diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 2000-11-20 04:41:45 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 2000-11-20 04:41:45 +0000 |
commit | 94bb9d581468116c659950d31288ce30f661f3d4 (patch) | |
tree | aa309bce3da72823e836c2c03a9141e43fa8ac50 | |
parent | c4a56e87080655ccac11c5e57fd27c4035d021f8 (diff) |
Notes
521 files changed, 9 insertions, 109834 deletions
diff --git a/contrib/awk/Makefile.in b/contrib/awk/Makefile.in deleted file mode 100644 index 2b464168c7397..0000000000000 --- a/contrib/awk/Makefile.in +++ /dev/null @@ -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 - diff --git a/contrib/awk/README_d/README.tests b/contrib/awk/README_d/README.tests deleted file mode 100644 index 1c969d754d4a7..0000000000000 --- a/contrib/awk/README_d/README.tests +++ /dev/null @@ -1,46 +0,0 @@ -Date: Sat, 22 Apr 2000 06:07:06 -0600 (MDT) -From: "Nelson H. F. Beebe" <beebe@math.utah.edu> -To: arnold@gnu.org -Cc: beebe@math.utah.edu, sysstaff@math.utah.edu, othmer@math.utah.edu -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. diff --git a/contrib/awk/aclocal.m4 b/contrib/awk/aclocal.m4 deleted file mode 100644 index 7ba39c39cdd6d..0000000000000 --- a/contrib/awk/aclocal.m4 +++ /dev/null @@ -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 <eggert@twinsun.com>. - -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 diff --git a/contrib/awk/alloca.c b/contrib/awk/alloca.c deleted file mode 100644 index 6bbd9839ba8b9..0000000000000 --- a/contrib/awk/alloca.c +++ /dev/null @@ -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 <jot@cray.com> 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 */ diff --git a/contrib/awk/awktab.c b/contrib/awk/awktab.c deleted file mode 100644 index 23aa4fb381e92..0000000000000 --- a/contrib/awk/awktab.c +++ /dev/null @@ -1,3983 +0,0 @@ - -/* A Bison parser, made from ./awk.y - by GNU Bison version 1.25 - */ - -#define YYBISON 1 /* Identify Bison output. */ - -#define FUNC_CALL 258 -#define NAME 259 -#define REGEXP 260 -#define ERROR 261 -#define YNUMBER 262 -#define YSTRING 263 -#define RELOP 264 -#define APPEND_OP 265 -#define ASSIGNOP 266 -#define MATCHOP 267 -#define NEWLINE 268 -#define CONCAT_OP 269 -#define LEX_BEGIN 270 -#define LEX_END 271 -#define LEX_IF 272 -#define LEX_ELSE 273 -#define LEX_RETURN 274 -#define LEX_DELETE 275 -#define LEX_WHILE 276 -#define LEX_DO 277 -#define LEX_FOR 278 -#define LEX_BREAK 279 -#define LEX_CONTINUE 280 -#define LEX_PRINT 281 -#define LEX_PRINTF 282 -#define LEX_NEXT 283 -#define LEX_EXIT 284 -#define LEX_FUNCTION 285 -#define LEX_GETLINE 286 -#define LEX_NEXTFILE 287 -#define LEX_IN 288 -#define LEX_AND 289 -#define LEX_OR 290 -#define INCREMENT 291 -#define DECREMENT 292 -#define LEX_BUILTIN 293 -#define LEX_LENGTH 294 -#define UNARY 295 - -#line 26 "./awk.y" - -#ifdef DEBUG -#define YYDEBUG 12 -#endif - -#include "awk.h" - -#define CAN_FREE TRUE -#define DONT_FREE FALSE - -#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ -static void yyerror(const char *m, ...) ; -#else -static void yyerror(); /* va_alist */ -#endif -static char *get_src_buf P((void)); -static int yylex P((void)); -static NODE *node_common P((NODETYPE op)); -static NODE *snode P((NODE *subn, NODETYPE op, int sindex)); -static NODE *mkrangenode P((NODE *cpair)); -static NODE *make_for_loop P((NODE *init, NODE *cond, NODE *incr)); -static NODE *append_right P((NODE *list, NODE *new)); -static void func_install P((NODE *params, NODE *def)); -static void pop_var P((NODE *np, int freeit)); -static void pop_params P((NODE *params)); -static NODE *make_param P((char *name)); -static NODE *mk_rexp P((NODE *exp)); -static int dup_parms P((NODE *func)); -static void param_sanity P((NODE *arglist)); -static int isnoeffect P((NODETYPE t)); -static int isassignable P((NODE *n)); - -enum defref { FUNC_DEFINE, FUNC_USE }; -static void func_use P((char *name, enum defref how)); -static void check_funcs P((void)); - -static int want_assign; /* lexical scanning kludge */ -static int want_regexp; /* lexical scanning kludge */ -static int can_return; /* lexical scanning kludge */ -static int io_allowed = TRUE; /* lexical scanning kludge */ -static char *lexptr; /* pointer to next char during parsing */ -static char *lexend; -static char *lexptr_begin; /* keep track of where we were for error msgs */ -static char *lexeme; /* beginning of lexeme for debugging */ -static char *thisline = NULL; -#define YYDEBUG_LEXER_TEXT (lexeme) -static int param_counter; -static char *tokstart = NULL; -static char *tok = NULL; -static char *tokend; - -#define HASHSIZE 1021 /* this constant only used here */ -NODE *variables[HASHSIZE]; - -extern char *source; -extern int sourceline; -extern struct src *srcfiles; -extern int numfiles; -extern int errcount; -extern NODE *begin_block; -extern NODE *end_block; - -#line 89 "./awk.y" -typedef union { - long lval; - AWKNUM fval; - NODE *nodeval; - NODETYPE nodetypeval; - char *sval; - NODE *(*ptrval)(); -} YYSTYPE; -#include <stdio.h> - -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif -#endif - - - -#define YYFINAL 312 -#define YYFLAG -32768 -#define YYNTBASE 62 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 295 ? yytranslate[x] : 107) - -static const char yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 51, 2, 2, 54, 50, 2, 2, 55, - 56, 48, 46, 42, 47, 2, 49, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 41, 61, 43, - 2, 44, 40, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 57, 2, 58, 53, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 59, 45, 60, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 52 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 4, 6, 9, 11, 14, 15, 16, 20, 21, - 25, 28, 31, 34, 36, 39, 42, 44, 46, 48, - 50, 52, 53, 61, 66, 71, 73, 77, 78, 83, - 89, 94, 96, 99, 101, 104, 106, 109, 112, 115, - 119, 121, 128, 137, 146, 157, 167, 170, 173, 180, - 185, 189, 192, 196, 197, 202, 209, 213, 216, 218, - 220, 227, 237, 239, 242, 243, 245, 246, 249, 250, - 253, 256, 259, 260, 262, 264, 268, 270, 273, 277, - 278, 280, 281, 283, 285, 289, 291, 294, 298, 302, - 303, 305, 307, 311, 313, 316, 320, 324, 325, 330, - 336, 341, 345, 349, 353, 357, 359, 362, 366, 370, - 374, 378, 384, 386, 389, 390, 395, 399, 403, 407, - 409, 412, 416, 420, 424, 430, 432, 435, 437, 441, - 445, 449, 453, 457, 461, 464, 467, 470, 474, 479, - 484, 486, 491, 493, 496, 499, 501, 503, 506, 509, - 510, 512, 514, 519, 522, 525, 528, 530, 531, 533, - 535 -}; - -static const short yyrhs[] = { 83, - 63, 83, 0, 64, 0, 63, 64, 0, 1, 0, - 63, 1, 0, 0, 0, 15, 65, 75, 0, 0, - 16, 66, 75, 0, 15, 77, 0, 16, 77, 0, - 72, 75, 0, 75, 0, 72, 77, 0, 69, 71, - 0, 4, 0, 3, 0, 68, 0, 38, 0, 39, - 0, 0, 30, 70, 67, 55, 86, 103, 83, 0, - 101, 76, 102, 104, 0, 101, 102, 104, 83, 0, - 93, 0, 93, 42, 93, 0, 0, 49, 74, 5, - 49, 0, 101, 76, 102, 104, 83, 0, 101, 102, - 104, 83, 0, 78, 0, 76, 78, 0, 1, 0, - 76, 1, 0, 82, 0, 105, 83, 0, 105, 83, - 0, 101, 102, 0, 101, 76, 102, 0, 81, 0, - 21, 55, 93, 103, 83, 78, 0, 22, 83, 78, - 21, 55, 93, 103, 83, 0, 23, 55, 4, 33, - 4, 103, 83, 78, 0, 23, 55, 88, 105, 93, - 105, 88, 103, 83, 78, 0, 23, 55, 88, 105, - 105, 88, 103, 83, 78, 0, 24, 77, 0, 25, - 77, 0, 80, 55, 92, 103, 85, 77, 0, 80, - 89, 85, 77, 0, 28, 88, 77, 0, 32, 77, - 0, 29, 88, 77, 0, 0, 19, 79, 88, 77, - 0, 20, 4, 57, 92, 58, 77, 0, 20, 4, - 77, 0, 93, 77, 0, 26, 0, 27, 0, 17, - 55, 93, 103, 83, 78, 0, 17, 55, 93, 103, - 83, 78, 18, 83, 78, 0, 13, 0, 82, 13, - 0, 0, 82, 0, 0, 43, 97, 0, 0, 44, - 93, 0, 10, 93, 0, 45, 93, 0, 0, 87, - 0, 4, 0, 87, 106, 4, 0, 1, 0, 87, - 1, 0, 87, 106, 1, 0, 0, 93, 0, 0, - 90, 0, 95, 0, 90, 106, 95, 0, 1, 0, - 90, 1, 0, 90, 1, 95, 0, 90, 106, 1, - 0, 0, 92, 0, 93, 0, 92, 106, 93, 0, - 1, 0, 92, 1, 0, 92, 1, 93, 0, 92, - 106, 1, 0, 0, 100, 11, 94, 93, 0, 55, - 92, 103, 33, 4, 0, 93, 45, 31, 99, 0, - 31, 99, 84, 0, 93, 34, 93, 0, 93, 35, - 93, 0, 93, 12, 93, 0, 73, 0, 51, 73, - 0, 93, 33, 4, 0, 93, 9, 93, 0, 93, - 43, 93, 0, 93, 44, 93, 0, 93, 40, 93, - 41, 93, 0, 97, 0, 93, 97, 0, 0, 100, - 11, 96, 95, 0, 95, 34, 95, 0, 95, 35, - 95, 0, 31, 99, 84, 0, 73, 0, 51, 73, - 0, 95, 12, 95, 0, 95, 33, 4, 0, 95, - 9, 95, 0, 95, 40, 95, 41, 95, 0, 97, - 0, 95, 97, 0, 98, 0, 97, 53, 97, 0, - 97, 48, 97, 0, 97, 49, 97, 0, 97, 50, - 97, 0, 97, 46, 97, 0, 97, 47, 97, 0, - 100, 36, 0, 100, 37, 0, 51, 97, 0, 55, - 93, 103, 0, 38, 55, 91, 103, 0, 39, 55, - 91, 103, 0, 39, 0, 3, 55, 91, 103, 0, - 100, 0, 36, 100, 0, 37, 100, 0, 7, 0, - 8, 0, 47, 97, 0, 46, 97, 0, 0, 100, - 0, 4, 0, 4, 57, 92, 58, 0, 54, 98, - 0, 59, 83, 0, 60, 83, 0, 56, 0, 0, - 105, 0, 61, 0, 42, 83, 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 150, 158, 166, 182, 183, 184, 188, 190, 204, 206, - 220, 226, 232, 234, 236, 249, 258, 260, 262, 272, - 273, 277, 281, 296, 301, 310, 312, 321, 323, 341, - 343, 348, 354, 362, 364, 369, 370, 374, 376, 378, - 380, 382, 384, 386, 413, 417, 422, 425, 428, 430, - 450, 489, 508, 510, 515, 517, 519, 533, 538, 540, - 545, 550, 557, 559, 563, 564, 568, 570, 575, 577, - 579, 581, 586, 588, 593, 595, 597, 599, 601, 607, - 609, 614, 616, 621, 623, 629, 631, 633, 635, 640, - 642, 647, 649, 655, 657, 659, 661, 666, 669, 674, - 676, 681, 687, 689, 691, 697, 707, 715, 717, 723, - 725, 727, 729, 731, 736, 739, 740, 742, 744, 750, - 752, 754, 756, 758, 760, 762, 764, 769, 771, 773, - 775, 777, 779, 781, 783, 785, 790, 792, 794, 797, - 799, 807, 814, 815, 817, 819, 821, 824, 832, 843, - 845, 850, 852, 862, 867, 871, 875, 879, 880, 884, - 887 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","FUNC_CALL", -"NAME","REGEXP","ERROR","YNUMBER","YSTRING","RELOP","APPEND_OP","ASSIGNOP","MATCHOP", -"NEWLINE","CONCAT_OP","LEX_BEGIN","LEX_END","LEX_IF","LEX_ELSE","LEX_RETURN", -"LEX_DELETE","LEX_WHILE","LEX_DO","LEX_FOR","LEX_BREAK","LEX_CONTINUE","LEX_PRINT", -"LEX_PRINTF","LEX_NEXT","LEX_EXIT","LEX_FUNCTION","LEX_GETLINE","LEX_NEXTFILE", -"LEX_IN","LEX_AND","LEX_OR","INCREMENT","DECREMENT","LEX_BUILTIN","LEX_LENGTH", -"'?'","':'","','","'<'","'>'","'|'","'+'","'-'","'*'","'/'","'%'","'!'","UNARY", -"'^'","'$'","'('","')'","'['","']'","'{'","'}'","';'","start","program","rule", -"@1","@2","func_name","lex_builtin","function_prologue","@3","function_body", -"pattern","regexp","@4","action","statements","statement_term","statement","@5", -"print","if_statement","nls","opt_nls","input_redir","output_redir","opt_param_list", -"param_list","opt_exp","opt_rexpression_list","rexpression_list","opt_expression_list", -"expression_list","exp","@6","rexp","@7","simp_exp","non_post_simp_exp","opt_variable", -"variable","l_brace","r_brace","r_paren","opt_semi","semi","comma", NULL -}; -#endif - -static const short yyr1[] = { 0, - 62, 63, 63, 63, 63, 63, 65, 64, 66, 64, - 64, 64, 64, 64, 64, 64, 67, 67, 67, 68, - 68, 70, 69, 71, 71, 72, 72, 74, 73, 75, - 75, 76, 76, 76, 76, 77, 77, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 79, 78, 78, 78, 78, 80, 80, - 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, - 85, 85, 86, 86, 87, 87, 87, 87, 87, 88, - 88, 89, 89, 90, 90, 90, 90, 90, 90, 91, - 91, 92, 92, 92, 92, 92, 92, 94, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 96, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 99, - 99, 100, 100, 100, 101, 102, 103, 104, 104, 105, - 106 -}; - -static const short yyr2[] = { 0, - 3, 1, 2, 1, 2, 0, 0, 3, 0, 3, - 2, 2, 2, 1, 2, 2, 1, 1, 1, 1, - 1, 0, 7, 4, 4, 1, 3, 0, 4, 5, - 4, 1, 2, 1, 2, 1, 2, 2, 2, 3, - 1, 6, 8, 8, 10, 9, 2, 2, 6, 4, - 3, 2, 3, 0, 4, 6, 3, 2, 1, 1, - 6, 9, 1, 2, 0, 1, 0, 2, 0, 2, - 2, 2, 0, 1, 1, 3, 1, 2, 3, 0, - 1, 0, 1, 1, 3, 1, 2, 3, 3, 0, - 1, 1, 3, 1, 2, 3, 3, 0, 4, 5, - 4, 3, 3, 3, 3, 1, 2, 3, 3, 3, - 3, 5, 1, 2, 0, 4, 3, 3, 3, 1, - 2, 3, 3, 3, 5, 1, 2, 1, 3, 3, - 3, 3, 3, 3, 2, 2, 2, 3, 4, 4, - 1, 4, 1, 2, 2, 1, 1, 2, 2, 0, - 1, 1, 4, 2, 2, 2, 1, 0, 1, 1, - 2 -}; - -static const short yydefact[] = { 65, - 63, 66, 0, 64, 4, 0, 152, 146, 147, 7, - 9, 22, 150, 0, 0, 0, 141, 0, 0, 28, - 0, 0, 0, 65, 0, 2, 0, 0, 106, 14, - 26, 113, 128, 143, 0, 0, 0, 160, 0, 11, - 36, 65, 0, 12, 0, 67, 151, 144, 145, 0, - 0, 0, 0, 149, 143, 148, 0, 107, 137, 154, - 143, 94, 0, 92, 155, 5, 3, 1, 16, 0, - 13, 15, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 114, 0, 0, 0, 0, 0, 0, 98, - 135, 136, 34, 0, 54, 0, 0, 65, 0, 0, - 0, 59, 60, 80, 80, 0, 65, 0, 32, 0, - 41, 0, 0, 158, 65, 0, 0, 92, 0, 8, - 37, 10, 18, 17, 20, 21, 0, 19, 0, 102, - 0, 0, 0, 0, 95, 65, 157, 0, 0, 138, - 0, 158, 109, 105, 108, 103, 104, 0, 27, 110, - 111, 150, 133, 134, 130, 131, 132, 129, 0, 0, - 80, 0, 0, 0, 80, 47, 48, 0, 81, 0, - 52, 156, 35, 33, 158, 86, 150, 0, 0, 120, - 69, 0, 84, 126, 143, 58, 0, 39, 65, 159, - 38, 142, 153, 0, 68, 139, 140, 29, 96, 161, - 0, 97, 93, 158, 65, 0, 101, 99, 0, 0, - 0, 57, 0, 0, 152, 0, 51, 53, 65, 67, - 121, 0, 0, 0, 0, 0, 87, 0, 0, 0, - 0, 0, 0, 0, 127, 115, 40, 31, 77, 75, - 0, 0, 100, 24, 25, 112, 65, 55, 0, 65, - 0, 0, 0, 30, 119, 69, 71, 70, 72, 50, - 88, 89, 85, 124, 122, 123, 117, 118, 0, 0, - 65, 78, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 0, 116, 23, 79, 76, 61, 56, 42, 0, - 65, 80, 0, 49, 125, 65, 65, 0, 0, 65, - 0, 43, 44, 65, 0, 62, 0, 46, 45, 0, - 0, 0 -}; - -static const short yydefgoto[] = { 310, - 25, 26, 39, 43, 127, 128, 27, 45, 69, 28, - 29, 57, 30, 108, 40, 109, 161, 110, 111, 2, - 3, 130, 226, 241, 242, 168, 181, 182, 116, 117, - 112, 159, 183, 270, 32, 33, 46, 34, 113, 114, - 140, 189, 42, 139 -}; - -static const short yypact[] = { -6, --32768, 0, 875,-32768,-32768, -40, -38,-32768,-32768, -7, - -7,-32768, 10, 10, 10, -31, -26, 1735, 1735,-32768, - 1715, 1735, 1131, -6, 932,-32768, -24, 72,-32768,-32768, - 1304, 205,-32768, 5, 709, 1110, 1131,-32768, -24,-32768, - 0, -6, -24,-32768, 85, 3,-32768,-32768,-32768, 1110, - 1110, 1735, 1620, 8, 106, 8, 81,-32768, 8,-32768, --32768,-32768, 37, 1250,-32768,-32768,-32768,-32768,-32768, 709, --32768,-32768, 1620, 1620, 90, 1620, 1620, 1620, 1620, 1620, - 1620, 65, 205, 1735, 1735, 1735, 1735, 1735, 1735,-32768, --32768,-32768,-32768, 50,-32768, 111, 70, -6, 93, -7, - -7,-32768,-32768, 1620, 1620, -7, -6, 758,-32768, 819, --32768, 1040, 709, 100, -6, 99, 55, 1402, 9,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 109,-32768, 1735,-32768, - 99, 99, 1250, 119, 1620, -6,-32768, 133, 1180,-32768, - 758, 100, 1327, 794,-32768, 1515, 1451, 1353, 1402, 1327, - 1327, 10, 125, 125, 8, 8, 8, 8, 1620, 1620, - 1620, 42, 1620, 981, 1657,-32768,-32768, -7, 1402, -7, --32768,-32768,-32768,-32768, 100,-32768, 10, 1715, 1131,-32768, - 96, 39, 1538, 205, 117,-32768, 758,-32768, -6,-32768, --32768,-32768,-32768, 7, 205,-32768,-32768,-32768, 1402,-32768, - 166,-32768, 1402, 100, -6, 1620,-32768, 1402, 1250, -7, - 1131,-32768, 1250, 151, -12, 100,-32768,-32768, -6, 3, --32768, 37, 1620, 1620, 1620, -7, 1678, 1201, 1678, 1678, - 181, 1678, 1678, 1678, 205,-32768,-32768,-32768,-32768,-32768, - 99, 56,-32768,-32768,-32768, 1402, -6,-32768, 11, -6, - 131, 183, 1061,-32768,-32768, 96, 1402, 1402, 1402,-32768, - 1538,-32768, 1538, 635, 83,-32768, 1599, 1579, 1474, 1678, - -6,-32768, 103, 981, -7, 981, 1620, 99, 623, 1620, - -7, 1678, 1538,-32768,-32768,-32768, 170,-32768,-32768, 1250, - -6, 1620, 99,-32768, 1538, -6, -6, 981, 99, -6, - 981,-32768,-32768, -6, 981,-32768, 981,-32768,-32768, 190, - 191,-32768 -}; - -static const short yypgoto[] = {-32768, --32768, 167,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 211,-32768, 107, -53, 315, -105,-32768,-32768,-32768, 199, - 97, -22, -62,-32768,-32768, -103,-32768,-32768, 94, -14, - -3,-32768, -202,-32768, 318, 177, -134, 95, 124, -69, - 407, -138, 420, -177 -}; - - -#define YYLAST 1790 - - -static const short yytable[] = { 31, - 142, 170, 174, 205, 228, 1, 1, 239, 63, 135, - 240, 135, 4, 7, 36, 90, 141, 207, 37, 64, - 252, 31, 119, 50, 261, 263, 264, 265, 51, 267, - 268, 269, 118, 118, 24, 174, 219, 135, 175, 227, - 91, 92, 220, 188, 37, 129, 118, 118, -83, 133, - 136, -83, 136, 38, 1, 135, 272, 210, 214, 187, - 89, 216, -73, 22, 273, 244, 193, 283, 275, 143, - 144, 204, 146, 147, 148, 149, 150, 151, 136, 295, - 136, 174, -83, -83, 1, 134, 7, 123, 124, 8, - 9, 229, 137, 145,-32768, 152, 136, 136, 211, -83, - 169, 169, 38, 285, 160, 223, 286, 47, 48, 49, - -91, -74, 55, 55, 162, 55, 61, 237, 14, 15, - 65, 68, 125, 126, 163, 55, 35, 236, 18, 19, - 24, 199, 38, 52, 71, 203, 22, 53, 121, 224, - 225, 91, 92, 131, 132, 120, 55, 165, 35, 122, - 70, 35, 91, 92, 137, 208, 209, 169, 55, 213, - 38, 169, 35, 194, 222, 201, 35, 198, 287, 243, - 289, 251, 86, 87, 88, 64, 293, 89, 55, 55, - 55, 55, 55, 55, 266, 277, 278, 296, 299, 311, - 312, 67, 303, 281, 164, 306, 249, 255, 60, 308, - 0, 309, 246, 172, 185, 0, 55, 118, 41, 41, - 0, 191, 55, 0, 0, 0, 0, 0, 0, 257, - 258, 259, 0, 55, 0, 0, 41, 55, 0, 0, - 0, 58, 200, 0, 0, 0, 0, 55, 55, 0, - 55, 55, 55, 55, 55, 55, 47, 0, 0, 279, - 84, 85, 86, 87, 88, 0, 0, 89, 0, 0, - 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, - 0, 47, 55, 290, 0, 0, 169, 55, 0, 0, - 0, 0, 0, 0, 0, 238, 0, 0, 169, 0, - 0, 0, 0, 55, 0, 0, 0, 55, 41, 41, - 0, 245, 55, 55, 41, 0, 0, 55, 0, 0, - 41, 0, 0, 0, 0, 254, 0, 0, 0, 0, - 180, 185, 185, 185, 185, 44, 185, 185, 185, 0, - 0, 0, 0, 0, 0, 54, 56, 0, 59, 0, - 55, 0, 72, 274, 0, 0, 276, 0, 83, 0, - 0, 55, 55, 55, 0, 55, 0, 55, 55, 55, - 41, 55, 55, 55, 185, 0, 41, 284, 41, 59, - 0, 0, 0, 55, 0, 0, 185, 55, 0, 0, - 0, 83, 0, 0, 55, 0, 0, 298, 221, 55, - 0, 0, 301, 302, 0, 0, 305, 0, 0, 0, - 307, 153, 154, 155, 156, 157, 158, 0, 41, 0, - 0, 0, 0, 0, 166, 167, 0, 0, 0, 0, - 171, 0, 0, 0, 41, 0, 186, 184, 0, 83, - 0, 0, 0, 0, 0, 83, 0, 180, 180, 180, - 180, 0, 180, 180, 180, 0, 195, 0, 0, 0, - 83, 0, 0, 0, 115, 0, 0, 0, 0, 0, - 83, 83, 0, 83, 83, 83, 83, 83, 83, 138, - 0, 0, 0, 41, 0, 0, 212, 0, 0, 41, - 180, 0, 217, 0, 218, 0, 83, 0, 0, 115, - 0, 0, 180, 0, 0, 59, 0, 0, 0, 0, - 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 83, 0, 0, 0, - 83, 0, 192, 0, 248, 83, 83, 115, 0, 0, - 83, 0, 115, 190, 0, 0, 0, 196, 197, 0, - 260, 0, 0, 0, 184, 184, 184, 184, 0, 184, - 184, 184, 0, 0, 0, 0, 0, 0, 0, 0, - 115, 190, 0, 83, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 83, 83, 83, 0, 235, 0, - 235, 235, 235, 115, 235, 235, 235, 184, 0, 288, - 0, 0, 0, 0, 190, 294, 83, 0, 0, 184, - 235, 0, 0, 0, 0, 0, 115, 83, 0, 0, - 0, 0, 235, 0, 0, 247, 0, 0, 0, 250, - 0, 0, 0, 190, 0, 6, 7, 0, 256, 8, - 9, 73, 0, 0, 74, 253, 0, 0, 7, 0, - 0, 8, 9,-32768, 0, 0, 0, 271, 0, 0, - 0, 0, 0, 0, 0, 75, 76, 77, 14, 15, - 16, 17, 78, 0, 0, 80, 81, 82, 18, 19, - 14, 15, 280, 52, 0, 0, 22, 53, 0, 0, - 18, 19, 0, 38, 291, 52, 0, 0, 22, 53, - 0, 0, 0, 115, 0, 115, 297, 0, 292, 300, - 0, 0, 0, 0, 0, 304, 0, 0, 0, 93, - 0, 6, 7, 0, 0, 8, 9, 115, 0, 0, - 115, 0, 0, 0, 115, 94, 115, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 0, 13, - 106, 0, 0, 0, 14, 15, 16, 17, 0, 0, - 0, 0, 0, 0, 18, 19, 0, 20, 173, 21, - 6, 7, 22, 23, 8, 9, 0, 24, 107, 38, - 0, 0, 0, 0, 94, 0, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 0, 13, 106, - 0, 0, 0, 14, 15, 16, 17, 7, 0, 0, - 8, 9, 73, 18, 19,-32768, 20, 0, 21, 0, - 0, 22, 23, 0, 0, 0, 24, 107, 38, 176, - 0, 6, 7, 0, 0, 8, 9, 0, -82, 14, - 15, -82, 0, 0, 0, 0, 80, 81, 82, 18, - 19, 0, 0, 0, 52, 0, 0, 22, 53, 177, - 0, 0, 0, 0, 14, 15, 16, 17, 0, 0, - 0, 0, -82, -82, 18, 19, 0, 20, 0, 178, - 0, 0, 22, 179, -6, 5, 0, 6, 7, -82, - 0, 8, 9, 0, 0, 0, 0, -6, 0, 10, - 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 12, 13, 0, 0, 0, 0, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 21, 0, 0, 22, 23, - 0, -65, 66, 24, 6, 7, 0, 0, 8, 9, - 0, 0, 0, 0, 1, 0, 10, 11, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 12, 13, 0, 0, 0, 0, 14, 15, 16, - 17, 0, 0, 0, 0, 0, 0, 18, 19, 0, - 20, 0, 21, 6, 7, 22, 23, 8, 9, 0, - 24, 0, 0, 0, 0, 0, 0, 94, 0, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 0, 13, 106, 0, 0, 0, 14, 15, 16, 17, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 0, 21, 0, 0, 22, 23, 0, 0, 0, 24, - 0, 38, 6, 7, 0, 0, 8, 9, 73, 0, - 0, 74, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 6, 7, 0, 0, 8, 9, 0, - 0, 0, 75, 76, 77, 14, 15, 16, 17, 78, - 0, 0, 80, 81, 82, 18, 19, 0, 0, 0, - 52, 13, 0, 22, 53, 0, 14, 15, 16, 17, - 38, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 62, 21, 6, 7, 22, 23, 8, 9, 0, 0, - 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 62, 0, 6, 7, 0, 0, 8, 9, 0, - 13, 0, 0, 0, 0, 14, 15, 16, 17, 0, - 0, 0, 0, 0, 0, 18, 19, 0, 20, 0, - 21, 13, 0, 22, 23, -90, 14, 15, 16, 17, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 202, 21, 6, 7, 22, 23, 8, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 262, 0, 6, 7, 0, 0, 8, 9, 0, - 13, 0, 0, 0, 0, 14, 15, 16, 17, 0, - 0, 0, 0, 0, 0, 18, 19, 0, 20, 0, - 21, 177, 0, 22, 23, 0, 14, 15, 16, 17, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 0, 178, 6, 7, 22, 53, 8, 9, 73, 0, - 0, 74, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 75, 76, 77, 14, 15, 16, 17, 78, - 0, 0, 80, 81, 82, 18, 19, 0, 0, 0, - 52, 0, 0, 22, 53, 137, 6, 7, 0, 0, - 8, 9, 73, 0, 0, 74, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 0, 0, 8, 9,-32768, 75, 76, 77, 14, - 15, 16, 17, 78, 0, 79, 80, 81, 82, 18, - 19, 0, 0, 0, 52, 6, 7, 22, 53, 8, - 9, 73, 14, 15, 74, 0, 0, 0, 0,-32768, --32768,-32768, 18, 19, 0, 0, 0, 52, 0, 0, - 22, 53, 0, 0, 0, 75, 76, 77, 14, 15, - 16, 17, 78, 206, 0, 80, 81, 82, 18, 19, - 0, 0, 0, 52, 6, 7, 22, 53, 8, 9, - 73, 0, 0, 74, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75, 76, 77, 14, 15, 16, - 17, 78, 0, 0, 80, 81, 82, 18, 19, 0, - 0, 0, 52, 6, 7, 22, 53, 8, 9, 73, - 0, 0, 74, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 6, 7, 0, 0, - 8, 9, 229, 75, 76, 230, 14, 15, 16, 17, - 0, 0, 0, 80, 81, 82, 18, 19, 0, 0, - 0, 52, 0, 0, 22, 53, 231, 232, 233, 14, - 15, 16, 17, 234, 282, 0, 0, 6, 7, 18, - 19, 8, 9, 73, 52, 0, 74, 22, 53, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 7, 0, 0, 8, 9, 229, 75, 0, 230, - 14, 15, 16, 17, 0, 0, 0, 80, 81, 82, - 18, 19, 0, 0, 0, 52, 0, 0, 22, 53, - 231, 232, 233, 14, 15, 16, 17, 234, 0, 0, - 0, 6, 7, 18, 19, 8, 9, 229, 52, 0, - 230, 22, 53, 0, 0, 0, 0, 0, 0, 0, - 0, 6, 7, 0, 0, 8, 9, 229, 0, 0, - 230, 231, 232, 0, 14, 15, 16, 17, 0, 0, - 0, 0, 6, 7, 18, 19, 8, 9, 0, 52, - 0, 231, 22, 53, 14, 15, 16, 17, 0, 0, - 0, 0, 0, 0, 18, 19, 0, 0, 0, 52, - 13, 0, 22, 53, 0, 14, 15, 16, 17, 6, - 215, 0, 0, 8, 9, 18, 19, 0, 20, 0, - 21, 0, 0, 22, 23, 0, 0, 0, 0, 0, - 6, 7, 0, 0, 8, 9, 0, 13, 0, 0, - 0, 0, 14, 15, 16, 17, 0, 0, 0, 0, - 0, 0, 18, 19, 0, 20, 0, 21, 177, 0, - 22, 23, 0, 14, 15, 16, 17, 6, 7, 0, - 0, 8, 9, 18, 19, 0, 20, 0, 178, 0, - 0, 22, 53, 0, 0, 0, 0, 6, 7, 0, - 0, 8, 9, 0, 0, 0, 0, 0, 0, 0, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 52, 0, 0, 22, 53, - 14, 15, 16, 17, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 0, 0, 52, 0, 0, 22, 53 -}; - -static const short yycheck[] = { 3, - 70, 105, 108, 142, 182, 13, 13, 1, 23, 1, - 4, 1, 13, 4, 55, 11, 70, 152, 57, 23, - 33, 25, 37, 55, 227, 228, 229, 230, 55, 232, - 233, 234, 36, 37, 59, 141, 175, 1, 108, 1, - 36, 37, 177, 113, 57, 43, 50, 51, 10, 53, - 42, 13, 42, 61, 13, 1, 1, 161, 164, 113, - 53, 165, 56, 54, 242, 204, 58, 270, 58, 73, - 74, 141, 76, 77, 78, 79, 80, 81, 42, 282, - 42, 187, 44, 45, 13, 5, 4, 3, 4, 7, - 8, 9, 56, 4, 12, 31, 42, 42, 57, 61, - 104, 105, 61, 1, 55, 10, 4, 13, 14, 15, - 56, 56, 18, 19, 4, 21, 22, 187, 36, 37, - 24, 25, 38, 39, 55, 31, 3, 11, 46, 47, - 59, 135, 61, 51, 28, 139, 54, 55, 42, 44, - 45, 36, 37, 50, 51, 39, 52, 55, 25, 43, - 27, 28, 36, 37, 56, 159, 160, 161, 64, 163, - 61, 165, 39, 55, 179, 33, 43, 49, 274, 4, - 276, 21, 48, 49, 50, 179, 280, 53, 84, 85, - 86, 87, 88, 89, 4, 55, 4, 18, 292, 0, - 0, 25, 298, 256, 98, 301, 211, 220, 22, 305, - -1, 307, 206, 107, 110, -1, 112, 211, 10, 11, - -1, 115, 118, -1, -1, -1, -1, -1, -1, 223, - 224, 225, -1, 129, -1, -1, 28, 133, -1, -1, - -1, 21, 136, -1, -1, -1, -1, 143, 144, -1, - 146, 147, 148, 149, 150, 151, 152, -1, -1, 253, - 46, 47, 48, 49, 50, -1, -1, 53, -1, -1, - -1, -1, -1, 169, -1, -1, -1, -1, -1, -1, - -1, 177, 178, 277, -1, -1, 280, 183, -1, -1, - -1, -1, -1, -1, -1, 189, -1, -1, 292, -1, - -1, -1, -1, 199, -1, -1, -1, 203, 100, 101, - -1, 205, 208, 209, 106, -1, -1, 213, -1, -1, - 112, -1, -1, -1, -1, 219, -1, -1, -1, -1, - 110, 227, 228, 229, 230, 11, 232, 233, 234, -1, - -1, -1, -1, -1, -1, 18, 19, -1, 21, -1, - 246, -1, 28, 247, -1, -1, 250, -1, 31, -1, - -1, 257, 258, 259, -1, 261, -1, 263, 264, 265, - 162, 267, 268, 269, 270, -1, 168, 271, 170, 52, - -1, -1, -1, 279, -1, -1, 282, 283, -1, -1, - -1, 64, -1, -1, 290, -1, -1, 291, 178, 295, - -1, -1, 296, 297, -1, -1, 300, -1, -1, -1, - 304, 84, 85, 86, 87, 88, 89, -1, 210, -1, - -1, -1, -1, -1, 100, 101, -1, -1, -1, -1, - 106, -1, -1, -1, 226, -1, 112, 110, -1, 112, - -1, -1, -1, -1, -1, 118, -1, 227, 228, 229, - 230, -1, 232, 233, 234, -1, 129, -1, -1, -1, - 133, -1, -1, -1, 35, -1, -1, -1, -1, -1, - 143, 144, -1, 146, 147, 148, 149, 150, 151, 63, - -1, -1, -1, 275, -1, -1, 162, -1, -1, 281, - 270, -1, 168, -1, 170, -1, 169, -1, -1, 70, - -1, -1, 282, -1, -1, 178, -1, -1, -1, -1, - 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, - 203, -1, 116, -1, 210, 208, 209, 108, -1, -1, - 213, -1, 113, 114, -1, -1, -1, 131, 132, -1, - 226, -1, -1, -1, 227, 228, 229, 230, -1, 232, - 233, 234, -1, -1, -1, -1, -1, -1, -1, -1, - 141, 142, -1, 246, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 257, 258, 259, -1, 261, -1, - 263, 264, 265, 164, 267, 268, 269, 270, -1, 275, - -1, -1, -1, -1, 175, 281, 279, -1, -1, 282, - 283, -1, -1, -1, -1, -1, 187, 290, -1, -1, - -1, -1, 295, -1, -1, 209, -1, -1, -1, 213, - -1, -1, -1, 204, -1, 3, 4, -1, 222, 7, - 8, 9, -1, -1, 12, 216, -1, -1, 4, -1, - -1, 7, 8, 9, -1, -1, -1, 241, -1, -1, - -1, -1, -1, -1, -1, 33, 34, 35, 36, 37, - 38, 39, 40, -1, -1, 43, 44, 45, 46, 47, - 36, 37, 253, 51, -1, -1, 54, 55, -1, -1, - 46, 47, -1, 61, 278, 51, -1, -1, 54, 55, - -1, -1, -1, 274, -1, 276, 290, -1, 279, 293, - -1, -1, -1, -1, -1, 299, -1, -1, -1, 1, - -1, 3, 4, -1, -1, 7, 8, 298, -1, -1, - 301, -1, -1, -1, 305, 17, 307, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, -1, 31, - 32, -1, -1, -1, 36, 37, 38, 39, -1, -1, - -1, -1, -1, -1, 46, 47, -1, 49, 1, 51, - 3, 4, 54, 55, 7, 8, -1, 59, 60, 61, - -1, -1, -1, -1, 17, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, -1, 31, 32, - -1, -1, -1, 36, 37, 38, 39, 4, -1, -1, - 7, 8, 9, 46, 47, 12, 49, -1, 51, -1, - -1, 54, 55, -1, -1, -1, 59, 60, 61, 1, - -1, 3, 4, -1, -1, 7, 8, -1, 10, 36, - 37, 13, -1, -1, -1, -1, 43, 44, 45, 46, - 47, -1, -1, -1, 51, -1, -1, 54, 55, 31, - -1, -1, -1, -1, 36, 37, 38, 39, -1, -1, - -1, -1, 44, 45, 46, 47, -1, 49, -1, 51, - -1, -1, 54, 55, 0, 1, -1, 3, 4, 61, - -1, 7, 8, -1, -1, -1, -1, 13, -1, 15, - 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 30, 31, -1, -1, -1, -1, - 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, - 46, 47, -1, 49, -1, 51, -1, -1, 54, 55, - -1, 0, 1, 59, 3, 4, -1, -1, 7, 8, - -1, -1, -1, -1, 13, -1, 15, 16, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 30, 31, -1, -1, -1, -1, 36, 37, 38, - 39, -1, -1, -1, -1, -1, -1, 46, 47, -1, - 49, -1, 51, 3, 4, 54, 55, 7, 8, -1, - 59, -1, -1, -1, -1, -1, -1, 17, -1, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - -1, 31, 32, -1, -1, -1, 36, 37, 38, 39, - -1, -1, -1, -1, -1, -1, 46, 47, -1, 49, - -1, 51, -1, -1, 54, 55, -1, -1, -1, 59, - -1, 61, 3, 4, -1, -1, 7, 8, 9, -1, - -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 3, 4, -1, -1, 7, 8, -1, - -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, - -1, -1, 43, 44, 45, 46, 47, -1, -1, -1, - 51, 31, -1, 54, 55, -1, 36, 37, 38, 39, - 61, -1, -1, -1, -1, -1, 46, 47, -1, 49, - 1, 51, 3, 4, 54, 55, 7, 8, -1, -1, - -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 1, -1, 3, 4, -1, -1, 7, 8, -1, - 31, -1, -1, -1, -1, 36, 37, 38, 39, -1, - -1, -1, -1, -1, -1, 46, 47, -1, 49, -1, - 51, 31, -1, 54, 55, 56, 36, 37, 38, 39, - -1, -1, -1, -1, -1, -1, 46, 47, -1, 49, - 1, 51, 3, 4, 54, 55, 7, 8, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 1, -1, 3, 4, -1, -1, 7, 8, -1, - 31, -1, -1, -1, -1, 36, 37, 38, 39, -1, - -1, -1, -1, -1, -1, 46, 47, -1, 49, -1, - 51, 31, -1, 54, 55, -1, 36, 37, 38, 39, - -1, -1, -1, -1, -1, -1, 46, 47, -1, 49, - -1, 51, 3, 4, 54, 55, 7, 8, 9, -1, - -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 33, 34, 35, 36, 37, 38, 39, 40, - -1, -1, 43, 44, 45, 46, 47, -1, -1, -1, - 51, -1, -1, 54, 55, 56, 3, 4, -1, -1, - 7, 8, 9, -1, -1, 12, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 4, -1, -1, 7, 8, 9, 33, 34, 35, 36, - 37, 38, 39, 40, -1, 42, 43, 44, 45, 46, - 47, -1, -1, -1, 51, 3, 4, 54, 55, 7, - 8, 9, 36, 37, 12, -1, -1, -1, -1, 43, - 44, 45, 46, 47, -1, -1, -1, 51, -1, -1, - 54, 55, -1, -1, -1, 33, 34, 35, 36, 37, - 38, 39, 40, 41, -1, 43, 44, 45, 46, 47, - -1, -1, -1, 51, 3, 4, 54, 55, 7, 8, - 9, -1, -1, 12, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 33, 34, 35, 36, 37, 38, - 39, 40, -1, -1, 43, 44, 45, 46, 47, -1, - -1, -1, 51, 3, 4, 54, 55, 7, 8, 9, - -1, -1, 12, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 3, 4, -1, -1, - 7, 8, 9, 33, 34, 12, 36, 37, 38, 39, - -1, -1, -1, 43, 44, 45, 46, 47, -1, -1, - -1, 51, -1, -1, 54, 55, 33, 34, 35, 36, - 37, 38, 39, 40, 41, -1, -1, 3, 4, 46, - 47, 7, 8, 9, 51, -1, 12, 54, 55, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 3, 4, -1, -1, 7, 8, 9, 33, -1, 12, - 36, 37, 38, 39, -1, -1, -1, 43, 44, 45, - 46, 47, -1, -1, -1, 51, -1, -1, 54, 55, - 33, 34, 35, 36, 37, 38, 39, 40, -1, -1, - -1, 3, 4, 46, 47, 7, 8, 9, 51, -1, - 12, 54, 55, -1, -1, -1, -1, -1, -1, -1, - -1, 3, 4, -1, -1, 7, 8, 9, -1, -1, - 12, 33, 34, -1, 36, 37, 38, 39, -1, -1, - -1, -1, 3, 4, 46, 47, 7, 8, -1, 51, - -1, 33, 54, 55, 36, 37, 38, 39, -1, -1, - -1, -1, -1, -1, 46, 47, -1, -1, -1, 51, - 31, -1, 54, 55, -1, 36, 37, 38, 39, 3, - 4, -1, -1, 7, 8, 46, 47, -1, 49, -1, - 51, -1, -1, 54, 55, -1, -1, -1, -1, -1, - 3, 4, -1, -1, 7, 8, -1, 31, -1, -1, - -1, -1, 36, 37, 38, 39, -1, -1, -1, -1, - -1, -1, 46, 47, -1, 49, -1, 51, 31, -1, - 54, 55, -1, 36, 37, 38, 39, 3, 4, -1, - -1, 7, 8, 46, 47, -1, 49, -1, 51, -1, - -1, 54, 55, -1, -1, -1, -1, 3, 4, -1, - -1, 7, 8, -1, -1, -1, -1, -1, -1, -1, - 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, - 46, 47, -1, 49, -1, 51, -1, -1, 54, 55, - 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, - 46, 47, -1, -1, -1, 51, -1, -1, 54, 55 -}; -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/share/bison.simple" - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program 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, or (at your option) - any later version. - - This program 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -#ifndef alloca -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) -#include <alloca.h> -#else /* not sparc */ -#if defined (MSDOS) && !defined (__TURBOC__) -#include <malloc.h> -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -#include <malloc.h> - #pragma alloca -#else /* not MSDOS, __TURBOC__, or _AIX */ -#ifdef __hpux -#ifdef __cplusplus -extern "C" { -void *alloca (unsigned int); -}; -#else /* not __cplusplus */ -void *alloca (); -#endif /* not __cplusplus */ -#endif /* __hpux */ -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc. */ -#endif /* not GNU C. */ -#endif /* alloca not defined. */ - -/* This is the parser code that is written into each bison parser - when the %semantic_parser declaration is not specified in the grammar. - It was written by Richard Stallman by simplifying the hairy parser - used when %semantic_parser is specified. */ - -/* Note: there must be only one dollar sign in this file. - It is replaced by the list of actions, each action - as one case of the switch. */ - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call yyerror. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab -#define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ -while (0) - -#define YYTERROR 1 -#define YYERRCODE 256 - -#ifndef YYPURE -#define YYLEX yylex() -#endif - -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) -#endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ -#endif - -/* If nonreentrant, generate the variables here */ - -#ifndef YYPURE - -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ -#endif - -/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ - -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif - -#ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 -#endif - -#ifndef YYPARSE_RETURN_TYPE -#define YYPARSE_RETURN_TYPE int -#endif - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -YYPARSE_RETURN_TYPE yyparse (void); -#endif - -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - int count; -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, int count) -{ - register char *f = from; - register char *t = to; - register int i = count; - - while (i-- > 0) - *t++ = *f++; -} - -#endif -#endif - -#line 196 "/usr/share/bison.simple" - -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ - -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -YYPARSE_RETURN_TYPE -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL -{ - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else -#define YYPOPSTACK (yyvsp--, yyssp--) -#endif - - int yystacksize = YYINITDEPTH; - -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif - - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ - - int yylen; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - - /* Initialize stack pointers. - Waste one element of value and location stack - so that they stay on the same level as the state stack. - The wasted elements are never initialized. */ - - yyssp = yyss - 1; - yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif - -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif - - /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; - -#ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif - - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif -#else /* no yyoverflow */ - /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; - yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); - yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); -#endif -#endif /* no yyoverflow */ - - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - - if (yyssp >= yyss + yystacksize - 1) - YYABORT; - } - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif - - goto yybackup; - yybackup: - -/* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to lookahead token. */ - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (yychar == YYEMPTY) - { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif - yychar = YYLEX; - } - - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ - { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif - } - else - { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif - } - - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) - goto yydefault; - - yyn = yytable[yyn]; - - /* yyn is what to do for this token type in this state. - Negative => reduce, -yyn is rule number. - Positive => shift, yyn is new state. - New state is final state => don't bother to shift, - just return success. - 0, or most negative number => error. */ - - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrlab; - - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; - - yystate = yyn; - goto yynewstate; - -/* Do the default action for the current state. */ -yydefault: - - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - -/* Do a reduction. yyn is the number of a rule to reduce with. */ -yyreduce: - yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ - -#if YYDEBUG != 0 - if (yydebug) - { - int i; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif - - - switch (yyn) { - -case 1: -#line 151 "./awk.y" -{ - expression_value = yyvsp[-1].nodeval; - check_funcs(); - ; - break;} -case 2: -#line 159 "./awk.y" -{ - if (yyvsp[0].nodeval != NULL) - yyval.nodeval = yyvsp[0].nodeval; - else - yyval.nodeval = NULL; - yyerrok; - ; - break;} -case 3: -#line 168 "./awk.y" -{ - if (yyvsp[0].nodeval == NULL) - yyval.nodeval = yyvsp[-1].nodeval; - else if (yyvsp[-1].nodeval == NULL) - yyval.nodeval = yyvsp[0].nodeval; - else { - if (yyvsp[-1].nodeval->type != Node_rule_list) - yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_rule_list, - (NODE*) NULL); - yyval.nodeval = append_right(yyvsp[-1].nodeval, - node(yyvsp[0].nodeval, Node_rule_list, (NODE *) NULL)); - } - yyerrok; - ; - break;} -case 4: -#line 182 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 5: -#line 183 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 6: -#line 184 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 7: -#line 188 "./awk.y" -{ io_allowed = FALSE; ; - break;} -case 8: -#line 190 "./awk.y" -{ - if (begin_block != NULL) { - if (begin_block->type != Node_rule_list) - begin_block = node(begin_block, Node_rule_list, - (NODE *) NULL); - (void) append_right(begin_block, node( - node((NODE *) NULL, Node_rule_node, yyvsp[0].nodeval), - Node_rule_list, (NODE *) NULL) ); - } else - begin_block = node((NODE *) NULL, Node_rule_node, yyvsp[0].nodeval); - yyval.nodeval = NULL; - io_allowed = TRUE; - yyerrok; - ; - break;} -case 9: -#line 204 "./awk.y" -{ io_allowed = FALSE; ; - break;} -case 10: -#line 206 "./awk.y" -{ - if (end_block != NULL) { - if (end_block->type != Node_rule_list) - end_block = node(end_block, Node_rule_list, - (NODE *) NULL); - (void) append_right (end_block, node( - node((NODE *) NULL, Node_rule_node, yyvsp[0].nodeval), - Node_rule_list, (NODE *) NULL)); - } else - end_block = node((NODE *) NULL, Node_rule_node, yyvsp[0].nodeval); - yyval.nodeval = NULL; - io_allowed = TRUE; - yyerrok; - ; - break;} -case 11: -#line 221 "./awk.y" -{ - warning("BEGIN blocks must have an action part"); - errcount++; - yyerrok; - ; - break;} -case 12: -#line 227 "./awk.y" -{ - warning("END blocks must have an action part"); - errcount++; - yyerrok; - ; - break;} -case 13: -#line 233 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_rule_node, yyvsp[0].nodeval); yyerrok; ; - break;} -case 14: -#line 235 "./awk.y" -{ yyval.nodeval = node((NODE *) NULL, Node_rule_node, yyvsp[0].nodeval); yyerrok; ; - break;} -case 15: -#line 237 "./awk.y" -{ - yyval.nodeval = node(yyvsp[-1].nodeval, - Node_rule_node, - node(node(node(make_number(0.0), - Node_field_spec, - (NODE *) NULL), - Node_expression_list, - (NODE *) NULL), - Node_K_print, - (NODE *) NULL)); - yyerrok; - ; - break;} -case 16: -#line 250 "./awk.y" -{ - func_install(yyvsp[-1].nodeval, yyvsp[0].nodeval); - yyval.nodeval = NULL; - yyerrok; - ; - break;} -case 17: -#line 259 "./awk.y" -{ yyval.sval = yyvsp[0].sval; ; - break;} -case 18: -#line 261 "./awk.y" -{ yyval.sval = yyvsp[0].sval; ; - break;} -case 19: -#line 263 "./awk.y" -{ - yyerror("%s() is a built-in function, it cannot be redefined", - tokstart); - errcount++; - /* yyerrok; */ - ; - break;} -case 22: -#line 278 "./awk.y" -{ - param_counter = 0; - ; - break;} -case 23: -#line 282 "./awk.y" -{ - NODE *t; - - t = make_param(yyvsp[-4].sval); - t->flags |= FUNC; - yyval.nodeval = append_right(t, yyvsp[-2].nodeval); - can_return = TRUE; - /* check for duplicate parameter names */ - if (dup_parms(yyval.nodeval)) - errcount++; - ; - break;} -case 24: -#line 297 "./awk.y" -{ - yyval.nodeval = yyvsp[-2].nodeval; - can_return = FALSE; - ; - break;} -case 25: -#line 302 "./awk.y" -{ - yyval.nodeval = node((NODE *) NULL, Node_K_return, (NODE *) NULL); - can_return = FALSE; - ; - break;} -case 26: -#line 311 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 27: -#line 313 "./awk.y" -{ yyval.nodeval = mkrangenode(node(yyvsp[-2].nodeval, Node_cond_pair, yyvsp[0].nodeval)); ; - break;} -case 28: -#line 322 "./awk.y" -{ ++want_regexp; ; - break;} -case 29: -#line 324 "./awk.y" -{ - NODE *n; - size_t len; - - getnode(n); - n->type = Node_regex; - len = strlen(yyvsp[-1].sval); - n->re_exp = make_string(yyvsp[-1].sval, len); - n->re_reg = make_regexp(yyvsp[-1].sval, len, FALSE, TRUE); - n->re_text = NULL; - n->re_flags = CONST; - n->re_cnt = 1; - yyval.nodeval = n; - ; - break;} -case 30: -#line 342 "./awk.y" -{ yyval.nodeval = yyvsp[-3].nodeval; ; - break;} -case 31: -#line 344 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 32: -#line 349 "./awk.y" -{ - yyval.nodeval = yyvsp[0].nodeval; - if (do_lint && isnoeffect(yyval.nodeval->type)) - warning("statement may have no effect"); - ; - break;} -case 33: -#line 355 "./awk.y" -{ - if (yyvsp[-1].nodeval == NULL || yyvsp[-1].nodeval->type != Node_statement_list) - yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_statement_list, (NODE *) NULL); - yyval.nodeval = append_right(yyvsp[-1].nodeval, - node(yyvsp[0].nodeval, Node_statement_list, (NODE *) NULL)); - yyerrok; - ; - break;} -case 34: -#line 363 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 35: -#line 365 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 38: -#line 375 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 39: -#line 377 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 40: -#line 379 "./awk.y" -{ yyval.nodeval = yyvsp[-1].nodeval; ; - break;} -case 41: -#line 381 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 42: -#line 383 "./awk.y" -{ yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_while, yyvsp[0].nodeval); ; - break;} -case 43: -#line 385 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_K_do, yyvsp[-5].nodeval); ; - break;} -case 44: -#line 387 "./awk.y" -{ - /* - * Efficiency hack. Recognize the special case of - * - * for (iggy in foo) - * delete foo[iggy] - * - * and treat it as if it were - * - * delete foo - * - * Check that the body is a `delete a[i]' statement, - * and that both the loop var and array names match. - */ - if (yyvsp[0].nodeval->type == Node_K_delete - && yyvsp[0].nodeval->rnode != NULL - && strcmp(yyvsp[-5].sval, yyvsp[0].nodeval->rnode->var_value->vname) == 0 - && strcmp(yyvsp[-3].sval, yyvsp[0].nodeval->lnode->vname) == 0) { - yyvsp[0].nodeval->type = Node_K_delete_loop; - yyval.nodeval = yyvsp[0].nodeval; - } else { - yyval.nodeval = node(yyvsp[0].nodeval, Node_K_arrayfor, - make_for_loop(variable(yyvsp[-5].sval, CAN_FREE, Node_var), - (NODE *) NULL, variable(yyvsp[-3].sval, CAN_FREE, Node_var_array))); - } - ; - break;} -case 45: -#line 414 "./awk.y" -{ - yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, (NODE *) make_for_loop(yyvsp[-7].nodeval, yyvsp[-5].nodeval, yyvsp[-3].nodeval)); - ; - break;} -case 46: -#line 418 "./awk.y" -{ - yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, - (NODE *) make_for_loop(yyvsp[-6].nodeval, (NODE *) NULL, yyvsp[-3].nodeval)); - ; - break;} -case 47: -#line 424 "./awk.y" -{ yyval.nodeval = node((NODE *) NULL, Node_K_break, (NODE *) NULL); ; - break;} -case 48: -#line 427 "./awk.y" -{ yyval.nodeval = node((NODE *) NULL, Node_K_continue, (NODE *) NULL); ; - break;} -case 49: -#line 429 "./awk.y" -{ yyval.nodeval = node(yyvsp[-3].nodeval, yyvsp[-5].nodetypeval, yyvsp[-1].nodeval); ; - break;} -case 50: -#line 431 "./awk.y" -{ - if (yyvsp[-3].nodetypeval == Node_K_print && yyvsp[-2].nodeval == NULL) { - static int warned = FALSE; - - yyvsp[-2].nodeval = node(node(make_number(0.0), - Node_field_spec, - (NODE *) NULL), - Node_expression_list, - (NODE *) NULL); - - if (do_lint && ! io_allowed && ! warned) { - warned = TRUE; - warning( - "plain `print' in BEGIN or END rule should probably be `print \"\"'"); - } - } - - yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-3].nodetypeval, yyvsp[-1].nodeval); - ; - break;} -case 51: -#line 451 "./awk.y" -{ NODETYPE type; - - if (yyvsp[-1].nodeval) { - if (yyvsp[-1].nodeval == lookup("file")) { - static int warned = FALSE; - - if (! warned) { - warned = TRUE; - warning("`next file' is obsolete; use `nextfile'"); - } - if (do_lint) - warning("`next file' is a gawk extension"); - if (do_traditional) { - /* - * can't use yyerror, since may have overshot - * the source line - */ - errcount++; - error("`next file' is a gawk extension"); - } - if (! io_allowed) { - /* same thing */ - errcount++; - error("`next file' used in BEGIN or END action"); - } - type = Node_K_nextfile; - } else { - errcount++; - error("illegal expression after `next'"); - type = Node_K_next; /* sanity */ - } - } else { - if (! io_allowed) - yyerror("`next' used in BEGIN or END action"); - type = Node_K_next; - } - yyval.nodeval = node((NODE *) NULL, type, (NODE *) NULL); - ; - break;} -case 52: -#line 490 "./awk.y" -{ - if (do_lint) - warning("`nextfile' is a gawk extension"); - if (do_traditional) { - /* - * can't use yyerror, since may have overshot - * the source line - */ - errcount++; - error("`nextfile' is a gawk extension"); - } - if (! io_allowed) { - /* same thing */ - errcount++; - error("`nextfile' used in BEGIN or END action"); - } - yyval.nodeval = node((NODE *) NULL, Node_K_nextfile, (NODE *) NULL); - ; - break;} -case 53: -#line 509 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_K_exit, (NODE *) NULL); ; - break;} -case 54: -#line 511 "./awk.y" -{ - if (! can_return) - yyerror("`return' used outside function context"); - ; - break;} -case 55: -#line 516 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_K_return, (NODE *) NULL); ; - break;} -case 56: -#line 518 "./awk.y" -{ yyval.nodeval = node(variable(yyvsp[-4].sval, CAN_FREE, Node_var_array), Node_K_delete, yyvsp[-2].nodeval); ; - break;} -case 57: -#line 520 "./awk.y" -{ - if (do_lint) - warning("`delete array' is a gawk extension"); - if (do_traditional) { - /* - * can't use yyerror, since may have overshot - * the source line - */ - errcount++; - error("`delete array' is a gawk extension"); - } - yyval.nodeval = node(variable(yyvsp[-1].sval, CAN_FREE, Node_var_array), Node_K_delete, (NODE *) NULL); - ; - break;} -case 58: -#line 534 "./awk.y" -{ yyval.nodeval = yyvsp[-1].nodeval; ; - break;} -case 59: -#line 539 "./awk.y" -{ yyval.nodetypeval = yyvsp[0].nodetypeval; ; - break;} -case 60: -#line 541 "./awk.y" -{ yyval.nodetypeval = yyvsp[0].nodetypeval; ; - break;} -case 61: -#line 546 "./awk.y" -{ - yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_if, - node(yyvsp[0].nodeval, Node_if_branches, (NODE *) NULL)); - ; - break;} -case 62: -#line 552 "./awk.y" -{ yyval.nodeval = node(yyvsp[-6].nodeval, Node_K_if, - node(yyvsp[-3].nodeval, Node_if_branches, yyvsp[0].nodeval)); ; - break;} -case 63: -#line 558 "./awk.y" -{ want_assign = FALSE; ; - break;} -case 67: -#line 569 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 68: -#line 571 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_redirect_input, (NODE *) NULL); ; - break;} -case 69: -#line 576 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 70: -#line 578 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_redirect_output, (NODE *) NULL); ; - break;} -case 71: -#line 580 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_redirect_append, (NODE *) NULL); ; - break;} -case 72: -#line 582 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_redirect_pipe, (NODE *) NULL); ; - break;} -case 73: -#line 587 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 74: -#line 589 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 75: -#line 594 "./awk.y" -{ yyval.nodeval = make_param(yyvsp[0].sval); ; - break;} -case 76: -#line 596 "./awk.y" -{ yyval.nodeval = append_right(yyvsp[-2].nodeval, make_param(yyvsp[0].sval)); yyerrok; ; - break;} -case 77: -#line 598 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 78: -#line 600 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 79: -#line 602 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 80: -#line 608 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 81: -#line 610 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 82: -#line 615 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 83: -#line 617 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 84: -#line 622 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_expression_list, (NODE *) NULL); ; - break;} -case 85: -#line 624 "./awk.y" -{ - yyval.nodeval = append_right(yyvsp[-2].nodeval, - node(yyvsp[0].nodeval, Node_expression_list, (NODE *) NULL)); - yyerrok; - ; - break;} -case 86: -#line 630 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 87: -#line 632 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 88: -#line 634 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 89: -#line 636 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 90: -#line 641 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 91: -#line 643 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 92: -#line 648 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_expression_list, (NODE *) NULL); ; - break;} -case 93: -#line 650 "./awk.y" -{ - yyval.nodeval = append_right(yyvsp[-2].nodeval, - node(yyvsp[0].nodeval, Node_expression_list, (NODE *) NULL)); - yyerrok; - ; - break;} -case 94: -#line 656 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 95: -#line 658 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 96: -#line 660 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 97: -#line 662 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 98: -#line 667 "./awk.y" -{ want_assign = FALSE; ; - break;} -case 99: -#line 669 "./awk.y" -{ - if (do_lint && yyvsp[0].nodeval->type == Node_regex) - warning("Regular expression on left of assignment."); - yyval.nodeval = node(yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, yyvsp[0].nodeval); - ; - break;} -case 100: -#line 675 "./awk.y" -{ yyval.nodeval = node(variable(yyvsp[0].sval, CAN_FREE, Node_var_array), Node_in_array, yyvsp[-3].nodeval); ; - break;} -case 101: -#line 677 "./awk.y" -{ - yyval.nodeval = node(yyvsp[0].nodeval, Node_K_getline, - node(yyvsp[-3].nodeval, Node_redirect_pipein, (NODE *) NULL)); - ; - break;} -case 102: -#line 682 "./awk.y" -{ - if (do_lint && ! io_allowed && yyvsp[0].nodeval == NULL) - warning("non-redirected getline undefined inside BEGIN or END action"); - yyval.nodeval = node(yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval); - ; - break;} -case 103: -#line 688 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ; - break;} -case 104: -#line 690 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ; - break;} -case 105: -#line 692 "./awk.y" -{ - if (yyvsp[-2].nodeval->type == Node_regex) - warning("Regular expression on left of MATCH operator."); - yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, mk_rexp(yyvsp[0].nodeval)); - ; - break;} -case 106: -#line 698 "./awk.y" -{ - yyval.nodeval = yyvsp[0].nodeval; - if (do_lint && tokstart[0] == '*') { - /* possible C comment */ - int n = strlen(tokstart) - 1; - if (tokstart[n] == '*') - warning("regexp looks like a C comment, but is not"); - } - ; - break;} -case 107: -#line 708 "./awk.y" -{ - yyval.nodeval = node(node(make_number(0.0), - Node_field_spec, - (NODE *) NULL), - Node_nomatch, - yyvsp[0].nodeval); - ; - break;} -case 108: -#line 716 "./awk.y" -{ yyval.nodeval = node(variable(yyvsp[0].sval, CAN_FREE, Node_var_array), Node_in_array, yyvsp[-2].nodeval); ; - break;} -case 109: -#line 718 "./awk.y" -{ - if (do_lint && yyvsp[0].nodeval->type == Node_regex) - warning("Regular expression on left of comparison."); - yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); - ; - break;} -case 110: -#line 724 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_less, yyvsp[0].nodeval); ; - break;} -case 111: -#line 726 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_greater, yyvsp[0].nodeval); ; - break;} -case 112: -#line 728 "./awk.y" -{ yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));; - break;} -case 113: -#line 730 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 114: -#line 732 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ; - break;} -case 115: -#line 737 "./awk.y" -{ want_assign = FALSE; ; - break;} -case 116: -#line 739 "./awk.y" -{ yyval.nodeval = node(yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, yyvsp[0].nodeval); ; - break;} -case 117: -#line 741 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ; - break;} -case 118: -#line 743 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ; - break;} -case 119: -#line 745 "./awk.y" -{ - if (do_lint && ! io_allowed && yyvsp[0].nodeval == NULL) - warning("non-redirected getline undefined inside BEGIN or END action"); - yyval.nodeval = node(yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval); - ; - break;} -case 120: -#line 751 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 121: -#line 753 "./awk.y" -{ yyval.nodeval = node((NODE *) NULL, Node_nomatch, yyvsp[0].nodeval); ; - break;} -case 122: -#line 755 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, mk_rexp(yyvsp[0].nodeval)); ; - break;} -case 123: -#line 757 "./awk.y" -{ yyval.nodeval = node(variable(yyvsp[0].sval, CAN_FREE, Node_var_array), Node_in_array, yyvsp[-2].nodeval); ; - break;} -case 124: -#line 759 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ; - break;} -case 125: -#line 761 "./awk.y" -{ yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));; - break;} -case 126: -#line 763 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 127: -#line 765 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ; - break;} -case 129: -#line 772 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_exp, yyvsp[0].nodeval); ; - break;} -case 130: -#line 774 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_times, yyvsp[0].nodeval); ; - break;} -case 131: -#line 776 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_quotient, yyvsp[0].nodeval); ; - break;} -case 132: -#line 778 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_mod, yyvsp[0].nodeval); ; - break;} -case 133: -#line 780 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_plus, yyvsp[0].nodeval); ; - break;} -case 134: -#line 782 "./awk.y" -{ yyval.nodeval = node(yyvsp[-2].nodeval, Node_minus, yyvsp[0].nodeval); ; - break;} -case 135: -#line 784 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_postincrement, (NODE *) NULL); ; - break;} -case 136: -#line 786 "./awk.y" -{ yyval.nodeval = node(yyvsp[-1].nodeval, Node_postdecrement, (NODE *) NULL); ; - break;} -case 137: -#line 791 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_not, (NODE *) NULL); ; - break;} -case 138: -#line 793 "./awk.y" -{ yyval.nodeval = yyvsp[-1].nodeval; ; - break;} -case 139: -#line 796 "./awk.y" -{ yyval.nodeval = snode(yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); ; - break;} -case 140: -#line 798 "./awk.y" -{ yyval.nodeval = snode(yyvsp[-1].nodeval, Node_builtin, (int) yyvsp[-3].lval); ; - break;} -case 141: -#line 800 "./awk.y" -{ - if (do_lint) - warning("call of `length' without parentheses is not portable"); - yyval.nodeval = snode((NODE *) NULL, Node_builtin, (int) yyvsp[0].lval); - if (do_posix) - warning("call of `length' without parentheses is deprecated by POSIX"); - ; - break;} -case 142: -#line 808 "./awk.y" -{ - yyval.nodeval = node(yyvsp[-1].nodeval, Node_func_call, make_string(yyvsp[-3].sval, strlen(yyvsp[-3].sval))); - func_use(yyvsp[-3].sval, FUNC_USE); - param_sanity(yyvsp[-1].nodeval); - free(yyvsp[-3].sval); - ; - break;} -case 144: -#line 816 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_preincrement, (NODE *) NULL); ; - break;} -case 145: -#line 818 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_predecrement, (NODE *) NULL); ; - break;} -case 146: -#line 820 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 147: -#line 822 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 148: -#line 825 "./awk.y" -{ - if (yyvsp[0].nodeval->type == Node_val) { - yyvsp[0].nodeval->numbr = -(force_number(yyvsp[0].nodeval)); - yyval.nodeval = yyvsp[0].nodeval; - } else - yyval.nodeval = node(yyvsp[0].nodeval, Node_unary_minus, (NODE *) NULL); - ; - break;} -case 149: -#line 833 "./awk.y" -{ - /* - * was: $$ = $2 - * POSIX semantics: force a conversion to numeric type - */ - yyval.nodeval = node (make_number(0.0), Node_plus, yyvsp[0].nodeval); - ; - break;} -case 150: -#line 844 "./awk.y" -{ yyval.nodeval = NULL; ; - break;} -case 151: -#line 846 "./awk.y" -{ yyval.nodeval = yyvsp[0].nodeval; ; - break;} -case 152: -#line 851 "./awk.y" -{ yyval.nodeval = variable(yyvsp[0].sval, CAN_FREE, Node_var); ; - break;} -case 153: -#line 853 "./awk.y" -{ - if (yyvsp[-1].nodeval == NULL) { - fatal("invalid subscript expression"); - } else if (yyvsp[-1].nodeval->rnode == NULL) { - yyval.nodeval = node(variable(yyvsp[-3].sval, CAN_FREE, Node_var_array), Node_subscript, yyvsp[-1].nodeval->lnode); - freenode(yyvsp[-1].nodeval); - } else - yyval.nodeval = node(variable(yyvsp[-3].sval, CAN_FREE, Node_var_array), Node_subscript, yyvsp[-1].nodeval); - ; - break;} -case 154: -#line 863 "./awk.y" -{ yyval.nodeval = node(yyvsp[0].nodeval, Node_field_spec, (NODE *) NULL); ; - break;} -case 156: -#line 871 "./awk.y" -{ yyerrok; ; - break;} -case 157: -#line 875 "./awk.y" -{ yyerrok; ; - break;} -case 160: -#line 884 "./awk.y" -{ yyerrok; want_assign = FALSE; ; - break;} -case 161: -#line 887 "./awk.y" -{ yyerrok; ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 498 "/usr/share/bison.simple" - - yyvsp -= yylen; - yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - - *++yyvsp = yyval; - -#ifdef YYLSP_NEEDED - yylsp++; - if (yylen == 0) - { - yylsp->first_line = yylloc.first_line; - yylsp->first_column = yylloc.first_column; - yylsp->last_line = (yylsp-1)->last_line; - yylsp->last_column = (yylsp-1)->last_column; - yylsp->text = 0; - } - else - { - yylsp->last_line = (yylsp+yylen-1)->last_line; - yylsp->last_column = (yylsp+yylen-1)->last_column; - } -#endif - - /* Now "shift" the result of the reduction. - Determine what state that goes to, - based on the state we popped back to - and the rule number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTBASE]; - - goto yynewstate; - -yyerrlab: /* here on detecting error */ - - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ - { - ++yynerrs; - -#ifdef YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); - - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } - else -#endif /* YYERROR_VERBOSE */ - yyerror("parse error"); - } - - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ - - if (yyerrstatus == 3) - { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; - } - - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ - - goto yyerrhandle; - -yyerrdefault: /* current state does not do anything special for the error token. */ - -#if 0 - /* This is wrong; only states that explicitly want error tokens - should shift them. */ - yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ - if (yyn) goto yydefault; -#endif - -yyerrpop: /* pop the current state because it cannot handle the error token */ - - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif - -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: - - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; - - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; - } - else if (yyn == 0) - goto yyerrpop; - - if (yyn == YYFINAL) - YYACCEPT; - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif - - yystate = yyn; - goto yynewstate; -} -#line 890 "./awk.y" - - -struct token { - const char *operator; /* text to match */ - NODETYPE value; /* node type */ - int class; /* lexical class */ - unsigned flags; /* # of args. allowed and compatability */ -# define ARGS 0xFF /* 0, 1, 2, 3 args allowed (any combination */ -# define A(n) (1<<(n)) -# define VERSION 0xFF00 /* old awk is zero */ -# define NOT_OLD 0x0100 /* feature not in old awk */ -# define NOT_POSIX 0x0200 /* feature not in POSIX */ -# define GAWKX 0x0400 /* gawk extension */ -# define RESX 0x0800 /* Bell Labs Research extension */ - NODE *(*ptr)(); /* function that implements this keyword */ -}; - - -/* Tokentab is sorted ascii ascending order, so it can be binary searched. */ -/* Function pointers come from declarations in awk.h. */ - -static struct token tokentab[] = { -{"BEGIN", Node_illegal, LEX_BEGIN, 0, 0}, -{"END", Node_illegal, LEX_END, 0, 0}, -#ifdef ARRAYDEBUG -{"adump", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_adump}, -#endif -#ifdef BITOPS -{"and", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_and}, -#endif /* BITOPS */ -{"atan2", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_atan2}, -{"break", Node_K_break, LEX_BREAK, 0, 0}, -{"close", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_close}, -#ifdef BITOPS -{"compl", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_compl}, -#endif /* BITOPS */ -{"continue", Node_K_continue, LEX_CONTINUE, 0, 0}, -{"cos", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos}, -{"delete", Node_K_delete, LEX_DELETE, NOT_OLD, 0}, -{"do", Node_K_do, LEX_DO, NOT_OLD, 0}, -{"else", Node_illegal, LEX_ELSE, 0, 0}, -{"exit", Node_K_exit, LEX_EXIT, 0, 0}, -{"exp", Node_builtin, LEX_BUILTIN, A(1), do_exp}, -{"fflush", Node_builtin, LEX_BUILTIN, RESX|A(0)|A(1), do_fflush}, -{"for", Node_K_for, LEX_FOR, 0, 0}, -{"func", Node_K_function, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0}, -{"function", Node_K_function, LEX_FUNCTION, NOT_OLD, 0}, -{"gensub", Node_builtin, LEX_BUILTIN, GAWKX|A(3)|A(4), do_gensub}, -{"getline", Node_K_getline, LEX_GETLINE, NOT_OLD, 0}, -{"gsub", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_gsub}, -{"if", Node_K_if, LEX_IF, 0, 0}, -{"in", Node_illegal, LEX_IN, 0, 0}, -{"index", Node_builtin, LEX_BUILTIN, A(2), do_index}, -{"int", Node_builtin, LEX_BUILTIN, A(1), do_int}, -{"length", Node_builtin, LEX_LENGTH, A(0)|A(1), do_length}, -{"log", Node_builtin, LEX_BUILTIN, A(1), do_log}, -#ifdef BITOPS -{"lshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift}, -#endif /* BITOPS */ -{"match", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2), do_match}, -{"next", Node_K_next, LEX_NEXT, 0, 0}, -{"nextfile", Node_K_nextfile, LEX_NEXTFILE, GAWKX, 0}, -#ifdef BITOPS -{"or", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_or}, -#endif /* BITOPS */ -{"print", Node_K_print, LEX_PRINT, 0, 0}, -{"printf", Node_K_printf, LEX_PRINTF, 0, 0}, -{"rand", Node_builtin, LEX_BUILTIN, NOT_OLD|A(0), do_rand}, -{"return", Node_K_return, LEX_RETURN, NOT_OLD, 0}, -#ifdef BITOPS -{"rshift", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_rshift}, -#endif /* BITOPS */ -{"sin", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_sin}, -{"split", Node_builtin, LEX_BUILTIN, A(2)|A(3), do_split}, -{"sprintf", Node_builtin, LEX_BUILTIN, 0, do_sprintf}, -{"sqrt", Node_builtin, LEX_BUILTIN, A(1), do_sqrt}, -{"srand", Node_builtin, LEX_BUILTIN, NOT_OLD|A(0)|A(1), do_srand}, -#ifdef ARRAYDEBUG -{"stopme", Node_builtin, LEX_BUILTIN, GAWKX|A(0), stopme}, -#endif -{"strftime", Node_builtin, LEX_BUILTIN, GAWKX|A(0)|A(1)|A(2), do_strftime}, -#ifdef BITOPS -{"strtonum", Node_builtin, LEX_BUILTIN, GAWKX|A(1), do_strtonum}, -#endif /* BITOPS */ -{"sub", Node_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_sub}, -{"substr", Node_builtin, LEX_BUILTIN, A(2)|A(3), do_substr}, -{"system", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_system}, -{"systime", Node_builtin, LEX_BUILTIN, GAWKX|A(0), do_systime}, -{"tolower", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_tolower}, -{"toupper", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_toupper}, -{"while", Node_K_while, LEX_WHILE, 0, 0}, -#ifdef BITOPS -{"xor", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor}, -#endif /* BITOPS */ -}; - -/* yyerror --- print a syntax error message, show where */ - -#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ -static void -yyerror(const char *m, ...) -#else -/* VARARGS0 */ -static void -yyerror(va_alist) -va_dcl -#endif -{ - va_list args; - const char *mesg = NULL; - register char *bp, *cp; - char *scan; - char buf[120]; - static char end_of_file_line[] = "(END OF FILE)"; - - errcount++; - /* Find the current line in the input file */ - if (lexptr && lexeme) { - if (thisline == NULL) { - cp = lexeme; - if (*cp == '\n') { - cp--; - mesg = "unexpected newline"; - } - for (; cp != lexptr_begin && *cp != '\n'; --cp) - continue; - if (*cp == '\n') - cp++; - thisline = cp; - } - /* NL isn't guaranteed */ - bp = lexeme; - while (bp < lexend && *bp && *bp != '\n') - bp++; - } else { - thisline = end_of_file_line; - bp = thisline + strlen(thisline); - } - msg("%.*s", (int) (bp - thisline), thisline); - bp = buf; - cp = buf + sizeof(buf) - 24; /* 24 more than longest msg. input */ - if (lexptr != NULL) { - scan = thisline; - while (bp < cp && scan < lexeme) - if (*scan++ == '\t') - *bp++ = '\t'; - else - *bp++ = ' '; - *bp++ = '^'; - *bp++ = ' '; - } -#if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ - va_start(args, m); - if (mesg == NULL) - mesg = m; -#else - va_start(args); - if (mesg == NULL) - mesg = va_arg(args, char *); -#endif - strcpy(bp, mesg); - err("", buf, args); - va_end(args); -} - -/* get_src_buf --- read the next buffer of source program */ - -static char * -get_src_buf() -{ - static int samefile = FALSE; - static int nextfile = 0; - static char *buf = NULL; - static int fd; - int n; - register char *scan; - static int len = 0; - static int did_newline = FALSE; - int newfile; - struct stat sbuf; - -# define SLOP 128 /* enough space to hold most source lines */ - -again: - newfile = FALSE; - if (nextfile > numfiles) - return NULL; - - if (srcfiles[nextfile].stype == CMDLINE) { - if (len == 0) { - len = strlen(srcfiles[nextfile].val); - if (len == 0) { - /* - * Yet Another Special case: - * gawk '' /path/name - * Sigh. - */ - static int warned = FALSE; - - if (do_lint && ! warned) { - warned = TRUE; - warning("empty program text on command line"); - } - ++nextfile; - goto again; - } - sourceline = 1; - lexptr = lexptr_begin = srcfiles[nextfile].val; - lexend = lexptr + len; - } else if (! did_newline && *(lexptr-1) != '\n') { - /* - * The following goop is to ensure that the source - * ends with a newline and that the entire current - * line is available for error messages. - */ - int offset; - - did_newline = TRUE; - offset = lexptr - lexeme; - for (scan = lexeme; scan > lexptr_begin; scan--) - if (*scan == '\n') { - scan++; - break; - } - len = lexptr - scan; - emalloc(buf, char *, len+1, "get_src_buf"); - memcpy(buf, scan, len); - thisline = buf; - lexptr = buf + len; - *lexptr = '\n'; - lexeme = lexptr - offset; - lexptr_begin = buf; - lexend = lexptr + 1; - } else { - len = 0; - lexeme = lexptr = lexptr_begin = NULL; - } - if (lexptr == NULL && ++nextfile <= numfiles) - goto again; - return lexptr; - } - if (! samefile) { - source = srcfiles[nextfile].val; - if (source == NULL) { - if (buf != NULL) { - free(buf); - buf = NULL; - } - len = 0; - return lexeme = lexptr = lexptr_begin = NULL; - } - fd = pathopen(source); - if (fd <= INVALID_HANDLE) { - char *in; - - /* suppress file name and line no. in error mesg */ - in = source; - source = NULL; - fatal("can't open source file \"%s\" for reading (%s)", - in, strerror(errno)); - } - len = optimal_bufsize(fd, & sbuf); - newfile = TRUE; - if (buf != NULL) - free(buf); - emalloc(buf, char *, len + SLOP, "get_src_buf"); - lexptr_begin = buf + SLOP; - samefile = TRUE; - sourceline = 1; - } else { - /* - * Here, we retain the current source line (up to length SLOP) - * in the beginning of the buffer that was overallocated above - */ - int offset; - int linelen; - - offset = lexptr - lexeme; - for (scan = lexeme; scan > lexptr_begin; scan--) - if (*scan == '\n') { - scan++; - break; - } - linelen = lexptr - scan; - if (linelen > SLOP) - linelen = SLOP; - thisline = buf + SLOP - linelen; - memcpy(thisline, scan, linelen); - lexeme = buf + SLOP - offset; - lexptr_begin = thisline; - } - n = read(fd, buf + SLOP, len); - if (n == -1) - fatal("can't read sourcefile \"%s\" (%s)", - source, strerror(errno)); - if (n == 0) { - if (newfile) { - static int warned = FALSE; - - if (do_lint && ! warned) { - warned = TRUE; - warning("source file `%s' is empty", source); - } - } - if (fileno(stdin) != fd) /* safety */ - close(fd); - samefile = FALSE; - nextfile++; - if (lexeme) - *lexeme = '\0'; - len = 0; - goto again; - } - lexptr = buf + SLOP; - lexend = lexptr + n; - return buf; -} - -/* tokadd --- add a character to the token buffer */ - -#define tokadd(x) (*tok++ = (x), tok == tokend ? tokexpand() : tok) - -/* tokexpand --- grow the token buffer */ - -char * -tokexpand() -{ - static int toksize = 60; - int tokoffset; - - tokoffset = tok - tokstart; - toksize *= 2; - if (tokstart != NULL) - erealloc(tokstart, char *, toksize, "tokexpand"); - else - emalloc(tokstart, char *, toksize, "tokexpand"); - tokend = tokstart + toksize; - tok = tokstart + tokoffset; - return tok; -} - -/* nextc --- get the next input character */ - -#if DEBUG -int -nextc() -{ - int c; - - if (lexptr && lexptr < lexend) - c = (int) (unsigned char) *lexptr++; - else if (get_src_buf()) - c = (int) (unsigned char) *lexptr++; - else - c = EOF; - - return c; -} -#else -#define nextc() ((lexptr && lexptr < lexend) ? \ - ((int) (unsigned char) *lexptr++) : \ - (get_src_buf() ? ((int) (unsigned char) *lexptr++) : EOF) \ - ) -#endif - -/* pushback --- push a character back on the input */ - -#define pushback() (lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr) - -/* allow_newline --- allow newline after &&, ||, ? and : */ - -static void -allow_newline() -{ - int c; - - for (;;) { - c = nextc(); - if (c == EOF) - break; - if (c == '#') { - while ((c = nextc()) != '\n' && c != EOF) - continue; - if (c == EOF) - break; - } - if (c == '\n') - sourceline++; - if (! isspace(c)) { - pushback(); - break; - } - } -} - -/* yylex --- Read the input and turn it into tokens. */ - -static int -yylex() -{ - register int c, c1; - int seen_e = FALSE; /* These are for numbers */ - int seen_point = FALSE; - int esc_seen; /* for literal strings */ - int low, mid, high; - static int did_newline = FALSE; - char *tokkey; - static int lasttok = 0, eof_warned = FALSE; - int inhex = FALSE; - - if (nextc() == EOF) { - if (lasttok != NEWLINE) { - lasttok = NEWLINE; - if (do_lint && ! eof_warned) { - warning("source file does not end in newline"); - eof_warned = TRUE; - } - return NEWLINE; /* fake it */ - } - return 0; - } - pushback(); -#ifdef OS2 - /* - * added for OS/2's extproc feature of cmd.exe - * (like #! in BSD sh) - */ - if (strncasecmp(lexptr, "extproc ", 8) == 0) { - while (*lexptr && *lexptr != '\n') - lexptr++; - } -#endif - lexeme = lexptr; - thisline = NULL; - if (want_regexp) { - int in_brack = 0; /* count brackets, [[:alnum:]] allowed */ - /* - * Counting brackets is non-trivial. [[] is ok, - * and so is [\]], with a point being that /[/]/ as a regexp - * constant has to work. - * - * Do not count [ or ] if either one is preceded by a \. - * A `[' should be counted if - * a) it is the first one so far (in_brack == 0) - * b) it is the `[' in `[:' - * A ']' should be counted if not preceded by a \, since - * it is either closing `:]' or just a plain list. - * According to POSIX, []] is how you put a ] into a set. - * Try to handle that too. - * - * The code for \ handles \[ and \]. - */ - - want_regexp = FALSE; - tok = tokstart; - for (;;) { - c = nextc(); - switch (c) { - case '[': - /* one day check for `.' and `=' too */ - if ((c1 = nextc()) == ':' || in_brack == 0) - in_brack++; - pushback(); - break; - case ']': - if (tokstart[0] == '[' - && (tok == tokstart + 1 - || (tok == tokstart + 2 - && tokstart[1] == '^'))) - /* do nothing */; - else - in_brack--; - break; - case '\\': - if ((c = nextc()) == EOF) { - yyerror("unterminated regexp ends with \\ at end of file"); - return lasttok = REGEXP; /* kludge */ - } else if (c == '\n') { - sourceline++; - continue; - } else { - tokadd('\\'); - tokadd(c); - continue; - } - break; - case '/': /* end of the regexp */ - if (in_brack > 0) - break; - - pushback(); - tokadd('\0'); - yylval.sval = tokstart; - return lasttok = REGEXP; - case '\n': - pushback(); - yyerror("unterminated regexp"); - return lasttok = REGEXP; /* kludge */ - case EOF: - yyerror("unterminated regexp at end of file"); - return lasttok = REGEXP; /* kludge */ - } - tokadd(c); - } - } -retry: - while ((c = nextc()) == ' ' || c == '\t') - continue; - - lexeme = lexptr ? lexptr - 1 : lexptr; - thisline = NULL; - tok = tokstart; - yylval.nodetypeval = Node_illegal; - - switch (c) { - case EOF: - if (lasttok != NEWLINE) { - lasttok = NEWLINE; - if (do_lint && ! eof_warned) { - warning("source file does not end in newline"); - eof_warned = TRUE; - } - return NEWLINE; /* fake it */ - } - return 0; - - case '\n': - sourceline++; - return lasttok = NEWLINE; - - case '#': /* it's a comment */ - while ((c = nextc()) != '\n') { - if (c == EOF) { - if (lasttok != NEWLINE) { - lasttok = NEWLINE; - if (do_lint && ! eof_warned) { - warning( - "source file does not end in newline"); - eof_warned = TRUE; - } - return NEWLINE; /* fake it */ - } - return 0; - } - } - sourceline++; - return lasttok = NEWLINE; - - case '\\': -#ifdef RELAXED_CONTINUATION - /* - * This code puports to allow comments and/or whitespace - * after the `\' at the end of a line used for continuation. - * Use it at your own risk. We think it's a bad idea, which - * is why it's not on by default. - */ - if (! do_traditional) { - /* strip trailing white-space and/or comment */ - while ((c = nextc()) == ' ' || c == '\t') - continue; - if (c == '#') { - if (do_lint) - warning( - "use of `\\ #...' line continuation is not portable"); - while ((c = nextc()) != '\n') - if (c == EOF) - break; - } - pushback(); - } -#endif /* RELAXED_CONTINUATION */ - if (nextc() == '\n') { - sourceline++; - goto retry; - } else { - yyerror("backslash not last character on line"); - exit(1); - } - break; - - case '$': - want_assign = TRUE; - return lasttok = '$'; - - case ':': - case '?': - allow_newline(); - return lasttok = c; - - case ')': - case '(': - case ';': - case '{': - case ',': - want_assign = FALSE; - /* fall through */ - case '[': - case ']': - return lasttok = c; - - case '*': - if ((c = nextc()) == '=') { - yylval.nodetypeval = Node_assign_times; - return lasttok = ASSIGNOP; - } else if (do_posix) { - pushback(); - return lasttok = '*'; - } else if (c == '*') { - /* make ** and **= aliases for ^ and ^= */ - static int did_warn_op = FALSE, did_warn_assgn = FALSE; - - if (nextc() == '=') { - if (do_lint && ! did_warn_assgn) { - did_warn_assgn = TRUE; - warning("**= is not allowed by POSIX"); - warning("operator `**=' is not supported in old awk"); - } - yylval.nodetypeval = Node_assign_exp; - return ASSIGNOP; - } else { - pushback(); - if (do_lint && ! did_warn_op) { - did_warn_op = TRUE; - warning("** is not allowed by POSIX"); - warning("operator `**' is not supported in old awk"); - } - return lasttok = '^'; - } - } - pushback(); - return lasttok = '*'; - - case '/': - if (want_assign) { - if (nextc() == '=') { - yylval.nodetypeval = Node_assign_quotient; - return lasttok = ASSIGNOP; - } - pushback(); - } - return lasttok = '/'; - - case '%': - if (nextc() == '=') { - yylval.nodetypeval = Node_assign_mod; - return lasttok = ASSIGNOP; - } - pushback(); - return lasttok = '%'; - - case '^': - { - static int did_warn_op = FALSE, did_warn_assgn = FALSE; - - if (nextc() == '=') { - if (do_lint && ! did_warn_assgn) { - did_warn_assgn = TRUE; - warning("operator `^=' is not supported in old awk"); - } - yylval.nodetypeval = Node_assign_exp; - return lasttok = ASSIGNOP; - } - pushback(); - if (do_lint && ! did_warn_op) { - did_warn_op = TRUE; - warning("operator `^' is not supported in old awk"); - } - return lasttok = '^'; - } - - case '+': - if ((c = nextc()) == '=') { - yylval.nodetypeval = Node_assign_plus; - return lasttok = ASSIGNOP; - } - if (c == '+') - return lasttok = INCREMENT; - pushback(); - return lasttok = '+'; - - case '!': - if ((c = nextc()) == '=') { - yylval.nodetypeval = Node_notequal; - return lasttok = RELOP; - } - if (c == '~') { - yylval.nodetypeval = Node_nomatch; - want_assign = FALSE; - return lasttok = MATCHOP; - } - pushback(); - return lasttok = '!'; - - case '<': - if (nextc() == '=') { - yylval.nodetypeval = Node_leq; - return lasttok = RELOP; - } - yylval.nodetypeval = Node_less; - pushback(); - return lasttok = '<'; - - case '=': - if (nextc() == '=') { - yylval.nodetypeval = Node_equal; - return lasttok = RELOP; - } - yylval.nodetypeval = Node_assign; - pushback(); - return lasttok = ASSIGNOP; - - case '>': - if ((c = nextc()) == '=') { - yylval.nodetypeval = Node_geq; - return lasttok = RELOP; - } else if (c == '>') { - yylval.nodetypeval = Node_redirect_append; - return lasttok = APPEND_OP; - } - yylval.nodetypeval = Node_greater; - pushback(); - return lasttok = '>'; - - case '~': - yylval.nodetypeval = Node_match; - want_assign = FALSE; - return lasttok = MATCHOP; - - case '}': - /* - * Added did newline stuff. Easier than - * hacking the grammar. - */ - if (did_newline) { - did_newline = FALSE; - return lasttok = c; - } - did_newline++; - --lexptr; /* pick up } next time */ - return lasttok = NEWLINE; - - case '"': - esc_seen = FALSE; - while ((c = nextc()) != '"') { - if (c == '\n') { - pushback(); - yyerror("unterminated string"); - exit(1); - } - if (c == '\\') { - c = nextc(); - if (c == '\n') { - sourceline++; - continue; - } - esc_seen = TRUE; - tokadd('\\'); - } - if (c == EOF) { - pushback(); - yyerror("unterminated string"); - exit(1); - } - tokadd(c); - } - yylval.nodeval = make_str_node(tokstart, - tok - tokstart, esc_seen ? SCAN : 0); - yylval.nodeval->flags |= PERM; - return lasttok = YSTRING; - - case '-': - if ((c = nextc()) == '=') { - yylval.nodetypeval = Node_assign_minus; - return lasttok = ASSIGNOP; - } - if (c == '-') - return lasttok = DECREMENT; - pushback(); - return lasttok = '-'; - - case '.': - c = nextc(); - pushback(); - if (! isdigit(c)) - return lasttok = '.'; - else - c = '.'; - /* FALL THROUGH */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - /* It's a number */ - for (;;) { - int gotnumber = FALSE; - - tokadd(c); - switch (c) { -#ifdef BITOPS - case 'x': - case 'X': - if (do_traditional) - goto done; - if (tok == tokstart + 2) - inhex = TRUE; - break; -#endif /* BITOTS */ - case '.': - if (seen_point) { - gotnumber = TRUE; - break; - } - seen_point = TRUE; - break; - case 'e': - case 'E': - if (inhex) - break; - if (seen_e) { - gotnumber = TRUE; - break; - } - seen_e = TRUE; - if ((c = nextc()) == '-' || c == '+') - tokadd(c); - else - pushback(); - break; -#ifdef BITOPS - case 'a': - case 'A': - case 'b': - case 'B': - case 'c': - case 'C': - case 'D': - case 'd': - case 'f': - case 'F': - if (do_traditional || ! inhex) - goto done; - /* fall through */ -#endif - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - break; - default: - done: - gotnumber = TRUE; - } - if (gotnumber) - break; - c = nextc(); - } - if (c != EOF) - pushback(); - else if (do_lint && ! eof_warned) { - warning("source file does not end in newline"); - eof_warned = TRUE; - } - tokadd('\0'); -#ifdef BITOPS - if (! do_traditional && isnondecimal(tokstart)) - yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart))); - else -#endif /* BITOPS */ - yylval.nodeval = make_number(atof(tokstart)); - yylval.nodeval->flags |= PERM; - return lasttok = YNUMBER; - - case '&': - if ((c = nextc()) == '&') { - yylval.nodetypeval = Node_and; - allow_newline(); - want_assign = FALSE; - return lasttok = LEX_AND; - } - pushback(); - return lasttok = '&'; - - case '|': - if ((c = nextc()) == '|') { - yylval.nodetypeval = Node_or; - allow_newline(); - want_assign = FALSE; - return lasttok = LEX_OR; - } - pushback(); - return lasttok = '|'; - } - - if (c != '_' && ! isalpha(c)) { - yyerror("Invalid char '%c' in expression\n", c); - exit(1); - } - - /* it's some type of name-type-thing. Find its length. */ - tok = tokstart; - while (is_identchar(c)) { - tokadd(c); - c = nextc(); - } - tokadd('\0'); - emalloc(tokkey, char *, tok - tokstart, "yylex"); - memcpy(tokkey, tokstart, tok - tokstart); - if (c != EOF) - pushback(); - else if (do_lint && ! eof_warned) { - warning("source file does not end in newline"); - eof_warned = TRUE; - } - - /* See if it is a special token. */ - low = 0; - high = (sizeof(tokentab) / sizeof(tokentab[0])) - 1; - while (low <= high) { - int i; - - mid = (low + high) / 2; - c = *tokstart - tokentab[mid].operator[0]; - i = c ? c : strcmp(tokstart, tokentab[mid].operator); - - if (i < 0) /* token < mid */ - high = mid - 1; - else if (i > 0) /* token > mid */ - low = mid + 1; - else { - if (do_lint) { - if (tokentab[mid].flags & GAWKX) - warning("%s() is a gawk extension", - tokentab[mid].operator); - if (tokentab[mid].flags & RESX) - warning("%s() is a Bell Labs extension", - tokentab[mid].operator); - if (tokentab[mid].flags & NOT_POSIX) - warning("POSIX does not allow %s", - tokentab[mid].operator); - } - if (do_lint_old && (tokentab[mid].flags & NOT_OLD)) - warning("%s is not supported in old awk", - tokentab[mid].operator); - if ((do_traditional && (tokentab[mid].flags & GAWKX)) - || (do_posix && (tokentab[mid].flags & NOT_POSIX))) - break; - if (tokentab[mid].class == LEX_BUILTIN - || tokentab[mid].class == LEX_LENGTH - ) - yylval.lval = mid; - else - yylval.nodetypeval = tokentab[mid].value; - - free(tokkey); - return lasttok = tokentab[mid].class; - } - } - - yylval.sval = tokkey; - if (*lexptr == '(') - return lasttok = FUNC_CALL; - else { - want_assign = TRUE; - return lasttok = NAME; - } -} - -/* node_common --- common code for allocating a new node */ - -static NODE * -node_common(op) -NODETYPE op; -{ - register NODE *r; - - getnode(r); - r->type = op; - r->flags = MALLOC; - /* if lookahead is NL, lineno is 1 too high */ - if (lexeme && *lexeme == '\n') - r->source_line = sourceline - 1; - else - r->source_line = sourceline; - r->source_file = source; - return r; -} - -/* node --- allocates a node with defined lnode and rnode. */ - -NODE * -node(left, op, right) -NODE *left, *right; -NODETYPE op; -{ - register NODE *r; - - r = node_common(op); - r->lnode = left; - r->rnode = right; - return r; -} - -/* snode --- allocate a node with defined subnode and proc for builtin - functions. Checks for arg. count and supplies defaults where - possible. */ - -static NODE * -snode(subn, op, idx) -NODETYPE op; -int idx; -NODE *subn; -{ - register NODE *r; - register NODE *n; - int nexp = 0; - int args_allowed; - - r = node_common(op); - - /* traverse expression list to see how many args. given */ - for (n = subn; n != NULL; n = n->rnode) { - nexp++; - if (nexp > 3) - break; - } - - /* check against how many args. are allowed for this builtin */ - args_allowed = tokentab[idx].flags & ARGS; - if (args_allowed && (args_allowed & A(nexp)) == 0) - fatal("%s() cannot have %d argument%c", - tokentab[idx].operator, nexp, nexp == 1 ? ' ' : 's'); - - r->proc = tokentab[idx].ptr; - - /* special case processing for a few builtins */ - /* - * FIXME: go through these to make sure that everything done - * here is really right. Move anything that's not into - * the corresponding routine. - */ - if (nexp == 0 && r->proc == do_length) { - subn = node(node(make_number(0.0), Node_field_spec, (NODE *) NULL), - Node_expression_list, - (NODE *) NULL); - } else if (r->proc == do_match) { - if (subn->rnode->lnode->type != Node_regex) - subn->rnode->lnode = mk_rexp(subn->rnode->lnode); - } else if (r->proc == do_sub || r->proc == do_gsub) { - if (subn->lnode->type != Node_regex) - subn->lnode = mk_rexp(subn->lnode); - if (nexp == 2) - append_right(subn, node(node(make_number(0.0), - Node_field_spec, - (NODE *) NULL), - Node_expression_list, - (NODE *) NULL)); - else if (subn->rnode->rnode->lnode->type == Node_val) { - if (do_lint) - warning("string literal as last arg of substitute"); - } else if (! isassignable(subn->rnode->rnode->lnode)) - yyerror("%s third parameter is not a changeable object", - r->proc == do_sub ? "sub" : "gsub"); - } else if (r->proc == do_gensub) { - if (subn->lnode->type != Node_regex) - subn->lnode = mk_rexp(subn->lnode); - if (nexp == 3) - append_right(subn, node(node(make_number(0.0), - Node_field_spec, - (NODE *) NULL), - Node_expression_list, - (NODE *) NULL)); - } else if (r->proc == do_split) { - if (nexp == 2) - append_right(subn, - node(FS_node, Node_expression_list, (NODE *) NULL)); - n = subn->rnode->rnode->lnode; - if (n->type != Node_regex) - subn->rnode->rnode->lnode = mk_rexp(n); - if (nexp == 2) - subn->rnode->rnode->lnode->re_flags |= FS_DFLT; - } - - r->subnode = subn; - return r; -} - -/* - * mkrangenode: - * This allocates a Node_line_range node with defined condpair and - * zeroes the trigger word to avoid the temptation of assuming that calling - * 'node( foo, Node_line_range, 0)' will properly initialize 'triggered'. - * Otherwise like node(). - */ - -static NODE * -mkrangenode(cpair) -NODE *cpair; -{ - register NODE *r; - - getnode(r); - r->type = Node_line_range; - r->condpair = cpair; - r->triggered = FALSE; - return r; -} - -/* make_for_loop --- build a for loop */ - -static NODE * -make_for_loop(init, cond, incr) -NODE *init, *cond, *incr; -{ - register FOR_LOOP_HEADER *r; - NODE *n; - - emalloc(r, FOR_LOOP_HEADER *, sizeof(FOR_LOOP_HEADER), "make_for_loop"); - getnode(n); - n->type = Node_illegal; - r->init = init; - r->cond = cond; - r->incr = incr; - n->sub.nodep.r.hd = r; - return n; -} - -/* dup_parms --- return TRUE if there are duplicate parameters */ - -static int -dup_parms(func) -NODE *func; -{ - register NODE *np; - char *fname, **names; - int count, i, j, dups; - NODE *params; - - if (func == NULL) /* error earlier */ - return TRUE; - - fname = func->param; - count = func->param_cnt; - params = func->rnode; - - if (count == 0) /* no args, no problem */ - return FALSE; - - if (params == NULL) /* error earlier */ - return TRUE; - - emalloc(names, char **, count * sizeof(char *), "dup_parms"); - - i = 0; - for (np = params; np != NULL; np = np->rnode) { - if (np->param == NULL) { /* error earlier, give up, go home */ - free(names); - return TRUE; - } - names[i++] = np->param; - } - - dups = 0; - for (i = 1; i < count; i++) { - for (j = 0; j < i; j++) { - if (strcmp(names[i], names[j]) == 0) { - dups++; - error( - "function `%s': parameter #%d, `%s', duplicates parameter #%d", - fname, i+1, names[j], j+1); - } - } - } - - free(names); - return (dups > 0 ? TRUE : FALSE); -} - -/* - * install: - * Install a name in the symbol table, even if it is already there. - * Caller must check against redefinition if that is desired. - */ - -NODE * -install(name, value) -char *name; -NODE *value; -{ - register NODE *hp; - register size_t len; - register int bucket; - - len = strlen(name); - bucket = hash(name, len, (unsigned long) HASHSIZE); - getnode(hp); - hp->type = Node_hashnode; - hp->hnext = variables[bucket]; - variables[bucket] = hp; - hp->hlength = len; - hp->hvalue = value; - hp->hname = name; - hp->hvalue->vname = name; - return hp->hvalue; -} - -/* lookup --- find the most recent hash node for name installed by install */ - -NODE * -lookup(name) -const char *name; -{ - register NODE *bucket; - register size_t len; - - len = strlen(name); - for (bucket = variables[hash(name, len, (unsigned long) HASHSIZE)]; - bucket != NULL; bucket = bucket->hnext) - if (bucket->hlength == len && STREQN(bucket->hname, name, len)) - return bucket->hvalue; - - return NULL; -} - -/* - * append_right: - * Add new to the rightmost branch of LIST. This uses n^2 time, so we make - * a simple attempt at optimizing it. - */ - -static NODE * -append_right(list, new) -NODE *list, *new; -{ - register NODE *oldlist; - static NODE *savefront = NULL, *savetail = NULL; - - if (list == NULL || new == NULL) - return list; - - oldlist = list; - if (savefront == oldlist) { - savetail = savetail->rnode = new; - return oldlist; - } else - savefront = oldlist; - while (list->rnode != NULL) - list = list->rnode; - savetail = list->rnode = new; - return oldlist; -} - -/* - * func_install: - * check if name is already installed; if so, it had better have Null value, - * in which case def is added as the value. Otherwise, install name with def - * as value. - */ - -static void -func_install(params, def) -NODE *params; -NODE *def; -{ - NODE *r; - NODE *n; - - /* check for function foo(foo) { ... }. bleh. */ - for (n = params->rnode; n != NULL; n = n->rnode) { - if (strcmp(n->param, params->param) == 0) - fatal("function `%s': can't use function name as parameter name", - params->param); - } - - pop_params(params->rnode); - pop_var(params, FALSE); - r = lookup(params->param); - if (r != NULL) { - fatal("function name `%s' previously defined", params->param); - } else - (void) install(params->param, node(params, Node_func, def)); - - func_use(params->param, FUNC_DEFINE); -} - -/* pop_var --- remove a variable from the symbol table */ - -static void -pop_var(np, freeit) -NODE *np; -int freeit; -{ - register NODE *bucket, **save; - register size_t len; - char *name; - - name = np->param; - len = strlen(name); - save = &(variables[hash(name, len, (unsigned long) HASHSIZE)]); - for (bucket = *save; bucket != NULL; bucket = bucket->hnext) { - if (len == bucket->hlength && STREQN(bucket->hname, name, len)) { - *save = bucket->hnext; - freenode(bucket); - if (freeit) - free(np->param); - return; - } - save = &(bucket->hnext); - } -} - -/* pop_params --- remove list of function parameters from symbol table */ - -/* - * pop parameters out of the symbol table. do this in reverse order to - * avoid reading freed memory if there were duplicated parameters. - */ -static void -pop_params(params) -NODE *params; -{ - if (params == NULL) - return; - pop_params(params->rnode); - pop_var(params, TRUE); -} - -/* make_param --- make NAME into a function parameter */ - -static NODE * -make_param(name) -char *name; -{ - NODE *r; - - getnode(r); - r->type = Node_param_list; - r->rnode = NULL; - r->param = name; - r->param_cnt = param_counter++; - return (install(name, r)); -} - -static struct fdesc { - char *name; - short used; - short defined; - struct fdesc *next; -} *ftable[HASHSIZE]; - -/* func_use --- track uses and definitions of functions */ - -static void -func_use(name, how) -char *name; -enum defref how; -{ - struct fdesc *fp; - int len; - int ind; - - len = strlen(name); - ind = hash(name, len, HASHSIZE); - - for (fp = ftable[ind]; fp != NULL; fp = fp->next) { - if (strcmp(fp->name, name) == 0) { - if (how == FUNC_DEFINE) - fp->defined++; - else - fp->used++; - return; - } - } - - /* not in the table, fall through to allocate a new one */ - - emalloc(fp, struct fdesc *, sizeof(struct fdesc), "func_use"); - memset(fp, '\0', sizeof(struct fdesc)); - emalloc(fp->name, char *, len + 1, "func_use"); - strcpy(fp->name, name); - if (how == FUNC_DEFINE) - fp->defined++; - else - fp->used++; - fp->next = ftable[ind]; - ftable[ind] = fp; -} - -/* check_funcs --- verify functions that are called but not defined */ - -static void -check_funcs() -{ - struct fdesc *fp, *next; - int i; - - for (i = 0; i < HASHSIZE; i++) { - for (fp = ftable[i]; fp != NULL; fp = fp->next) { -#ifdef REALLYMEAN - /* making this the default breaks old code. sigh. */ - if (fp->defined == 0) { - error( - "function `%s' called but never defined", fp->name); - errcount++; - } -#else - if (do_lint && fp->defined == 0) - warning( - "function `%s' called but never defined", fp->name); -#endif - if (do_lint && fp->used == 0) { - warning("function `%s' defined but never called", - fp->name); - } - } - } - - /* now let's free all the memory */ - for (i = 0; i < HASHSIZE; i++) { - for (fp = ftable[i]; fp != NULL; fp = next) { - next = fp->next; - free(fp->name); - free(fp); - } - } -} - -/* param_sanity --- look for parameters that are regexp constants */ - -static void -param_sanity(arglist) -NODE *arglist; -{ - NODE *argp, *arg; - int i; - - for (i = 1, argp = arglist; argp != NULL; argp = argp->rnode, i++) { - arg = argp->lnode; - if (arg->type == Node_regex) - warning("regexp constant for parameter #%d yields boolean value", i); - } -} - -/* variable --- make sure NAME is in the symbol table */ - -NODE * -variable(name, can_free, type) -char *name; -int can_free; -NODETYPE type; -{ - register NODE *r; - static int env_loaded = FALSE; - - if (! env_loaded && STREQ(name, "ENVIRON")) { - load_environ(); - env_loaded = TRUE; - } - if ((r = lookup(name)) == NULL) - r = install(name, node(Nnull_string, type, (NODE *) NULL)); - else if (can_free) - free(name); - return r; -} - -/* mk_rexp --- make a regular expression constant */ - -static NODE * -mk_rexp(exp) -NODE *exp; -{ - NODE *n; - - if (exp->type == Node_regex) - return exp; - - getnode(n); - n->type = Node_regex; - n->re_exp = exp; - n->re_text = NULL; - n->re_reg = NULL; - n->re_flags = 0; - n->re_cnt = 1; - return n; -} - -/* isnoeffect --- when used as a statement, has no side effects */ - -/* - * To be completely general, we should recursively walk the parse - * tree, to make sure that all the subexpressions also have no effect. - * Instead, we just weaken the actual warning that's printed, up above - * in the grammar. - */ - -static int -isnoeffect(type) -NODETYPE type; -{ - switch (type) { - case Node_times: - case Node_quotient: - case Node_mod: - case Node_plus: - case Node_minus: - case Node_subscript: - case Node_concat: - case Node_exp: - case Node_unary_minus: - case Node_field_spec: - case Node_and: - case Node_or: - case Node_equal: - case Node_notequal: - case Node_less: - case Node_greater: - case Node_leq: - case Node_geq: - case Node_match: - case Node_nomatch: - case Node_not: - case Node_val: - case Node_in_array: - case Node_NF: - case Node_NR: - case Node_FNR: - case Node_FS: - case Node_RS: - case Node_FIELDWIDTHS: - case Node_IGNORECASE: - case Node_OFS: - case Node_ORS: - case Node_OFMT: - case Node_CONVFMT: - return TRUE; - default: - break; /* keeps gcc -Wall happy */ - } - - return FALSE; -} - -/* isassignable --- can this node be assigned to? */ - -static int -isassignable(n) -register NODE *n; -{ - switch (n->type) { - case Node_var: - case Node_FIELDWIDTHS: - case Node_RS: - case Node_FS: - case Node_FNR: - case Node_NR: - case Node_NF: - case Node_IGNORECASE: - case Node_OFMT: - case Node_CONVFMT: - case Node_ORS: - case Node_OFS: - case Node_field_spec: - case Node_subscript: - return TRUE; - case Node_param_list: - return ((n->flags & FUNC) == 0); /* ok if not func name */ - default: - break; /* keeps gcc -Wall happy */ - } - return FALSE; -} - -/* for debugging */ -NODE * -stopme(tree) -NODE *tree; -{ - return tmp_number((AWKNUM) 0.0); -} diff --git a/contrib/awk/configh.in b/contrib/awk/configh.in deleted file mode 100644 index f423d4aac8943..0000000000000 --- a/contrib/awk/configh.in +++ /dev/null @@ -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 */ diff --git a/contrib/awk/configure b/contrib/awk/configure deleted file mode 100755 index b4ba9dc3dd809..0000000000000 --- a/contrib/awk/configure +++ /dev/null @@ -1,3685 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: -ac_help="$ac_help - --enable-bitops Enable Octal and Hex constants and bit functions" -ac_help="$ac_help - --enable-non-decimal-data Enable Octal and Hex constants as valid input data" -ac_help="$ac_help - --disable-largefile omit support for large files" - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=awk.h - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - - - -# Check whether --enable-bitops or --disable-bitops was given. -if test "${enable_bitops+set}" = set; then - enableval="$enable_bitops" - cat >> confdefs.h <<\EOF -#define BITOPS 1 -EOF - -fi - -# Check whether --enable-non-decimal-data or --disable-non-decimal-data was given. -if test "${enable_non_decimal_data+set}" = set; then - enableval="$enable_non_decimal_data" - cat >> confdefs.h <<\EOF -#define NONDECDATA 1 -EOF - -fi - - -for ac_prog in 'bison -y' byacc -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:558: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -YACC="$ac_cv_prog_YACC" -if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$YACC" && break -done -test -n "$YACC" || YACC="yacc" - -echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:589: checking whether ln -s works" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftestdata -if ln -s X conftestdata 2>/dev/null -then - rm -f conftestdata - ac_cv_prog_LN_S="ln -s" -else - ac_cv_prog_LN_S=ln -fi -fi -LN_S="$ac_cv_prog_LN_S" -if test "$ac_cv_prog_LN_S" = "ln -s"; then - echo "$ac_t""yes" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:612: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:642: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:693: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:725: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 736 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:767: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:772: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:781: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:800: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:832: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 847 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 864 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 881 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - - -# 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_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } -fi -ac_config_guess=$ac_aux_dir/config.guess -ac_config_sub=$ac_aux_dir/config.sub -ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:946: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - else - ac_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - done - ;; - esac - done - IFS="$ac_save_IFS" - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL="$ac_cv_path_install" - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL="$ac_install_sh" - fi -fi -echo "$ac_t""$INSTALL" 1>&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1000: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - - -if test "$CFLAGS" = "" -then - if test "$GCC" = yes - then - CFLAGS="-g -O" - else - 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 - cat >> confdefs.h <<\EOF -#define BITOPS 1 -EOF - - cat >> confdefs.h <<\EOF -#define NONDECDATA 1 -EOF - - CFLAGS="$CFLAGS -DARRAYDEBUG" -fi - - - -echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1055: checking for AIX" >&5 -cat > conftest.$ac_ext <<EOF -#line 1057 "configure" -#include "confdefs.h" -#ifdef _AIX - yes -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF -#define _ALL_SOURCE 1 -EOF - -else - rm -rf conftest* - echo "$ac_t""no" 1>&6 -fi -rm -f conftest* - - -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1079: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi -else - echo "$ac_t""no" 1>&6 - ISC= -fi - -ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1101: checking for minix/config.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1106 "configure" -#include "confdefs.h" -#include <minix/config.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - MINIX=yes -else - echo "$ac_t""no" 1>&6 -MINIX= -fi - -if test "$MINIX" = yes; then - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - cat >> confdefs.h <<\EOF -#define _POSIX_1_SOURCE 2 -EOF - - cat >> confdefs.h <<\EOF -#define _MINIX 1 -EOF - -fi - -# Check whether --enable-largefile or --disable-largefile was given. -if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" - : -fi - - if test "$enable_largefile" != no; then - - echo $ac_n "checking for special C compiler options needed for large files""... $ac_c" 1>&6 -echo "configure:1157: checking for special C compiler options needed for large files" >&5 -if eval "test \"`echo '$''{'gawk_cv_sys_largefile_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - 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. - cat > conftest.$ac_ext <<EOF -#line 1166 "configure" -#include "confdefs.h" -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - -int main() { - -; return 0; } -EOF -if { (eval echo configure:1175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_save_CC="$CC" - CC="$CC -n32" - cat > conftest.$ac_ext <<EOF -#line 1184 "configure" -#include "confdefs.h" -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - -int main() { - -; return 0; } -EOF -if { (eval echo configure:1193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gawk_cv_sys_largefile_CC=' -n32' -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* - CC="$ac_save_CC" -fi -rm -f conftest* - fi -fi - -echo "$ac_t""$gawk_cv_sys_largefile_CC" 1>&6 - if test "$gawk_cv_sys_largefile_CC" != no; then - CC="$CC$gawk_cv_sys_largefile_CC" - fi - - echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6 -echo "configure:1213: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -if eval "test \"`echo '$''{'gawk_cv_sys_file_offset_bits'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - gawk_cv_sys_file_offset_bits=no - cat > conftest.$ac_ext <<EOF -#line 1219 "configure" -#include "confdefs.h" -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - - - -int main() { - -; return 0; } -EOF -if { (eval echo configure:1230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <<EOF -#line 1237 "configure" -#include "confdefs.h" -#define _FILE_OFFSET_BITS 64 -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - - - -int main() { - -; return 0; } -EOF -if { (eval echo configure:1249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gawk_cv_sys_file_offset_bits=64 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -fi -rm -f conftest* -fi - -echo "$ac_t""$gawk_cv_sys_file_offset_bits" 1>&6 - if test "$gawk_cv_sys_file_offset_bits" != no; then - cat >> confdefs.h <<EOF -#define _FILE_OFFSET_BITS $gawk_cv_sys_file_offset_bits -EOF - - fi - echo $ac_n "checking for _LARGEFILE_SOURCE value needed for large files""... $ac_c" 1>&6 -echo "configure:1269: checking for _LARGEFILE_SOURCE value needed for large files" >&5 -if eval "test \"`echo '$''{'gawk_cv_sys_largefile_source'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - gawk_cv_sys_largefile_source=no - cat > conftest.$ac_ext <<EOF -#line 1275 "configure" -#include "confdefs.h" -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - -#include <stdio.h> - -int main() { -return !ftello; -; return 0; } -EOF -if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <<EOF -#line 1293 "configure" -#include "confdefs.h" -#define _LARGEFILE_SOURCE 1 -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - -#include <stdio.h> - -int main() { -return !ftello; -; return 0; } -EOF -if { (eval echo configure:1305: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gawk_cv_sys_largefile_source=1 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -fi -rm -f conftest* -fi - -echo "$ac_t""$gawk_cv_sys_largefile_source" 1>&6 - if test "$gawk_cv_sys_largefile_source" != no; then - cat >> confdefs.h <<EOF -#define _LARGEFILE_SOURCE $gawk_cv_sys_largefile_source -EOF - - fi - echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6 -echo "configure:1325: checking for _LARGE_FILES value needed for large files" >&5 -if eval "test \"`echo '$''{'gawk_cv_sys_large_files'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - gawk_cv_sys_large_files=no - cat > conftest.$ac_ext <<EOF -#line 1331 "configure" -#include "confdefs.h" -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - - - -int main() { - -; return 0; } -EOF -if { (eval echo configure:1342: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <<EOF -#line 1349 "configure" -#include "confdefs.h" -#define _LARGE_FILES 1 -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - - - -int main() { - -; return 0; } -EOF -if { (eval echo configure:1361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gawk_cv_sys_large_files=1 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -fi -rm -f conftest* -fi - -echo "$ac_t""$gawk_cv_sys_large_files" 1>&6 - if test "$gawk_cv_sys_large_files" != no; then - cat >> confdefs.h <<EOF -#define _LARGE_FILES $gawk_cv_sys_large_files -EOF - - fi - echo $ac_n "checking for _XOPEN_SOURCE value needed for large files""... $ac_c" 1>&6 -echo "configure:1381: checking for _XOPEN_SOURCE value needed for large files" >&5 -if eval "test \"`echo '$''{'gawk_cv_sys_xopen_source'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - gawk_cv_sys_xopen_source=no - cat > conftest.$ac_ext <<EOF -#line 1387 "configure" -#include "confdefs.h" -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - -#include <stdio.h> - -int main() { -return !ftello; -; return 0; } -EOF -if { (eval echo configure:1398: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cat > conftest.$ac_ext <<EOF -#line 1405 "configure" -#include "confdefs.h" -#define _XOPEN_SOURCE 500 -#include <sys/types.h> - int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1]; - -#include <stdio.h> - -int main() { -return !ftello; -; return 0; } -EOF -if { (eval echo configure:1417: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gawk_cv_sys_xopen_source=500 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -fi -rm -f conftest* -fi - -echo "$ac_t""$gawk_cv_sys_xopen_source" 1>&6 - if test "$gawk_cv_sys_xopen_source" != no; then - cat >> confdefs.h <<EOF -#define _XOPEN_SOURCE $gawk_cv_sys_xopen_source -EOF - - fi - fi - - -echo $ac_n "checking for AIX compilation hacks""... $ac_c" 1>&6 -echo "configure:1440: checking for AIX compilation hacks" >&5 -if eval "test \"`echo '$''{'gawk_cv_aix_hack'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - -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 - -fi -echo "$ac_t""${gawk_cv_aix_hack}" 1>&6 - - -if test "$ISC" = 1 # will be set by test for ISC -then - CFLAGS="$CFLAGS -D_SYSV3" -fi - -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1463: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1468 "configure" -#include "confdefs.h" -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1476: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - ac_cv_header_stdc=yes -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1493 "configure" -#include "confdefs.h" -#include <string.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. -cat > conftest.$ac_ext <<EOF -#line 1511 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then - : -else - rm -rf conftest* - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. -if test "$cross_compiling" = yes; then - : -else - cat > conftest.$ac_ext <<EOF -#line 1532 "configure" -#include "confdefs.h" -#include <ctype.h> -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int main () { int i; for (i = 0; i < 256; i++) -if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); -exit (0); } - -EOF -if { (eval echo configure:1543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 -if test $ac_cv_header_stdc = yes; then - cat >> confdefs.h <<\EOF -#define STDC_HEADERS 1 -EOF - -fi - -echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1567: checking for sys/wait.h that is POSIX.1 compatible" >&5 -if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1572 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <sys/wait.h> -#ifndef WEXITSTATUS -#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) -#endif -#ifndef WIFEXITED -#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) -#endif -int main() { -int s; -wait (&s); -s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; -; return 0; } -EOF -if { (eval echo configure:1588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_sys_wait_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_sys_wait_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 -if test $ac_cv_header_sys_wait_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_SYS_WAIT_H 1 -EOF - -fi - -for ac_hdr in limits.h locale.h stdarg.h unistd.h signum.h sys/param.h string.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1612: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1617 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1622: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -if test "$ac_cv_header_string_h" = yes -then - for ac_hdr in memory.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1654: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1659 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1664: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -else - for ac_hdr in strings.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1695: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1700 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1705: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -fi - -echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:1734: checking for pid_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1739 "configure" -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_pid_t=yes -else - rm -rf conftest* - ac_cv_type_pid_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_pid_t" 1>&6 -if test $ac_cv_type_pid_t = no; then - cat >> confdefs.h <<\EOF -#define pid_t int -EOF - -fi - -echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:1767: checking return type of signal handlers" >&5 -if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1772 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <signal.h> -#ifdef signal -#undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif - -int main() { -int i; -; return 0; } -EOF -if { (eval echo configure:1789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_type_signal=void -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_type_signal=int -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_type_signal" 1>&6 -cat >> confdefs.h <<EOF -#define RETSIGTYPE $ac_cv_type_signal -EOF - - -echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1808: checking for size_t" >&5 -if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1813 "configure" -#include "confdefs.h" -#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_size_t=yes -else - rm -rf conftest* - ac_cv_type_size_t=no -fi -rm -f conftest* - -fi -echo "$ac_t""$ac_cv_type_size_t" 1>&6 -if test $ac_cv_type_size_t = no; then - cat >> confdefs.h <<\EOF -#define size_t unsigned -EOF - -fi - -echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1841: checking for uid_t in sys/types.h" >&5 -if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1846 "configure" -#include "confdefs.h" -#include <sys/types.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "uid_t" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_uid_t=yes -else - rm -rf conftest* - ac_cv_type_uid_t=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_type_uid_t" 1>&6 -if test $ac_cv_type_uid_t = no; then - cat >> confdefs.h <<\EOF -#define uid_t int -EOF - - cat >> confdefs.h <<\EOF -#define gid_t int -EOF - -fi - -echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:1875: checking type of array argument to getgroups" >&5 -if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_type_getgroups=cross -else - cat > conftest.$ac_ext <<EOF -#line 1883 "configure" -#include "confdefs.h" - -/* Thanks to Mike Rendell for this test. */ -#include <sys/types.h> -#define NGID 256 -#undef MAX -#define MAX(x, y) ((x) > (y) ? (x) : (y)) -main() -{ - gid_t gidset[NGID]; - int i, n; - union { gid_t gval; long lval; } val; - - val.lval = -1; - for (i = 0; i < NGID; i++) - gidset[i] = val.gval; - n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, - gidset); - /* Exit non-zero if getgroups seems to require an array of ints. This - happens when gid_t is short but getgroups modifies an array of ints. */ - exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); -} - -EOF -if { (eval echo configure:1908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_type_getgroups=gid_t -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_type_getgroups=int -fi -rm -fr conftest* -fi - -if test $ac_cv_type_getgroups = cross; then - cat > conftest.$ac_ext <<EOF -#line 1922 "configure" -#include "confdefs.h" -#include <unistd.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_type_getgroups=gid_t -else - rm -rf conftest* - ac_cv_type_getgroups=int -fi -rm -f conftest* - -fi -fi - -echo "$ac_t""$ac_cv_type_getgroups" 1>&6 -cat >> confdefs.h <<EOF -#define GETGROUPS_T $ac_cv_type_getgroups -EOF - - -cat > conftest.$ac_ext <<EOF -#line 1946 "configure" -#include "confdefs.h" -#include <stdio.h> -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "int.*sprintf" >/dev/null 2>&1; then - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define SPRINTF_RET int -EOF - -else - rm -rf conftest* - cat >> confdefs.h <<\EOF -#define SPRINTF_RET char * -EOF - -fi -rm -f conftest* - - -if test "$YACC" = "bison -y" || - { test -f $srcdir/awktab.c && grep 'alloca *(' $srcdir/awktab.c > /dev/null; } -then - # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works -# for constant arguments. Useless! -echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1973: checking for working alloca.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1978 "configure" -#include "confdefs.h" -#include <alloca.h> -int main() { -char *p = alloca(2 * sizeof(int)); -; return 0; } -EOF -if { (eval echo configure:1985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_header_alloca_h=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_alloca_h=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 -if test $ac_cv_header_alloca_h = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA_H 1 -EOF - -fi - -echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2006: checking for alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2011 "configure" -#include "confdefs.h" - -#ifdef __GNUC__ -# define alloca __builtin_alloca -#else -# ifdef _MSC_VER -# include <malloc.h> -# define alloca _alloca -# else -# if HAVE_ALLOCA_H -# include <alloca.h> -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -# endif -#endif - -int main() { -char *p = (char *) alloca(1); -; return 0; } -EOF -if { (eval echo configure:2039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_func_alloca_works=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_func_alloca_works=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 -if test $ac_cv_func_alloca_works = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ALLOCA 1 -EOF - -fi - -if test $ac_cv_func_alloca_works = no; then - # The SVR3 libPW and SVR4 libucb both contain incompatible functions - # that cause trouble. Some versions do not even contain alloca or - # contain a buggy version. If you still want to use their alloca, - # use ar to extract alloca.o from them instead of compiling alloca.c. - ALLOCA=alloca.${ac_objext} - cat >> confdefs.h <<\EOF -#define C_ALLOCA 1 -EOF - - -echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2071: checking whether alloca needs Cray hooks" >&5 -if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2076 "configure" -#include "confdefs.h" -#if defined(CRAY) && ! defined(CRAY2) -webecray -#else -wenotbecray -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "webecray" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_os_cray=yes -else - rm -rf conftest* - ac_cv_os_cray=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_os_cray" 1>&6 -if test $ac_cv_os_cray = yes; then -for ac_func in _getb67 GETB67 getb67; do - echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2101: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2106 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<EOF -#define CRAY_STACKSEG_END $ac_func -EOF - - break -else - echo "$ac_t""no" 1>&6 -fi - -done -fi - -echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2156: checking stack direction for C alloca" >&5 -if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_c_stack_direction=0 -else - cat > conftest.$ac_ext <<EOF -#line 2164 "configure" -#include "confdefs.h" -find_stack_direction () -{ - static char *addr = 0; - auto char dummy; - if (addr == 0) - { - addr = &dummy; - return find_stack_direction (); - } - else - return (&dummy > addr) ? 1 : -1; -} -main () -{ - exit (find_stack_direction() < 0); -} -EOF -if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_stack_direction=1 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_stack_direction=-1 -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 -cat >> confdefs.h <<EOF -#define STACK_DIRECTION $ac_cv_c_stack_direction -EOF - -fi - -fi -cat >> confdefs.h <<\EOF -#define REGEX_MALLOC 1 -EOF - -echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:2210: checking for vprintf" >&5 -if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2215 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char vprintf(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vprintf(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_vprintf) || defined (__stub___vprintf) -choke me -#else -vprintf(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_vprintf=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_vprintf=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_VPRINTF 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -if test "$ac_cv_func_vprintf" != yes; then -echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:2262: checking for _doprnt" >&5 -if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2267 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char _doprnt(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char _doprnt(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub__doprnt) || defined (__stub____doprnt) -choke me -#else -_doprnt(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func__doprnt=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func__doprnt=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then - echo "$ac_t""yes" 1>&6 - cat >> confdefs.h <<\EOF -#define HAVE_DOPRNT 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi - -fi - - -echo $ac_n "checking for fmod in -lm""... $ac_c" 1>&6 -echo "configure:2316: checking for fmod in -lm" >&5 -ac_lib_var=`echo m'_'fmod | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-lm $LIBS" -cat > conftest.$ac_ext <<EOF -#line 2324 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char fmod(); - -int main() { -fmod() -; return 0; } -EOF -if { (eval echo configure:2335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ - -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` - cat >> confdefs.h <<EOF -#define $ac_tr_lib 1 -EOF - - LIBS="-lm $LIBS" - -else - echo "$ac_t""no" 1>&6 -fi - -for ac_func in madvise memset memcpy memcmp fmod setlocale strchr strerror \ - strftime strncasecmp strtod system tzset -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2366: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2371 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - - -for ac_hdr in unistd.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2423: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2428 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -for ac_func in getpagesize -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2462: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2467 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:2490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - -echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:2515: checking for working mmap" >&5 -if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - ac_cv_func_mmap_fixed_mapped=no -else - cat > conftest.$ac_ext <<EOF -#line 2523 "configure" -#include "confdefs.h" - -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the filesystem buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propogated back to all the places they're supposed to be. - - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ -#include <sys/types.h> -#include <fcntl.h> -#include <sys/mman.h> - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef HAVE_UNISTD_H -# include <unistd.h> -# endif - -/* Assume that all systems that can run configure have sys/param.h. */ -# ifndef HAVE_SYS_PARAM_H -# define HAVE_SYS_PARAM_H 1 -# endif - -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include <sys/param.h> -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -#ifdef __cplusplus -extern "C" { void *malloc(unsigned); } -#else -char *malloc(); -#endif - -int -main() -{ - char *data, *data2, *data3; - int i, pagesize; - int fd; - - pagesize = getpagesize(); - - /* - * First, make a file with some known garbage in it. - */ - data = malloc(pagesize); - if (!data) - exit(1); - for (i = 0; i < pagesize; ++i) - *(data + i) = rand(); - umask(0); - fd = creat("conftestmmap", 0600); - if (fd < 0) - exit(1); - if (write(fd, data, pagesize) != pagesize) - exit(1); - close(fd); - - /* - * Next, try to mmap the file at a fixed address which - * already has something else allocated at it. If we can, - * also make sure that we see the same garbage. - */ - fd = open("conftestmmap", O_RDWR); - if (fd < 0) - exit(1); - data2 = malloc(2 * pagesize); - if (!data2) - exit(1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); - if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - exit(1); - - /* - * Finally, make sure that changes to the mapped area - * do not percolate back to the file as seen by read(). - * (This is a bug on some variants of i386 svr4.0.) - */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = malloc(pagesize); - if (!data3) - exit(1); - if (read(fd, data3, pagesize) != pagesize) - exit(1); - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - exit(1); - close(fd); - unlink("conftestmmap"); - exit(0); -} - -EOF -if { (eval echo configure:2663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_mmap_fixed_mapped=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_mmap_fixed_mapped=no -fi -rm -fr conftest* -fi - -fi - -echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 -if test $ac_cv_func_mmap_fixed_mapped = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_MMAP 1 -EOF - -fi - - -if (uname) > /dev/null 2>&1 -then - case `uname` in - *VMS*|*BeOS*) - cat >> confdefs.h <<\EOF -#define GETPGRP_VOID 1 -EOF - - ;; - *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 - echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:2710: checking whether getpgrp takes no argument" >&5 -if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 2718 "configure" -#include "confdefs.h" - -/* - * If this system has a BSD-style getpgrp(), - * which takes a pid argument, exit unsuccessfully. - * - * Snarfed from Chet Ramey's bash pgrp.c test program - */ -#include <stdio.h> -#include <sys/types.h> - -int pid; -int pg1, pg2, pg3, pg4; -int ng, np, s, child; - -main() -{ - pid = getpid(); - pg1 = getpgrp(0); - pg2 = getpgrp(); - pg3 = getpgrp(pid); - pg4 = getpgrp(1); - - /* - * If all of these values are the same, it's pretty sure that - * we're on a system that ignores getpgrp's first argument. - */ - if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) - exit(0); - - child = fork(); - if (child < 0) - exit(1); - else if (child == 0) { - np = getpid(); - /* - * If this is Sys V, this will not work; pgrp will be - * set to np because setpgrp just changes a pgrp to be - * the same as the pid. - */ - setpgrp(np, pg1); - ng = getpgrp(0); /* Same result for Sys V and BSD */ - if (ng == pg1) { - exit(1); - } else { - exit(0); - } - } else { - wait(&s); - exit(s>>8); - } -} - -EOF -if { (eval echo configure:2773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_getpgrp_void=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_getpgrp_void=no -fi -rm -fr conftest* -fi - - -fi - -echo "$ac_t""$ac_cv_func_getpgrp_void" 1>&6 -if test $ac_cv_func_getpgrp_void = yes; then - cat >> confdefs.h <<\EOF -#define GETPGRP_VOID 1 -EOF - -fi - - ;; - *) echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:2798: checking whether getpgrp takes no argument" >&5 -if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 2806 "configure" -#include "confdefs.h" - -/* - * If this system has a BSD-style getpgrp(), - * which takes a pid argument, exit unsuccessfully. - * - * Snarfed from Chet Ramey's bash pgrp.c test program - */ -#include <stdio.h> -#include <sys/types.h> - -int pid; -int pg1, pg2, pg3, pg4; -int ng, np, s, child; - -main() -{ - pid = getpid(); - pg1 = getpgrp(0); - pg2 = getpgrp(); - pg3 = getpgrp(pid); - pg4 = getpgrp(1); - - /* - * If all of these values are the same, it's pretty sure that - * we're on a system that ignores getpgrp's first argument. - */ - if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) - exit(0); - - child = fork(); - if (child < 0) - exit(1); - else if (child == 0) { - np = getpid(); - /* - * If this is Sys V, this will not work; pgrp will be - * set to np because setpgrp just changes a pgrp to be - * the same as the pid. - */ - setpgrp(np, pg1); - ng = getpgrp(0); /* Same result for Sys V and BSD */ - if (ng == pg1) { - exit(1); - } else { - exit(0); - } - } else { - wait(&s); - exit(s>>8); - } -} - -EOF -if { (eval echo configure:2861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_getpgrp_void=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_getpgrp_void=no -fi -rm -fr conftest* -fi - - -fi - -echo "$ac_t""$ac_cv_func_getpgrp_void" 1>&6 -if test $ac_cv_func_getpgrp_void = yes; then - cat >> confdefs.h <<\EOF -#define GETPGRP_VOID 1 -EOF - -fi - - ;; - esac -else - echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:2888: checking whether getpgrp takes no argument" >&5 -if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$cross_compiling" = yes; then - { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 2896 "configure" -#include "confdefs.h" - -/* - * If this system has a BSD-style getpgrp(), - * which takes a pid argument, exit unsuccessfully. - * - * Snarfed from Chet Ramey's bash pgrp.c test program - */ -#include <stdio.h> -#include <sys/types.h> - -int pid; -int pg1, pg2, pg3, pg4; -int ng, np, s, child; - -main() -{ - pid = getpid(); - pg1 = getpgrp(0); - pg2 = getpgrp(); - pg3 = getpgrp(pid); - pg4 = getpgrp(1); - - /* - * If all of these values are the same, it's pretty sure that - * we're on a system that ignores getpgrp's first argument. - */ - if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) - exit(0); - - child = fork(); - if (child < 0) - exit(1); - else if (child == 0) { - np = getpid(); - /* - * If this is Sys V, this will not work; pgrp will be - * set to np because setpgrp just changes a pgrp to be - * the same as the pid. - */ - setpgrp(np, pg1); - ng = getpgrp(0); /* Same result for Sys V and BSD */ - if (ng == pg1) { - exit(1); - } else { - exit(0); - } - } else { - wait(&s); - exit(s>>8); - } -} - -EOF -if { (eval echo configure:2951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_func_getpgrp_void=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_func_getpgrp_void=no -fi -rm -fr conftest* -fi - - -fi - -echo "$ac_t""$ac_cv_func_getpgrp_void" 1>&6 -if test $ac_cv_func_getpgrp_void = yes; then - cat >> confdefs.h <<\EOF -#define GETPGRP_VOID 1 -EOF - -fi - -fi - -echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:2977: checking for st_blksize in struct stat" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 2982 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <sys/stat.h> -int main() { -struct stat s; s.st_blksize; -; return 0; } -EOF -if { (eval echo configure:2990: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_st_blksize=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_st_blksize=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 -if test $ac_cv_struct_st_blksize = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_ST_BLKSIZE 1 -EOF - -fi - -echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3011: checking whether time.h and sys/time.h may both be included" >&5 -if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3016 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <sys/time.h> -#include <time.h> -int main() { -struct tm *tp; -; return 0; } -EOF -if { (eval echo configure:3025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_header_time=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_time=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_header_time" 1>&6 -if test $ac_cv_header_time = yes; then - cat >> confdefs.h <<\EOF -#define TIME_WITH_SYS_TIME 1 -EOF - -fi - -echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:3046: checking whether struct tm is in sys/time.h or time.h" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3051 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <time.h> -int main() { -struct tm *tp; tp->tm_sec; -; return 0; } -EOF -if { (eval echo configure:3059: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_tm=time.h -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_tm=sys/time.h -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_struct_tm" 1>&6 -if test $ac_cv_struct_tm = sys/time.h; then - cat >> confdefs.h <<\EOF -#define TM_IN_SYS_TIME 1 -EOF - -fi - -echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:3080: checking for tm_zone in struct tm" >&5 -if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3085 "configure" -#include "confdefs.h" -#include <sys/types.h> -#include <$ac_cv_struct_tm> -int main() { -struct tm tm; tm.tm_zone; -; return 0; } -EOF -if { (eval echo configure:3093: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_struct_tm_zone=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_struct_tm_zone=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6 -if test "$ac_cv_struct_tm_zone" = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_TM_ZONE 1 -EOF - -else - echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:3113: checking for tzname" >&5 -if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3118 "configure" -#include "confdefs.h" -#include <time.h> -#ifndef tzname /* For SGI. */ -extern char *tzname[]; /* RS6000 and others reject char **tzname. */ -#endif -int main() { -atoi(*tzname); -; return 0; } -EOF -if { (eval echo configure:3128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - ac_cv_var_tzname=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_var_tzname=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_var_tzname" 1>&6 - if test $ac_cv_var_tzname = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_TZNAME 1 -EOF - - fi -fi - - -echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:3151: checking whether char is unsigned" >&5 -if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test "$GCC" = yes; then - # GCC predefines this symbol on systems where it applies. -cat > conftest.$ac_ext <<EOF -#line 3158 "configure" -#include "confdefs.h" -#ifdef __CHAR_UNSIGNED__ - yes -#endif - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "yes" >/dev/null 2>&1; then - rm -rf conftest* - ac_cv_c_char_unsigned=yes -else - rm -rf conftest* - ac_cv_c_char_unsigned=no -fi -rm -f conftest* - -else -if test "$cross_compiling" = yes; then - { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } -else - cat > conftest.$ac_ext <<EOF -#line 3180 "configure" -#include "confdefs.h" -/* volatile prevents gcc2 from optimizing the test away on sparcs. */ -#if !defined(__STDC__) || __STDC__ != 1 -#define volatile -#endif -main() { - volatile char c = 255; exit(c < 0); -} -EOF -if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then - ac_cv_c_char_unsigned=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_c_char_unsigned=no -fi -rm -fr conftest* -fi - -fi -fi - -echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6 -if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then - cat >> confdefs.h <<\EOF -#define __CHAR_UNSIGNED__ 1 -EOF - -fi - -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:3214: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3219 "configure" -#include "confdefs.h" - -int main() { - -/* Ultrix mips cc rejects this. */ -typedef int charset[2]; const charset x; -/* SunOS 4.1.1 cc rejects this. */ -char const *const *ccp; -char **p; -/* NEC SVR4.0.2 mips cc rejects this. */ -struct point {int x, y;}; -static struct point const zero = {0,0}; -/* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in an arm - of an if-expression whose if-part is not a constant expression */ -const char *g = "string"; -ccp = &g + (g ? g-g : 0); -/* HPUX 7.0 cc rejects these. */ -++ccp; -p = (char**) ccp; -ccp = (char const *const *) p; -{ /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; -} -{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; -} -{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; -} -{ /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:3268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - ac_cv_c_const=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 -if test $ac_cv_c_const = no; then - cat >> confdefs.h <<\EOF -#define const -EOF - -fi - - - -echo $ac_n "checking for ANSI stringizing capability""... $ac_c" 1>&6 -echo "configure:3291: checking for ANSI stringizing capability" >&5 -if eval "test \"`echo '$''{'gawk_cv_c_stringize'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 3296 "configure" -#include "confdefs.h" - -#define x(y) #y - -char *s = x(teststring); - -EOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "#teststring" >/dev/null 2>&1; then - rm -rf conftest* - gawk_cv_c_stringize=no -else - rm -rf conftest* - gawk_cv_c_stringize=yes -fi -rm -f conftest* - -fi - -if test "${gawk_cv_c_stringize}" = yes -then - cat >> confdefs.h <<\EOF -#define HAVE_STRINGIZE 1 -EOF - -fi -echo "$ac_t""${gawk_cv_c_stringize}" 1>&6 - - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -DEFS=-DHAVE_CONFIG_H - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir -ac_given_INSTALL="$INSTALL" - -trap 'rm -fr `echo "Makefile doc/Makefile test/Makefile awklib/Makefile config.h:configh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@YACC@%$YACC%g -s%@LN_S@%$LN_S%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g -s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@SET_MAKE@%$SET_MAKE%g -s%@ALLOCA@%$ALLOCA%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile test/Makefile awklib/Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - case "$ac_given_INSTALL" in - [/$]*) INSTALL="$ac_given_INSTALL" ;; - *) INSTALL="$ac_dots$ac_given_INSTALL" ;; - esac - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -s%@INSTALL@%$INSTALL%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' -ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <<EOF - CONFIG_HEADERS="config.h:configh.in" -EOF -cat >> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. - -rm -f conftest.tail -while : -do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS - echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h - else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF -date > stamp-h -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/awk/configure.in b/contrib/awk/configure.in deleted file mode 100644 index 7867034fb76bc..0000000000000 --- a/contrib/awk/configure.in +++ /dev/null @@ -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]) diff --git a/contrib/awk/doc/Makefile.in b/contrib/awk/doc/Makefile.in deleted file mode 100644 index edcf404656021..0000000000000 --- a/contrib/awk/doc/Makefile.in +++ /dev/null @@ -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 diff --git a/contrib/awk/doc/README.card b/contrib/awk/doc/README.card deleted file mode 100644 index ef77cdacec7b0..0000000000000 --- a/contrib/awk/doc/README.card +++ /dev/null @@ -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. diff --git a/contrib/awk/doc/ad.block b/contrib/awk/doc/ad.block deleted file mode 100644 index d31f5d50a0437..0000000000000 --- a/contrib/awk/doc/ad.block +++ /dev/null @@ -1,49 +0,0 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org -.\" 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: gnu@gnu.org -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 diff --git a/contrib/awk/doc/awkcard.in b/contrib/awk/doc/awkcard.in deleted file mode 100644 index ac1e8e56c74c8..0000000000000 --- a/contrib/awk/doc/awkcard.in +++ /dev/null @@ -1,1550 +0,0 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org -.\" -.\" Copyright (C) 1996, 1997, 1998, 1999, 2000 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. -.\" -.\" Strings to save typing -.ds AK \*(FCawk\*(FR -.ds GK \*(FCgawk\*(FR -.ds NK Bell Labs \*(FCawk\*(FR -.ds MK \*(FCmawk\*(FR -.\" -.\" -.de TD\" tab defaults -.ta .2i .78i 1i 1.2i 1.4i 1.7i -.. -.de TE -.TD -.. - -.sp -.ce -\*(CD\f(HB\s+8AWK REFERENCE\s0\*(FR -.sp -.\" --- Table Of Contents -.ta 2.4i 2.6iR -.lc . -.ES -.in +.2i -.nf -\*(FRAWK Program Execution 4 -Action Statements 7 -Arrays 9 -Bug Reports 15 -Command Line Arguments (standard) 2 -Command Line Arguments (\*(GK) 3 -Command Line Arguments (\*(MK) 4 -Conversions And Comparisons 10 -Copying Permissions 16 -Definitions 2 -Environment Variables 16 -Escape Sequences 7 -Expressions 9 -Fields 6 -FTP Information 16 -Historical Features (\*(GK) 16 -Input Control 11 -Lines And Statements 5 -.ig -Localization 10 -.. -Numeric Functions 13 -Output Control 11 -Pattern Elements 7 -POSIX Character Classes (\*(GK) 6 -Printf Formats 12 -Records 6 -Regular Expressions 5 -Special Filenames 13 -String Functions 14 -Time Functions (\*(GK) 15 -User-defined Functions 15 -Variables 8\*(CX -.in -.2i -.EB "\s+2\f(HBCONTENTS\*(FR\s0" -.sp -.TD -.fi -\*(CD\*(FRThis reference card was written by Arnold Robbins. -Brian Kernighan and Michael Brennan reviewed it; we thank them -for their help. -.sp -.SL -.sp -.so SRCDIR/ad.block -.\" a subtlety here; this line changes color. We rely on it -.\" also to provide a blank line. -\*(CD -.SL -.nf -\*(FR\(co Copyright 1996-2000, Free Software Foundation -59 Temple Place \(em Suite 330 -Boston, MA 02111-1307 USA -.nf -.BT - - -.\" -.\" -.\" --- Definitions -.fi -.ES -\*(CDThis card describes POSIX AWK, as well as the three -freely available \*(AK implementations -(see \fHFTP Information\fP below). -\*(CLCommon extensions (in two or more versions) are printed in light blue. -\*(CBFeatures specific to just one version\(emusually GNU AWK (\*(GK)\(emare -printed in dark blue. -\*(CRExceptions and deprecated features are printed in red. -\*(CDFeatures mandated by POSIX are printed in black. -.sp .5 -Several type faces are used to clarify the meaning: -.br -.nr IN \w'\(bu ' -\(bu \*(FC\*(CN\fP is used for computer input. -.br -.fi -.in +\n(INu -.ti -\n(INu -\(bu\|\^\*(FI\*(IN\fP is used to indicate user input and for syntactic -placeholders, such as \*(FIvariable\fP or \*(FIaction\fP. -.in -\n(INu -.br -\(bu \*(RN is used for explanatory text. -.sp .5 -\*(FInumber\fP \- a floating point number as in ANSI C, such as -\*(FC3\*(FR, -\*(FC2.3\*(FR, -\*(FC.4\*(FR, -\*(FC1.4e2\*(FR -or -\*(FC4.1E5\*(FR. -.sp .5 -\*(FIescape sequences\fP \- a special sequence of characters beginning -with a backslash, used to describe otherwise unprintable characters. -(See \fHEscape Sequences\fP below.) -.sp .5 -\*(FIstring\fP \- a group of characters enclosed in double quotes. -Strings may contain \*(FIescape sequences\*(FR. -.sp .5 -\*(FIregexp\fP \- a regular expression, either a regexp constant -enclosed in forward slashes, or a dynamic regexp computed at run-time. -Regexp constants may contain \*(FIescape sequences\*(FR. -.sp .5 -\*(FIname\fP \- a variable, array or function name. -.sp .5 -\*(FIentry\fP(\*(FIN\fP) \- entry \*(FIentry\fP in section \*(FIN\fP of the -UNIX reference manual. -.sp .5 -\*(FIpattern\fP \- an expression describing an input record to be matched. -.sp .5 -\*(FIaction\fP \- statements to execute when an input record is matched. -.sp .5 -\*(FIrule\fP \- a pattern-action pair, where the pattern or action may -be missing.\*(CX -.EB \s+2\f(HBDEFINITIONS\*(FR\s0 - -.\" --- Command Line Arguments -.ES -.fi -\*(CDCommand line arguments control setting the field separator, -setting variables before the \*(FCBEGIN\fP rule is run, and -the location of AWK program source code. -Implementation-specific command line arguments change -the behavior of the running interpreter. -.sp .5 -.TS -expand; -l lw(2.2i). -\*(FC\-F \*(FIfs\*(FR use \*(FIfs\fP for the input field separator. -\*(FC\-v\*(FI var\*(FC\^=\^\*(FIval\*(FR T{ -assign the value \*(FIval\*(FR, to the variable \*(FIvar\*(FR, -before execution of the program begins. Such -variable values are available to the \*(FCBEGIN\fP rule. -T} -\*(FC\-f \*(FIprog-file\*(FR T{ -read the AWK program source from the file -\*(FIprog-file\*(FR, instead of from the first command -line argument. Multiple \*(FC\-f\*(FR options may be used. -T} -\*(FC\-\^\-\*(FR signal the end of options. -.TE -.sp .5 -.fi -\*(CLThe following options are accepted by both \*(NK and \*(GK -\*(CR(ignored by \*(GK, not in \*(MK).\*(CL -.sp .5 -.nf -.TS -expand, tab(%); -l lw(2.2i). -\*(FC\-mf \*(FIval\*(FR%set the maximum number of fields to \*(FIval\fP -\*(FC\-mr \*(FIval\*(FR%set the maximum record size to \*(FIval\fP\*(CX -.TE -.EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (standard)\*(FR\s0" - -.BT - -.ES -.fi -\*(CDThe following options are specific to \*(GK. The \*(FC\-W\*(FR -forms are for full POSIX compliance. -.sp .5 -.ig -.\" This option is left undocumented, on purpose. -\*(FC\-\^\-nostalgia\*(FR -\*(FC\-W nostalgia\*(FR%T{ -provide a moment of nostalgia for -long time \*(AK users. -T} -.. -.TS -expand, tab(%); -ls -l lw(1.8i). -\*(FC\-\^\-field-separator \*(FIfs\*(FR -%just like \*(FC\-F\fP -\*(FC\-\^\-assign \*(FIvar\*(FC\^=\^\*(FIval\*(FR%just like \*(FC\-v\fP -\*(FC\-\^\-file \*(FIprog-file%\*(FRjust like \*(FC\-f\fP -\*(FC\-\^\-traditional\*(FR -\*(FC\-\^\-compat\*(FR -\*(FC\-W compat\*(FR -\*(FC\-W traditional\*(FR%T{ -turn off \*(GK-specific extensions -(\*(FC\-\^\-traditional\*(FR preferred). -T} -\*(FC\-\^\-copyleft\*(FR -\*(FC\-\^\-copyright\*(FR -\*(FC\-W copyleft\*(FR -\*(FC\-W copyright\*(FR%T{ -print the short version of the GNU -copyright information on \*(FCstdout\*(FR. -T} -\*(FC\-\^\-help\*(FR -\*(FC\-\^\-usage\*(FR -\*(FC\-W help\*(FR -\*(FC\-W usage\*(FR%T{ -print a short summary of the available -options on \*(FCstdout\*(FR, then exit zero. -T} -\*(FC\-\^\-lint\*(FR -\*(FC\-W lint\*(FR%T{ -warn about constructs that are dubious -or non-portable to other \*(AKs. -T} -\*(FC\-\^\-lint\-old\*(FR -\*(FC\-W lint\-old\*(FR%T{ -warn about constructs that are not -portable to the original version of -Unix \*(AK. -T} -\*(FC\-\^\-posix\*(FR -\*(FC\-W posix\*(FR%T{ -disable common and GNU extensions. -Enable \*(FIinterval expressions\*(FR in regular -expression matching (see \fHRegular -Expressions\fP below). -T} -\*(FC\-\^\-re\-interval\*(FR -\*(FC\-W re\-interval\*(FR%T{ -enable \*(FIinterval expressions\*(FR in regular -expression matching (see \fHRegular -Expressions\fP below). Useful if -\*(FC\-\^\-posix\*(FR is not specified. -T} -\*(FC\-\^\-source '\*(FItext\*(FC'\*(FR -\*(FC\-W source '\*(FItext\*(FC'\*(FR%use \*(FItext\*(FR as AWK program source code. -\*(FC\-\^\-version\*(FR -\*(FC\-W version\*(FR%T{ -print version information on \*(FCstdout\fP -and exit zero. -T} -.TE -.sp .5 -.fi -In compatibility mode, -any other options are flagged as illegal, but are otherwise ignored. -In normal operation, as long as program text has been supplied, unknown -options are passed on to the AWK program in -\*(FCARGV\*(FR -for processing. This is most useful for running AWK -programs via the \*(FC#!\*(FR executable interpreter mechanism.\*(CB -.EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0" - -.BT - -.ES -.fi -\*(CDThe following options are specific to \*(MK. -.sp .5 -.fi -.TS -expand; -l lw(1.8i). -\*(FC\-W dump\*(FR T{ -print an assembly listing of the program to -\*(FCstdout\fP and exit zero. -T} -\*(FC\-W exec \*(FIfile\*(FR T{ -read program text from \*(FIfile\fP. No other -options are processed. Useful with \*(FC#!\fP. -T} -\*(FC\-W interactive\*(FR T{ -unbuffer \*(FCstdout\fP and line buffer \*(FCstdin\fP. -Lines are always records, ignoring \*(FCRS\fP -T} -\*(FC\-W posix_space\*(FR T{ -\*(FC\en\*(FR separates fields when \*(FCRS = "\^"\fP. -T} -\*(FC\-W sprintf=\*(FInum\*(FR T{ -adjust the size of \*(MK's internal -\*(FCsprintf\*(FR buffer. -T} -\*(FC\-W version\*(FR T{ -print version and copyright on -\*(FCstdout\fP and limit information on \*(FCstderr\fP -and exit zero. -T} -.TE -.sp .5 -.fi -The options may be abbreviated using just the first letter, e.g., -\*(FC\-We\*(FR, -\*(FC\-Wv\*(FR -and so on.\*(CB -.EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(MK\f(HB)\*(FR\s0" - -.\" --- Awk Program Execution -.ES -.fi -\*(CDAWK programs are a sequence of pattern-action statements -and optional function definitions. -.sp .5 - \*(FIpattern\*(FC { \*(FIaction statements\*(FC }\*(FR -.br - \*(FCfunction \*(FIname\*(FC(\*(FIparameter list\*(FC) { \*(FIstatements\*(FC }\*(FR -.sp .5 -\*(AK first reads the program source from the -\*(FIprog-file\*(FR(s), if specified, -\*(CBfrom arguments to \*(FC\-\^\-source\*(FR,\*(CD -or from the first non-option argument on the command line. -The program text is read as if all the \*(FIprog-file\*(FR(s) -\*(CBand command line -source texts\*(CD had been concatenated. -.sp .5 -AWK programs execute in the following order. -First, all variable assignments specified via the \*(FC\-v\fP -option are performed. -Next, \*(AK executes the code in the -\*(FCBEGIN\fP rules(s), if any, and then proceeds to read -the files \*(FC1\fP through \*(FCARGC \- 1\fP in the \*(FCARGV\fP array. -(Adjusting \*(FCARGC\fP and \*(FCARGV\fP thus provides control over -the input files that will be processed.) -If there are no files named on the command line, -\*(AK reads the standard input. -.sp .5 -If a command line argument has the form -\*(FIvar\*(FC=\*(FIval\*(FR, -it is treated as a variable assignment. The variable -\*(FIvar\fP will be assigned the value \*(FIval\*(FR. -(This happens after any \*(FCBEGIN\fP rule(s) have been run.) -... delete this paragraph if no space -Command line variable assignment -is most useful for dynamically assigning values to the variables -\*(AK uses to control how input is broken into fields and records. It -is also useful for controlling state if multiple passes are needed over -a single data file. -.sp .5 -If the value of a particular element of \*(FCARGV\fP is empty -(\*(FC"\^"\*(FR), \*(AK skips over it. -.sp .5 -For each record in the input, \*(AK tests to see if it matches any -\*(FIpattern\fP in the AWK program. -For each pattern that the record matches, the associated -\*(FIaction\fP is executed. -The patterns are tested in the order they occur in the program. -.sp .5 -Finally, after all the input is exhausted, -\*(AK executes the code in the \*(FCEND\fP rule(s), if any. -.sp .5 -If a program only has a \*(FCBEGIN\fP rule, no input files are processed. -If a program only has an \*(FCEND\fP rule, the input will be read. -\*(CX -.EB "\s+2\f(HBAWK PROGRAM EXECUTION\*(FR\s0" - - -.BT - -.\" --- Lines And Statements -.ES -.fi -\*(CDAWK is a line oriented language. The pattern comes first, and then the -action. Action statements are enclosed in \*(FC{\fP and \*(FC}\*(FR. -Either the pattern or the action may be missing, but -not both. If the pattern is missing, the action will be -executed for every input record. -A missing action is equivalent to -.sp .5 - \*(FC{ print }\fP -.sp .5 -which prints the entire record. -.sp .5 -Comments begin with the \*(FC#\*(FR character, and continue until the -end of the line. -Normally, a statement ends with a newline, but lines ending in -a ``,'', -\*(FC{\*(FR, -\*(CB\*(FC?\*(FR, -\*(FC:\*(FR,\*(CD -\*(FC&&\*(FR -or -\*(FC||\*(FR -are automatically continued. -Lines ending in \*(FCdo\fP or \*(FCelse\fP -also have their statements automatically continued on the following line. -In other cases, a line can be continued by ending it with a ``\e'', -in which case the newline will be ignored. However, a ``\e'' after a -\*(FC#\*(FR is not special. -.sp .5 -Multiple statements may be put on one line by separating them with a ``;''. -This applies to both the statements within the action part of a -pattern-action pair (the usual case) -and to the pattern-action statements themselves.\*(CX -.EB "\s+2\f(HBLINES AND STATEMENTS\*(FR\s0" - - - -.\" --- Regular Expressions -.ES -.fi -\*(CDRegular expressions are the extended kind originally defined by -\*(FCegrep\fP. -\*(CBAdditional GNU regexp operators are supported by \*(GK. -A \*(FIword-constituent\fP character is a letter, digit, or -underscore (\*(FC_\fP).\*(CD -.sp .5 -.TS -center, tab(~); -cp8 sp8 -cp8 sp8 -lp8|lp8. -.\" .vs 10 -_ -Summary of Regular Expressions -In Decreasing Precedence -_ -\*(FC(\^\*(FIr\*(FC)\*(FR~regular expression (for grouping) -\*(FIc\*(FR~if non-special char, matches itself -\*(FC\e\*(FI\^c\*(FR~turn off special meaning of \*(FIc\fP -\*(FC^\*(FR~beginning of string (note: \*(FInot\fP line) -\*(FC$\*(FR~end of string (note: \*(FInot\fP line) -\*(FC.\*(FR~any single character, including newline -\*(FC[\*(FR...\*(FC]\*(FR~any one character in ... or range -\*(FC[^\*(FR...\*(FC]\*(FR~any one character not in ... or range -\*(CB\*(FC\ey\*(FR~word boundary -\*(FC\eB\*(FR~middle of a word -\*(FC\e<\*(FR~beginning of a word -\*(FC\e>\*(FR~end of a word -\*(FC\ew\*(FR~any word-constituent character -\*(FC\eW\*(FR~any non-word-constituent character -\*(FC\e`\*(FR~beginning of a buffer (string) -\*(FC\e'\*(FR~end of a buffer (string)\*(CD -\*(FIr\*(FC*\*(FR~zero or more occurrences of \*(FIr\*(FR -\*(FIr\*(FC+\*(FR~one or more occurrences of \*(FIr\*(FR -\*(FIr\*(FC?\*(FR~zero or one occurrences of \*(FIr\*(FR -\*(FIr\*(FC{\*(FIn\*(FC,\*(FIm\*(FC}\*(FR~\*(FIn\fP to \*(FIm\fP occurrences of \*(FIr\*(FR \*(CR(POSIX: see note below)\*(CD -\*(FIr1\*(FC|\|\*(FIr2\*(FR~\*(FIr1\*(FR or \*(FIr2\*(FR -.TE -.sp .5 -.fi -\*(CRThe \*(FIr\*(FC{\*(FIn\*(FC,\*(FIm\*(FC}\*(FR notation is called an -\*(FIinterval expression\fP. POSIX mandates it for AWK regexps, but -most \*(AKs don't implement it. \*(CBUse \*(FC\-\^\-re\-interval\*(FR -or \*(FC\-\^\-posix\*(FR to enable -this feature in \*(GK.\*(CX -.EB "\s+2\f(HBREGULAR EXPRESSIONS\*(FR\s0" - - -.BT - -.\" --- POSIX Character Classes (gawk) -.ES -.fi -\*(CDIn regular expressions, within character ranges -(\*(FC[\*(FR...\*(FC]\*(FR), -the notation \*(FC[[:\*(FIclass\*(FC:]]\*(FR defines characters classes: -.sp .5 -.TS -center, tab(~); -lp8 lp8 lp8 lp8. -\*(FCalnum\*(FR~alphanumeric~\*(FClower\*(FR~lower-case -\*(FCalpha\*(FR~alphabetic~\*(FCprint\*(FR~printable -\*(FCblank\*(FR~space or tab~\*(FCpunct\*(FR~punctuation -\*(FCcntrl\*(FR~control~\*(FCspace\*(FR~whitespace -\*(FCdigit\*(FR~decimal~\*(FCupper\*(FR~upper-case -\*(FCgraph\*(FR~non-spaces~\*(FCxdigit\*(FR~hexadecimal\*(CB -.TE -.fi -.EB "\s+2\f(HBPOSIX CHARACTER CLASSES (\*(GK\f(HB)\*(FR\s0" - -.\" --- Records -.ES -.fi -\*(CDNormally, records are separated by newline characters. -Assigning values to the built-in variable \*(FCRS\*(FR -controls how records are separated. -If \*(FCRS\fP is any single character, that character separates records. -\*(CLOtherwise, \*(FCRS\fP is a regular expression. -\*(CR(Not \*(NK.)\*(CL -Text in the input that matches this -regular expression will separate the record. -\*(CB\*(GK sets \*(FCRT\*(FR to the value of the -input text that matched the regular expression. -The value of \*(FCIGNORECASE\fP -will also affect how records are separated when -\*(FCRS\fP is a regular expression.\*(CD -If \*(FCRS\fP is set to the null string, -then records are separated by one or more blank lines. -When \*(FCRS\fP is set to the null string, -the newline character always acts as -a field separator, in addition to whatever value -\*(FCFS\fP may have. -\*(CB\*(MK does not apply exceptional rules to \*(FCFS\fP -when \*(FCRS = "\^"\fP.\*(CX -.EB \s+2\f(HBRECORDS\*(FR\s0 - -.\" --- Fields -.ES -.fi -\*(CDAs each input record is read, \*(AK splits the record into -\*(FIfields\*(FR, using the value of the \*(FCFS\fP -variable as the field separator. -If \*(FCFS\fP is a single character, -fields are separated by that character. -\*(CLIf \*(FCFS\fP is the null string, -then each individual character becomes a separate field.\*(CD -Otherwise, \*(FCFS\fP is expected to be a full regular expression. -In the special case that \*(FCFS\fP -is a single space, fields are separated -by runs of spaces and/or tabs -\*(CLand/or newlines\*(CD. -Leading and trailing whitespace are ignored. -\*(CBThe value of \*(FCIGNORECASE\fP -will also affect how fields are split when -\*(FCFS\fP is a regular expression.\*(CD -.sp .5 -\*(CBIf the \*(FCFIELDWIDTHS\fP -variable is set to a space separated list of numbers, each field is -expected to have a fixed width, and \*(GK -will split up the record using the specified widths. -The value of \*(FCFS\fP is ignored. -Assigning a new value to \*(FCFS\fP -overrides the use of \*(FCFIELDWIDTHS\*(FR, -and restores the default behavior.\*(CD -.sp .5 -Each field in the input record may be referenced by its position, -\*(FC$1\*(FR, \*(FC$2\*(FR and so on. -\*(FC$0\fP is the whole record. -Fields may also be assigned new values. -.sp .5 -The variable \*(FCNF\fP -is set to the total number of fields in the input record. -.sp .5 -References to non-existent fields (i.e., fields after \*(FC$NF\*(FR) -produce the null-string. However, assigning to a non-existent field -(e.g., \*(FC$(NF+2) = 5\*(FR) will increase the value of -\*(FCNF\*(FR, create any intervening fields with the null string as their value, -and cause the value of \*(FC$0\fP -to be recomputed with the fields being separated by the -value of \*(FCOFS\*(FR. -References to negative numbered fields cause a fatal error. -Decreasing the value of \*(FCNF\fP causes the trailing fields to be lost -\*(CR(not \*(NK).\*(CX -.EB \s+2\f(HBFIELDS\*(FR\s0 - -.BT - -.\" --- Pattern Elements -.ES -.fi -\*(CDAWK patterns may be one of the following. -.sp .5 -.nf - \*(FCBEGIN - END - \*(FIexpression - pat1\*(FC,\*(FIpat2\*(FR -.sp .5 -.fi -\*(FCBEGIN\fP and \*(FCEND\fP are special patterns that provide start-up -and clean-up actions respectively. They must have actions. There can -be multiple \*(FCBEGIN\fP and \*(FCEND\fP rules; they are merged and -executed as if there had just been one large rule. They may occur anywhere -in a program, including different source files. -.sp .5 -Expression patterns can be any expression, as described -under \fHExpressions\fP. -.sp .5 -The \*(FIpat1\*(FC,\*(FIpat2\*(FR pattern -is called a \*(FIrange pattern\*(FR. -It matches all input records starting with a record that matches -\*(FIpat1\*(FR, and continuing until a record that matches -\*(FIpat2\*(FR, inclusive. -It does not combine with any other pattern expression.\*(CX -.EB "\s+2\f(HBPATTERN ELEMENTS\*(FR\s0" - - -.\" --- Action Statements -.ES -.nf -\*(CD\*(FCif (\*(FIcondition\*(FC) \*(FIstatement\*(FR [ \*(FCelse\*(FI statement \*(FR] -\*(FCwhile (\*(FIcondition\*(FC) \*(FIstatement \*(FR -\*(FCdo \*(FIstatement \*(FCwhile (\*(FIcondition\*(FC)\*(FR -\*(FCfor (\*(FIexpr1\*(FC; \*(FIexpr2\*(FC; \*(FIexpr3\*(FC) \*(FIstatement\*(FR -\*(FCfor (\*(FIvar \*(FCin\*(FI array\*(FC) \*(FIstatement\*(FR -.ig -\*(CB\*(FCabort\*(FR [ \*(FIexpression\*(FR ]\*(CD -.. -\*(FCbreak\*(FR -\*(FCcontinue\*(FR -\*(FCdelete \*(FIarray\^\*(FC[\^\*(FIindex\^\*(FC]\*(FR -\*(CL\*(FCdelete \*(FIarray\^\*(FR\*(CD -\*(FCexit\*(FR [ \*(FIexpression\*(FR ] -\*(FCnext\*(FR -\*(CL\*(FCnextfile\*(FR \*(CR(not \*(MK)\*(CD -\*(FC{ \*(FIstatements \*(FC}\*(CX -.EB "\s+2\f(HBACTION STATEMENTS\*(FR\s0" - - - -.\" --- Escape Sequences -.ES -.fi -\*(CDWithin strings constants (\*(FC"..."\fP) and regexp -constants (\*(FC/.../\fP), escape sequences may be used to -generate otherwise unprintable characters. This table lists -the available escape sequences. -.sp .5 -.ig -\*(CB\*(FCPROCINFO\fP T{ -elements of this array provide access to info -about the running AWK program. See -\*(AM for details.\*(CD -T} -.. -.TS -center, tab(~); -lp8 lp8 lp8 lp8. -\*(FC\ea\fP~alert (bell)~\*(FC\er\fP~carriage return -\*(FC\eb\fP~backspace~\*(FC\et\fP~horizontal tab -\*(FC\ef\fP~form feed~\*(FC\ev\fP~vertical tab -\*(FC\en\fP~newline~\*(FC\e\e\fP~backslash -\*(FC\e\*(FIddd\*(FR~octal value \*(FIddd\fP~\*(CL\*(FC\ex\*(FIhh\*(FR~hex value \*(FIhh\fP\*(CD -\*(FC\e"\fP~double quote~\*(FC\e/\fP~forward slash\*(CX -.TE -.EB "\s+2\f(HBESCAPE SEQUENCES\*(FR\s0" - - -.BT - -.\" --- Variables -.ES -.fi -.TS -expand; -l lw(2i). -\*(FCARGC\fP T{ -number of command line arguments. -T} -\*(CB\*(FCARGIND\fP T{ -index in \*(FCARGV\fP of current data file.\*(CD -T} -\*(FCARGV\fP T{ -array of command line arguments. Indexed from -0 to \*(FCARGC\fP \- 1. Dynamically changing the -contents of \*(FCARGV\fP can control the files used -for data. -T} -\*(FCCONVFMT\fP T{ -conversion format for numbers, default value -is \*(FC"%.6g"\*(FR. -T} -\*(FCENVIRON\fP T{ -array containing the the current environment. -The array is indexed by the environment -variables, each element being the value of -that variable. -T} -\*(CB\*(FCERRNO\fP T{ -contains a string describing the error when a -redirection or read for \*(FCgetline\*(FR fails, or if -\*(FCclose()\*(FR fails. -T} -\*(FCFIELDWIDTHS\fP T{ -white-space separated list of fieldwidths. Used -to parse the input into fields of fixed width, -instead of the value of \*(FCFS\fP.\*(CD -T} -\*(FCFILENAME\fP T{ -name of the current input file. If no files given -on the command line, \*(FCFILENAME\fP is ``\-''. -\*(FCFILENAME\fP is undefined inside the \*(FCBEGIN\fP rule -(unless set by \*(FCgetline\fP). -T} -\*(FCFNR\fP T{ -number of the input record in current input file. -T} -\*(FCFS\fP T{ -input field separator, a space by default -(see \fHFields\fP above). -T} -\*(CB\*(FCIGNORECASE\fP T{ -if non-zero, all regular expression and string -operations ignore case. \*(CRIn versions of \*(GK -prior to 3.0, \*(FCIGNORECASE\fP only affected -regular expression operations and \*(FCindex()\*(FR.\*(CD -T} -\*(FCNF\fP T{ -number of fields in the current input record. -T} -\*(FCNR\fP T{ -total number of input records seen so far. -T} -\*(FCOFMT\fP T{ -output format for numbers, \*(FC"%.6g"\*(FR, by default. -\*(CROld versions of \*(AK also used this for number -to string conversion instead of \*(FCCONVFMT\fP.\*(CD -T} -\*(FCOFS\fP T{ -output field separator, a space by default. -T} -\*(FCORS\fP T{ -output record separator, a newline by default. -T} -\*(FCRS\fP T{ -input record separator, a newline by default -(see \fHRecords\fP above). -T} -\*(CB\*(FCRT\fP T{ -record terminator. \*(GK sets \*(FCRT\fP to the input -text that matched the character or regular -expression specified by \*(FCRS\*(FR.\*(CD -T} -\*(FCRSTART\fP T{ -index of the first character matched by -\*(FCmatch()\*(FR; 0 if no match. -T} -\*(FCRLENGTH\fP T{ -length of the string matched by \*(FCmatch()\*(FR; -\-1 if no match. -T} -\*(FCSUBSEP\fP T{ -character(s) used to separate multiple subscripts -in array elements, by default \*(FC"\e034"\*(FR. (see -\fHArrays\fP below).\*(CX -T} -.TE -.EB \s+2\f(HBVARIABLES\*(FR\s0 - -.BT - -.\" --- Arrays -.ES -.fi -\*(CDAn arrays subscript is an expression between square brackets -(\*(FC[ \*(FRand \*(FC]\*(FR). -If the expression is a list -\*(FC(\*(FIexpr\*(FC, \*(FIexpr \*(FC...)\*(FR, -then the subscript is a string consisting of the -concatenation of the (string) value of each expression, -separated by the value of the \*(FCSUBSEP\fP variable. -This simulates multi-dimensional -arrays. For example: -.nf -.sp .5 - \*(FCi = "A";\^ j = "B";\^ k = "C" - x[i, j, k] = "hello, world\en"\*(FR -.sp .5 -.fi -assigns \*(FC"hello, world\en"\*(FR to the element of the array -\*(FCx\fP -indexed by the string \*(FC"A\e034B\e034C"\*(FR. All arrays in AWK -are associative, i.e., indexed by string values. -.sp .5 -Use the special operator \*(FCin\fP in an \*(FCif\fP -or \*(FCwhile\fP statement to see if a particular value is -an array index. -.sp .5 -.nf - \*(FCif (val in array) - print array[val]\*(FR -.sp .5 -.fi -If the array has multiple subscripts, use -\*(FC(i, j) in array\*(FR. -.sp .5 -Use the \*(FCin\fP construct in a \*(FCfor\fP -loop to iterate over all the elements of an array. -.sp .5 -Use the \*(FCdelete\fP statement to delete an -element from an array. -\*(CLSpecifying just the array name without a subscript in -the \*(FCdelete\fP -statement deletes the entire contents of an array.\*(CX -.EB \s+2\f(HBARRAYS\*(FR\s0 - -.\" --- Expressions -.ES -.fi -\*(CDExpressions are used as patterns, for controlling conditional action -statements, and to produce parameter values when calling functions. -Expressions may also be used as simple statements, -particularly if they have side-effects such as assignment. -Expressions mix \*(FIoperands\fP and \*(FIoperators\fP. Operands are -constants, fields, variables, array elements, and the return -values from function calls (both built-in and user-defined). -.sp .5 -Regexp constants (\*(FC/\*(FIpat\*(FC/\*(FR), when used as simple expressions, -i.e., not used on the right-hand side of -\*(FC~\fP and \*(FC!~\fP, or as arguments to the -\*(CB\*(FCgensub()\fP,\*(CD -\*(FCgsub()\fP, -\*(FCmatch()\fP, -\*(FCsplit()\fP, -and -\*(FCsub()\fP, -functions, mean \*(FC$0 ~ /\*(FIpat\*(FC/\*(FR. -.sp .5 -The AWK operators, in order of decreasing precedence, are -.sp .5 -.fi -.TS -expand; -l lw(1.8i). -\*(FC(\&...)\*(FR grouping -\*(FC$\fP field reference -\*(FC++ \-\^\-\fP T{ -increment and decrement, -prefix and postfix -T} -\*(FC^\fP \*(CL\*(FC**\*(FR\*(CD exponentiation -\*(FC+ \- !\fP unary plus, unary minus, and logical negation -\*(FC* / %\fP multiplication, division, and modulus -\*(FC+ \-\fP addition and subtraction -\*(FIspace\fP string concatenation -\*(FC< >\fP less than, greater than -\*(FC<= >=\fP less than or equal, greater than or equal -\*(FC!= ==\fP not equal, equal -\*(FC~ !~\fP regular expression match, negated match -\*(FCin\fP array membership -\*(FC&&\fP logical AND, short circuit -\*(FC||\fP logical OR, short circuit -\*(FC?\^:\fP in-line conditional expression -.T& -l s -l lw(1.8i). -\*(FC=\0+=\0\-=\0*=\0/=\0%=\0^=\0\*(CL**=\*(CD\fP - assignment operators\*(CX -.TE -.EB \s+2\f(HBEXPRESSIONS\*(FR\s0 - - -.BT - -.\" --- Conversions and Comparisons -.ES -.fi -\*(CDVariables and fields may be (floating point) numbers, strings or both. -Context determines how the value of a variable is interpreted. If used in -a numeric expression, it will be treated as a number, if used as a string -it will be treated as a string. -.sp .5 -To force a variable to be treated as a number, add 0 to it; to force it -to be treated as a string, concatenate it with the null string. -.sp .5 -When a string must be converted to a number, the conversion is accomplished -using \*(FIatof\*(FR(3). -A number is converted to a string by using the value of \*(FCCONVFMT\fP -as a format string for \*(FIsprintf\*(FR(3), -with the numeric value of the variable as the argument. -However, even though all numbers in AWK are floating-point, -integral values are \*(FIalways\fP converted as integers. -.sp .5 -Comparisons are performed as follows: -If two variables are numeric, they are compared numerically. -If one value is numeric and the other has a string value that is a -``numeric string,'' then comparisons are also done numerically. -Otherwise, the numeric value is converted to a string, and a string -comparison is performed. -Two strings are compared, of course, as strings. -\*(CRAccording to the POSIX standard, even if two strings are -numeric strings, a numeric comparison is performed. However, this is -clearly incorrect, and none of the three free \*(AK\*(FRs do this.\*(CD -.sp .5 -Note that string constants, such as \*(FC"57"\fP, are \*(FInot\fP -numeric strings, they are string constants. The idea of ``numeric string'' -only applies to fields, \*(FCgetline\fP input, -\*(FCFILENAME\*(FR, \*(FCARGV\fP elements, \*(FCENVIRON\fP -elements and the elements of an array created by -\*(FCsplit()\fP that are numeric strings. -The basic idea is that \*(FIuser input\*(FR, -and only user input, that looks numeric, -should be treated that way. -.sp .5 -Uninitialized variables have the numeric value 0 and the string value -\*(FC"\^"\fP -(the null, or empty, string).\*(CX -.EB "\s+2\f(HBCONVERSIONS AND COMPARISONS\*(FR\s0" - -.ig -.\" --- Localization -.ES -.nf -.ce 100 -\*(CDThis -section -is -under -construction. -.sp .5 -This -section -is -under -construction.\*(CB -.ce 0 -.EB "\s+2\f(HBLOCALIZATION\*(FR\s0" -.. - -.ig -.ps +2 -.ce 1 -\*(CD\fHISBN: 0-916151-97-2\*(FR -.ps -2 -.. - -.BT - - -.\" --- Input Control -.ES -.fi -.TS -expand; -l lw(1.8i). -\*(CD\*(FCclose(\*(FIfile\*(FC)\*(FR close input file or pipe. -\*(FCgetline\fP T{ -set \*(FC$0\fP from next input record; -set \*(FCNF\*(FR, \*(FCNR\*(FR, \*(FCFNR\*(FR. -T} -\*(FCgetline < \*(FIfile\*(FR set \*(FC$0\fP from next record of \*(FIfile\*(FR; set \*(FCNF\*(FR. -\*(FCgetline \*(FIv\*(FR T{ -set \*(FIv\fP from next input record; -set \*(FCNR\*(FR, \*(FCFNR\*(FR. -T} -\*(FCgetline \*(FIv \*(FC< \*(FIfile\*(FR set \*(FIv\fP from next record of \*(FIfile\*(FR. -\*(FIcmd \*(FC| getline\*(FR pipe into \*(FCgetline\*(FR; set \*(FC$0\*(FR, \*(FCNF\*(FR. -\*(FIcmd \*(FC| getline \*(FIv\*(FR pipe into \*(FCgetline\*(FR; set \*(FIv\*(FR. -.TE -.fi -.in +.2i -.ti -.2i -\*(FCnext\fP -.br -stop processing the current input -record. Read next input record and -start over with the first pattern in the -program. Upon end of the input data, -execute any \*(FCEND\fP rule(s). -.br -.ti -.2i -\*(CL\*(FCnextfile\fP -.br -stop processing the current input file. -The next input record comes from the -next input file. \*(FCFILENAME\fP \*(CBand -\*(FCARGIND\fP\*(CL are updated, \*(FCFNR\fP is reset to 1, -and processing starts over with the first -pattern in the AWK program. Upon end -of input data, execute any \*(FCEND\fP rule(s). -\*(CREarlier versions of \*(GK used -\*(FCnext file\*(FR, as two words. This -generates a warning message and will -eventually be removed. \*(CR\*(MK does not -currently support \*(FCnextfile\*(FR.\*(CD -.in -.2i -.sp .5 -.fi -\*(FCgetline\*(FR returns 0 on end of file, and \-1 on an -error.\*(CX -.EB "\s+2\f(HBINPUT CONTROL\*(FR\s0" - -.\" --- Output Control -.ES -.fi -.in +.2i -.ti -.2i -\*(CD\*(FCclose(\*(FIfile\*(FC)\*(FR -.br -close output file or pipe. -.ti -.2i -\*(CL\*(FCfflush(\*(FR[\*(FIfile\^\*(FR]\*(FC)\*(FR -.br -flush any buffers associated -with the open output file or pipe \*(FIfile\*(FR.\*(CD -\*(CBIf \*(FIfile\fP is missing, then standard output is flushed. -If \*(FIfile\fP is the null string, then all open output files and pipes -are flushed \*(CR(not \*(NK)\*(CD. -.ti -.2i -\*(FCprint\fP -.br -print the current record. The output record is terminated -with the value of \*(FCORS\fP. -.ti -.2i -\*(FCprint \*(FIexpr-list\*(FR -.br -print expressions. Each expression is separated -by the value of \*(FCOFS\fP. The output record is -terminated with the value of \*(FCORS\fP. -.ti -.2i -\*(FCprintf \*(FIfmt\*(FC, \*(FIexpr-list\*(FR -.br -format and print (see \fHPrintf Formats\fP below). -.ti -.2i -\*(FCsystem(\*(FIcmd\*(FC)\*(FR -.br -execute the command \*(FIcmd\*(FR, -and return the exit status -\*(CR(may not be available on non-POSIX systems)\*(CD. -.sp .5 -.in -.2i -I/O redirections may be used with both \*(FCprint\fP and \*(FCprintf\fP. -.sp .5 -.in +.2i -.ti -.2i -\*(CD\*(FCprint "hello" > \*(FIfile\*(FR -.br -Print data to \*(FIfile\fP. The first time the file is written to, it -will be truncated. Subsequent commands append data. -.ti -.2i -\*(FCprint "hello" >> \*(FIfile\*(FR -.br -Append data to \*(FIfile\fP. The previous contents of the file are not lost. -.ti -.2i -\*(FCprint "hello" | \*(FIcmd\*(FR -.br -Print data down a pipeline to \*(FIcmd\*(FR.\*(CX -.in -.2i -.EB "\s+2\f(HBOUTPUT CONTROL\*(FR\s0" - -.BT - - -.\" --- Printf Formats -.ES -.fi -\*(CDThe \*(FCprintf\fP statement and -\*(FCsprintf()\fP function -accept the following conversion specification formats: -.sp .5 -.nf -\*(FC%c\fP an \s-1ASCII\s+1 character -\*(FC%d\fP a decimal number (the integer part) -\*(FC%i\fP a decimal number (the integer part) -\*(FC%e\fP a floating point number of the form - \*(FC[\-]d.dddddde[+\^\-]dd\*(FR -\*(FC%E\fP like \*(FC%e\fP, but use \*(FCE\fP instead of \*(FCe\*(FR -\*(FC%f\fP a floating point number of the form - \*(FC[\-]ddd.dddddd\*(FR -\*(FC%g\fP use \*(FC%e\fP or \*(FC%f\fP, whichever is shorter, with - nonsignificant zeros suppressed -\*(FC%G\fP like \*(FC%g\fP, but use \*(FC%E\fP instead of \*(FC%e\*(FR -\*(FC%o\fP an unsigned octal integer -\*(FC%u\fP an unsigned decimal integer -\*(FC%s\fP a character string -\*(FC%x\fP an unsigned hexadecimal integer -\*(FC%X\fP like \*(FC%x\fP, but use \*(FCABCDEF\fP for 10\(en15 -\*(FC%%\fP A literal \*(FC%\fP; no argument is converted -.sp .5 -.fi -Optional, additional parameters may lie between the \*(FC%\fP -and the control letter: -.sp .5 -.TS -expand; -l lw(2.2i). -\*(FC\-\fP T{ -left-justify the expression within its field. -T} -\*(FIspace\fP T{ -for numeric conversions, prefix positive values -with a space and negative values with a -minus sign. -T} -\*(FC+\fP T{ -used before the \*(FIwidth\fP modifier means to always -supply a sign for numeric conversions, even if -the data to be formatted is positive. The \*(FC+\fP -overrides the space modifier. -T} -\*(FC#\fP T{ -use an ``alternate form'' for some control letters. -T} - \*(FC%o\*(FR T{ -supply a leading zero. -T} - \*(FC%x\*(FR, \*(FC%X\*(FR T{ -supply a leading \*(FC0x\*(FR or \*(FC0X\*(FR for a nonzero result. -T} - \*(FC%e\*(FR, \*(FC%E\*(FR, \*(FC%f\*(FR T{ -the result always has a decimal point. -T} - \*(FC%g\*(FR, \*(FC%G\*(FR T{ -trailing zeros are not removed. -T} -\*(FC0\fP T{ -a leading zero acts as a flag, indicating output -should be padded with zeroes instead of spaces. -This applies even to non-numeric output formats. -Only has an effect when the field width is wider -than the value to be printed. -T} -\*(FIwidth\fP T{ -pad the field to this width. The field is normally -padded with spaces. If the \*(FC0\fP flag has been used, -pad with zeroes. -T} -\*(FC.\fP\*(FIprec\fP T{ -precision. -The meaning varies by control letter: -T} - \*(FC%d\*(FR, \*(FC%o\*(FR, \*(FC%i\*(FR, - \*(FC%u\*(FR, \*(FC%x\*(FR, \*(FC%X\fP T{ -the minimum number of digits to print. -T} - \*(FC%e\*(FR, \*(FC%E\*(FR, \*(FC%f\*(FR T{ -the number of digits to print to the right of the decimal point. -T} - \*(FC%g\*(FR, \*(FC%G\fP T{ -the maximum number of significant digits. -T} - \*(FC%s\fP T{ -the maximum number of characters to print. -T} -.TE -.sp .5 -.fi -The dynamic \*(FIwidth\fP and \*(FIprec\fP capabilities of the ANSI C -\*(FCprintf()\fP routines are supported. -A \*(FC*\fP in place of either the \*(FIwidth\fP or \*(FIprec\fP -specifications will cause their values to be taken from -the argument list to \*(FCprintf\fP or \*(FCsprintf()\*(FR.\*(CX -.EB "\s+2\f(HBPRINTF FORMATS\*(FR\s0" - - - -.BT - -.\" --- Special Filenames -.ES -.fi -\*(CDWhen doing I/O redirection from either \*(FCprint\fP -or \*(FCprintf\fP into a file or via \*(FCgetline\fP -from a file, all three implementations of \*(FCawk\fP -recognize certain special filenames internally. These filenames -allow access to open file descriptors inherited from the -parent process (usually the shell). -These filenames may also be used on the command line to name data files. -The filenames are: -.sp .5 -.TS -expand; -l lw(2i). -\*(FC"\-"\fP standard input -\*(FC/dev/stdin\fP standard input \*(CR(not \*(MK)\*(CD -\*(FC/dev/stdout\fP standard output -\*(FC/dev/stderr\fP standard error output -.TE -.sp .5 -.fi -\*(CBThe following names are specific to \*(GK. -.sp .5 -.TS -expand; -l lw(2i). -\*(FC/dev/fd/\^\*(FIn\*(FR T{ -file associated with the open file descriptor \*(FIn\*(FR -T} -.TE -.sp .5 -.fi -Other special filenames provide access to information about the running -\*(FCgawk\fP process. -Reading from these files returns a single record. -The filenames and what they return are:\*(FR -.sp .5 -.TS -expand; -l lw(2i). -\*(FC/dev/pid\fP process ID of current process -\*(FC/dev/ppid\fP parent process ID of current process -\*(FC/dev/pgrpid\fP process group ID of current process -\*(FC/dev/user\fP T{ -.nf -a single newline-terminated record. -The fields are separated with spaces. -\*(FC$1\fP is the return value of \*(FIgetuid\*(FR(2), -\*(FC$2\fP is the return value of \*(FIgeteuid\*(FR(2), -\*(FC$3\fP is the return value of \*(FIgetgid\*(FR(2) , and -\*(FC$4\fP is the return value of \*(FIgetegid\*(FR(2). -.fi -Any additional fields are the group IDs returned -by \*(FIgetgroups\*(FR(2). Multiple groups may not be -supported on all systems. -T} -.TE -.sp .5 -.fi -.ig -\*(CRThese filenames are now obsolete. -Use the \*(FCPROCINFO\fP array to obtain the information they provide.\*(CL -.. -.\" BEGIN FOR 3.0.x -\*(CRThese filenames will become obsolete in \*(GK 3.1. -Be aware that you will have to change your programs.\*(CL -.\" END FOR 3.0.x -.EB "\s+2\f(HBSPECIAL FILENAMES\*(FR\s0" - - - - -.\" --- Builtin Numeric Functions -.ES -.fi -.TS -expand; -l lw(2i). -\*(CD\*(FCatan2(\*(FIy\*(FC, \*(FIx\*(FC)\*(FR the arctangent of \*(FIy/x\fP in radians. -\*(FCcos(\*(FIexpr\*(FC)\*(FR the cosine of \*(FIexpr\fP, which is in radians. -\*(FCexp(\*(FIexpr\*(FC)\*(FR the exponential function (\*(FIe \*(FC^ \*(FIx\*(FR). -\*(FCint(\*(FIexpr\*(FC)\*(FR truncates to integer. -\*(FClog(\*(FIexpr\*(FC)\*(FR the natural logarithm function (base \*(FIe\^\*(FR). -\*(FCrand()\fP a random number between 0 and 1. -\*(FCsin(\*(FIexpr\*(FC)\*(FR the sine of \*(FIexpr\fP, which is in radians. -\*(FCsqrt(\*(FIexpr\*(FC)\*(FR the square root function. -\&\*(FCsrand(\*(FR[\*(FIexpr\^\*(FR]\*(FC)\*(FR T{ -uses \*(FIexpr\fP as a new seed for the random number -generator. If no \*(FIexpr\fP, the time of day is used. -Returns previous seed for the random number -generator.\*(CX -T} -.TE -.EB "\s+2\f(HBNUMERIC FUNCTIONS\*(FR\s0" - - -.BT - - -.\" --- Builtin String Functions -.ES -.fi -.in +.2i -.ti -.2i -\*(CB\*(FCgensub(\*(FIr\*(FC, \*(FIs\*(FC, \*(FIh \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR -.br -search the target string -\*(FIt\fP for matches of the regular expression \*(FIr\*(FR. If -\*(FIh\fP is a string beginning with \*(FCg\fP or \*(FCG\*(FR, -replace all matches of \*(FIr\fP with \*(FIs\*(FR. Otherwise, \*(FIh\fP -is a number indicating which match of \*(FIr\fP to replace. If no -\*(FIt\fP is supplied, \*(FC$0\fP is used instead. Within the -replacement text \*(FIs\*(FR, the sequence \*(FC\e\*(FIn\*(FR, -where \*(FIn\fP is a digit from 1 to 9, may be used to indicate just -the text that matched the \*(FIn\*(FRth parenthesized subexpression. -The sequence \*(FC\e0\fP represents the entire matched text, as does -the character \*(FC&\*(FR. Unlike \*(FCsub()\fP and \*(FCgsub()\*(FR, -the modified string is returned as the result of the function, -and the original target string is \*(FInot\fP changed.\*(CD -.ti -.2i -\*(FCgsub(\*(FIr\*(FC, \*(FIs \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR -.br -for each substring matching the -regular expression \*(FIr\fP in the string \*(FIt\*(FR, substitute the -string \*(FIs\*(FR, and return the number of substitutions. If -\*(FIt\fP is not supplied, use \*(FC$0\*(FR. An \*(FC&\fP in the -replacement text is replaced with the text that was actually matched. -Use \*(FC\e&\fP to get a literal \*(FC&\*(FR. See \*(AM -for a fuller discussion of the rules for \*(FC&\*(FR's and backslashes -in the replacement text of \*(CB\*(FCgensub()\*(FR,\*(CD \*(FCsub()\*(FR -and \*(FCgsub()\*(FR -.ti -.2i -\*(FCindex(\*(FIs\*(FC, \*(FIt\*(FC)\*(FR -.br -returns the index of the string -\*(FIt\fP in the string \*(FIs\*(FR, or 0 if \*(FIt\fP is not present. -.ti -.2i -\*(FClength(\*(FR[\*(FIs\*(FR]\*(FC)\*(FR -.br -returns the length of the string -\*(FIs\*(FR, or the length of \*(FC$0\fP if \*(FIs\fP is not supplied. -.ti -.2i -\*(FCmatch(\*(FIs\*(FC, \*(FIr\*(FC)\*(FR -.br -returns the position in -\*(FIs\fP where the regular expression \*(FIr\fP occurs, or 0 if -\*(FIr\fP is not present, and sets the values of variables -\*(FCRSTART\fP -and \*(FCRLENGTH\*(FR. -.ti -.2i -\*(FCsplit(\*(FIs\*(FC, \*(FIa \*(FR[\*(FC, \*(FIr\*(FR]\*(FC)\*(FR -.br -splits the string -\*(FIs\fP into the array \*(FIa\fP using the regular expression \*(FIr\*(FR, -and returns the number of fields. If \*(FIr\fP is omitted, \*(FCFS\fP -is used instead. The array \*(FIa\fP is cleared first. -Splitting behaves identically to field splitting. -(See \fHFields\fP, above.) -.ti -.2i -\*(FCsprintf(\*(FIfmt\*(FC, \*(FIexpr-list\*(FC)\*(FR -.br -prints \*(FIexpr-list\fP -according to \*(FIfmt\*(FR, and returns the resulting string. -.ti -.2i -\*(FCsub(\*(FIr\*(FC, \*(FIs \*(FR[\*(FC, \*(FIt\*(FR]\*(FC)\*(FR -.br -just like -\*(FCgsub()\*(FR, but only the first matching substring is replaced. -.ti -.2i -\*(FCsubstr(\*(FIs\*(FC, \*(FIi \*(FR[\*(FC, \*(FIn\*(FR]\*(FC)\*(FR -.br -returns the at most -\*(FIn\*(FR-character substring of \*(FIs\fP starting at \*(FIi\*(FR. -If \*(FIn\fP is omitted, the rest of \*(FIs\fP is used. -.ti -.2i -\*(FCtolower(\*(FIstr\*(FC)\*(FR -.br -returns a copy of the string \*(FIstr\*(FR, -with all the upper-case characters in \*(FIstr\fP translated to their -corresponding lower-case counterparts. Non-alphabetic characters are -left unchanged. -.ti -.2i -\*(FCtoupper(\*(FIstr\*(FC)\*(FR -.br -returns a copy of the string \*(FIstr\*(FR, -with all the lower-case characters in \*(FIstr\fP translated to their -corresponding upper-case counterparts. Non-alphabetic characters are -left unchanged.\*(CX -.in -.2i -.EB "\s+2\f(HBSTRING FUNCTIONS\*(FR\s0" - - - -.BT - - -.\" --- Builtin Time Functions -.ES -.fi -\*(CD\*(GK -provides the following functions for obtaining time stamps and -formatting them. -.sp .5 -.fi -.in +.2i -.ig -.ti -.2i -\*(FCmktime(\*(FIdatespec\*(FC)\*(FR -.br -turns \*(FIdatespec\fP into a time -stamp of the same form as returned by \*(FCsystime()\*(FR. -The \*(FIdatespec\fP is a string of the form -\*(FC"\*(FIYYYY MM DD HH MM SS\*(FC"\*(FR. -.. -.ti -.2i -\*(FCstrftime(\*(FR[\*(FIformat \*(FR[\*(FC, \*(FItimestamp\*(FR]]\*(FC)\*(FR -.br -formats \*(FItimestamp\fP -according to the specification in \*(FIformat\*(FR. The -\*(FItimestamp\fP should be of the same form as returned by -\*(FCsystime()\*(FR. -If \*(FItimestamp\fP is missing, the current time of day is used. If -\*(FIformat\fP is missing, a default format equivalent to the output -of \*(FIdate\*(FR(1) will be used. -.ti -.2i -\*(FCsystime()\fP -.br -returns the current time of day as the number of -seconds since the Epoch.\*(CB -.in -.2i -.EB "\s+2\f(HBTIME FUNCTIONS (\*(GK\f(HB)\*(FR\s0" - - - -.\" --- User-defined Functions -.ES -.fi -\*(CDFunctions in AWK are defined as follows: -.sp .5 -.nf - \*(FCfunction \*(FIname\*(FC(\*(FIparameter list\*(FC) - { - \*(FIstatements - \*(FC}\*(FR -.sp .5 -.fi -Functions are executed when they are called from within expressions -in either patterns or actions. Actual parameters supplied in the function -call instantiate the formal parameters declared in the function. -Arrays are passed by reference, other variables are passed by value. -.sp .5 -Local variables are declared as extra parameters -in the parameter list. The convention is to separate local variables from -real parameters by extra spaces in the parameter list. For example: -.sp .5 -.nf - \*(FC# a & b are local - function f(p, q, a, b) - { - \&..... - } -.sp .3 - /abc/ { ... ; f(1, 2) ; ... }\*(FR -.fi -.sp .5 -The left parenthesis in a function call is required -to immediately follow the function name -without any intervening white space. -This is to avoid a syntactic ambiguity with the concatenation operator. -This restriction does not apply to the built-in functions. -.sp .5 -Functions may call each other and may be recursive. -Function parameters used as local variables are initialized -to the null string and the number zero upon function invocation. -.sp .5 -Use \*(FCreturn\fP to return a value from a function. The return value -is undefined if no value is provided, or if the function returns by -``falling off'' the end. -.sp .5 -\*(CLThe word -\*(FCfunc\fP -may be used in place of -\*(FCfunction\*(FR. -\*(CRNote: This usage is deprecated.\*(CX -.EB "\s+2\f(HBUSER-DEFINED FUNCTIONS\*(FR\s0" - - - -.\" --- Bug Reports -.ES -.fi -\*(CDIf you find a bug in this reference card, please report it via electronic -mail to \*(FCarnold@gnu.org\*(FR.\*(CX -.EB "\s+2\f(HBBUG REPORTS\*(FR\s0" - -.BT - -.\" --- Environment Variables -.ES -.fi -\*(CDThe environment variable \*(FCAWKPATH\fP specifies a search path to use -when finding source files named with the \*(FC\-f\fP -option. -The default path is -\*(FC".:/usr/local/share/awk"\*(FR, -if this variable does not exist. -(The actual directory may vary, -depending upon how \*(GK was built and installed.) -If a file name given to the \*(FC\-f\fP option contains a ``/'' character, -no path search is performed. -.sp .5 -If \*(FCPOSIXLY_CORRECT\fP exists in the environment, then \*(GK -behaves exactly as if \*(FC\-\^\-posix\fP had been specified on the -command line.\*(CB -.EB "\s+2\f(HBENVIRONMENT VARIABLES (\*(GK\f(HB)\*(FR\s0" - -.\" --- Historical Features -.ES -.fi -\*(CD\*(GK supports two features of historical AWK implementations. -First, it is possible to call the \*(FClength()\fP -built-in function not only with no argument, but even without parentheses. -This feature is marked as ``deprecated'' in the POSIX standard, and \*(GK -will issue a warning about its use if \*(FC\-\^\-lint\fP -is specified on the command line. -.sp .5 -The other feature is the use of \*(FCcontinue\fP -or \*(FCbreak\fP statements outside the body of a -\*(FCwhile\*(FR, \*(FCfor\*(FR, or \*(FCdo\fP loop. -Historical AWK implementations have treated such usage as -equivalent to the \*(FCnext\fP statement. -\*(GK will support this usage if \*(FC\-\^\-traditional\fP -has been specified.\*(CB -.EB "\s+2\f(HBHISTORICAL FEATURES (\*(GK\f(HB)\*(FR\s0" - - -.\" --- FTP Information -.ES -.nf -\*(CDHost: \*(FCgnudist.gnu.org\*(FR -File: \*(FC/gnu/gawk/gawk-3.0.6.tar.gz\fP -.in +.2i -.fi -GNU \*(AK (\*(GK). There may be a later version. -.in -.2i -.nf -.sp .5 -Host: \*(FCnetlib.bell-labs.com\*(FR -File: \*(FC/netlib/research/awk.bundle.gz\fP -.in +.2i -.fi -\*(NK. This version requires an ANSI C compiler; -GCC (the GNU C compiler) works well. -.in -.2i -.nf -.sp .5 -Host: \*(FCftp.whidbey.net\*(FR -File: \*(FC/pub/brennan/mawk1.3.3.tar.gz\fP -.in +.2i -.fi -Michael Brennan's \*(MK. There may be a newer version.\*(CX -.in -.2i -.EB "\s+2\f(HBFTP INFORMATION\*(FR\s0" - -.\" --- Copying Permissions -.ES -.fi -\*(CDCopyright \(co 1996-2000 Free Software Foundation, Inc. -.sp .5 -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. -.sp .5 -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. -.sp .5 -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.\*(CX -.EB "\s+2\f(HBCOPYING PERMISSIONS\*(FR\s0" -.BT diff --git a/contrib/awk/doc/awkforai.txt b/contrib/awk/doc/awkforai.txt deleted file mode 100644 index 3fca3204324f1..0000000000000 --- a/contrib/awk/doc/awkforai.txt +++ /dev/null @@ -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 (loui@ai.wustl.edu) 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). diff --git a/contrib/awk/doc/cardfonts b/contrib/awk/doc/cardfonts deleted file mode 100644 index 5529ba9891aa9..0000000000000 --- a/contrib/awk/doc/cardfonts +++ /dev/null @@ -1,37 +0,0 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org -.\" 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 diff --git a/contrib/awk/doc/colors b/contrib/awk/doc/colors deleted file mode 100644 index 933d25efedfcb..0000000000000 --- a/contrib/awk/doc/colors +++ /dev/null @@ -1,39 +0,0 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org -.\" 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 diff --git a/contrib/awk/doc/gawk.1 b/contrib/awk/doc/gawk.1 deleted file mode 100644 index 6f07cfab136e8..0000000000000 --- a/contrib/awk/doc/gawk.1 +++ /dev/null @@ -1,2657 +0,0 @@ -.ds PX \s-1POSIX\s+1 -.ds UX \s-1UNIX\s+1 -.ds AN \s-1ANSI\s+1 -.ds GN \s-1GNU\s+1 -.ds AK \s-1AWK\s+1 -.if !\n(.g \{\ -. if !\w|\*(lq| \{\ -. ds lq `` -. if \w'\(lq' .ds lq "\(lq -. \} -. if !\w|\*(rq| \{\ -. ds rq '' -. if \w'\(rq' .ds rq "\(rq -. \} -.\} -.TH GAWK 1 "May 17 2000" "Free Software Foundation" "Utility Commands" -.SH NAME -gawk \- pattern scanning and processing language -.SH SYNOPSIS -.B gawk -[ \*(PX or \*(GN style options ] -.B \-f -.I program-file -[ -.B \-\^\- -] file .\|.\|. -.br -.B gawk -[ \*(PX or \*(GN style options ] -[ -.B \-\^\- -] -.I program-text -file .\|.\|. -.SH DESCRIPTION -.I Gawk -is the \*(GN Project's implementation of the \*(AK programming language. -It conforms to the definition of the language in -the \*(PX 1003.2 Command Language And Utilities Standard. -This version in turn is based on the description in -.IR "The AWK Programming Language" , -by Aho, Kernighan, and Weinberger, -with the additional features found in the System V Release 4 version -of \*(UX -.IR awk . -.I Gawk -also provides more recent Bell Labs -.I awk -extensions, and some \*(GN-specific extensions. -.PP -The command line consists of options to -.I gawk -itself, the \*(AK program text (if not supplied via the -.B \-f -or -.B \-\^\-file -options), and values to be made -available in the -.B ARGC -and -.B ARGV -pre-defined \*(AK variables. -.SH OPTION FORMAT -.PP -.I Gawk -options may be either the traditional \*(PX one letter options, -or the \*(GN style long options. \*(PX options start with a single \*(lq\-\*(rq, -while long options start with \*(lq\-\^\-\*(rq. -Long options are provided for both \*(GN-specific features and -for \*(PX mandated features. -.PP -Following the \*(PX standard, -.IR gawk -specific -options are supplied via arguments to the -.B \-W -option. Multiple -.B \-W -options may be supplied -Each -.B \-W -option has a corresponding long option, as detailed below. -Arguments to long options are either joined with the option -by an -.B = -sign, with no intervening spaces, or they may be provided in the -next command line argument. -Long options may be abbreviated, as long as the abbreviation -remains unique. -.SH OPTIONS -.PP -.I Gawk -accepts the following options. -.TP -.PD 0 -.BI \-F " fs" -.TP -.PD -.BI \-\^\-field-separator " fs" -Use -.I fs -for the input field separator (the value of the -.B FS -predefined -variable). -.TP -.PD 0 -\fB\-v\fI var\fB\^=\^\fIval\fR -.TP -.PD -\fB\-\^\-assign \fIvar\fB\^=\^\fIval\fR -Assign the value -.IR val , -to the variable -.IR var , -before execution of the program begins. -Such variable values are available to the -.B BEGIN -block of an \*(AK program. -.TP -.PD 0 -.BI \-f " program-file" -.TP -.PD -.BI \-\^\-file " program-file" -Read the \*(AK program source from the file -.IR program-file , -instead of from the first command line argument. -Multiple -.B \-f -(or -.BR \-\^\-file ) -options may be used. -.TP -.PD 0 -.BI \-mf " NNN" -.TP -.PD -.BI \-mr " NNN" -Set various memory limits to the value -.IR NNN . -The -.B f -flag sets the maximum number of fields, and the -.B r -flag sets the maximum record size. These two flags and the -.B \-m -option are from the Bell Labs research version of \*(UX -.IR awk . -They are ignored by -.IR gawk , -since -.I gawk -has no pre-defined limits. -.TP -.PD 0 -.B "\-W traditional" -.TP -.PD 0 -.B "\-W compat" -.TP -.PD 0 -.B \-\^\-traditional -.TP -.PD -.B \-\^\-compat -Run in -.I compatibility -mode. In compatibility mode, -.I gawk -behaves identically to \*(UX -.IR awk ; -none of the \*(GN-specific extensions are recognized. -The use of -.B \-\^\-traditional -is preferred over the other forms of this option. -See -.BR "GNU EXTENSIONS" , -below, for more information. -.TP -.PD 0 -.B "\-W copyleft" -.TP -.PD 0 -.B "\-W copyright" -.TP -.PD 0 -.B \-\^\-copyleft -.TP -.PD -.B \-\^\-copyright -Print the short version of the \*(GN copyright information message on -the standard output, and exits successfully. -.TP -.PD 0 -.B "\-W help" -.TP -.PD 0 -.B "\-W usage" -.TP -.PD 0 -.B \-\^\-help -.TP -.PD -.B \-\^\-usage -Print a relatively short summary of the available options on -the standard output. -(Per the -.IR "GNU Coding Standards" , -these options cause an immediate, successful exit.) -.TP -.PD 0 -.B "\-W lint" -.TP -.PD -.B \-\^\-lint -Provide warnings about constructs that are -dubious or non-portable to other \*(AK implementations. -.TP -.PD 0 -.B "\-W lint\-old" -.TP -.PD -.B \-\^\-lint\-old -Provide warnings about constructs that are -not portable to the original version of Unix -.IR awk . -.ig -.\" This option is left undocumented, on purpose. -.TP -.PD 0 -.B "\-W nostalgia" -.TP -.PD -.B \-\^\-nostalgia -Provide a moment of nostalgia for long time -.I awk -users. -.. -.TP -.PD 0 -.B "\-W posix" -.TP -.PD -.B \-\^\-posix -This turns on -.I compatibility -mode, with the following additional restrictions: -.RS -.TP \w'\(bu'u+1n -\(bu -.B \ex -escape sequences are not recognized. -.TP -\(bu -Only space and tab act as field separators when -.B FS -is set to a single space, newline does not. -.TP -\(bu -The synonym -.B func -for the keyword -.B function -is not recognized. -.TP -\(bu -The operators -.B ** -and -.B **= -cannot be used in place of -.B ^ -and -.BR ^= . -.TP -\(bu -The -.B fflush() -function is not available. -.RE -.TP -.PD 0 -.B "\-W re\-interval" -.TP -.PD -.B \-\^\-re\-interval -Enable the use of -.I "interval expressions" -in regular expression matching -(see -.BR "Regular Expressions" , -below). -Interval expressions were not traditionally available in the -\*(AK language. The \*(PX standard added them, to make -.I awk -and -.I egrep -consistent with each other. -However, their use is likely -to break old \*(AK programs, so -.I gawk -only provides them if they are requested with this option, or when -.B \-\^\-posix -is specified. -.TP -.PD 0 -.BI "\-W source " program-text -.TP -.PD -.BI \-\^\-source " program-text" -Use -.I program-text -as \*(AK program source code. -This option allows the easy intermixing of library functions (used via the -.B \-f -and -.B \-\^\-file -options) with source code entered on the command line. -It is intended primarily for medium to large \*(AK programs used -in shell scripts. -.TP -.PD 0 -.B "\-W version" -.TP -.PD -.B \-\^\-version -Print version information for this particular copy of -.I gawk -on the standard output. -This is useful mainly for knowing if the current copy of -.I gawk -on your system -is up to date with respect to whatever the Free Software Foundation -is distributing. -This is also useful when reporting bugs. -(Per the -.IR "GNU Coding Standards" , -these options cause an immediate, successful exit.) -.TP -.B \-\^\- -Signal the end of options. This is useful to allow further arguments to the -\*(AK program itself to start with a \*(lq\-\*(rq. -This is mainly for consistency with the argument parsing convention used -by most other \*(PX programs. -.PP -In compatibility mode, -any other options are flagged as illegal, but are otherwise ignored. -In normal operation, as long as program text has been supplied, unknown -options are passed on to the \*(AK program in the -.B ARGV -array for processing. This is particularly useful for running \*(AK -programs via the \*(lq#!\*(rq executable interpreter mechanism. -.SH AWK PROGRAM EXECUTION -.PP -An \*(AK program consists of a sequence of pattern-action statements -and optional function definitions. -.RS -.PP -\fIpattern\fB { \fIaction statements\fB }\fR -.br -\fBfunction \fIname\fB(\fIparameter list\fB) { \fIstatements\fB }\fR -.RE -.PP -.I Gawk -first reads the program source from the -.IR program-file (s) -if specified, -from arguments to -.BR \-\^\-source , -or from the first non-option argument on the command line. -The -.B \-f -and -.B \-\^\-source -options may be used multiple times on the command line. -.I Gawk -will read the program text as if all the -.IR program-file s -and command line source texts -had been concatenated together. This is useful for building libraries -of \*(AK functions, without having to include them in each new \*(AK -program that uses them. It also provides the ability to mix library -functions with command line programs. -.PP -The environment variable -.B AWKPATH -specifies a search path to use when finding source files named with -the -.B \-f -option. If this variable does not exist, the default path is -\fB".:/usr/local/share/awk"\fR. -(The actual directory may vary, depending upon how -.I gawk -was built and installed.) -If a file name given to the -.B \-f -option contains a \*(lq/\*(rq character, no path search is performed. -.PP -.I Gawk -executes \*(AK programs in the following order. -First, -all variable assignments specified via the -.B \-v -option are performed. -Next, -.I gawk -compiles the program into an internal form. -Then, -.I gawk -executes the code in the -.B BEGIN -block(s) (if any), -and then proceeds to read -each file named in the -.B ARGV -array. -If there are no files named on the command line, -.I gawk -reads the standard input. -.PP -If a filename on the command line has the form -.IB var = val -it is treated as a variable assignment. The variable -.I var -will be assigned the value -.IR val . -(This happens after any -.B BEGIN -block(s) have been run.) -Command line variable assignment -is most useful for dynamically assigning values to the variables -\*(AK uses to control how input is broken into fields and records. -It is also useful for controlling state if multiple passes are needed over -a single data file. -.PP -If the value of a particular element of -.B ARGV -is empty (\fB""\fR), -.I gawk -skips over it. -.PP -For each record in the input, -.I gawk -tests to see if it matches any -.I pattern -in the \*(AK program. -For each pattern that the record matches, the associated -.I action -is executed. -The patterns are tested in the order they occur in the program. -.PP -Finally, after all the input is exhausted, -.I gawk -executes the code in the -.B END -block(s) (if any). -.SH VARIABLES, RECORDS AND FIELDS -\*(AK variables are dynamic; they come into existence when they are -first used. Their values are either floating-point numbers or strings, -or both, -depending upon how they are used. \*(AK also has one dimensional -arrays; arrays with multiple dimensions may be simulated. -Several pre-defined variables are set as a program -runs; these will be described as needed and summarized below. -.SS Records -Normally, records are separated by newline characters. You can control how -records are separated by assigning values to the built-in variable -.BR RS . -If -.B RS -is any single character, that character separates records. -Otherwise, -.B RS -is a regular expression. Text in the input that matches this -regular expression will separate the record. -However, in compatibility mode, -only the first character of its string -value is used for separating records. -If -.B RS -is set to the null string, then records are separated by -blank lines. -When -.B RS -is set to the null string, the newline character always acts as -a field separator, in addition to whatever value -.B FS -may have. -.SS Fields -.PP -As each input record is read, -.I gawk -splits the record into -.IR fields , -using the value of the -.B FS -variable as the field separator. -If -.B FS -is a single character, fields are separated by that character. -If -.B FS -is the null string, then each individual character becomes a -separate field. -Otherwise, -.B FS -is expected to be a full regular expression. -In the special case that -.B FS -is a single space, fields are separated -by runs of spaces and/or tabs and/or newlines. -(But see the discussion of -.BR \-\^\-posix , -below). -Note that the value of -.B IGNORECASE -(see below) will also affect how fields are split when -.B FS -is a regular expression, and how records are separated when -.B RS -is a regular expression. -.PP -If the -.B FIELDWIDTHS -variable is set to a space separated list of numbers, each field is -expected to have fixed width, and -.I gawk -will split up the record using the specified widths. The value of -.B FS -is ignored. -Assigning a new value to -.B FS -overrides the use of -.BR FIELDWIDTHS , -and restores the default behavior. -.PP -Each field in the input record may be referenced by its position, -.BR $1 , -.BR $2 , -and so on. -.B $0 -is the whole record. The value of a field may be assigned to as well. -Fields need not be referenced by constants: -.RS -.PP -.ft B -n = 5 -.br -print $n -.ft R -.RE -.PP -prints the fifth field in the input record. -The variable -.B NF -is set to the total number of fields in the input record. -.PP -References to non-existent fields (i.e. fields after -.BR $NF ) -produce the null-string. However, assigning to a non-existent field -(e.g., -.BR "$(NF+2) = 5" ) -will increase the value of -.BR NF , -create any intervening fields with the null string as their value, and -cause the value of -.B $0 -to be recomputed, with the fields being separated by the value of -.BR OFS . -References to negative numbered fields cause a fatal error. -Decrementing -.B NF -causes the values of fields past the new value to be lost, and the value of -.B $0 -to be recomputed, with the fields being separated by the value of -.BR OFS . -.SS Built-in Variables -.PP -.IR Gawk 's -built-in variables are: -.PP -.TP \w'\fBFIELDWIDTHS\fR'u+1n -.B ARGC -The number of command line arguments (does not include options to -.IR gawk , -or the program source). -.TP -.B ARGIND -The index in -.B ARGV -of the current file being processed. -.TP -.B ARGV -Array of command line arguments. The array is indexed from -0 to -.B ARGC -\- 1. -Dynamically changing the contents of -.B ARGV -can control the files used for data. -.TP -.B CONVFMT -The conversion format for numbers, \fB"%.6g"\fR, by default. -.TP -.B ENVIRON -An array containing the values of the current environment. -The array is indexed by the environment variables, each element being -the value of that variable (e.g., \fBENVIRON["HOME"]\fP might be -.BR /home/arnold ). -Changing this array does not affect the environment seen by programs which -.I gawk -spawns via redirection or the -.B system() -function. -(This may change in a future version of -.IR gawk .) -.\" but don't hold your breath... -.TP -.B ERRNO -If a system error occurs either doing a redirection for -.BR getline , -during a read for -.BR getline , -or during a -.BR close() , -then -.B ERRNO -will contain -a string describing the error. -.TP -.B FIELDWIDTHS -A white-space separated list of fieldwidths. When set, -.I gawk -parses the input into fields of fixed width, instead of using the -value of the -.B FS -variable as the field separator. -The fixed field width facility is still experimental; the -semantics may change as -.I gawk -evolves over time. -.TP -.B FILENAME -The name of the current input file. -If no files are specified on the command line, the value of -.B FILENAME -is \*(lq\-\*(rq. -However, -.B FILENAME -is undefined inside the -.B BEGIN -block. -.TP -.B FNR -The input record number in the current input file. -.TP -.B FS -The input field separator, a space by default. See -.BR Fields , -above. -.TP -.B IGNORECASE -Controls the case-sensitivity of all regular expression -and string operations. If -.B IGNORECASE -has a non-zero value, then string comparisons and -pattern matching in rules, -field splitting with -.BR FS , -record separating with -.BR RS , -regular expression -matching with -.B ~ -and -.BR !~ , -and the -.BR gensub() , -.BR gsub() , -.BR index() , -.BR match() , -.BR split() , -and -.B sub() -pre-defined functions will all ignore case when doing regular expression -operations. Thus, if -.B IGNORECASE -is not equal to zero, -.B /aB/ -matches all of the strings \fB"ab"\fP, \fB"aB"\fP, \fB"Ab"\fP, -and \fB"AB"\fP. -As with all \*(AK variables, the initial value of -.B IGNORECASE -is zero, so all regular expression and string -operations are normally case-sensitive. -Under Unix, the full ISO 8859-1 Latin-1 character set is used -when ignoring case. -.B NOTE: -In versions of -.I gawk -prior to 3.0, -.B IGNORECASE -only affected regular expression operations. It now affects string -comparisons as well. -.TP -.B NF -The number of fields in the current input record. -.TP -.B NR -The total number of input records seen so far. -.TP -.B OFMT -The output format for numbers, \fB"%.6g"\fR, by default. -.TP -.B OFS -The output field separator, a space by default. -.TP -.B ORS -The output record separator, by default a newline. -.TP -.B RS -The input record separator, by default a newline. -.TP -.B RT -The record terminator. -.I Gawk -sets -.B RT -to the input text that matched the character or regular expression -specified by -.BR RS . -.TP -.B RSTART -The index of the first character matched by -.BR match() ; -0 if no match. -.TP -.B RLENGTH -The length of the string matched by -.BR match() ; -\-1 if no match. -.TP -.B SUBSEP -The character used to separate multiple subscripts in array -elements, by default \fB"\e034"\fR. -.SS Arrays -.PP -Arrays are subscripted with an expression between square brackets -.RB ( [ " and " ] ). -If the expression is an expression list -.RI ( expr ", " expr " .\|.\|.)" -then the array subscript is a string consisting of the -concatenation of the (string) value of each expression, -separated by the value of the -.B SUBSEP -variable. -This facility is used to simulate multiply dimensioned -arrays. For example: -.PP -.RS -.ft B -i = "A";\^ j = "B";\^ k = "C" -.br -x[i, j, k] = "hello, world\en" -.ft R -.RE -.PP -assigns the string \fB"hello, world\en"\fR to the element of the array -.B x -which is indexed by the string \fB"A\e034B\e034C"\fR. All arrays in \*(AK -are associative, i.e. indexed by string values. -.PP -The special operator -.B in -may be used in an -.B if -or -.B while -statement to see if an array has an index consisting of a particular -value. -.PP -.RS -.ft B -.nf -if (val in array) - print array[val] -.fi -.ft -.RE -.PP -If the array has multiple subscripts, use -.BR "(i, j) in array" . -.PP -The -.B in -construct may also be used in a -.B for -loop to iterate over all the elements of an array. -.PP -An element may be deleted from an array using the -.B delete -statement. -The -.B delete -statement may also be used to delete the entire contents of an array, -just by specifying the array name without a subscript. -.SS Variable Typing And Conversion -.PP -Variables and fields -may be (floating point) numbers, or strings, or both. How the -value of a variable is interpreted depends upon its context. If used in -a numeric expression, it will be treated as a number, if used as a string -it will be treated as a string. -.PP -To force a variable to be treated as a number, add 0 to it; to force it -to be treated as a string, concatenate it with the null string. -.PP -When a string must be converted to a number, the conversion is accomplished -using -.IR atof (3). -A number is converted to a string by using the value of -.B CONVFMT -as a format string for -.IR sprintf (3), -with the numeric value of the variable as the argument. -However, even though all numbers in \*(AK are floating-point, -integral values are -.I always -converted as integers. Thus, given -.PP -.RS -.ft B -.nf -CONVFMT = "%2.2f" -a = 12 -b = a "" -.fi -.ft R -.RE -.PP -the variable -.B b -has a string value of \fB"12"\fR and not \fB"12.00"\fR. -.PP -.I Gawk -performs comparisons as follows: -If two variables are numeric, they are compared numerically. -If one value is numeric and the other has a string value that is a -\*(lqnumeric string,\*(rq then comparisons are also done numerically. -Otherwise, the numeric value is converted to a string and a string -comparison is performed. -Two strings are compared, of course, as strings. -According to the \*(PX standard, even if two strings are -numeric strings, a numeric comparison is performed. However, this is -clearly incorrect, and -.I gawk -does not do this. -.PP -Note that string constants, such as \fB"57"\fP, are -.I not -numeric strings, they are string constants. -The idea of \*(lqnumeric string\*(rq -only applies to fields, -.B getline -input, -.BR FILENAME , -.B ARGV -elements, -.B ENVIRON -elements and the elements of an array created by -.B split() -that are numeric strings. -The basic idea is that -.IR "user input" , -and only user input, that looks numeric, -should be treated that way. -.PP -Uninitialized variables have the numeric value 0 and the string value "" -(the null, or empty, string). -.SH PATTERNS AND ACTIONS -\*(AK is a line-oriented language. The pattern comes first, and then the -action. Action statements are enclosed in -.B { -and -.BR } . -Either the pattern may be missing, or the action may be missing, but, -of course, not both. If the pattern is missing, the action will be -executed for every single record of input. -A missing action is equivalent to -.RS -.PP -.B "{ print }" -.RE -.PP -which prints the entire record. -.PP -Comments begin with the \*(lq#\*(rq character, and continue until the -end of the line. -Blank lines may be used to separate statements. -Normally, a statement ends with a newline, however, this is not the -case for lines ending in -a \*(lq,\*(rq, -.BR { , -.BR ? , -.BR : , -.BR && , -or -.BR || . -Lines ending in -.B do -or -.B else -also have their statements automatically continued on the following line. -In other cases, a line can be continued by ending it with a \*(lq\e\*(rq, -in which case the newline will be ignored. -.PP -Multiple statements may -be put on one line by separating them with a \*(lq;\*(rq. -This applies to both the statements within the action part of a -pattern-action pair (the usual case), -and to the pattern-action statements themselves. -.SS Patterns -\*(AK patterns may be one of the following: -.PP -.RS -.nf -.B BEGIN -.B END -.BI / "regular expression" / -.I "relational expression" -.IB pattern " && " pattern -.IB pattern " || " pattern -.IB pattern " ? " pattern " : " pattern -.BI ( pattern ) -.BI ! " pattern" -.IB pattern1 ", " pattern2 -.fi -.RE -.PP -.B BEGIN -and -.B END -are two special kinds of patterns which are not tested against -the input. -The action parts of all -.B BEGIN -patterns are merged as if all the statements had -been written in a single -.B BEGIN -block. They are executed before any -of the input is read. Similarly, all the -.B END -blocks are merged, -and executed when all the input is exhausted (or when an -.B exit -statement is executed). -.B BEGIN -and -.B END -patterns cannot be combined with other patterns in pattern expressions. -.B BEGIN -and -.B END -patterns cannot have missing action parts. -.PP -For -.BI / "regular expression" / -patterns, the associated statement is executed for each input record that matches -the regular expression. -Regular expressions are the same as those in -.IR egrep (1), -and are summarized below. -.PP -A -.I "relational expression" -may use any of the operators defined below in the section on actions. -These generally test whether certain fields match certain regular expressions. -.PP -The -.BR && , -.BR || , -and -.B ! -operators are logical AND, logical OR, and logical NOT, respectively, as in C. -They do short-circuit evaluation, also as in C, and are used for combining -more primitive pattern expressions. As in most languages, parentheses -may be used to change the order of evaluation. -.PP -The -.B ?\^: -operator is like the same operator in C. If the first pattern is true -then the pattern used for testing is the second pattern, otherwise it is -the third. Only one of the second and third patterns is evaluated. -.PP -The -.IB pattern1 ", " pattern2 -form of an expression is called a -.IR "range pattern" . -It matches all input records starting with a record that matches -.IR pattern1 , -and continuing until a record that matches -.IR pattern2 , -inclusive. It does not combine with any other sort of pattern expression. -.SS Regular Expressions -Regular expressions are the extended kind found in -.IR egrep . -They are composed of characters as follows: -.TP \w'\fB[^\fIabc.\|.\|.\fB]\fR'u+2n -.I c -matches the non-metacharacter -.IR c . -.TP -.I \ec -matches the literal character -.IR c . -.TP -.B . -matches any character -.I including -newline. -.TP -.B ^ -matches the beginning of a string. -.TP -.B $ -matches the end of a string. -.TP -.BI [ abc.\|.\|. ] -character list, matches any of the characters -.IR abc.\|.\|. . -.TP -.BI [^ abc.\|.\|. ] -negated character list, matches any character except -.IR abc.\|.\|. . -.TP -.IB r1 | r2 -alternation: matches either -.I r1 -or -.IR r2 . -.TP -.I r1r2 -concatenation: matches -.IR r1 , -and then -.IR r2 . -.TP -.IB r + -matches one or more -.IR r 's. -.TP -.IB r * -matches zero or more -.IR r 's. -.TP -.IB r ? -matches zero or one -.IR r 's. -.TP -.BI ( r ) -grouping: matches -.IR r . -.TP -.PD 0 -.IB r { n } -.TP -.PD 0 -.IB r { n ,} -.TP -.PD -.IB r { n , m } -One or two numbers inside braces denote an -.IR "interval expression" . -If there is one number in the braces, the preceding regexp -.I r -is repeated -.I n -times. If there are two numbers separated by a comma, -.I r -is repeated -.I n -to -.I m -times. -If there is one number followed by a comma, then -.I r -is repeated at least -.I n -times. -.sp .5 -Interval expressions are only available if either -.B \-\^\-posix -or -.B \-\^\-re\-interval -is specified on the command line. -.TP -.B \ey -matches the empty string at either the beginning or the -end of a word. -.TP -.B \eB -matches the empty string within a word. -.TP -.B \e< -matches the empty string at the beginning of a word. -.TP -.B \e> -matches the empty string at the end of a word. -.TP -.B \ew -matches any word-constituent character (letter, digit, or underscore). -.TP -.B \eW -matches any character that is not word-constituent. -.TP -.B \e` -matches the empty string at the beginning of a buffer (string). -.TP -.B \e' -matches the empty string at the end of a buffer. -.PP -The escape sequences that are valid in string constants (see below) -are also legal in regular expressions. -.PP -.I "Character classes" -are a new feature introduced in the \*(PX standard. -A character class is a special notation for describing -lists of characters that have a specific attribute, but where the -actual characters themselves can vary from country to country and/or -from character set to character set. For example, the notion of what -is an alphabetic character differs in the USA and in France. -.PP -A character class is only valid in a regexp -.I inside -the brackets of a character list. Character classes consist of -.BR [: , -a keyword denoting the class, and -.BR :] . -Here are the character -classes defined by the \*(PX standard. -.TP -.B [:alnum:] -Alphanumeric characters. -.TP -.B [:alpha:] -Alphabetic characters. -.TP -.B [:blank:] -Space or tab characters. -.TP -.B [:cntrl:] -Control characters. -.TP -.B [:digit:] -Numeric characters. -.TP -.B [:graph:] -Characters that are both printable and visible. -(A space is printable, but not visible, while an -.B a -is both.) -.TP -.B [:lower:] -Lower-case alphabetic characters. -.TP -.B [:print:] -Printable characters (characters that are not control characters.) -.TP -.B [:punct:] -Punctuation characters (characters that are not letter, digits, -control characters, or space characters). -.TP -.B [:space:] -Space characters (such as space, tab, and formfeed, to name a few). -.TP -.B [:upper:] -Upper-case alphabetic characters. -.TP -.B [:xdigit:] -Characters that are hexadecimal digits. -.PP -For example, before the \*(PX standard, to match alphanumeric -characters, you would have had to write -.BR /[A\-Za\-z0\-9]/ . -If your character set had other alphabetic characters in it, this would not -match them. With the \*(PX character classes, you can write -.BR /[[:alnum:]]/ , -and this will match -.I all -the alphabetic and numeric characters in your character set. -.PP -Two additional special sequences can appear in character lists. -These apply to non-ASCII character sets, which can have single symbols -(called -.IR "collating elements" ) -that are represented with more than one -character, as well as several characters that are equivalent for -.IR collating , -or sorting, purposes. (E.g., in French, a plain \*(lqe\*(rq -and a grave-accented e\` are equivalent.) -.TP -Collating Symbols -A collating symbols is a multi-character collating element enclosed in -.B [. -and -.BR .] . -For example, if -.B ch -is a collating element, then -.B [[.ch.]] -is a regexp that matches this collating element, while -.B [ch] -is a regexp that matches either -.B c -or -.BR h . -.TP -Equivalence Classes -An equivalence class is a locale-specific name for a list of -characters that are equivalent. The name is enclosed in -.B [= -and -.BR =] . -For example, the name -.B e -might be used to represent all of -\*(lqe,\*(rq \*(lqe\`,\*(rq and \*(lqe\`.\*(rq -In this case, -.B [[=e]] -is a regexp -that matches any of - .BR e , - .BR e\' , -or - .BR e\` . -.PP -These features are very valuable in non-English speaking locales. -The library functions that -.I gawk -uses for regular expression matching -currently only recognize \*(PX character classes; they do not recognize -collating symbols or equivalence classes. -.PP -The -.BR \ey , -.BR \eB , -.BR \e< , -.BR \e> , -.BR \ew , -.BR \eW , -.BR \e` , -and -.B \e' -operators are specific to -.IR gawk ; -they are extensions based on facilities in the \*(GN regexp libraries. -.PP -The various command line options -control how -.I gawk -interprets characters in regexps. -.TP -No options -In the default case, -.I gawk -provide all the facilities of -\*(PX regexps and the \*(GN regexp operators described above. -However, interval expressions are not supported. -.TP -.B \-\^\-posix -Only \*(PX regexps are supported, the \*(GN operators are not special. -(E.g., -.B \ew -matches a literal -.BR w ). -Interval expressions are allowed. -.TP -.B \-\^\-traditional -Traditional Unix -.I awk -regexps are matched. The \*(GN operators -are not special, interval expressions are not available, and neither -are the \*(PX character classes -.RB ( [[:alnum:]] -and so on). -Characters described by octal and hexadecimal escape sequences are -treated literally, even if they represent regexp metacharacters. -.TP -.B \-\^\-re\-interval -Allow interval expressions in regexps, even if -.B \-\^\-traditional -has been provided. -.SS Actions -Action statements are enclosed in braces, -.B { -and -.BR } . -Action statements consist of the usual assignment, conditional, and looping -statements found in most languages. The operators, control statements, -and input/output statements -available are patterned after those in C. -.SS Operators -.PP -The operators in \*(AK, in order of decreasing precedence, are -.PP -.TP "\w'\fB*= /= %= ^=\fR'u+1n" -.BR ( \&.\|.\|. ) -Grouping -.TP -.B $ -Field reference. -.TP -.B "++ \-\^\-" -Increment and decrement, both prefix and postfix. -.TP -.B ^ -Exponentiation (\fB**\fR may also be used, and \fB**=\fR for -the assignment operator). -.TP -.B "+ \- !" -Unary plus, unary minus, and logical negation. -.TP -.B "* / %" -Multiplication, division, and modulus. -.TP -.B "+ \-" -Addition and subtraction. -.TP -.I space -String concatenation. -.TP -.PD 0 -.B "< >" -.TP -.PD 0 -.B "<= >=" -.TP -.PD -.B "!= ==" -The regular relational operators. -.TP -.B "~ !~" -Regular expression match, negated match. -.B NOTE: -Do not use a constant regular expression -.RB ( /foo/ ) -on the left-hand side of a -.B ~ -or -.BR !~ . -Only use one on the right-hand side. The expression -.BI "/foo/ ~ " exp -has the same meaning as \fB(($0 ~ /foo/) ~ \fIexp\fB)\fR. -This is usually -.I not -what was intended. -.TP -.B in -Array membership. -.TP -.B && -Logical AND. -.TP -.B || -Logical OR. -.TP -.B ?: -The C conditional expression. This has the form -.IB expr1 " ? " expr2 " : " expr3\c -\&. -If -.I expr1 -is true, the value of the expression is -.IR expr2 , -otherwise it is -.IR expr3 . -Only one of -.I expr2 -and -.I expr3 -is evaluated. -.TP -.PD 0 -.B "= += \-=" -.TP -.PD -.B "*= /= %= ^=" -Assignment. Both absolute assignment -.BI ( var " = " value ) -and operator-assignment (the other forms) are supported. -.SS Control Statements -.PP -The control statements are -as follows: -.PP -.RS -.nf -\fBif (\fIcondition\fB) \fIstatement\fR [ \fBelse\fI statement \fR] -\fBwhile (\fIcondition\fB) \fIstatement \fR -\fBdo \fIstatement \fBwhile (\fIcondition\fB)\fR -\fBfor (\fIexpr1\fB; \fIexpr2\fB; \fIexpr3\fB) \fIstatement\fR -\fBfor (\fIvar \fBin\fI array\fB) \fIstatement\fR -\fBbreak\fR -\fBcontinue\fR -\fBdelete \fIarray\^\fB[\^\fIindex\^\fB]\fR -\fBdelete \fIarray\^\fR -\fBexit\fR [ \fIexpression\fR ] -\fB{ \fIstatements \fB} -.fi -.RE -.SS "I/O Statements" -.PP -The input/output statements are as follows: -.PP -.TP "\w'\fBprintf \fIfmt, expr-list\fR'u+1n" -.BI close( file ) -Close file (or pipe, see below). -.TP -.B getline -Set -.B $0 -from next input record; set -.BR NF , -.BR NR , -.BR FNR . -.TP -.BI "getline <" file -Set -.B $0 -from next record of -.IR file ; -set -.BR NF . -.TP -.BI getline " var" -Set -.I var -from next input record; set -.BR NR , -.BR FNR . -.TP -.BI getline " var" " <" file -Set -.I var -from next record of -.IR file . -.TP -.B next -Stop processing the current input record. The next input record -is read and processing starts over with the first pattern in the -\*(AK program. If the end of the input data is reached, the -.B END -block(s), if any, are executed. -.TP -.B "nextfile" -Stop processing the current input file. The next input record read -comes from the next input file. -.B FILENAME -and -.B ARGIND -are updated, -.B FNR -is reset to 1, and processing starts over with the first pattern in the -\*(AK program. If the end of the input data is reached, the -.B END -block(s), if any, are executed. -.B NOTE: -Earlier versions of gawk used -.BR "next file" , -as two words. While this usage is still recognized, it generates a -warning message and will eventually be removed. -.TP -.B print -Prints the current record. -The output record is terminated with the value of the -.B ORS -variable. -.TP -.BI print " expr-list" -Prints expressions. -Each expression is separated by the value of the -.B OFS -variable. -The output record is terminated with the value of the -.B ORS -variable. -.TP -.BI print " expr-list" " >" file -Prints expressions on -.IR file . -Each expression is separated by the value of the -.B OFS -variable. The output record is terminated with the value of the -.B ORS -variable. -.TP -.BI printf " fmt, expr-list" -Format and print. -.TP -.BI printf " fmt, expr-list" " >" file -Format and print on -.IR file . -.TP -.BI system( cmd-line ) -Execute the command -.IR cmd-line , -and return the exit status. -(This may not be available on non-\*(PX systems.) -.TP -\&\fBfflush(\fR[\fIfile\^\fR]\fB)\fR -Flush any buffers associated with the open output file or pipe -.IR file . -If -.I file -is missing, then standard output is flushed. -If -.I file -is the null string, -then all open output files and pipes -have their buffers flushed. -.PP -Other input/output redirections are also allowed. For -.B print -and -.BR printf , -.BI >> " file" -appends output to the -.IR file , -while -.BI | " command" -writes on a pipe. -In a similar fashion, -.IB command " | getline" -pipes into -.BR getline . -The -.BR getline -command will return 0 on end of file, and \-1 on an error. -.PP -NOTE: If using a pipe to -.BR getline , -or from -.B print -or -.BR printf -within a loop, you -.I must -use -.B close() -to create new instances of the command. -AWK does not automatically close pipes when -they return EOF. -.SS The \fIprintf\fP\^ Statement -.PP -The \*(AK versions of the -.B printf -statement and -.B sprintf() -function -(see below) -accept the following conversion specification formats: -.TP -.B %c -An \s-1ASCII\s+1 character. -If the argument used for -.B %c -is numeric, it is treated as a character and printed. -Otherwise, the argument is assumed to be a string, and the only first -character of that string is printed. -.TP -.PD 0 -.B %d -.TP -.PD -.B %i -A decimal number (the integer part). -.TP -.PD 0 -.B %e -.TP -.PD -.B %E -A floating point number of the form -.BR [\-]d.dddddde[+\^\-]dd . -The -.B %E -format uses -.B E -instead of -.BR e . -.TP -.B %f -A floating point number of the form -.BR [\-]ddd.dddddd . -.TP -.PD 0 -.B %g -.TP -.PD -.B %G -Use -.B %e -or -.B %f -conversion, whichever is shorter, with nonsignificant zeros suppressed. -The -.B %G -format uses -.B %E -instead of -.BR %e . -.TP -.B %o -An unsigned octal number (also an integer). -.TP -.PD -.B %u -An unsigned decimal number (again, an integer). -.TP -.B %s -A character string. -.TP -.PD 0 -.B %x -.TP -.PD -.B %X -An unsigned hexadecimal number (an integer). -The -.B %X -format uses -.B ABCDEF -instead of -.BR abcdef . -.TP -.B %% -A single -.B % -character; no argument is converted. -.PP -There are optional, additional parameters that may lie between the -.B % -and the control letter: -.TP -.B \- -The expression should be left-justified within its field. -.TP -.I space -For numeric conversions, prefix positive values with a space, and -negative values with a minus sign. -.TP -.B + -The plus sign, used before the width modifier (see below), -says to always supply a sign for numeric conversions, even if the data -to be formatted is positive. The -.B + -overrides the space modifier. -.TP -.B # -Use an \*(lqalternate form\*(rq for certain control letters. -For -.BR %o , -supply a leading zero. -For -.BR %x , -and -.BR %X , -supply a leading -.BR 0x -or -.BR 0X -for -a nonzero result. -For -.BR %e , -.BR %E , -and -.BR %f , -the result will always contain a -decimal point. -For -.BR %g , -and -.BR %G , -trailing zeros are not removed from the result. -.TP -.B 0 -A leading -.B 0 -(zero) acts as a flag, that indicates output should be -padded with zeroes instead of spaces. -This applies even to non-numeric output formats. -This flag only has an effect when the field width is wider than the -value to be printed. -.TP -.I width -The field should be padded to this width. The field is normally padded -with spaces. If the -.B 0 -flag has been used, it is padded with zeroes. -.TP -.BI \&. prec -A number that specifies the precision to use when printing. -For the -.BR %e , -.BR %E , -and -.BR %f -formats, this specifies the -number of digits you want printed to the right of the decimal point. -For the -.BR %g , -and -.B %G -formats, it specifies the maximum number -of significant digits. For the -.BR %d , -.BR %o , -.BR %i , -.BR %u , -.BR %x , -and -.B %X -formats, it specifies the minimum number of -digits to print. For a string, it specifies the maximum number of -characters from the string that should be printed. -.PP -The dynamic -.I width -and -.I prec -capabilities of the \*(AN C -.B printf() -routines are supported. -A -.B * -in place of either the -.B width -or -.B prec -specifications will cause their values to be taken from -the argument list to -.B printf -or -.BR sprintf() . -.SS Special File Names -.PP -When doing I/O redirection from either -.B print -or -.B printf -into a file, -or via -.B getline -from a file, -.I gawk -recognizes certain special filenames internally. These filenames -allow access to open file descriptors inherited from -.IR gawk 's -parent process (usually the shell). -Other special filenames provide access to information about the running -.B gawk -process. -The filenames are: -.TP \w'\fB/dev/stdout\fR'u+1n -.B /dev/pid -Reading this file returns the process ID of the current process, -in decimal, terminated with a newline. -.TP -.B /dev/ppid -Reading this file returns the parent process ID of the current process, -in decimal, terminated with a newline. -.TP -.B /dev/pgrpid -Reading this file returns the process group ID of the current process, -in decimal, terminated with a newline. -.TP -.B /dev/user -Reading this file returns a single record terminated with a newline. -The fields are separated with spaces. -.B $1 -is the value of the -.IR getuid (2) -system call, -.B $2 -is the value of the -.IR geteuid (2) -system call, -.B $3 -is the value of the -.IR getgid (2) -system call, and -.B $4 -is the value of the -.IR getegid (2) -system call. -If there are any additional fields, they are the group IDs returned by -.IR getgroups (2). -Multiple groups may not be supported on all systems. -.TP -.B /dev/stdin -The standard input. -.TP -.B /dev/stdout -The standard output. -.TP -.B /dev/stderr -The standard error output. -.TP -.BI /dev/fd/\^ n -The file associated with the open file descriptor -.IR n . -.PP -These are particularly useful for error messages. For example: -.PP -.RS -.ft B -print "You blew it!" > "/dev/stderr" -.ft R -.RE -.PP -whereas you would otherwise have to use -.PP -.RS -.ft B -print "You blew it!" | "cat 1>&2" -.ft R -.RE -.PP -These file names may also be used on the command line to name data files. -.SS Numeric Functions -.PP -\*(AK has the following pre-defined arithmetic functions: -.PP -.TP \w'\fBsrand(\fR[\fIexpr\^\fR]\fB)\fR'u+1n -.BI atan2( y , " x" ) -returns the arctangent of -.I y/x -in radians. -.TP -.BI cos( expr ) -returns the cosine of -.IR expr , -which is in radians. -.TP -.BI exp( expr ) -the exponential function. -.TP -.BI int( expr ) -truncates to integer. -.TP -.BI log( expr ) -the natural logarithm function. -.TP -.B rand() -returns a random number between 0 and 1. -.TP -.BI sin( expr ) -returns the sine of -.IR expr , -which is in radians. -.TP -.BI sqrt( expr ) -the square root function. -.TP -\&\fBsrand(\fR[\fIexpr\^\fR]\fB)\fR -uses -.I expr -as a new seed for the random number generator. If no -.I expr -is provided, the time of day will be used. -The return value is the previous seed for the random -number generator. -.SS String Functions -.PP -.I Gawk -has the following pre-defined string functions: -.PP -.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIexpr-list\^\fB)\fR'u+1n" -\fBgensub(\fIr\fB, \fIs\fB, \fIh \fR[\fB, \fIt\fR]\fB)\fR -search the target string -.I t -for matches of the regular expression -.IR r . -If -.I h -is a string beginning with -.B g -or -.BR G , -then replace all matches of -.I r -with -.IR s . -Otherwise, -.I h -is a number indicating which match of -.I r -to replace. -If no -.I t -is supplied, -.B $0 -is used instead. -Within the replacement text -.IR s , -the sequence -.BI \e n\fR, -where -.I n -is a digit from 1 to 9, may be used to indicate just the text that -matched the -.IR n 'th -parenthesized subexpression. The sequence -.B \e0 -represents the entire matched text, as does the character -.BR & . -Unlike -.B sub() -and -.BR gsub() , -the modified string is returned as the result of the function, -and the original target string is -.I not -changed. -.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIexpr-list\^\fB)\fR'u+1n" -\fBgsub(\fIr\fB, \fIs \fR[\fB, \fIt\fR]\fB)\fR -for each substring matching the regular expression -.I r -in the string -.IR t , -substitute the string -.IR s , -and return the number of substitutions. -If -.I t -is not supplied, use -.BR $0 . -An -.B & -in the replacement text is replaced with the text that was actually matched. -Use -.B \e& -to get a literal -.BR & . -See -.I "Effective AWK Programming" -for a fuller discussion of the rules for -.BR &'s -and backslashes in the replacement text of -.BR sub() , -.BR gsub() , -and -.BR gensub() . -.TP -.BI index( s , " t" ) -returns the index of the string -.I t -in the string -.IR s , -or 0 if -.I t -is not present. -.TP -\fBlength(\fR[\fIs\fR]\fB) -returns the length of the string -.IR s , -or the length of -.B $0 -if -.I s -is not supplied. -.TP -.BI match( s , " r" ) -returns the position in -.I s -where the regular expression -.I r -occurs, or 0 if -.I r -is not present, and sets the values of -.B RSTART -and -.BR RLENGTH . -.TP -\fBsplit(\fIs\fB, \fIa \fR[\fB, \fIr\fR]\fB)\fR -splits the string -.I s -into the array -.I a -on the regular expression -.IR r , -and returns the number of fields. If -.I r -is omitted, -.B FS -is used instead. -The array -.I a -is cleared first. -Splitting behaves identically to field splitting, described above. -.TP -.BI sprintf( fmt , " expr-list" ) -prints -.I expr-list -according to -.IR fmt , -and returns the resulting string. -.TP -\fBsub(\fIr\fB, \fIs \fR[\fB, \fIt\fR]\fB)\fR -just like -.BR gsub() , -but only the first matching substring is replaced. -.TP -\fBsubstr(\fIs\fB, \fIi \fR[\fB, \fIn\fR]\fB)\fR -returns the at most -.IR n -character -substring of -.I s -starting at -.IR i . -If -.I n -is omitted, the rest of -.I s -is used. -.TP -.BI tolower( str ) -returns a copy of the string -.IR str , -with all the upper-case characters in -.I str -translated to their corresponding lower-case counterparts. -Non-alphabetic characters are left unchanged. -.TP -.BI toupper( str ) -returns a copy of the string -.IR str , -with all the lower-case characters in -.I str -translated to their corresponding upper-case counterparts. -Non-alphabetic characters are left unchanged. -.SS Time Functions -.PP -Since one of the primary uses of \*(AK programs is processing log files -that contain time stamp information, -.I gawk -provides the following two functions for obtaining time stamps and -formatting them. -.PP -.TP "\w'\fBsystime()\fR'u+1n" -.B systime() -returns the current time of day as the number of seconds since the Epoch -(Midnight UTC, January 1, 1970 on \*(PX systems). -.TP -\fBstrftime(\fR[\fIformat \fR[\fB, \fItimestamp\fR]]\fB)\fR -formats -.I timestamp -according to the specification in -.IR format. -The -.I timestamp -should be of the same form as returned by -.BR systime() . -If -.I timestamp -is missing, the current time of day is used. -If -.I format -is missing, a default format equivalent to the output of -.IR date (1) -will be used. -See the specification for the -.B strftime() -function in \*(AN C for the format conversions that are -guaranteed to be available. -A public-domain version of -.IR strftime (3) -and a man page for it come with -.IR gawk ; -if that version was used to build -.IR gawk , -then all of the conversions described in that man page are available to -.IR gawk. -.SS String Constants -.PP -String constants in \*(AK are sequences of characters enclosed -between double quotes (\fB"\fR). Within strings, certain -.I "escape sequences" -are recognized, as in C. These are: -.PP -.TP \w'\fB\e\^\fIddd\fR'u+1n -.B \e\e -A literal backslash. -.TP -.B \ea -The \*(lqalert\*(rq character; usually the \s-1ASCII\s+1 \s-1BEL\s+1 character. -.TP -.B \eb -backspace. -.TP -.B \ef -form-feed. -.TP -.B \en -newline. -.TP -.B \er -carriage return. -.TP -.B \et -horizontal tab. -.TP -.B \ev -vertical tab. -.TP -.BI \ex "\^hex digits" -The character represented by the string of hexadecimal digits following -the -.BR \ex . -As in \*(AN C, all following hexadecimal digits are considered part of -the escape sequence. -(This feature should tell us something about language design by committee.) -E.g., \fB"\ex1B"\fR is the \s-1ASCII\s+1 \s-1ESC\s+1 (escape) character. -.TP -.BI \e ddd -The character represented by the 1-, 2-, or 3-digit sequence of octal -digits. -E.g., \fB"\e033"\fR is the \s-1ASCII\s+1 \s-1ESC\s+1 (escape) character. -.TP -.BI \e c -The literal character -.IR c\^ . -.PP -The escape sequences may also be used inside constant regular expressions -(e.g., -.B "/[\ \et\ef\en\er\ev]/" -matches whitespace characters). -.PP -In compatibility mode, the characters represented by octal and -hexadecimal escape sequences are treated literally when used in -regexp constants. Thus, -.B /a\e52b/ -is equivalent to -.BR /a\e*b/ . -.SH FUNCTIONS -Functions in \*(AK are defined as follows: -.PP -.RS -\fBfunction \fIname\fB(\fIparameter list\fB) { \fIstatements \fB}\fR -.RE -.PP -Functions are executed when they are called from within expressions -in either patterns or actions. Actual parameters supplied in the function -call are used to instantiate the formal parameters declared in the function. -Arrays are passed by reference, other variables are passed by value. -.PP -Since functions were not originally part of the \*(AK language, the provision -for local variables is rather clumsy: They are declared as extra parameters -in the parameter list. The convention is to separate local variables from -real parameters by extra spaces in the parameter list. For example: -.PP -.RS -.ft B -.nf -function f(p, q, a, b) # a & b are local -{ - \&.\|.\|. -} - -/abc/ { .\|.\|. ; f(1, 2) ; .\|.\|. } -.fi -.ft R -.RE -.PP -The left parenthesis in a function call is required -to immediately follow the function name, -without any intervening white space. -This is to avoid a syntactic ambiguity with the concatenation operator. -This restriction does not apply to the built-in functions listed above. -.PP -Functions may call each other and may be recursive. -Function parameters used as local variables are initialized -to the null string and the number zero upon function invocation. -.PP -Use -.BI return " expr" -to return a value from a function. The return value is undefined if no -value is provided, or if the function returns by \*(lqfalling off\*(rq the -end. -.PP -If -.B \-\^\-lint -has been provided, -.I gawk -will warn about calls to undefined functions at parse time, -instead of at run time. -Calling an undefined function at run time is a fatal error. -.PP -The word -.B func -may be used in place of -.BR function . -.SH EXAMPLES -.nf -Print and sort the login names of all users: - -.ft B - BEGIN { FS = ":" } - { print $1 | "sort" } - -.ft R -Count lines in a file: - -.ft B - { nlines++ } - END { print nlines } - -.ft R -Precede each line by its number in the file: - -.ft B - { print FNR, $0 } - -.ft R -Concatenate and line number (a variation on a theme): - -.ft B - { print NR, $0 } -.ft R -.fi -.SH SEE ALSO -.IR egrep (1), -.IR getpid (2), -.IR getppid (2), -.IR getpgrp (2), -.IR getuid (2), -.IR geteuid (2), -.IR getgid (2), -.IR getegid (2), -.IR getgroups (2) -.PP -.IR "The AWK Programming Language" , -Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger, -Addison-Wesley, 1988. ISBN 0-201-07981-X. -.PP -.IR "Effective AWK Programming" , -Edition 1.0, published by the Free Software Foundation, 1995. -.SH POSIX COMPATIBILITY -A primary goal for -.I gawk -is compatibility with the \*(PX standard, as well as with the -latest version of \*(UX -.IR awk . -To this end, -.I gawk -incorporates the following user visible -features which are not described in the \*(AK book, -but are part of the Bell Labs version of -.IR awk , -and are in the \*(PX standard. -.PP -The -.B \-v -option for assigning variables before program execution starts is new. -The book indicates that command line variable assignment happens when -.I awk -would otherwise open the argument as a file, which is after the -.B BEGIN -block is executed. However, in earlier implementations, when such an -assignment appeared before any file names, the assignment would happen -.I before -the -.B BEGIN -block was run. Applications came to depend on this \*(lqfeature.\*(rq -When -.I awk -was changed to match its documentation, this option was added to -accommodate applications that depended upon the old behavior. -(This feature was agreed upon by both the AT&T and \*(GN developers.) -.PP -The -.B \-W -option for implementation specific features is from the \*(PX standard. -.PP -When processing arguments, -.I gawk -uses the special option \*(lq\-\^\-\*(rq to signal the end of -arguments. -In compatibility mode, it will warn about, but otherwise ignore, -undefined options. -In normal operation, such arguments are passed on to the \*(AK program for -it to process. -.PP -The \*(AK book does not define the return value of -.BR srand() . -The \*(PX standard -has it return the seed it was using, to allow keeping track -of random number sequences. Therefore -.B srand() -in -.I gawk -also returns its current seed. -.PP -Other new features are: -The use of multiple -.B \-f -options (from MKS -.IR awk ); -the -.B ENVIRON -array; the -.BR \ea , -and -.BR \ev -escape sequences (done originally in -.I gawk -and fed back into AT&T's); the -.B tolower() -and -.B toupper() -built-in functions (from AT&T); and the \*(AN C conversion specifications in -.B printf -(done first in AT&T's version). -.SH GNU EXTENSIONS -.I Gawk -has a number of extensions to \*(PX -.IR awk . -They are described in this section. All the extensions described here -can be disabled by -invoking -.I gawk -with the -.B \-\^\-traditional -option. -.PP -The following features of -.I gawk -are not available in -\*(PX -.IR awk . -.RS -.TP \w'\(bu'u+1n -\(bu -The -.B \ex -escape sequence. -(Disabled with -.BR \-\^\-posix .) -.TP \w'\(bu'u+1n -\(bu -The -.B fflush() -function. -(Disabled with -.BR \-\^\-posix .) -.TP -\(bu -The -.BR systime(), -.BR strftime(), -and -.B gensub() -functions. -.TP -\(bu -The special file names available for I/O redirection are not recognized. -.TP -\(bu -The -.BR ARGIND , -.BR ERRNO , -and -.B RT -variables are not special. -.TP -\(bu -The -.B IGNORECASE -variable and its side-effects are not available. -.TP -\(bu -The -.B FIELDWIDTHS -variable and fixed-width field splitting. -.TP -\(bu -The use of -.B RS -as a regular expression. -.TP -\(bu -The ability to split out individual characters using the null string -as the value of -.BR FS , -and as the third argument to -.BR split() . -.TP -\(bu -No path search is performed for files named via the -.B \-f -option. Therefore the -.B AWKPATH -environment variable is not special. -.TP -\(bu -The use of -.B "nextfile" -to abandon processing of the current input file. -.TP -\(bu -The use of -.BI delete " array" -to delete the entire contents of an array. -.RE -.PP -The AWK book does not define the return value of the -.B close() -function. -.IR Gawk\^ 's -.B close() -returns the value from -.IR fclose (3), -or -.IR pclose (3), -when closing a file or pipe, respectively. -.PP -When -.I gawk -is invoked with the -.B \-\^\-traditional -option, -if the -.I fs -argument to the -.B \-F -option is \*(lqt\*(rq, then -.B FS -will be set to the tab character. -Note that typing -.B "gawk \-F\et \&.\|.\|." -simply causes the shell to quote the \*(lqt,\*(rq, and does not pass -\*(lq\et\*(rq to the -.B \-F -option. -Since this is a rather ugly special case, it is not the default behavior. -This behavior also does not occur if -.B \-\^\-posix -has been specified. -To really get a tab character as the field separator, it is best to use -quotes: -.BR "gawk \-F'\et' \&.\|.\|." . -.ig -.PP -If -.I gawk -was compiled for debugging, it will -accept the following additional options: -.TP -.PD 0 -.B \-Wparsedebug -.TP -.PD -.B \-\^\-parsedebug -Turn on -.IR yacc (1) -or -.IR bison (1) -debugging output during program parsing. -This option should only be of interest to the -.I gawk -maintainers, and may not even be compiled into -.IR gawk . -.. -.SH HISTORICAL FEATURES -There are two features of historical \*(AK implementations that -.I gawk -supports. -First, it is possible to call the -.B length() -built-in function not only with no argument, but even without parentheses! -Thus, -.RS -.PP -.ft B -a = length # Holy Algol 60, Batman! -.ft R -.RE -.PP -is the same as either of -.RS -.PP -.ft B -a = length() -.br -a = length($0) -.ft R -.RE -.PP -This feature is marked as \*(lqdeprecated\*(rq in the \*(PX standard, and -.I gawk -will issue a warning about its use if -.B \-\^\-lint -is specified on the command line. -.PP -The other feature is the use of either the -.B continue -or the -.B break -statements outside the body of a -.BR while , -.BR for , -or -.B do -loop. Traditional \*(AK implementations have treated such usage as -equivalent to the -.B next -statement. -.I Gawk -will support this usage if -.B \-\^\-traditional -has been specified. -.SH ENVIRONMENT VARIABLES -If -.B POSIXLY_CORRECT -exists in the environment, then -.I gawk -behaves exactly as if -.B \-\^\-posix -had been specified on the command line. -If -.B \-\^\-lint -has been specified, -.I gawk -will issue a warning message to this effect. -.PP -The -.B AWKPATH -environment variable can be used to provide a list of directories that -.I gawk -will search when looking for files named via the -.B \-f -and -.B \-\^\-file -options. -.SH BUGS -The -.B \-F -option is not necessary given the command line variable assignment feature; -it remains only for backwards compatibility. -.PP -If your system actually has support for -.B /dev/fd -and the associated -.BR /dev/stdin , -.BR /dev/stdout , -and -.B /dev/stderr -files, you may get different output from -.I gawk -than you would get on a system without those files. When -.I gawk -interprets these files internally, it synchronizes output to the standard -output with output to -.BR /dev/stdout , -while on a system with those files, the output is actually to different -open files. -Caveat Emptor. -.PP -Syntactically invalid single character programs tend to overflow -the parse stack, generating a rather unhelpful message. Such programs -are surprisingly difficult to diagnose in the completely general case, -and the effort to do so really is not worth it. -.SH VERSION INFORMATION -This man page documents -.IR gawk , -version 3.0.6. -.SH AUTHORS -The original version of \*(UX -.I awk -was designed and implemented by Alfred Aho, -Peter Weinberger, and Brian Kernighan of AT&T Bell Labs. Brian Kernighan -continues to maintain and enhance it. -.PP -Paul Rubin and Jay Fenlason, -of the Free Software Foundation, wrote -.IR gawk , -to be compatible with the original version of -.I awk -distributed in Seventh Edition \*(UX. -John Woods contributed a number of bug fixes. -David Trueman, with contributions -from Arnold Robbins, made -.I gawk -compatible with the new version of \*(UX -.IR awk . -Arnold Robbins is the current maintainer. -.PP -The initial DOS port was done by Conrad Kwok and Scott Garfinkle. -Scott Deifik is the current DOS maintainer. Pat Rankin did the -port to VMS, and Michal Jaegermann did the port to the Atari ST. -The port to OS/2 was done by Kai Uwe Rommel, with contributions and -help from Darrel Hankerson. Fred Fish supplied support for the Amiga. -.SH BUG REPORTS -If you find a bug in -.IR gawk , -please send electronic mail to -.BR bug-gawk@gnu.org . -Please include your operating system and its revision, the version of -.IR gawk , -what C compiler you used to compile it, and a test program -and data that are as small as possible for reproducing the problem. -.PP -Before sending a bug report, please do two things. First, verify that -you have the latest version of -.IR gawk . -Many bugs (usually subtle ones) are fixed at each release, and if -yours is out of date, the problem may already have been solved. -Second, please read this man page and the reference manual carefully to -be sure that what you think is a bug really is, instead of just a quirk -in the language. -.PP -Whatever you do, do -.B NOT -post a bug report in -.BR comp.lang.awk . -While the -.I gawk -developers occasionally read this newsgroup, posting bug reports there -is an unreliable way to report bugs. Instead, please use the electronic mail -addresses given above. -.SH ACKNOWLEDGEMENTS -Brian Kernighan of Bell Labs -provided valuable assistance during testing and debugging. -We thank him. -.SH COPYING PERMISSIONS -Copyright \(co 1996\-2000 Free Software Foundation, Inc. -.PP -Permission is granted to make and distribute verbatim copies of -this manual page provided the copyright notice and this permission -notice are preserved on all copies. -.ig -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 manual page). -.. -.PP -Permission is granted to copy and distribute modified versions of this -manual page 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. -.PP -Permission is granted to copy and distribute translations of this -manual page 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. diff --git a/contrib/awk/doc/igawk.1 b/contrib/awk/doc/igawk.1 deleted file mode 100644 index 08173ec182ffa..0000000000000 --- a/contrib/awk/doc/igawk.1 +++ /dev/null @@ -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 ( arnold@skeeve.com ). diff --git a/contrib/awk/doc/macros b/contrib/awk/doc/macros deleted file mode 100644 index bdfc5c8cbf691..0000000000000 --- a/contrib/awk/doc/macros +++ /dev/null @@ -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: bryang@chinet.chi.il.us (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 diff --git a/contrib/awk/doc/no.colors b/contrib/awk/doc/no.colors deleted file mode 100644 index 974f985b349db..0000000000000 --- a/contrib/awk/doc/no.colors +++ /dev/null @@ -1,31 +0,0 @@ -.\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org -.\" 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 diff --git a/contrib/awk/doc/setter.outline b/contrib/awk/doc/setter.outline deleted file mode 100644 index 67ade73a178a6..0000000000000 --- a/contrib/awk/doc/setter.outline +++ /dev/null @@ -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 - diff --git a/contrib/awk/doc/texinfo.tex b/contrib/awk/doc/texinfo.tex deleted file mode 100644 index ebf58d8e8345e..0000000000000 --- a/contrib/awk/doc/texinfo.tex +++ /dev/null @@ -1,5992 +0,0 @@ -% texinfo.tex -- TeX macros to handle Texinfo files. -% -% Load plain if necessary, i.e., if running under initex. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi -% -\def\texinfoversion{1999-10-01.07} -% -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 -% Free Software Foundation, Inc. -% -% This texinfo.tex 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, or (at -% your option) any later version. -% -% This texinfo.tex 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 texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. -% -% In other words, you are welcome to use, share and improve this program. -% You are forbidden to forbid anyone else to use, share and improve -% what you give them. Help stamp out software-hoarding! -% -% Please try the latest version of texinfo.tex before submitting bug -% reports; you can get the latest version from: -% ftp://ftp.gnu.org/gnu/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) -% ftp://texinfo.org/tex/texinfo.tex -% ftp://us.ctan.org/macros/texinfo/texinfo.tex -% (and all CTAN mirrors, finger ctan@us.ctan.org for a list). -% /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% The texinfo.tex in any given Texinfo distribution could well be out -% of date, so if that's what you're using, please check. -% Texinfo has a small home page at http://texinfo.org/. -% -% Send bug reports to bug-texinfo@gnu.org. Please include including a -% complete document in each bug report with which we can reproduce the -% problem. Patches are, of course, greatly appreciated. -% -% To process a Texinfo manual with TeX, it's most reliable to use the -% texi2dvi shell script that comes with the distribution. For a simple -% manual foo.texi, however, you can get away with this: -% tex foo.texi -% texindex foo.?? -% tex foo.texi -% tex foo.texi -% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. -% The extra runs of TeX get the cross-reference information correct. -% Sometimes one run after texindex suffices, and sometimes you need more -% than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. - -\message{Loading texinfo [version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}% - \catcode`+=\active \catcode`\_=\active} - -% Save some parts of plain tex whose names we will redefine. -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv=\equiv -\let\ptexexclam=\! -\let\ptexi=\i -\let\ptexlbrace=\{ -\let\ptexrbrace=\} -\let\ptexstar=\* -\let\ptext=\t - -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -\message{Basics,} -\chardef\other=12 - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi -\ifx\putwordof\undefined \gdef\putwordof{of}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi -\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi -% -\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi -\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi -\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi -\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi -\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi -\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi -\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi -\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi -\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi -\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi -\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi -\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi -% -\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi -\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi -\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi -\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi -\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi - -% Ignore a token. -% -\def\gobble#1{} - -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} -\hyphenation{white-space} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\fi - -% For @cropmarks command. -% Do @cropmarks to get crop marks. -% -\newif\ifcropmarks -\let\cropmarks = \cropmarkstrue -% -% Dimensions to add cropmarks at corners. -% Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\cornerlong \cornerlong=1pc -\newdimen\cornerthick \cornerthick=.3pt -\newdimen\topandbottommargin \topandbottommargin=.75in - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox -\newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi - % - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \escapechar = `\\ % use backslash in output files. - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - \shipout\vbox{% - \ifcropmarks \vbox to \outervsize\bgroup - \hsize = \outerhsize - \vskip-\topandbottommargin - \vtop to0pt{% - \line{\ewtop\hfil\ewtop}% - \nointerlineskip - \line{% - \vbox{\moveleft\cornerthick\nstop}% - \hfill - \vbox{\moveright\cornerthick\nstop}% - }% - \vss}% - \vskip\topandbottommargin - \line\bgroup - \hfil % center the page within the outer (page) hsize. - \ifodd\pageno\hskip\bindingoffset\fi - \vbox\bgroup - \fi - % - \unvbox\headlinebox - \pagebody{#1}% - \ifdim\ht\footlinebox > 0pt - % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) - % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip - \unvbox\footlinebox - \fi - % - \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi - % - \ifcropmarks - \egroup % end of \vbox\bgroup - \hfil\egroup % end of (centering) \line\bgroup - \vskip\topandbottommargin plus1fill minus1fill - \boxmaxdepth = \cornerthick - \vbox to0pt{\vss - \line{% - \vbox{\moveleft\cornerthick\nsbot}% - \hfill - \vbox{\moveright\cornerthick\nsbot}% - }% - \nointerlineskip - \line{\ewbot\hfil\ewbot}% - }% - \egroup % \vbox from first cropmarks clause - \fi - }% end of \shipout\vbox - }% end of group with \turnoffactive - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg#1{% - \let\next = #1% - \begingroup - \obeylines - \futurelet\temp\parseargx -} - -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi -} - -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% - }% -} - -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} - -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., -% @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. -% -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup -} - -% Change the active space to expand to nothing. -% -\begingroup - \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -% @end foo executes the definition of \Efoo. -% -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi - \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname - \fi -} - -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% - \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% -} - -% Define the control sequence \E#1 to give an unmatched @end error. -% -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% -} - - -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip -} - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } - -% @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -\def\group{\begingroup - \ifnum\catcode13=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - \endgroup % End the \group. - }% - % - \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -\def\need{\parsearg\needx} - -% Old definition--didn't work. -%\def\needx #1{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\def\needx#1{% - % Ensure vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % If the @need value is less than one line space, it's useless. - \dimen0 = #1\mil - \dimen2 = \ht\strutbox - \advance\dimen2 by \dp\strutbox - \ifdim\dimen0 > \dimen2 - % - % Do a \strut just to make the height of this box be normal, so the - % normal leading is inserted relative to the preceding line. - % And a page break here is fine. - \vtop to #1\mil{\strut\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak - \fi -} - -% @br forces paragraph break - -\let\br = \par - -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - - -% @page forces the start of a new page -% -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} - -% This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} - -%\hbox{{\rm#1}}\hfil\break}} - -% @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. - \def\thisfile{#1}% - \input\thisfile -\endgroup} - -\def\thisfile{} - -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} - -% @sp n outputs n lines of vertical space - -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\begingroup \catcode`\^^M=\other% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - -\let\c=\comment - -% @paragraphindent NCHARS -% We'll use ems for NCHARS, close enough. -% We cannot implement @paragraphindent asis, though. -% -\def\asisword{asis} % no translation, these are keywords -\def\noneword{none} -% -\def\paragraphindent{\parsearg\doparagraphindent} -\def\doparagraphindent#1{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \defaultparindent = 0pt - \else - \defaultparindent = #1em - \fi - \fi - \parindent = \defaultparindent -} - -% @exampleindent NCHARS -% We'll use ems for NCHARS like @paragraphindent. -% It seems @exampleindent asis isn't necessary, but -% I preserve it to make it similar to @paragraphindent. -\def\exampleindent{\parsearg\doexampleindent} -\def\doexampleindent#1{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \lispnarrowing = 0pt - \else - \lispnarrowing = #1em - \fi - \fi -} - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. -% -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. -% -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} - -% @refill is a no-op. -\let\refill=\relax - -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \iflinks - \readauxfile - \fi % \openindices needs to do some work in any case. - \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. - \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - - -\message{pdf,} -% adobe `portable' document format -\newcount\tempnum -\newcount\lnkcount -\newtoks\filename -\newcount\filenamelength -\newcount\pgn -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newbox\boxA -\newcount\countA -\newif\ifpdf -\newif\ifpdfmakepagedest - -\ifx\pdfoutput\undefined - \pdffalse - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax -\else - \pdftrue - \pdfoutput = 1 - \input pdfcolor - \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - \ifnum\pdftexversion < 14 - \pdfimage - \else - \pdfximage - \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi - {#1.pdf}% - \ifnum\pdftexversion < 14 \else - \pdfrefximage \pdflastximage - \fi} - \def\pdfmkdest#1{\pdfdest name{#1@} xyz} - \def\pdfmkpgn#1{#1@} - \let\linkcolor = \Cyan - \def\endlink{\Black\pdfendlink} - % Adding outlines to PDF; macros for calculating structure of outlines - % come from Petr Olsak - \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} - \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - \def\pdfmakeoutlines{{% - \openin 1 \jobname.toc - \ifeof 1\else\bgroup - \closein 1 - \indexnofonts - \def\tt{} - % thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % - \def\chapentry ##1##2##3{} - \def\unnumbchapentry ##1##2{} - \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \def\unnumbsubsubsecentry ##1##2{} - \input \jobname.toc - \def\chapentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\unnumbchapentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\secentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\unnumbsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\unnumbsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsubsecentry ##1##2##3##4##5##6{% - \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \def\unnumbsubsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \input \jobname.toc - \egroup\fi - }} - \def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax - \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \startlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - \linkcolor #1% - \advance\lnkcount by 1% - \endlink - \fi - \nextmakelinks - } - \def\picknum#1{\expandafter\pn#1} - \def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn - \else - \let\nextpn=\ppnn - \def\first{#1} - \fi - \nextpn - } - \def\ppn#1{\pgn=#1\gobble} - \def\ppnn{\pgn=\first} - \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi - \fi - \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} - \ifnum\pdftexversion < 14 - \let \startlink \pdfannotlink - \else - \let \startlink \pdfstartlink - \fi - \def\pdfurl#1{% - \begingroup - \normalturnoffactive\def\@{@}% - \leavevmode\Red - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - % #1 - \endgroup} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS| - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} - \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}} - \linkcolor #1\endlink} - \def\mkpgn#1{#1@} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % \ifx\pdfoutput - - -\message{fonts,} -% Font-change commands. - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. -\newfam\sffam -\def\sf{\fam=\sffam \tensf} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this one. -\def\ttsl{\tenttsl} - -% Use Computer Modern fonts at \magstephalf (11pt). -\newcount\mainmagstep -\mainmagstep=\magstephalf - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -\ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} -\else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\fi -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 -\setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} - -% Fonts for indices, footnotes, small examples (9pt). -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} -\font\smalli=cmmi9 -\font\smallsy=cmsy9 - -% Fonts for title page: -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} -\let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} -\font\titlei=cmmi12 scaled \magstep3 -\font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} - -% Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm - -% Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf -} - - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \resetmathfonts \setleading{11pt}} - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} -\setfont\shortcontsl\slshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\var=\smartslanted -\let\dfn=\smartslanted -\let\emph=\smartitalic -\let\cite=\smartslanted - -\def\b#1{{\bf #1}} -\let\strong=\b - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -\def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% - \null -} -\let\ttfont=\t -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \frenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in \code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ - \catcode`\-=\active - \catcode`\_=\active - % - \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder - \codex - } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} -\def\codex #1{\tclose{#1}\endgroup} - -%\let\exp=\tclose %Was temporary - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% - \def\arg{#1}% - \ifx\arg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code -\let\env=\code -\let\command=\code - -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% rms does not like angle brackets --karl, 17may97. -% So now @email is just like @uref, unless we are pdf. -% -%\def\email#1{\angleleft{\tt #1}\angleright} -\ifpdf - \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{\begingroup - \unsepspaces - \pdfurl{mailto:#1}% - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \endlink - \endgroup} -\else - \let\email=\uref -\fi - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} - -% @pounds{} is a sterling sign. -\def\pounds{{\it\$}} - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\newif\ifseenauthor -\newif\iffinishedtitlepage - -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue - -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \oldpage - \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi - % - \ifpdf \pdfmakepagedesttrue \fi - % - \HEADINGSon -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks\evenheadline % headline on even pages -\newtoks\oddheadline % headline on odd pages -\newtoks\evenfootline % footline on even pages -\newtoks\oddfootline % footline on odd pages - -% Now make Tex use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% - -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% - \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% - % - % Leave some space for the footline. Hopefully ok to assume - % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip -} - -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} -% -}% unbind the catcode of @. - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{ -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% Produces Day Month Year style of output. -\def\today{% - \number\day\space - \ifcase\month - \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr - \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug - \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec - \fi - \space\number\year} - -% @settitle line... specifies the title of the document, for headings. -% It generates no output of its own. -\def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} - - -\message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. - \noindent - % Do this with kerns and \unhbox so that if there is a footnote in - % the item text, it can migrate to the main vertical list and - % eventually be printed. - \nobreak\kern-\tableindent - \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 - \unhbox0 - \nobreak\kern\dimen0 - \endgroup - \itemxneedsnegativevskiptrue - \fi -} - -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} - -% @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % -} - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\def\itemize{\parsearg\itemizezzz} - -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} -} - -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a <number>. - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call itemizey, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -% Macros used to set up halign preamble: -% -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% - \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% - \setuptable -} - -\newcount\colcount -\def\setuptable#1{% - \def\firstarg{#1}% - \ifx\firstarg\xendsetuptable - \let\go = \relax - \else - \ifx\firstarg\xcolumnfractions - \global\setpercenttrue - \else - \ifsetpercent - \let\go\pickupwholefraction - \else - \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi - \fi - \ifx\go\pickupwholefraction - % Put the argument back for the \pickupwholefraction call, so - % we'll always have a period there to be parsed. - \def\go{\pickupwholefraction#1}% - \else - \let\go = \setuptable - \fi% - \fi - \go -} - -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} - -% @multitable ... @end multitable definitions: -% -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup - \vskip\parskip - \let\item\crcr - \tolerance=9500 - \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent - \overfullrule=0pt - \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% - % - % To parse everything between @multitable and @item: - \setuptable#1 \endsetuptable - % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % Maybe so, but it also creates really weird page breaks when the table - % breaks over pages. Wouldn't \vfil be better? Wait until the problem - % manifests itself, so it can be fixed for real --karl. - \global\colcount=0\relax}}% - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. - \halign\bgroup&\global\advance\colcount by 1\relax - \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{conditionals,} -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% - \let\chapter=\relax - \let\unnumbered=\relax - \let\top=\relax - \let\unnumberedsec=\relax - \let\unnumberedsection=\relax - \let\unnumberedsubsec=\relax - \let\unnumberedsubsection=\relax - \let\unnumberedsubsubsec=\relax - \let\unnumberedsubsubsection=\relax - \let\section=\relax - \let\subsec=\relax - \let\subsubsec=\relax - \let\subsection=\relax - \let\subsubsection=\relax - \let\appendix=\relax - \let\appendixsec=\relax - \let\appendixsection=\relax - \let\appendixsubsec=\relax - \let\appendixsubsection=\relax - \let\appendixsubsubsec=\relax - \let\appendixsubsubsection=\relax - \let\contents=\relax - \let\smallbook=\relax - \let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax - \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypeop = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax - \let\evenheading = \relax - \let\oddheading = \relax - \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax - \let\headings = \relax - \let\include = \relax - \let\lowersections = \relax - \let\down = \relax - \let\raisesections = \relax - \let\up = \relax - \let\set = \relax - \let\clear = \relax - \let\item = \relax -} - -% Ignore @ignore ... @end ignore. -% -\def\ignore{\doignore{ignore}} - -% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. -% -\def\ifinfo{\doignore{ifinfo}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} -\def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. -% -\def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 - % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 - % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 - % - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 - % - % And now expand that command. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{WARNING: for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi -} - -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. - % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% - % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. - % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont - \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont - \let\tensf=\nullfont - % Similarly for index fonts (mostly for their use in smallexample). - \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont - \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont - \let\smallsf=\nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% -} - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. -% -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup -} -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} - -% @value{foo} gets the text saved in variable foo. -{ - \catcode`\_ = \active - % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 - \indexbreaks \let_\normalunderscore - \valuexxx} -} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% - \else - \csname SET#1\endcsname - \fi -} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail - \else - \expandafter\ifsetsucceed - \fi -} -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed - \else - \expandafter\ifclearfail - \fi -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text -% following, through the first @end iftex (etc.). Make `@end iftex' -% (etc.) valid only after an @iftex. -% -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} - -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. -% -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} - -% @defininfoenclose. -\let\definfoenclose=\comment - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. -% -\def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi - \expandafter\xdef\csname#1index\endcsname{% % Define @#1index - \noexpand\doindex{#1}} -} - -% @defindex foo == \newindex{foo} - -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. - -\def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi - \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}} -} - -\def\defcodeindex{\parsearg\newcodeindex} - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -% The \closeout helps reduce unnecessary open files; the limit on the -% Acorn RISC OS is a mere 16 files. -\def\synindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\doindex{#2}}% -} - -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -\def\syncodeindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\docodeindex{#2}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -\def\indexdummies{% -\def\ { }% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\result{\realbackslash result}% -\def\equiv{\realbackslash equiv}% -\def\expansion{\realbackslash expansion}% -\def\print{\realbackslash print}% -\def\error{\realbackslash error}% -\def\point{\realbackslash point}% -\def\copyright{\realbackslash copyright}% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\def\acronym##1{\realbackslash acronym {##1}}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros -} - -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexdummytex{TeX} -\def\indexdummydots{...} - -\def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\url=\indexdummyfont -\let\uref=\indexdummyfont -\let\env=\indexdummyfont -\let\acronym=\indexdummyfont -\let\command=\indexdummyfont -\let\option=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% For \ifx comparisons. -\def\emptymacro{\empty} - -% Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% \empty if called from \doind, as we usually are. The main exception -% is with defuns, which call us directly. -% -\def\dosubind#1#2#3{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% - \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. - \toks0 = {#2}% - % - % If third (subentry) arg is present, add it to the index - % string. And include a space. - \ifx\thirdarg\emptymacro \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - % Set up the complete index entry, with both the sort key - % and the original text, including any font commands. We write - % three arguments to \entry to the .?? file, texindex reduces to - % two when writing the .??s sorted result. - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % If a skip is the last thing on the list now, preserve it - % by backing up by \lastskip, doing the \write, then inserting - % the skip again. Otherwise, the whatsit generated by the - % \write will make \lastskip zero. The result is that sequences - % like this: - % @end defun - % @tindex whatever - % @defun ... - % will have extra space inserted, because the \medbreak in the - % start of the @defun won't see the skip inserted by the @end of - % the previous defun. - % - % But don't do any of this if we're not in vertical mode. We - % don't want to do a \vskip and prematurely end a paragraph. - % - % Avoid page breaks due to these extra skips, too. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi - \fi - % - \temp % do the write - % - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 - }% -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \indexbreaks - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\rawbackslashxx}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \penalty -300 - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % - % Do our best not to break after the initial. - \nobreak -}} - -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. -% -\def\entry#1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing columns. - \vskip 0pt plus1pt - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - \ #2% The page number ends the paragraph. - \fi - \fi% - \par -\endgroup} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +-<1pt) - % as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \advance\vsize by -\ht\partialpage - \vsize = 2\vsize -} - -% The double-column output routine for all double-column pages except -% the last. -% -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@ = \vsize - \divide\dimen@ by 2 - % - % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 - \penalty\outputpenalty -} -\def\pagesofar{% - % Re-output the contents of the output page -- any previous material, - % followed by the two boxes we just split, in box0 and box2. - \unvbox\partialpage - % - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% -} -\def\enddoublecolumns{% - \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. - \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not - % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) - \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize -} -\def\balancecolumns{% - % Called at the end of the double column material. - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - % - \pagesofar -} -\catcode`\@ = \other - - -\message{sectioning,} -% Chapters, sections, etc. - -\newcount\chapno -\newcount\secno \secno=0 -\newcount\subsecno \subsecno=0 -\newcount\subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount\appendixno \appendixno = `\@ -% \def\appendixletter{\char\the\appendixno} -% We do the following for the sake of pdftex, which needs the actual -% letter in the expansion, not just typeset. -\def\appendixletter{% - \ifnum\appendixno=`A A% - \else\ifnum\appendixno=`B B% - \else\ifnum\appendixno=`C C% - \else\ifnum\appendixno=`D D% - \else\ifnum\appendixno=`E E% - \else\ifnum\appendixno=`F F% - \else\ifnum\appendixno=`G G% - \else\ifnum\appendixno=`H H% - \else\ifnum\appendixno=`I I% - \else\ifnum\appendixno=`J J% - \else\ifnum\appendixno=`K K% - \else\ifnum\appendixno=`L L% - \else\ifnum\appendixno=`M M% - \else\ifnum\appendixno=`N N% - \else\ifnum\appendixno=`O O% - \else\ifnum\appendixno=`P P% - \else\ifnum\appendixno=`Q Q% - \else\ifnum\appendixno=`R R% - \else\ifnum\appendixno=`S S% - \else\ifnum\appendixno=`T T% - \else\ifnum\appendixno=`U U% - \else\ifnum\appendixno=`V V% - \else\ifnum\appendixno=`W W% - \else\ifnum\appendixno=`X X% - \else\ifnum\appendixno=`Y Y% - \else\ifnum\appendixno=`Z Z% - % The \the is necessary, despite appearances, because \appendixletter is - % expanded while writing the .toc file. \char\appendixno is not - % expandable, thus it is written literally, thus all appendixes come out - % with the same letter (or @) in the toc without it. - \else\char\the\appendixno - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -\def\thischapter{} -\def\thissection{} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} - \else - \numberedsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} - \else - \appendixsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} - \else - \unnumberedsubsubseczzz{#2} - \fi -\fi -} - -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\putwordAppendix{} \appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec -} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} - -% @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the<toks register> to achieve this: TeX expands \the<toks> only once, -% simply yielding the contents of <toks register>. (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec -} - -% Sections. -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% Subsections. -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% Subsubsections. -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -% @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{ -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% - \pchapsepmacro - {% - \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} - -\CHAPFplain % The default - -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak -} - -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} - -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak -} - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} - - -% Section titles. -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} - -% Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} - -% Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} - - -% Print any size section title. -% -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% - {% - % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm - % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% - % - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% - }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak -} - - -\message{toc,} -% Table of contents. -\newwrite\tocfile - -% Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. -% -% We open the .toc file here instead of at @setfilename or any other -% given time so that @contents can be put in the document anywhere. -% -\newif\iftocfileopened -\def\writetocentry#1{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - \iflinks \write\tocfile{#1{\folio}}\fi -} - -\newskip\contentsrightmargin \contentsrightmargin=1in -\newcount\savepageno -\newcount\lastnegativepageno \lastnegativepageno = -1 - -% Finish up the main text and prepare to read what we've written -% to \tocfile. -% -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund <tege@matematik.su.se> - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi -} - - -% Normal (long) toc. -\def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \pdfmakeoutlines - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno -} - -% And just the chapters. -\def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\chapentry = \shortchapentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno -} -\let\shortcontents = \summarycontents - -\ifpdf - \pdfcatalog{/PageMode /UseOutlines}% -\fi - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapter-level things, for both the long and short contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% -} - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -% -\newdimen\shortappendixwidth -% -\def\shortchaplabel#1{% - % Compute width of word "Appendix", may change with language. - \setbox0 = \hbox{\shortcontrm \putwordAppendix}% - \shortappendixwidth = \wd0 - % - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% -} - -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} - -% Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} - -% Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} - -% And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} - -% This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno\bgroup#2\egroup}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, so characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\endgroup} - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts - - -\message{environments,} -% @foo ... @end foo. - -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% Adapted from the TeXbook's \boxit. -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - -\global\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{ - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} - -% The @error{} command. -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\def\tex{\begingroup - \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 - \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie - \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \escapechar=`\\ - % - \let\b=\ptexb - \let\bullet=\ptexbullet - \let\c=\ptexc - \let\,=\ptexcomma - \let\.=\ptexdot - \let\dots=\ptexdots - \let\equiv=\ptexequiv - \let\!=\ptexexclam - \let\i=\ptexi - \let\{=\ptexlbrace - \let\+=\tabalign - \let\}=\ptexrbrace - \let\*=\ptexstar - \let\t=\ptext - % - \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% - \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% - \def\@{@}% -\let\Etex=\endgroup} - -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip -% -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. -\let\nonarrowing=\relax - -% @cartouche ... @end cartouche: draw rectangle w/rounded corners around -% environment contents. -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\long\def\cartouche{% -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip -\def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \inENV % This group ends at the end of the body - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax - \fi -} - -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup} - -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup - \nonfillstart - \let\Elisp = \nonfillfinish - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} - -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. -% -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. -% Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \smallfonts - \lisp -} - -% @display: same as @lisp except keep current font. -% -\def\display{\begingroup - \nonfillstart - \let\Edisplay = \nonfillfinish - \gobble -} - -% @smalldisplay (when @smallbook): @display plus smaller fonts. -% -\def\smalldisplayx{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \smallfonts \rm - \display -} - -% @format: same as @display except don't narrow margins. -% -\def\format{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eformat = \nonfillfinish - \gobble -} - -% @smallformat (when @smallbook): @format plus smaller fonts. -% -\def\smallformatx{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \smallfonts \rm - \format -} - -% @flushleft (same as @format). -% -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} - -% @flushright. -% -\def\flushright{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eflushright = \nonfillfinish - \advance\leftskip by 0pt plus 1fill - \gobble -} - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. -% -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace - \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \let\nonarrowing = \relax - \fi -} - - -\message{defuns,} -% @defun etc. - -% Allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt -\newskip\deflastargmargin \deflastargmargin=18pt - -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. -\def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 -} -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\let\ampnr = \& -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} - -% Active &'s sneak into the index arguments, so make sure it's defined. -{ - \catcode`& = 13 - \global\let& = \ampnr -} - -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} - -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -% Used for @deftypemethod and @deftypeivar. -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by a space, is the class name. -% #5 is the method's return type. -% -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} - -% Used for @deftypeop. The change from \deftypemethparsebody is an -% extra argument at the beginning which is the `category', instead of it -% being the hardwired string `Method' or `Instance Variable'. We have -% to account for this both in the \...x definition and in parsing the -% input at hand. Thus also need a control sequence (passed as #5) for -% the \E... definition to assign the category name to. -% -\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 ##3 {% - \def#4{##1}% - \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines -} - -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{#3{#4}}% -} - -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{\parsetpheaderline{#3{#4}}}\empty -} - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% - -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} - -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. - -% Define @defun. - -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up - -\def\defunargs#1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Set the font temporarily and use \font in case \setfont made \tensl a macro. -{\tensl\hyphenchar\font=0}% -#1% -{\tensl\hyphenchar\font=45}% -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDeffunc}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefun int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} - -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% -\deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$$$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefmac}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefspec}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defop CATEGORY CLASS OPERATION ARG... -% -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} -% -\def\defopheader#1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % -} - -% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... -% -\def\deftypeop #1 {\def\deftypeopcategory{#1}% - \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader - \deftypeopcategory} -% -% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. -\def\deftypeopheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3} - {\deftypeopcategory\ \putwordon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypemethod CLASS TYPE METHOD ARG... -% -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} -% -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypeivar CLASS TYPE VARNAME -% -\def\deftypeivar{% - \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} -% -% #1 is the class name, #2 the data type, #3 the variable name. -\def\deftypeivarheader#1#2#3{% - \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index - \begingroup - \defname{#3}{\putwordInstanceVariableof\ \code{#1}}% - \defvarargs{#3}% - \endgroup -} - -% @defmethod == @defop Method -% -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} -% -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} - -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % -} - -% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME -% -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} -% -\def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index - \begingroup - \defname{#2}{\putwordInstanceVariableof\ #1}% - \defvarargs{#3}% - \endgroup -} - -% @defvar -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefvar}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefopt}% -\defvarargs {#2}\endgroup % -} - -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% These definitions are used if you use @defunx (etc.) -% anywhere other than immediately after a @defun or @defunx. -% -\def\defcvx#1 {\errmessage{@defcvx in invalid context}} -\def\deffnx#1 {\errmessage{@deffnx in invalid context}} -\def\defivarx#1 {\errmessage{@defivarx in invalid context}} -\def\defmacx#1 {\errmessage{@defmacx in invalid context}} -\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\defopx#1 {\errmessage{@defopx in invalid context}} -\def\defspecx#1 {\errmessage{@defspecx in invalid context}} -\def\deftpx#1 {\errmessage{@deftpx in invalid context}} -\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} -\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} -\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} -\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} -\def\defunx#1 {\errmessage{@defunx in invalid context}} -\def\defvarx#1 {\errmessage{@defvarx in invalid context}} -\def\defvrx#1 {\errmessage{@defvrx in invalid context}} - - -\message{macros,} -% @macro. - -% To do this right we need a feature of e-TeX, \scantokens, -% which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scanmacro#1{% - \begingroup \newlinechar`\^^M - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ - % Append \endinput to make sure that TeX does not see the ending newline. - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -% Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ -\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} -\fi - -\newcount\paramno % Count of parameters -\newtoks\macname % Macro name -\newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... - -% Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. -\def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} - -% Trim leading and trailing spaces off a string. -% Concepts from aro-bend problem 15 (see CTAN). -{\catcode`\@=11 -\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} -\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} -\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} -\def\unbrace#1{#1} -\unbrace{\gdef\trim@@@ #1 } #2@{#1} -} - -% Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% -\gdef\eatcr #1{\eatcra #1Q^^MQ}% -\gdef\eatcra#1^^MQ{\eatcrb#1Q}% -\gdef\eatcrb#1Q#2Q{#1}% -} - -% Macro bodies are absorbed as an argument in a context where -% all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro -% body, and then making it the \newlinechar in \scanmacro. - -\def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 - \usembodybackslash} - -\def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} - -% \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N -% where N is the macro parameter number. -% We define \csname macarg.\endcsname to be \realbackslash, so -% \\ in macro replacement text gets you a backslash. - -{\catcode`@=0 @catcode`@\=@active - @gdef@usembodybackslash{@let\=@mbodybackslash} - @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} -} -\expandafter\def\csname macarg.\endcsname{\realbackslash} - -\def\macro{\recursivefalse\parsearg\macroxxx} -\def\rmacro{\recursivetrue\parsearg\macroxxx} - -\def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist - \ifx\argl\empty % no arguments - \paramno=0% - \else - \expandafter\parsemargdef \argl;% - \fi - \if1\csname ismacro.\the\macname\endcsname - \message{Warning: redefining \the\macname}% - \else - \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{The name \the\macname\space is reserved}\fi - \global\cslet{macsave.\the\macname}{\the\macname}% - \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% - \fi - \begingroup \macrobodyctxt - \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody - \fi} - -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% - \if1\csname ismacro.#1\endcsname - \global\cslet{#1}{macsave.#1}% - \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist - \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist - \endgroup - \else - \errmessage{Macro #1 not defined}% - \fi -} - -% This makes use of the obscure feature that if the last token of a -% <parameter list> is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -\def\getargs#1{\getargsxxx#1{}} -\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} -\def\getmacargs#1{\def\argl{#1}} - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. -% That gets used by \mbodybackslash (above). - -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} -\def\parsemargdefxxx#1,{% - \if#1;\let\next=\relax - \else \let\next=\parsemargdefxxx - \advance\paramno by 1% - \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% - \edef\paramlist{\paramlist\hash\the\paramno,}% - \fi\next} - -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) - -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. -% Much magic with \expandafter here. -% \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. -\def\defmacro{% - \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \fi - \else - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \fi - \fi} - -\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} -\def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg - \fi \next} - -% We mant to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} - - -% @alias. -% We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. -\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} -\def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{\ignoreactivespaces -\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% - \expandafter\noexpand\csname#2\endcsname}% -\expandafter\endgroup\next} - - -\message{cross references,} -% @xref etc. - -\newwrite\auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is relatively simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} -\let\nwnode=\node -\let\lastnode=\relax - -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax - \fi -} -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax - \fi -} - - -% @anchor{NAME} -- define xref target at arbitrary point. -% -\newcount\savesfregister -\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. -% -\def\setref#1#2{{% - \indexdummies - \pdfmkdest{#1}% - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2}% -}} - -% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is -% the node name, #2 the name of the Info cross-reference, #3 the printed -% node name, #4 the name of the Info file, #5 the name of the printed -% manual. All but the node name can be omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \unsepspaces - \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifpdf - \leavevmode - \getfilename{#4}% - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1@}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{#1@}% - \fi - \linkcolor - \fi - % - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\normalturnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % [mynode], - [\printednodename],\space - % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi - \endlink -\endgroup} - -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) -\def\dosetq#1#2{% - {\let\folio=0% - \normalturnoffactive - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi - }% -} - -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ytitle{\thissection} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. - -\def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax - % If not defined, say something at least. - \angleleft un\-de\-fined\angleright - \iflinks - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \fi - \else - % It's defined, so just use it. - \csname X#1\endcsname - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. -% -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname -} - -% Read the last existing aux file, if any. No error if none exists. -\def\readauxfile{\begingroup - \catcode`\^^@=\other - \catcode`\^^A=\other - \catcode`\^^B=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\^^K=\other - \catcode`\^^L=\other - \catcode`\^^N=\other - \catcode`\^^P=\other - \catcode`\^^Q=\other - \catcode`\^^R=\other - \catcode`\^^S=\other - \catcode`\^^T=\other - \catcode`\^^U=\other - \catcode`\^^V=\other - \catcode`\^^W=\other - \catcode`\^^X=\other - \catcode`\^^Z=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % Make the characters 128-255 be printing characters - {% - \count 1=128 - \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi - }% - }% - % The aux file uses ' as the escape (for now). - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other - % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux -\endgroup} - - -% Footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only. -\let\footnotestyle=\comment - -\let\ptexfootnote=\footnote - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \footnotezzz -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\long\gdef\footnotezzz{\insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - \smallfonts \rm - % - % Hang the footnote text off the number. - \hang - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\par\egroup} - -}%end \catcode `\@=11 - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - -% @image. We use the macros from epsf.tex to support this. -% If epsf.tex is not installed and @image is used, we complain. -% -% Check for and read epsf.tex up front. If we read it only at @image -% time, we might be inside a group, and then its definitions would get -% undone and the next image would fail. -\openin 1 = epsf.tex -\ifeof 1 \else - \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). - \def\epsfannounce{\toks0 = }% - \input epsf.tex -\fi -% -% We will only complain once about lack of epsf.tex. -\newif\ifwarnednoepsf -\newhelp\noepsfhelp{epsf.tex must be installed for images to - work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} -% -\def\image#1{% - \ifx\epsfbox\undefined - \ifwarnednoepsf \else - \errhelp = \noepsfhelp - \errmessage{epsf.tex not found, images will be ignored}% - \global\warnednoepsftrue - \fi - \else - \imagexxx #1,,,\finish - \fi -} -% -% Arguments to @image: -% #1 is (mandatory) image filename; we tack on .eps extension. -% #2 is (optional) width, #3 is (optional) height. -% #4 is just the usual extra ignored arg for parsing this stuff. -\def\imagexxx#1,#2,#3,#4\finish{% - \ifpdf - \centerline{\dopdfimage{#1}{#2}{#3}}% - \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \begingroup - \catcode`\^^M = 5 % in case we're inside an example - % If the image is by itself, center it. - \ifvmode - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \centerline{\epsfbox{#1.eps}}% - \bigbreak - \else - % In the middle of a paragraph, no extra space. - \epsfbox{#1.eps}% - \fi - \endgroup - \fi -} - - -\message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\def\documentlanguage{\parsearg\dodocumentlanguage} -\def\dodocumentlanguage#1{% - \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \let\temp = \relax - \else - \def\temp{\input txi-#1.tex }% - \fi - \temp - \endgroup -} -\newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% -\newdimen\defaultparindent \defaultparindent = 15pt - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness = 10000 - -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. We call this whenever the paper size is set. -% -\def\setemergencystretch{% - \ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% - \else - \emergencystretch = .15\hsize - \fi -} - -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can -% set \parskip and call \setleading for \baselineskip. -% -\def\internalpagesizes#1#2#3#4#5#6{% - \voffset = #3\relax - \topskip = #6\relax - \splittopskip = \topskip - % - \vsize = #1\relax - \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize - % - \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in - \pagewidth = \hsize - % - \normaloffset = #4\relax - \bindingoffset = #5\relax - % - \parindent = \defaultparindent - \setemergencystretch -} - -% @letterpaper (the default). -\def\letterpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% - % - % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% -}} - -% Use @smallbook to reset parameters for 7x9.5 (or so) format. -\def\smallbook{{\globaldefs = 1 - \parskip = 2pt plus 1pt - \setleading{12pt}% - % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% - % - \lispnarrowing = 0.3in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \deftypemargin = 0pt - \defbodyindent = .5cm - % - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx -}} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{{\globaldefs = 1 - \setleading{12pt}% - \parskip = 3pt plus 2pt minus 1pt - % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% - % - \tolerance = 700 - \hfuzz = 1pt -}} - -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. -\def\afourlatex{{\globaldefs = 1 - \setleading{13.6pt}% - % - \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% - % - \globaldefs = 0 -}} - -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% - \afourpaper - \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% - % - \globaldefs = 0 -} - -% @pagesizes TEXTHEIGHT[,TEXTWIDTH] -% Perhaps we should allow setting the margins, \topskip, \parskip, -% and/or leading, also. Or perhaps we should compute them somehow. -% -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} -\def\pagesizesyyy#1,#2,#3\finish{{% - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi - \globaldefs = 1 - % - \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% - % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% -}} - -% Set default to letter. -% -\letterpaper - - -\message{and turning on texinfo input format.} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$} - -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt\char34}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} - -\catcode`\|=\active -\def|{{\tt\char124}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} - -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -\catcode`\@=0 - -% \rawbackslashxx output one backslash character in current font -\global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} - -% \rawbackslash redefines \ as input to do \rawbackslashxx. -{\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} - -% \catcode 17=0 % Define control-q -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active - @catcode`@_=@active -} - -% Say @foo, not \foo, in error messages. -@escapechar = `@@ - -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - -@c Set initial fonts. -@textfonts -@rm - - -@c Local variables: -@c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" -@c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%02H" -@c time-stamp-end: "}" -@c End: diff --git a/contrib/awk/install-sh b/contrib/awk/install-sh deleted file mode 100755 index ab74c882e9233..0000000000000 --- a/contrib/awk/install-sh +++ /dev/null @@ -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 diff --git a/contrib/awk/mkinstalldirs b/contrib/awk/mkinstalldirs deleted file mode 100755 index 0801ec2c96612..0000000000000 --- a/contrib/awk/mkinstalldirs +++ /dev/null @@ -1,32 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# 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 diff --git a/contrib/awk/protos.h b/contrib/awk/protos.h deleted file mode 100644 index 3ed55c5e96026..0000000000000 --- a/contrib/awk/protos.h +++ /dev/null @@ -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 diff --git a/contrib/awk/regex.c b/contrib/awk/regex.c deleted file mode 100644 index 8c7f4fe2c8c3b..0000000000000 --- a/contrib/awk/regex.c +++ /dev/null @@ -1,5744 +0,0 @@ -/* Extended regular expression matching and search library, - version 0.12. - (Implements POSIX draft P1003.2/D11.2, except for some of the - internationalization features.) - - Copyright (C) 1993,1994,1995,1996,1997,1999,2000 Free Software Foundation, Inc. - - This program 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, or (at your option) - any later version. - - This program 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. */ - -/* AIX requires this to be the first thing in the file. */ -#if defined (_AIX) && !defined (REGEX_MALLOC) - #pragma alloca -#endif - -#undef _GNU_SOURCE -#define _GNU_SOURCE - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#if defined(STDC_HEADERS) && !defined(emacs) -#include <stddef.h> -#else -/* We need this for `regex.h', and perhaps for the Emacs include files. */ -#include <sys/types.h> -#endif - -/* For platform which support the ISO C amendement 1 functionality we - support user defined character classes. */ -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) -# include <wctype.h> -# include <wchar.h> -#endif - -/* This is for other GNU distributions with internationalized messages. */ -#if HAVE_LIBINTL_H || defined (_LIBC) -# include <libintl.h> -#else -# define gettext(msgid) (msgid) -#endif - -#ifndef gettext_noop -/* This define is so xgettext can find the internationalizable - strings. */ -#define gettext_noop(String) String -#endif - -/* The `emacs' switch turns on certain matching commands - that make sense only in Emacs. */ -#ifdef emacs - -#include "lisp.h" -#include "buffer.h" -#include "syntax.h" - -#else /* not emacs */ - -/* If we are not linking with Emacs proper, - we can't use the relocating allocator - even if config.h says that we can. */ -#undef REL_ALLOC - -#if defined (STDC_HEADERS) || defined (_LIBC) -#include <stdlib.h> -#else -char *malloc (); -char *realloc (); -#endif - -/* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. - If nothing else has been done, use the method below. */ -#ifdef INHIBIT_STRING_HEADER -#if !(defined (HAVE_BZERO) && defined (HAVE_BCOPY)) -#if !defined (bzero) && !defined (bcopy) -#undef INHIBIT_STRING_HEADER -#endif -#endif -#endif - -/* This is the normal way of making sure we have a bcopy and a bzero. - This is used in most programs--a few other programs avoid this - by defining INHIBIT_STRING_HEADER. */ -#ifndef INHIBIT_STRING_HEADER -#if defined (HAVE_STRING_H) || defined (STDC_HEADERS) || defined (_LIBC) -#include <string.h> -#ifndef bcmp -#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) -#endif -#ifndef bcopy -#define bcopy(s, d, n) memcpy ((d), (s), (n)) -#endif -#ifndef bzero -#define bzero(s, n) memset ((s), 0, (n)) -#endif -#else -#include <strings.h> -#endif -#endif - -/* Define the syntax stuff for \<, \>, etc. */ - -/* This must be nonzero for the wordchar and notwordchar pattern - commands in re_match_2. */ -#ifndef Sword -#define Sword 1 -#endif - -#ifdef SWITCH_ENUM_BUG -#define SWITCH_ENUM_CAST(x) ((int)(x)) -#else -#define SWITCH_ENUM_CAST(x) (x) -#endif - -#endif /* not emacs */ - -/* Get the interface, including the syntax bits. */ -#include "regex.h" - -/* isalpha etc. are used for the character classes. */ -#include <ctype.h> - -/* Jim Meyering writes: - - "... Some ctype macros are valid only for character codes that - isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when - using /bin/cc or gcc but without giving an ansi option). So, all - ctype uses should be through macros like ISPRINT... If - STDC_HEADERS is defined, then autoconf has verified that the ctype - macros don't need to be guarded with references to isascii. ... - Defining isascii to 1 should let any compiler worth its salt - eliminate the && through constant folding." */ - -#if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII)) -#define ISASCII(c) 1 -#else -#define ISASCII(c) isascii(c) -#endif - -#ifdef isblank -#define ISBLANK(c) (ISASCII (c) && isblank (c)) -#else -#define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -#ifdef isgraph -#define ISGRAPH(c) (ISASCII (c) && isgraph (c)) -#else -#define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) -#endif - -#define ISPRINT(c) (ISASCII (c) && isprint (c)) -#define ISDIGIT(c) (ISASCII (c) && isdigit (c)) -#define ISALNUM(c) (ISASCII (c) && isalnum (c)) -#define ISALPHA(c) (ISASCII (c) && isalpha (c)) -#define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) -#define ISLOWER(c) (ISASCII (c) && islower (c)) -#define ISPUNCT(c) (ISASCII (c) && ispunct (c)) -#define ISSPACE(c) (ISASCII (c) && isspace (c)) -#define ISUPPER(c) (ISASCII (c) && isupper (c)) -#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) - -#ifndef NULL -#define NULL (void *)0 -#endif - -/* We remove any previous definition of `SIGN_EXTEND_CHAR', - since ours (we hope) works properly with all combinations of - machines, compilers, `char' and `unsigned char' argument types. - (Per Bothner suggested the basic approach.) */ -#undef SIGN_EXTEND_CHAR -#if __STDC__ -#define SIGN_EXTEND_CHAR(c) ((signed char) (c)) -#else /* not __STDC__ */ -/* As in Harbison and Steele. */ -#define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) -#endif - -#ifndef emacs -/* How many characters in the character set. */ -#define CHAR_SET_SIZE 256 - -#ifdef SYNTAX_TABLE - -extern char *re_syntax_table; - -#else /* not SYNTAX_TABLE */ - -static char re_syntax_table[CHAR_SET_SIZE]; - -static void -init_syntax_once () -{ - register int c; - static int done = 0; - - if (done) - return; - bzero (re_syntax_table, sizeof re_syntax_table); - - for (c = 0; c < CHAR_SET_SIZE; c++) - if (ISALNUM (c)) - re_syntax_table[c] = Sword; - - re_syntax_table['_'] = Sword; - - done = 1; -} - -#endif /* not SYNTAX_TABLE */ - -#define SYNTAX(c) re_syntax_table[(unsigned char) (c)] - -#endif /* emacs */ - -/* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we - use `alloca' instead of `malloc'. This is because using malloc in - re_search* or re_match* could cause memory leaks when C-g is used in - Emacs; also, malloc is slower and causes storage fragmentation. On - the other hand, malloc is more portable, and easier to debug. - - Because we sometimes use alloca, some routines have to be macros, - not functions -- `alloca'-allocated space disappears at the end of the - function it is called in. */ - -#ifdef REGEX_MALLOC - -#define REGEX_ALLOCATE malloc -#define REGEX_REALLOCATE(source, osize, nsize) realloc (source, nsize) -#define REGEX_FREE free - -#else /* not REGEX_MALLOC */ - -/* Emacs already defines alloca, sometimes. */ -#ifndef alloca - -/* Make alloca work the best possible way. */ -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not __GNUC__ */ -#if HAVE_ALLOCA_H -#include <alloca.h> -#else /* not __GNUC__ or HAVE_ALLOCA_H */ -#if 0 /* It is a bad idea to declare alloca. We always cast the result. */ -#ifndef _AIX /* Already did AIX, up at the top. */ -char *alloca (); -#endif /* not _AIX */ -#endif -#endif /* not HAVE_ALLOCA_H */ -#endif /* not __GNUC__ */ - -#endif /* not alloca */ - -#define REGEX_ALLOCATE alloca - -/* Assumes a `char *destination' variable. */ -#define REGEX_REALLOCATE(source, osize, nsize) \ - (destination = (char *) alloca (nsize), \ - bcopy (source, destination, osize), \ - destination) - -/* No need to do anything to free, after alloca. */ -#define REGEX_FREE(arg) ((void)0) /* Do nothing! But inhibit gcc warning. */ - -#endif /* not REGEX_MALLOC */ - -/* Define how to allocate the failure stack. */ - -#if defined (REL_ALLOC) && defined (REGEX_MALLOC) - -#define REGEX_ALLOCATE_STACK(size) \ - r_alloc (&failure_stack_ptr, (size)) -#define REGEX_REALLOCATE_STACK(source, osize, nsize) \ - r_re_alloc (&failure_stack_ptr, (nsize)) -#define REGEX_FREE_STACK(ptr) \ - r_alloc_free (&failure_stack_ptr) - -#else /* not using relocating allocator */ - -#ifdef REGEX_MALLOC - -#define REGEX_ALLOCATE_STACK malloc -#define REGEX_REALLOCATE_STACK(source, osize, nsize) realloc (source, nsize) -#define REGEX_FREE_STACK free - -#else /* not REGEX_MALLOC */ - -#define REGEX_ALLOCATE_STACK alloca - -#define REGEX_REALLOCATE_STACK(source, osize, nsize) \ - REGEX_REALLOCATE (source, osize, nsize) -/* No need to explicitly free anything. */ -#define REGEX_FREE_STACK(arg) - -#endif /* not REGEX_MALLOC */ -#endif /* not using relocating allocator */ - - -/* True if `size1' is non-NULL and PTR is pointing anywhere inside - `string1' or just past its end. This works if PTR is NULL, which is - a good thing. */ -#define FIRST_STRING_P(ptr) \ - (size1 && string1 <= (ptr) && (ptr) <= string1 + size1) - -/* (Re)Allocate N items of type T using malloc, or fail. */ -#define TALLOC(n, t) ((t *) malloc ((n) * sizeof (t))) -#define RETALLOC(addr, n, t) ((addr) = (t *) realloc (addr, (n) * sizeof (t))) -#define RETALLOC_IF(addr, n, t) \ - if (addr) RETALLOC((addr), (n), t); else (addr) = TALLOC ((n), t) -#define REGEX_TALLOC(n, t) ((t *) REGEX_ALLOCATE ((n) * sizeof (t))) - -#define BYTEWIDTH 8 /* In bits. */ - -#define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) - -#undef MAX -#undef MIN -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - -typedef char boolean; -#define false 0 -#define true 1 - -static int re_match_2_internal (); - -/* These are the command codes that appear in compiled regular - expressions. Some opcodes are followed by argument bytes. A - command code can specify any interpretation whatsoever for its - arguments. Zero bytes may appear in the compiled regular expression. */ - -typedef enum -{ - no_op = 0, - - /* Succeed right away--no more backtracking. */ - succeed, - - /* Followed by one byte giving n, then by n literal bytes. */ - exactn, - - /* Matches any (more or less) character. */ - anychar, - - /* Matches any one char belonging to specified set. First - following byte is number of bitmap bytes. Then come bytes - for a bitmap saying which chars are in. Bits in each byte - are ordered low-bit-first. A character is in the set if its - bit is 1. A character too large to have a bit in the map is - automatically not in the set. */ - charset, - - /* Same parameters as charset, but match any character that is - not one of those specified. */ - charset_not, - - /* Start remembering the text that is matched, for storing in a - register. Followed by one byte with the register number, in - the range 0 to one less than the pattern buffer's re_nsub - field. Then followed by one byte with the number of groups - inner to this one. (This last has to be part of the - start_memory only because we need it in the on_failure_jump - of re_match_2.) */ - start_memory, - - /* Stop remembering the text that is matched and store it in a - memory register. Followed by one byte with the register - number, in the range 0 to one less than `re_nsub' in the - pattern buffer, and one byte with the number of inner groups, - just like `start_memory'. (We need the number of inner - groups here because we don't have any easy way of finding the - corresponding start_memory when we're at a stop_memory.) */ - stop_memory, - - /* Match a duplicate of something remembered. Followed by one - byte containing the register number. */ - duplicate, - - /* Fail unless at beginning of line. */ - begline, - - /* Fail unless at end of line. */ - endline, - - /* Succeeds if at beginning of buffer (if emacs) or at beginning - of string to be matched (if not). */ - begbuf, - - /* Analogously, for end of buffer/string. */ - endbuf, - - /* Followed by two byte relative address to which to jump. */ - jump, - - /* Same as jump, but marks the end of an alternative. */ - jump_past_alt, - - /* Followed by two-byte relative address of place to resume at - in case of failure. */ - on_failure_jump, - - /* Like on_failure_jump, but pushes a placeholder instead of the - current string position when executed. */ - on_failure_keep_string_jump, - - /* Throw away latest failure point and then jump to following - two-byte relative address. */ - pop_failure_jump, - - /* Change to pop_failure_jump if know won't have to backtrack to - match; otherwise change to jump. This is used to jump - back to the beginning of a repeat. If what follows this jump - clearly won't match what the repeat does, such that we can be - sure that there is no use backtracking out of repetitions - already matched, then we change it to a pop_failure_jump. - Followed by two-byte address. */ - maybe_pop_jump, - - /* Jump to following two-byte address, and push a dummy failure - point. This failure point will be thrown away if an attempt - is made to use it for a failure. A `+' construct makes this - before the first repeat. Also used as an intermediary kind - of jump when compiling an alternative. */ - dummy_failure_jump, - - /* Push a dummy failure point and continue. Used at the end of - alternatives. */ - push_dummy_failure, - - /* Followed by two-byte relative address and two-byte number n. - After matching N times, jump to the address upon failure. */ - succeed_n, - - /* Followed by two-byte relative address, and two-byte number n. - Jump to the address N times, then fail. */ - jump_n, - - /* Set the following two-byte relative address to the - subsequent two-byte number. The address *includes* the two - bytes of number. */ - set_number_at, - - wordchar, /* Matches any word-constituent character. */ - notwordchar, /* Matches any char that is not a word-constituent. */ - - wordbeg, /* Succeeds if at word beginning. */ - wordend, /* Succeeds if at word end. */ - - wordbound, /* Succeeds if at a word boundary. */ - notwordbound /* Succeeds if not at a word boundary. */ - -#ifdef emacs - ,before_dot, /* Succeeds if before point. */ - at_dot, /* Succeeds if at point. */ - after_dot, /* Succeeds if after point. */ - - /* Matches any character whose syntax is specified. Followed by - a byte which contains a syntax code, e.g., Sword. */ - syntaxspec, - - /* Matches any character whose syntax is not that specified. */ - notsyntaxspec -#endif /* emacs */ -} re_opcode_t; - -/* Common operations on the compiled pattern. */ - -/* Store NUMBER in two contiguous bytes starting at DESTINATION. */ - -#define STORE_NUMBER(destination, number) \ - do { \ - (destination)[0] = (number) & 0377; \ - (destination)[1] = (number) >> 8; \ - } while (0) - -/* Same as STORE_NUMBER, except increment DESTINATION to - the byte after where the number is stored. Therefore, DESTINATION - must be an lvalue. */ - -#define STORE_NUMBER_AND_INCR(destination, number) \ - do { \ - STORE_NUMBER (destination, number); \ - (destination) += 2; \ - } while (0) - -/* Put into DESTINATION a number stored in two contiguous bytes starting - at SOURCE. */ - -#define EXTRACT_NUMBER(destination, source) \ - do { \ - (destination) = *(source) & 0377; \ - (destination) += SIGN_EXTEND_CHAR (*((source) + 1)) << 8; \ - } while (0) - -#ifdef DEBUG -static void extract_number _RE_ARGS ((int *dest, unsigned char *source)); -static void -extract_number (dest, source) - int *dest; - unsigned char *source; -{ - int temp = SIGN_EXTEND_CHAR (*(source + 1)); - *dest = *source & 0377; - *dest += temp << 8; -} - -#ifndef EXTRACT_MACROS /* To debug the macros. */ -#undef EXTRACT_NUMBER -#define EXTRACT_NUMBER(dest, src) extract_number (&dest, src) -#endif /* not EXTRACT_MACROS */ - -#endif /* DEBUG */ - -/* Same as EXTRACT_NUMBER, except increment SOURCE to after the number. - SOURCE must be an lvalue. */ - -#define EXTRACT_NUMBER_AND_INCR(destination, source) \ - do { \ - EXTRACT_NUMBER (destination, source); \ - (source) += 2; \ - } while (0) - -#ifdef DEBUG -static void extract_number_and_incr _RE_ARGS ((int *destination, - unsigned char **source)); -static void -extract_number_and_incr (destination, source) - int *destination; - unsigned char **source; -{ - extract_number (destination, *source); - *source += 2; -} - -#ifndef EXTRACT_MACROS -#undef EXTRACT_NUMBER_AND_INCR -#define EXTRACT_NUMBER_AND_INCR(dest, src) \ - extract_number_and_incr (&dest, &src) -#endif /* not EXTRACT_MACROS */ - -#endif /* DEBUG */ - -/* If DEBUG is defined, Regex prints many voluminous messages about what - it is doing (if the variable `debug' is nonzero). If linked with the - main program in `iregex.c', you can enter patterns and strings - interactively. And if linked with the main program in `main.c' and - the other test files, you can run the already-written tests. */ - -#ifdef DEBUG - -/* We use standard I/O for debugging. */ -#include <stdio.h> - -/* It is useful to test things that ``must'' be true when debugging. */ -#include <assert.h> - -static int debug = 0; - -#define DEBUG_STATEMENT(e) e -#define DEBUG_PRINT1(x) if (debug) printf (x) -#define DEBUG_PRINT2(x1, x2) if (debug) printf (x1, x2) -#define DEBUG_PRINT3(x1, x2, x3) if (debug) printf (x1, x2, x3) -#define DEBUG_PRINT4(x1, x2, x3, x4) if (debug) printf (x1, x2, x3, x4) -#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) \ - if (debug) print_partial_compiled_pattern (s, e) -#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) \ - if (debug) print_double_string (w, s1, sz1, s2, sz2) - - -/* Print the fastmap in human-readable form. */ - -void -print_fastmap (fastmap) - char *fastmap; -{ - unsigned was_a_range = 0; - unsigned i = 0; - - while (i < (1 << BYTEWIDTH)) - { - if (fastmap[i++]) - { - was_a_range = 0; - putchar (i - 1); - while (i < (1 << BYTEWIDTH) && fastmap[i]) - { - was_a_range = 1; - i++; - } - if (was_a_range) - { - printf ("-"); - putchar (i - 1); - } - } - } - putchar ('\n'); -} - - -/* Print a compiled pattern string in human-readable form, starting at - the START pointer into it and ending just before the pointer END. */ - -void -print_partial_compiled_pattern (start, end) - unsigned char *start; - unsigned char *end; -{ - int mcnt, mcnt2; - unsigned char *p1; - unsigned char *p = start; - unsigned char *pend = end; - - if (start == NULL) - { - printf ("(null)\n"); - return; - } - - /* Loop over pattern commands. */ - while (p < pend) - { - printf ("%d:\t", p - start); - - switch ((re_opcode_t) *p++) - { - case no_op: - printf ("/no_op"); - break; - - case exactn: - mcnt = *p++; - printf ("/exactn/%d", mcnt); - do - { - putchar ('/'); - putchar (*p++); - } - while (--mcnt); - break; - - case start_memory: - mcnt = *p++; - printf ("/start_memory/%d/%d", mcnt, *p++); - break; - - case stop_memory: - mcnt = *p++; - printf ("/stop_memory/%d/%d", mcnt, *p++); - break; - - case duplicate: - printf ("/duplicate/%d", *p++); - break; - - case anychar: - printf ("/anychar"); - break; - - case charset: - case charset_not: - { - register int c, last = -100; - register int in_range = 0; - - printf ("/charset [%s", - (re_opcode_t) *(p - 1) == charset_not ? "^" : ""); - - assert (p + *p < pend); - - for (c = 0; c < 256; c++) - if (c / 8 < *p - && (p[1 + (c/8)] & (1 << (c % 8)))) - { - /* Are we starting a range? */ - if (last + 1 == c && ! in_range) - { - putchar ('-'); - in_range = 1; - } - /* Have we broken a range? */ - else if (last + 1 != c && in_range) - { - putchar (last); - in_range = 0; - } - - if (! in_range) - putchar (c); - - last = c; - } - - if (in_range) - putchar (last); - - putchar (']'); - - p += 1 + *p; - } - break; - - case begline: - printf ("/begline"); - break; - - case endline: - printf ("/endline"); - break; - - case on_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_jump to %d", p + mcnt - start); - break; - - case on_failure_keep_string_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/on_failure_keep_string_jump to %d", p + mcnt - start); - break; - - case dummy_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/dummy_failure_jump to %d", p + mcnt - start); - break; - - case push_dummy_failure: - printf ("/push_dummy_failure"); - break; - - case maybe_pop_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/maybe_pop_jump to %d", p + mcnt - start); - break; - - case pop_failure_jump: - extract_number_and_incr (&mcnt, &p); - printf ("/pop_failure_jump to %d", p + mcnt - start); - break; - - case jump_past_alt: - extract_number_and_incr (&mcnt, &p); - printf ("/jump_past_alt to %d", p + mcnt - start); - break; - - case jump: - extract_number_and_incr (&mcnt, &p); - printf ("/jump to %d", p + mcnt - start); - break; - - case succeed_n: - extract_number_and_incr (&mcnt, &p); - p1 = p + mcnt; - extract_number_and_incr (&mcnt2, &p); - printf ("/succeed_n to %d, %d times", p1 - start, mcnt2); - break; - - case jump_n: - extract_number_and_incr (&mcnt, &p); - p1 = p + mcnt; - extract_number_and_incr (&mcnt2, &p); - printf ("/jump_n to %d, %d times", p1 - start, mcnt2); - break; - - case set_number_at: - extract_number_and_incr (&mcnt, &p); - p1 = p + mcnt; - extract_number_and_incr (&mcnt2, &p); - printf ("/set_number_at location %d to %d", p1 - start, mcnt2); - break; - - case wordbound: - printf ("/wordbound"); - break; - - case notwordbound: - printf ("/notwordbound"); - break; - - case wordbeg: - printf ("/wordbeg"); - break; - - case wordend: - printf ("/wordend"); - -#ifdef emacs - case before_dot: - printf ("/before_dot"); - break; - - case at_dot: - printf ("/at_dot"); - break; - - case after_dot: - printf ("/after_dot"); - break; - - case syntaxspec: - printf ("/syntaxspec"); - mcnt = *p++; - printf ("/%d", mcnt); - break; - - case notsyntaxspec: - printf ("/notsyntaxspec"); - mcnt = *p++; - printf ("/%d", mcnt); - break; -#endif /* emacs */ - - case wordchar: - printf ("/wordchar"); - break; - - case notwordchar: - printf ("/notwordchar"); - break; - - case begbuf: - printf ("/begbuf"); - break; - - case endbuf: - printf ("/endbuf"); - break; - - default: - printf ("?%d", *(p-1)); - } - - putchar ('\n'); - } - - printf ("%d:\tend of pattern.\n", p - start); -} - - -void -print_compiled_pattern (bufp) - struct re_pattern_buffer *bufp; -{ - unsigned char *buffer = bufp->buffer; - - print_partial_compiled_pattern (buffer, buffer + bufp->used); - printf ("%ld bytes used/%ld bytes allocated.\n", - bufp->used, bufp->allocated); - - if (bufp->fastmap_accurate && bufp->fastmap) - { - printf ("fastmap: "); - print_fastmap (bufp->fastmap); - } - - printf ("re_nsub: %d\t", bufp->re_nsub); - printf ("regs_alloc: %d\t", bufp->regs_allocated); - printf ("can_be_null: %d\t", bufp->can_be_null); - printf ("newline_anchor: %d\n", bufp->newline_anchor); - printf ("no_sub: %d\t", bufp->no_sub); - printf ("not_bol: %d\t", bufp->not_bol); - printf ("not_eol: %d\t", bufp->not_eol); - printf ("syntax: %lx\n", bufp->syntax); - /* Perhaps we should print the translate table? */ -} - - -void -print_double_string (where, string1, size1, string2, size2) - const char *where; - const char *string1; - const char *string2; - int size1; - int size2; -{ - int this_char; - - if (where == NULL) - printf ("(null)"); - else - { - if (FIRST_STRING_P (where)) - { - for (this_char = where - string1; this_char < size1; this_char++) - putchar (string1[this_char]); - - where = string2; - } - - for (this_char = where - string2; this_char < size2; this_char++) - putchar (string2[this_char]); - } -} - -void -printchar (c) - int c; -{ - putc (c, stderr); -} - -#else /* not DEBUG */ - -#undef assert -#define assert(e) - -#define DEBUG_STATEMENT(e) -#define DEBUG_PRINT1(x) -#define DEBUG_PRINT2(x1, x2) -#define DEBUG_PRINT3(x1, x2, x3) -#define DEBUG_PRINT4(x1, x2, x3, x4) -#define DEBUG_PRINT_COMPILED_PATTERN(p, s, e) -#define DEBUG_PRINT_DOUBLE_STRING(w, s1, sz1, s2, sz2) - -#endif /* not DEBUG */ - -/* Set by `re_set_syntax' to the current regexp syntax to recognize. Can - also be assigned to arbitrarily: each pattern buffer stores its own - syntax, so it can be changed between regex compilations. */ -/* This has no initializer because initialized variables in Emacs - become read-only after dumping. */ -reg_syntax_t re_syntax_options; - - -/* Specify the precise syntax of regexps for compilation. This provides - for compatibility for various utilities which historically have - different, incompatible syntaxes. - - The argument SYNTAX is a bit mask comprised of the various bits - defined in regex.h. We return the old syntax. */ - -reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; -{ - reg_syntax_t ret = re_syntax_options; - - re_syntax_options = syntax; -#ifdef DEBUG - if (syntax & RE_DEBUG) - debug = 1; - else if (debug) /* was on but now is not */ - debug = 0; -#endif /* DEBUG */ - return ret; -} - -/* This table gives an error message for each of the error codes listed - in regex.h. Obviously the order here has to be same as there. - POSIX doesn't require that we do anything for REG_NOERROR, - but why not be nice? */ - -static const char *re_error_msgid[] = - { - gettext_noop ("Success"), /* REG_NOERROR */ - gettext_noop ("No match"), /* REG_NOMATCH */ - gettext_noop ("Invalid regular expression"), /* REG_BADPAT */ - gettext_noop ("Invalid collation character"), /* REG_ECOLLATE */ - gettext_noop ("Invalid character class name"), /* REG_ECTYPE */ - gettext_noop ("Trailing backslash"), /* REG_EESCAPE */ - gettext_noop ("Invalid back reference"), /* REG_ESUBREG */ - gettext_noop ("Unmatched [ or [^"), /* REG_EBRACK */ - gettext_noop ("Unmatched ( or \\("), /* REG_EPAREN */ - gettext_noop ("Unmatched \\{"), /* REG_EBRACE */ - gettext_noop ("Invalid content of \\{\\}"), /* REG_BADBR */ - gettext_noop ("Invalid range end"), /* REG_ERANGE */ - gettext_noop ("Memory exhausted"), /* REG_ESPACE */ - gettext_noop ("Invalid preceding regular expression"), /* REG_BADRPT */ - gettext_noop ("Premature end of regular expression"), /* REG_EEND */ - gettext_noop ("Regular expression too big"), /* REG_ESIZE */ - gettext_noop ("Unmatched ) or \\)"), /* REG_ERPAREN */ - }; - -/* Avoiding alloca during matching, to placate r_alloc. */ - -/* Define MATCH_MAY_ALLOCATE unless we need to make sure that the - searching and matching functions should not call alloca. On some - systems, alloca is implemented in terms of malloc, and if we're - using the relocating allocator routines, then malloc could cause a - relocation, which might (if the strings being searched are in the - ralloc heap) shift the data out from underneath the regexp - routines. - - Here's another reason to avoid allocation: Emacs - processes input from X in a signal handler; processing X input may - call malloc; if input arrives while a matching routine is calling - malloc, then we're scrod. But Emacs can't just block input while - calling matching routines; then we don't notice interrupts when - they come in. So, Emacs blocks input around all regexp calls - except the matching calls, which it leaves unprotected, in the - faith that they will not malloc. */ - -/* Normally, this is fine. */ -#define MATCH_MAY_ALLOCATE - -/* When using GNU C, we are not REALLY using the C alloca, no matter - what config.h may say. So don't take precautions for it. */ -#ifdef __GNUC__ -#undef C_ALLOCA -#endif - -/* The match routines may not allocate if (1) they would do it with malloc - and (2) it's not safe for them to use malloc. - Note that if REL_ALLOC is defined, matching would not use malloc for the - failure stack, but we would still use it for the register vectors; - so REL_ALLOC should not affect this. */ -#if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && defined (emacs) -#undef MATCH_MAY_ALLOCATE -#endif - - -/* Failure stack declarations and macros; both re_compile_fastmap and - re_match_2 use a failure stack. These have to be macros because of - REGEX_ALLOCATE_STACK. */ - - -/* Number of failure points for which to initially allocate space - when matching. If this number is exceeded, we allocate more - space, so it is not a hard limit. */ -#ifndef INIT_FAILURE_ALLOC -#define INIT_FAILURE_ALLOC 5 -#endif - -/* Roughly the maximum number of failure points on the stack. Would be - exactly that if always used MAX_FAILURE_ITEMS items each time we failed. - This is a variable only so users of regex can assign to it; we never - change it ourselves. */ - -#ifdef INT_IS_16BIT - -#if defined (MATCH_MAY_ALLOCATE) -/* 4400 was enough to cause a crash on Alpha OSF/1, - whose default stack limit is 2mb. */ -long int re_max_failures = 4000; -#else -long int re_max_failures = 2000; -#endif - -union fail_stack_elt -{ - unsigned char *pointer; - long int integer; -}; - -typedef union fail_stack_elt fail_stack_elt_t; - -typedef struct -{ - fail_stack_elt_t *stack; - unsigned long int size; - unsigned long int avail; /* Offset of next open position. */ -} fail_stack_type; - -#else /* not INT_IS_16BIT */ - -#if defined (MATCH_MAY_ALLOCATE) -/* 4400 was enough to cause a crash on Alpha OSF/1, - whose default stack limit is 2mb. */ -int re_max_failures = 20000; -#else -int re_max_failures = 2000; -#endif - -union fail_stack_elt -{ - unsigned char *pointer; - int integer; -}; - -typedef union fail_stack_elt fail_stack_elt_t; - -typedef struct -{ - fail_stack_elt_t *stack; - unsigned size; - unsigned avail; /* Offset of next open position. */ -} fail_stack_type; - -#endif /* INT_IS_16BIT */ - -#define FAIL_STACK_EMPTY() (fail_stack.avail == 0) -#define FAIL_STACK_PTR_EMPTY() (fail_stack_ptr->avail == 0) -#define FAIL_STACK_FULL() (fail_stack.avail == fail_stack.size) - - -/* Define macros to initialize and free the failure stack. - Do `return -2' if the alloc fails. */ - -#ifdef MATCH_MAY_ALLOCATE -#define INIT_FAIL_STACK() \ - do { \ - fail_stack.stack = (fail_stack_elt_t *) \ - REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * sizeof (fail_stack_elt_t)); \ - \ - if (fail_stack.stack == NULL) \ - return -2; \ - \ - fail_stack.size = INIT_FAILURE_ALLOC; \ - fail_stack.avail = 0; \ - } while (0) - -#define RESET_FAIL_STACK() REGEX_FREE_STACK (fail_stack.stack) -#else -#define INIT_FAIL_STACK() \ - do { \ - fail_stack.avail = 0; \ - } while (0) - -#define RESET_FAIL_STACK() -#endif - - -/* Double the size of FAIL_STACK, up to approximately `re_max_failures' items. - - Return 1 if succeeds, and 0 if either ran out of memory - allocating space for it or it was already too large. - - REGEX_REALLOCATE_STACK requires `destination' be declared. */ - -#define DOUBLE_FAIL_STACK(fail_stack) \ - ((fail_stack).size > (unsigned) (re_max_failures * MAX_FAILURE_ITEMS) \ - ? 0 \ - : ((fail_stack).stack = (fail_stack_elt_t *) \ - REGEX_REALLOCATE_STACK ((fail_stack).stack, \ - (fail_stack).size * sizeof (fail_stack_elt_t), \ - ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \ - \ - (fail_stack).stack == NULL \ - ? 0 \ - : ((fail_stack).size <<= 1, \ - 1))) - - -/* Push pointer POINTER on FAIL_STACK. - Return 1 if was able to do so and 0 if ran out of memory allocating - space to do so. */ -#define PUSH_PATTERN_OP(POINTER, FAIL_STACK) \ - ((FAIL_STACK_FULL () \ - && !DOUBLE_FAIL_STACK (FAIL_STACK)) \ - ? 0 \ - : ((FAIL_STACK).stack[(FAIL_STACK).avail++].pointer = POINTER, \ - 1)) - -/* Push a pointer value onto the failure stack. - Assumes the variable `fail_stack'. Probably should only - be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_POINTER(item) \ - fail_stack.stack[fail_stack.avail++].pointer = (unsigned char *) (item) - -/* This pushes an integer-valued item onto the failure stack. - Assumes the variable `fail_stack'. Probably should only - be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_INT(item) \ - fail_stack.stack[fail_stack.avail++].integer = (item) - -/* Push a fail_stack_elt_t value onto the failure stack. - Assumes the variable `fail_stack'. Probably should only - be called from within `PUSH_FAILURE_POINT'. */ -#define PUSH_FAILURE_ELT(item) \ - fail_stack.stack[fail_stack.avail++] = (item) - -/* These three POP... operations complement the three PUSH... operations. - All assume that `fail_stack' is nonempty. */ -#define POP_FAILURE_POINTER() fail_stack.stack[--fail_stack.avail].pointer -#define POP_FAILURE_INT() fail_stack.stack[--fail_stack.avail].integer -#define POP_FAILURE_ELT() fail_stack.stack[--fail_stack.avail] - -/* Used to omit pushing failure point id's when we're not debugging. */ -#ifdef DEBUG -#define DEBUG_PUSH PUSH_FAILURE_INT -#define DEBUG_POP(item_addr) (item_addr)->integer = POP_FAILURE_INT () -#else -#define DEBUG_PUSH(item) -#define DEBUG_POP(item_addr) -#endif - - -/* Push the information about the state we will need - if we ever fail back to it. - - Requires variables fail_stack, regstart, regend, reg_info, and - num_regs be declared. DOUBLE_FAIL_STACK requires `destination' be - declared. - - Does `return FAILURE_CODE' if runs out of memory. */ - -#define PUSH_FAILURE_POINT(pattern_place, string_place, failure_code) \ - do { \ - char *destination; \ - /* Must be int, so when we don't save any registers, the arithmetic \ - of 0 + -1 isn't done as unsigned. */ \ - /* Can't be int, since there is not a shred of a guarantee that int \ - is wide enough to hold a value of something to which pointer can \ - be assigned */ \ - s_reg_t this_reg; \ - \ - DEBUG_STATEMENT (failure_id++); \ - DEBUG_STATEMENT (nfailure_points_pushed++); \ - DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \ - DEBUG_PRINT2 (" Before push, next avail: %d\n", (fail_stack).avail);\ - DEBUG_PRINT2 (" size: %d\n", (fail_stack).size);\ - \ - DEBUG_PRINT2 (" slots needed: %d\n", NUM_FAILURE_ITEMS); \ - DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \ - \ - /* Ensure we have enough space allocated for what we will push. */ \ - while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \ - { \ - if (!DOUBLE_FAIL_STACK (fail_stack)) \ - return failure_code; \ - \ - DEBUG_PRINT2 ("\n Doubled stack; size now: %d\n", \ - (fail_stack).size); \ - DEBUG_PRINT2 (" slots available: %d\n", REMAINING_AVAIL_SLOTS);\ - } \ - \ - /* Push the info, starting with the registers. */ \ - DEBUG_PRINT1 ("\n"); \ - \ - if (1) \ - for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ - this_reg++) \ - { \ - DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ - DEBUG_STATEMENT (num_regs_pushed++); \ - \ - DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ - PUSH_FAILURE_POINTER (regstart[this_reg]); \ - \ - DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ - PUSH_FAILURE_POINTER (regend[this_reg]); \ - \ - DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \ - DEBUG_PRINT2 (" match_null=%d", \ - REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ - DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ - DEBUG_PRINT2 (" matched_something=%d", \ - MATCHED_SOMETHING (reg_info[this_reg])); \ - DEBUG_PRINT2 (" ever_matched=%d", \ - EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ - DEBUG_PRINT1 ("\n"); \ - PUSH_FAILURE_ELT (reg_info[this_reg].word); \ - } \ - \ - DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\ - PUSH_FAILURE_INT (lowest_active_reg); \ - \ - DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ - PUSH_FAILURE_INT (highest_active_reg); \ - \ - DEBUG_PRINT2 (" Pushing pattern 0x%x:\n", pattern_place); \ - DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ - PUSH_FAILURE_POINTER (pattern_place); \ - \ - DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \ - DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \ - size2); \ - DEBUG_PRINT1 ("'\n"); \ - PUSH_FAILURE_POINTER (string_place); \ - \ - DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \ - DEBUG_PUSH (failure_id); \ - } while (0) - -/* This is the number of items that are pushed and popped on the stack - for each register. */ -#define NUM_REG_ITEMS 3 - -/* Individual items aside from the registers. */ -#ifdef DEBUG -#define NUM_NONREG_ITEMS 5 /* Includes failure point id. */ -#else -#define NUM_NONREG_ITEMS 4 -#endif - -/* We push at most this many items on the stack. */ -/* We used to use (num_regs - 1), which is the number of registers - this regexp will save; but that was changed to 5 - to avoid stack overflow for a regexp with lots of parens. */ -#define MAX_FAILURE_ITEMS (5 * NUM_REG_ITEMS + NUM_NONREG_ITEMS) - -/* We actually push this many items. */ -#define NUM_FAILURE_ITEMS \ - (((0 \ - ? 0 : highest_active_reg - lowest_active_reg + 1) \ - * NUM_REG_ITEMS) \ - + NUM_NONREG_ITEMS) - -/* How many items can still be added to the stack without overflowing it. */ -#define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) - - -/* Pops what PUSH_FAIL_STACK pushes. - - We restore into the parameters, all of which should be lvalues: - STR -- the saved data position. - PAT -- the saved pattern position. - LOW_REG, HIGH_REG -- the highest and lowest active registers. - REGSTART, REGEND -- arrays of string positions. - REG_INFO -- array of information about each subexpression. - - Also assumes the variables `fail_stack' and (if debugging), `bufp', - `pend', `string1', `size1', `string2', and `size2'. */ - -#define POP_FAILURE_POINT(str, pat, low_reg, high_reg, regstart, regend, reg_info)\ -{ \ - DEBUG_STATEMENT (fail_stack_elt_t failure_id;) \ - s_reg_t this_reg; \ - const unsigned char *string_temp; \ - \ - assert (!FAIL_STACK_EMPTY ()); \ - \ - /* Remove failure points and point to how many regs pushed. */ \ - DEBUG_PRINT1 ("POP_FAILURE_POINT:\n"); \ - DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \ - DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \ - \ - assert (fail_stack.avail >= NUM_NONREG_ITEMS); \ - \ - DEBUG_POP (&failure_id); \ - DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \ - \ - /* If the saved string location is NULL, it came from an \ - on_failure_keep_string_jump opcode, and we want to throw away the \ - saved NULL, thus retaining our current position in the string. */ \ - string_temp = POP_FAILURE_POINTER (); \ - if (string_temp != NULL) \ - str = (const char *) string_temp; \ - \ - DEBUG_PRINT2 (" Popping string 0x%x: `", str); \ - DEBUG_PRINT_DOUBLE_STRING (str, string1, size1, string2, size2); \ - DEBUG_PRINT1 ("'\n"); \ - \ - pat = (unsigned char *) POP_FAILURE_POINTER (); \ - DEBUG_PRINT2 (" Popping pattern 0x%x:\n", pat); \ - DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ - \ - /* Restore register info. */ \ - high_reg = (active_reg_t) POP_FAILURE_INT (); \ - DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ - \ - low_reg = (active_reg_t) POP_FAILURE_INT (); \ - DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ - \ - if (1) \ - for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ - { \ - DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ - \ - reg_info[this_reg].word = POP_FAILURE_ELT (); \ - DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \ - \ - regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \ - DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ - \ - regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \ - DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ - } \ - else \ - { \ - for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \ - { \ - reg_info[this_reg].word.integer = 0; \ - regend[this_reg] = 0; \ - regstart[this_reg] = 0; \ - } \ - highest_active_reg = high_reg; \ - } \ - \ - set_regs_matched_done = 0; \ - DEBUG_STATEMENT (nfailure_points_popped++); \ -} /* POP_FAILURE_POINT */ - - - -/* Structure for per-register (a.k.a. per-group) information. - Other register information, such as the - starting and ending positions (which are addresses), and the list of - inner groups (which is a bits list) are maintained in separate - variables. - - We are making a (strictly speaking) nonportable assumption here: that - the compiler will pack our bit fields into something that fits into - the type of `word', i.e., is something that fits into one item on the - failure stack. */ - - -/* Declarations and macros for re_match_2. */ - -typedef union -{ - fail_stack_elt_t word; - struct - { - /* This field is one if this group can match the empty string, - zero if not. If not yet determined, `MATCH_NULL_UNSET_VALUE'. */ -#define MATCH_NULL_UNSET_VALUE 3 - unsigned match_null_string_p : 2; - unsigned is_active : 1; - unsigned matched_something : 1; - unsigned ever_matched_something : 1; - } bits; -} register_info_type; - -#define REG_MATCH_NULL_STRING_P(R) ((R).bits.match_null_string_p) -#define IS_ACTIVE(R) ((R).bits.is_active) -#define MATCHED_SOMETHING(R) ((R).bits.matched_something) -#define EVER_MATCHED_SOMETHING(R) ((R).bits.ever_matched_something) - - -/* Call this when have matched a real character; it sets `matched' flags - for the subexpressions which we are currently inside. Also records - that those subexprs have matched. */ -#define SET_REGS_MATCHED() \ - do \ - { \ - if (!set_regs_matched_done) \ - { \ - active_reg_t r; \ - set_regs_matched_done = 1; \ - for (r = lowest_active_reg; r <= highest_active_reg; r++) \ - { \ - MATCHED_SOMETHING (reg_info[r]) \ - = EVER_MATCHED_SOMETHING (reg_info[r]) \ - = 1; \ - } \ - } \ - } \ - while (0) - -/* Registers are set to a sentinel when they haven't yet matched. */ -static char reg_unset_dummy; -#define REG_UNSET_VALUE (®_unset_dummy) -#define REG_UNSET(e) ((e) == REG_UNSET_VALUE) - -/* Subroutine declarations and macros for regex_compile. */ - -static reg_errcode_t regex_compile _RE_ARGS ((const char *pattern, size_t size, - reg_syntax_t syntax, - struct re_pattern_buffer *bufp)); -static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg)); -static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg1, int arg2)); -static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg, unsigned char *end)); -static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc, - int arg1, int arg2, unsigned char *end)); -static boolean at_begline_loc_p _RE_ARGS ((const char *pattern, const char *p, - reg_syntax_t syntax)); -static boolean at_endline_loc_p _RE_ARGS ((const char *p, const char *pend, - reg_syntax_t syntax)); -static reg_errcode_t compile_range _RE_ARGS ((const char **p_ptr, - const char *pend, - char *translate, - reg_syntax_t syntax, - unsigned char *b)); - -/* Fetch the next character in the uncompiled pattern---translating it - if necessary. Also cast from a signed character in the constant - string passed to us by the user to an unsigned char that we can use - as an array index (in, e.g., `translate'). */ -#ifndef PATFETCH -#define PATFETCH(c) \ - do {if (p == pend) return REG_EEND; \ - c = (unsigned char) *p++; \ - if (translate) c = (unsigned char) translate[c]; \ - } while (0) -#endif - -/* Fetch the next character in the uncompiled pattern, with no - translation. */ -#define PATFETCH_RAW(c) \ - do {if (p == pend) return REG_EEND; \ - c = (unsigned char) *p++; \ - } while (0) - -/* Go backwards one character in the pattern. */ -#define PATUNFETCH p-- - - -/* If `translate' is non-null, return translate[D], else just D. We - cast the subscript to translate because some data is declared as - `char *', to avoid warnings when a string constant is passed. But - when we use a character as a subscript we must make it unsigned. */ -#ifndef TRANSLATE -#define TRANSLATE(d) \ - (translate ? (char) translate[(unsigned char) (d)] : (d)) -#endif - - -/* Macros for outputting the compiled pattern into `buffer'. */ - -/* If the buffer isn't allocated when it comes in, use this. */ -#define INIT_BUF_SIZE 32 - -/* Make sure we have at least N more bytes of space in buffer. */ -#define GET_BUFFER_SPACE(n) \ - while ((unsigned long) (b - bufp->buffer + (n)) > bufp->allocated) \ - EXTEND_BUFFER () - -/* Make sure we have one more byte of buffer space and then add C to it. */ -#define BUF_PUSH(c) \ - do { \ - GET_BUFFER_SPACE (1); \ - *b++ = (unsigned char) (c); \ - } while (0) - - -/* Ensure we have two more bytes of buffer space and then append C1 and C2. */ -#define BUF_PUSH_2(c1, c2) \ - do { \ - GET_BUFFER_SPACE (2); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - } while (0) - - -/* As with BUF_PUSH_2, except for three bytes. */ -#define BUF_PUSH_3(c1, c2, c3) \ - do { \ - GET_BUFFER_SPACE (3); \ - *b++ = (unsigned char) (c1); \ - *b++ = (unsigned char) (c2); \ - *b++ = (unsigned char) (c3); \ - } while (0) - - -/* Store a jump with opcode OP at LOC to location TO. We store a - relative address offset by the three bytes the jump itself occupies. */ -#define STORE_JUMP(op, loc, to) \ - store_op1 (op, loc, (int) ((to) - (loc) - 3)) - -/* Likewise, for a two-argument jump. */ -#define STORE_JUMP2(op, loc, to, arg) \ - store_op2 (op, loc, (int) ((to) - (loc) - 3), arg) - -/* Like `STORE_JUMP', but for inserting. Assume `b' is the buffer end. */ -#define INSERT_JUMP(op, loc, to) \ - insert_op1 (op, loc, (int) ((to) - (loc) - 3), b) - -/* Like `STORE_JUMP2', but for inserting. Assume `b' is the buffer end. */ -#define INSERT_JUMP2(op, loc, to, arg) \ - insert_op2 (op, loc, (int) ((to) - (loc) - 3), arg, b) - - -/* This is not an arbitrary limit: the arguments which represent offsets - into the pattern are two bytes long. So if 2^16 bytes turns out to - be too small, many things would have to change. */ -/* Any other compiler which, like MSC, has allocation limit below 2^16 - bytes will have to use approach similar to what was done below for - MSC and drop MAX_BUF_SIZE a bit. Otherwise you may end up - reallocating to 0 bytes. Such thing is not going to work too well. - You have been warned!! */ -#if defined(_MSC_VER) && !defined(WIN32) -/* Microsoft C 16-bit versions limit malloc to approx 65512 bytes. - The REALLOC define eliminates a flurry of conversion warnings, - but is not required. */ -#define MAX_BUF_SIZE 65500L -#define REALLOC(p,s) realloc ((p), (size_t) (s)) -#else -#define MAX_BUF_SIZE (1L << 16) -#define REALLOC(p,s) realloc ((p), (s)) -#endif - -/* Extend the buffer by twice its current size via realloc and - reset the pointers that pointed into the old block to point to the - correct places in the new one. If extending the buffer results in it - being larger than MAX_BUF_SIZE, then flag memory exhausted. */ -#if __BOUNDED_POINTERS__ -# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated) -# define MOVE_BUFFER_POINTER(P) \ - (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr) -# define ELSE_EXTEND_BUFFER_HIGH_BOUND \ - else \ - { \ - SET_HIGH_BOUND (b); \ - SET_HIGH_BOUND (begalt); \ - if (fixup_alt_jump) \ - SET_HIGH_BOUND (fixup_alt_jump); \ - if (laststart) \ - SET_HIGH_BOUND (laststart); \ - if (pending_exact) \ - SET_HIGH_BOUND (pending_exact); \ - } -#else -# define MOVE_BUFFER_POINTER(P) (P) += incr -# define ELSE_EXTEND_BUFFER_HIGH_BOUND -#endif -#define EXTEND_BUFFER() \ - do { \ - unsigned char *old_buffer = bufp->buffer; \ - if (bufp->allocated == MAX_BUF_SIZE) \ - return REG_ESIZE; \ - bufp->allocated <<= 1; \ - if (bufp->allocated > MAX_BUF_SIZE) \ - bufp->allocated = MAX_BUF_SIZE; \ - bufp->buffer = (unsigned char *) REALLOC (bufp->buffer, bufp->allocated);\ - if (bufp->buffer == NULL) \ - return REG_ESPACE; \ - /* If the buffer moved, move all the pointers into it. */ \ - if (old_buffer != bufp->buffer) \ - { \ - int incr = bufp->buffer - old_buffer; \ - MOVE_BUFFER_POINTER (b); \ - MOVE_BUFFER_POINTER (begalt); \ - if (fixup_alt_jump) \ - MOVE_BUFFER_POINTER (fixup_alt_jump); \ - if (laststart) \ - MOVE_BUFFER_POINTER (laststart); \ - if (pending_exact) \ - MOVE_BUFFER_POINTER (pending_exact); \ - } \ - ELSE_EXTEND_BUFFER_HIGH_BOUND \ - } while (0) - - -/* Since we have one byte reserved for the register number argument to - {start,stop}_memory, the maximum number of groups we can report - things about is what fits in that byte. */ -#define MAX_REGNUM 255 - -/* But patterns can have more than `MAX_REGNUM' registers. We just - ignore the excess. */ -typedef unsigned regnum_t; - - -/* Macros for the compile stack. */ - -/* Since offsets can go either forwards or backwards, this type needs to - be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1. */ -/* int may be not enough when sizeof(int) == 2. */ -typedef long pattern_offset_t; - -typedef struct -{ - pattern_offset_t begalt_offset; - pattern_offset_t fixup_alt_jump; - pattern_offset_t inner_group_offset; - pattern_offset_t laststart_offset; - regnum_t regnum; -} compile_stack_elt_t; - - -typedef struct -{ - compile_stack_elt_t *stack; - unsigned size; - unsigned avail; /* Offset of next open position. */ -} compile_stack_type; - - -#define INIT_COMPILE_STACK_SIZE 32 - -#define COMPILE_STACK_EMPTY (compile_stack.avail == 0) -#define COMPILE_STACK_FULL (compile_stack.avail == compile_stack.size) - -/* The next available element. */ -#define COMPILE_STACK_TOP (compile_stack.stack[compile_stack.avail]) - - -/* Set the bit for character C in a list. */ -#define SET_LIST_BIT(c) \ - (b[((unsigned char) (c)) / BYTEWIDTH] \ - |= 1 << (((unsigned char) c) % BYTEWIDTH)) - - -/* Get the next unsigned number in the uncompiled pattern. */ -#define GET_UNSIGNED_NUMBER(num) \ - { if (p != pend) \ - { \ - PATFETCH (c); \ - while (ISDIGIT (c)) \ - { \ - if (num < 0) \ - num = 0; \ - num = num * 10 + c - '0'; \ - if (p == pend) \ - break; \ - PATFETCH (c); \ - } \ - } \ - } - -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) -/* The GNU C library provides support for user-defined character classes - and the functions from ISO C amendement 1. */ -# ifdef CHARCLASS_NAME_MAX -# define CHAR_CLASS_MAX_LENGTH CHARCLASS_NAME_MAX -# else -/* This shouldn't happen but some implementation might still have this - problem. Use a reasonable default value. */ -# define CHAR_CLASS_MAX_LENGTH 256 -# endif - -# define IS_CHAR_CLASS(string) wctype (string) -#else -# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ - -# define IS_CHAR_CLASS(string) \ - (STREQ (string, "alpha") || STREQ (string, "upper") \ - || STREQ (string, "lower") || STREQ (string, "digit") \ - || STREQ (string, "alnum") || STREQ (string, "xdigit") \ - || STREQ (string, "space") || STREQ (string, "print") \ - || STREQ (string, "punct") || STREQ (string, "graph") \ - || STREQ (string, "cntrl") || STREQ (string, "blank")) -#endif - -#ifndef MATCH_MAY_ALLOCATE - -/* If we cannot allocate large objects within re_match_2_internal, - we make the fail stack and register vectors global. - The fail stack, we grow to the maximum size when a regexp - is compiled. - The register vectors, we adjust in size each time we - compile a regexp, according to the number of registers it needs. */ - -static fail_stack_type fail_stack; - -/* Size with which the following vectors are currently allocated. - That is so we can make them bigger as needed, - but never make them smaller. */ -static int regs_allocated_size; - -static const char ** regstart, ** regend; -static const char ** old_regstart, ** old_regend; -static const char **best_regstart, **best_regend; -static register_info_type *reg_info; -static const char **reg_dummy; -static register_info_type *reg_info_dummy; - -/* Make the register vectors big enough for NUM_REGS registers, - but don't make them smaller. */ - -static -regex_grow_registers (num_regs) - int num_regs; -{ - if (num_regs > regs_allocated_size) - { - RETALLOC_IF (regstart, num_regs, const char *); - RETALLOC_IF (regend, num_regs, const char *); - RETALLOC_IF (old_regstart, num_regs, const char *); - RETALLOC_IF (old_regend, num_regs, const char *); - RETALLOC_IF (best_regstart, num_regs, const char *); - RETALLOC_IF (best_regend, num_regs, const char *); - RETALLOC_IF (reg_info, num_regs, register_info_type); - RETALLOC_IF (reg_dummy, num_regs, const char *); - RETALLOC_IF (reg_info_dummy, num_regs, register_info_type); - - regs_allocated_size = num_regs; - } -} - -#endif /* not MATCH_MAY_ALLOCATE */ - -static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type - compile_stack, - regnum_t regnum)); - -/* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX. - Returns one of error codes defined in `regex.h', or zero for success. - - Assumes the `allocated' (and perhaps `buffer') and `translate' - fields are set in BUFP on entry. - - If it succeeds, results are put in BUFP (if it returns an error, the - contents of BUFP are undefined): - `buffer' is the compiled pattern; - `syntax' is set to SYNTAX; - `used' is set to the length of the compiled pattern; - `fastmap_accurate' is zero; - `re_nsub' is the number of subexpressions in PATTERN; - `not_bol' and `not_eol' are zero; - - The `fastmap' and `newline_anchor' fields are neither - examined nor set. */ - -/* Return, freeing storage we allocated. */ -#define FREE_STACK_RETURN(value) \ - return (free (compile_stack.stack), value) - -static reg_errcode_t -regex_compile (pattern, size, syntax, bufp) - const char *pattern; - size_t size; - reg_syntax_t syntax; - struct re_pattern_buffer *bufp; -{ - /* We fetch characters from PATTERN here. Even though PATTERN is - `char *' (i.e., signed), we declare these variables as unsigned, so - they can be reliably used as array indices. */ - register unsigned char c, c1; - - /* A random temporary spot in PATTERN. */ - const char *p1; - - /* Points to the end of the buffer, where we should append. */ - register unsigned char *b; - - /* Keeps track of unclosed groups. */ - compile_stack_type compile_stack; - - /* Points to the current (ending) position in the pattern. */ - const char *p = pattern; - const char *pend = pattern + size; - - /* How to translate the characters in the pattern. */ - RE_TRANSLATE_TYPE translate = bufp->translate; - - /* Address of the count-byte of the most recently inserted `exactn' - command. This makes it possible to tell if a new exact-match - character can be added to that command or if the character requires - a new `exactn' command. */ - unsigned char *pending_exact = 0; - - /* Address of start of the most recently finished expression. - This tells, e.g., postfix * where to find the start of its - operand. Reset at the beginning of groups and alternatives. */ - unsigned char *laststart = 0; - - /* Address of beginning of regexp, or inside of last group. */ - unsigned char *begalt; - - /* Place in the uncompiled pattern (i.e., the {) to - which to go back if the interval is invalid. */ - const char *beg_interval; - - /* Address of the place where a forward jump should go to the end of - the containing expression. Each alternative of an `or' -- except the - last -- ends with a forward jump of this sort. */ - unsigned char *fixup_alt_jump = 0; - - /* Counts open-groups as they are encountered. Remembered for the - matching close-group on the compile stack, so the same register - number is put in the stop_memory as the start_memory. */ - regnum_t regnum = 0; - -#ifdef DEBUG - DEBUG_PRINT1 ("\nCompiling pattern: "); - if (debug) - { - unsigned debug_count; - - for (debug_count = 0; debug_count < size; debug_count++) - putchar (pattern[debug_count]); - putchar ('\n'); - } -#endif /* DEBUG */ - - /* Initialize the compile stack. */ - compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t); - if (compile_stack.stack == NULL) - return REG_ESPACE; - - compile_stack.size = INIT_COMPILE_STACK_SIZE; - compile_stack.avail = 0; - - /* Initialize the pattern buffer. */ - bufp->syntax = syntax; - bufp->fastmap_accurate = 0; - bufp->not_bol = bufp->not_eol = 0; - - /* Set `used' to zero, so that if we return an error, the pattern - printer (for debugging) will think there's no pattern. We reset it - at the end. */ - bufp->used = 0; - - /* Always count groups, whether or not bufp->no_sub is set. */ - bufp->re_nsub = 0; - -#if !defined (emacs) && !defined (SYNTAX_TABLE) - /* Initialize the syntax table. */ - init_syntax_once (); -#endif - - if (bufp->allocated == 0) - { - if (bufp->buffer) - { /* If zero allocated, but buffer is non-null, try to realloc - enough space. This loses if buffer's address is bogus, but - that is the user's responsibility. */ - RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char); - } - else - { /* Caller did not allocate a buffer. Do it for them. */ - bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char); - } - if (!bufp->buffer) FREE_STACK_RETURN (REG_ESPACE); - - bufp->allocated = INIT_BUF_SIZE; - } - - begalt = b = bufp->buffer; - - /* Loop through the uncompiled pattern until we're at the end. */ - while (p != pend) - { - PATFETCH (c); - - switch (c) - { - case '^': - { - if ( /* If at start of pattern, it's an operator. */ - p == pattern + 1 - /* If context independent, it's an operator. */ - || syntax & RE_CONTEXT_INDEP_ANCHORS - /* Otherwise, depends on what's come before. */ - || at_begline_loc_p (pattern, p, syntax)) - BUF_PUSH (begline); - else - goto normal_char; - } - break; - - - case '$': - { - if ( /* If at end of pattern, it's an operator. */ - p == pend - /* If context independent, it's an operator. */ - || syntax & RE_CONTEXT_INDEP_ANCHORS - /* Otherwise, depends on what's next. */ - || at_endline_loc_p (p, pend, syntax)) - BUF_PUSH (endline); - else - goto normal_char; - } - break; - - - case '+': - case '?': - if ((syntax & RE_BK_PLUS_QM) - || (syntax & RE_LIMITED_OPS)) - goto normal_char; - handle_plus: - case '*': - /* If there is no previous pattern... */ - if (!laststart) - { - if (syntax & RE_CONTEXT_INVALID_OPS) - FREE_STACK_RETURN (REG_BADRPT); - else if (!(syntax & RE_CONTEXT_INDEP_OPS)) - goto normal_char; - } - - { - /* Are we optimizing this jump? */ - boolean keep_string_p = false; - - /* 1 means zero (many) matches is allowed. */ - char zero_times_ok = 0, many_times_ok = 0; - - /* If there is a sequence of repetition chars, collapse it - down to just one (the right one). We can't combine - interval operators with these because of, e.g., `a{2}*', - which should only match an even number of `a's. */ - - for (;;) - { - zero_times_ok |= c != '+'; - many_times_ok |= c != '?'; - - if (p == pend) - break; - - PATFETCH (c); - - if (c == '*' - || (!(syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?'))) - ; - - else if (syntax & RE_BK_PLUS_QM && c == '\\') - { - if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); - - PATFETCH (c1); - if (!(c1 == '+' || c1 == '?')) - { - PATUNFETCH; - PATUNFETCH; - break; - } - - c = c1; - } - else - { - PATUNFETCH; - break; - } - - /* If we get here, we found another repeat character. */ - } - - /* Star, etc. applied to an empty pattern is equivalent - to an empty pattern. */ - if (!laststart) - break; - - /* Now we know whether or not zero matches is allowed - and also whether or not two or more matches is allowed. */ - if (many_times_ok) - { /* More than one repetition is allowed, so put in at the - end a backward relative jump from `b' to before the next - jump we're going to put in below (which jumps from - laststart to after this jump). - - But if we are at the `*' in the exact sequence `.*\n', - insert an unconditional jump backwards to the ., - instead of the beginning of the loop. This way we only - push a failure point once, instead of every time - through the loop. */ - assert (p - 1 > pattern); - - /* Allocate the space for the jump. */ - GET_BUFFER_SPACE (3); - - /* We know we are not at the first character of the pattern, - because laststart was nonzero. And we've already - incremented `p', by the way, to be the character after - the `*'. Do we have to do something analogous here - for null bytes, because of RE_DOT_NOT_NULL? */ - if (TRANSLATE (*(p - 2)) == TRANSLATE ('.') - && zero_times_ok - && p < pend && TRANSLATE (*p) == TRANSLATE ('\n') - && !(syntax & RE_DOT_NEWLINE)) - { /* We have .*\n. */ - STORE_JUMP (jump, b, laststart); - keep_string_p = true; - } - else - /* Anything else. */ - STORE_JUMP (maybe_pop_jump, b, laststart - 3); - - /* We've added more stuff to the buffer. */ - b += 3; - } - - /* On failure, jump from laststart to b + 3, which will be the - end of the buffer after this jump is inserted. */ - GET_BUFFER_SPACE (3); - INSERT_JUMP (keep_string_p ? on_failure_keep_string_jump - : on_failure_jump, - laststart, b + 3); - pending_exact = 0; - b += 3; - - if (!zero_times_ok) - { - /* At least one repetition is required, so insert a - `dummy_failure_jump' before the initial - `on_failure_jump' instruction of the loop. This - effects a skip over that instruction the first time - we hit that loop. */ - GET_BUFFER_SPACE (3); - INSERT_JUMP (dummy_failure_jump, laststart, laststart + 6); - b += 3; - } - } - break; - - - case '.': - laststart = b; - BUF_PUSH (anychar); - break; - - - case '[': - { - boolean had_char_class = false; - - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); - - /* Ensure that we have enough space to push a charset: the - opcode, the length count, and the bitset; 34 bytes in all. */ - GET_BUFFER_SPACE (34); - - laststart = b; - - /* We test `*p == '^' twice, instead of using an if - statement, so we only need one BUF_PUSH. */ - BUF_PUSH (*p == '^' ? charset_not : charset); - if (*p == '^') - p++; - - /* Remember the first position in the bracket expression. */ - p1 = p; - - /* Push the number of bytes in the bitmap. */ - BUF_PUSH ((1 << BYTEWIDTH) / BYTEWIDTH); - - /* Clear the whole map. */ - bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); - - /* charset_not matches newline according to a syntax bit. */ - if ((re_opcode_t) b[-2] == charset_not - && (syntax & RE_HAT_LISTS_NOT_NEWLINE)) - SET_LIST_BIT ('\n'); - - /* Read in characters and ranges, setting map bits. */ - for (;;) - { - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); - - PATFETCH (c); - - /* \ might escape characters inside [...] and [^...]. */ - if ((syntax & RE_BACKSLASH_ESCAPE_IN_LISTS) && c == '\\') - { - if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); - - PATFETCH (c1); - SET_LIST_BIT (c1); - continue; - } - - /* Could be the end of the bracket expression. If it's - not (i.e., when the bracket expression is `[]' so - far), the ']' character bit gets set way below. */ - if (c == ']' && p != p1 + 1) - break; - - /* Look ahead to see if it's a range when the last thing - was a character class. */ - if (had_char_class && c == '-' && *p != ']') - FREE_STACK_RETURN (REG_ERANGE); - - /* Look ahead to see if it's a range when the last thing - was a character: if this is a hyphen not at the - beginning or the end of a list, then it's the range - operator. */ - if (c == '-' - && !(p - 2 >= pattern && p[-2] == '[') - && !(p - 3 >= pattern && p[-3] == '[' && p[-2] == '^') - && *p != ']') - { - reg_errcode_t ret - = compile_range (&p, pend, translate, syntax, b); - if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); - } - - else if (p[0] == '-' && p[1] != ']') - { /* This handles ranges made up of characters only. */ - reg_errcode_t ret; - - /* Move past the `-'. */ - PATFETCH (c1); - - ret = compile_range (&p, pend, translate, syntax, b); - if (ret != REG_NOERROR) FREE_STACK_RETURN (ret); - } - - /* See if we're at the beginning of a possible character - class. */ - - else if (syntax & RE_CHAR_CLASSES && c == '[' && *p == ':') - { /* Leave room for the null. */ - char str[CHAR_CLASS_MAX_LENGTH + 1]; - - PATFETCH (c); - c1 = 0; - - /* If pattern is `[[:'. */ - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); - - for (;;) - { - PATFETCH (c); - if (c == ':' || c == ']' || p == pend - || c1 == CHAR_CLASS_MAX_LENGTH) - break; - str[c1++] = c; - } - str[c1] = '\0'; - - /* If isn't a word bracketed by `[:' and:`]': - undo the ending character, the letters, and leave - the leading `:' and `[' (but set bits for them). */ - if (c == ':' && *p == ']') - { -#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H) - boolean is_lower = STREQ (str, "lower"); - boolean is_upper = STREQ (str, "upper"); - wctype_t wt; - int ch; - - wt = wctype (str); - if (wt == 0) - FREE_STACK_RETURN (REG_ECTYPE); - - /* Throw away the ] at the end of the character - class. */ - PATFETCH (c); - - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); - - for (ch = 0; ch < 1 << BYTEWIDTH; ++ch) - { - if (iswctype (btowc (ch), wt)) - SET_LIST_BIT (ch); - - if (translate && (is_upper || is_lower) - && (ISUPPER (ch) || ISLOWER (ch))) - SET_LIST_BIT (ch); - } - - had_char_class = true; -#else - int ch; - boolean is_alnum = STREQ (str, "alnum"); - boolean is_alpha = STREQ (str, "alpha"); - boolean is_blank = STREQ (str, "blank"); - boolean is_cntrl = STREQ (str, "cntrl"); - boolean is_digit = STREQ (str, "digit"); - boolean is_graph = STREQ (str, "graph"); - boolean is_lower = STREQ (str, "lower"); - boolean is_print = STREQ (str, "print"); - boolean is_punct = STREQ (str, "punct"); - boolean is_space = STREQ (str, "space"); - boolean is_upper = STREQ (str, "upper"); - boolean is_xdigit = STREQ (str, "xdigit"); - - if (!IS_CHAR_CLASS (str)) - FREE_STACK_RETURN (REG_ECTYPE); - - /* Throw away the ] at the end of the character - class. */ - PATFETCH (c); - - if (p == pend) FREE_STACK_RETURN (REG_EBRACK); - - for (ch = 0; ch < 1 << BYTEWIDTH; ch++) - { - /* This was split into 3 if's to - avoid an arbitrary limit in some compiler. */ - if ( (is_alnum && ISALNUM (ch)) - || (is_alpha && ISALPHA (ch)) - || (is_blank && ISBLANK (ch)) - || (is_cntrl && ISCNTRL (ch))) - SET_LIST_BIT (ch); - if ( (is_digit && ISDIGIT (ch)) - || (is_graph && ISGRAPH (ch)) - || (is_lower && ISLOWER (ch)) - || (is_print && ISPRINT (ch))) - SET_LIST_BIT (ch); - if ( (is_punct && ISPUNCT (ch)) - || (is_space && ISSPACE (ch)) - || (is_upper && ISUPPER (ch)) - || (is_xdigit && ISXDIGIT (ch))) - SET_LIST_BIT (ch); - if ( translate && (is_upper || is_lower) - && (ISUPPER (ch) || ISLOWER (ch))) - SET_LIST_BIT (ch); - } - had_char_class = true; -#endif /* libc || wctype.h */ - } - else - { - c1++; - while (c1--) - PATUNFETCH; - SET_LIST_BIT ('['); - SET_LIST_BIT (':'); - had_char_class = false; - } - } - else - { - had_char_class = false; - SET_LIST_BIT (c); - } - } - - /* Discard any (non)matching list bytes that are all 0 at the - end of the map. Decrease the map-length byte too. */ - while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) - b[-1]--; - b += b[-1]; - } - break; - - - case '(': - if (syntax & RE_NO_BK_PARENS) - goto handle_open; - else - goto normal_char; - - - case ')': - if (syntax & RE_NO_BK_PARENS) - goto handle_close; - else - goto normal_char; - - - case '\n': - if (syntax & RE_NEWLINE_ALT) - goto handle_alt; - else - goto normal_char; - - - case '|': - if (syntax & RE_NO_BK_VBAR) - goto handle_alt; - else - goto normal_char; - - - case '{': - if (syntax & RE_INTERVALS && syntax & RE_NO_BK_BRACES) - goto handle_interval; - else - goto normal_char; - - - case '\\': - if (p == pend) FREE_STACK_RETURN (REG_EESCAPE); - - /* Do not translate the character after the \, so that we can - distinguish, e.g., \B from \b, even if we normally would - translate, e.g., B to b. */ - PATFETCH_RAW (c); - - switch (c) - { - case '(': - if (syntax & RE_NO_BK_PARENS) - goto normal_backslash; - - handle_open: - bufp->re_nsub++; - regnum++; - - if (COMPILE_STACK_FULL) - { - RETALLOC (compile_stack.stack, compile_stack.size << 1, - compile_stack_elt_t); - if (compile_stack.stack == NULL) return REG_ESPACE; - - compile_stack.size <<= 1; - } - - /* These are the values to restore when we hit end of this - group. They are all relative offsets, so that if the - whole pattern moves because of realloc, they will still - be valid. */ - COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; - COMPILE_STACK_TOP.fixup_alt_jump - = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; - COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; - COMPILE_STACK_TOP.regnum = regnum; - - /* We will eventually replace the 0 with the number of - groups inner to this one. But do not push a - start_memory for groups beyond the last one we can - represent in the compiled pattern. */ - if (regnum <= MAX_REGNUM) - { - COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2; - BUF_PUSH_3 (start_memory, regnum, 0); - } - - compile_stack.avail++; - - fixup_alt_jump = 0; - laststart = 0; - begalt = b; - /* If we've reached MAX_REGNUM groups, then this open - won't actually generate any code, so we'll have to - clear pending_exact explicitly. */ - pending_exact = 0; - break; - - - case ')': - if (syntax & RE_NO_BK_PARENS) goto normal_backslash; - - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_backslash; - else - FREE_STACK_RETURN (REG_ERPAREN); - - handle_close: - if (fixup_alt_jump) - { /* Push a dummy failure point at the end of the - alternative for a possible future - `pop_failure_jump' to pop. See comments at - `push_dummy_failure' in `re_match_2'. */ - BUF_PUSH (push_dummy_failure); - - /* We allocated space for this jump when we assigned - to `fixup_alt_jump', in the `handle_alt' case below. */ - STORE_JUMP (jump_past_alt, fixup_alt_jump, b - 1); - } - - /* See similar code for backslashed left paren above. */ - if (COMPILE_STACK_EMPTY) - if (syntax & RE_UNMATCHED_RIGHT_PAREN_ORD) - goto normal_char; - else - FREE_STACK_RETURN (REG_ERPAREN); - - /* Since we just checked for an empty stack above, this - ``can't happen''. */ - assert (compile_stack.avail != 0); - { - /* We don't just want to restore into `regnum', because - later groups should continue to be numbered higher, - as in `(ab)c(de)' -- the second group is #2. */ - regnum_t this_group_regnum; - - compile_stack.avail--; - begalt = bufp->buffer + COMPILE_STACK_TOP.begalt_offset; - fixup_alt_jump - = COMPILE_STACK_TOP.fixup_alt_jump - ? bufp->buffer + COMPILE_STACK_TOP.fixup_alt_jump - 1 - : 0; - laststart = bufp->buffer + COMPILE_STACK_TOP.laststart_offset; - this_group_regnum = COMPILE_STACK_TOP.regnum; - /* If we've reached MAX_REGNUM groups, then this open - won't actually generate any code, so we'll have to - clear pending_exact explicitly. */ - pending_exact = 0; - - /* We're at the end of the group, so now we know how many - groups were inside this one. */ - if (this_group_regnum <= MAX_REGNUM) - { - unsigned char *inner_group_loc - = bufp->buffer + COMPILE_STACK_TOP.inner_group_offset; - - *inner_group_loc = regnum - this_group_regnum; - BUF_PUSH_3 (stop_memory, this_group_regnum, - regnum - this_group_regnum); - } - } - break; - - - case '|': /* `\|'. */ - if (syntax & RE_LIMITED_OPS || syntax & RE_NO_BK_VBAR) - goto normal_backslash; - handle_alt: - if (syntax & RE_LIMITED_OPS) - goto normal_char; - - /* Insert before the previous alternative a jump which - jumps to this alternative if the former fails. */ - GET_BUFFER_SPACE (3); - INSERT_JUMP (on_failure_jump, begalt, b + 6); - pending_exact = 0; - b += 3; - - /* The alternative before this one has a jump after it - which gets executed if it gets matched. Adjust that - jump so it will jump to this alternative's analogous - jump (put in below, which in turn will jump to the next - (if any) alternative's such jump, etc.). The last such - jump jumps to the correct final destination. A picture: - _____ _____ - | | | | - | v | v - a | b | c - - If we are at `b', then fixup_alt_jump right now points to a - three-byte space after `a'. We'll put in the jump, set - fixup_alt_jump to right after `b', and leave behind three - bytes which we'll fill in when we get to after `c'. */ - - if (fixup_alt_jump) - STORE_JUMP (jump_past_alt, fixup_alt_jump, b); - - /* Mark and leave space for a jump after this alternative, - to be filled in later either by next alternative or - when know we're at the end of a series of alternatives. */ - fixup_alt_jump = b; - GET_BUFFER_SPACE (3); - b += 3; - - laststart = 0; - begalt = b; - break; - - - case '{': - /* If \{ is a literal. */ - if (!(syntax & RE_INTERVALS) - /* If we're at `\{' and it's not the open-interval - operator. */ - || ((syntax & RE_INTERVALS) && (syntax & RE_NO_BK_BRACES)) - || (p - 2 == pattern && p == pend)) - goto normal_backslash; - - handle_interval: - { - /* If got here, then the syntax allows intervals. */ - - /* At least (most) this many matches must be made. */ - int lower_bound = -1, upper_bound = -1; - - beg_interval = p - 1; - - if (p == pend) - { - if (syntax & RE_NO_BK_BRACES) - goto unfetch_interval; - else - FREE_STACK_RETURN (REG_EBRACE); - } - - GET_UNSIGNED_NUMBER (lower_bound); - - if (c == ',') - { - GET_UNSIGNED_NUMBER (upper_bound); - if (upper_bound < 0) upper_bound = RE_DUP_MAX; - } - else - /* Interval such as `{1}' => match exactly once. */ - upper_bound = lower_bound; - - if (lower_bound < 0 || upper_bound > RE_DUP_MAX - || lower_bound > upper_bound) - { - if (syntax & RE_NO_BK_BRACES) - goto unfetch_interval; - else - FREE_STACK_RETURN (REG_BADBR); - } - - if (!(syntax & RE_NO_BK_BRACES)) - { - if (c != '\\') FREE_STACK_RETURN (REG_EBRACE); - - PATFETCH (c); - } - - if (c != '}') - { - if (syntax & RE_NO_BK_BRACES) - goto unfetch_interval; - else - FREE_STACK_RETURN (REG_BADBR); - } - - /* We just parsed a valid interval. */ - - /* If it's invalid to have no preceding re. */ - if (!laststart) - { - if (syntax & RE_CONTEXT_INVALID_OPS) - FREE_STACK_RETURN (REG_BADRPT); - else if (syntax & RE_CONTEXT_INDEP_OPS) - laststart = b; - else - goto unfetch_interval; - } - - /* If the upper bound is zero, don't want to succeed at - all; jump from `laststart' to `b + 3', which will be - the end of the buffer after we insert the jump. */ - if (upper_bound == 0) - { - GET_BUFFER_SPACE (3); - INSERT_JUMP (jump, laststart, b + 3); - b += 3; - } - - /* Otherwise, we have a nontrivial interval. When - we're all done, the pattern will look like: - set_number_at <jump count> <upper bound> - set_number_at <succeed_n count> <lower bound> - succeed_n <after jump addr> <succeed_n count> - <body of loop> - jump_n <succeed_n addr> <jump count> - (The upper bound and `jump_n' are omitted if - `upper_bound' is 1, though.) */ - else - { /* If the upper bound is > 1, we need to insert - more at the end of the loop. */ - unsigned nbytes = 10 + (upper_bound > 1) * 10; - - GET_BUFFER_SPACE (nbytes); - - /* Initialize lower bound of the `succeed_n', even - though it will be set during matching by its - attendant `set_number_at' (inserted next), - because `re_compile_fastmap' needs to know. - Jump to the `jump_n' we might insert below. */ - INSERT_JUMP2 (succeed_n, laststart, - b + 5 + (upper_bound > 1) * 5, - lower_bound); - b += 5; - - /* Code to initialize the lower bound. Insert - before the `succeed_n'. The `5' is the last two - bytes of this `set_number_at', plus 3 bytes of - the following `succeed_n'. */ - insert_op2 (set_number_at, laststart, 5, lower_bound, b); - b += 5; - - if (upper_bound > 1) - { /* More than one repetition is allowed, so - append a backward jump to the `succeed_n' - that starts this interval. - - When we've reached this during matching, - we'll have matched the interval once, so - jump back only `upper_bound - 1' times. */ - STORE_JUMP2 (jump_n, b, laststart + 5, - upper_bound - 1); - b += 5; - - /* The location we want to set is the second - parameter of the `jump_n'; that is `b-2' as - an absolute address. `laststart' will be - the `set_number_at' we're about to insert; - `laststart+3' the number to set, the source - for the relative address. But we are - inserting into the middle of the pattern -- - so everything is getting moved up by 5. - Conclusion: (b - 2) - (laststart + 3) + 5, - i.e., b - laststart. - - We insert this at the beginning of the loop - so that if we fail during matching, we'll - reinitialize the bounds. */ - insert_op2 (set_number_at, laststart, b - laststart, - upper_bound - 1, b); - b += 5; - } - } - pending_exact = 0; - beg_interval = NULL; - } - break; - - unfetch_interval: - /* If an invalid interval, match the characters as literals. */ - assert (beg_interval); - p = beg_interval; - beg_interval = NULL; - - /* normal_char and normal_backslash need `c'. */ - PATFETCH (c); - - if (!(syntax & RE_NO_BK_BRACES)) - { - if (p > pattern && p[-1] == '\\') - goto normal_backslash; - } - goto normal_char; - -#ifdef emacs - /* There is no way to specify the before_dot and after_dot - operators. rms says this is ok. --karl */ - case '=': - BUF_PUSH (at_dot); - break; - - case 's': - laststart = b; - PATFETCH (c); - BUF_PUSH_2 (syntaxspec, syntax_spec_code[c]); - break; - - case 'S': - laststart = b; - PATFETCH (c); - BUF_PUSH_2 (notsyntaxspec, syntax_spec_code[c]); - break; -#endif /* emacs */ - - - case 'w': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - laststart = b; - BUF_PUSH (wordchar); - break; - - - case 'W': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - laststart = b; - BUF_PUSH (notwordchar); - break; - - - case '<': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - BUF_PUSH (wordbeg); - break; - - case '>': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - BUF_PUSH (wordend); - break; - - case 'b': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - BUF_PUSH (wordbound); - break; - - case 'B': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - BUF_PUSH (notwordbound); - break; - - case '`': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - BUF_PUSH (begbuf); - break; - - case '\'': - if (re_syntax_options & RE_NO_GNU_OPS) - goto normal_char; - BUF_PUSH (endbuf); - break; - - case '1': case '2': case '3': case '4': case '5': - case '6': case '7': case '8': case '9': - if (syntax & RE_NO_BK_REFS) - goto normal_char; - - c1 = c - '0'; - - if (c1 > regnum) - FREE_STACK_RETURN (REG_ESUBREG); - - /* Can't back reference to a subexpression if inside of it. */ - if (group_in_compile_stack (compile_stack, (regnum_t) c1)) - goto normal_char; - - laststart = b; - BUF_PUSH_2 (duplicate, c1); - break; - - - case '+': - case '?': - if (syntax & RE_BK_PLUS_QM) - goto handle_plus; - else - goto normal_backslash; - - default: - normal_backslash: - /* You might think it would be useful for \ to mean - not to translate; but if we don't translate it - it will never match anything. */ - c = TRANSLATE (c); - goto normal_char; - } - break; - - - default: - /* Expects the character in `c'. */ - normal_char: - /* If no exactn currently being built. */ - if (!pending_exact - - /* If last exactn not at current position. */ - || pending_exact + *pending_exact + 1 != b - - /* We have only one byte following the exactn for the count. */ - || *pending_exact == (1 << BYTEWIDTH) - 1 - - /* If followed by a repetition operator. */ - || *p == '*' || *p == '^' - || ((syntax & RE_BK_PLUS_QM) - ? *p == '\\' && (p[1] == '+' || p[1] == '?') - : (*p == '+' || *p == '?')) - || ((syntax & RE_INTERVALS) - && ((syntax & RE_NO_BK_BRACES) - ? *p == '{' - : (p[0] == '\\' && p[1] == '{')))) - { - /* Start building a new exactn. */ - - laststart = b; - - BUF_PUSH_2 (exactn, 0); - pending_exact = b - 1; - } - - BUF_PUSH (c); - (*pending_exact)++; - break; - } /* switch (c) */ - } /* while p != pend */ - - - /* Through the pattern now. */ - - if (fixup_alt_jump) - STORE_JUMP (jump_past_alt, fixup_alt_jump, b); - - if (!COMPILE_STACK_EMPTY) - FREE_STACK_RETURN (REG_EPAREN); - - /* If we don't want backtracking, force success - the first time we reach the end of the compiled pattern. */ - if (syntax & RE_NO_POSIX_BACKTRACKING) - BUF_PUSH (succeed); - - free (compile_stack.stack); - - /* We have succeeded; set the length of the buffer. */ - bufp->used = b - bufp->buffer; - -#ifdef DEBUG - if (debug) - { - DEBUG_PRINT1 ("\nCompiled pattern: \n"); - print_compiled_pattern (bufp); - } -#endif /* DEBUG */ - -#ifndef MATCH_MAY_ALLOCATE - /* Initialize the failure stack to the largest possible stack. This - isn't necessary unless we're trying to avoid calling alloca in - the search and match routines. */ - { - int num_regs = bufp->re_nsub + 1; - - /* Since DOUBLE_FAIL_STACK refuses to double only if the current size - is strictly greater than re_max_failures, the largest possible stack - is 2 * re_max_failures failure points. */ - if (fail_stack.size < (2 * re_max_failures * MAX_FAILURE_ITEMS)) - { - fail_stack.size = (2 * re_max_failures * MAX_FAILURE_ITEMS); - -#ifdef emacs - if (! fail_stack.stack) - fail_stack.stack - = (fail_stack_elt_t *) xmalloc (fail_stack.size - * sizeof (fail_stack_elt_t)); - else - fail_stack.stack - = (fail_stack_elt_t *) xrealloc (fail_stack.stack, - (fail_stack.size - * sizeof (fail_stack_elt_t))); -#else /* not emacs */ - if (! fail_stack.stack) - fail_stack.stack - = (fail_stack_elt_t *) malloc (fail_stack.size - * sizeof (fail_stack_elt_t)); - else - fail_stack.stack - = (fail_stack_elt_t *) realloc (fail_stack.stack, - (fail_stack.size - * sizeof (fail_stack_elt_t))); -#endif /* not emacs */ - } - - regex_grow_registers (num_regs); - } -#endif /* not MATCH_MAY_ALLOCATE */ - - return REG_NOERROR; -} /* regex_compile */ - -/* Subroutines for `regex_compile'. */ - -/* Store OP at LOC followed by two-byte integer parameter ARG. */ - -static void -store_op1 (op, loc, arg) - re_opcode_t op; - unsigned char *loc; - int arg; -{ - *loc = (unsigned char) op; - STORE_NUMBER (loc + 1, arg); -} - - -/* Like `store_op1', but for two two-byte parameters ARG1 and ARG2. */ - -static void -store_op2 (op, loc, arg1, arg2) - re_opcode_t op; - unsigned char *loc; - int arg1, arg2; -{ - *loc = (unsigned char) op; - STORE_NUMBER (loc + 1, arg1); - STORE_NUMBER (loc + 3, arg2); -} - - -/* Copy the bytes from LOC to END to open up three bytes of space at LOC - for OP followed by two-byte integer parameter ARG. */ - -static void -insert_op1 (op, loc, arg, end) - re_opcode_t op; - unsigned char *loc; - int arg; - unsigned char *end; -{ - register unsigned char *pfrom = end; - register unsigned char *pto = end + 3; - - while (pfrom != loc) - *--pto = *--pfrom; - - store_op1 (op, loc, arg); -} - - -/* Like `insert_op1', but for two two-byte parameters ARG1 and ARG2. */ - -static void -insert_op2 (op, loc, arg1, arg2, end) - re_opcode_t op; - unsigned char *loc; - int arg1, arg2; - unsigned char *end; -{ - register unsigned char *pfrom = end; - register unsigned char *pto = end + 5; - - while (pfrom != loc) - *--pto = *--pfrom; - - store_op2 (op, loc, arg1, arg2); -} - - -/* P points to just after a ^ in PATTERN. Return true if that ^ comes - after an alternative or a begin-subexpression. We assume there is at - least one character before the ^. */ - -static boolean -at_begline_loc_p (pattern, p, syntax) - const char *pattern, *p; - reg_syntax_t syntax; -{ - const char *prev = p - 2; - boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\'; - - return - /* After a subexpression? */ - (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash)) - /* After an alternative? */ - || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash)); -} - - -/* The dual of at_begline_loc_p. This one is for $. We assume there is - at least one character after the $, i.e., `P < PEND'. */ - -static boolean -at_endline_loc_p (p, pend, syntax) - const char *p, *pend; - reg_syntax_t syntax; -{ - const char *next = p; - boolean next_backslash = *next == '\\'; - const char *next_next = p + 1 < pend ? p + 1 : 0; - - return - /* Before a subexpression? */ - (syntax & RE_NO_BK_PARENS ? *next == ')' - : next_backslash && next_next && *next_next == ')') - /* Before an alternative? */ - || (syntax & RE_NO_BK_VBAR ? *next == '|' - : next_backslash && next_next && *next_next == '|'); -} - - -/* Returns true if REGNUM is in one of COMPILE_STACK's elements and - false if it's not. */ - -static boolean -group_in_compile_stack (compile_stack, regnum) - compile_stack_type compile_stack; - regnum_t regnum; -{ - int this_element; - - for (this_element = compile_stack.avail - 1; - this_element >= 0; - this_element--) - if (compile_stack.stack[this_element].regnum == regnum) - return true; - - return false; -} - - -/* Read the ending character of a range (in a bracket expression) from the - uncompiled pattern *P_PTR (which ends at PEND). We assume the - starting character is in `P[-2]'. (`P[-1]' is the character `-'.) - Then we set the translation of all bits between the starting and - ending characters (inclusive) in the compiled pattern B. - - Return an error code. - - We use these short variable names so we can use the same macros as - `regex_compile' itself. */ - -static reg_errcode_t -compile_range (p_ptr, pend, translate, syntax, b) - const char **p_ptr, *pend; - RE_TRANSLATE_TYPE translate; - reg_syntax_t syntax; - unsigned char *b; -{ - unsigned this_char; - - const char *p = *p_ptr; - unsigned int range_start, range_end; - - if (p == pend) - return REG_ERANGE; - - /* Even though the pattern is a signed `char *', we need to fetch - with unsigned char *'s; if the high bit of the pattern character - is set, the range endpoints will be negative if we fetch using a - signed char *. - - We also want to fetch the endpoints without translating them; the - appropriate translation is done in the bit-setting loop below. */ - /* The SVR4 compiler on the 3B2 had trouble with unsigned const char *. */ - range_start = ((const unsigned char *) p)[-2]; - range_end = ((const unsigned char *) p)[0]; - - /* Have to increment the pointer into the pattern string, so the - caller isn't still at the ending character. */ - (*p_ptr)++; - - /* If the start is after the end, the range is empty. */ - if (range_start > range_end) - return syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR; - - /* Here we see why `this_char' has to be larger than an `unsigned - char' -- the range is inclusive, so if `range_end' == 0xff - (assuming 8-bit characters), we would otherwise go into an infinite - loop, since all characters <= 0xff. */ - for (this_char = range_start; this_char <= range_end; this_char++) - { - SET_LIST_BIT (TRANSLATE (this_char)); - } - - return REG_NOERROR; -} - -/* re_compile_fastmap computes a ``fastmap'' for the compiled pattern in - BUFP. A fastmap records which of the (1 << BYTEWIDTH) possible - characters can start a string that matches the pattern. This fastmap - is used by re_search to skip quickly over impossible starting points. - - The caller must supply the address of a (1 << BYTEWIDTH)-byte data - area as BUFP->fastmap. - - We set the `fastmap', `fastmap_accurate', and `can_be_null' fields in - the pattern buffer. - - Returns 0 if we succeed, -2 if an internal error. */ - -int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; -{ - int j, k; -#ifdef MATCH_MAY_ALLOCATE - fail_stack_type fail_stack; -#endif -#ifndef REGEX_MALLOC - char *destination; -#endif - - register char *fastmap = bufp->fastmap; - unsigned char *pattern = bufp->buffer; - unsigned char *p = pattern; - register unsigned char *pend = pattern + bufp->used; - -#ifdef REL_ALLOC - /* This holds the pointer to the failure stack, when - it is allocated relocatably. */ - fail_stack_elt_t *failure_stack_ptr; -#endif - - /* Assume that each path through the pattern can be null until - proven otherwise. We set this false at the bottom of switch - statement, to which we get only if a particular path doesn't - match the empty string. */ - boolean path_can_be_null = true; - - /* We aren't doing a `succeed_n' to begin with. */ - boolean succeed_n_p = false; - - assert (fastmap != NULL && p != NULL); - - INIT_FAIL_STACK (); - bzero (fastmap, 1 << BYTEWIDTH); /* Assume nothing's valid. */ - bufp->fastmap_accurate = 1; /* It will be when we're done. */ - bufp->can_be_null = 0; - - while (1) - { - if (p == pend || *p == succeed) - { - /* We have reached the (effective) end of pattern. */ - if (!FAIL_STACK_EMPTY ()) - { - bufp->can_be_null |= path_can_be_null; - - /* Reset for next path. */ - path_can_be_null = true; - - p = fail_stack.stack[--fail_stack.avail].pointer; - - continue; - } - else - break; - } - - /* We should never be about to go beyond the end of the pattern. */ - assert (p < pend); - - switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) - { - - /* I guess the idea here is to simply not bother with a fastmap - if a backreference is used, since it's too hard to figure out - the fastmap for the corresponding group. Setting - `can_be_null' stops `re_search_2' from using the fastmap, so - that is all we do. */ - case duplicate: - bufp->can_be_null = 1; - goto done; - - - /* Following are the cases which match a character. These end - with `break'. */ - - case exactn: - fastmap[p[1]] = 1; - break; - - - case charset: - for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) - if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) - fastmap[j] = 1; - break; - - - case charset_not: - /* Chars beyond end of map must be allowed. */ - for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) - fastmap[j] = 1; - - for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) - if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) - fastmap[j] = 1; - break; - - - case wordchar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) == Sword) - fastmap[j] = 1; - break; - - - case notwordchar: - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) != Sword) - fastmap[j] = 1; - break; - - - case anychar: - { - int fastmap_newline = fastmap['\n']; - - /* `.' matches anything ... */ - for (j = 0; j < (1 << BYTEWIDTH); j++) - fastmap[j] = 1; - - /* ... except perhaps newline. */ - if (!(bufp->syntax & RE_DOT_NEWLINE)) - fastmap['\n'] = fastmap_newline; - - /* Return if we have already set `can_be_null'; if we have, - then the fastmap is irrelevant. Something's wrong here. */ - else if (bufp->can_be_null) - goto done; - - /* Otherwise, have to check alternative paths. */ - break; - } - -#ifdef emacs - case syntaxspec: - k = *p++; - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) == (enum syntaxcode) k) - fastmap[j] = 1; - break; - - - case notsyntaxspec: - k = *p++; - for (j = 0; j < (1 << BYTEWIDTH); j++) - if (SYNTAX (j) != (enum syntaxcode) k) - fastmap[j] = 1; - break; - - - /* All cases after this match the empty string. These end with - `continue'. */ - - - case before_dot: - case at_dot: - case after_dot: - continue; -#endif /* emacs */ - - - case no_op: - case begline: - case endline: - case begbuf: - case endbuf: - case wordbound: - case notwordbound: - case wordbeg: - case wordend: - case push_dummy_failure: - continue; - - - case jump_n: - case pop_failure_jump: - case maybe_pop_jump: - case jump: - case jump_past_alt: - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR (j, p); - p += j; - if (j > 0) - continue; - - /* Jump backward implies we just went through the body of a - loop and matched nothing. Opcode jumped to should be - `on_failure_jump' or `succeed_n'. Just treat it like an - ordinary jump. For a * loop, it has pushed its failure - point already; if so, discard that as redundant. */ - if ((re_opcode_t) *p != on_failure_jump - && (re_opcode_t) *p != succeed_n) - continue; - - p++; - EXTRACT_NUMBER_AND_INCR (j, p); - p += j; - - /* If what's on the stack is where we are now, pop it. */ - if (!FAIL_STACK_EMPTY () - && fail_stack.stack[fail_stack.avail - 1].pointer == p) - fail_stack.avail--; - - continue; - - - case on_failure_jump: - case on_failure_keep_string_jump: - handle_on_failure_jump: - EXTRACT_NUMBER_AND_INCR (j, p); - - /* For some patterns, e.g., `(a?)?', `p+j' here points to the - end of the pattern. We don't want to push such a point, - since when we restore it above, entering the switch will - increment `p' past the end of the pattern. We don't need - to push such a point since we obviously won't find any more - fastmap entries beyond `pend'. Such a pattern can match - the null string, though. */ - if (p + j < pend) - { - if (!PUSH_PATTERN_OP (p + j, fail_stack)) - { - RESET_FAIL_STACK (); - return -2; - } - } - else - bufp->can_be_null = 1; - - if (succeed_n_p) - { - EXTRACT_NUMBER_AND_INCR (k, p); /* Skip the n. */ - succeed_n_p = false; - } - - continue; - - - case succeed_n: - /* Get to the number of times to succeed. */ - p += 2; - - /* Increment p past the n for when k != 0. */ - EXTRACT_NUMBER_AND_INCR (k, p); - if (k == 0) - { - p -= 4; - succeed_n_p = true; /* Spaghetti code alert. */ - goto handle_on_failure_jump; - } - continue; - - - case set_number_at: - p += 4; - continue; - - - case start_memory: - case stop_memory: - p += 2; - continue; - - - default: - abort (); /* We have listed all the cases. */ - } /* switch *p++ */ - - /* Getting here means we have found the possible starting - characters for one path of the pattern -- and that the empty - string does not match. We need not follow this path further. - Instead, look at the next alternative (remembered on the - stack), or quit if no more. The test at the top of the loop - does these things. */ - path_can_be_null = false; - p = pend; - } /* while p */ - - /* Set `can_be_null' for the last path (also the first path, if the - pattern is empty). */ - bufp->can_be_null |= path_can_be_null; - - done: - RESET_FAIL_STACK (); - return 0; -} /* re_compile_fastmap */ - -/* Set REGS to hold NUM_REGS registers, storing them in STARTS and - ENDS. Subsequent matches using PATTERN_BUFFER and REGS will use - this memory for recording register information. STARTS and ENDS - must be allocated using the malloc library routine, and must each - be at least NUM_REGS * sizeof (regoff_t) bytes long. - - If NUM_REGS == 0, then subsequent matches should allocate their own - register data. - - Unless this function is called, the first search or match using - PATTERN_BUFFER will allocate its own register data, without - freeing the old data. */ - -void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - unsigned num_regs; - regoff_t *starts, *ends; -{ - if (num_regs) - { - bufp->regs_allocated = REGS_REALLOCATE; - regs->num_regs = num_regs; - regs->start = starts; - regs->end = ends; - } - else - { - bufp->regs_allocated = REGS_UNALLOCATED; - regs->num_regs = 0; - regs->start = regs->end = (regoff_t *) 0; - } -} - -/* Searching routines. */ - -/* Like re_search_2, below, but only one string is specified, and - doesn't let you say where to stop matching. */ - -int -re_search (bufp, string, size, startpos, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, startpos, range; - struct re_registers *regs; -{ - return re_search_2 (bufp, NULL, 0, string, size, startpos, range, - regs, size); -} - - -/* Using the compiled pattern in BUFP->buffer, first tries to match the - virtual concatenation of STRING1 and STRING2, starting first at index - STARTPOS, then at STARTPOS + 1, and so on. - - STRING1 and STRING2 have length SIZE1 and SIZE2, respectively. - - RANGE is how far to scan while trying to match. RANGE = 0 means try - only at STARTPOS; in general, the last start tried is STARTPOS + - RANGE. - - In REGS, return the indices of the virtual concatenation of STRING1 - and STRING2 that matched the entire BUFP->buffer and its contained - subexpressions. - - Do not consider matching one past the index STOP in the virtual - concatenation of STRING1 and STRING2. - - We return either the position in the strings at which the match was - found, -1 if no match, or -2 if error (such as failure - stack overflow). */ - -int -re_search_2 (bufp, string1, size1, string2, size2, startpos, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int startpos; - int range; - struct re_registers *regs; - int stop; -{ - int val; - register char *fastmap = bufp->fastmap; - register RE_TRANSLATE_TYPE translate = bufp->translate; - int total_size = size1 + size2; - int endpos = startpos + range; - - /* Check for out-of-range STARTPOS. */ - if (startpos < 0 || startpos > total_size) - return -1; - - /* Fix up RANGE if it might eventually take us outside - the virtual concatenation of STRING1 and STRING2. - Make sure we won't move STARTPOS below 0 or above TOTAL_SIZE. */ - if (endpos < 0) - range = 0 - startpos; - else if (endpos > total_size) - range = total_size - startpos; - - /* If the search isn't to be a backwards one, don't waste time in a - search for a pattern that must be anchored. */ - if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == begbuf && range > 0) - { - if (startpos > 0) - return -1; - else - range = 1; - } - -#ifdef emacs - /* In a forward search for something that starts with \=. - don't keep searching past point. */ - if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0) - { - range = PT - startpos; - if (range <= 0) - return -1; - } -#endif /* emacs */ - - /* Update the fastmap now if not correct already. */ - if (fastmap && !bufp->fastmap_accurate) - if (re_compile_fastmap (bufp) == -2) - return -2; - - /* Loop through the string, looking for a place to start matching. */ - for (;;) - { - /* If a fastmap is supplied, skip quickly over characters that - cannot be the start of a match. If the pattern can match the - null string, however, we don't need to skip characters; we want - the first null string. */ - if (fastmap && startpos < total_size && !bufp->can_be_null) - { - if (range > 0) /* Searching forwards. */ - { - register const char *d; - register int lim = 0; - int irange = range; - - if (startpos < size1 && startpos + range >= size1) - lim = range - (size1 - startpos); - - d = (startpos >= size1 ? string2 - size1 : string1) + startpos; - - /* Written out as an if-else to avoid testing `translate' - inside the loop. */ - if (translate) - while (range > lim - && !fastmap[(unsigned char) - translate[(unsigned char) *d++]]) - range--; - else - while (range > lim && !fastmap[(unsigned char) *d++]) - range--; - - startpos += irange - range; - } - else /* Searching backwards. */ - { - register char c = (size1 == 0 || startpos >= size1 - ? string2[startpos - size1] - : string1[startpos]); - - if (!fastmap[(unsigned char) TRANSLATE (c)]) - goto advance; - } - } - - /* If can't match the null string, and that's all we have left, fail. */ - if (range >= 0 && startpos == total_size && fastmap - && !bufp->can_be_null) - return -1; - - val = re_match_2_internal (bufp, string1, size1, string2, size2, - startpos, regs, stop); -#ifndef REGEX_MALLOC -#ifdef C_ALLOCA - alloca (0); -#endif -#endif - - if (val >= 0) - return startpos; - - if (val == -2) - return -2; - - advance: - if (!range) - break; - else if (range > 0) - { - range--; - startpos++; - } - else - { - range++; - startpos--; - } - } - return -1; -} /* re_search_2 */ - -/* This converts PTR, a pointer into one of the search strings `string1' - and `string2' into an offset from the beginning of that string. */ -#define POINTER_TO_OFFSET(ptr) \ - (FIRST_STRING_P (ptr) \ - ? ((regoff_t) ((ptr) - string1)) \ - : ((regoff_t) ((ptr) - string2 + size1))) - -/* Macros for dealing with the split strings in re_match_2. */ - -#define MATCHING_IN_FIRST_STRING (dend == end_match_1) - -/* Call before fetching a character with *d. This switches over to - string2 if necessary. */ -#define PREFETCH() \ - while (d == dend) \ - { \ - /* End of string2 => fail. */ \ - if (dend == end_match_2) \ - goto fail; \ - /* End of string1 => advance to string2. */ \ - d = string2; \ - dend = end_match_2; \ - } - - -/* Test if at very beginning or at very end of the virtual concatenation - of `string1' and `string2'. If only one string, it's `string2'. */ -#define AT_STRINGS_BEG(d) ((d) == (size1 ? string1 : string2) || !size2) -#define AT_STRINGS_END(d) ((d) == end2) - - -/* Test if D points to a character which is word-constituent. We have - two special cases to check for: if past the end of string1, look at - the first character in string2; and if before the beginning of - string2, look at the last character in string1. */ -#define WORDCHAR_P(d) \ - (SYNTAX ((d) == end1 ? *string2 \ - : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \ - == Sword) - -/* Disabled due to a compiler bug -- see comment at case wordbound */ -#if 0 -/* Test if the character before D and the one at D differ with respect - to being word-constituent. */ -#define AT_WORD_BOUNDARY(d) \ - (AT_STRINGS_BEG (d) || AT_STRINGS_END (d) \ - || WORDCHAR_P (d - 1) != WORDCHAR_P (d)) -#endif - -/* Free everything we malloc. */ -#ifdef MATCH_MAY_ALLOCATE -#define FREE_VAR(var) if (var) REGEX_FREE (var); var = NULL -#define FREE_VARIABLES() \ - do { \ - REGEX_FREE_STACK (fail_stack.stack); \ - FREE_VAR (regstart); \ - FREE_VAR (regend); \ - FREE_VAR (old_regstart); \ - FREE_VAR (old_regend); \ - FREE_VAR (best_regstart); \ - FREE_VAR (best_regend); \ - FREE_VAR (reg_info); \ - FREE_VAR (reg_dummy); \ - FREE_VAR (reg_info_dummy); \ - } while (0) -#else -#define FREE_VARIABLES() ((void)0) /* Do nothing! But inhibit gcc warning. */ -#endif /* not MATCH_MAY_ALLOCATE */ - -/* These values must meet several constraints. They must not be valid - register values; since we have a limit of 255 registers (because - we use only one byte in the pattern for the register number), we can - use numbers larger than 255. They must differ by 1, because of - NUM_FAILURE_ITEMS above. And the value for the lowest register must - be larger than the value for the highest register, so we do not try - to actually save any registers when none are active. */ -#define NO_HIGHEST_ACTIVE_REG (1 << BYTEWIDTH) -#define NO_LOWEST_ACTIVE_REG (NO_HIGHEST_ACTIVE_REG + 1) - -/* Matching routines. */ - -#ifndef emacs /* Emacs never uses this. */ -/* re_match is like re_match_2 except it takes only a single string. */ - -int -re_match (bufp, string, size, pos, regs) - struct re_pattern_buffer *bufp; - const char *string; - int size, pos; - struct re_registers *regs; -{ - int result = re_match_2_internal (bufp, NULL, 0, string, size, - pos, regs, size); -#ifndef REGEX_MALLOC -#ifdef C_ALLOCA - alloca (0); -#endif -#endif - return result; -} -#endif /* not emacs */ - -static boolean group_match_null_string_p _RE_ARGS ((unsigned char **p, - unsigned char *end, - register_info_type *reg_info)); -static boolean alt_match_null_string_p _RE_ARGS ((unsigned char *p, - unsigned char *end, - register_info_type *reg_info)); -static boolean common_op_match_null_string_p _RE_ARGS ((unsigned char **p, - unsigned char *end, - register_info_type *reg_info)); -static int bcmp_translate _RE_ARGS ((const char *s1, const char *s2, - int len, char *translate)); - -/* re_match_2 matches the compiled pattern in BUFP against the - the (virtual) concatenation of STRING1 and STRING2 (of length SIZE1 - and SIZE2, respectively). We start matching at POS, and stop - matching at STOP. - - If REGS is non-null and the `no_sub' field of BUFP is nonzero, we - store offsets for the substring each group matched in REGS. See the - documentation for exactly how many groups we fill. - - We return -1 if no match, -2 if an internal error (such as the - failure stack overflowing). Otherwise, we return the length of the - matched substring. */ - -int -re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; -{ - int result = re_match_2_internal (bufp, string1, size1, string2, size2, - pos, regs, stop); -#ifndef REGEX_MALLOC -#ifdef C_ALLOCA - alloca (0); -#endif -#endif - return result; -} - -/* This is a separate function so that we can force an alloca cleanup - afterwards. */ -static int -re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int size1, size2; - int pos; - struct re_registers *regs; - int stop; -{ - /* General temporaries. */ - int mcnt; - unsigned char *p1; - - /* Just past the end of the corresponding string. */ - const char *end1, *end2; - - /* Pointers into string1 and string2, just past the last characters in - each to consider matching. */ - const char *end_match_1, *end_match_2; - - /* Where we are in the data, and the end of the current string. */ - const char *d, *dend; - - /* Where we are in the pattern, and the end of the pattern. */ - unsigned char *p = bufp->buffer; - register unsigned char *pend = p + bufp->used; - - /* Mark the opcode just after a start_memory, so we can test for an - empty subpattern when we get to the stop_memory. */ - unsigned char *just_past_start_mem = 0; - - /* We use this to map every character in the string. */ - RE_TRANSLATE_TYPE translate = bufp->translate; - - /* Failure point stack. Each place that can handle a failure further - down the line pushes a failure point on this stack. It consists of - restart, regend, and reg_info for all registers corresponding to - the subexpressions we're currently inside, plus the number of such - registers, and, finally, two char *'s. The first char * is where - to resume scanning the pattern; the second one is where to resume - scanning the strings. If the latter is zero, the failure point is - a ``dummy''; if a failure happens and the failure point is a dummy, - it gets discarded and the next next one is tried. */ -#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ - fail_stack_type fail_stack; -#endif -#ifdef DEBUG - static unsigned failure_id = 0; - unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0; -#endif - -#ifdef REL_ALLOC - /* This holds the pointer to the failure stack, when - it is allocated relocatably. */ - fail_stack_elt_t *failure_stack_ptr; -#endif - - /* We fill all the registers internally, independent of what we - return, for use in backreferences. The number here includes - an element for register zero. */ - size_t num_regs = bufp->re_nsub + 1; - - /* The currently active registers. */ - active_reg_t lowest_active_reg = NO_LOWEST_ACTIVE_REG; - active_reg_t highest_active_reg = NO_HIGHEST_ACTIVE_REG; - - /* Information on the contents of registers. These are pointers into - the input strings; they record just what was matched (on this - attempt) by a subexpression part of the pattern, that is, the - regnum-th regstart pointer points to where in the pattern we began - matching and the regnum-th regend points to right after where we - stopped matching the regnum-th subexpression. (The zeroth register - keeps track of what the whole pattern matches.) */ -#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ - const char **regstart, **regend; -#endif - - /* If a group that's operated upon by a repetition operator fails to - match anything, then the register for its start will need to be - restored because it will have been set to wherever in the string we - are when we last see its open-group operator. Similarly for a - register's end. */ -#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ - const char **old_regstart, **old_regend; -#endif - - /* The is_active field of reg_info helps us keep track of which (possibly - nested) subexpressions we are currently in. The matched_something - field of reg_info[reg_num] helps us tell whether or not we have - matched any of the pattern so far this time through the reg_num-th - subexpression. These two fields get reset each time through any - loop their register is in. */ -#ifdef MATCH_MAY_ALLOCATE /* otherwise, this is global. */ - register_info_type *reg_info; -#endif - - /* The following record the register info as found in the above - variables when we find a match better than any we've seen before. - This happens as we backtrack through the failure points, which in - turn happens only if we have not yet matched the entire string. */ - unsigned best_regs_set = false; -#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ - const char **best_regstart, **best_regend; -#endif - - /* Logically, this is `best_regend[0]'. But we don't want to have to - allocate space for that if we're not allocating space for anything - else (see below). Also, we never need info about register 0 for - any of the other register vectors, and it seems rather a kludge to - treat `best_regend' differently than the rest. So we keep track of - the end of the best match so far in a separate variable. We - initialize this to NULL so that when we backtrack the first time - and need to test it, it's not garbage. */ - const char *match_end = NULL; - - /* This helps SET_REGS_MATCHED avoid doing redundant work. */ - int set_regs_matched_done = 0; - - /* Used when we pop values we don't care about. */ -#ifdef MATCH_MAY_ALLOCATE /* otherwise, these are global. */ - const char **reg_dummy; - register_info_type *reg_info_dummy; -#endif - -#ifdef DEBUG - /* Counts the total number of registers pushed. */ - unsigned num_regs_pushed = 0; -#endif - - DEBUG_PRINT1 ("\n\nEntering re_match_2.\n"); - - INIT_FAIL_STACK (); - -#ifdef MATCH_MAY_ALLOCATE - /* Do not bother to initialize all the register variables if there are - no groups in the pattern, as it takes a fair amount of time. If - there are groups, we include space for register 0 (the whole - pattern), even though we never use it, since it simplifies the - array indexing. We should fix this. */ - if (bufp->re_nsub) - { - regstart = REGEX_TALLOC (num_regs, const char *); - regend = REGEX_TALLOC (num_regs, const char *); - old_regstart = REGEX_TALLOC (num_regs, const char *); - old_regend = REGEX_TALLOC (num_regs, const char *); - best_regstart = REGEX_TALLOC (num_regs, const char *); - best_regend = REGEX_TALLOC (num_regs, const char *); - reg_info = REGEX_TALLOC (num_regs, register_info_type); - reg_dummy = REGEX_TALLOC (num_regs, const char *); - reg_info_dummy = REGEX_TALLOC (num_regs, register_info_type); - - if (!(regstart && regend && old_regstart && old_regend && reg_info - && best_regstart && best_regend && reg_dummy && reg_info_dummy)) - { - FREE_VARIABLES (); - return -2; - } - } - else - { - /* We must initialize all our variables to NULL, so that - `FREE_VARIABLES' doesn't try to free them. */ - regstart = regend = old_regstart = old_regend = best_regstart - = best_regend = reg_dummy = NULL; - reg_info = reg_info_dummy = (register_info_type *) NULL; - } -#endif /* MATCH_MAY_ALLOCATE */ - - /* The starting position is bogus. */ - if (pos < 0 || pos > size1 + size2) - { - FREE_VARIABLES (); - return -1; - } - - /* Initialize subexpression text positions to -1 to mark ones that no - start_memory/stop_memory has been seen for. Also initialize the - register information struct. */ - for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) - { - regstart[mcnt] = regend[mcnt] - = old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE; - - REG_MATCH_NULL_STRING_P (reg_info[mcnt]) = MATCH_NULL_UNSET_VALUE; - IS_ACTIVE (reg_info[mcnt]) = 0; - MATCHED_SOMETHING (reg_info[mcnt]) = 0; - EVER_MATCHED_SOMETHING (reg_info[mcnt]) = 0; - } - - /* We move `string1' into `string2' if the latter's empty -- but not if - `string1' is null. */ - if (size2 == 0 && string1 != NULL) - { - string2 = string1; - size2 = size1; - string1 = 0; - size1 = 0; - } - end1 = string1 + size1; - end2 = string2 + size2; - - /* Compute where to stop matching, within the two strings. */ - if (stop <= size1) - { - end_match_1 = string1 + stop; - end_match_2 = string2; - } - else - { - end_match_1 = end1; - end_match_2 = string2 + stop - size1; - } - - /* `p' scans through the pattern as `d' scans through the data. - `dend' is the end of the input string that `d' points within. `d' - is advanced into the following input string whenever necessary, but - this happens before fetching; therefore, at the beginning of the - loop, `d' can be pointing at the end of a string, but it cannot - equal `string2'. */ - if (size1 > 0 && pos <= size1) - { - d = string1 + pos; - dend = end_match_1; - } - else - { - d = string2 + pos - size1; - dend = end_match_2; - } - - DEBUG_PRINT1 ("The compiled pattern is:\n"); - DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); - DEBUG_PRINT1 ("The string to match is: `"); - DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); - DEBUG_PRINT1 ("'\n"); - - /* This loops over pattern commands. It exits by returning from the - function if the match is complete, or it drops through if the match - fails at this starting point in the input data. */ - for (;;) - { -#ifdef _LIBC - DEBUG_PRINT2 ("\n%p: ", p); -#else - DEBUG_PRINT2 ("\n0x%x: ", p); -#endif - - if (p == pend) - { /* End of pattern means we might have succeeded. */ - DEBUG_PRINT1 ("end of pattern ... "); - - /* If we haven't matched the entire string, and we want the - longest match, try backtracking. */ - if (d != end_match_2) - { - /* 1 if this match ends in the same string (string1 or string2) - as the best previous match. */ - boolean same_str_p = (FIRST_STRING_P (match_end) - == MATCHING_IN_FIRST_STRING); - /* 1 if this match is the best seen so far. */ - boolean best_match_p; - - /* AIX compiler got confused when this was combined - with the previous declaration. */ - if (same_str_p) - best_match_p = d > match_end; - else - best_match_p = !MATCHING_IN_FIRST_STRING; - - DEBUG_PRINT1 ("backtracking.\n"); - - if (!FAIL_STACK_EMPTY ()) - { /* More failure points to try. */ - - /* If exceeds best match so far, save it. */ - if (!best_regs_set || best_match_p) - { - best_regs_set = true; - match_end = d; - - DEBUG_PRINT1 ("\nSAVING match as best so far.\n"); - - for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) - { - best_regstart[mcnt] = regstart[mcnt]; - best_regend[mcnt] = regend[mcnt]; - } - } - goto fail; - } - - /* If no failure points, don't restore garbage. And if - last match is real best match, don't restore second - best one. */ - else if (best_regs_set && !best_match_p) - { - restore_best_regs: - /* Restore best match. It may happen that `dend == - end_match_1' while the restored d is in string2. - For example, the pattern `x.*y.*z' against the - strings `x-' and `y-z-', if the two strings are - not consecutive in memory. */ - DEBUG_PRINT1 ("Restoring best registers.\n"); - - d = match_end; - dend = ((d >= string1 && d <= end1) - ? end_match_1 : end_match_2); - - for (mcnt = 1; (unsigned) mcnt < num_regs; mcnt++) - { - regstart[mcnt] = best_regstart[mcnt]; - regend[mcnt] = best_regend[mcnt]; - } - } - } /* d != end_match_2 */ - - succeed_label: - DEBUG_PRINT1 ("Accepting match.\n"); - - /* If caller wants register contents data back, do it. */ - if (regs && !bufp->no_sub) - { - /* Have the register data arrays been allocated? */ - if (bufp->regs_allocated == REGS_UNALLOCATED) - { /* No. So allocate them with malloc. We need one - extra element beyond `num_regs' for the `-1' marker - GNU code uses. */ - regs->num_regs = MAX (RE_NREGS, num_regs + 1); - regs->start = TALLOC (regs->num_regs, regoff_t); - regs->end = TALLOC (regs->num_regs, regoff_t); - if (regs->start == NULL || regs->end == NULL) - { - FREE_VARIABLES (); - return -2; - } - bufp->regs_allocated = REGS_REALLOCATE; - } - else if (bufp->regs_allocated == REGS_REALLOCATE) - { /* Yes. If we need more elements than were already - allocated, reallocate them. If we need fewer, just - leave it alone. */ - if (regs->num_regs < num_regs + 1) - { - regs->num_regs = num_regs + 1; - RETALLOC (regs->start, regs->num_regs, regoff_t); - RETALLOC (regs->end, regs->num_regs, regoff_t); - if (regs->start == NULL || regs->end == NULL) - { - FREE_VARIABLES (); - return -2; - } - } - } - else - { - /* These braces fend off a "empty body in an else-statement" - warning under GCC when assert expands to nothing. */ - assert (bufp->regs_allocated == REGS_FIXED); - } - - /* Convert the pointer data in `regstart' and `regend' to - indices. Register zero has to be set differently, - since we haven't kept track of any info for it. */ - if (regs->num_regs > 0) - { - regs->start[0] = pos; - regs->end[0] = (MATCHING_IN_FIRST_STRING - ? ((regoff_t) (d - string1)) - : ((regoff_t) (d - string2 + size1))); - } - - /* Go through the first `min (num_regs, regs->num_regs)' - registers, since that is all we initialized. */ - for (mcnt = 1; (unsigned) mcnt < MIN (num_regs, regs->num_regs); - mcnt++) - { - if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt])) - regs->start[mcnt] = regs->end[mcnt] = -1; - else - { - regs->start[mcnt] - = (regoff_t) POINTER_TO_OFFSET (regstart[mcnt]); - regs->end[mcnt] - = (regoff_t) POINTER_TO_OFFSET (regend[mcnt]); - } - } - - /* If the regs structure we return has more elements than - were in the pattern, set the extra elements to -1. If - we (re)allocated the registers, this is the case, - because we always allocate enough to have at least one - -1 at the end. */ - for (mcnt = num_regs; (unsigned) mcnt < regs->num_regs; mcnt++) - regs->start[mcnt] = regs->end[mcnt] = -1; - } /* regs && !bufp->no_sub */ - - DEBUG_PRINT4 ("%u failure points pushed, %u popped (%u remain).\n", - nfailure_points_pushed, nfailure_points_popped, - nfailure_points_pushed - nfailure_points_popped); - DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); - - mcnt = d - pos - (MATCHING_IN_FIRST_STRING - ? string1 - : string2 - size1); - - DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); - - FREE_VARIABLES (); - return mcnt; - } - - /* Otherwise match next pattern command. */ - switch (SWITCH_ENUM_CAST ((re_opcode_t) *p++)) - { - /* Ignore these. Used to ignore the n of succeed_n's which - currently have n == 0. */ - case no_op: - DEBUG_PRINT1 ("EXECUTING no_op.\n"); - break; - - case succeed: - DEBUG_PRINT1 ("EXECUTING succeed.\n"); - goto succeed_label; - - /* Match the next n pattern characters exactly. The following - byte in the pattern defines n, and the n bytes after that - are the characters to match. */ - case exactn: - mcnt = *p++; - DEBUG_PRINT2 ("EXECUTING exactn %d.\n", mcnt); - - /* This is written out as an if-else so we don't waste time - testing `translate' inside the loop. */ - if (translate) - { - do - { - PREFETCH (); - if ((unsigned char) translate[(unsigned char) *d++] - != (unsigned char) *p++) - goto fail; - } - while (--mcnt); - } - else - { - do - { - PREFETCH (); - if (*d++ != (char) *p++) goto fail; - } - while (--mcnt); - } - SET_REGS_MATCHED (); - break; - - - /* Match any character except possibly a newline or a null. */ - case anychar: - DEBUG_PRINT1 ("EXECUTING anychar.\n"); - - PREFETCH (); - - if ((!(bufp->syntax & RE_DOT_NEWLINE) && TRANSLATE (*d) == '\n') - || (bufp->syntax & RE_DOT_NOT_NULL && TRANSLATE (*d) == '\000')) - goto fail; - - SET_REGS_MATCHED (); - DEBUG_PRINT2 (" Matched `%d'.\n", *d); - d++; - break; - - - case charset: - case charset_not: - { - register unsigned char c; - boolean not = (re_opcode_t) *(p - 1) == charset_not; - - DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); - - PREFETCH (); - c = TRANSLATE (*d); /* The character to match. */ - - /* Cast to `unsigned' instead of `unsigned char' in case the - bit list is a full 32 bytes long. */ - if (c < (unsigned) (*p * BYTEWIDTH) - && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; - - p += 1 + *p; - - if (!not) goto fail; - - SET_REGS_MATCHED (); - d++; - break; - } - - - /* The beginning of a group is represented by start_memory. - The arguments are the register number in the next byte, and the - number of groups inner to this one in the next. The text - matched within the group is recorded (in the internal - registers data structure) under the register number. */ - case start_memory: - DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); - - /* Find out if this group can match the empty string. */ - p1 = p; /* To send to group_match_null_string_p. */ - - if (REG_MATCH_NULL_STRING_P (reg_info[*p]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[*p]) - = group_match_null_string_p (&p1, pend, reg_info); - - /* Save the position in the string where we were the last time - we were at this open-group operator in case the group is - operated upon by a repetition operator, e.g., with `(a*)*b' - against `ab'; then we want to ignore where we are now in - the string in case this attempt to match fails. */ - old_regstart[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regstart[*p]) ? d : regstart[*p] - : regstart[*p]; - DEBUG_PRINT2 (" old_regstart: %d\n", - POINTER_TO_OFFSET (old_regstart[*p])); - - regstart[*p] = d; - DEBUG_PRINT2 (" regstart: %d\n", POINTER_TO_OFFSET (regstart[*p])); - - IS_ACTIVE (reg_info[*p]) = 1; - MATCHED_SOMETHING (reg_info[*p]) = 0; - - /* Clear this whenever we change the register activity status. */ - set_regs_matched_done = 0; - - /* This is the new highest active register. */ - highest_active_reg = *p; - - /* If nothing was active before, this is the new lowest active - register. */ - if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) - lowest_active_reg = *p; - - /* Move past the register number and inner group count. */ - p += 2; - just_past_start_mem = p; - - break; - - - /* The stop_memory opcode represents the end of a group. Its - arguments are the same as start_memory's: the register - number, and the number of inner groups. */ - case stop_memory: - DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); - - /* We need to save the string position the last time we were at - this close-group operator in case the group is operated - upon by a repetition operator, e.g., with `((a*)*(b*)*)*' - against `aba'; then we want to ignore where we are now in - the string in case this attempt to match fails. */ - old_regend[*p] = REG_MATCH_NULL_STRING_P (reg_info[*p]) - ? REG_UNSET (regend[*p]) ? d : regend[*p] - : regend[*p]; - DEBUG_PRINT2 (" old_regend: %d\n", - POINTER_TO_OFFSET (old_regend[*p])); - - regend[*p] = d; - DEBUG_PRINT2 (" regend: %d\n", POINTER_TO_OFFSET (regend[*p])); - - /* This register isn't active anymore. */ - IS_ACTIVE (reg_info[*p]) = 0; - - /* Clear this whenever we change the register activity status. */ - set_regs_matched_done = 0; - - /* If this was the only register active, nothing is active - anymore. */ - if (lowest_active_reg == highest_active_reg) - { - lowest_active_reg = NO_LOWEST_ACTIVE_REG; - highest_active_reg = NO_HIGHEST_ACTIVE_REG; - } - else - { /* We must scan for the new highest active register, since - it isn't necessarily one less than now: consider - (a(b)c(d(e)f)g). When group 3 ends, after the f), the - new highest active register is 1. */ - unsigned char r = *p - 1; - while (r > 0 && !IS_ACTIVE (reg_info[r])) - r--; - - /* If we end up at register zero, that means that we saved - the registers as the result of an `on_failure_jump', not - a `start_memory', and we jumped to past the innermost - `stop_memory'. For example, in ((.)*) we save - registers 1 and 2 as a result of the *, but when we pop - back to the second ), we are at the stop_memory 1. - Thus, nothing is active. */ - if (r == 0) - { - lowest_active_reg = NO_LOWEST_ACTIVE_REG; - highest_active_reg = NO_HIGHEST_ACTIVE_REG; - } - else - highest_active_reg = r; - } - - /* If just failed to match something this time around with a - group that's operated on by a repetition operator, try to - force exit from the ``loop'', and restore the register - information for this group that we had before trying this - last match. */ - if ((!MATCHED_SOMETHING (reg_info[*p]) - || just_past_start_mem == p - 1) - && (p + 2) < pend) - { - boolean is_a_jump_n = false; - - p1 = p + 2; - mcnt = 0; - switch ((re_opcode_t) *p1++) - { - case jump_n: - is_a_jump_n = true; - case pop_failure_jump: - case maybe_pop_jump: - case jump: - case dummy_failure_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if (is_a_jump_n) - p1 += 2; - break; - - default: - /* do nothing */ ; - } - p1 += mcnt; - - /* If the next operation is a jump backwards in the pattern - to an on_failure_jump right before the start_memory - corresponding to this stop_memory, exit from the loop - by forcing a failure after pushing on the stack the - on_failure_jump's jump in the pattern, and d. */ - if (mcnt < 0 && (re_opcode_t) *p1 == on_failure_jump - && (re_opcode_t) p1[3] == start_memory && p1[4] == *p) - { - /* If this group ever matched anything, then restore - what its registers were before trying this last - failed match, e.g., with `(a*)*b' against `ab' for - regstart[1], and, e.g., with `((a*)*(b*)*)*' - against `aba' for regend[3]. - - Also restore the registers for inner groups for, - e.g., `((a*)(b*))*' against `aba' (register 3 would - otherwise get trashed). */ - - if (EVER_MATCHED_SOMETHING (reg_info[*p])) - { - unsigned r; - - EVER_MATCHED_SOMETHING (reg_info[*p]) = 0; - - /* Restore this and inner groups' (if any) registers. */ - for (r = *p; r < (unsigned) *p + (unsigned) *(p + 1); - r++) - { - regstart[r] = old_regstart[r]; - - /* xx why this test? */ - if (old_regend[r] >= regstart[r]) - regend[r] = old_regend[r]; - } - } - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - PUSH_FAILURE_POINT (p1 + mcnt, d, -2); - - goto fail; - } - } - - /* Move past the register number and the inner group count. */ - p += 2; - break; - - - /* \<digit> has been turned into a `duplicate' command which is - followed by the numeric value of <digit> as the register number. */ - case duplicate: - { - register const char *d2, *dend2; - int regno = *p++; /* Get which register to match against. */ - DEBUG_PRINT2 ("EXECUTING duplicate %d.\n", regno); - - /* Can't back reference a group which we've never matched. */ - if (REG_UNSET (regstart[regno]) || REG_UNSET (regend[regno])) - goto fail; - - /* Where in input to try to start matching. */ - d2 = regstart[regno]; - - /* Where to stop matching; if both the place to start and - the place to stop matching are in the same string, then - set to the place to stop, otherwise, for now have to use - the end of the first string. */ - - dend2 = ((FIRST_STRING_P (regstart[regno]) - == FIRST_STRING_P (regend[regno])) - ? regend[regno] : end_match_1); - for (;;) - { - /* If necessary, advance to next segment in register - contents. */ - while (d2 == dend2) - { - if (dend2 == end_match_2) break; - if (dend2 == regend[regno]) break; - - /* End of string1 => advance to string2. */ - d2 = string2; - dend2 = regend[regno]; - } - /* At end of register contents => success */ - if (d2 == dend2) break; - - /* If necessary, advance to next segment in data. */ - PREFETCH (); - - /* How many characters left in this segment to match. */ - mcnt = dend - d; - - /* Want how many consecutive characters we can match in - one shot, so, if necessary, adjust the count. */ - if (mcnt > dend2 - d2) - mcnt = dend2 - d2; - - /* Compare that many; failure if mismatch, else move - past them. */ - if (translate - ? bcmp_translate (d, d2, mcnt, translate) - : bcmp (d, d2, mcnt)) - goto fail; - d += mcnt, d2 += mcnt; - - /* Do this because we've match some characters. */ - SET_REGS_MATCHED (); - } - } - break; - - - /* begline matches the empty string at the beginning of the string - (unless `not_bol' is set in `bufp'), and, if - `newline_anchor' is set, after newlines. */ - case begline: - DEBUG_PRINT1 ("EXECUTING begline.\n"); - - if (AT_STRINGS_BEG (d)) - { - if (!bufp->not_bol) break; - } - else if (d[-1] == '\n' && bufp->newline_anchor) - { - break; - } - /* In all other cases, we fail. */ - goto fail; - - - /* endline is the dual of begline. */ - case endline: - DEBUG_PRINT1 ("EXECUTING endline.\n"); - - if (AT_STRINGS_END (d)) - { - if (!bufp->not_eol) break; - } - - /* We have to ``prefetch'' the next character. */ - else if ((d == end1 ? *string2 : *d) == '\n' - && bufp->newline_anchor) - { - break; - } - goto fail; - - - /* Match at the very beginning of the data. */ - case begbuf: - DEBUG_PRINT1 ("EXECUTING begbuf.\n"); - if (AT_STRINGS_BEG (d)) - break; - goto fail; - - - /* Match at the very end of the data. */ - case endbuf: - DEBUG_PRINT1 ("EXECUTING endbuf.\n"); - if (AT_STRINGS_END (d)) - break; - goto fail; - - - /* on_failure_keep_string_jump is used to optimize `.*\n'. It - pushes NULL as the value for the string on the stack. Then - `pop_failure_point' will keep the current value for the - string, instead of restoring it. To see why, consider - matching `foo\nbar' against `.*\n'. The .* matches the foo; - then the . fails against the \n. But the next thing we want - to do is match the \n against the \n; if we restored the - string value, we would be back at the foo. - - Because this is used only in specific cases, we don't need to - check all the things that `on_failure_jump' does, to make - sure the right things get saved on the stack. Hence we don't - share its code. The only reason to push anything on the - stack at all is that otherwise we would have to change - `anychar's code to do something besides goto fail in this - case; that seems worse than this. */ - case on_failure_keep_string_jump: - DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); - - EXTRACT_NUMBER_AND_INCR (mcnt, p); -#ifdef _LIBC - DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt); -#else - DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); -#endif - - PUSH_FAILURE_POINT (p + mcnt, NULL, -2); - break; - - - /* Uses of on_failure_jump: - - Each alternative starts with an on_failure_jump that points - to the beginning of the next alternative. Each alternative - except the last ends with a jump that in effect jumps past - the rest of the alternatives. (They really jump to the - ending jump of the following alternative, because tensioning - these jumps is a hassle.) - - Repeats start with an on_failure_jump that points past both - the repetition text and either the following jump or - pop_failure_jump back to this on_failure_jump. */ - case on_failure_jump: - on_failure: - DEBUG_PRINT1 ("EXECUTING on_failure_jump"); - - EXTRACT_NUMBER_AND_INCR (mcnt, p); -#ifdef _LIBC - DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt); -#else - DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); -#endif - - /* If this on_failure_jump comes right before a group (i.e., - the original * applied to a group), save the information - for that group and all inner ones, so that if we fail back - to this point, the group's information will be correct. - For example, in \(a*\)*\1, we need the preceding group, - and in \(zz\(a*\)b*\)\2, we need the inner group. */ - - /* We can't use `p' to check ahead because we push - a failure point to `p + mcnt' after we do this. */ - p1 = p; - - /* We need to skip no_op's before we look for the - start_memory in case this on_failure_jump is happening as - the result of a completed succeed_n, as in \(a\)\{1,3\}b\1 - against aba. */ - while (p1 < pend && (re_opcode_t) *p1 == no_op) - p1++; - - if (p1 < pend && (re_opcode_t) *p1 == start_memory) - { - /* We have a new highest active register now. This will - get reset at the start_memory we are about to get to, - but we will have saved all the registers relevant to - this repetition op, as described above. */ - highest_active_reg = *(p1 + 1) + *(p1 + 2); - if (lowest_active_reg == NO_LOWEST_ACTIVE_REG) - lowest_active_reg = *(p1 + 1); - } - - DEBUG_PRINT1 (":\n"); - PUSH_FAILURE_POINT (p + mcnt, d, -2); - break; - - - /* A smart repeat ends with `maybe_pop_jump'. - We change it to either `pop_failure_jump' or `jump'. */ - case maybe_pop_jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); - DEBUG_PRINT2 ("EXECUTING maybe_pop_jump %d.\n", mcnt); - { - register unsigned char *p2 = p; - - /* Compare the beginning of the repeat with what in the - pattern follows its end. If we can establish that there - is nothing that they would both match, i.e., that we - would have to backtrack because of (as in, e.g., `a*a') - then we can change to pop_failure_jump, because we'll - never have to backtrack. - - This is not true in the case of alternatives: in - `(a|ab)*' we do need to backtrack to the `ab' alternative - (e.g., if the string was `ab'). But instead of trying to - detect that here, the alternative has put on a dummy - failure point which is what we will end up popping. */ - - /* Skip over open/close-group commands. - If what follows this loop is a ...+ construct, - look at what begins its body, since we will have to - match at least one of that. */ - while (1) - { - if (p2 + 2 < pend - && ((re_opcode_t) *p2 == stop_memory - || (re_opcode_t) *p2 == start_memory)) - p2 += 3; - else if (p2 + 6 < pend - && (re_opcode_t) *p2 == dummy_failure_jump) - p2 += 6; - else - break; - } - - p1 = p + mcnt; - /* p1[0] ... p1[2] are the `on_failure_jump' corresponding - to the `maybe_finalize_jump' of this case. Examine what - follows. */ - - /* If we're at the end of the pattern, we can change. */ - if (p2 == pend) - { - /* Consider what happens when matching ":\(.*\)" - against ":/". I don't really understand this code - yet. */ - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT1 - (" End of pattern: change to `pop_failure_jump'.\n"); - } - - else if ((re_opcode_t) *p2 == exactn - || (bufp->newline_anchor && (re_opcode_t) *p2 == endline)) - { - register unsigned char c - = *p2 == (unsigned char) endline ? '\n' : p2[2]; - - if ((re_opcode_t) p1[3] == exactn && p1[5] != c) - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", - c, p1[5]); - } - - else if ((re_opcode_t) p1[3] == charset - || (re_opcode_t) p1[3] == charset_not) - { - int not = (re_opcode_t) p1[3] == charset_not; - - if (c < (unsigned char) (p1[4] * BYTEWIDTH) - && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; - - /* `not' is equal to 1 if c would match, which means - that we can't change to pop_failure_jump. */ - if (!not) - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); - } - } - } - else if ((re_opcode_t) *p2 == charset) - { -#ifdef DEBUG - register unsigned char c - = *p2 == (unsigned char) endline ? '\n' : p2[2]; -#endif - -#if 0 - if ((re_opcode_t) p1[3] == exactn - && ! ((int) p2[1] * BYTEWIDTH > (int) p1[5] - && (p2[2 + p1[5] / BYTEWIDTH] - & (1 << (p1[5] % BYTEWIDTH))))) -#else - if ((re_opcode_t) p1[3] == exactn - && ! ((int) p2[1] * BYTEWIDTH > (int) p1[4] - && (p2[2 + p1[4] / BYTEWIDTH] - & (1 << (p1[4] % BYTEWIDTH))))) -#endif - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", - c, p1[5]); - } - - else if ((re_opcode_t) p1[3] == charset_not) - { - int idx; - /* We win if the charset_not inside the loop - lists every character listed in the charset after. */ - for (idx = 0; idx < (int) p2[1]; idx++) - if (! (p2[2 + idx] == 0 - || (idx < (int) p1[4] - && ((p2[2 + idx] & ~ p1[5 + idx]) == 0)))) - break; - - if (idx == p2[1]) - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); - } - } - else if ((re_opcode_t) p1[3] == charset) - { - int idx; - /* We win if the charset inside the loop - has no overlap with the one after the loop. */ - for (idx = 0; - idx < (int) p2[1] && idx < (int) p1[4]; - idx++) - if ((p2[2 + idx] & p1[5 + idx]) != 0) - break; - - if (idx == p2[1] || idx == p1[4]) - { - p[-3] = (unsigned char) pop_failure_jump; - DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); - } - } - } - } - p -= 2; /* Point at relative address again. */ - if ((re_opcode_t) p[-1] != pop_failure_jump) - { - p[-1] = (unsigned char) jump; - DEBUG_PRINT1 (" Match => jump.\n"); - goto unconditional_jump; - } - /* Note fall through. */ - - - /* The end of a simple repeat has a pop_failure_jump back to - its matching on_failure_jump, where the latter will push a - failure point. The pop_failure_jump takes off failure - points put on by this pop_failure_jump's matching - on_failure_jump; we got through the pattern to here from the - matching on_failure_jump, so didn't fail. */ - case pop_failure_jump: - { - /* We need to pass separate storage for the lowest and - highest registers, even though we don't care about the - actual values. Otherwise, we will restore only one - register from the stack, since lowest will == highest in - `pop_failure_point'. */ - active_reg_t dummy_low_reg, dummy_high_reg; - unsigned char *pdummy; - const char *sdummy; - - DEBUG_PRINT1 ("EXECUTING pop_failure_jump.\n"); - POP_FAILURE_POINT (sdummy, pdummy, - dummy_low_reg, dummy_high_reg, - reg_dummy, reg_dummy, reg_info_dummy); - } - /* Note fall through. */ - - unconditional_jump: -#ifdef _LIBC - DEBUG_PRINT2 ("\n%p: ", p); -#else - DEBUG_PRINT2 ("\n0x%x: ", p); -#endif - /* Note fall through. */ - - /* Unconditionally jump (without popping any failure points). */ - case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ - DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); - p += mcnt; /* Do the jump. */ -#ifdef _LIBC - DEBUG_PRINT2 ("(to %p).\n", p); -#else - DEBUG_PRINT2 ("(to 0x%x).\n", p); -#endif - break; - - - /* We need this opcode so we can detect where alternatives end - in `group_match_null_string_p' et al. */ - case jump_past_alt: - DEBUG_PRINT1 ("EXECUTING jump_past_alt.\n"); - goto unconditional_jump; - - - /* Normally, the on_failure_jump pushes a failure point, which - then gets popped at pop_failure_jump. We will end up at - pop_failure_jump, also, and with a pattern of, say, `a+', we - are skipping over the on_failure_jump, so we have to push - something meaningless for pop_failure_jump to pop. */ - case dummy_failure_jump: - DEBUG_PRINT1 ("EXECUTING dummy_failure_jump.\n"); - /* It doesn't matter what we push for the string here. What - the code at `fail' tests is the value for the pattern. */ - PUSH_FAILURE_POINT (0, 0, -2); - goto unconditional_jump; - - - /* At the end of an alternative, we need to push a dummy failure - point in case we are followed by a `pop_failure_jump', because - we don't want the failure point for the alternative to be - popped. For example, matching `(a|ab)*' against `aab' - requires that we match the `ab' alternative. */ - case push_dummy_failure: - DEBUG_PRINT1 ("EXECUTING push_dummy_failure.\n"); - /* See comments just above at `dummy_failure_jump' about the - two zeroes. */ - PUSH_FAILURE_POINT (0, 0, -2); - break; - - /* Have to succeed matching what follows at least n times. - After that, handle like `on_failure_jump'. */ - case succeed_n: - EXTRACT_NUMBER (mcnt, p + 2); - DEBUG_PRINT2 ("EXECUTING succeed_n %d.\n", mcnt); - - assert (mcnt >= 0); - /* Originally, this is how many times we HAVE to succeed. */ - if (mcnt > 0) - { - mcnt--; - p += 2; - STORE_NUMBER_AND_INCR (p, mcnt); -#ifdef _LIBC - DEBUG_PRINT3 (" Setting %p to %d.\n", p - 2, mcnt); -#else - DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - 2, mcnt); -#endif - } - else if (mcnt == 0) - { -#ifdef _LIBC - DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", p+2); -#else - DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); -#endif - p[2] = (unsigned char) no_op; - p[3] = (unsigned char) no_op; - goto on_failure; - } - break; - - case jump_n: - EXTRACT_NUMBER (mcnt, p + 2); - DEBUG_PRINT2 ("EXECUTING jump_n %d.\n", mcnt); - - /* Originally, this is how many times we CAN jump. */ - if (mcnt) - { - mcnt--; - STORE_NUMBER (p + 2, mcnt); -#ifdef _LIBC - DEBUG_PRINT3 (" Setting %p to %d.\n", p + 2, mcnt); -#else - DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + 2, mcnt); -#endif - goto unconditional_jump; - } - /* If don't have to jump any more, skip over the rest of command. */ - else - p += 4; - break; - - case set_number_at: - { - DEBUG_PRINT1 ("EXECUTING set_number_at.\n"); - - EXTRACT_NUMBER_AND_INCR (mcnt, p); - p1 = p + mcnt; - EXTRACT_NUMBER_AND_INCR (mcnt, p); -#ifdef _LIBC - DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt); -#else - DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); -#endif - STORE_NUMBER (p1, mcnt); - break; - } - -#if 0 - /* The DEC Alpha C compiler 3.x generates incorrect code for the - test WORDCHAR_P (d - 1) != WORDCHAR_P (d) in the expansion of - AT_WORD_BOUNDARY, so this code is disabled. Expanding the - macro and introducing temporary variables works around the bug. */ - - case wordbound: - DEBUG_PRINT1 ("EXECUTING wordbound.\n"); - if (AT_WORD_BOUNDARY (d)) - break; - goto fail; - - case notwordbound: - DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); - if (AT_WORD_BOUNDARY (d)) - goto fail; - break; -#else - case wordbound: - { - boolean prevchar, thischar; - - DEBUG_PRINT1 ("EXECUTING wordbound.\n"); - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - break; - - prevchar = WORDCHAR_P (d - 1); - thischar = WORDCHAR_P (d); - if (prevchar != thischar) - break; - goto fail; - } - - case notwordbound: - { - boolean prevchar, thischar; - - DEBUG_PRINT1 ("EXECUTING notwordbound.\n"); - if (AT_STRINGS_BEG (d) || AT_STRINGS_END (d)) - goto fail; - - prevchar = WORDCHAR_P (d - 1); - thischar = WORDCHAR_P (d); - if (prevchar != thischar) - goto fail; - break; - } -#endif - - case wordbeg: - DEBUG_PRINT1 ("EXECUTING wordbeg.\n"); - if (WORDCHAR_P (d) && (AT_STRINGS_BEG (d) || !WORDCHAR_P (d - 1))) - break; - goto fail; - - case wordend: - DEBUG_PRINT1 ("EXECUTING wordend.\n"); - if (!AT_STRINGS_BEG (d) && WORDCHAR_P (d - 1) - && (!WORDCHAR_P (d) || AT_STRINGS_END (d))) - break; - goto fail; - -#ifdef emacs - case before_dot: - DEBUG_PRINT1 ("EXECUTING before_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) >= point) - goto fail; - break; - - case at_dot: - DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) != point) - goto fail; - break; - - case after_dot: - DEBUG_PRINT1 ("EXECUTING after_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) <= point) - goto fail; - break; - - case syntaxspec: - DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt); - mcnt = *p++; - goto matchsyntax; - - case wordchar: - DEBUG_PRINT1 ("EXECUTING Emacs wordchar.\n"); - mcnt = (int) Sword; - matchsyntax: - PREFETCH (); - /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ - d++; - if (SYNTAX (d[-1]) != (enum syntaxcode) mcnt) - goto fail; - SET_REGS_MATCHED (); - break; - - case notsyntaxspec: - DEBUG_PRINT2 ("EXECUTING notsyntaxspec %d.\n", mcnt); - mcnt = *p++; - goto matchnotsyntax; - - case notwordchar: - DEBUG_PRINT1 ("EXECUTING Emacs notwordchar.\n"); - mcnt = (int) Sword; - matchnotsyntax: - PREFETCH (); - /* Can't use *d++ here; SYNTAX may be an unsafe macro. */ - d++; - if (SYNTAX (d[-1]) == (enum syntaxcode) mcnt) - goto fail; - SET_REGS_MATCHED (); - break; - -#else /* not emacs */ - case wordchar: - DEBUG_PRINT1 ("EXECUTING non-Emacs wordchar.\n"); - PREFETCH (); - if (!WORDCHAR_P (d)) - goto fail; - SET_REGS_MATCHED (); - d++; - break; - - case notwordchar: - DEBUG_PRINT1 ("EXECUTING non-Emacs notwordchar.\n"); - PREFETCH (); - if (WORDCHAR_P (d)) - goto fail; - SET_REGS_MATCHED (); - d++; - break; -#endif /* not emacs */ - - default: - abort (); - } - continue; /* Successfully executed one pattern command; keep going. */ - - - /* We goto here if a matching operation fails. */ - fail: - if (!FAIL_STACK_EMPTY ()) - { /* A restart point is known. Restore to that state. */ - DEBUG_PRINT1 ("\nFAIL:\n"); - POP_FAILURE_POINT (d, p, - lowest_active_reg, highest_active_reg, - regstart, regend, reg_info); - - /* If this failure point is a dummy, try the next one. */ - if (!p) - goto fail; - - /* If we failed to the end of the pattern, don't examine *p. */ - assert (p <= pend); - if (p < pend) - { - boolean is_a_jump_n = false; - - /* If failed to a backwards jump that's part of a repetition - loop, need to pop this failure point and use the next one. */ - switch ((re_opcode_t) *p) - { - case jump_n: - is_a_jump_n = true; - case maybe_pop_jump: - case pop_failure_jump: - case jump: - p1 = p + 1; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - - if ((is_a_jump_n && (re_opcode_t) *p1 == succeed_n) - || (!is_a_jump_n - && (re_opcode_t) *p1 == on_failure_jump)) - goto fail; - break; - default: - /* do nothing */ ; - } - } - - if (d >= string1 && d <= end1) - dend = end_match_1; - } - else - break; /* Matching at this starting point really fails. */ - } /* for (;;) */ - - if (best_regs_set) - goto restore_best_regs; - - FREE_VARIABLES (); - - return -1; /* Failure to match. */ -} /* re_match_2 */ - -/* Subroutine definitions for re_match_2. */ - - -/* We are passed P pointing to a register number after a start_memory. - - Return true if the pattern up to the corresponding stop_memory can - match the empty string, and false otherwise. - - If we find the matching stop_memory, sets P to point to one past its number. - Otherwise, sets P to an undefined byte less than or equal to END. - - We don't handle duplicates properly (yet). */ - -static boolean -group_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *reg_info; -{ - int mcnt; - /* Point to after the args to the start_memory. */ - unsigned char *p1 = *p + 2; - - while (p1 < end) - { - /* Skip over opcodes that can match nothing, and return true or - false, as appropriate, when we get to one that can't, or to the - matching stop_memory. */ - - switch ((re_opcode_t) *p1) - { - /* Could be either a loop or a series of alternatives. */ - case on_failure_jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - - /* If the next operation is not a jump backwards in the - pattern. */ - - if (mcnt >= 0) - { - /* Go through the on_failure_jumps of the alternatives, - seeing if any of the alternatives cannot match nothing. - The last alternative starts with only a jump, - whereas the rest start with on_failure_jump and end - with a jump, e.g., here is the pattern for `a|b|c': - - /on_failure_jump/0/6/exactn/1/a/jump_past_alt/0/6 - /on_failure_jump/0/6/exactn/1/b/jump_past_alt/0/3 - /exactn/1/c - - So, we have to first go through the first (n-1) - alternatives and then deal with the last one separately. */ - - - /* Deal with the first (n-1) alternatives, which start - with an on_failure_jump (see above) that jumps to right - past a jump_past_alt. */ - - while ((re_opcode_t) p1[mcnt-3] == jump_past_alt) - { - /* `mcnt' holds how many bytes long the alternative - is, including the ending `jump_past_alt' and - its number. */ - - if (!alt_match_null_string_p (p1, p1 + mcnt - 3, - reg_info)) - return false; - - /* Move to right after this alternative, including the - jump_past_alt. */ - p1 += mcnt; - - /* Break if it's the beginning of an n-th alternative - that doesn't begin with an on_failure_jump. */ - if ((re_opcode_t) *p1 != on_failure_jump) - break; - - /* Still have to check that it's not an n-th - alternative that starts with an on_failure_jump. */ - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if ((re_opcode_t) p1[mcnt-3] != jump_past_alt) - { - /* Get to the beginning of the n-th alternative. */ - p1 -= 3; - break; - } - } - - /* Deal with the last alternative: go back and get number - of the `jump_past_alt' just before it. `mcnt' contains - the length of the alternative. */ - EXTRACT_NUMBER (mcnt, p1 - 2); - - if (!alt_match_null_string_p (p1, p1 + mcnt, reg_info)) - return false; - - p1 += mcnt; /* Get past the n-th alternative. */ - } /* if mcnt > 0 */ - break; - - - case stop_memory: - assert (p1[1] == **p); - *p = p1 + 2; - return true; - - - default: - if (!common_op_match_null_string_p (&p1, end, reg_info)) - return false; - } - } /* while p1 < end */ - - return false; -} /* group_match_null_string_p */ - - -/* Similar to group_match_null_string_p, but doesn't deal with alternatives: - It expects P to be the first byte of a single alternative and END one - byte past the last. The alternative can contain groups. */ - -static boolean -alt_match_null_string_p (p, end, reg_info) - unsigned char *p, *end; - register_info_type *reg_info; -{ - int mcnt; - unsigned char *p1 = p; - - while (p1 < end) - { - /* Skip over opcodes that can match nothing, and break when we get - to one that can't. */ - - switch ((re_opcode_t) *p1) - { - /* It's a loop. */ - case on_failure_jump: - p1++; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - break; - - default: - if (!common_op_match_null_string_p (&p1, end, reg_info)) - return false; - } - } /* while p1 < end */ - - return true; -} /* alt_match_null_string_p */ - - -/* Deals with the ops common to group_match_null_string_p and - alt_match_null_string_p. - - Sets P to one after the op and its arguments, if any. */ - -static boolean -common_op_match_null_string_p (p, end, reg_info) - unsigned char **p, *end; - register_info_type *reg_info; -{ - int mcnt; - boolean ret; - int reg_no; - unsigned char *p1 = *p; - - switch ((re_opcode_t) *p1++) - { - case no_op: - case begline: - case endline: - case begbuf: - case endbuf: - case wordbeg: - case wordend: - case wordbound: - case notwordbound: -#ifdef emacs - case before_dot: - case at_dot: - case after_dot: -#endif - break; - - case start_memory: - reg_no = *p1; - assert (reg_no > 0 && reg_no <= MAX_REGNUM); - ret = group_match_null_string_p (&p1, end, reg_info); - - /* Have to set this here in case we're checking a group which - contains a group and a back reference to it. */ - - if (REG_MATCH_NULL_STRING_P (reg_info[reg_no]) == MATCH_NULL_UNSET_VALUE) - REG_MATCH_NULL_STRING_P (reg_info[reg_no]) = ret; - - if (!ret) - return false; - break; - - /* If this is an optimized succeed_n for zero times, make the jump. */ - case jump: - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - if (mcnt >= 0) - p1 += mcnt; - else - return false; - break; - - case succeed_n: - /* Get to the number of times to succeed. */ - p1 += 2; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - - if (mcnt == 0) - { - p1 -= 4; - EXTRACT_NUMBER_AND_INCR (mcnt, p1); - p1 += mcnt; - } - else - return false; - break; - - case duplicate: - if (!REG_MATCH_NULL_STRING_P (reg_info[*p1])) - return false; - break; - - case set_number_at: - p1 += 4; - - default: - /* All other opcodes mean we cannot match the empty string. */ - return false; - } - - *p = p1; - return true; -} /* common_op_match_null_string_p */ - - -/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN - bytes; nonzero otherwise. */ - -static int -bcmp_translate (s1, s2, len, translate) - const char *s1, *s2; - register int len; - RE_TRANSLATE_TYPE translate; -{ - register const unsigned char *p1 = (const unsigned char *) s1; - register const unsigned char *p2 = (const unsigned char *) s2; - while (len) - { - if (translate[*p1++] != translate[*p2++]) return 1; - len--; - } - return 0; -} - -/* Entry points for GNU code. */ - -/* re_compile_pattern is the GNU regular expression compiler: it - compiles PATTERN (of length SIZE) and puts the result in BUFP. - Returns 0 if the pattern was valid, otherwise an error string. - - Assumes the `allocated' (and perhaps `buffer') and `translate' fields - are set in BUFP on entry. - - We call regex_compile to do the actual compilation. */ - -const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - size_t length; - struct re_pattern_buffer *bufp; -{ - reg_errcode_t ret; - - /* GNU code is written to assume at least RE_NREGS registers will be set - (and at least one extra will be -1). */ - bufp->regs_allocated = REGS_UNALLOCATED; - - /* And GNU code determines whether or not to get register information - by passing null for the REGS argument to re_match, etc., not by - setting no_sub. */ - bufp->no_sub = 0; - - /* Match anchors at newline. */ - bufp->newline_anchor = 1; - - ret = regex_compile (pattern, length, re_syntax_options, bufp); - - if (!ret) - return NULL; - return gettext (re_error_msgid[(int) ret]); -} - -/* Entry points compatible with 4.2 BSD regex library. We don't define - them unless specifically requested. */ - -#if defined (_REGEX_RE_COMP) || defined (_LIBC) - -/* BSD has one and only one pattern buffer. */ -static struct re_pattern_buffer re_comp_buf; - -char * -#ifdef _LIBC -/* Make these definitions weak in libc, so POSIX programs can redefine - these names if they don't use our functions, and still use - regcomp/regexec below without link errors. */ -weak_function -#endif -re_comp (s) - const char *s; -{ - reg_errcode_t ret; - - if (!s) - { - if (!re_comp_buf.buffer) - return gettext ("No previous regular expression"); - return 0; - } - - if (!re_comp_buf.buffer) - { - re_comp_buf.buffer = (unsigned char *) malloc (200); - if (re_comp_buf.buffer == NULL) - return gettext (re_error_msgid[(int) REG_ESPACE]); - re_comp_buf.allocated = 200; - - re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); - if (re_comp_buf.fastmap == NULL) - return gettext (re_error_msgid[(int) REG_ESPACE]); - } - - /* Since `re_exec' always passes NULL for the `regs' argument, we - don't need to initialize the pattern buffer fields which affect it. */ - - /* Match anchors at newlines. */ - re_comp_buf.newline_anchor = 1; - - ret = regex_compile (s, strlen (s), re_syntax_options, &re_comp_buf); - - if (!ret) - return NULL; - - /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ - return (char *) gettext (re_error_msgid[(int) ret]); -} - - -int -#ifdef _LIBC -weak_function -#endif -re_exec (s) - const char *s; -{ - const int len = strlen (s); - return - 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); -} - -#endif /* _REGEX_RE_COMP */ - -/* POSIX.2 functions. Don't define these for Emacs. */ - -#ifndef emacs - -/* regcomp takes a regular expression as a string and compiles it. - - PREG is a regex_t *. We do not expect any fields to be initialized, - since POSIX says we shouldn't. Thus, we set - - `buffer' to the compiled pattern; - `used' to the length of the compiled pattern; - `syntax' to RE_SYNTAX_POSIX_EXTENDED if the - REG_EXTENDED bit in CFLAGS is set; otherwise, to - RE_SYNTAX_POSIX_BASIC; - `newline_anchor' to REG_NEWLINE being set in CFLAGS; - `fastmap' and `fastmap_accurate' to zero; - `re_nsub' to the number of subexpressions in PATTERN. - - PATTERN is the address of the pattern string. - - CFLAGS is a series of bits which affect compilation. - - If REG_EXTENDED is set, we use POSIX extended syntax; otherwise, we - use POSIX basic syntax. - - If REG_NEWLINE is set, then . and [^...] don't match newline. - Also, regexec will try a match beginning after every newline. - - If REG_ICASE is set, then we considers upper- and lowercase - versions of letters to be equivalent when matching. - - If REG_NOSUB is set, then when PREG is passed to regexec, that - routine will report only success or failure, and nothing about the - registers. - - It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for - the return codes and their meanings.) */ - -#ifdef __APPLE__ -__private_extern__ -#endif -int -regcomp (preg, pattern, cflags) - regex_t *preg; - const char *pattern; - int cflags; -{ - reg_errcode_t ret; - reg_syntax_t syntax - = (cflags & REG_EXTENDED) ? - RE_SYNTAX_POSIX_EXTENDED : RE_SYNTAX_POSIX_BASIC; - - /* regex_compile will allocate the space for the compiled pattern. */ - preg->buffer = 0; - preg->allocated = 0; - preg->used = 0; - - /* Don't bother to use a fastmap when searching. This simplifies the - REG_NEWLINE case: if we used a fastmap, we'd have to put all the - characters after newlines into the fastmap. This way, we just try - every character. */ - preg->fastmap = 0; - - if (cflags & REG_ICASE) - { - unsigned i; - - preg->translate - = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE - * sizeof (*(RE_TRANSLATE_TYPE)0)); - if (preg->translate == NULL) - return (int) REG_ESPACE; - - /* Map uppercase characters to corresponding lowercase ones. */ - for (i = 0; i < CHAR_SET_SIZE; i++) - preg->translate[i] = ISUPPER (i) ? tolower (i) : i; - } - else - preg->translate = NULL; - - /* If REG_NEWLINE is set, newlines are treated differently. */ - if (cflags & REG_NEWLINE) - { /* REG_NEWLINE implies neither . nor [^...] match newline. */ - syntax &= ~RE_DOT_NEWLINE; - syntax |= RE_HAT_LISTS_NOT_NEWLINE; - /* It also changes the matching behavior. */ - preg->newline_anchor = 1; - } - else - preg->newline_anchor = 0; - - preg->no_sub = !!(cflags & REG_NOSUB); - - /* POSIX says a null character in the pattern terminates it, so we - can use strlen here in compiling the pattern. */ - ret = regex_compile (pattern, strlen (pattern), syntax, preg); - - /* POSIX doesn't distinguish between an unmatched open-group and an - unmatched close-group: both are REG_EPAREN. */ - if (ret == REG_ERPAREN) ret = REG_EPAREN; - - return (int) ret; -} - - -/* regexec searches for a given pattern, specified by PREG, in the - string STRING. - - If NMATCH is zero or REG_NOSUB was set in the cflags argument to - `regcomp', we ignore PMATCH. Otherwise, we assume PMATCH has at - least NMATCH elements, and we set them to the offsets of the - corresponding matched substrings. - - EFLAGS specifies `execution flags' which affect matching: if - REG_NOTBOL is set, then ^ does not match at the beginning of the - string; if REG_NOTEOL is set, then $ does not match at the end. - - We return 0 if we find a match and REG_NOMATCH if not. */ - -#ifdef __APPLE__ -__private_extern__ -#endif -int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *preg; - const char *string; - size_t nmatch; - regmatch_t pmatch[]; - int eflags; -{ - int ret; - struct re_registers regs; - regex_t private_preg; - int len = strlen (string); - boolean want_reg_info = !preg->no_sub && nmatch > 0; - - private_preg = *preg; - - private_preg.not_bol = !!(eflags & REG_NOTBOL); - private_preg.not_eol = !!(eflags & REG_NOTEOL); - - /* The user has told us exactly how many registers to return - information about, via `nmatch'. We have to pass that on to the - matching routines. */ - private_preg.regs_allocated = REGS_FIXED; - - if (want_reg_info) - { - regs.num_regs = nmatch; - regs.start = TALLOC (nmatch, regoff_t); - regs.end = TALLOC (nmatch, regoff_t); - if (regs.start == NULL || regs.end == NULL) - return (int) REG_NOMATCH; - } - - /* Perform the searching operation. */ - ret = re_search (&private_preg, string, len, - /* start: */ 0, /* range: */ len, - want_reg_info ? ®s : (struct re_registers *) 0); - - /* Copy the register information to the POSIX structure. */ - if (want_reg_info) - { - if (ret >= 0) - { - unsigned r; - - for (r = 0; r < nmatch; r++) - { - pmatch[r].rm_so = regs.start[r]; - pmatch[r].rm_eo = regs.end[r]; - } - } - - /* If we needed the temporary register info, free the space now. */ - free (regs.start); - free (regs.end); - } - - /* We want zero return to mean success, unlike `re_search'. */ - return ret >= 0 ? (int) REG_NOERROR : (int) REG_NOMATCH; -} - - -/* Returns a message corresponding to an error code, ERRCODE, returned - from either regcomp or regexec. We don't use PREG here. */ - -size_t -regerror (errcode, preg, errbuf, errbuf_size) - int errcode; - const regex_t *preg; - char *errbuf; - size_t errbuf_size; -{ - const char *msg; - size_t msg_size; - - if (errcode < 0 - || errcode >= (int) (sizeof (re_error_msgid) - / sizeof (re_error_msgid[0]))) - /* Only error codes returned by the rest of the code should be passed - to this routine. If we are given anything else, or if other regex - code generates an invalid error code, then the program has a bug. - Dump core so we can fix it. */ - abort (); - - msg = gettext (re_error_msgid[errcode]); - - msg_size = strlen (msg) + 1; /* Includes the null. */ - - if (errbuf_size != 0) - { - if (msg_size > errbuf_size) - { - strncpy (errbuf, msg, errbuf_size - 1); - errbuf[errbuf_size - 1] = 0; - } - else - strcpy (errbuf, msg); - } - - return msg_size; -} - - -/* Free dynamically allocated space used by PREG. */ - -#ifdef __APPLE__ -__private_extern__ -#endif -void -regfree (preg) - regex_t *preg; -{ - if (preg->buffer != NULL) - free (preg->buffer); - preg->buffer = NULL; - - preg->allocated = 0; - preg->used = 0; - - if (preg->fastmap != NULL) - free (preg->fastmap); - preg->fastmap = NULL; - preg->fastmap_accurate = 0; - - if (preg->translate != NULL) - free (preg->translate); - preg->translate = NULL; -} - -#endif /* not emacs */ diff --git a/contrib/awk/stamp-h.in b/contrib/awk/stamp-h.in deleted file mode 100644 index 232f054cb9fee..0000000000000 --- a/contrib/awk/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -Mon Jun 12 15:56:11 IDT 2000 diff --git a/contrib/awk/test/arynocls.awk b/contrib/awk/test/arynocls.awk deleted file mode 100644 index 724c9ac87ed39..0000000000000 --- a/contrib/awk/test/arynocls.awk +++ /dev/null @@ -1,95 +0,0 @@ -#To: bug-gnu-utils@gnu.org -#From: Kristján Jónasson <kristjan@decode.is> -#Subject: Gawk bug -#Cc: arnold@gnu.org -# -#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 -# -# diff --git a/contrib/awk/test/arynocls.in b/contrib/awk/test/arynocls.in deleted file mode 100644 index 8f4712c5c28b8..0000000000000 --- a/contrib/awk/test/arynocls.in +++ /dev/null @@ -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 diff --git a/contrib/awk/test/arynocls.ok b/contrib/awk/test/arynocls.ok deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/awk/test/arynocls.ok +++ /dev/null diff --git a/contrib/awk/test/arysubnm.awk b/contrib/awk/test/arysubnm.awk deleted file mode 100644 index 961b54abf530e..0000000000000 --- a/contrib/awk/test/arysubnm.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { n = 11 ; foo[n] = n; print (2 <= n) } diff --git a/contrib/awk/test/arysubnm.ok b/contrib/awk/test/arysubnm.ok deleted file mode 100644 index d00491fd7e5bb..0000000000000 --- a/contrib/awk/test/arysubnm.ok +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/contrib/awk/test/fnamedat.awk b/contrib/awk/test/fnamedat.awk deleted file mode 100644 index 33a07049cda09..0000000000000 --- a/contrib/awk/test/fnamedat.awk +++ /dev/null @@ -1 +0,0 @@ -function foo() { print foo } {foo()} diff --git a/contrib/awk/test/fnamedat.in b/contrib/awk/test/fnamedat.in deleted file mode 100644 index 257cc5642cb1a..0000000000000 --- a/contrib/awk/test/fnamedat.in +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/contrib/awk/test/fnamedat.ok b/contrib/awk/test/fnamedat.ok deleted file mode 100644 index 0dd0ae5ad8e98..0000000000000 --- a/contrib/awk/test/fnamedat.ok +++ /dev/null @@ -1 +0,0 @@ -gawk: fnamedat.awk:1: (FILENAME=- FNR=1) fatal: can't use function name `foo' as variable or array diff --git a/contrib/awk/test/fnparydl.awk b/contrib/awk/test/fnparydl.awk deleted file mode 100644 index ef3a82255b359..0000000000000 --- a/contrib/awk/test/fnparydl.awk +++ /dev/null @@ -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) -} diff --git a/contrib/awk/test/fnparydl.ok b/contrib/awk/test/fnparydl.ok deleted file mode 100644 index 26a5c3902c864..0000000000000 --- a/contrib/awk/test/fnparydl.ok +++ /dev/null @@ -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[] diff --git a/contrib/awk/test/funsmnam.awk b/contrib/awk/test/funsmnam.awk deleted file mode 100644 index 1e8ca50650c00..0000000000000 --- a/contrib/awk/test/funsmnam.awk +++ /dev/null @@ -1,6 +0,0 @@ -function foo( \ - foo) -{ - print foo -} -{ foo() } diff --git a/contrib/awk/test/funsmnam.ok b/contrib/awk/test/funsmnam.ok deleted file mode 100644 index bc68a2f3bab71..0000000000000 --- a/contrib/awk/test/funsmnam.ok +++ /dev/null @@ -1 +0,0 @@ -gawk: funsmnam.awk:6: fatal: function `foo': can't use function name as parameter name diff --git a/contrib/awk/test/getlnbuf.awk b/contrib/awk/test/getlnbuf.awk deleted file mode 100644 index 8a4483ef46cad..0000000000000 --- a/contrib/awk/test/getlnbuf.awk +++ /dev/null @@ -1,18 +0,0 @@ -#Date: Tue, 21 Dec 1999 16:11:07 +0100 -#From: Daniel Schnell <Daniel.Schnell.GP@icn.siemens.de> -#To: bug-gnu-utils@gnu.org -#CC: arnold@gnu.org -#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) - } diff --git a/contrib/awk/test/getlnbuf.in b/contrib/awk/test/getlnbuf.in deleted file mode 100644 index 062b377f282bc..0000000000000 --- a/contrib/awk/test/getlnbuf.in +++ /dev/null @@ -1,1708 +0,0 @@ -EXTRA_INFO.TYP3.EC := EC; -EXTRA_INFO.TYP3.TEXT:= 'CONNECT_SERVICE TO OAM FAILED'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C003', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_SWERR, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -917596041 -@K@NAME -T_ERR4_1 -@K@INSCRIPT -ERROR_HANDLING: -DB_OVERFLOW -MP/NSEI -@K@CODE -/***@@@ ERROR ***/ -/*@@ERRORTEXT -*@ DB-OVERFLOW -*@ -*@ -*@@DESCRIPTION -*@ THE INSTANCE-CREATION WAS NOT POSSIBLE -*@ BECAUSE THE DATABASE WOULD OVERFLOW -*@ -*@@EXTRA INFO -*@ (EXTRA_INFO_4_STRUCT) -*@ NSEI -*@ NSVCI -*@ TEXT -*@ -*/ - -EXTRA_INFO.TYP4.NSEI := EVD_PTR->.KEYS.INT_ARR(0); -EXTRA_INFO.TYP4.NSVCI:= EVD_PTR->.KEYS.INT_ARR(1); -EXTRA_INFO.TYP4.TEXT := 'NSVC-HAND.: MP/NSEI-OVERFLOW'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C004', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_ESC_MAX_ANY, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -920903219 -@K@NAME -T_ERR4_2 -@K@INSCRIPT -ERROR_HANDLING: -DB_OVERFLOW -MP/NSVCI -@K@CODE -/***@@@ ERROR ***/ -/*@@ERRORTEXT -*@ DB-OVERFLOW -*@ -*@ -*@@DESCRIPTION -*@ THE INSTANCE-CREATION WAS NOT POSSIBLE -*@ BECAUSE THE DATABASE WOULD OVERFLOW -*@ -*@@EXTRA INFO -*@ (EXTRA_INFO_4_STRUCT) -*@ NSEI -*@ NSVCI -*@ TEXT -*@ -*/ - -EXTRA_INFO.TYP4.NSEI := EVD_PTR->.KEYS.INT_ARR(0); -EXTRA_INFO.TYP4.NSVCI:= EVD_PTR->.KEYS.INT_ARR(1); -EXTRA_INFO.TYP4.TEXT := 'NSVC-HAND.: MP/NSVCI-OVERFLOW'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C004', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_ESC_MAX_ANY, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -920903222 -@K@NAME -T_ERR4_3 -@K@INSCRIPT -ERROR_HANDLING: -DB_OVERFLOW -NSEI/NSVCI -@K@CODE -/***@@@ ERROR ***/ -/*@@ERRORTEXT -*@ DB-OVERFLOW -*@ -*@ -*@@DESCRIPTION -*@ THE INSTANCE-CREATION WAS NOT POSSIBLE -*@ BECAUSE THE DATABASE WOULD OVERFLOW -*@ -*@@EXTRA INFO -*@ (EXTRA_INFO_4_STRUCT) -*@ NSEI -*@ NSVCI -*@ TEXT -*@ -*/ - -EXTRA_INFO.TYP4.NSEI := EVD_PTR->.KEYS.INT_ARR(0); -EXTRA_INFO.TYP4.NSVCI:= EVD_PTR->.KEYS.INT_ARR(1); -EXTRA_INFO.TYP4.TEXT := 'NSVC-HAND.: NSEI/NSVC-OVERFLOW'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C004', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_ESC_MAX_ANY, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -920903226 -@K@NAME -TR_RESET -@K@INSCRIPT -RESTART_ -TNS_RESET_ -TIMER -@K@CODE -/* TIMER EVENT DESCRIPTOR STILL THERE */ - -/* INITIALIZATION OF THE TIMER-EVENT-DESCRIPTOR STILL VALID */ -NSVCI_CON_PTR->.TIM_EVD_PTR->.TIMER:= TNS_RESET_MAP; - -/* START TIMER */ -G9PX508_START_TIMER_P -( -NSVCI_CON_PTR->.TIM_EVD_PTR -); - -@K@FREEZE -924684867 -@K@NAME -TX_AUDIT -@K@INSCRIPT -FOR -AUDIT - -@K@NAME -M_BLKOACKM -@K@INSCRIPT -NS_ -BLOCK_ACK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; - -IF -/* 'OTHER' ALIVE NSVC TO THIS NSEI EXISTING? */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR /= NULL -THEN -/* USE THIS 'OTHER' FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -/* NSEI TO BE USED FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; -/* NSVCI TO BE USED FOR TRANSPORT */ -ELSE -/* USE AFFECTED NSVC AGAIN FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -FI; - - -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D3); - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR2_NS_BLOCK_ACK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D3.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -938805885 -@K@NAME -T_RCTRUE -@K@INSCRIPT -RC -= -TRUE -@K@CODE -RC:= TRUE; - -@K@FREEZE -922176328 -@K@NAME -M_AC_SBVCN -@K@INSCRIPT -G9IBME0_ -ACT_ -SIGN_BVC_C -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB512_GET_MSG_LESS_EV_DESCR_P -( -SID_GBNSVC, -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -TX_EVD_PTR->.EVENT_CMD:= G9IBME0_ACT_SIGN_BVC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBBVC_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= EVD_PTR->.KEYS.INT_ARR(0); -TX_EVD_PTR->.KEYS.INT_ARR(1):= SIGN_BVCI; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -938788211 -@K@NAME -T_RC_EOD -@K@INSCRIPT -RC -= -END OF DATA - -@K@CODE -RC:= G9IBSM4_RC_END_OF_DATA; - -@K@FREEZE -921083785 -@K@NAME -T_RC_EMP -@K@INSCRIPT -RC -= -EMPTY - -@K@CODE -RC:= G9IBSM4_RC_EMPTY; - -@K@FREEZE -921083757 -@K@NAME -T_RC_ERR -@K@INSCRIPT -RC -= -ERROR - -@K@CODE -RC:= G9IBSM4_RC_ERROR; - -@K@FREEZE -921083731 -@K@NAME -S_UNUSED -@K@INSCRIPT -G9IBSM0_ -UNUSED -@K@CODE - - -@K@FREEZE -919416670 -@K@NAME -TA_UNBLOCK -@K@INSCRIPT -START_ -TNS_UNBLOCK_ -TIMER -@K@CODE -/* GET TIMER-EVENT DESCRIPTOR */ -G9PB513_GET_TIMER_EV_DESCR_P -( -SID_GBNSVC, -NSVCI_CON_PTR->.TIM_EVD_PTR -); - -/* INITIALIZATION OF THE TIMER-EVENT-DESCRIPTOR */ -NSVCI_CON_PTR->.TIM_EVD_PTR->.EVENT_CMD:= G9IBSE4_TO_TNS_C; -NSVCI_CON_PTR->.TIM_EVD_PTR->.EVENT_DESTINATION:= GBNSVC_HANDLE; -NSVCI_CON_PTR->.TIM_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -NSVCI_CON_PTR->.TIM_EVD_PTR->.KEYS.INT_ARR(1):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; -NSVCI_CON_PTR->.TIM_EVD_PTR->.TIMER:= TNS_UNBLOCK_MAP; - -/* START TIMER */ -G9PX508_START_TIMER_P -( -NSVCI_CON_PTR->.TIM_EVD_PTR -); - -@K@FREEZE -924686210 -@K@NAME -M_BLK_ACKM -@K@INSCRIPT -NS_ -BLOCK_ACK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D3); - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR2_NS_BLOCK_ACK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D3.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -926348442 -@K@NAME -TA_NXTALIV -@K@INSCRIPT -DEFINE -NEW 'NEXT_ -ALIVE' -@K@CODE -IF -/* ALIVE NSVC TO THE NSEI EXISTING? */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR /= NULL - -THEN -/* TAKE NEXT ELEMENT IN THE LINKED LIST AS THE NEXT ALIVE NSVC */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR:= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.NEXT_ALV_NSVCI_CON_PTR; - -FI; - -@K@FREEZE -938801086 -@K@NAME -M_DE_CBVCN -@K@INSCRIPT -G9IBME2_ -DEACT_ -CELL_BVC_C - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB512_GET_MSG_LESS_EV_DESCR_P -( -SID_GBNSVC, -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -TX_EVD_PTR->.EVENT_CMD:= G9IBME2_DEACT_CELL_BVC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBBVC_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -TX_EVD_PTR->.KEYS.INT_ARR(1):= EVD_PTR->.ADD_DATA(3); - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -933318270 -@K@NAME -TA_NXTRESP -@K@INSCRIPT -DEFINE -NEW 'NEXT_ -RESPONSIBLE' -@K@CODE -NSEI_CON_PTR->.NEXT_RESP_NSVCI_CON_PTR:= - NSEI_CON_PTR->.NEXT_RESP_NSVCI_CON_PTR->.NEXT_LSP_NSVCI_CON_PTR; - - -@K@FREEZE -938005006 -@K@NAME -TA_NXTSUBS -@K@INSCRIPT -DEFINE -NEW 'NEXT_ -SUBSTITUTE' -@K@CODE -NSEI_CON_PTR->.NEXT_SUBS_NSVCI_CON_PTR:= - NSEI_CON_PTR->.NEXT_SUBS_NSVCI_CON_PTR->.NEXT_UBL_NSVCI_CON_PTR; - -@K@NAME -M_BLK_O__M -@K@INSCRIPT -NS_ -BLOCK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; - -IF -/* 'OTHER' ALIVE NSVC TO THIS NSEI EXISTING? */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR /= NULL -THEN -/* USE THIS 'OTHER' FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -/* NSEI TO BE USED FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; -/* NSVCI TO BE USED FOR TRANSPORT */ -ELSE -/* USE AFFECTED NSVC AGAIN FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -FI; - - -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D2); - - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR1_NS_BLOCK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D2.CAUSE_TLV.CAUSE_VAL:= - G9IBBA2_NS_TRANSIT_NETWORK_FAILURE; /* CAUSE FOR BLOCK */ -NS_PDU_PTR->.D2.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@TEXT -GSM 8.16 CHAP. 7.2: -THE NS-BLOCK-PDU MAY BE SENT IN ANY ALIVE -(BLOCKED OR UNBLOCKED) NS-VC... -@K@FREEZE -938803215 -@K@NAME -M_DE_SBVCN -@K@INSCRIPT -G9IBME1_ -DEACT_ -SIGN_BVC_C -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB512_GET_MSG_LESS_EV_DESCR_P -( -SID_GBNSVC, -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -TX_EVD_PTR->.EVENT_CMD:= G9IBME1_DEACT_SIGN_BVC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBBVC_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= EVD_PTR->.KEYS.INT_ARR(0); -TX_EVD_PTR->.KEYS.INT_ARR(1):= SIGN_BVCI; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -938788201 -@K@NAME -M_OAME401M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSE */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSE; -OAM_MSG_PTR->.HANDLED_OBJECT.NSE_ID:= EVD_PTR->.KEYS.INT_ARR(0); /* -USED NSEI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* AFFECTED NSEI (FROM PDU) */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* AFFECTED NSVCI (FROM PDU) */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935766108 -@K@NAME -M_OAME402M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.KEYS.INT_ARR(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* NSEI FROM PDU */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* NSVCI FROM PDU */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935766407 -@K@NAME -M_OAME411M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_ACK_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSE */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSE; -OAM_MSG_PTR->.HANDLED_OBJECT.NSE_ID:= EVD_PTR->.KEYS.INT_ARR(0); /* -USED NSEI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_ACK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* NSEI FROM PDU */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* NSVCI FROM PDU */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935767332 -@K@NAME -M_OAME412M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_ACK_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.KEYS.INT_ARR(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_ACK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* NSEI FROM PDU */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* NSVCI FROM PDU */ - - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935767189 -@K@NAME -C_CON -@K@INSCRIPT -RC_DB -@K@CODE -RC_DB - -@K@FREEZE -922176673 -@K@NAME -M_BLK____M -@K@INSCRIPT -NS_ -BLOCK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D2); - - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR1_NS_BLOCK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D2.CAUSE_TLV.CAUSE_VAL:= - G9IBBA2_NS_OAM_INTERVENTION; /* CAUSE FOR BLOCK */ -NS_PDU_PTR->.D2.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@TEXT -GSM 8.16 CHAP. 7.2: -THE NS-BLOCK-PDU MAY BE SENT IN ANY ALIVE -(BLOCKED OR UNBLOCKED) NS-VC... -@K@FREEZE -926348613 -@K@NAME -S_BLOCKED -@K@INSCRIPT -G9IBSM0_ -BLOCKED -@K@CODE - - -@K@FREEZE -922176496 -@K@NAME -D_CON -@K@INSCRIPT -CONTEXT -GOT -@K@CODE -RC_DB = G9IBSR0_RC_OK - -@K@FREEZE -921772339 -@K@NAME -M_OAME901M -@K@INSCRIPT -ERROR_MESSAGE: -OPERATIONAL_STATE_CHANGE -UBL->BLK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = OPERATIONAL_STATE_CHANGE */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_OPERATIONAL_STATE_CHANGE; -/* ADDITIONAL_OPERATIONAL_STATE_INFO */ -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_OLD:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_OLD:= - G9OC102_ENABLED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_NEW:= - G9OC102_ENABLED; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -925970975 -@K@NAME -M_OAME902M -@K@INSCRIPT -ERROR_MESSAGE: -OPERATIONAL_STATE_CHANGE -UBL->BLK - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = OPERATIONAL_STATE_CHANGE */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_OPERATIONAL_STATE_CHANGE; -/* ADDITIONAL_OPERATIONAL_STATE_INFO */ -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_OLD:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_OLD:= - G9OC102_ENABLED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_NEW:= - G9OC102_DISABLED; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -925970987 -@K@NAME -M_OAME10SM -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@NAME -M_OAME911M -@K@INSCRIPT -ERROR_MESSAGE: -OPERATIONAL_STATE_CHANGE -BLK->UBL -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = OPERATIONAL_STATE_CHANGE */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_OPERATIONAL_STATE_CHANGE; -/* ADDITIONAL_OPERATIONAL_STATE_INFO */ -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_NEW:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_OLD:= - G9OC102_ENABLED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_NEW:= - G9OC102_ENABLED; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -925970996 -@K@NAME -M_OAME20SM -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_END_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_END_NS_ALIVE_TEST */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_END_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@NAME -M_OAME10_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443813 -@K@NAME -D_SEM -@K@INSCRIPT -CALL_SEM -= -TRUE -@K@CODE -CALL_SEM = TRUE - -@K@FREEZE -922176624 -@K@NAME -D_N_0 -@K@INSCRIPT -N = 0 - -@K@CODE -NSVCI_CON_PTR->.N = 0 - -@K@FREEZE -921511000 -@K@NAME -M_OAME12_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - FALSE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_ALIVE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443829 -@K@NAME -M_OAME21_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_END_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_END_NS_ALIVE_TEST */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_END_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - FALSE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443856 -@K@NAME -M_OAME13_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - FALSE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_ALIVE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443838 -@K@NAME -M_OAME22_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_END_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_END_NS_ALIVE_TEST */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_END_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - FALSE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_ALIVE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443864 -@K@NAME -M_OAME30_M -@K@INSCRIPT -ERROR_MESSAGE: -NO_ANSWER_FORM_BSS -RESET_PROCEDURE - - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = NO_ANSWER_FROM_BSS */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_NO_ANSWER_FROM_BSS; -/* INITIATED_PROCEDURE */ -OAM_MSG_PTR->.INITIATED_PROCEDURE:= - G9OC123_RESET_PROCEDURE; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922175973 -@K@NAME -M_OAME31_M -@K@INSCRIPT -ERROR_MESSAGE: -NO_ANSWER_FROM_BSS -BLOCK_PROCEDURE - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = NO_ANSWER_FROM_BSS */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_NO_ANSWER_FROM_BSS; -/* INITIATED_PROCEDURE */ -OAM_MSG_PTR->.INITIATED_PROCEDURE:= - G9OC123_BLOCK_PROCEDURE; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922175976 -@K@NAME -M_OAME32_M -@K@INSCRIPT -ERROR_MESSAGE: -NO_ANSWER_FROM_BSS -UNBLOCK_PROCEDURE - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = NO_ANSWER_FROM_BSS */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_NO_ANSWER_FROM_BSS; -/* INITIATED_PROCEDURE */ -OAM_MSG_PTR->.INITIATED_PROCEDURE:= - G9OC123_UNBLOCK_PROCEDURE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922175980 -@K@NAME -M_OAME42_M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -BLOCK_PDU -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.ADD_DATA(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_BLOCK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.KEYS.INT_ARR(0); /* AFFECTED NSEI (FROM PDU) */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.KEYS.INT_ARR(1); /* AFFECTED NSVCI (FROM PDU) */ - - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -934296141 -@K@NAME -M_OAME50_M -@K@INSCRIPT -ERROR_MESSAGE: -STATUS_PDU_CONTAINS_ERROR_INFO -RECEIVED -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR-CAUSE = STATUS_PDU_CONTAINS_ERROR_INFO */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_STATUS_PDU_CONTAINS_ERROR_INFO; -/* ADDITIONAL_STATUS_PDU_INFO */ -INT_CAUSE_PTR.INT_PTR:= ADDR(EVD_PTR->.ADD_DATA(2)); -OAM_MSG_PTR->.ADDITIONAL_STATUS_PDU_INFO:= - INT_CAUSE_PTR.CAUSE_PTR->; /* CAUSE */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@TEXT -NICHT OK - -@K@FREEZE -934298924 -@K@NAME -M_OAME43_M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -BLOCK_ACK_PDU -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.ADD_DATA(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_BLOCK_ACK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.KEYS.INT_ARR(0); /* AFFECTED NSEI (FROM PDU) */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.KEYS.INT_ARR(1); /* AFFECTED NSVCI (FROM PDU) */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -934297710 diff --git a/contrib/awk/test/getlnbuf.ok b/contrib/awk/test/getlnbuf.ok deleted file mode 100644 index 062b377f282bc..0000000000000 --- a/contrib/awk/test/getlnbuf.ok +++ /dev/null @@ -1,1708 +0,0 @@ -EXTRA_INFO.TYP3.EC := EC; -EXTRA_INFO.TYP3.TEXT:= 'CONNECT_SERVICE TO OAM FAILED'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C003', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_SWERR, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -917596041 -@K@NAME -T_ERR4_1 -@K@INSCRIPT -ERROR_HANDLING: -DB_OVERFLOW -MP/NSEI -@K@CODE -/***@@@ ERROR ***/ -/*@@ERRORTEXT -*@ DB-OVERFLOW -*@ -*@ -*@@DESCRIPTION -*@ THE INSTANCE-CREATION WAS NOT POSSIBLE -*@ BECAUSE THE DATABASE WOULD OVERFLOW -*@ -*@@EXTRA INFO -*@ (EXTRA_INFO_4_STRUCT) -*@ NSEI -*@ NSVCI -*@ TEXT -*@ -*/ - -EXTRA_INFO.TYP4.NSEI := EVD_PTR->.KEYS.INT_ARR(0); -EXTRA_INFO.TYP4.NSVCI:= EVD_PTR->.KEYS.INT_ARR(1); -EXTRA_INFO.TYP4.TEXT := 'NSVC-HAND.: MP/NSEI-OVERFLOW'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C004', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_ESC_MAX_ANY, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -920903219 -@K@NAME -T_ERR4_2 -@K@INSCRIPT -ERROR_HANDLING: -DB_OVERFLOW -MP/NSVCI -@K@CODE -/***@@@ ERROR ***/ -/*@@ERRORTEXT -*@ DB-OVERFLOW -*@ -*@ -*@@DESCRIPTION -*@ THE INSTANCE-CREATION WAS NOT POSSIBLE -*@ BECAUSE THE DATABASE WOULD OVERFLOW -*@ -*@@EXTRA INFO -*@ (EXTRA_INFO_4_STRUCT) -*@ NSEI -*@ NSVCI -*@ TEXT -*@ -*/ - -EXTRA_INFO.TYP4.NSEI := EVD_PTR->.KEYS.INT_ARR(0); -EXTRA_INFO.TYP4.NSVCI:= EVD_PTR->.KEYS.INT_ARR(1); -EXTRA_INFO.TYP4.TEXT := 'NSVC-HAND.: MP/NSVCI-OVERFLOW'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C004', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_ESC_MAX_ANY, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -920903222 -@K@NAME -T_ERR4_3 -@K@INSCRIPT -ERROR_HANDLING: -DB_OVERFLOW -NSEI/NSVCI -@K@CODE -/***@@@ ERROR ***/ -/*@@ERRORTEXT -*@ DB-OVERFLOW -*@ -*@ -*@@DESCRIPTION -*@ THE INSTANCE-CREATION WAS NOT POSSIBLE -*@ BECAUSE THE DATABASE WOULD OVERFLOW -*@ -*@@EXTRA INFO -*@ (EXTRA_INFO_4_STRUCT) -*@ NSEI -*@ NSVCI -*@ TEXT -*@ -*/ - -EXTRA_INFO.TYP4.NSEI := EVD_PTR->.KEYS.INT_ARR(0); -EXTRA_INFO.TYP4.NSVCI:= EVD_PTR->.KEYS.INT_ARR(1); -EXTRA_INFO.TYP4.TEXT := 'NSVC-HAND.: NSEI/NSVC-OVERFLOW'; - -G9PXYA1S!G9TE500_EHP_P( -'G9IBSA1C004', /*@@ID*/ -G9PXYA1S!G9TE102_ERR_CLASS_ESC_MAX_ANY, /*@@CLASS*/ -ADDR(EXTRA_INFO.ERROR_HANDLER), /* EXTRA-INFO ADDR */ -G9PXYA1S!G9TE100_GB_LM, /* USER-ID */ -NULL /* OPTIONAL-SWET-INFO ADDR */ -); -/***@@@ END OF ERROR ***/ - -@K@FREEZE -920903226 -@K@NAME -TR_RESET -@K@INSCRIPT -RESTART_ -TNS_RESET_ -TIMER -@K@CODE -/* TIMER EVENT DESCRIPTOR STILL THERE */ - -/* INITIALIZATION OF THE TIMER-EVENT-DESCRIPTOR STILL VALID */ -NSVCI_CON_PTR->.TIM_EVD_PTR->.TIMER:= TNS_RESET_MAP; - -/* START TIMER */ -G9PX508_START_TIMER_P -( -NSVCI_CON_PTR->.TIM_EVD_PTR -); - -@K@FREEZE -924684867 -@K@NAME -TX_AUDIT -@K@INSCRIPT -FOR -AUDIT - -@K@NAME -M_BLKOACKM -@K@INSCRIPT -NS_ -BLOCK_ACK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; - -IF -/* 'OTHER' ALIVE NSVC TO THIS NSEI EXISTING? */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR /= NULL -THEN -/* USE THIS 'OTHER' FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -/* NSEI TO BE USED FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; -/* NSVCI TO BE USED FOR TRANSPORT */ -ELSE -/* USE AFFECTED NSVC AGAIN FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -FI; - - -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D3); - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR2_NS_BLOCK_ACK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D3.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -938805885 -@K@NAME -T_RCTRUE -@K@INSCRIPT -RC -= -TRUE -@K@CODE -RC:= TRUE; - -@K@FREEZE -922176328 -@K@NAME -M_AC_SBVCN -@K@INSCRIPT -G9IBME0_ -ACT_ -SIGN_BVC_C -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB512_GET_MSG_LESS_EV_DESCR_P -( -SID_GBNSVC, -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -TX_EVD_PTR->.EVENT_CMD:= G9IBME0_ACT_SIGN_BVC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBBVC_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= EVD_PTR->.KEYS.INT_ARR(0); -TX_EVD_PTR->.KEYS.INT_ARR(1):= SIGN_BVCI; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -938788211 -@K@NAME -T_RC_EOD -@K@INSCRIPT -RC -= -END OF DATA - -@K@CODE -RC:= G9IBSM4_RC_END_OF_DATA; - -@K@FREEZE -921083785 -@K@NAME -T_RC_EMP -@K@INSCRIPT -RC -= -EMPTY - -@K@CODE -RC:= G9IBSM4_RC_EMPTY; - -@K@FREEZE -921083757 -@K@NAME -T_RC_ERR -@K@INSCRIPT -RC -= -ERROR - -@K@CODE -RC:= G9IBSM4_RC_ERROR; - -@K@FREEZE -921083731 -@K@NAME -S_UNUSED -@K@INSCRIPT -G9IBSM0_ -UNUSED -@K@CODE - - -@K@FREEZE -919416670 -@K@NAME -TA_UNBLOCK -@K@INSCRIPT -START_ -TNS_UNBLOCK_ -TIMER -@K@CODE -/* GET TIMER-EVENT DESCRIPTOR */ -G9PB513_GET_TIMER_EV_DESCR_P -( -SID_GBNSVC, -NSVCI_CON_PTR->.TIM_EVD_PTR -); - -/* INITIALIZATION OF THE TIMER-EVENT-DESCRIPTOR */ -NSVCI_CON_PTR->.TIM_EVD_PTR->.EVENT_CMD:= G9IBSE4_TO_TNS_C; -NSVCI_CON_PTR->.TIM_EVD_PTR->.EVENT_DESTINATION:= GBNSVC_HANDLE; -NSVCI_CON_PTR->.TIM_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -NSVCI_CON_PTR->.TIM_EVD_PTR->.KEYS.INT_ARR(1):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; -NSVCI_CON_PTR->.TIM_EVD_PTR->.TIMER:= TNS_UNBLOCK_MAP; - -/* START TIMER */ -G9PX508_START_TIMER_P -( -NSVCI_CON_PTR->.TIM_EVD_PTR -); - -@K@FREEZE -924686210 -@K@NAME -M_BLK_ACKM -@K@INSCRIPT -NS_ -BLOCK_ACK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D3); - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR2_NS_BLOCK_ACK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D3.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -926348442 -@K@NAME -TA_NXTALIV -@K@INSCRIPT -DEFINE -NEW 'NEXT_ -ALIVE' -@K@CODE -IF -/* ALIVE NSVC TO THE NSEI EXISTING? */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR /= NULL - -THEN -/* TAKE NEXT ELEMENT IN THE LINKED LIST AS THE NEXT ALIVE NSVC */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR:= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.NEXT_ALV_NSVCI_CON_PTR; - -FI; - -@K@FREEZE -938801086 -@K@NAME -M_DE_CBVCN -@K@INSCRIPT -G9IBME2_ -DEACT_ -CELL_BVC_C - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB512_GET_MSG_LESS_EV_DESCR_P -( -SID_GBNSVC, -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -TX_EVD_PTR->.EVENT_CMD:= G9IBME2_DEACT_CELL_BVC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBBVC_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -TX_EVD_PTR->.KEYS.INT_ARR(1):= EVD_PTR->.ADD_DATA(3); - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -933318270 -@K@NAME -TA_NXTRESP -@K@INSCRIPT -DEFINE -NEW 'NEXT_ -RESPONSIBLE' -@K@CODE -NSEI_CON_PTR->.NEXT_RESP_NSVCI_CON_PTR:= - NSEI_CON_PTR->.NEXT_RESP_NSVCI_CON_PTR->.NEXT_LSP_NSVCI_CON_PTR; - - -@K@FREEZE -938005006 -@K@NAME -TA_NXTSUBS -@K@INSCRIPT -DEFINE -NEW 'NEXT_ -SUBSTITUTE' -@K@CODE -NSEI_CON_PTR->.NEXT_SUBS_NSVCI_CON_PTR:= - NSEI_CON_PTR->.NEXT_SUBS_NSVCI_CON_PTR->.NEXT_UBL_NSVCI_CON_PTR; - -@K@NAME -M_BLK_O__M -@K@INSCRIPT -NS_ -BLOCK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; - -IF -/* 'OTHER' ALIVE NSVC TO THIS NSEI EXISTING? */ -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR /= NULL -THEN -/* USE THIS 'OTHER' FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; -/* NSEI TO BE USED FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - -NSVCI_CON_PTR->.OWN_NSEI_CON_PTR->.NEXT_ALIV_NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; -/* NSVCI TO BE USED FOR TRANSPORT */ -ELSE -/* USE AFFECTED NSVC AGAIN FOR TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(0):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -FI; - - -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D2); - - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR1_NS_BLOCK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D2.CAUSE_TLV.CAUSE_VAL:= - G9IBBA2_NS_TRANSIT_NETWORK_FAILURE; /* CAUSE FOR BLOCK */ -NS_PDU_PTR->.D2.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@TEXT -GSM 8.16 CHAP. 7.2: -THE NS-BLOCK-PDU MAY BE SENT IN ANY ALIVE -(BLOCKED OR UNBLOCKED) NS-VC... -@K@FREEZE -938803215 -@K@NAME -M_DE_SBVCN -@K@INSCRIPT -G9IBME1_ -DEACT_ -SIGN_BVC_C -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB512_GET_MSG_LESS_EV_DESCR_P -( -SID_GBNSVC, -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -TX_EVD_PTR->.EVENT_CMD:= G9IBME1_DEACT_SIGN_BVC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBBVC_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= EVD_PTR->.KEYS.INT_ARR(0); -TX_EVD_PTR->.KEYS.INT_ARR(1):= SIGN_BVCI; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -938788201 -@K@NAME -M_OAME401M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSE */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSE; -OAM_MSG_PTR->.HANDLED_OBJECT.NSE_ID:= EVD_PTR->.KEYS.INT_ARR(0); /* -USED NSEI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* AFFECTED NSEI (FROM PDU) */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* AFFECTED NSVCI (FROM PDU) */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935766108 -@K@NAME -M_OAME402M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.KEYS.INT_ARR(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* NSEI FROM PDU */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* NSVCI FROM PDU */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935766407 -@K@NAME -M_OAME411M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_ACK_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSE */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSE; -OAM_MSG_PTR->.HANDLED_OBJECT.NSE_ID:= EVD_PTR->.KEYS.INT_ARR(0); /* -USED NSEI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_ACK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* NSEI FROM PDU */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* NSVCI FROM PDU */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935767332 -@K@NAME -M_OAME412M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -RESET_ACK_PDU - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.KEYS.INT_ARR(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_RESET_ACK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.ADD_DATA(0); /* NSEI FROM PDU */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.ADD_DATA(1); /* NSVCI FROM PDU */ - - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -935767189 -@K@NAME -C_CON -@K@INSCRIPT -RC_DB -@K@CODE -RC_DB - -@K@FREEZE -922176673 -@K@NAME -M_BLK____M -@K@INSCRIPT -NS_ -BLOCK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9IBDF4_NS_LM_M) + G9IBD44_NS_PDU_DATA_OFFSET_C), -TX_EVD_PTR -); - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9IBD40_NS_LM_PDU_C; -TX_EVD_PTR->.EVENT_DESTINATION:= GBDL_HANDLE; -TX_EVD_PTR->.KEYS.INT_ARR(0):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSEI; /* NSEI TO BE USED FOR -TRANSPORT */ -TX_EVD_PTR->.KEYS.INT_ARR(1):= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVCI TO BE USED FOR -TRANSPORT */ -/* POINTER TO PDU IN POOL-ELEMENT */ -NS_PDU_PTR:= NS_PDU_REF_M (INT(TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT) - + G9IBD44_NS_PDU_DATA_OFFSET_C); -/* OFFSET OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_OFFSET:= G9IBD44_NS_PDU_DATA_OFFSET_C; -/* LENGTH OF THE PDU IN POOL-ELEMENT */ -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(NS_PDU_PTR->.G9IBDF4_PDU_TYPE) + -SIZE(NS_PDU_PTR->.D2); - - -/* NOW THE POOL-ELEMENT */ -NS_PDU_PTR->.G9IBDF4_PDU_TYPE:= G9IBDR1_NS_BLOCK_C; /* PDU-TYPE */ - -NS_PDU_PTR->.D2.CAUSE_TLV.CAUSE_VAL:= - G9IBBA2_NS_OAM_INTERVENTION; /* CAUSE FOR BLOCK */ -NS_PDU_PTR->.D2.NSVCI_TLV.NSVCI_VAL := - NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; /* NSVC TO BE BLOCKED */ - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@TEXT -GSM 8.16 CHAP. 7.2: -THE NS-BLOCK-PDU MAY BE SENT IN ANY ALIVE -(BLOCKED OR UNBLOCKED) NS-VC... -@K@FREEZE -926348613 -@K@NAME -S_BLOCKED -@K@INSCRIPT -G9IBSM0_ -BLOCKED -@K@CODE - - -@K@FREEZE -922176496 -@K@NAME -D_CON -@K@INSCRIPT -CONTEXT -GOT -@K@CODE -RC_DB = G9IBSR0_RC_OK - -@K@FREEZE -921772339 -@K@NAME -M_OAME901M -@K@INSCRIPT -ERROR_MESSAGE: -OPERATIONAL_STATE_CHANGE -UBL->BLK -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = OPERATIONAL_STATE_CHANGE */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_OPERATIONAL_STATE_CHANGE; -/* ADDITIONAL_OPERATIONAL_STATE_INFO */ -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_OLD:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_OLD:= - G9OC102_ENABLED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_NEW:= - G9OC102_ENABLED; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -925970975 -@K@NAME -M_OAME902M -@K@INSCRIPT -ERROR_MESSAGE: -OPERATIONAL_STATE_CHANGE -UBL->BLK - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = OPERATIONAL_STATE_CHANGE */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_OPERATIONAL_STATE_CHANGE; -/* ADDITIONAL_OPERATIONAL_STATE_INFO */ -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_OLD:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_OLD:= - G9OC102_ENABLED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_NEW:= - G9OC102_DISABLED; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -925970987 -@K@NAME -M_OAME10SM -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@NAME -M_OAME911M -@K@INSCRIPT -ERROR_MESSAGE: -OPERATIONAL_STATE_CHANGE -BLK->UBL -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = OPERATIONAL_STATE_CHANGE */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_OPERATIONAL_STATE_CHANGE; -/* ADDITIONAL_OPERATIONAL_STATE_INFO */ -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.OPER_STATE_NEW:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_OLD:= - G9OC102_ENABLED; -OAM_MSG_PTR->.ADDITIONAL_OPERATIONAL_STATE_INFO.ADMIN_STATE_NEW:= - G9OC102_ENABLED; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -925970996 -@K@NAME -M_OAME20SM -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_END_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_END_NS_ALIVE_TEST */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_END_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@NAME -M_OAME10_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443813 -@K@NAME -D_SEM -@K@INSCRIPT -CALL_SEM -= -TRUE -@K@CODE -CALL_SEM = TRUE - -@K@FREEZE -922176624 -@K@NAME -D_N_0 -@K@INSCRIPT -N = 0 - -@K@CODE -NSVCI_CON_PTR->.N = 0 - -@K@FREEZE -921511000 -@K@NAME -M_OAME12_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - FALSE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_ALIVE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443829 -@K@NAME -M_OAME21_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_END_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_END_NS_ALIVE_TEST */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_END_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - TRUE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - FALSE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443856 -@K@NAME -M_OAME13_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_BEGIN_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_BEGIN_NS_ALIVE_TEST*/ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_BEGIN_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - FALSE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_UNBLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_ALIVE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443838 -@K@NAME -M_OAME22_M -@K@INSCRIPT -ERROR_MESSAGE: -ALARM_END_NS_ALIVE_TEST -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = ALARM_END_NS_ALIVE_TEST */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ALARM_END_NS_ALIVE_TEST; -/* ADDITIONAL_ALARM_INFO */ -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.ADMINISTRATIVE_STATE_CHANGED:= - FALSE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_OLD:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.OPER_STATE_NEW:= - G9OC101_BLOCKED; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_OLD:= - G9OC103_DEAD; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.AVAIL_STATE_NEW:= - G9OC103_ALIVE; -OAM_MSG_PTR->.ADDITIONAL_ALARM_INFO.CONFIGURATION_OF_NSVC:= - TRUE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922443864 -@K@NAME -M_OAME30_M -@K@INSCRIPT -ERROR_MESSAGE: -NO_ANSWER_FORM_BSS -RESET_PROCEDURE - - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = NO_ANSWER_FROM_BSS */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_NO_ANSWER_FROM_BSS; -/* INITIATED_PROCEDURE */ -OAM_MSG_PTR->.INITIATED_PROCEDURE:= - G9OC123_RESET_PROCEDURE; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922175973 -@K@NAME -M_OAME31_M -@K@INSCRIPT -ERROR_MESSAGE: -NO_ANSWER_FROM_BSS -BLOCK_PROCEDURE - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = NO_ANSWER_FROM_BSS */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_NO_ANSWER_FROM_BSS; -/* INITIATED_PROCEDURE */ -OAM_MSG_PTR->.INITIATED_PROCEDURE:= - G9OC123_BLOCK_PROCEDURE; - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922175976 -@K@NAME -M_OAME32_M -@K@INSCRIPT -ERROR_MESSAGE: -NO_ANSWER_FROM_BSS -UNBLOCK_PROCEDURE - -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR_CAUSE = NO_ANSWER_FROM_BSS */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_NO_ANSWER_FROM_BSS; -/* INITIATED_PROCEDURE */ -OAM_MSG_PTR->.INITIATED_PROCEDURE:= - G9OC123_UNBLOCK_PROCEDURE; - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -922175980 -@K@NAME -M_OAME42_M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -BLOCK_PDU -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.ADD_DATA(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_BLOCK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.KEYS.INT_ARR(0); /* AFFECTED NSEI (FROM PDU) */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.KEYS.INT_ARR(1); /* AFFECTED NSVCI (FROM PDU) */ - - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -934296141 -@K@NAME -M_OAME50_M -@K@INSCRIPT -ERROR_MESSAGE: -STATUS_PDU_CONTAINS_ERROR_INFO -RECEIVED -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= -NSVCI_CON_PTR->.DBMS.NSVC_INSTANCE.NSVCI; - -/* ERROR-CAUSE = STATUS_PDU_CONTAINS_ERROR_INFO */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_STATUS_PDU_CONTAINS_ERROR_INFO; -/* ADDITIONAL_STATUS_PDU_INFO */ -INT_CAUSE_PTR.INT_PTR:= ADDR(EVD_PTR->.ADD_DATA(2)); -OAM_MSG_PTR->.ADDITIONAL_STATUS_PDU_INFO:= - INT_CAUSE_PTR.CAUSE_PTR->; /* CAUSE */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@TEXT -NICHT OK - -@K@FREEZE -934298924 -@K@NAME -M_OAME43_M -@K@INSCRIPT -ERROR_MESSAGE: -ERRONOUS_PDU -BLOCK_ACK_PDU -@K@CODE -/* GETTING THE EVENT DESCRIPTOR */ -G9PB511_GET_MSG_BOUND_EV_DESCR_P -( -SID_GBNSVC, -(SIZE(G9OC109_REPORTED_EVENT_STR_M)), -TX_EVD_PTR -); - - -/* COMPOSING THE EVENT */ -/* FIRST THE DESCRIPTOR */ -TX_EVD_PTR->.EVENT_CMD:= G9PX040_SEND_MBC_C; -TX_EVD_PTR->.EVENT_DESTINATION:= RXTX_HANDLE; -TX_EVD_PTR->.KEYS.UBI_INDEX:= OAM_UBI_INDEX; -TX_EVD_PTR->.BOUND.DATA_OFFSET:= 0; -TX_EVD_PTR->.BOUND.DATA_LENGTH:= SIZE(G9OC109_REPORTED_EVENT_STR_M); - -/* NOW THE POOL-ELEMENT */ -/* INITIALIZATION OF THE POINTER WITH THE POOL-ELEMENT-START */ -OAM_MSG_PTR:= OAM_MSG_PTR_M (TX_EVD_PTR->.BOUND.PTR_TO_POOL_ELEMENT); - -/* COMPOSING THE MESSAGE */ -/* HANDLED OBJECT = AFFECTED INSTANCE, TYPE NSVC */ -OAM_MSG_PTR->.HANDLED_OBJECT.OBJECT_TYPE:= G9OC104_NSVC; -OAM_MSG_PTR->.HANDLED_OBJECT.NSVC_ID:= EVD_PTR->.ADD_DATA(1); /* -USED NSVCI (FROM ECI) */ - -/* ERROR-CAUSE = ERRONEOUS_PDU */ -OAM_MSG_PTR->.ERROR_CAUSE:= G9OC108_ERRONEOUS_PDU; -/* ADDITIONAL_PDU_INFO */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_PDU_TYPE:= - G9OC124_BLOCK_ACK_PDU; -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSEI:= - EVD_PTR->.KEYS.INT_ARR(0); /* AFFECTED NSEI (FROM PDU) */ -OAM_MSG_PTR->.ADDITIONAL_PDU_INFO.G9OC120_REPORTED_NSVC:= - EVD_PTR->.KEYS.INT_ARR(1); /* AFFECTED NSVCI (FROM PDU) */ - - - -/* SENDING */ -G9PX503_POST_EVENT_P(TX_EVD_PTR); - -@K@FREEZE -934297710 diff --git a/contrib/awk/test/getnr2tb.awk b/contrib/awk/test/getnr2tb.awk deleted file mode 100644 index 204acf463e35b..0000000000000 --- a/contrib/awk/test/getnr2tb.awk +++ /dev/null @@ -1,111 +0,0 @@ -#From vp@dmat.uevora.pt Thu Jun 18 09:10 EDT 1998 -#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id JAA23649 for <arnold@mathcs.emory.edu>; 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 <arnold@gnu.ai.mit.edu>; 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 <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 14:13:57 +0100 -#Message-Id: <199806181313.OAA11817@khromeleque.dmat.uevora.pt> -#To: arnold@gnu.org -#Subject: concatenation bug in gawk 3.0.3 -#Date: Thu, 18 Jun 1998 14:13:57 +0200 -#From: Vasco Pedro <vp@dmat.uevora.pt> -#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 } diff --git a/contrib/awk/test/getnr2tb.in b/contrib/awk/test/getnr2tb.in deleted file mode 100644 index f98585722413e..0000000000000 --- a/contrib/awk/test/getnr2tb.in +++ /dev/null @@ -1,6 +0,0 @@ -line 1 -line 2 -line 3 -line 4 -line 5 -line 6 diff --git a/contrib/awk/test/getnr2tb.ok b/contrib/awk/test/getnr2tb.ok deleted file mode 100644 index 7b40e8d7519cb..0000000000000 --- a/contrib/awk/test/getnr2tb.ok +++ /dev/null @@ -1,6 +0,0 @@ -1 10 -2 5 -3 3.33333 -4 2.5 -5 2 -6 1.66667 diff --git a/contrib/awk/test/getnr2tm.awk b/contrib/awk/test/getnr2tm.awk deleted file mode 100644 index dfe377a84887f..0000000000000 --- a/contrib/awk/test/getnr2tm.awk +++ /dev/null @@ -1,75 +0,0 @@ -#From dhw@gamgee.acad.emich.edu Sat Oct 31 22:54:07 1998 -#Return-Path: <dhw@gamgee.acad.emich.edu> -#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 <arobbins@netvision.net.il>; Sat, 31 Oct 1998 07:14:07 +0200 (IST) -#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id AAA14947 for <arnold@mathcs.emory.edu>; 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 <arnold@gnu.ai.mit.edu>; 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: <m0zZUKY-000IDSC@gamgee.acad.emich.edu> -#Date: Sat, 31 Oct 98 00:16 CST -#From: dhw@gamgee.acad.emich.edu (David H. West) -#To: bug-gnu-utils@gnu.org -#Subject: gawk 3.0.3 bug report -#Cc: arnold@gnu.org -#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 dhw@gamgee.acad.emich.edu -# diff --git a/contrib/awk/test/getnr2tm.in b/contrib/awk/test/getnr2tm.in deleted file mode 100644 index 78981922613b2..0000000000000 --- a/contrib/awk/test/getnr2tm.in +++ /dev/null @@ -1 +0,0 @@ -a diff --git a/contrib/awk/test/getnr2tm.ok b/contrib/awk/test/getnr2tm.ok deleted file mode 100644 index d63fca0990e77..0000000000000 --- a/contrib/awk/test/getnr2tm.ok +++ /dev/null @@ -1 +0,0 @@ -1 lines in 1 sec: 1 lines/sec; nlines=1 diff --git a/contrib/awk/test/gtlnbufv.awk b/contrib/awk/test/gtlnbufv.awk deleted file mode 100644 index ce7d243c9c708..0000000000000 --- a/contrib/awk/test/gtlnbufv.awk +++ /dev/null @@ -1,2 +0,0 @@ -/@K@CODE/ { print ; getline temp ; print temp ;next } -{print} diff --git a/contrib/awk/test/igncdym.awk b/contrib/awk/test/igncdym.awk deleted file mode 100644 index 3119c3e9c36e3..0000000000000 --- a/contrib/awk/test/igncdym.awk +++ /dev/null @@ -1,56 +0,0 @@ -#From Jeffrey.B.Woodward@Hitchcock.ORG Mon Feb 21 09:33:32 2000 -#Message-id: <12901034@mailbox2.Hitchcock.ORG> -#Date: 20 Feb 2000 18:14:11 EST -#From: Jeffrey.B.Woodward@Hitchcock.ORG (Jeffrey B. Woodward) -#Subject: gawk 3.0.4 bug -#To: bug-gnu-utils@gnu.org -#Cc: arnold@gnu.org -# -#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 diff --git a/contrib/awk/test/igncdym.in b/contrib/awk/test/igncdym.in deleted file mode 100644 index 43e361aa6480f..0000000000000 --- a/contrib/awk/test/igncdym.in +++ /dev/null @@ -1,2 +0,0 @@ -This is foo -This is bar diff --git a/contrib/awk/test/igncdym.ok b/contrib/awk/test/igncdym.ok deleted file mode 100644 index e715a6de5c21e..0000000000000 --- a/contrib/awk/test/igncdym.ok +++ /dev/null @@ -1,4 +0,0 @@ -0 bar:This is foo -9 foo:This is foo -9 bar:This is bar -0 foo:This is bar diff --git a/contrib/awk/test/nasty.awk b/contrib/awk/test/nasty.awk deleted file mode 100644 index b9c20c8b6cb38..0000000000000 --- a/contrib/awk/test/nasty.awk +++ /dev/null @@ -1,92 +0,0 @@ -#From hankedr@manatee.dms.auburn.edu Tue Oct 13 22:15:59 1998 -#Return-Path: <hankedr@manatee.dms.auburn.edu> -#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 <arobbins@netvision.net.il>; Tue, 13 Oct 1998 15:32:13 +0200 (IST) -#Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id KAA11644 for <arnold@mathcs.emory.edu>; 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 <arnold@gnu.org>; 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: <199810131422.JAA13348@manatee.dms.auburn.edu> -#From: Darrel Hankerson <hankedr@dms.auburn.edu> -#To: arnold@gnu.org -#In-reply-to: <199810131313.QAA31784@alpha.netvision.net.il> (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 <arcdev@mail.matav.hu> -#To: "'bug-gnu-utils@prep.ai.mit.edu'" <bug-gnu-utils@gnu.org> -#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: bug-gnu-utils@gnu.org -#X-Mailing-List: <bug-gnu-utils@gnu.org> archive/latest/3396 -#X-Loop: bug-gnu-utils@gnu.org -#Precedence: list -#Resent-Sender: bug-gnu-utils-request@gnu.org -#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 -# diff --git a/contrib/awk/test/nasty.ok b/contrib/awk/test/nasty.ok deleted file mode 100644 index 5189cf8167c88..0000000000000 --- a/contrib/awk/test/nasty.ok +++ /dev/null @@ -1,2 +0,0 @@ -123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123 -X diff --git a/contrib/awk/test/nlstrina.awk b/contrib/awk/test/nlstrina.awk deleted file mode 100644 index 41dbd5f1230ab..0000000000000 --- a/contrib/awk/test/nlstrina.awk +++ /dev/null @@ -1,77 +0,0 @@ -# From E.Ab@chem.rug.nl 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 <arobbins@actcom.co.il>; -# 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 <arobbins@actcom.co.il>; 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 <arnold@skeeve.com>; 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: E.Ab@chem.rug.nl -# Message-ID: <3987E7D5.2BDC5FD3@chem.rug.nl> -# Date: Wed, 02 Aug 2000 11:20:21 +0200 -# From: Eiso AB <E.Ab@chem.rug.nl> -# X-Mailer: Mozilla 4.72C-SGI [en] (X11; I; IRIX 6.5 IP32) -# X-Accept-Language: en -# MIME-Version: 1.0 -# To: bug-gnu-utils@gnu.org, arnold@gnu.org -# 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:eiso@chem.rug.nl -# | - _ mailto:eiso@dds.nl -# \__|__/ http://md.chem.rug.nl/~eiso -# | tel 4326 -# | -# / \ -# / \ -# | | -# ________ ._| |_. ________________________________________________ -# diff --git a/contrib/awk/test/nlstrina.ok b/contrib/awk/test/nlstrina.ok deleted file mode 100644 index 690f1a2fac734..0000000000000 --- a/contrib/awk/test/nlstrina.ok +++ /dev/null @@ -1,3 +0,0 @@ -a 2 2 -b 3 3 -c 1 3 diff --git a/contrib/awk/test/numindex.awk b/contrib/awk/test/numindex.awk deleted file mode 100644 index 1762e456f2b22..0000000000000 --- a/contrib/awk/test/numindex.awk +++ /dev/null @@ -1,55 +0,0 @@ -#To: bug-gnu-utils@gnu.org -#cc: arnold@gnu.org -#Subject: Possible bug in GNU Awk 3.0.4 -#Date: Wed, 24 Nov 1999 21:47:24 +0000 -#From: Daniel Elphick <de397@ecs.soton.ac.uk> -#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-- diff --git a/contrib/awk/test/numindex.in b/contrib/awk/test/numindex.in deleted file mode 100644 index 3852058d58487..0000000000000 --- a/contrib/awk/test/numindex.in +++ /dev/null @@ -1,4 +0,0 @@ -322322111111112232231111 -322322111111112213223111 -322322111111112211132231 -322322111111112211113223 diff --git a/contrib/awk/test/numindex.ok b/contrib/awk/test/numindex.ok deleted file mode 100644 index 8e086f62a65a3..0000000000000 --- a/contrib/awk/test/numindex.ok +++ /dev/null @@ -1 +0,0 @@ -0 0.000000% diff --git a/contrib/awk/test/opasnidx.awk b/contrib/awk/test/opasnidx.awk deleted file mode 100644 index e39886004acbb..0000000000000 --- a/contrib/awk/test/opasnidx.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { b = 1; a[b] = 2; a[b++] += 1; print b,a[1] } diff --git a/contrib/awk/test/opasnidx.ok b/contrib/awk/test/opasnidx.ok deleted file mode 100644 index 654d526942adb..0000000000000 --- a/contrib/awk/test/opasnidx.ok +++ /dev/null @@ -1 +0,0 @@ -2 3 diff --git a/contrib/awk/test/opasnslf.awk b/contrib/awk/test/opasnslf.awk deleted file mode 100644 index 46cd2b8176ddb..0000000000000 --- a/contrib/awk/test/opasnslf.awk +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - print b += b += 1 - b = 6 - print b += b++ - print b -} diff --git a/contrib/awk/test/opasnslf.ok b/contrib/awk/test/opasnslf.ok deleted file mode 100644 index 2fa9fd51a97e5..0000000000000 --- a/contrib/awk/test/opasnslf.ok +++ /dev/null @@ -1,3 +0,0 @@ -2 -13 -13 diff --git a/contrib/awk/test/printf1.awk b/contrib/awk/test/printf1.awk deleted file mode 100644 index 1cd7b99fff7f3..0000000000000 --- a/contrib/awk/test/printf1.awk +++ /dev/null @@ -1,19 +0,0 @@ -# Tue May 25 16:36:16 IDT 1999 -# -# Test cases based on email from Andreas Schwab, schwab@gnu.org - -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]) - } - -} diff --git a/contrib/awk/test/printf1.ok b/contrib/awk/test/printf1.ok deleted file mode 100644 index 32b3a7d87a0db..0000000000000 --- a/contrib/awk/test/printf1.ok +++ /dev/null @@ -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 --- | | diff --git a/contrib/awk/test/reg/Obsolete/exp.awk b/contrib/awk/test/reg/Obsolete/exp.awk deleted file mode 100644 index 4e707f891a775..0000000000000 --- a/contrib/awk/test/reg/Obsolete/exp.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { print exp(0), exp(1000000), exp(0.5) } diff --git a/contrib/awk/test/reg/Obsolete/exp.good b/contrib/awk/test/reg/Obsolete/exp.good deleted file mode 100644 index 07b88537dd810..0000000000000 --- a/contrib/awk/test/reg/Obsolete/exp.good +++ /dev/null @@ -1,2 +0,0 @@ -1 gawk: reg/exp.awk:1: warning: exp argument 1e+06 is out of range -Inf 1.64872 diff --git a/contrib/awk/test/reg/Obsolete/exp.in b/contrib/awk/test/reg/Obsolete/exp.in deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/awk/test/reg/Obsolete/exp.in +++ /dev/null diff --git a/contrib/awk/test/reg/Obsolete/log.awk b/contrib/awk/test/reg/Obsolete/log.awk deleted file mode 100644 index bcae90b8132d1..0000000000000 --- a/contrib/awk/test/reg/Obsolete/log.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { print log(0), log(-1), log(100) } diff --git a/contrib/awk/test/reg/Obsolete/log.good b/contrib/awk/test/reg/Obsolete/log.good deleted file mode 100644 index 857ab7703650b..0000000000000 --- a/contrib/awk/test/reg/Obsolete/log.good +++ /dev/null @@ -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 diff --git a/contrib/awk/test/reg/Obsolete/log.in b/contrib/awk/test/reg/Obsolete/log.in deleted file mode 100644 index e69de29bb2d1d..0000000000000 --- a/contrib/awk/test/reg/Obsolete/log.in +++ /dev/null diff --git a/contrib/awk/test/strftime.awk b/contrib/awk/test/strftime.awk deleted file mode 100644 index 8c1f401acc75b..0000000000000 --- a/contrib/awk/test/strftime.awk +++ /dev/null @@ -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 -} diff --git a/contrib/awk/test/subslash.awk b/contrib/awk/test/subslash.awk deleted file mode 100644 index 87ab02991a9bf..0000000000000 --- a/contrib/awk/test/subslash.awk +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - i = 2 - a[i] = 5 - a[i] /= 2 - printf "a[%s] = %f\n", i, a[i] -} diff --git a/contrib/awk/test/subslash.ok b/contrib/awk/test/subslash.ok deleted file mode 100644 index 4f3beffb42cf7..0000000000000 --- a/contrib/awk/test/subslash.ok +++ /dev/null @@ -1 +0,0 @@ -a[2] = 2.500000 diff --git a/contrib/awk/test/zeroflag.awk b/contrib/awk/test/zeroflag.awk deleted file mode 100644 index 526ed0e89a7d5..0000000000000 --- a/contrib/awk/test/zeroflag.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { printf("%2.1d---%02.1d\n", 2, 2) } diff --git a/contrib/awk/test/zeroflag.ok b/contrib/awk/test/zeroflag.ok deleted file mode 100644 index 937c0ede098ad..0000000000000 --- a/contrib/awk/test/zeroflag.ok +++ /dev/null @@ -1 +0,0 @@ - 2--- 2 diff --git a/contrib/binutils/FREEBSD-deletelist b/contrib/binutils/FREEBSD-deletelist deleted file mode 100644 index d2e09d375c1fd..0000000000000 --- a/contrib/binutils/FREEBSD-deletelist +++ /dev/null @@ -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 diff --git a/contrib/binutils/bfd/acconfig.h b/contrib/binutils/bfd/acconfig.h deleted file mode 100644 index 1d5e819ec24ea..0000000000000 --- a/contrib/binutils/bfd/acconfig.h +++ /dev/null @@ -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 diff --git a/contrib/binutils/include/dyn-string.h b/contrib/binutils/include/dyn-string.h deleted file mode 100644 index 67f7ab7d36e43..0000000000000 --- a/contrib/binutils/include/dyn-string.h +++ /dev/null @@ -1,92 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - -This file is part of GNU CC. - -GNU CC 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, or (at your option) -any later version. - -GNU CC 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 CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - - -typedef struct dyn_string -{ - int allocated; /* The amount of space allocated for the string. */ - int length; /* The actual length of the string. */ - char *s; /* The string itself, NUL-terminated. */ -}* dyn_string_t; - -/* The length STR, in bytes, not including the terminating NUL. */ -#define dyn_string_length(STR) \ - ((STR)->length) - -/* The NTBS in which the contents of STR are stored. */ -#define dyn_string_buf(STR) \ - ((STR)->s) - -/* Compare DS1 to DS2 with strcmp. */ -#define dyn_string_compare(DS1, DS2) \ - (strcmp ((DS1)->s, (DS2)->s)) - - -/* dyn_string functions are used in the demangling implementation - included in the G++ runtime library. To prevent collisions with - names in user programs, the functions that are used in the - demangler are given implementation-reserved names. */ - -#ifdef IN_LIBGCC2 - -#define dyn_string_init __cxa_dyn_string_init -#define dyn_string_new __cxa_dyn_string_new -#define dyn_string_delete __cxa_dyn_string_delete -#define dyn_string_release __cxa_dyn_string_release -#define dyn_string_resize __cxa_dyn_string_resize -#define dyn_string_clear __cxa_dyn_string_clear -#define dyn_string_copy __cxa_dyn_string_copy -#define dyn_string_copy_cstr __cxa_dyn_string_copy_cstr -#define dyn_string_prepend __cxa_dyn_string_prepend -#define dyn_string_prepend_cstr __cxa_dyn_string_prepend_cstr -#define dyn_string_insert __cxa_dyn_string_insert -#define dyn_string_insert_cstr __cxa_dyn_string_insert_cstr -#define dyn_string_insert_char __cxa_dyn_string_insert_char -#define dyn_string_append __cxa_dyn_string_append -#define dyn_string_append_cstr __cxa_dyn_string_append_cstr -#define dyn_string_append_char __cxa_dyn_string_append_char -#define dyn_string_substring __cxa_dyn_string_substring -#define dyn_string_eq __cxa_dyn_string_eq - -#endif /* IN_LIBGCC2 */ - - -extern int dyn_string_init PARAMS ((struct dyn_string *, int)); -extern dyn_string_t dyn_string_new PARAMS ((int)); -extern void dyn_string_delete PARAMS ((dyn_string_t)); -extern char *dyn_string_release PARAMS ((dyn_string_t)); -extern dyn_string_t dyn_string_resize PARAMS ((dyn_string_t, int)); -extern void dyn_string_clear PARAMS ((dyn_string_t)); -extern int dyn_string_copy PARAMS ((dyn_string_t, dyn_string_t)); -extern int dyn_string_copy_cstr PARAMS ((dyn_string_t, const char *)); -extern int dyn_string_prepend PARAMS ((dyn_string_t, dyn_string_t)); -extern int dyn_string_prepend_cstr PARAMS ((dyn_string_t, const char *)); -extern int dyn_string_insert PARAMS ((dyn_string_t, int, - dyn_string_t)); -extern int dyn_string_insert_cstr PARAMS ((dyn_string_t, int, - const char *)); -extern int dyn_string_insert_char PARAMS ((dyn_string_t, int, int)); -extern int dyn_string_append PARAMS ((dyn_string_t, dyn_string_t)); -extern int dyn_string_append_cstr PARAMS ((dyn_string_t, const char *)); -extern int dyn_string_append_char PARAMS ((dyn_string_t, int)); -extern int dyn_string_substring PARAMS ((dyn_string_t, - dyn_string_t, int, int)); -extern int dyn_string_eq PARAMS ((dyn_string_t, dyn_string_t)); diff --git a/contrib/binutils/include/elf/avr.h b/contrib/binutils/include/elf/avr.h deleted file mode 100644 index 1527455995eda..0000000000000 --- a/contrib/binutils/include/elf/avr.h +++ /dev/null @@ -1,58 +0,0 @@ -/* AVR ELF support for BFD. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - Contributed by Denis Chertykov <denisc@overta.ru> - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -#ifndef _ELF_AVR_H -#define _ELF_AVR_H - -#include "elf/reloc-macros.h" - -/* Processor specific flags for the ELF header e_flags field. */ -#define EF_AVR_MACH 0xf - -#define E_AVR_MACH_AVR1 1 -#define E_AVR_MACH_AVR2 2 -#define E_AVR_MACH_AVR3 3 -#define E_AVR_MACH_AVR4 4 - -/* Relocations. */ -START_RELOC_NUMBERS (elf_avr_reloc_type) - RELOC_NUMBER (R_AVR_NONE, 0) - RELOC_NUMBER (R_AVR_32, 1) - RELOC_NUMBER (R_AVR_7_PCREL, 2) - RELOC_NUMBER (R_AVR_13_PCREL, 3) - RELOC_NUMBER (R_AVR_16, 4) - RELOC_NUMBER (R_AVR_16_PM, 5) - RELOC_NUMBER (R_AVR_LO8_LDI, 6) - RELOC_NUMBER (R_AVR_HI8_LDI, 7) - RELOC_NUMBER (R_AVR_HH8_LDI, 8) - RELOC_NUMBER (R_AVR_LO8_LDI_NEG, 9) - RELOC_NUMBER (R_AVR_HI8_LDI_NEG, 10) - RELOC_NUMBER (R_AVR_HH8_LDI_NEG, 11) - RELOC_NUMBER (R_AVR_LO8_LDI_PM, 12) - RELOC_NUMBER (R_AVR_HI8_LDI_PM, 13) - RELOC_NUMBER (R_AVR_HH8_LDI_PM, 14) - RELOC_NUMBER (R_AVR_LO8_LDI_PM_NEG, 15) - RELOC_NUMBER (R_AVR_HI8_LDI_PM_NEG, 16) - RELOC_NUMBER (R_AVR_HH8_LDI_PM_NEG, 17) - RELOC_NUMBER (R_AVR_CALL, 18) - EMPTY_RELOC (R_AVR_max) -END_RELOC_NUMBERS - -#endif /* _ELF_AVR_H */ diff --git a/contrib/binutils/include/elf/d10v.h b/contrib/binutils/include/elf/d10v.h deleted file mode 100644 index 63b79c801b1fb..0000000000000 --- a/contrib/binutils/include/elf/d10v.h +++ /dev/null @@ -1,38 +0,0 @@ -/* d10v ELF support for BFD. - Copyright (C) 1998 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 program 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. */ - -#ifndef _ELF_D10V_H -#define _ELF_D10V_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_d10v_reloc_type) - RELOC_NUMBER (R_D10V_NONE, 0) - RELOC_NUMBER (R_D10V_10_PCREL_R, 1) - RELOC_NUMBER (R_D10V_10_PCREL_L, 2) - RELOC_NUMBER (R_D10V_16, 3) - RELOC_NUMBER (R_D10V_18, 4) - RELOC_NUMBER (R_D10V_18_PCREL, 5) - RELOC_NUMBER (R_D10V_32, 6) - RELOC_NUMBER (R_D10V_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_D10V_GNU_VTENTRY, 8) -END_RELOC_NUMBERS - -#endif diff --git a/contrib/binutils/include/elf/d30v.h b/contrib/binutils/include/elf/d30v.h deleted file mode 100644 index adbad192325c0..0000000000000 --- a/contrib/binutils/include/elf/d30v.h +++ /dev/null @@ -1,42 +0,0 @@ -/* d30v ELF support for BFD. - Copyright (C) 1998 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 program 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. */ - -#ifndef _ELF_D30V_H -#define _ELF_D30V_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_d30v_reloc_type) - RELOC_NUMBER (R_D30V_NONE, 0) - RELOC_NUMBER (R_D30V_6, 1) - RELOC_NUMBER (R_D30V_9_PCREL, 2) - RELOC_NUMBER (R_D30V_9_PCREL_R, 3) - RELOC_NUMBER (R_D30V_15, 4) - RELOC_NUMBER (R_D30V_15_PCREL, 5) - RELOC_NUMBER (R_D30V_15_PCREL_R, 6) - RELOC_NUMBER (R_D30V_21, 7) - RELOC_NUMBER (R_D30V_21_PCREL, 8) - RELOC_NUMBER (R_D30V_21_PCREL_R, 9) - RELOC_NUMBER (R_D30V_32, 10) - RELOC_NUMBER (R_D30V_32_PCREL, 11) - RELOC_NUMBER (R_D30V_32_NORMAL, 12) -END_RELOC_NUMBERS - -#endif diff --git a/contrib/binutils/include/elf/fr30.h b/contrib/binutils/include/elf/fr30.h deleted file mode 100644 index 223b052973aad..0000000000000 --- a/contrib/binutils/include/elf/fr30.h +++ /dev/null @@ -1,43 +0,0 @@ -/* FR30 ELF support for BFD. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -#ifndef _ELF_FR30_H -#define _ELF_FR30_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_fr30_reloc_type) - RELOC_NUMBER (R_FR30_NONE, 0) - RELOC_NUMBER (R_FR30_8, 1) - RELOC_NUMBER (R_FR30_20, 2) - RELOC_NUMBER (R_FR30_32, 3) - RELOC_NUMBER (R_FR30_48, 4) - RELOC_NUMBER (R_FR30_6_IN_4, 5) - RELOC_NUMBER (R_FR30_8_IN_8, 6) - RELOC_NUMBER (R_FR30_9_IN_8, 7) - RELOC_NUMBER (R_FR30_10_IN_8, 8) - RELOC_NUMBER (R_FR30_9_PCREL, 9) - RELOC_NUMBER (R_FR30_12_PCREL, 10) - RELOC_NUMBER (R_FR30_GNU_VTINHERIT, 11) - RELOC_NUMBER (R_FR30_GNU_VTENTRY, 12) - EMPTY_RELOC (R_FR30_max) -END_RELOC_NUMBERS - -#endif /* _ELF_FR30_H */ diff --git a/contrib/binutils/include/elf/hppa.h b/contrib/binutils/include/elf/hppa.h deleted file mode 100644 index 0e45d7451fd68..0000000000000 --- a/contrib/binutils/include/elf/hppa.h +++ /dev/null @@ -1,336 +0,0 @@ -/* HPPA ELF support for BFD. - Copyright (C) 1993, 1994, 1999 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -/* This file holds definitions specific to the HPPA ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_HPPA_H -#define _ELF_HPPA_H - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Trap null address dereferences. */ -#define EF_PARISC_TRAPNIL 0x00010000 - -/* .PARISC.archext section is present. */ -#define EF_PARISC_EXT 0x00020000 - -/* Program expects little-endian mode. */ -#define EF_PARISC_LSB 0x00040000 - -/* Program expects wide mode. */ -#define EF_PARISC_WIDE 0x00080000 - -/* Do not allow kernel-assisted branch prediction. */ -#define EF_PARISC_NO_KABP 0x00100000 - -/* Allow lazy swap for dynamically allocated program segments. */ -#define EF_PARISC_LAZYSWAP 0x00400000 - -/* Architecture version */ -#define EF_PARISC_ARCH 0x0000ffff - -#define EFA_PARISC_1_0 0x020b -#define EFA_PARISC_1_1 0x0210 -#define EFA_PARISC_2_0 0x0214 - -/* Special section indices. */ -/* A symbol that has been declared as a tentative definition in an ANSI C - compilation. */ -#define SHN_PARISC_ANSI_COMMON 0xff00 - -/* A symbol that has been declared as a common block using the - huge memory model. */ -#define SHN_PARISC_HUGE_COMMON 0xff01 - -/* Processor specific section types. */ - -/* Section contains product specific extension bits. */ -#define SHT_PARISC_EXT 0x70000000 - -/* Section contains unwind table entries. */ -#define SHT_PARISC_UNWIND 0x70000001 - -/* Section contains debug information for optimized code. */ -#define SHT_PARISC_DOC 0x70000002 - -/* Section contains code annotations. */ -#define SHT_PARISC_ANNOT 0x70000003 - -/* These are strictly for compatibility with the older elf32-hppa - implementation. Hopefully we can eliminate them in the future. */ -/* Optional section holding argument location/relocation info. */ -#define SHT_PARISC_SYMEXTN SHT_LOPROC+8 - -/* Option section for linker stubs. */ -#define SHT_PARISC_STUBS SHT_LOPROC+9 - -/* Processor specific section flags. */ - -/* Section contains code compiled for static branch prediction. */ -#define SHF_PARISC_SBP 0x80000000 - -/* Section should be allocated from from GP. */ -#define SHF_PARISC_HUGE 0x40000000 - -/* Section should go near GP. */ -#define SHF_PARISC_SHORT 0x20000000 - - -/* Identifies the entry point of a millicode routine. */ -#define STT_PARISC_MILLI 13 - -/* ELF/HPPA relocation types */ - -/* Note: PA-ELF is defined to use only RELA relocations. */ -#include "elf/reloc-macros.h" - -START_RELOC_NUMBERS (elf_hppa_reloc_type) - RELOC_NUMBER (R_PARISC_NONE, 0) /* No reloc */ - - /* These relocation types do simple base + offset relocations. */ - - RELOC_NUMBER (R_PARISC_DIR32, 1) - RELOC_NUMBER (R_PARISC_DIR21L, 2) - RELOC_NUMBER (R_PARISC_DIR17R, 3) - RELOC_NUMBER (R_PARISC_DIR17F, 4) - RELOC_NUMBER (R_PARISC_DIR14R, 6) - - /* PC-relative relocation types - Typically used for calls. - Note PCREL17C and PCREL17F differ only in overflow handling. - PCREL17C never reports a relocation error. - - When supporting argument relocations, function calls must be - accompanied by parameter relocation information. This information is - carried in the ten high-order bits of the addend field. The remaining - 22 bits of of the addend field are sign-extended to form the Addend. - - Note the code to build argument relocations depends on the - addend being zero. A consequence of this limitation is GAS - can not perform relocation reductions for function symbols. */ - - RELOC_NUMBER (R_PARISC_PCREL32, 9) - RELOC_NUMBER (R_PARISC_PCREL21L, 10) - RELOC_NUMBER (R_PARISC_PCREL17R, 11) - RELOC_NUMBER (R_PARISC_PCREL17F, 12) - RELOC_NUMBER (R_PARISC_PCREL17C, 13) - RELOC_NUMBER (R_PARISC_PCREL14R, 14) - RELOC_NUMBER (R_PARISC_PCREL14F, 15) - - /* DP-relative relocation types. */ - RELOC_NUMBER (R_PARISC_DPREL21L, 18) - RELOC_NUMBER (R_PARISC_DPREL14WR, 19) - RELOC_NUMBER (R_PARISC_DPREL14DR, 20) - RELOC_NUMBER (R_PARISC_DPREL14R, 22) - RELOC_NUMBER (R_PARISC_DPREL14F, 23) - - /* Data linkage table (DLT) relocation types - - SOM DLT_REL fixup requests are used to for static data references - from position-independent code within shared libraries. They are - similar to the GOT relocation types in some SVR4 implementations. */ - - RELOC_NUMBER (R_PARISC_DLTREL21L, 26) - RELOC_NUMBER (R_PARISC_DLTREL14R, 30) - RELOC_NUMBER (R_PARISC_DLTREL14F, 31) - - /* DLT indirect relocation types */ - RELOC_NUMBER (R_PARISC_DLTIND21L, 34) - RELOC_NUMBER (R_PARISC_DLTIND14R, 38) - RELOC_NUMBER (R_PARISC_DLTIND14F, 39) - - /* Base relative relocation types. Ugh. These imply lots of state */ - RELOC_NUMBER (R_PARISC_SETBASE, 40) - RELOC_NUMBER (R_PARISC_SECREL32, 41) - RELOC_NUMBER (R_PARISC_BASEREL21L, 42) - RELOC_NUMBER (R_PARISC_BASEREL17R, 43) - RELOC_NUMBER (R_PARISC_BASEREL17F, 44) - RELOC_NUMBER (R_PARISC_BASEREL14R, 46) - RELOC_NUMBER (R_PARISC_BASEREL14F, 47) - - /* Segment relative relocation types. */ - RELOC_NUMBER (R_PARISC_SEGBASE, 48) - RELOC_NUMBER (R_PARISC_SEGREL32, 49) - - /* Offsets from the PLT. */ - RELOC_NUMBER (R_PARISC_PLTOFF21L, 50) - RELOC_NUMBER (R_PARISC_PLTOFF14R, 54) - RELOC_NUMBER (R_PARISC_PLTOFF14F, 55) - - RELOC_NUMBER (R_PARISC_LTOFF_FPTR32, 57) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR21L, 58) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR14R, 62) - - RELOC_NUMBER (R_PARISC_FPTR64, 64) - - /* Plabel relocation types. */ - RELOC_NUMBER (R_PARISC_PLABEL32, 65) - RELOC_NUMBER (R_PARISC_PLABEL21L, 66) - RELOC_NUMBER (R_PARISC_PLABEL14R, 70) - - /* PCREL relocations. */ - RELOC_NUMBER (R_PARISC_PCREL64, 72) - RELOC_NUMBER (R_PARISC_PCREL22C, 73) - RELOC_NUMBER (R_PARISC_PCREL22F, 74) - RELOC_NUMBER (R_PARISC_PCREL14WR, 75) - RELOC_NUMBER (R_PARISC_PCREL14DR, 76) - RELOC_NUMBER (R_PARISC_PCREL16F, 77) - RELOC_NUMBER (R_PARISC_PCREL16WF, 78) - RELOC_NUMBER (R_PARISC_PCREL16DF, 79) - - - RELOC_NUMBER (R_PARISC_DIR64, 80) - RELOC_NUMBER (R_PARISC_DIR64WR, 81) - RELOC_NUMBER (R_PARISC_DIR64DR, 82) - RELOC_NUMBER (R_PARISC_DIR14WR, 83) - RELOC_NUMBER (R_PARISC_DIR14DR, 84) - RELOC_NUMBER (R_PARISC_DIR16F, 85) - RELOC_NUMBER (R_PARISC_DIR16WF, 86) - RELOC_NUMBER (R_PARISC_DIR16DF, 87) - - RELOC_NUMBER (R_PARISC_GPREL64, 88) - - RELOC_NUMBER (R_PARISC_DLTREL14WR, 91) - RELOC_NUMBER (R_PARISC_DLTREL14DR, 92) - RELOC_NUMBER (R_PARISC_GPREL16F, 93) - RELOC_NUMBER (R_PARISC_GPREL16WF, 94) - RELOC_NUMBER (R_PARISC_GPREL16DF, 95) - - - RELOC_NUMBER (R_PARISC_LTOFF64, 96) - RELOC_NUMBER (R_PARISC_DLTIND14WR, 99) - RELOC_NUMBER (R_PARISC_DLTIND14DR, 100) - RELOC_NUMBER (R_PARISC_LTOFF16F, 101) - RELOC_NUMBER (R_PARISC_LTOFF16WF, 102) - RELOC_NUMBER (R_PARISC_LTOFF16DF, 103) - - RELOC_NUMBER (R_PARISC_SECREL64, 104) - - RELOC_NUMBER (R_PARISC_BASEREL14WR, 107) - RELOC_NUMBER (R_PARISC_BASEREL14DR, 108) - - RELOC_NUMBER (R_PARISC_SEGREL64, 112) - - RELOC_NUMBER (R_PARISC_PLTOFF14WR, 115) - RELOC_NUMBER (R_PARISC_PLTOFF14DR, 116) - RELOC_NUMBER (R_PARISC_PLTOFF16F, 117) - RELOC_NUMBER (R_PARISC_PLTOFF16WF, 118) - RELOC_NUMBER (R_PARISC_PLTOFF16DF, 119) - - RELOC_NUMBER (R_PARISC_LTOFF_FPTR64, 120) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR14WR, 123) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR14DR, 124) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR16F, 125) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR16WF, 126) - RELOC_NUMBER (R_PARISC_LTOFF_FPTR16DF, 127) - - - RELOC_NUMBER (R_PARISC_COPY, 128) - RELOC_NUMBER (R_PARISC_IPLT, 129) - RELOC_NUMBER (R_PARISC_EPLT, 130) - - RELOC_NUMBER (R_PARISC_TPREL32, 153) - RELOC_NUMBER (R_PARISC_TPREL21L, 154) - RELOC_NUMBER (R_PARISC_TPREL14R, 158) - - RELOC_NUMBER (R_PARISC_LTOFF_TP21L, 162) - RELOC_NUMBER (R_PARISC_LTOFF_TP14R, 166) - RELOC_NUMBER (R_PARISC_LTOFF_TP14F, 167) - - RELOC_NUMBER (R_PARISC_TPREL64, 216) - RELOC_NUMBER (R_PARISC_TPREL14WR, 219) - RELOC_NUMBER (R_PARISC_TPREL14DR, 220) - RELOC_NUMBER (R_PARISC_TPREL16F, 221) - RELOC_NUMBER (R_PARISC_TPREL16WF, 222) - RELOC_NUMBER (R_PARISC_TPREL16DF, 223) - - RELOC_NUMBER (R_PARISC_LTOFF_TP64, 224) - RELOC_NUMBER (R_PARISC_LTOFF_TP14WR, 227) - RELOC_NUMBER (R_PARISC_LTOFF_TP14DR, 228) - RELOC_NUMBER (R_PARISC_LTOFF_TP16F, 229) - RELOC_NUMBER (R_PARISC_LTOFF_TP16WF, 230) - RELOC_NUMBER (R_PARISC_LTOFF_TP16DF, 231) - EMPTY_RELOC (R_PARISC_UNIMPLEMENTED) -END_RELOC_NUMBERS - -#ifndef RELOC_MACROS_GEN_FUNC -typedef enum elf_hppa_reloc_type elf_hppa_reloc_type; -#endif - -#define PT_PARISC_ARCHEXT 0x70000000 -#define PT_PARISC_UNWIND 0x70000001 -#define PF_PARISC_SBP 0x08000000 -#define PF_HP_PAGE_SIZE 0x00100000 -#define PF_HP_FAR_SHARED 0x00200000 -#define PF_HP_NEAR_SHARED 0x00400000 -#define PF_HP_CODE 0x01000000 -#define PF_HP_MODIFY 0x02000000 -#define PF_HP_LAZYSWAP 0x04000000 -#define PF_HP_SBP 0x08000000 - - -/* Processor specific dynamic array tags. */ - -#define DT_HP_LOAD_MAP (DT_LOOS + 0x0) -#define DT_HP_DLD_FLAGS (DT_LOOS + 0x1) -#define DT_HP_DLD_HOOK (DT_LOOS + 0x2) -#define DT_HP_UX10_INIT (DT_LOOS + 0x3) -#define DT_HP_UX10_INITSZ (DT_LOOS + 0x4) -#define DT_HP_PREINIT (DT_LOOS + 0x5) -#define DT_HP_PREINITSZ (DT_LOOS + 0x6) -#define DT_HP_NEEDED (DT_LOOS + 0x7) -#define DT_HP_TIME_STAMP (DT_LOOS + 0x8) -#define DT_HP_CHECKSUM (DT_LOOS + 0x9) -#define DT_HP_GST_SIZE (DT_LOOS + 0xa) -#define DT_HP_GST_VERSION (DT_LOOS + 0xb) -#define DT_HP_GST_HASHVAL (DT_LOOS + 0xc) - -/* Values for DT_HP_DLD_FLAGS. */ -#define DT_HP_DEBUG_PRIVATE 0x0001 /* Map text private */ -#define DT_HP_DEBUG_CALLBACK 0x0002 /* Callback */ -#define DT_HP_DEBUG_CALLBACK_BOR 0x0004 /* BOR callback */ -#define DT_HP_NO_ENVVAR 0x0008 /* No env var */ -#define DT_HP_BIND_NOW 0x0010 /* Bind now */ -#define DT_HP_BIND_NONFATAL 0x0020 /* Bind non-fatal */ -#define DT_HP_BIND_VERBOSE 0x0040 /* Bind verbose */ -#define DT_HP_BIND_RESTRICTED 0x0080 /* Bind restricted */ -#define DT_HP_BIND_SYMBOLIC 0x0100 /* Bind symbolic */ -#define DT_HP_RPATH_FIRST 0x0200 /* RPATH first */ -#define DT_HP_BIND_DEPTH_FIRST 0x0400 /* Bind depth-first */ - -/* Program header extensions. */ -#define PT_HP_TLS (PT_LOOS + 0x0) -#define PT_HP_CORE_NONE (PT_LOOS + 0x1) -#define PT_HP_CORE_VERSION (PT_LOOS + 0x2) -#define PT_HP_CORE_KERNEL (PT_LOOS + 0x3) -#define PT_HP_CORE_COMM (PT_LOOS + 0x4) -#define PT_HP_CORE_PROC (PT_LOOS + 0x5) -#define PT_HP_CORE_LOADABLE (PT_LOOS + 0x6) -#define PT_HP_CORE_STACK (PT_LOOS + 0x7) -#define PT_HP_CORE_SHM (PT_LOOS + 0x8) -#define PT_HP_CORE_MMF (PT_LOOS + 0x9) -#define PT_HP_PARALLEL (PT_LOOS + 0x10) -#define PT_HP_FASTBIND (PT_LOOS + 0x11) - -/* Additional symbol types. */ -#define STT_HP_OPAQUE (STT_LOOS + 0x1) -#define STT_HP_STUB (STT_LOOS + 0x2) - -#endif /* _ELF_HPPA_H */ diff --git a/contrib/binutils/include/elf/i370.h b/contrib/binutils/include/elf/i370.h deleted file mode 100644 index 9c021f00e89e3..0000000000000 --- a/contrib/binutils/include/elf/i370.h +++ /dev/null @@ -1,46 +0,0 @@ -/* i370 ELF support for BFD. - Copyright (C) 1995, 2000 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -/* This file holds definitions specific to the i370 ELF ABI. Note - that most of this is not actually implemented by BFD. */ - -#ifndef _ELF_I370_H -#define _ELF_I370_H - -/* Processor specific section headers, sh_type field */ - -#define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \ - entries in this section \ - based on the address \ - specified in the associated \ - symbol table entry. */ - -#define EF_I370_RELOCATABLE 0x00010000 /* i370 -mrelocatable flag */ -#define EF_I370_RELOCATABLE_LIB 0x00008000 /* i370 -mrelocatable-lib flag */ -/* Processor specific section flags, sh_flags field */ - -#define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude \ - this section from executable \ - and shared objects that it \ - builds when those objects \ - are not to be furhter \ - relocated. */ -#endif /* _ELF_I370_H */ - - diff --git a/contrib/binutils/include/elf/i960.h b/contrib/binutils/include/elf/i960.h deleted file mode 100644 index 3e60289ea9971..0000000000000 --- a/contrib/binutils/include/elf/i960.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Intel 960 ELF support for BFD. - Copyright (C) 1999 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 program 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. */ - -#ifndef _ELF_I960_H -#define _ELF_I960_H - -#include "elf/reloc-macros.h" - - -START_RELOC_NUMBERS (elf_i960_reloc_type) - RELOC_NUMBER (R_960_NONE, 0) - RELOC_NUMBER (R_960_12, 1) - RELOC_NUMBER (R_960_32, 2) - RELOC_NUMBER (R_960_IP24, 3) - RELOC_NUMBER (R_960_SUB, 4) - RELOC_NUMBER (R_960_OPTCALL, 5) - RELOC_NUMBER (R_960_OPTCALLX, 6) - RELOC_NUMBER (R_960_OPTCALLXA, 7) - EMPTY_RELOC (R_960_max) -END_RELOC_NUMBERS - -#endif /* _ELF_I960_H */ diff --git a/contrib/binutils/include/elf/m32r.h b/contrib/binutils/include/elf/m32r.h deleted file mode 100644 index a12ae16aea5bf..0000000000000 --- a/contrib/binutils/include/elf/m32r.h +++ /dev/null @@ -1,68 +0,0 @@ -/* M32R ELF support for BFD. - Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -#ifndef _ELF_M32R_H -#define _ELF_M32R_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_m32r_reloc_type) - RELOC_NUMBER (R_M32R_NONE, 0) - RELOC_NUMBER (R_M32R_16, 1) - RELOC_NUMBER (R_M32R_32, 2) - RELOC_NUMBER (R_M32R_24, 3) - RELOC_NUMBER (R_M32R_10_PCREL, 4) - RELOC_NUMBER (R_M32R_18_PCREL, 5) - RELOC_NUMBER (R_M32R_26_PCREL, 6) - RELOC_NUMBER (R_M32R_HI16_ULO, 7) - RELOC_NUMBER (R_M32R_HI16_SLO, 8) - RELOC_NUMBER (R_M32R_LO16, 9) - RELOC_NUMBER (R_M32R_SDA16, 10) - RELOC_NUMBER (R_M32R_GNU_VTINHERIT, 11) - RELOC_NUMBER (R_M32R_GNU_VTENTRY, 12) - EMPTY_RELOC (R_M32R_max) -END_RELOC_NUMBERS - -/* Processor specific section indices. These sections do not actually - exist. Symbols with a st_shndx field corresponding to one of these - values have a special meaning. */ - -/* Small common symbol. */ -#define SHN_M32R_SCOMMON 0xff00 - -/* Processor specific section flags. */ - -/* This section contains sufficient relocs to be relaxed. - When relaxing, even relocs of branch instructions the assembler could - complete must be present because relaxing may cause the branch target to - move. */ -#define SHF_M32R_CAN_RELAX 0x10000000 - -/* Processor specific flags for the ELF header e_flags field. */ - -/* Two bit m32r architecture field. */ -#define EF_M32R_ARCH 0x30000000 - -/* m32r code. */ -#define E_M32R_ARCH 0x00000000 -/* m32rx code. */ -#define E_M32RX_ARCH 0x10000000 - -#endif diff --git a/contrib/binutils/include/elf/m68k.h b/contrib/binutils/include/elf/m68k.h deleted file mode 100644 index e2d51ef4a9068..0000000000000 --- a/contrib/binutils/include/elf/m68k.h +++ /dev/null @@ -1,58 +0,0 @@ -/* MC68k ELF support for BFD. - Copyright (C) 1998 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 program 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. */ - -#ifndef _ELF_M68K_H -#define _ELF_M68K_H - -#include "elf/reloc-macros.h" - -/* Relocation types. */ -START_RELOC_NUMBERS (elf_m68k_reloc_type) - RELOC_NUMBER (R_68K_NONE, 0) /* No reloc */ - RELOC_NUMBER (R_68K_32, 1) /* Direct 32 bit */ - RELOC_NUMBER (R_68K_16, 2) /* Direct 16 bit */ - RELOC_NUMBER (R_68K_8, 3) /* Direct 8 bit */ - RELOC_NUMBER (R_68K_PC32, 4) /* PC relative 32 bit */ - RELOC_NUMBER (R_68K_PC16, 5) /* PC relative 16 bit */ - RELOC_NUMBER (R_68K_PC8, 6) /* PC relative 8 bit */ - RELOC_NUMBER (R_68K_GOT32, 7) /* 32 bit PC relative GOT entry */ - RELOC_NUMBER (R_68K_GOT16, 8) /* 16 bit PC relative GOT entry */ - RELOC_NUMBER (R_68K_GOT8, 9) /* 8 bit PC relative GOT entry */ - RELOC_NUMBER (R_68K_GOT32O, 10) /* 32 bit GOT offset */ - RELOC_NUMBER (R_68K_GOT16O, 11) /* 16 bit GOT offset */ - RELOC_NUMBER (R_68K_GOT8O, 12) /* 8 bit GOT offset */ - RELOC_NUMBER (R_68K_PLT32, 13) /* 32 bit PC relative PLT address */ - RELOC_NUMBER (R_68K_PLT16, 14) /* 16 bit PC relative PLT address */ - RELOC_NUMBER (R_68K_PLT8, 15) /* 8 bit PC relative PLT address */ - RELOC_NUMBER (R_68K_PLT32O, 16) /* 32 bit PLT offset */ - RELOC_NUMBER (R_68K_PLT16O, 17) /* 16 bit PLT offset */ - RELOC_NUMBER (R_68K_PLT8O, 18) /* 8 bit PLT offset */ - RELOC_NUMBER (R_68K_COPY, 19) /* Copy symbol at runtime */ - RELOC_NUMBER (R_68K_GLOB_DAT, 20) /* Create GOT entry */ - RELOC_NUMBER (R_68K_JMP_SLOT, 21) /* Create PLT entry */ - RELOC_NUMBER (R_68K_RELATIVE, 22) /* Adjust by program base */ - /* These are GNU extensions to enable C++ vtable garbage collection. */ - RELOC_NUMBER (R_68K_GNU_VTINHERIT, 23) - RELOC_NUMBER (R_68K_GNU_VTENTRY, 24) - EMPTY_RELOC (R_68K_max) -END_RELOC_NUMBERS - -#define EF_CPU32 0x00810000 - -#endif diff --git a/contrib/binutils/include/elf/mcore.h b/contrib/binutils/include/elf/mcore.h deleted file mode 100644 index 62a88c9093ecb..0000000000000 --- a/contrib/binutils/include/elf/mcore.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Motorola MCore support for BFD. - Copyright (C) 1995, 1999 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -/* This file holds definitions specific to the MCore ELF ABI. */ -#ifndef _ELF_MORE_H -#define _ELF_MORE_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_mcore_reloc_type) - RELOC_NUMBER (R_MCORE_NONE, 0) - RELOC_NUMBER (R_MCORE_ADDR32, 1) - RELOC_NUMBER (R_MCORE_PCRELIMM8BY4, 2) - RELOC_NUMBER (R_MCORE_PCRELIMM11BY2, 3) - RELOC_NUMBER (R_MCORE_PCRELIMM4BY2, 4) - RELOC_NUMBER (R_MCORE_PCREL32, 5) - RELOC_NUMBER (R_MCORE_PCRELJSR_IMM11BY2, 6) - RELOC_NUMBER (R_MCORE_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_MCORE_GNU_VTENTRY, 8) - RELOC_NUMBER (R_MCORE_RELATIVE, 9) - RELOC_NUMBER (R_MCORE_COPY, 10) - RELOC_NUMBER (R_MCORE_GLOB_DAT, 11) - RELOC_NUMBER (R_MCORE_JUMP_SLOT, 12) - EMPTY_RELOC (R_MCORE_max) -END_RELOC_NUMBERS - -/* Section Attributes. */ -#define SHF_MCORE_NOREAD 0x80000000 - -#endif /* _ELF_MCORE_H */ diff --git a/contrib/binutils/include/elf/mn10200.h b/contrib/binutils/include/elf/mn10200.h deleted file mode 100644 index 5e29e0ad21193..0000000000000 --- a/contrib/binutils/include/elf/mn10200.h +++ /dev/null @@ -1,39 +0,0 @@ -/* MN10200 ELF support for BFD. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -/* This file holds definitions specific to the MN10200 ELF ABI. */ - -#ifndef _ELF_MN10200_H -#define _ELF_MN10200_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_mn10200_reloc_type) - RELOC_NUMBER (R_MN10200_NONE, 0) - RELOC_NUMBER (R_MN10200_32, 1) - RELOC_NUMBER (R_MN10200_16, 2) - RELOC_NUMBER (R_MN10200_8, 3) - RELOC_NUMBER (R_MN10200_24, 4) - RELOC_NUMBER (R_MN10200_PCREL8, 5) - RELOC_NUMBER (R_MN10200_PCREL16, 6) - RELOC_NUMBER (R_MN10200_PCREL24, 7) -END_RELOC_NUMBERS - -#endif /* _ELF_MN10200_H */ diff --git a/contrib/binutils/include/elf/mn10300.h b/contrib/binutils/include/elf/mn10300.h deleted file mode 100644 index 1b90a1379619f..0000000000000 --- a/contrib/binutils/include/elf/mn10300.h +++ /dev/null @@ -1,54 +0,0 @@ -/* MN10300 ELF support for BFD. - Copyright (C) 1998 Free Software Foundation, Inc. - -This file is part of BFD, the Binary File Descriptor library. - -This program 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 program 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. */ - -/* This file holds definitions specific to the MN10300 ELF ABI. */ - -#ifndef _ELF_MN10300_H -#define _ELF_MN10300_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ -START_RELOC_NUMBERS (elf_mn10300_reloc_type) - RELOC_NUMBER (R_MN10300_NONE, 0) - RELOC_NUMBER (R_MN10300_32, 1) - RELOC_NUMBER (R_MN10300_16, 2) - RELOC_NUMBER (R_MN10300_8, 3) - RELOC_NUMBER (R_MN10300_PCREL32, 4) - RELOC_NUMBER (R_MN10300_PCREL16, 5) - RELOC_NUMBER (R_MN10300_PCREL8, 6) - RELOC_NUMBER (R_MN10300_GNU_VTINHERIT, 7) - RELOC_NUMBER (R_MN10300_GNU_VTENTRY, 8) - RELOC_NUMBER (R_MN10300_24, 9) - EMPTY_RELOC (R_MN10300_MAX) -END_RELOC_NUMBERS - -/* Machine variant if we know it. This field was invented at Cygnus, - but it is hoped that other vendors will adopt it. If some standard - is developed, this code should be changed to follow it. */ - -#define EF_MN10300_MACH 0x00FF0000 - -/* Cygnus is choosing values between 80 and 9F; - 00 - 7F should be left for a future standard; - the rest are open. */ - -#define E_MN10300_MACH_MN10300 0x00810000 -#define E_MN10300_MACH_AM33 0x00820000 -#endif /* _ELF_MN10300_H */ diff --git a/contrib/binutils/include/elf/pj.h b/contrib/binutils/include/elf/pj.h deleted file mode 100644 index 6bb8306523e7b..0000000000000 --- a/contrib/binutils/include/elf/pj.h +++ /dev/null @@ -1,45 +0,0 @@ -/* picoJava ELF support for BFD. - Copyright (C) 1999 Free Software Foundation, Inc. - - This file is part of BFD, the Binary File Descriptor library. - - This program 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 program 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. */ - -#ifndef _ELF_PJ_H -#define _ELF_PJ_H - -#include "elf/reloc-macros.h" - -/* Relocations. */ - -START_RELOC_NUMBERS (elf_pj_reloc_type) - RELOC_NUMBER (R_PJ_NONE, 0) - RELOC_NUMBER (R_PJ_DATA_DIR32, 1) - RELOC_NUMBER (R_PJ_CODE_REL32, 2) - RELOC_NUMBER (R_PJ_CODE_REL16, 3) - RELOC_NUMBER (R_PJ_CODE_DIR32, 6) - RELOC_NUMBER (R_PJ_CODE_DIR16, 7) - RELOC_NUMBER (R_PJ_CODE_LO16, 13) - RELOC_NUMBER (R_PJ_CODE_HI16, 14) - RELOC_NUMBER (R_PJ_GNU_VTINHERIT, 15) - RELOC_NUMBER (R_PJ_GNU_VTENTRY, 16) - EMPTY_RELOC (R_PJ_max) -END_RELOC_NUMBERS - -#define EF_PICOJAVA_ARCH 0x0000000f -#define EF_PICOJAVA_NEWCALLS 0x00000010 -#define EF_PICOJAVA_GNUCALLS 0x00000020 /* The (currently) non standard GNU calling convention */ - -#endif diff --git a/contrib/binutils/libiberty/cp-demangle.c b/contrib/binutils/libiberty/cp-demangle.c deleted file mode 100644 index 1eb24027e513a..0000000000000 --- a/contrib/binutils/libiberty/cp-demangle.c +++ /dev/null @@ -1,3409 +0,0 @@ -/* Demangler for IA64 / g++ standard C++ ABI. - Copyright (C) 2000 CodeSourcery LLC. - Written by Alex Samuel <samuel@codesourcery.com>. - - This program 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 program 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. -*/ - -/* This file implements demangling of C++ names mangled according to - the IA64 / g++ standard C++ ABI. Use the cp_demangle function to - demangle a mangled name, or compile with the preprocessor macro - STANDALONE_DEMANGLER defined to create a demangling filter - executable. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <sys/types.h> - -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#include <stdio.h> - -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#include "ansidecl.h" -#include "libiberty.h" -#include "dyn-string.h" -#include "demangle.h" - -/* If CP_DEMANGLE_DEBUG is defined, a trace of the grammar evaluation, - and other debugging output, will be generated. */ -#ifdef CP_DEMANGLE_DEBUG -#define DEMANGLE_TRACE(PRODUCTION, DM) \ - fprintf (stderr, " -> %-24s at position %3d\n", \ - (PRODUCTION), current_position (DM)); -#else -#define DEMANGLE_TRACE(PRODUCTION, DM) -#endif - -/* Don't include <ctype.h>, to prevent additional unresolved symbols - from being dragged into the C++ runtime library. */ -#define IS_DIGIT(CHAR) ((CHAR) >= '0' && (CHAR) <= '9') -#define IS_ALPHA(CHAR) \ - (((CHAR) >= 'a' && (CHAR) <= 'z') \ - || ((CHAR) >= 'A' && (CHAR) <= 'Z')) - -/* If flag_verbose is zero, some simplifications will be made to the - output to make it easier to read and supress details that are - generally not of interest to the average C++ programmer. - Otherwise, the demangled representation will attempt to convey as - much information as the mangled form. */ -static int flag_verbose; - -/* If flag_strict is non-zero, demangle strictly according to the - specification -- don't demangle special g++ manglings. */ -static int flag_strict; - -/* String_list_t is an extended form of dyn_string_t which provides a link - field. A string_list_t may safely be cast to and used as a - dyn_string_t. */ - -struct string_list_def -{ - struct dyn_string string; - struct string_list_def *next; -}; - -typedef struct string_list_def *string_list_t; - -/* Data structure representing a potential substitution. */ - -struct substitution_def -{ - /* The demangled text of the substitution. */ - dyn_string_t text; - - /* The template parameter that this represents, indexed from zero. - If this is not a template paramter number, the value is - NOT_TEMPLATE_PARM. */ - int template_parm_number; - - /* Whether this substitution represents a template item. */ - int template_p : 1; -}; - -#define NOT_TEMPLATE_PARM (-1) - -/* Data structure representing a template argument list. */ - -struct template_arg_list_def -{ - /* The next (lower) template argument list in the stack of currently - active template arguments. */ - struct template_arg_list_def *next; - - /* The first element in the list of template arguments in - left-to-right order. */ - string_list_t first_argument; - - /* The last element in the arguments lists. */ - string_list_t last_argument; -}; - -typedef struct template_arg_list_def *template_arg_list_t; - -/* Data structure to maintain the state of the current demangling. */ - -struct demangling_def -{ - /* The full mangled name being mangled. */ - const char *name; - - /* Pointer into name at the current position. */ - const char *next; - - /* Stack for strings containing demangled result generated so far. - Text is emitted to the topmost (first) string. */ - string_list_t result; - - /* The number of presently available substitutions. */ - int num_substitutions; - - /* The allocated size of the substitutions array. */ - int substitutions_allocated; - - /* An array of available substitutions. The number of elements in - the array is given by num_substitions, and the allocated array - size in substitutions_size. - - The most recent substition is at the end, so - - - `S_' corresponds to substititutions[num_substitutions - 1] - - `S0_' corresponds to substititutions[num_substitutions - 2] - - etc. */ - struct substitution_def *substitutions; - - /* The stack of template argument lists. */ - template_arg_list_t template_arg_lists; - - /* The most recently demangled source-name. */ - dyn_string_t last_source_name; -}; - -typedef struct demangling_def *demangling_t; - -/* This type is the standard return code from most functions. Values - other than STATUS_OK contain descriptive messages. */ -typedef const char *status_t; - -/* Special values that can be used as a status_t. */ -#define STATUS_OK NULL -#define STATUS_ERROR "Error." -#define STATUS_UNIMPLEMENTED "Unimplemented." -#define STATUS_INTERNAL_ERROR "Internal error." - -/* This status code indicates a failure in malloc or realloc. */ -static const char* const status_allocation_failed = "Allocation failed."; -#define STATUS_ALLOCATION_FAILED status_allocation_failed - -/* Non-zero if STATUS indicates that no error has occurred. */ -#define STATUS_NO_ERROR(STATUS) ((STATUS) == STATUS_OK) - -/* Evaluate EXPR, which must produce a status_t. If the status code - indicates an error, return from the current function with that - status code. */ -#define RETURN_IF_ERROR(EXPR) \ - do \ - { \ - status_t s = EXPR; \ - if (!STATUS_NO_ERROR (s)) \ - return s; \ - } \ - while (0) - -static status_t int_to_dyn_string - PARAMS ((int, dyn_string_t)); -static string_list_t string_list_new - PARAMS ((int)); -static void string_list_delete - PARAMS ((string_list_t)); -static status_t result_close_template_list - PARAMS ((demangling_t)); -static status_t result_push - PARAMS ((demangling_t)); -static string_list_t result_pop - PARAMS ((demangling_t)); -static int substitution_start - PARAMS ((demangling_t)); -static status_t substitution_add - PARAMS ((demangling_t, int, int, int)); -static dyn_string_t substitution_get - PARAMS ((demangling_t, int, int *)); -#ifdef CP_DEMANGLE_DEBUG -static void substitutions_print - PARAMS ((demangling_t, FILE *)); -#endif -static template_arg_list_t template_arg_list_new - PARAMS ((void)); -static void template_arg_list_delete - PARAMS ((template_arg_list_t)); -static void template_arg_list_add_arg - PARAMS ((template_arg_list_t, string_list_t)); -static string_list_t template_arg_list_get_arg - PARAMS ((template_arg_list_t, int)); -static void push_template_arg_list - PARAMS ((demangling_t, template_arg_list_t)); -static void pop_to_template_arg_list - PARAMS ((demangling_t, template_arg_list_t)); -#ifdef CP_DEMANGLE_DEBUG -static void template_arg_list_print - PARAMS ((template_arg_list_t, FILE *)); -#endif -static template_arg_list_t current_template_arg_list - PARAMS ((demangling_t)); -static demangling_t demangling_new - PARAMS ((const char *)); -static void demangling_delete - PARAMS ((demangling_t)); - -/* The last character of DS. Warning: DS is evaluated twice. */ -#define dyn_string_last_char(DS) \ - (dyn_string_buf (DS)[dyn_string_length (DS) - 1]) - -/* Append a space character (` ') to DS if it does not already end - with one. Evaluates to 1 on success, or 0 on allocation failure. */ -#define dyn_string_append_space(DS) \ - ((dyn_string_length (DS) > 0 \ - && dyn_string_last_char (DS) != ' ') \ - ? dyn_string_append_char ((DS), ' ') \ - : 1) - -/* Returns the index of the current position in the mangled name. */ -#define current_position(DM) ((DM)->next - (DM)->name) - -/* Returns the character at the current position of the mangled name. */ -#define peek_char(DM) (*((DM)->next)) - -/* Returns the character one past the current position of the mangled - name. */ -#define peek_char_next(DM) \ - (peek_char (DM) == '\0' ? '\0' : (*((DM)->next + 1))) - -/* Returns the character at the current position, and advances the - current position to the next character. */ -#define next_char(DM) (*((DM)->next)++) - -/* Returns non-zero if the current position is the end of the mangled - name, i.e. one past the last character. */ -#define end_of_name_p(DM) (peek_char (DM) == '\0') - -/* Advances the current position by one character. */ -#define advance_char(DM) (++(DM)->next) - -/* Returns the string containing the current demangled result. */ -#define result_string(DM) (&(DM)->result->string) - -/* Appends a dyn_string_t to the demangled result. */ -#define result_append_string(DM, STRING) \ - (dyn_string_append (&(DM)->result->string, (STRING)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Appends NUL-terminated string CSTR to the demangled result. */ -#define result_append(DM, CSTR) \ - (dyn_string_append_cstr (&(DM)->result->string, (CSTR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Appends character CHAR to the demangled result. */ -#define result_append_char(DM, CHAR) \ - (dyn_string_append_char (&(DM)->result->string, (CHAR)) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* The length of the current demangled result. */ -#define result_length(DM) \ - dyn_string_length (&(DM)->result->string) - -/* Appends a space to the demangled result if the last character is - not a space. */ -#define result_append_space(DM) \ - (dyn_string_append_space (&(DM)->result->string) \ - ? STATUS_OK : STATUS_ALLOCATION_FAILED) - -/* Appends a base 10 representation of VALUE to DS. STATUS_OK on - success. On failure, deletes DS and returns an error code. */ - -static status_t -int_to_dyn_string (value, ds) - int value; - dyn_string_t ds; -{ - int i; - int mask = 1; - - /* Handle zero up front. */ - if (value == 0) - { - if (!dyn_string_append_char (ds, '0')) - return STATUS_ALLOCATION_FAILED; - return STATUS_OK; - } - - /* For negative numbers, emit a minus sign. */ - if (value < 0) - { - if (!dyn_string_append_char (ds, '-')) - return STATUS_ALLOCATION_FAILED; - value = -value; - } - - /* Find the power of 10 of the first digit. */ - i = value; - while (i > 9) - { - mask *= 10; - i /= 10; - } - - /* Write the digits. */ - while (mask > 0) - { - int digit = value / mask; - - if (!dyn_string_append_char (ds, '0' + digit)) - return STATUS_ALLOCATION_FAILED; - - value -= digit * mask; - mask /= 10; - } - - return STATUS_OK; -} - -/* Creates a new string list node. The contents of the string are - empty, but the initial buffer allocation is LENGTH. The string - list node should be deleted with string_list_delete. Returns NULL - if allocation fails. */ - -static string_list_t -string_list_new (length) - int length; -{ - string_list_t s = (string_list_t) malloc (sizeof (struct string_list_def)); - if (s == NULL) - return NULL; - if (!dyn_string_init ((dyn_string_t) s, length)) - return NULL; - return s; -} - -/* Deletes the entire string list starting at NODE. */ - -static void -string_list_delete (node) - string_list_t node; -{ - while (node != NULL) - { - string_list_t next = node->next; - free (node); - node = next; - } -} - -/* Appends a greater-than character to the demangled result. If the - last character is a greater-than character, a space is inserted - first, so that the two greater-than characters don't look like a - right shift token. */ - -static status_t -result_close_template_list (dm) - demangling_t dm; -{ - dyn_string_t s = &dm->result->string; - - /* Add a space if the last character is already a closing angle - bracket, so that a nested template arg list doesn't look like - it's closed with a right-shift operator. */ - if (dyn_string_last_char (s) == '>') - { - if (!dyn_string_append_char (s, ' ')) - return STATUS_ALLOCATION_FAILED; - } - - /* Add closing angle brackets. */ - if (!dyn_string_append_char (s, '>')) - return STATUS_ALLOCATION_FAILED; - - return STATUS_OK; -} - -/* Allocates and pushes a new string onto the demangled results stack - for DM. Subsequent demangling with DM will emit to the new string. - Returns STATUS_OK on success, STATUS_ALLOCATION_FAILED on - allocation failure. */ - -static status_t -result_push (dm) - demangling_t dm; -{ - string_list_t new_string = string_list_new (0); - if (new_string == NULL) - /* Allocation failed. */ - return STATUS_ALLOCATION_FAILED; - - /* Link the new string to the front of the list of result strings. */ - new_string->next = (string_list_t) dm->result; - dm->result = new_string; - return STATUS_OK; -} - -/* Removes and returns the topmost element on the demangled results - stack for DM. The caller assumes ownership for the returned - string. */ - -static string_list_t -result_pop (dm) - demangling_t dm; -{ - string_list_t top = dm->result; - dm->result = top->next; - return top; -} - -/* Returns the start position of a fragment of the demangled result - that will be a substitution candidate. Should be called at the - start of productions that can add substitutions. */ - -static int -substitution_start (dm) - demangling_t dm; -{ - return result_length (dm); -} - -/* Adds the suffix of the current demangled result of DM starting at - START_POSITION as a potential substitution. If TEMPLATE_P is - non-zero, this potential substitution is a template-id. - - If TEMPLATE_PARM_NUMBER is not NOT_TEMPLATE_PARM, the substitution - is for that particular <template-param>, and is distinct from other - otherwise-identical types and other <template-param>s with - different indices. */ - -static status_t -substitution_add (dm, start_position, template_p, template_parm_number) - demangling_t dm; - int start_position; - int template_p; - int template_parm_number; -{ - dyn_string_t result = result_string (dm); - dyn_string_t substitution = dyn_string_new (0); - int i; - - if (substitution == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Extract the substring of the current demangling result that - represents the subsitution candidate. */ - if (!dyn_string_substring (substitution, - result, start_position, result_length (dm))) - { - dyn_string_delete (substitution); - return STATUS_ALLOCATION_FAILED; - } - - /* Check whether SUBSTITUTION already occurs. */ - for (i = 0; i < dm->num_substitutions; ++i) - if (dyn_string_eq (dm->substitutions[i].text, substitution) - && dm->substitutions[i].template_parm_number == template_parm_number) - /* Found SUBSTITUTION already present. */ - { - /* Callers expect this function to take ownership of - SUBSTITUTION, so delete it. */ - dyn_string_delete (substitution); - return STATUS_OK; - } - - /* If there's no room for the new entry, grow the array. */ - if (dm->substitutions_allocated == dm->num_substitutions) - { - size_t new_array_size; - dm->substitutions_allocated *= 2; - new_array_size = - sizeof (struct substitution_def) * dm->substitutions_allocated; - - dm->substitutions = (struct substitution_def *) - realloc (dm->substitutions, new_array_size); - if (dm->substitutions == NULL) - /* Realloc failed. */ - { - dyn_string_delete (substitution); - return STATUS_ALLOCATION_FAILED; - } - } - - /* Add the substitution to the array. */ - dm->substitutions[i].text = substitution; - dm->substitutions[i].template_p = template_p; - dm->substitutions[i].template_parm_number = template_parm_number; - ++dm->num_substitutions; - -#ifdef CP_DEMANGLE_DEBUG - substitutions_print (dm, stderr); -#endif - - return STATUS_OK; -} - -/* Returns the Nth-most-recent substitution. Sets *TEMPLATE_P to - non-zero if the substitution is a template-id, zero otherwise. - N is numbered from zero. DM retains ownership of the returned - string. If N is negative, or equal to or greater than the current - number of substitution candidates, returns NULL. */ - -static dyn_string_t -substitution_get (dm, n, template_p) - demangling_t dm; - int n; - int *template_p; -{ - struct substitution_def *sub; - - /* Make sure N is in the valid range. */ - if (n < 0 || n >= dm->num_substitutions) - return NULL; - - sub = &(dm->substitutions[n]); - *template_p = sub->template_p; - return sub->text; -} - -#ifdef CP_DEMANGLE_DEBUG -/* Debugging routine to print the current substitutions to FP. */ - -static void -substitutions_print (dm, fp) - demangling_t dm; - FILE *fp; -{ - int seq_id; - int num = dm->num_substitutions; - - fprintf (fp, "SUBSTITUTIONS:\n"); - for (seq_id = -1; seq_id < num - 1; ++seq_id) - { - int template_p; - dyn_string_t text = substitution_get (dm, seq_id + 1, &template_p); - - if (seq_id == -1) - fprintf (fp, " S_ "); - else - fprintf (fp, " S%d_", seq_id); - fprintf (fp, " %c: %s\n", template_p ? '*' : ' ', dyn_string_buf (text)); - } -} - -#endif /* CP_DEMANGLE_DEBUG */ - -/* Creates a new template argument list. Returns NULL if allocation - fails. */ - -static template_arg_list_t -template_arg_list_new () -{ - template_arg_list_t new_list = - (template_arg_list_t) malloc (sizeof (struct template_arg_list_def)); - if (new_list == NULL) - return NULL; - /* Initialize the new list to have no arguments. */ - new_list->first_argument = NULL; - new_list->last_argument = NULL; - /* Return the new list. */ - return new_list; -} - -/* Deletes a template argument list and the template arguments it - contains. */ - -static void -template_arg_list_delete (list) - template_arg_list_t list; -{ - /* If there are any arguments on LIST, delete them. */ - if (list->first_argument != NULL) - string_list_delete (list->first_argument); - /* Delete LIST. */ - free (list); -} - -/* Adds ARG to the template argument list ARG_LIST. */ - -static void -template_arg_list_add_arg (arg_list, arg) - template_arg_list_t arg_list; - string_list_t arg; -{ - if (arg_list->first_argument == NULL) - /* If there were no arguments before, ARG is the first one. */ - arg_list->first_argument = arg; - else - /* Make ARG the last argument on the list. */ - arg_list->last_argument->next = arg; - /* Make ARG the last on the list. */ - arg_list->last_argument = arg; - arg->next = NULL; -} - -/* Returns the template arugment at position INDEX in template - argument list ARG_LIST. */ - -static string_list_t -template_arg_list_get_arg (arg_list, index) - template_arg_list_t arg_list; - int index; -{ - string_list_t arg = arg_list->first_argument; - /* Scan down the list of arguments to find the one at position - INDEX. */ - while (index--) - { - arg = arg->next; - if (arg == NULL) - /* Ran out of arguments before INDEX hit zero. That's an - error. */ - return NULL; - } - /* Return the argument at position INDEX. */ - return arg; -} - -/* Pushes ARG_LIST onto the top of the template argument list stack. */ - -static void -push_template_arg_list (dm, arg_list) - demangling_t dm; - template_arg_list_t arg_list; -{ - arg_list->next = dm->template_arg_lists; - dm->template_arg_lists = arg_list; -#ifdef CP_DEMANGLE_DEBUG - fprintf (stderr, " ** pushing template arg list\n"); - template_arg_list_print (arg_list, stderr); -#endif -} - -/* Pops and deletes elements on the template argument list stack until - arg_list is the topmost element. If arg_list is NULL, all elements - are popped and deleted. */ - -static void -pop_to_template_arg_list (dm, arg_list) - demangling_t dm; - template_arg_list_t arg_list; -{ - while (dm->template_arg_lists != arg_list) - { - template_arg_list_t top = dm->template_arg_lists; - /* Disconnect the topmost element from the list. */ - dm->template_arg_lists = top->next; - /* Delete the popped element. */ - template_arg_list_delete (top); -#ifdef CP_DEMANGLE_DEBUG - fprintf (stderr, " ** removing template arg list\n"); -#endif - } -} - -#ifdef CP_DEMANGLE_DEBUG - -/* Prints the contents of ARG_LIST to FP. */ - -static void -template_arg_list_print (arg_list, fp) - template_arg_list_t arg_list; - FILE *fp; -{ - string_list_t arg; - int index = -1; - - fprintf (fp, "TEMPLATE ARGUMENT LIST:\n"); - for (arg = arg_list->first_argument; arg != NULL; arg = arg->next) - { - if (index == -1) - fprintf (fp, " T_ : "); - else - fprintf (fp, " T%d_ : ", index); - ++index; - fprintf (fp, "%s\n", dyn_string_buf ((dyn_string_t) arg)); - } -} - -#endif /* CP_DEMANGLE_DEBUG */ - -/* Returns the topmost element on the stack of template argument - lists. If there is no list of template arguments, returns NULL. */ - -static template_arg_list_t -current_template_arg_list (dm) - demangling_t dm; -{ - return dm->template_arg_lists; -} - -/* Allocates a demangling_t object for demangling mangled NAME. A new - result must be pushed before the returned object can be used. - Returns NULL if allocation fails. */ - -static demangling_t -demangling_new (name) - const char *name; -{ - demangling_t dm; - dm = (demangling_t) malloc (sizeof (struct demangling_def)); - if (dm == NULL) - return NULL; - - dm->name = name; - dm->next = name; - dm->result = NULL; - dm->num_substitutions = 0; - dm->substitutions_allocated = 10; - dm->template_arg_lists = NULL; - dm->last_source_name = dyn_string_new (0); - if (dm->last_source_name == NULL) - return NULL; - dm->substitutions = (struct substitution_def *) - malloc (dm->substitutions_allocated * sizeof (struct substitution_def)); - if (dm->substitutions == NULL) - { - dyn_string_delete (dm->last_source_name); - return NULL; - } - - return dm; -} - -/* Deallocates a demangling_t object and all memory associated with - it. */ - -static void -demangling_delete (dm) - demangling_t dm; -{ - int i; - template_arg_list_t arg_list = dm->template_arg_lists; - - /* Delete the stack of template argument lists. */ - while (arg_list != NULL) - { - template_arg_list_t next = arg_list->next; - template_arg_list_delete (arg_list); - arg_list = next; - } - /* Delete the list of substitutions. */ - for (i = dm->num_substitutions; --i >= 0; ) - dyn_string_delete (dm->substitutions[i].text); - free (dm->substitutions); - /* Delete the demangled result. */ - string_list_delete (dm->result); - /* Delete the stored identifier name. */ - dyn_string_delete (dm->last_source_name); - /* Delete the context object itself. */ - free (dm); -} - -/* These functions demangle an alternative of the corresponding - production in the mangling spec. The first argument of each is a - demangling context structure for the current demangling - operation. Most emit demangled text directly to the topmost result - string on the result string stack in the demangling context - structure. */ - -static status_t demangle_char - PARAMS ((demangling_t, int)); -static status_t demangle_mangled_name - PARAMS ((demangling_t)); -static status_t demangle_encoding - PARAMS ((demangling_t)); -static status_t demangle_name - PARAMS ((demangling_t, int *)); -static status_t demangle_nested_name - PARAMS ((demangling_t, int *)); -static status_t demangle_prefix - PARAMS ((demangling_t, int *)); -static status_t demangle_unqualified_name - PARAMS ((demangling_t)); -static status_t demangle_source_name - PARAMS ((demangling_t)); -static status_t demangle_number - PARAMS ((demangling_t, int *, int, int)); -static status_t demangle_number_literally - PARAMS ((demangling_t, dyn_string_t, int, int)); -static status_t demangle_identifier - PARAMS ((demangling_t, int, dyn_string_t)); -static status_t demangle_operator_name - PARAMS ((demangling_t, int, int *)); -static status_t demangle_special_name - PARAMS ((demangling_t)); -static status_t demangle_ctor_dtor_name - PARAMS ((demangling_t)); -static status_t demangle_type_ptr - PARAMS ((demangling_t)); -static status_t demangle_type - PARAMS ((demangling_t)); -static status_t demangle_CV_qualifiers - PARAMS ((demangling_t, dyn_string_t)); -static status_t demangle_builtin_type - PARAMS ((demangling_t)); -static status_t demangle_function_type - PARAMS ((demangling_t, int)); -static status_t demangle_bare_function_type - PARAMS ((demangling_t, int)); -static status_t demangle_class_enum_type - PARAMS ((demangling_t, int *)); -static status_t demangle_array_type - PARAMS ((demangling_t)); -static status_t demangle_template_param - PARAMS ((demangling_t, int *)); -static status_t demangle_template_args - PARAMS ((demangling_t)); -static status_t demangle_literal - PARAMS ((demangling_t)); -static status_t demangle_template_arg - PARAMS ((demangling_t)); -static status_t demangle_expression - PARAMS ((demangling_t)); -static status_t demangle_scope_expression - PARAMS ((demangling_t)); -static status_t demangle_expr_primary - PARAMS ((demangling_t)); -static status_t demangle_substitution - PARAMS ((demangling_t, int *, int *)); -static status_t demangle_local_name - PARAMS ((demangling_t)); -static status_t demangle_discriminator - PARAMS ((demangling_t, int)); -static status_t cp_demangle - PARAMS ((const char *, dyn_string_t)); -static status_t cp_demangle_type - PARAMS ((const char*, dyn_string_t)); - -/* When passed to demangle_bare_function_type, indicates that the - function's return type is not encoded before its parameter types. */ -#define BFT_NO_RETURN_TYPE -1 - -/* Check that the next character is C. If so, consume it. If not, - return an error. */ - -static status_t -demangle_char (dm, c) - demangling_t dm; - int c; -{ - static char *error_message = NULL; - - if (peek_char (dm) == c) - { - advance_char (dm); - return STATUS_OK; - } - else - { - if (error_message == NULL) - error_message = strdup ("Expected ?"); - error_message[9] = c; - return error_message; - } -} - -/* Demangles and emits a <mangled-name>. - - <mangled-name> ::= _Z <encoding> */ - -static status_t -demangle_mangled_name (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("mangled-name", dm); - RETURN_IF_ERROR (demangle_char (dm, '_')); - RETURN_IF_ERROR (demangle_char (dm, 'Z')); - RETURN_IF_ERROR (demangle_encoding (dm)); - return STATUS_OK; -} - -/* Demangles and emits an <encoding>. - - <encoding> ::= <function name> <bare-function-type> - ::= <data name> - ::= <special-name> */ - -static status_t -demangle_encoding (dm) - demangling_t dm; -{ - int template_p; - int start_position; - template_arg_list_t old_arg_list = current_template_arg_list (dm); - char peek = peek_char (dm); - - DEMANGLE_TRACE ("encoding", dm); - - /* Remember where the name starts. If it turns out to be a template - function, we'll have to insert the return type here. */ - start_position = result_length (dm); - - if (peek == 'G' || peek == 'T') - RETURN_IF_ERROR (demangle_special_name (dm)); - else - { - /* Now demangle the name. */ - RETURN_IF_ERROR (demangle_name (dm, &template_p)); - - /* If there's anything left, the name was a function name, with - maybe its return type, and its parameters types, following. */ - if (!end_of_name_p (dm) - && peek_char (dm) != 'E') - { - if (template_p) - /* Template functions have their return type encoded. The - return type should be inserted at start_position. */ - RETURN_IF_ERROR - (demangle_bare_function_type (dm, start_position)); - else - /* Non-template functions don't have their return type - encoded. */ - RETURN_IF_ERROR - (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE)); - } - } - - /* Pop off template argument lists that were built during the - mangling of this name, to restore the old template context. */ - pop_to_template_arg_list (dm, old_arg_list); - - return STATUS_OK; -} - -/* Demangles and emits a <name>. - - <name> ::= <unscoped-name> - ::= <unscoped-template-name> <template-args> - ::= <nested-name> - ::= <local-name> - - <unscoped-name> ::= <unqualified-name> - ::= St <unqualified-name> # ::std:: - - <unscoped-template-name> - ::= <unscoped-name> - ::= <substitution> */ - -static status_t -demangle_name (dm, template_p) - demangling_t dm; - int *template_p; -{ - int special_std_substitution; - int start = substitution_start (dm); - - DEMANGLE_TRACE ("name", dm); - - switch (peek_char (dm)) - { - case 'N': - /* This is a <nested-name>. */ - RETURN_IF_ERROR (demangle_nested_name (dm, template_p)); - break; - - case 'Z': - RETURN_IF_ERROR (demangle_local_name (dm)); - break; - - case 'S': - /* The `St' substitution allows a name nested in std:: to appear - without being enclosed in a nested name. */ - if (peek_char_next (dm) == 't') - { - (void) next_char (dm); - (void) next_char (dm); - RETURN_IF_ERROR (result_append (dm, "std::")); - RETURN_IF_ERROR (demangle_unqualified_name (dm)); - } - else - { - RETURN_IF_ERROR (demangle_substitution (dm, template_p, - &special_std_substitution)); - if (special_std_substitution) - { - /* This was the magic `std::' substitution. We can have - a <nested-name> or one of the unscoped names - following. */ - RETURN_IF_ERROR (result_append (dm, "::")); - RETURN_IF_ERROR (demangle_name (dm, template_p)); - } - } - /* Check if a template argument list immediately follows. - If so, then we just demangled an <unqualified-template-name>. */ - if (peek_char (dm) == 'I') - { - RETURN_IF_ERROR (substitution_add (dm, start, 0, - NOT_TEMPLATE_PARM)); - RETURN_IF_ERROR (demangle_template_args (dm)); - } - break; - - default: - /* This is an <unscoped-name> or <unscoped-template-name>. */ - RETURN_IF_ERROR (demangle_unqualified_name (dm)); - - /* If the <unqualified-name> is followed by template args, this - is an <unscoped-template-name>. */ - if (peek_char (dm) == 'I') - { - /* Add a substitution for the unqualified template name. */ - RETURN_IF_ERROR (substitution_add (dm, start, 0, - NOT_TEMPLATE_PARM)); - - RETURN_IF_ERROR (demangle_template_args (dm)); - *template_p = 1; - } - else - *template_p = 0; - - break; - } - - return STATUS_OK; -} - -/* Demangles and emits a <nested-name>. - - <nested-name> ::= N [<CV-qualifiers>] <prefix> <component> E */ - -static status_t -demangle_nested_name (dm, template_p) - demangling_t dm; - int *template_p; -{ - char peek; - - DEMANGLE_TRACE ("nested-name", dm); - - RETURN_IF_ERROR (demangle_char (dm, 'N')); - - peek = peek_char (dm); - if (peek == 'r' || peek == 'V' || peek == 'K') - { - status_t status; - - /* Snarf up and emit CV qualifiers. */ - dyn_string_t cv_qualifiers = dyn_string_new (24); - if (cv_qualifiers == NULL) - return STATUS_ALLOCATION_FAILED; - - demangle_CV_qualifiers (dm, cv_qualifiers); - status = result_append_string (dm, cv_qualifiers); - dyn_string_delete (cv_qualifiers); - RETURN_IF_ERROR (status); - RETURN_IF_ERROR (result_append_space (dm)); - } - - RETURN_IF_ERROR (demangle_prefix (dm, template_p)); - /* No need to demangle the final <component>; demangle_prefix will - handle it. */ - RETURN_IF_ERROR (demangle_char (dm, 'E')); - - return STATUS_OK; -} - -/* Demangles and emits a <prefix>. - - <prefix> ::= <prefix> <component> - ::= <template-prefix> <template-args> - ::= # empty - ::= <substitution> - - <template-prefix> ::= <prefix> - ::= <substitution> - - <component> ::= <unqualified-name> - ::= <local-name> */ - -static status_t -demangle_prefix (dm, template_p) - demangling_t dm; - int *template_p; -{ - int start = substitution_start (dm); - int nested = 0; - - /* TEMPLATE_P is updated as we decend the nesting chain. After - <template-args>, it is set to non-zero; after everything else it - is set to zero. */ - - DEMANGLE_TRACE ("prefix", dm); - - while (1) - { - char peek; - int unused; - - if (end_of_name_p (dm)) - return "Unexpected end of name in <compound-name>."; - - peek = peek_char (dm); - - if (IS_DIGIT ((unsigned char) peek) - || (peek >= 'a' && peek <= 'z') - || peek == 'C' || peek == 'D' - || peek == 'S') - { - /* We have another level of scope qualification. */ - if (nested) - RETURN_IF_ERROR (result_append (dm, "::")); - else - nested = 1; - - if (peek == 'S') - /* The substitution determines whether this is a - template-id. */ - RETURN_IF_ERROR (demangle_substitution (dm, template_p, - &unused)); - else - { - RETURN_IF_ERROR (demangle_unqualified_name (dm)); - *template_p = 0; - } - } - else if (peek == 'Z') - RETURN_IF_ERROR (demangle_local_name (dm)); - else if (peek == 'I') - { - if (*template_p) - return STATUS_INTERNAL_ERROR; - /* The template name is a substitution candidate. */ - RETURN_IF_ERROR (substitution_add (dm, start, 0, NOT_TEMPLATE_PARM)); - RETURN_IF_ERROR (demangle_template_args (dm)); - *template_p = 1; - } - else if (peek == 'E') - /* All done. */ - return STATUS_OK; - else - return "Unexpected character in <compound-name>."; - - /* Add a new substitution for the prefix thus far. */ - RETURN_IF_ERROR (substitution_add (dm, start, *template_p, - NOT_TEMPLATE_PARM)); - } -} - -/* Demangles and emits an <unqualified-name>. If the - <unqualified-name> is a function and the first element in the - argument list should be taken to be its return type, - ENCODE_RETURN_TYPE is non-zero. - - <unqualified-name> ::= <operator-name> - ::= <special-name> - ::= <source-name> */ - -static status_t -demangle_unqualified_name (dm) - demangling_t dm; -{ - char peek = peek_char (dm); - - DEMANGLE_TRACE ("unqualified-name", dm); - - if (IS_DIGIT ((unsigned char) peek)) - RETURN_IF_ERROR (demangle_source_name (dm)); - else if (peek >= 'a' && peek <= 'z') - { - int num_args; - RETURN_IF_ERROR (demangle_operator_name (dm, 0, &num_args)); - } - else if (peek == 'C' || peek == 'D') - RETURN_IF_ERROR (demangle_ctor_dtor_name (dm)); - else - return "Unexpected character in <unqualified-name>."; - - return STATUS_OK; -} - -/* Demangles and emits <source-name>. - - <source-name> ::= <length number> <identifier> */ - -static status_t -demangle_source_name (dm) - demangling_t dm; -{ - int length; - - DEMANGLE_TRACE ("source-name", dm); - - /* Decode the length of the identifier. */ - RETURN_IF_ERROR (demangle_number (dm, &length, 10, 0)); - if (length == 0) - return "Zero length in <source-name>."; - - /* Now the identifier itself. It's placed into last_source_name, - where it can be used to build a constructor or destructor name. */ - RETURN_IF_ERROR (demangle_identifier (dm, length, - dm->last_source_name)); - - /* Emit it. */ - RETURN_IF_ERROR (result_append_string (dm, dm->last_source_name)); - - return STATUS_OK; -} - -/* Demangles a number, either a <number> or a <positive-number> at the - current position, consuming all consecutive digit characters. Sets - *VALUE to the resulting numberand returns STATUS_OK. The number is - interpreted as BASE, which must be either 10 or 36. If IS_SIGNED - is non-zero, negative numbers -- prefixed with `n' -- are accepted. - - <number> ::= [n] <positive-number> - - <positive-number> ::= <decimal integer> */ - -static status_t -demangle_number (dm, value, base, is_signed) - demangling_t dm; - int *value; - int base; - int is_signed; -{ - dyn_string_t number = dyn_string_new (10); - - DEMANGLE_TRACE ("number", dm); - - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - - demangle_number_literally (dm, number, base, is_signed); - *value = strtol (dyn_string_buf (number), NULL, base); - dyn_string_delete (number); - - return STATUS_OK; -} - -/* Demangles a number at the current position. The digits (and minus - sign, if present) that make up the number are appended to STR. - Only base-BASE digits are accepted; BASE must be either 10 or 36. - If IS_SIGNED, negative numbers -- prefixed with `n' -- are - accepted. Does not consume a trailing underscore or other - terminating character. */ - -static status_t -demangle_number_literally (dm, str, base, is_signed) - demangling_t dm; - dyn_string_t str; - int base; - int is_signed; -{ - DEMANGLE_TRACE ("number*", dm); - - if (base != 10 && base != 36) - return STATUS_INTERNAL_ERROR; - - /* An `n' denotes a negative number. */ - if (is_signed && peek_char (dm) == 'n') - { - /* Skip past the n. */ - advance_char (dm); - /* The normal way to write a negative number is with a minus - sign. */ - if (!dyn_string_append_char (str, '-')) - return STATUS_ALLOCATION_FAILED; - } - - /* Loop until we hit a non-digit. */ - while (1) - { - char peek = peek_char (dm); - if (IS_DIGIT ((unsigned char) peek) - || (base == 36 && peek >= 'A' && peek <= 'Z')) - { - /* Accumulate digits. */ - if (!dyn_string_append_char (str, next_char (dm))) - return STATUS_ALLOCATION_FAILED; - } - else - /* Not a digit? All done. */ - break; - } - - return STATUS_OK; -} - -/* Demangles an identifier at the current position of LENGTH - characters and places it in IDENTIFIER. */ - -static status_t -demangle_identifier (dm, length, identifier) - demangling_t dm; - int length; - dyn_string_t identifier; -{ - DEMANGLE_TRACE ("identifier", dm); - - dyn_string_clear (identifier); - if (!dyn_string_resize (identifier, length)) - return STATUS_ALLOCATION_FAILED; - - while (length-- > 0) - { - if (end_of_name_p (dm)) - return "Unexpected end of name in <identifier>."; - if (!dyn_string_append_char (identifier, next_char (dm))) - return STATUS_ALLOCATION_FAILED; - } - - return STATUS_OK; -} - -/* Demangles and emits an <operator-name>. If SHORT_NAME is non-zero, - the short form is emitted; otherwise the full source form - (`operator +' etc.) is emitted. *NUM_ARGS is set to the number of - operands that the operator takes. - - <operator-name> - ::= nw # new - ::= na # new[] - ::= dl # delete - ::= da # delete[] - ::= ps # + (unary) - ::= ng # - (unary) - ::= ad # & (unary) - ::= de # * (unary) - ::= co # ~ - ::= pl # + - ::= mi # - - ::= ml # * - ::= dv # / - ::= rm # % - ::= an # & - ::= or # | - ::= eo # ^ - ::= aS # = - ::= pL # += - ::= mI # -= - ::= mL # *= - ::= dV # /= - ::= rM # %= - ::= aN # &= - ::= oR # |= - ::= eO # ^= - ::= ls # << - ::= rs # >> - ::= lS # <<= - ::= rS # >>= - ::= eq # == - ::= ne # != - ::= lt # < - ::= gt # > - ::= le # <= - ::= ge # >= - ::= nt # ! - ::= aa # && - ::= oo # || - ::= pp # ++ - ::= mm # -- - ::= cm # , - ::= pm # ->* - ::= pt # -> - ::= cl # () - ::= ix # [] - ::= qu # ? - ::= sz # sizeof - ::= cv <type> # cast - ::= vx <source-name> # vendor extended operator */ - -static status_t -demangle_operator_name (dm, short_name, num_args) - demangling_t dm; - int short_name; - int *num_args; -{ - struct operator_code - { - /* The mangled code for this operator. */ - const char *code; - /* The source name of this operator. */ - const char *name; - /* The number of arguments this operator takes. */ - int num_args; - }; - - static const struct operator_code operators[] = - { - { "aN", "&=" , 2 }, - { "aS", "=" , 2 }, - { "aa", "&&" , 2 }, - { "ad", "&" , 1 }, - { "an", "&" , 2 }, - { "cl", "()" , 0 }, - { "cm", "," , 2 }, - { "co", "~" , 1 }, - { "dV", "/=" , 2 }, - { "da", " delete[]", 1 }, - { "de", "*" , 1 }, - { "dl", " delete" , 1 }, - { "dv", "/" , 2 }, - { "eO", "^=" , 2 }, - { "eo", "^" , 2 }, - { "eq", "==" , 2 }, - { "ge", ">=" , 2 }, - { "gt", ">" , 2 }, - { "ix", "[]" , 2 }, - { "lS", "<<=" , 2 }, - { "le", "<=" , 2 }, - { "ls", "<<" , 2 }, - { "lt", "<" , 2 }, - { "mI", "-=" , 2 }, - { "mL", "*=" , 2 }, - { "mi", "-" , 2 }, - { "ml", "*" , 2 }, - { "mm", "--" , 1 }, - { "na", " new[]" , 1 }, - { "ne", "!=" , 2 }, - { "ng", "-" , 1 }, - { "nt", "!" , 1 }, - { "nw", " new" , 1 }, - { "oR", "|=" , 2 }, - { "oo", "||" , 2 }, - { "or", "|" , 2 }, - { "pL", "+=" , 2 }, - { "pl", "+" , 2 }, - { "pm", "->*" , 2 }, - { "pp", "++" , 1 }, - { "ps", "+" , 1 }, - { "qu", "?" , 3 }, - { "rM", "%=" , 2 }, - { "rS", ">>=" , 2 }, - { "rm", "%" , 2 }, - { "rs", ">>" , 2 }, - { "sz", " sizeof" , 1 } - }; - - const int num_operators = - sizeof (operators) / sizeof (struct operator_code); - - int c0 = next_char (dm); - int c1 = next_char (dm); - const struct operator_code* p1 = operators; - const struct operator_code* p2 = operators + num_operators; - - DEMANGLE_TRACE ("operator-name", dm); - - /* Is this a vendor extended operator? */ - if (c0 == 'v' && c1 == 'x') - { - RETURN_IF_ERROR (result_append (dm, "operator")); - RETURN_IF_ERROR (demangle_source_name (dm)); - *num_args = 0; - return STATUS_OK; - } - - /* Is this a conversion operator? */ - if (c0 == 'c' && c1 == 'v') - { - RETURN_IF_ERROR (result_append (dm, "operator ")); - /* Demangle the converted-to type. */ - RETURN_IF_ERROR (demangle_type (dm)); - *num_args = 0; - return STATUS_OK; - } - - /* Perform a binary search for the operator code. */ - while (1) - { - const struct operator_code* p = p1 + (p2 - p1) / 2; - char match0 = p->code[0]; - char match1 = p->code[1]; - - if (c0 == match0 && c1 == match1) - /* Found it. */ - { - if (!short_name) - RETURN_IF_ERROR (result_append (dm, "operator")); - RETURN_IF_ERROR (result_append (dm, p->name)); - *num_args = p->num_args; - - return STATUS_OK; - } - - if (p == p1) - /* Couldn't find it. */ - return "Unknown code in <operator-name>."; - - /* Try again. */ - if (c0 < match0 || (c0 == match0 && c1 < match1)) - p2 = p; - else - p1 = p; - } -} - -/* Demangles and emits a <special-name>. - - <special-name> ::= GV <object name> # Guard variable - ::= Th[n] <offset number> _ <base name> <base encoding> - # non-virtual base override thunk - ::= Tv[n] <offset number> _ <vcall offset number> - _ <base encoding> - # virtual base override thunk - ::= TV <type> # virtual table - ::= TT <type> # VTT - ::= TI <type> # typeinfo structure - ::= TS <type> # typeinfo name - - Also demangles the special g++ manglings, - - <special-name> ::= CT <type> <offset number> _ <base type> - # construction vtable - ::= TF <type> # typeinfo function (old ABI only) - ::= TJ <type> # java Class structure */ - -static status_t -demangle_special_name (dm) - demangling_t dm; -{ - dyn_string_t number; - int unused; - char peek = peek_char (dm); - - DEMANGLE_TRACE ("special-name", dm); - - if (peek == 'G') - { - /* A guard variable name. Consume the G. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_char (dm, 'V')); - RETURN_IF_ERROR (result_append (dm, "guard variable for ")); - RETURN_IF_ERROR (demangle_name (dm, &unused)); - } - else if (peek == 'T') - { - status_t status = STATUS_OK; - - /* Other C++ implementation miscellania. Consume the T. */ - advance_char (dm); - - switch (peek_char (dm)) - { - case 'V': - /* Virtual table. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "vtable for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'T': - /* VTT structure. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "VTT for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'I': - /* Typeinfo structure. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "typeinfo for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'F': - /* Typeinfo function. Used only in old ABI with new mangling. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "typeinfo fn for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'S': - /* Character string containing type name, used in typeinfo. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "typeinfo name for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'J': - /* The java Class variable corresponding to a C++ class. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "java Class for ")); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'h': - /* Non-virtual thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "non-virtual thunk")); - /* Demangle and emit the offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_append_char (dm, ' '); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, number); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the target name and function type. */ - RETURN_IF_ERROR (result_append (dm, " to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; - - case 'v': - /* Virtual thunk. */ - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "virtual thunk ")); - /* Demangle and emit the offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_append_string (dm, number); - if (STATUS_NO_ERROR (status)) - result_append_char (dm, ' '); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the vcall offset. */ - number = dyn_string_new (4); - if (number == NULL) - return STATUS_ALLOCATION_FAILED; - demangle_number_literally (dm, number, 10, 1); - /* Don't display the vcall offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_append_string (dm, number); - if (STATUS_NO_ERROR (status)) - status = result_append_char (dm, ' '); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - /* Demangle the separator. */ - RETURN_IF_ERROR (demangle_char (dm, '_')); - /* Demangle and emit the target function. */ - RETURN_IF_ERROR (result_append (dm, "to ")); - RETURN_IF_ERROR (demangle_encoding (dm)); - break; - - case 'C': - /* TC is a special g++ mangling for a construction vtable. */ - if (!flag_strict) - { - dyn_string_t derived_type; - - advance_char (dm); - RETURN_IF_ERROR (result_append (dm, "construction vtable for ")); - - /* Demangle the derived type off to the side. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - derived_type = (dyn_string_t) result_pop (dm); - - /* Demangle the offset. */ - number = dyn_string_new (4); - if (number == NULL) - { - dyn_string_delete (derived_type); - return STATUS_ALLOCATION_FAILED; - } - demangle_number_literally (dm, number, 10, 1); - /* Demangle the underscore separator. */ - status = demangle_char (dm, '_'); - - /* Demangle the base type. */ - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); - - /* Emit the derived type. */ - if (STATUS_NO_ERROR (status)) - status = result_append (dm, "-in-"); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, derived_type); - dyn_string_delete (derived_type); - - /* Don't display the offset unless in verbose mode. */ - if (flag_verbose) - { - status = result_append_char (dm, ' '); - if (STATUS_NO_ERROR (status)) - result_append_string (dm, number); - } - dyn_string_delete (number); - RETURN_IF_ERROR (status); - break; - } - /* If flag_strict, fall through. */ - - default: - return "Unrecognized <special-name>."; - } - } - else - return STATUS_ERROR; - - return STATUS_OK; -} - -/* Demangles and emits a <ctor-dtor-name>. - - <ctor-dtor-name> - ::= C1 # complete object (in-charge) ctor - ::= C2 # base object (not-in-charge) ctor - ::= C3 # complete object (in-charge) allocating ctor - ::= C4 # base object (not-in-charge) allocating ctor - ::= D0 # deleting (in-charge) dtor - ::= D1 # complete object (in-charge) dtor - ::= D2 # base object (not-in-charge) dtor */ - -static status_t -demangle_ctor_dtor_name (dm) - demangling_t dm; -{ - static const char *const ctor_flavors[] = - { - "in-charge", - "not-in-charge", - "in-charge allocating", - "not-in-charge allocating" - }; - static const char *const dtor_flavors[] = - { - "in-charge deleting", - "in-charge", - "not-in-charge" - }; - - int flavor; - char peek = peek_char (dm); - - DEMANGLE_TRACE ("ctor-dtor-name", dm); - - if (peek == 'C') - { - /* A constructor name. Consume the C. */ - advance_char (dm); - if (peek_char (dm) < '1' || peek_char (dm) > '4') - return "Unrecognized constructor."; - RETURN_IF_ERROR (result_append_string (dm, dm->last_source_name)); - /* Print the flavor of the constructor if in verbose mode. */ - flavor = next_char (dm) - '1'; - if (flag_verbose) - { - RETURN_IF_ERROR (result_append (dm, "[")); - RETURN_IF_ERROR (result_append (dm, ctor_flavors[flavor])); - RETURN_IF_ERROR (result_append_char (dm, ']')); - } - } - else if (peek == 'D') - { - /* A destructor name. Consume the D. */ - advance_char (dm); - if (peek_char (dm) < '0' || peek_char (dm) > '2') - return "Unrecognized destructor."; - RETURN_IF_ERROR (result_append_char (dm, '~')); - RETURN_IF_ERROR (result_append_string (dm, dm->last_source_name)); - /* Print the flavor of the destructor if in verbose mode. */ - flavor = next_char (dm) - '0'; - if (flag_verbose) - { - RETURN_IF_ERROR (result_append (dm, " [")); - RETURN_IF_ERROR (result_append (dm, dtor_flavors[flavor])); - RETURN_IF_ERROR (result_append_char (dm, ']')); - } - } - else - return STATUS_ERROR; - - return STATUS_OK; -} - -/* Handle pointer, reference, and pointer-to-member cases for - demangle_type. All consecutive `P's, `R's, and 'M's are joined to - build a pointer/reference type. We snarf all these, plus the - following <type>, all at once since we need to know whether we have - a pointer to data or pointer to function to construct the right - output syntax. C++'s pointer syntax is hairy. - - <type> ::= P <type> - ::= R <type> - ::= <pointer-to-member-type> - - <pointer-to-member-type> ::= M </class/ type> </member/ type> */ - -static status_t -demangle_type_ptr (dm) - demangling_t dm; -{ - char next; - status_t status; - - /* Collect pointer symbols into this string. */ - dyn_string_t symbols = dyn_string_new (10); - - DEMANGLE_TRACE ("type*", dm); - - if (symbols == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Scan forward, collecting pointers and references into symbols, - until we hit something else. Then emit the type. */ - while (1) - { - next = peek_char (dm); - if (next == 'P') - { - if (!dyn_string_append_char (symbols, '*')) - return STATUS_ALLOCATION_FAILED; - advance_char (dm); - } - else if (next == 'R') - { - if (!dyn_string_append_char (symbols, '&')) - return STATUS_ALLOCATION_FAILED; - advance_char (dm); - } - else if (next == 'M') - { - /* Pointer-to-member. */ - dyn_string_t class_type; - - /* Eat the 'M'. */ - advance_char (dm); - - /* Capture the type of which this is a pointer-to-member. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - class_type = (dyn_string_t) result_pop (dm); - - /* Build the pointer-to-member notation. It comes before - other pointer and reference qualifiers -- */ - if (!dyn_string_prepend_cstr (symbols, "::*")) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_prepend (symbols, class_type)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (class_type); - - if (peek_char (dm) == 'F') - continue; - - /* Demangle the type of the pointed-to member. */ - status = demangle_type (dm); - /* Make it pretty. */ - if (STATUS_NO_ERROR (status)) - status = result_append_space (dm); - /* Add the pointer-to-member syntax, and other pointer and - reference symbols. */ - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, symbols); - /* Clean up. */ - dyn_string_delete (symbols); - - RETURN_IF_ERROR (status); - return STATUS_OK; - } - else if (next == 'F') - { - /* Ooh, tricky, a pointer-to-function. */ - int position = result_length (dm); - status = result_append_char (dm, '('); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, symbols); - if (STATUS_NO_ERROR (status)) - status = result_append_char (dm, ')'); - dyn_string_delete (symbols); - RETURN_IF_ERROR (status); - - RETURN_IF_ERROR (demangle_function_type (dm, position)); - return STATUS_OK; - } - else - { - /* No more pointe or reference tokens. Finish up. */ - status = demangle_type (dm); - - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, symbols); - dyn_string_delete (symbols); - RETURN_IF_ERROR (status); - - RETURN_IF_ERROR (status); - return STATUS_OK; - } - } -} - -/* Demangles and emits a <type>. - - <type> ::= <builtin-type> - ::= <function-type> - ::= <class-enum-type> - ::= <array-type> - ::= <pointer-to-member-type> - ::= <template-param> - ::= <CV-qualifiers> <type> - ::= P <type> # pointer-to - ::= R <type> # reference-to - ::= C <type> # complex pair (C 2000) - ::= G <type> # imaginary (C 2000) - ::= U <source-name> <type> # vendor extended type qualifier - ::= <substitution> */ - -static status_t -demangle_type (dm) - demangling_t dm; -{ - int start = substitution_start (dm); - char peek = peek_char (dm); - char peek_next; - int template_p = 0; - int special_std_substitution; - int is_builtin_type = 0; - template_arg_list_t old_arg_list = current_template_arg_list (dm); - int template_parm = NOT_TEMPLATE_PARM; - - DEMANGLE_TRACE ("type", dm); - - /* A <class-enum-type> can start with a digit (a <source-name>), an - N (a <nested-name>), or a Z (a <local-name>). */ - if (IS_DIGIT ((unsigned char) peek) || peek == 'N' || peek == 'Z') - RETURN_IF_ERROR (demangle_class_enum_type (dm, &template_p)); - else if (peek >= 'a' && peek <= 'z') - { - RETURN_IF_ERROR (demangle_builtin_type (dm)); - is_builtin_type = 1; - } - else - switch (peek) - { - case 'r': - case 'V': - case 'K': - { - status_t status; - dyn_string_t cv_qualifiers = dyn_string_new (24); - - if (cv_qualifiers == NULL) - return STATUS_ALLOCATION_FAILED; - - demangle_CV_qualifiers (dm, cv_qualifiers); - - /* If the qualifiers apply to a pointer or reference, they - need to come after the whole qualified type. */ - if (peek_char (dm) == 'P' || peek_char (dm) == 'R') - { - status = demangle_type (dm); - if (STATUS_NO_ERROR (status)) - status = result_append_space (dm); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, cv_qualifiers); - } - /* Otherwise, the qualifiers come first. */ - else - { - status = result_append_string (dm, cv_qualifiers); - if (STATUS_NO_ERROR (status)) - status = result_append_space (dm); - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); - } - - dyn_string_delete (cv_qualifiers); - RETURN_IF_ERROR (status); - } - break; - - case 'F': - return "Non-pointer or -reference function type."; - - case 'A': - RETURN_IF_ERROR (demangle_array_type (dm)); - break; - - case 'T': - RETURN_IF_ERROR (demangle_template_param (dm, &template_parm)); - break; - - case 'S': - /* First check if this is a special substitution. If it is, - this is a <class-enum-type>. Special substitutions have a - letter following the `S'; other substitutions have a digit - or underscore. */ - peek_next = peek_char_next (dm); - if (IS_DIGIT (peek_next) || peek_next == '_') - RETURN_IF_ERROR (demangle_substitution (dm, &template_p, - &special_std_substitution)); - else - demangle_class_enum_type (dm, &template_p); - break; - - case 'P': - case 'R': - case 'M': - RETURN_IF_ERROR (demangle_type_ptr (dm)); - break; - - case 'C': - /* A C99 complex type. */ - RETURN_IF_ERROR (result_append (dm, "complex ")); - advance_char (dm); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'G': - /* A C99 imaginary type. */ - RETURN_IF_ERROR (result_append (dm, "imaginary ")); - advance_char (dm); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - case 'U': - /* Vendor extended type qualifier. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_source_name (dm)); - RETURN_IF_ERROR (result_append_char (dm, ' ')); - RETURN_IF_ERROR (demangle_type (dm)); - break; - - default: - return "Unexpected character in <type>."; - } - - /* Unqualified builin types are not substitution candidates. */ - if (!is_builtin_type) - /* Add a new substitution for the type. If this type was a - <template-param>, pass its index since from the point of - substitutions, a <template-param> token is a substitution - candidate distinct from the type that is substituted for it. */ - RETURN_IF_ERROR (substitution_add (dm, start, template_p, template_parm)); - - /* Pop off template argument lists added during mangling of this - type. */ - pop_to_template_arg_list (dm, old_arg_list); - - return STATUS_OK; -} - -/* C++ source names of builtin types, indexed by the mangled code - letter's position in the alphabet ('a' -> 0, 'b' -> 1, etc). */ -static const char *const builtin_type_names[26] = -{ - "signed char", /* a */ - "bool", /* b */ - "char", /* c */ - "double", /* d */ - "long double", /* e */ - "float", /* f */ - "__float128", /* g */ - "unsigned char", /* h */ - "int", /* i */ - "unsigned", /* j */ - NULL, /* k */ - "long", /* l */ - "unsigned long", /* m */ - "__int128", /* n */ - "unsigned __int128", /* o */ - NULL, /* p */ - NULL, /* q */ - NULL, /* r */ - "short", /* s */ - "unsigned short", /* t */ - NULL, /* u */ - "void", /* v */ - "wchar_t", /* w */ - "long long", /* x */ - "unsigned long long", /* y */ - "..." /* z */ -}; - -/* Demangles and emits a <builtin-type>. - - <builtin-type> ::= v # void - ::= w # wchar_t - ::= b # bool - ::= c # char - ::= a # signed char - ::= h # unsigned char - ::= s # short - ::= t # unsigned short - ::= i # int - ::= j # unsigned int - ::= l # long - ::= m # unsigned long - ::= x # long long, __int64 - ::= y # unsigned long long, __int64 - ::= n # __int128 - ::= o # unsigned __int128 - ::= f # float - ::= d # double - ::= e # long double, __float80 - ::= g # __float128 - ::= z # ellipsis - ::= u <source-name> # vendor extended type */ - -static status_t -demangle_builtin_type (dm) - demangling_t dm; -{ - - char code = peek_char (dm); - - DEMANGLE_TRACE ("builtin-type", dm); - - if (code == 'u') - { - advance_char (dm); - RETURN_IF_ERROR (demangle_source_name (dm)); - return STATUS_OK; - } - else if (code >= 'a' && code <= 'z') - { - const char *type_name = builtin_type_names[code - 'a']; - if (type_name == NULL) - return "Unrecognized <builtin-type> code."; - - RETURN_IF_ERROR (result_append (dm, type_name)); - advance_char (dm); - return STATUS_OK; - } - else - return "Non-alphabetic <builtin-type> code."; -} - -/* Demangles all consecutive CV-qualifiers (const, volatile, and - restrict) at the current position. The qualifiers are appended to - QUALIFIERS. Returns STATUS_OK. */ - -static status_t -demangle_CV_qualifiers (dm, qualifiers) - demangling_t dm; - dyn_string_t qualifiers; -{ - DEMANGLE_TRACE ("CV-qualifiers", dm); - - while (1) - { - switch (peek_char (dm)) - { - case 'r': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "restrict")) - return STATUS_ALLOCATION_FAILED; - break; - - case 'V': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "volatile")) - return STATUS_ALLOCATION_FAILED; - break; - - case 'K': - if (!dyn_string_append_space (qualifiers)) - return STATUS_ALLOCATION_FAILED; - if (!dyn_string_append_cstr (qualifiers, "const")) - return STATUS_ALLOCATION_FAILED; - break; - - default: - return STATUS_OK; - } - - advance_char (dm); - } -} - -/* Demangles and emits a <function-type> FUNCTION_NAME_POS is the - position in the result string of the start of the function - identifier, at which the function's return type will be inserted. - - <function-type> ::= F [Y] <bare-function-type> E */ - -static status_t -demangle_function_type (dm, function_name_pos) - demangling_t dm; - int function_name_pos; -{ - DEMANGLE_TRACE ("function-type", dm); - RETURN_IF_ERROR (demangle_char (dm, 'F')); - if (peek_char (dm) == 'Y') - { - /* Indicate this function has C linkage if in verbose mode. */ - if (flag_verbose) - RETURN_IF_ERROR (result_append (dm, " [extern \"C\"] ")); - advance_char (dm); - } - RETURN_IF_ERROR (demangle_bare_function_type (dm, function_name_pos)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - return STATUS_OK; -} - -/* Demangles and emits a <bare-function-type>. RETURN_TYPE_POS is the - position in the result string at which the function return type - should be inserted. If RETURN_TYPE_POS is BFT_NO_RETURN_TYPE, the - function's return type is assumed not to be encoded. - - <bare-function-type> ::= <signature type>+ */ - -static status_t -demangle_bare_function_type (dm, return_type_pos) - demangling_t dm; - int return_type_pos; -{ - /* Sequence is the index of the current function parameter, counting - from zero. The value -1 denotes the return type. */ - int sequence = - (return_type_pos == BFT_NO_RETURN_TYPE ? 0 : -1); - - DEMANGLE_TRACE ("bare-function-type", dm); - - RETURN_IF_ERROR (result_append_char (dm, '(')); - while (!end_of_name_p (dm) && peek_char (dm) != 'E') - { - if (sequence == -1) - /* We're decoding the function's return type. */ - { - dyn_string_t return_type; - status_t status = STATUS_OK; - - /* Decode the return type off to the side. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_type (dm)); - return_type = (dyn_string_t) result_pop (dm); - - /* Add a space to the end of the type. Insert the return - type where we've been asked to. */ - if (!dyn_string_append_space (return_type) - || !dyn_string_insert (result_string (dm), return_type_pos, - return_type)) - status = STATUS_ALLOCATION_FAILED; - - dyn_string_delete (return_type); - RETURN_IF_ERROR (status); - } - else - { - /* Skip `void' parameter types. One should only occur as - the only type in a parameter list; in that case, we want - to print `foo ()' instead of `foo (void)'. */ - if (peek_char (dm) == 'v') - { - /* Consume the v. */ - advance_char (dm); - continue; - } - /* Separate parameter types by commas. */ - if (sequence > 0) - RETURN_IF_ERROR (result_append (dm, ", ")); - /* Demangle the type. */ - RETURN_IF_ERROR (demangle_type (dm)); - } - - ++sequence; - } - RETURN_IF_ERROR (result_append_char (dm, ')')); - - return STATUS_OK; -} - -/* Demangles and emits a <class-enum-type>. *TEMPLATE_P is set to - non-zero if the type is a template-id, zero otherwise. - - <class-enum-type> ::= <name> */ - -static status_t -demangle_class_enum_type (dm, template_p) - demangling_t dm; - int *template_p; -{ - DEMANGLE_TRACE ("class-enum-type", dm); - - RETURN_IF_ERROR (demangle_name (dm, template_p)); - return STATUS_OK; -} - -/* Demangles and emits an <array-type>. - - <array-type> ::= A [<dimension number>] _ <element type> */ - -static status_t -demangle_array_type (dm) - demangling_t dm; -{ - status_t status; - dyn_string_t array_size = dyn_string_new (10); - - if (array_size == NULL) - return STATUS_ALLOCATION_FAILED; - - status = demangle_char (dm, 'A'); - - /* Demangle the array size into array_size. */ - if (STATUS_NO_ERROR (status)) - status = demangle_number_literally (dm, array_size, 10, 0); - - /* Demangle the base type of the array. */ - if (STATUS_NO_ERROR (status)) - status = demangle_char (dm, '_'); - if (STATUS_NO_ERROR (status)) - status = demangle_type (dm); - - /* Emit the array dimension syntax. */ - if (STATUS_NO_ERROR (status)) - status = result_append_char (dm, '['); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, array_size); - if (STATUS_NO_ERROR (status)) - status = result_append_char (dm, ']'); - dyn_string_delete (array_size); - - RETURN_IF_ERROR (status); - - return STATUS_OK; -} - -/* Demangles and emits a <template-param>. The zero-indexed position - in the parameter list is placed in *TEMPLATE_PARM_NUMBER. - - <template-param> ::= T_ # first template parameter - ::= T <parameter-2 number> _ */ - -static status_t -demangle_template_param (dm, template_parm_number) - demangling_t dm; - int *template_parm_number; -{ - int parm_number; - template_arg_list_t current_arg_list = current_template_arg_list (dm); - string_list_t arg; - - DEMANGLE_TRACE ("template-param", dm); - - /* Make sure there is a template argmust list in which to look up - this parameter reference. */ - if (current_arg_list == NULL) - return "Template parameter outside of template."; - - RETURN_IF_ERROR (demangle_char (dm, 'T')); - if (peek_char (dm) == '_') - parm_number = 0; - else - { - RETURN_IF_ERROR (demangle_number (dm, &parm_number, 10, 0)); - ++parm_number; - } - RETURN_IF_ERROR (demangle_char (dm, '_')); - - arg = template_arg_list_get_arg (current_arg_list, parm_number); - if (arg == NULL) - /* parm_number exceeded the number of arguments in the current - template argument list. */ - return "Template parameter number out of bounds."; - RETURN_IF_ERROR (result_append_string (dm, (dyn_string_t) arg)); - - if (peek_char (dm) == 'I') - RETURN_IF_ERROR (demangle_template_args (dm)); - - *template_parm_number = parm_number; - return STATUS_OK; -} - -/* Demangles and emits a <template-args>. - - <template-args> ::= I <template-arg>+ E */ - -static status_t -demangle_template_args (dm) - demangling_t dm; -{ - int first = 1; - dyn_string_t old_last_source_name; - template_arg_list_t arg_list = template_arg_list_new (); - - if (arg_list == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Preserve the most recently demangled source name. */ - old_last_source_name = dm->last_source_name; - dm->last_source_name = dyn_string_new (0); - - DEMANGLE_TRACE ("template-args", dm); - - if (dm->last_source_name == NULL) - return STATUS_ALLOCATION_FAILED; - - RETURN_IF_ERROR (demangle_char (dm, 'I')); - RETURN_IF_ERROR (result_append_char (dm, '<')); - do - { - string_list_t arg; - - if (first) - first = 0; - else - RETURN_IF_ERROR (result_append (dm, ", ")); - - /* Capture the template arg. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_template_arg (dm)); - arg = result_pop (dm); - - /* Emit it in the demangled name. */ - RETURN_IF_ERROR (result_append_string (dm, (dyn_string_t) arg)); - - /* Save it for use in expanding <template-param>s. */ - template_arg_list_add_arg (arg_list, arg); - } - while (peek_char (dm) != 'E'); - /* Append the '>'. */ - RETURN_IF_ERROR (result_close_template_list (dm)); - - /* Consume the 'E'. */ - advance_char (dm); - - /* Restore the most recent demangled source name. */ - dyn_string_delete (dm->last_source_name); - dm->last_source_name = old_last_source_name; - - /* Push the list onto the top of the stack of template argument - lists, so that arguments from it are used from now on when - expanding <template-param>s. */ - push_template_arg_list (dm, arg_list); - - return STATUS_OK; -} - -/* This function, which does not correspond to a production in the - mangling spec, handles the `literal' production for both - <template-arg> and <expr-primary>. It does not expect or consume - the initial `L' or final `E'. The demangling is given by: - - <literal> ::= <type> </value/ number> - - and the emitted output is `(type)number'. */ - -static status_t -demangle_literal (dm) - demangling_t dm; -{ - char peek = peek_char (dm); - dyn_string_t value_string; - status_t status; - - DEMANGLE_TRACE ("literal", dm); - - if (!flag_verbose && peek >= 'a' && peek <= 'z') - { - /* If not in verbose mode and this is a builtin type, see if we - can produce simpler numerical output. In particular, for - integer types shorter than `long', just write the number - without type information; for bools, write `true' or `false'. - Other refinements could be made here too. */ - - /* This constant string is used to map from <builtin-type> codes - (26 letters of the alphabet) to codes that determine how the - value will be displayed. The codes are: - b: display as bool - i: display as int - l: display as long - A space means the value will be represented using cast - notation. */ - static const char *const code_map = "ibi iii ll ii i "; - - char code = code_map[peek - 'a']; - /* FIXME: Implement demangling of floats and doubles. */ - if (code == 'u') - return STATUS_UNIMPLEMENTED; - if (code == 'b') - { - /* It's a boolean. */ - char value; - - /* Consume the b. */ - advance_char (dm); - /* Look at the next character. It should be 0 or 1, - corresponding to false or true, respectively. */ - value = peek_char (dm); - if (value == '0') - RETURN_IF_ERROR (result_append (dm, "false")); - else if (value == '1') - RETURN_IF_ERROR (result_append (dm, "true")); - else - return "Unrecognized bool constant."; - /* Consume the 0 or 1. */ - advance_char (dm); - return STATUS_OK; - } - else if (code == 'i' || code == 'l') - { - /* It's an integer or long. */ - - /* Consume the type character. */ - advance_char (dm); - - /* Demangle the number and write it out. */ - value_string = dyn_string_new (0); - status = demangle_number_literally (dm, value_string, 10, 1); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, value_string); - /* For long integers, append an l. */ - if (code == 'l' && STATUS_NO_ERROR (status)) - status = result_append_char (dm, code); - dyn_string_delete (value_string); - - RETURN_IF_ERROR (status); - return STATUS_OK; - } - /* ...else code == ' ', so fall through to represent this - literal's type explicitly using cast syntax. */ - } - - RETURN_IF_ERROR (result_append_char (dm, '(')); - RETURN_IF_ERROR (demangle_type (dm)); - RETURN_IF_ERROR (result_append_char (dm, ')')); - - value_string = dyn_string_new (0); - if (value_string == NULL) - return STATUS_ALLOCATION_FAILED; - - status = demangle_number_literally (dm, value_string, 10, 1); - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, value_string); - dyn_string_delete (value_string); - RETURN_IF_ERROR (status); - - return STATUS_OK; -} - -/* Demangles and emits a <template-arg>. - - <template-arg> ::= <type> # type - ::= L <type> <value number> E # literal - ::= LZ <encoding> E # external name - ::= X <expression> E # expression */ - -static status_t -demangle_template_arg (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("template-arg", dm); - - switch (peek_char (dm)) - { - case 'L': - advance_char (dm); - - if (peek_char (dm) == 'Z') - { - /* External name. */ - advance_char (dm); - /* FIXME: Standard is contradictory here. */ - RETURN_IF_ERROR (demangle_encoding (dm)); - } - else - RETURN_IF_ERROR (demangle_literal (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - break; - - case 'X': - /* Expression. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_expression (dm)); - break; - - default: - RETURN_IF_ERROR (demangle_type (dm)); - break; - } - - return STATUS_OK; -} - -/* Demangles and emits an <expression>. - - <expression> ::= <unary operator-name> <expression> - ::= <binary operator-name> <expression> <expression> - ::= <expr-primary> - ::= <scope-expression> */ - -static status_t -demangle_expression (dm) - demangling_t dm; -{ - char peek = peek_char (dm); - - DEMANGLE_TRACE ("expression", dm); - - if (peek == 'L' || peek == 'T') - RETURN_IF_ERROR (demangle_expr_primary (dm)); - else if (peek == 's' && peek_char_next (dm) == 'r') - RETURN_IF_ERROR (demangle_scope_expression (dm)); - else - /* An operator expression. */ - { - int num_args; - status_t status = STATUS_OK; - dyn_string_t operator_name; - - /* We have an operator name. Since we want to output binary - operations in infix notation, capture the operator name - first. */ - RETURN_IF_ERROR (result_push (dm)); - RETURN_IF_ERROR (demangle_operator_name (dm, 1, &num_args)); - operator_name = (dyn_string_t) result_pop (dm); - - /* If it's binary, do an operand first. */ - if (num_args > 1) - { - status = result_append_char (dm, '('); - if (STATUS_NO_ERROR (status)) - status = demangle_expression (dm); - if (STATUS_NO_ERROR (status)) - status = result_append_char (dm, ')'); - } - - /* Emit the operator. */ - if (STATUS_NO_ERROR (status)) - status = result_append_string (dm, operator_name); - dyn_string_delete (operator_name); - RETURN_IF_ERROR (status); - - /* Emit its second (if binary) or only (if unary) operand. */ - RETURN_IF_ERROR (result_append_char (dm, '(')); - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (result_append_char (dm, ')')); - - /* The ternary operator takes a third operand. */ - if (num_args == 3) - { - RETURN_IF_ERROR (result_append (dm, ":(")); - RETURN_IF_ERROR (demangle_expression (dm)); - RETURN_IF_ERROR (result_append_char (dm, ')')); - } - } - - return STATUS_OK; -} - -/* Demangles and emits a <scope-expression>. - - <scope-expression> ::= sr <qualifying type> <source-name> - ::= sr <qualifying type> <encoding> */ - -static status_t -demangle_scope_expression (dm) - demangling_t dm; -{ - RETURN_IF_ERROR (demangle_char (dm, 's')); - RETURN_IF_ERROR (demangle_char (dm, 'r')); - RETURN_IF_ERROR (demangle_type (dm)); - RETURN_IF_ERROR (result_append (dm, "::")); - RETURN_IF_ERROR (demangle_encoding (dm)); - return STATUS_OK; -} - -/* Demangles and emits an <expr-primary>. - - <expr-primary> ::= <template-param> - ::= L <type> <value number> E # literal - ::= L <mangled-name> E # external name */ - -static status_t -demangle_expr_primary (dm) - demangling_t dm; -{ - char peek = peek_char (dm); - int unused; - - DEMANGLE_TRACE ("expr-primary", dm); - - if (peek == 'T') - RETURN_IF_ERROR (demangle_template_param (dm, &unused)); - else if (peek == 'L') - { - /* Consume the `L'. */ - advance_char (dm); - peek = peek_char (dm); - - if (peek == '_') - RETURN_IF_ERROR (demangle_mangled_name (dm)); - else - RETURN_IF_ERROR (demangle_literal (dm)); - - RETURN_IF_ERROR (demangle_char (dm, 'E')); - } - else - return STATUS_ERROR; - - return STATUS_OK; -} - -/* Demangles and emits a <substitution>. Sets *TEMPLATE_P to non-zero - if the substitution is the name of a template, zero otherwise. If - the substitution token is St, which corresponds to the `::std::' - namespace and can appear in a non-nested name, sets - *SPECIAL_STD_SUBSTITUTION to non-zero; zero otherwise. - - <substitution> ::= S <seq-id> _ - ::= S_ - - ::= St # ::std:: - ::= Sa # ::std::allocator - ::= Sb # ::std::basic_string - ::= Ss # ::std::basic_string<char, - ::std::char_traits<char>, - ::std::allocator<char> > - ::= Si # ::std::basic_istream<char, - std::char_traits<char> > - ::= So # ::std::basic_ostream<char, - std::char_traits<char> > - ::= Sd # ::std::basic_iostream<char, - std::char_traits<char> > -*/ - -static status_t -demangle_substitution (dm, template_p, special_std_substitution) - demangling_t dm; - int *template_p; - int *special_std_substitution; -{ - int seq_id; - int peek; - dyn_string_t text; - - DEMANGLE_TRACE ("substitution", dm); - - RETURN_IF_ERROR (demangle_char (dm, 'S')); - *special_std_substitution = 0; - - /* Scan the substitution sequence index. A missing number denotes - the first index. */ - peek = peek_char (dm); - if (peek == '_') - seq_id = -1; - /* If the following character is 0-9 or a capital letter, interpret - the sequence up to the next underscore as a base-36 substitution - index. */ - else if (IS_DIGIT ((unsigned char) peek) - || (peek >= 'A' && peek <= 'Z')) - RETURN_IF_ERROR (demangle_number (dm, &seq_id, 36, 0)); - else - { - const char *new_last_source_name = NULL; - - switch (peek) - { - case 't': - RETURN_IF_ERROR (result_append (dm, "std")); - *special_std_substitution = 1; - break; - - case 'a': - RETURN_IF_ERROR (result_append (dm, "std::allocator")); - new_last_source_name = "allocator"; - *template_p = 1; - break; - - case 'b': - RETURN_IF_ERROR (result_append (dm, "std::basic_string")); - new_last_source_name = "basic_string"; - *template_p = 1; - break; - - case 's': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_append (dm, "std::string")); - new_last_source_name = "string"; - } - else - { - RETURN_IF_ERROR (result_append (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >")); - new_last_source_name = "basic_string"; - } - *template_p = 0; - break; - - case 'i': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_append (dm, "std::istream")); - new_last_source_name = "istream"; - } - else - { - RETURN_IF_ERROR (result_append (dm, "std::basic_istream<char, std::char_traints<char> >")); - new_last_source_name = "basic_istream"; - } - *template_p = 0; - break; - - case 'o': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_append (dm, "std::ostream")); - new_last_source_name = "ostream"; - } - else - { - RETURN_IF_ERROR (result_append (dm, "std::basic_ostream<char, std::char_traits<char> >")); - new_last_source_name = "basic_ostream"; - } - *template_p = 0; - break; - - case 'd': - if (!flag_verbose) - { - RETURN_IF_ERROR (result_append (dm, "std::iostream")); - new_last_source_name = "iostream"; - } - else - { - RETURN_IF_ERROR (result_append (dm, "std::basic_iostream<char, std::char_traits<char> >")); - new_last_source_name = "basic_iostream"; - } - *template_p = 0; - break; - - default: - return "Unrecognized <substitution>."; - } - - /* Consume the character we just processed. */ - advance_char (dm); - - if (new_last_source_name != NULL) - { - if (!dyn_string_copy_cstr (dm->last_source_name, - new_last_source_name)) - return STATUS_ALLOCATION_FAILED; - } - - return STATUS_OK; - } - - /* Look up the substitution text. Since `S_' is the most recent - substitution, `S0_' is the second-most-recent, etc., shift the - numbering by one. */ - text = substitution_get (dm, seq_id + 1, template_p); - if (text == NULL) - return "Substitution number out of range."; - - /* Emit the substitution text. */ - RETURN_IF_ERROR (result_append_string (dm, text)); - - RETURN_IF_ERROR (demangle_char (dm, '_')); - return STATUS_OK; -} - -/* Demangles and emits a <local-name>. - - <local-name> := Z <function encoding> E <entity name> [<discriminator>] - := Z <function encoding> E s [<discriminator>] */ - -static status_t -demangle_local_name (dm) - demangling_t dm; -{ - DEMANGLE_TRACE ("local-name", dm); - - RETURN_IF_ERROR (demangle_char (dm, 'Z')); - RETURN_IF_ERROR (demangle_encoding (dm)); - RETURN_IF_ERROR (demangle_char (dm, 'E')); - RETURN_IF_ERROR (result_append (dm, "'s ")); - - if (peek_char (dm) == 's') - { - /* Local character string literal. */ - RETURN_IF_ERROR (result_append (dm, "string literal")); - /* Consume the s. */ - advance_char (dm); - RETURN_IF_ERROR (demangle_discriminator (dm, 0)); - } - else - { - int unused; - RETURN_IF_ERROR (result_append (dm, "local ")); - /* Local name for some other entity. Demangle its name. */ - RETURN_IF_ERROR (demangle_name (dm, &unused)); - RETURN_IF_ERROR (demangle_discriminator (dm, 1)); - } - - return STATUS_OK; - } - - /* Optimonally demangles and emits a <discriminator>. If there is no - <discriminator> at the current position in the mangled string, the - descriminator is assumed to be zero. Emit the discriminator number - in parentheses, unless SUPPRESS_FIRST is non-zero and the - discriminator is zero. - - <discriminator> ::= _ <number> */ - -static status_t -demangle_discriminator (dm, suppress_first) - demangling_t dm; - int suppress_first; -{ - /* Output for <discriminator>s to the demangled name is completely - supressed if not in verbose mode. */ - - if (peek_char (dm) == '_') - { - /* Consume the underscore. */ - advance_char (dm); - if (flag_verbose) - RETURN_IF_ERROR (result_append (dm, " [#")); - /* Check if there's a number following the underscore. */ - if (IS_DIGIT ((unsigned char) peek_char (dm))) - { - int discriminator; - /* Demangle the number. */ - RETURN_IF_ERROR (demangle_number (dm, &discriminator, 10, 0)); - if (flag_verbose) - /* Write the discriminator. The mangled number is two - less than the discriminator ordinal, counting from - zero. */ - RETURN_IF_ERROR (int_to_dyn_string (discriminator + 2, - (dyn_string_t) dm->result)); - } - else - { - if (flag_verbose) - /* A missing digit correspond to one. */ - RETURN_IF_ERROR (result_append_char (dm, '1')); - } - if (flag_verbose) - RETURN_IF_ERROR (result_append_char (dm, ']')); - } - else if (!suppress_first) - { - if (flag_verbose) - RETURN_IF_ERROR (result_append (dm, " [#0]")); - } - - return STATUS_OK; -} - -/* Demangle NAME into RESULT, which must be an initialized - dyn_string_t. On success, returns STATUS_OK. On failure, returns - an error message, and the contents of RESULT are unchanged. */ - -static status_t -cp_demangle (name, result) - const char *name; - dyn_string_t result; -{ - status_t status; - int length = strlen (name); - - if (length > 2 && name[0] == '_' && name[1] == 'Z') - { - demangling_t dm = demangling_new (name); - if (dm == NULL) - return STATUS_ALLOCATION_FAILED; - - status = result_push (dm); - if (status != STATUS_OK) - { - demangling_delete (dm); - return status; - } - - status = demangle_mangled_name (dm); - if (STATUS_NO_ERROR (status)) - { - dyn_string_t demangled = (dyn_string_t) result_pop (dm); - if (!dyn_string_copy (result, demangled)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (demangled); - } - - demangling_delete (dm); - } - else - { - /* It's evidently not a mangled C++ name. It could be the name - of something with C linkage, though, so just copy NAME into - RESULT. */ - if (!dyn_string_copy_cstr (result, name)) - return STATUS_ALLOCATION_FAILED; - status = STATUS_OK; - } - - return status; -} - -/* Demangle TYPE_NAME into RESULT, which must be an initialized - dyn_string_t. On success, returns STATUS_OK. On failiure, returns - an error message, and the contents of RESULT are unchanged. */ - -static status_t -cp_demangle_type (type_name, result) - const char* type_name; - dyn_string_t result; -{ - status_t status; - demangling_t dm = demangling_new (type_name); - - if (dm == NULL) - return STATUS_ALLOCATION_FAILED; - - /* Demangle the type name. The demangled name is stored in dm. */ - status = result_push (dm); - if (status != STATUS_OK) - { - demangling_delete (dm); - return status; - } - - status = demangle_type (dm); - - if (STATUS_NO_ERROR (status)) - { - /* The demangling succeeded. Pop the result out of dm and copy - it into RESULT. */ - dyn_string_t demangled = (dyn_string_t) result_pop (dm); - if (!dyn_string_copy (result, demangled)) - return STATUS_ALLOCATION_FAILED; - dyn_string_delete (demangled); - } - - /* Clean up. */ - demangling_delete (dm); - - return status; -} - - -#ifdef IN_LIBGCC2 - -extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *)); - -/* ABI-mandated entry point in the C++ runtime library for performing - demangling. MANGLED_NAME is a NUL-terminated character string - containing the name to be demangled. - - OUTPUT_BUFFER is a region of memory, allocated with malloc, of - *LENGTH bytes, into which the demangled name is stored. If - OUTPUT_BUFFER is not long enough, it is expanded using realloc. - OUTPUT_BUFFER may instead be NULL; in that case, the demangled name - is placed in a region of memory allocated with malloc. - - If LENGTH is non-NULL, the length of the buffer conaining the - demangled name, is placed in *LENGTH. - - The return value is a pointer to the start of the NUL-terminated - demangled name, or NULL if the demangling fails. The caller is - responsible for deallocating this memory using free. - - *STATUS is set to one of the following values: - 0: The demangling operation succeeded. - -1: A memory allocation failiure occurred. - -2: MANGLED_NAME is not a valid name under the C++ ABI mangling rules. - -3: One of the arguments is invalid. - - The demagling is performed using the C++ ABI mangling rules, with - GNU extensions. */ - -char * -__cxa_demangle (mangled_name, output_buffer, length, status) - const char *mangled_name; - char *output_buffer; - size_t *length; - int *status; -{ - struct dyn_string demangled_name; - status_t result; - - if (status == NULL) - return NULL; - - if (mangled_name == NULL) { - *status = -3; - return NULL; - } - - /* Did the caller provide a buffer for the demangled name? */ - if (output_buffer == NULL) { - /* No; dyn_string will malloc a buffer for us. */ - if (!dyn_string_init (&demangled_name, 0)) - { - *status = -1; - return NULL; - } - } - else { - /* Yes. Check that the length was provided. */ - if (length == NULL) { - *status = -3; - return NULL; - } - /* Install the buffer into a dyn_string. */ - demangled_name.allocated = *length; - demangled_name.length = 0; - demangled_name.s = output_buffer; - } - - if (mangled_name[0] == '_' && mangled_name[1] == 'Z') - /* MANGLED_NAME apprears to be a function or variable name. - Demangle it accordingly. */ - result = cp_demangle (mangled_name, &demangled_name); - else - /* Try to demangled MANGLED_NAME as the name of a type. */ - result = cp_demangle_type (mangled_name, &demangled_name); - - if (result == STATUS_OK) - /* The demangling succeeded. */ - { - /* If LENGTH isn't NULL, store the allocated buffer length - there; the buffer may have been realloced by dyn_string - functions. */ - if (length != NULL) - *length = demangled_name.allocated; - /* The operation was a success. */ - *status = 0; - return dyn_string_buf (&demangled_name); - } - else if (result == STATUS_ALLOCATION_FAILED) - /* A call to malloc or realloc failed during the demangling - operation. */ - { - *status = -1; - return NULL; - } - else - /* The demangling failed for another reason, most probably because - MANGLED_NAME isn't a valid mangled name. */ - { - /* If the buffer containing the demangled name wasn't provided - by the caller, free it. */ - if (output_buffer == NULL) - free (dyn_string_buf (&demangled_name)); - *status = -2; - return NULL; - } -} - -#else /* !IN_LIBGCC2 */ - -/* Variant entry point for integration with the existing cplus-dem - demangler. Attempts to demangle MANGLED. If the demangling - succeeds, returns a buffer, allocated with malloc, containing the - demangled name. The caller must deallocate the buffer using free. - If the demangling failes, returns NULL. */ - -char * -cplus_demangle_new_abi (mangled) - const char* mangled; -{ - /* Create a dyn_string to hold the demangled name. */ - dyn_string_t demangled = dyn_string_new (0); - /* Attempt the demangling. */ - status_t status = cp_demangle ((char *) mangled, demangled); - if (STATUS_NO_ERROR (status)) - /* Demangling succeeded. */ - { - /* Grab the demangled result from the dyn_string. It was - allocated with malloc, so we can return it directly. */ - char *return_value = dyn_string_release (demangled); - /* Hand back the demangled name. */ - return return_value; - } - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } - else - /* Demangling failed. */ - { - dyn_string_delete (demangled); - return NULL; - } -} - -#endif /* IN_LIBGCC2 */ - -#ifdef STANDALONE_DEMANGLER - -#include "getopt.h" - -static void print_usage - PARAMS ((FILE* fp, int exit_value)); - -/* Non-zero if CHAR is a character than can occur in a mangled name. */ -#define is_mangled_char(CHAR) \ - (IS_ALPHA (CHAR) || IS_DIGIT (CHAR) || (CHAR) == '_') - -/* The name of this program, as invoked. */ -const char* program_name; - -/* Prints usage summary to FP and then exits with EXIT_VALUE. */ - -static void -print_usage (fp, exit_value) - FILE* fp; - int exit_value; -{ - fprintf (fp, "Usage: %s [options] [names ...]\n", program_name); - fprintf (fp, "Options:\n", program_name); - fprintf (fp, " -h,--help Display this message.\n"); - fprintf (fp, " -s,--strict Demangle standard names only.\n"); - fprintf (fp, " -v,--verbose Produce verbose demanglings.\n"); - fprintf (fp, "If names are provided, they are demangled. Otherwise filters standard input.\n"); - - exit (exit_value); -} - -/* Option specification for getopt_long. */ -static struct option long_options[] = -{ - { "help", no_argument, NULL, 'h' }, - { "strict", no_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { NULL, no_argument, NULL, 0 }, -}; - -/* Main entry for a demangling filter executable. It will demangle - its command line arguments, if any. If none are provided, it will - filter stdin to stdout, replacing any recognized mangled C++ names - with their demangled equivalents. */ - -int -main (argc, argv) - int argc; - char *argv[]; -{ - status_t status; - int i; - int opt_char; - - /* Use the program name of this program, as invoked. */ - program_name = argv[0]; - - /* Parse options. */ - do - { - opt_char = getopt_long (argc, argv, "hsv", long_options, NULL); - switch (opt_char) - { - case '?': /* Unrecognized option. */ - print_usage (stderr, 1); - break; - - case 'h': - print_usage (stdout, 0); - break; - - case 's': - flag_strict = 1; - break; - - case 'v': - flag_verbose = 1; - break; - } - } - while (opt_char != -1); - - if (optind == argc) - /* No command line arguments were provided. Filter stdin. */ - { - dyn_string_t mangled = dyn_string_new (3); - dyn_string_t demangled = dyn_string_new (0); - status_t status; - - /* Read all of input. */ - while (!feof (stdin)) - { - char c = getchar (); - - /* The first character of a mangled name is an underscore. */ - if (feof (stdin)) - break; - if (c != '_') - { - /* It's not a mangled name. Print the character and go - on. */ - putchar (c); - continue; - } - c = getchar (); - - /* The second character of a mangled name is a capital `Z'. */ - if (feof (stdin)) - break; - if (c != 'Z') - { - /* It's not a mangled name. Print the previous - underscore, the `Z', and go on. */ - putchar ('_'); - putchar (c); - continue; - } - - /* Start keeping track of the candidate mangled name. */ - dyn_string_append_char (mangled, '_'); - dyn_string_append_char (mangled, 'Z'); - - /* Pile characters into mangled until we hit one that can't - occur in a mangled name. */ - c = getchar (); - while (!feof (stdin) && is_mangled_char (c)) - { - dyn_string_append_char (mangled, c); - if (feof (stdin)) - break; - c = getchar (); - } - - /* Attempt to demangle the name. */ - status = cp_demangle (dyn_string_buf (mangled), demangled); - - /* If the demangling succeeded, great! Print out the - demangled version. */ - if (STATUS_NO_ERROR (status)) - fputs (dyn_string_buf (demangled), stdout); - /* Abort on allocation failures. */ - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocation failed.\n"); - abort (); - } - /* Otherwise, it might not have been a mangled name. Just - print out the original text. */ - else - fputs (dyn_string_buf (mangled), stdout); - - /* If we haven't hit EOF yet, we've read one character that - can't occur in a mangled name, so print it out. */ - if (!feof (stdin)) - putchar (c); - - /* Clear the candidate mangled name, to start afresh next - time we hit a `_Z'. */ - dyn_string_clear (mangled); - } - - dyn_string_delete (mangled); - dyn_string_delete (demangled); - } - else - /* Demangle command line arguments. */ - { - dyn_string_t result = dyn_string_new (0); - - /* Loop over command line arguments. */ - for (i = optind; i < argc; ++i) - { - /* Attempt to demangle. */ - status = cp_demangle (argv[i], result); - - /* If it worked, print the demangled name. */ - if (STATUS_NO_ERROR (status)) - printf ("%s\n", dyn_string_buf (result)); - /* Abort on allocaiton failures. */ - else if (status == STATUS_ALLOCATION_FAILED) - { - fprintf (stderr, "Memory allocaiton failed.\n"); - abort (); - } - /* If not, print the error message to stderr instead. */ - else - fprintf (stderr, "%s\n", status); - } - dyn_string_delete (result); - } - - return 0; -} - -#endif /* STANDALONE_DEMANGLER */ diff --git a/contrib/binutils/libiberty/dyn-string.c b/contrib/binutils/libiberty/dyn-string.c deleted file mode 100644 index 69897f84c5e61..0000000000000 --- a/contrib/binutils/libiberty/dyn-string.c +++ /dev/null @@ -1,409 +0,0 @@ -/* An abstract string datatype. - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - Contributed by Mark Mitchell (mark@markmitchell.com). - -This file is part of GNU CC. - -GNU CC 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, or (at your option) -any later version. - -GNU CC 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 CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> - -#ifdef HAVE_STRING_H -#include <string.h> -#endif - -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -#include "libiberty.h" -#include "dyn-string.h" - -/* If this file is being compiled for inclusion in the C++ runtime - library, as part of the demangler implementation, we don't want to - abort if an allocation fails. Instead, percolate an error code up - through the call chain. */ - -#ifdef IN_LIBGCC2 -#define RETURN_ON_ALLOCATION_FAILURE -#endif - -/* Performs in-place initialization of a dyn_string struct. This - function can be used with a dyn_string struct on the stack or - embedded in another object. The contents of of the string itself - are still dynamically allocated. The string initially is capable - of holding at least SPACE characeters, including the terminating - NUL. If SPACE is 0, it will silently be increated to 1. - - If RETURN_ON_ALLOCATION_FAILURE is defined and memory allocation - fails, returns 0. Otherwise returns 1. */ - -int -dyn_string_init (ds_struct_ptr, space) - struct dyn_string *ds_struct_ptr; - int space; -{ - /* We need at least one byte in which to store the terminating NUL. */ - if (space == 0) - space = 1; - -#ifdef RETURN_ON_ALLOCATION_FAILURE - ds_struct_ptr->s = (char *) malloc (space); - if (ds_struct_ptr->s == NULL) - return 0; -#else - ds_struct_ptr->s = (char *) xmalloc (space); -#endif - ds_struct_ptr->allocated = space; - ds_struct_ptr->length = 0; - ds_struct_ptr->s[0] = '\0'; - - return 1; -} - -/* Create a new dynamic string capable of holding at least SPACE - characters, including the terminating NUL. If SPACE is 0, it will - be silently increased to 1. If RETURN_ON_ALLOCATION_FAILURE is - defined and memory allocation fails, returns NULL. Otherwise - returns the newly allocated string. */ - -dyn_string_t -dyn_string_new (space) - int space; -{ - dyn_string_t result; -#ifdef RETURN_ON_ALLOCATION_FAILURE - result = (dyn_string_t) malloc (sizeof (struct dyn_string)); - if (result == NULL) - return NULL; - if (!dyn_string_init (result, space)) - { - free (result); - return NULL; - } -#else - result = (dyn_string_t) xmalloc (sizeof (struct dyn_string)); - dyn_string_init (result, space); -#endif - return result; -} - -/* Free the memory used by DS. */ - -void -dyn_string_delete (ds) - dyn_string_t ds; -{ - free (ds->s); - free (ds); -} - -/* Returns the contents of DS in a buffer allocated with malloc. It - is the caller's responsibility to deallocate the buffer using free. - DS is then set to the empty string. Deletes DS itself. */ - -char* -dyn_string_release (ds) - dyn_string_t ds; -{ - /* Store the old buffer. */ - char* result = ds->s; - /* The buffer is no longer owned by DS. */ - ds->s = NULL; - /* Delete DS. */ - free (ds); - /* Return the old buffer. */ - return result; -} - -/* Increase the capacity of DS so it can hold at least SPACE - characters, plus the terminating NUL. This function will not (at - present) reduce the capacity of DS. Returns DS on success. - - If RETURN_ON_ALLOCATION_FAILURE is defined and a memory allocation - operation fails, deletes DS and returns NULL. */ - -dyn_string_t -dyn_string_resize (ds, space) - dyn_string_t ds; - int space; -{ - int new_allocated = ds->allocated; - - /* Increase SPACE to hold the NUL termination. */ - ++space; - - /* Increase allocation by factors of two. */ - while (space > new_allocated) - new_allocated *= 2; - - if (new_allocated != ds->allocated) - { - ds->allocated = new_allocated; - /* We actually need more space. */ -#ifdef RETURN_ON_ALLOCATION_FAILURE - ds->s = (char *) realloc (ds->s, ds->allocated); - if (ds->s == NULL) - { - free (ds); - return NULL; - } -#else - ds->s = (char *) xrealloc (ds->s, ds->allocated); -#endif - } - - return ds; -} - -/* Sets the contents of DS to the empty string. */ - -void -dyn_string_clear (ds) - dyn_string_t ds; -{ - /* A dyn_string always has room for at least the NUL terminator. */ - ds->s[0] = '\0'; - ds->length = 0; -} - -/* Makes the contents of DEST the same as the contents of SRC. DEST - and SRC must be distinct. Returns 1 on success. On failure, if - RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ - -int -dyn_string_copy (dest, src) - dyn_string_t dest; - dyn_string_t src; -{ - if (dest == src) - abort (); - - /* Make room in DEST. */ - if (dyn_string_resize (dest, src->length) == NULL) - return 0; - /* Copy DEST into SRC. */ - strcpy (dest->s, src->s); - /* Update the size of DEST. */ - dest->length = src->length; - return 1; -} - -/* Copies SRC, a NUL-terminated string, into DEST. Returns 1 on - success. On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST - and returns 0. */ - -int -dyn_string_copy_cstr (dest, src) - dyn_string_t dest; - const char *src; -{ - int length = strlen (src); - /* Make room in DEST. */ - if (dyn_string_resize (dest, length) == NULL) - return 0; - /* Copy DEST into SRC. */ - strcpy (dest->s, src); - /* Update the size of DEST. */ - dest->length = length; - return 1; -} - -/* Inserts SRC at the beginning of DEST. DEST is expanded as - necessary. SRC and DEST must be distinct. Returns 1 on success. - On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and - returns 0. */ - -int -dyn_string_prepend (dest, src) - dyn_string_t dest; - dyn_string_t src; -{ - return dyn_string_insert (dest, 0, src); -} - -/* Inserts SRC, a NUL-terminated string, at the beginning of DEST. - DEST is expanded as necessary. Returns 1 on success. On failure, - if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ - -int -dyn_string_prepend_cstr (dest, src) - dyn_string_t dest; - const char *src; -{ - return dyn_string_insert_cstr (dest, 0, src); -} - -/* Inserts SRC into DEST starting at position POS. DEST is expanded - as necessary. SRC and DEST must be distinct. Returns 1 on - success. On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST - and returns 0. */ - -int -dyn_string_insert (dest, pos, src) - dyn_string_t dest; - int pos; - dyn_string_t src; -{ - int i; - - if (src == dest) - abort (); - - if (dyn_string_resize (dest, dest->length + src->length) == NULL) - return 0; - /* Make room for the insertion. Be sure to copy the NUL. */ - for (i = dest->length; i >= pos; --i) - dest->s[i + src->length] = dest->s[i]; - /* Splice in the new stuff. */ - strncpy (dest->s + pos, src->s, src->length); - /* Compute the new length. */ - dest->length += src->length; - return 1; -} - -/* Inserts SRC, a NUL-terminated string, into DEST starting at - position POS. DEST is expanded as necessary. Returns 1 on - success. On failure, RETURN_ON_ALLOCATION_FAILURE, deletes DEST - and returns 0. */ - -int -dyn_string_insert_cstr (dest, pos, src) - dyn_string_t dest; - int pos; - const char *src; -{ - int i; - int length = strlen (src); - - if (dyn_string_resize (dest, dest->length + length) == NULL) - return 0; - /* Make room for the insertion. Be sure to copy the NUL. */ - for (i = dest->length; i >= pos; --i) - dest->s[i + length] = dest->s[i]; - /* Splice in the new stuff. */ - strncpy (dest->s + pos, src, length); - /* Compute the new length. */ - dest->length += length; - return 1; -} - -/* Append S to DS, resizing DS if necessary. Returns 1 on success. - On failure, if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and - returns 0. */ - -int -dyn_string_append (dest, s) - dyn_string_t dest; - dyn_string_t s; -{ - if (dyn_string_resize (dest, dest->length + s->length) == 0) - return 0; - strcpy (dest->s + dest->length, s->s); - dest->length += s->length; - return 1; -} - -/* Append the NUL-terminated string S to DS, resizing DS if necessary. - Returns 1 on success. On failure, if RETURN_ON_ALLOCATION_FAILURE, - deletes DEST and returns 0. */ - -int -dyn_string_append_cstr (dest, s) - dyn_string_t dest; - const char *s; -{ - int len = strlen (s); - - /* The new length is the old length plus the size of our string, plus - one for the null at the end. */ - if (dyn_string_resize (dest, dest->length + len) == NULL) - return 0; - strcpy (dest->s + dest->length, s); - dest->length += len; - return 1; -} - -/* Appends C to the end of DEST. Returns 1 on success. On failiure, - if RETURN_ON_ALLOCATION_FAILURE, deletes DEST and returns 0. */ - -int -dyn_string_append_char (dest, c) - dyn_string_t dest; - int c; -{ - /* Make room for the extra character. */ - if (dyn_string_resize (dest, dest->length + 1) == NULL) - return 0; - /* Append the character; it will overwrite the old NUL. */ - dest->s[dest->length] = c; - /* Add a new NUL at the end. */ - dest->s[dest->length + 1] = '\0'; - /* Update the length. */ - ++(dest->length); - return 1; -} - -/* Sets the contents of DEST to the substring of SRC starting at START - and ending before END. START must be less than or equal to END, - and both must be between zero and the length of SRC, inclusive. - Returns 1 on success. On failure, if RETURN_ON_ALLOCATION_FAILURE, - deletes DEST and returns 0. */ - -int -dyn_string_substring (dest, src, start, end) - dyn_string_t dest; - dyn_string_t src; - int start; - int end; -{ - int i; - int length = end - start; - - if (start > end || start > src->length || end > src->length) - abort (); - - /* Make room for the substring. */ - if (dyn_string_resize (dest, length) == NULL) - return 0; - /* Copy the characters in the substring, */ - for (i = length; --i >= 0; ) - dest->s[i] = src->s[start + i]; - /* NUL-terimate the result. */ - dest->s[length] = '\0'; - /* Record the length of the substring. */ - dest->length = length; - - return 1; -} - -/* Returns non-zero if DS1 and DS2 have the same contents. */ - -int -dyn_string_eq (ds1, ds2) - dyn_string_t ds1; - dyn_string_t ds2; -{ - /* If DS1 and DS2 have different lengths, they must not be the same. */ - if (ds1->length != ds2->length) - return 0; - else - return !strcmp (ds1->s, ds2->s); -} diff --git a/contrib/file/Header b/contrib/file/Header deleted file mode 100644 index 3ca9b0eb2cc74..0000000000000 --- a/contrib/file/Header +++ /dev/null @@ -1,5 +0,0 @@ -# Magic -# Magic data for file(1) command. -# Machine-generated from src/cmd/file/magdir/*; edit there only! -# Format is described in magic(files), where: -# files is 5 on V7 and BSD, 4 on SV, and ?? in the SVID. diff --git a/contrib/file/LEGAL.NOTICE b/contrib/file/LEGAL.NOTICE deleted file mode 100644 index 72cc535f363b7..0000000000000 --- a/contrib/file/LEGAL.NOTICE +++ /dev/null @@ -1,34 +0,0 @@ -$Id: LEGAL.NOTICE,v 1.11 1999/01/14 16:30:12 christos Exp $ -Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995. -Software written by Ian F. Darwin and others; -maintained 1994-1999 Christos Zoulas. - -This software is not subject to any export provision of the United States -Department of Commerce, and may be exported to any country or planet. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice immediately at the beginning of the file, without modification, - this list of conditions, and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. All advertising materials mentioning features or use of this software - must display the following acknowledgement: - This product includes software developed by Ian F. Darwin and others. -4. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -SUCH DAMAGE. diff --git a/contrib/file/Localstuff b/contrib/file/Localstuff deleted file mode 100644 index 3c2fa0ef777f3..0000000000000 --- a/contrib/file/Localstuff +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# Localstuff: file(1) magic for locally observed files -# -# $Id: Localstuff,v 1.3 1995/01/21 21:09:00 christos Exp $ -# Add any locally observed files here. Remember: -# text if readable, executable if runnable binary, data if unreadable. diff --git a/contrib/file/MAINT b/contrib/file/MAINT deleted file mode 100644 index 5a8768390a96b..0000000000000 --- a/contrib/file/MAINT +++ /dev/null @@ -1,33 +0,0 @@ -$Id: MAINT,v 1.4 2000/04/11 02:43:51 christos Exp $ - -Maintenance notes: - -I am continuing to maintain the file command. I welcome your help, -but to make my life easier I'd like to request the following: - -- Don't change the version numbers! - -If your changes are extensive, I will have to work hard to -integrate them into my version. If you check it into SCCS locally, -the version numbers will likely be kept. IF you check it into RCS -or CVS locally, please use -k to keep the version numbers, and -please use branch deltas (1.21.1, 1.21.2, ...). If you don't do -this, I will likely be unable to use your changes; life's just too -short. - -- Do not distribute changed versions. - -People trying to be helpful occasionally put up their hacked versions -of the file command for FTP, then the "archie" server finds and publishes -the hacked version, and people all over the world get copies of it. -Within a day or two I am getting email from around the world -asking me why "my" file command won't compile!!! Needless to say this -detracts from the limited time I have available to work on the actual -software. Therefore I ask you again to please NOT distribute -your changed version. - - -Thank you for your assistance and cooperation. - -Christos Zoulas -christos@astron.com diff --git a/contrib/file/Magdir/adventure b/contrib/file/Magdir/adventure deleted file mode 100644 index 38a5e33a3a2a9..0000000000000 --- a/contrib/file/Magdir/adventure +++ /dev/null @@ -1,39 +0,0 @@ - -#------------------------------------------------------------------------------ -# adventure: file(1) magic for Adventure game files -# -# from Allen Garvin <earendil@faeryland.tamu-commerce.edu> -# Edited by Dave Chapeskie <dchapes@ddm.on.ca> Jun 28, 1998 -# -# ALAN -# I assume there are other, lower versions, but these are the only ones I -# saw in the archive. -0 beshort 0x0206 ALAN text adventure code data ->2 byte <10 version 2.6%d - -# Conflicts with too much other stuff! -# Infocom -# (Note: to avoid false matches Z-machine version 1 and 2 are not -# recognized since only the oldest Zork I and II used them. Similarly -# there are 4 Infocom games that use verion 4 that are not recognized.) -#0 byte 3 Infocom game data (Z-machine 3, -#>2 beshort <0x7fff Release %3d, -#>26 beshort >0 Size %d*2 -#>18 string >\0 Serial %.6s) -#0 byte 5 Infocom game data (Z-machine 5, -#>2 beshort <0x7fff Release %3d, -#>26 beshort >0 Size %d*4 -#>18 string >\0 Serial %.6s) -#0 byte 6 Infocom game data (Z-machine 6, -#>2 beshort <0x7fff Release %3d, -#>26 beshort >0 Size %d*8 -#>18 string >\0 Serial %.6s) -#0 byte 8 Infocom game data (Z-machine 8, -#>2 beshort <0x7fff Release %3d, -#>26 beshort >0 Size %d*8 -#>18 string >\0 Serial %.6s) - -# TADS (Text Adventure Development System) -0 string TADS TADS game data ->13 string >\0 (ver. %.6s, ->22 string >\0 date %s) diff --git a/contrib/file/Magdir/allegro b/contrib/file/Magdir/allegro deleted file mode 100644 index 41f4ad6cd236b..0000000000000 --- a/contrib/file/Magdir/allegro +++ /dev/null @@ -1,7 +0,0 @@ -#------------------------------------------------------------------------------ -# allegro: file(1) magic for Allegro datafiles -# Toby Deshane <hac@shoelace.digivill.net> -# -0 belong 0x736C6821 Allegro datafile (packed) -0 belong 0x736C682E Allegro datafile (not packed/autodetect) -0 belong 0x736C682B Allegro datafile (appended exe data) diff --git a/contrib/file/Magdir/alliant b/contrib/file/Magdir/alliant deleted file mode 100644 index 69cf4b44d7422..0000000000000 --- a/contrib/file/Magdir/alliant +++ /dev/null @@ -1,17 +0,0 @@ - -#------------------------------------------------------------------------------ -# alliant: file(1) magic for Alliant FX series a.out files -# -# If the FX series is the one that had a processor with a 68K-derived -# instruction set, the "short" should probably become "beshort" and the -# "long" should probably become "belong". -# If it's the i860-based one, they should probably become either the -# big-endian or little-endian versions, depending on the mode they ran -# the 860 in.... -# -0 short 0420 0420 Alliant virtual executable ->2 short &0x0020 common library ->16 long >0 not stripped -0 short 0421 0421 Alliant compact executable ->2 short &0x0020 common library ->16 long >0 not stripped diff --git a/contrib/file/Magdir/alpha b/contrib/file/Magdir/alpha deleted file mode 100644 index c0191fb931e4e..0000000000000 --- a/contrib/file/Magdir/alpha +++ /dev/null @@ -1,30 +0,0 @@ -#------------------------------------------------------------------------------ -# alpha architecture description -# - -0 leshort 0603 COFF format alpha ->22 leshort&030000 !020000 executable ->24 leshort 0410 pure ->24 leshort 0413 paged ->22 leshort&020000 !0 dynamically linked ->16 lelong !0 not stripped ->16 lelong 0 stripped ->22 leshort&030000 020000 shared library ->24 leshort 0407 object ->27 byte x - version %d ->26 byte x .%d ->28 byte x -%d - -# Basic recognition of Digital UNIX core dumps - Mike Bremford <mike@opac.bl.uk> -# -# The actual magic number is just "Core", followed by a 2-byte version -# number; however, treating any file that begins with "Core" as a Digital -# UNIX core dump file may produce too many false hits, so we include one -# byte of the version number as well; DU 5.0 appears only to be up to -# version 2. -# -0 string Core\001 Alpha COFF format core dump (Digital UNIX) ->24 string >\0 \b, from '%s' -0 string Core\002 Alpha COFF format core dump (Digital UNIX) ->24 string >\0 \b, from '%s' - diff --git a/contrib/file/Magdir/amanda b/contrib/file/Magdir/amanda deleted file mode 100644 index 2b9565083ee0f..0000000000000 --- a/contrib/file/Magdir/amanda +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# amanda: file(1) magic for amanda file format -# -0 string AMANDA:\ AMANDA ->8 string TAPESTART\ DATE tape header file, ->>23 string X ->>>25 string >\ Unused %s ->>23 string >\ DATE %s ->8 string FILE\ dump file, ->>13 string >\ DATE %s diff --git a/contrib/file/Magdir/amigaos b/contrib/file/Magdir/amigaos deleted file mode 100644 index 6073936e17bd1..0000000000000 --- a/contrib/file/Magdir/amigaos +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# amigaos: file(1) magic for AmigaOS binary formats: - -# -# From ignatios@cs.uni-bonn.de (Ignatios Souvatzis) -# Some formats are still missing: AmigaOS special IFF's, e.g.: FORM....CTLG -# (the others should be seperate, anyway) -# -0 belong 0x000003f3 AmigaOS loadseg()ble executable/binary -0 belong 0x000003e7 AmigaOS object/library data diff --git a/contrib/file/Magdir/animation b/contrib/file/Magdir/animation deleted file mode 100644 index de0bf518286d3..0000000000000 --- a/contrib/file/Magdir/animation +++ /dev/null @@ -1,142 +0,0 @@ - -#------------------------------------------------------------------------------ -# animation: file(1) magic for animation/movie formats -# -# animation formats -# MPEG, FLI, DL originally from vax@ccwf.cc.utexas.edu (VaX#n8) -# FLC, SGI, Apple originally from Daniel Quinlan (quinlan@yggdrasil.com) - -# MPEG animation format -0 belong 0x000001b3 MPEG video stream data -#>4 beshort&0xfff0 x (%d x -#>5 beshort&0x0fff x %d) -0 belong 0x000001ba MPEG system stream data - -# MPEG Audio (*.mpx) -# from dreesen@math.fu-berlin.de - -# XXX -# This conflicts with the FF FE signature for UTF-16-encoded Unicode -# text, which will be identified as an MP3 file. I don't have any MP3s -# so I don't know how to (or even if it's possible to) change this to -# tell the two apart. enf@pobox.com - -0 beshort &0xfff0 MP -# MPEG 1.0 ->1 byte&0x08 =0x08 \b -# Layer 3 ->>1 byte &0x02 \b3 ->>>2 byte&0xf0 =0x10 \b, 32 kBits ->>>2 byte&0xf0 =0x20 \b, 40 kBits ->>>2 byte&0xf0 =0x30 \b, 48 kBits ->>>2 byte&0xf0 =0x40 \b, 56 kBits ->>>2 byte&0xf0 =0x50 \b, 64 kBits ->>>2 byte&0xf0 =0x60 \b, 80 kBits ->>>2 byte&0xf0 =0x70 \b, 96 kBits ->>>2 byte&0xf0 =0x80 \b, 112 kBits ->>>2 byte&0xf0 =0x90 \b, 128 kBits ->>>2 byte&0xf0 =0xA0 \b, 160 kBits ->>>2 byte&0xf0 =0xB0 \b, 192 kBits ->>>2 byte&0xf0 =0xC0 \b, 224 kBits ->>>2 byte&0xf0 =0xD0 \b, 256 kBits ->>>2 byte&0xf0 =0xE0 \b, 320 kBits -# Layer 2 ->>1 byte &0x04 \b2 ->>>2 byte&0xf0 =0x10 \b, 32 kBits ->>>2 byte&0xf0 =0x20 \b, 48 kBits ->>>2 byte&0xf0 =0x30 \b, 56 kBits ->>>2 byte&0xf0 =0x40 \b, 64 kBits ->>>2 byte&0xf0 =0x50 \b, 80 kBits ->>>2 byte&0xf0 =0x60 \b, 96 kBits ->>>2 byte&0xf0 =0x70 \b, 112 kBits ->>>2 byte&0xf0 =0x80 \b, 128 kBits ->>>2 byte&0xf0 =0x90 \b, 160 kBits ->>>2 byte&0xf0 =0xA0 \b, 192 kBits ->>>2 byte&0xf0 =0xB0 \b, 224 kBits ->>>2 byte&0xf0 =0xC0 \b, 256 kBits ->>>2 byte&0xf0 =0xD0 \b, 320 kBits ->>>2 byte&0xf0 =0xE0 \b, 384 kBits -# freq ->>2 byte&0x0C =0x00 \b, 44.1 kHz ->>2 byte&0x0C =0x04 \b, 48 kHz ->>2 byte&0x0C =0x08 \b, 32 kHz -# MPEG 2.0 ->1 byte&0x08 =0x00 \b -# Layer 3 ->>1 byte &0x02 \b3 -# Layer 2 ->>1 byte &0x04 \b2 ->>2 byte&0xf0 =0x10 \b, 8 kBits ->>2 byte&0xf0 =0x20 \b, 16 kBits ->>2 byte&0xf0 =0x30 \b, 24 kBits ->>2 byte&0xf0 =0x40 \b, 32 kBits ->>2 byte&0xf0 =0x50 \b, 40 kBits ->>2 byte&0xf0 =0x60 \b, 48 kBits ->>2 byte&0xf0 =0x70 \b, 56 kBits ->>2 byte&0xf0 =0x80 \b, 64 kBits ->>2 byte&0xf0 =0x90 \b, 80 kBits ->>2 byte&0xf0 =0xA0 \b, 96 kBits ->>2 byte&0xf0 =0xB0 \b, 112 kBits ->>2 byte&0xf0 =0xC0 \b, 128 kBits ->>2 byte&0xf0 =0xD0 \b, 144 kBits ->>2 byte&0xf0 =0xE0 \b, 160 kBits -# freq ->>2 byte&0x0C =0x00 \b, 22.05 kHz ->>2 byte&0x0C =0x04 \b, 24 kHz ->>2 byte&0x0C =0x08 \b, 16 kHz -# misc ->3 byte&0xC0 =0x00 \b, Stereo ->3 byte&0xC0 =0x40 \b, JStereo ->3 byte&0xC0 =0x80 \b, Dual-Ch ->3 byte&0xC0 =0xC0 \b, Mono -#>1 byte&0x01 =0x00 \b, Error Protection -#>2 byte&0x02 =0x02 \b, Padding -#>2 byte&0x01 =0x01 \b, Private -#>3 byte&0x08 =0x08 \b, Copyright -#>3 byte&0x04 =0x04 \b, Original -#>3 byte&0x03 1 \b, Emphasis 5 -#>3 byte&0x03 3 \b, Emphasis c - -# FLI animation format -4 leshort 0xAF11 FLI file ->6 leshort x - %d frames, ->8 leshort x width=%d pixels, ->10 leshort x height=%d pixels, ->12 leshort x depth=%d, ->16 leshort x ticks/frame=%d -# FLC animation format -4 leshort 0xAF12 FLC file ->6 leshort x - %d frames ->8 leshort x width=%d pixels, ->10 leshort x height=%d pixels, ->12 leshort x depth=%d, ->16 leshort x ticks/frame=%d - -# DL animation format -# XXX - collision with most `mips' magic -# -# I couldn't find a real magic number for these, however, this -# -appears- to work. Note that it might catch other files, too, so be -# careful! -# -# Note that title and author appear in the two 20-byte chunks -# at decimal offsets 2 and 22, respectively, but they are XOR'ed with -# 255 (hex FF)! The DL format is really bad. -# -#0 byte 1 DL version 1, medium format (160x100, 4 images/screen) -#>42 byte x - %d screens, -#>43 byte x %d commands -#0 byte 2 DL version 2 -#>1 byte 1 - large format (320x200,1 image/screen), -#>1 byte 2 - medium format (160x100,4 images/screen), -#>1 byte >2 - unknown format, -#>42 byte x %d screens, -#>43 byte x %d commands -# Based on empirical evidence, DL version 3 have several nulls following the -# \003. Most of them start with non-null values at hex offset 0x34 or so. -#0 string \3\0\0\0\0\0\0\0\0\0\0\0 DL version 3 - -# SGI and Apple formats -0 string MOVI Silicon Graphics movie file -4 string moov Apple QuickTime movie file (moov) -4 string mdat Apple QuickTime movie file (mdat) diff --git a/contrib/file/Magdir/apl b/contrib/file/Magdir/apl deleted file mode 100644 index 040043191938d..0000000000000 --- a/contrib/file/Magdir/apl +++ /dev/null @@ -1,6 +0,0 @@ - -#------------------------------------------------------------------------------ -# apl: file(1) magic for APL (see also "pdp" and "vax" for other APL -# workspaces) -# -0 long 0100554 APL workspace (Ken's original?) diff --git a/contrib/file/Magdir/apple b/contrib/file/Magdir/apple deleted file mode 100644 index 35dd435727d8b..0000000000000 --- a/contrib/file/Magdir/apple +++ /dev/null @@ -1,116 +0,0 @@ - -#------------------------------------------------------------------------------ -# apple: file(1) magic for Apple file formats -# -0 string FiLeStArTfIlEsTaRt binscii (apple ][) text -0 string \x0aGL Binary II (apple ][) data -0 string \x76\xff Squeezed (apple ][) data -0 string NuFile NuFile archive (apple ][) data -0 string N\xf5F\xe9l\xe5 NuFile archive (apple ][) data -0 belong 0x00051600 AppleSingle encoded Macintosh file -0 belong 0x00051607 AppleDouble encoded Macintosh file - -# magic for Newton PDA package formats -# from Ruda Moura <ruda@helllabs.org> -0 string package Newton package, ->7 byte 48 NOS 1.x, ->7 byte 49 NOS 2.x, ->12 belong &0x80000000 AutoRemove, ->12 belong &0x40000000 CopyProtect, ->12 belong &0x10000000 NoCompression, ->12 belong &0x04000000 Relocation, ->12 belong &0x02000000 UseFasterCompression, ->16 belong x version %d - -# The following entries for the Apple II are for files that have -# been transferred as raw binary data from an Apple, without having -# been encapsulated by any of the above archivers. -# -# In general, Apple II formats are hard to identify because Apple DOS -# and especially Apple ProDOS have strong typing in the file system and -# therefore programmers never felt much need to include type information -# in the files themselves. -# -# Eric Fischer <enf@pobox.com> - -# AppleWorks word processor: -# -# This matches the standard tab stops for an AppleWorks file, but if -# a file has a tab stop set in the first four columns this will fail. -# -# The "O" is really the magic number, but that's so common that it's -# necessary to check the tab stops that follow it to avoid false positives. - -4 string O==== AppleWorks word processor data ->85 byte&0x01 >0 \b, zoomed ->90 byte&0x01 >0 \b, paginated ->92 byte&0x01 >0 \b, with mail merge -#>91 byte x \b, left margin %d - -# AppleWorks database: -# -# This isn't really a magic number, but it's the closest thing to one -# that I could find. The 1 and 2 really mean "order in which you defined -# categories" and "left to right, top to bottom," respectively; the D and R -# mean that the cursor should move either down or right when you press Return. - -30 string \x01D AppleWorks database data -30 string \x02D AppleWorks database data -30 string \x01R AppleWorks database data -30 string \x02R AppleWorks database data - -# AppleWorks spreadsheet: -# -# Likewise, this isn't really meant as a magic number. The R or C means -# row- or column-order recalculation; the A or M means automatic or manual -# recalculation. - -131 string RA AppleWorks spreadsheet data -131 string RM AppleWorks spreadsheet data -131 string CA AppleWorks spreadsheet data -131 string CM AppleWorks spreadsheet data - -# Applesoft BASIC: -# -# This is incredibly sloppy, but will be true if the program was -# written at its usual memory location of 2048 and its first line -# number is less than 256. Yuck. - -0 belong&0xff00ff 0x80000 Applesoft BASIC program data -#>2 leshort x \b, first line number %d - -# ORCA/EZ assembler: -# -# This will not identify ORCA/M source files, since those have -# some sort of date code instead of the two zero bytes at 6 and 7 -# XXX Conflicts with ELF -#4 belong&0xff00ffff 0x01000000 ORCA/EZ assembler source data -#>5 byte x \b, build number %d - -# Broderbund Fantavision -# -# I don't know what these values really mean, but they seem to recur. -# Will they cause too many conflicts? - -# Probably :-) -#2 belong&0xFF00FF 0x040008 Fantavision movie data - -# Some attempts at images. -# -# These are actually just bit-for-bit dumps of the frame buffer, so -# there's really no reasonably way to distinguish them except for their -# address (if preserved) -- 8192 or 16384 -- and their length -- 8192 -# or, occasionally, 8184. -# -# Nevertheless this will manage to catch a lot of images that happen -# to have a solid-colored line at the bottom of the screen. - -8144 string \x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F Apple II image with white background -8144 string \x55\x2A\x55\x2A\x55\x2A\x55\x2A Apple II image with purple background -8144 string \x2A\x55\x2A\x55\x2A\x55\x2A\x55 Apple II image with green background -8144 string \xD5\xAA\xD5\xAA\xD5\xAA\xD5\xAA Apple II image with blue background -8144 string \xAA\xD5\xAA\xD5\xAA\xD5\xAA\xD5 Apple II image with orange background - -# Beagle Bros. Apple Mechanic fonts - -0 belong&0xFF00FFFF 0x6400D000 Apple Mechanic font diff --git a/contrib/file/Magdir/applix b/contrib/file/Magdir/applix deleted file mode 100644 index 9d348d1524509..0000000000000 --- a/contrib/file/Magdir/applix +++ /dev/null @@ -1,12 +0,0 @@ - -#------------------------------------------------------------------------------ -# applix: file(1) magic for Applixware -# From: Peter Soos <sp@osb.hu> -# -0 string *BEGIN Applixware ->7 string WORDS Words Document ->7 string GRAPHICS Graphic ->7 string RASTER Bitmap ->7 string SPREADSHEETS Spreadsheet ->7 string MACRO Macro ->7 string BUILDER Builder Object diff --git a/contrib/file/Magdir/archive b/contrib/file/Magdir/archive deleted file mode 100644 index 2c663d6f99a14..0000000000000 --- a/contrib/file/Magdir/archive +++ /dev/null @@ -1,236 +0,0 @@ - -#------------------------------------------------------------------------------ -# archive: file(1) magic for archive formats (see also "msdos" for self- -# extracting compressed archives) -# -# cpio, ar, arc, arj, hpack, lha/lharc, rar, squish, uc2, zip, zoo, etc. -# pre-POSIX "tar" archives are handled in the C code. - -# POSIX tar archives -257 string ustar\0 POSIX tar archive -257 string ustar\040\040\0 GNU tar archive - -# cpio archives -# -# Yes, the top two "cpio archive" formats *are* supposed to just be "short". -# The idea is to indicate archives produced on machines with the same -# byte order as the machine running "file" with "cpio archive", and -# to indicate archives produced on machines with the opposite byte order -# from the machine running "file" with "byte-swapped cpio archive". -# -# The SVR4 "cpio(4)" hints that there are additional formats, but they -# are defined as "short"s; I think all the new formats are -# character-header formats and thus are strings, not numbers. -0 short 070707 cpio archive -0 short 0143561 byte-swapped cpio archive -0 string 070707 ASCII cpio archive (pre-SVR4 or odc) -0 string 070701 ASCII cpio archive (SVR4 with no CRC) -0 string 070702 ASCII cpio archive (SVR4 with CRC) - -# Debian package (needs to go before regular portable archives) -# -0 string !<arch>\ndebian ->8 string debian-split part of multipart Debian package ->8 string debian-binary Debian binary package ->68 string >\n (format %s) ->136 ledate x created: %s - -# other archives -0 long 0177555 very old archive -0 short 0177555 very old PDP-11 archive -0 long 0177545 old archive -0 short 0177545 old PDP-11 archive -0 long 0100554 apl workspace -0 string =<ar> archive - -# MIPS archive (needs to go before regular portable archives) -# -0 string !<arch>\n__________E MIPS archive ->20 string U with MIPS Ucode members ->21 string L with MIPSEL members ->21 string B with MIPSEB members ->19 string L and an EL hash table ->19 string B and an EB hash table ->22 string X -- out of date - -0 string -h- Software Tools format archive text - -# -# XXX - why are there multiple <ar> thingies? Note that 0x213c6172 is -# "!<ar", so, for new-style (4.xBSD/SVR2andup) archives, we have: -# -# 0 string !<arch> current ar archive -# 0 long 0x213c6172 archive file -# -# and for SVR1 archives, we have: -# -# 0 string \<ar> System V Release 1 ar archive -# 0 string =<ar> archive -# -# XXX - did Aegis really store shared libraries, breakpointed modules, -# and absolute code program modules in the same format as new-style -# "ar" archives? -# -0 string !<arch> current ar archive ->8 string __.SYMDEF random library ->0 belong =65538 - pre SR9.5 ->0 belong =65539 - post SR9.5 ->0 beshort 2 - object archive ->0 beshort 3 - shared library module ->0 beshort 4 - debug break-pointed module ->0 beshort 5 - absolute code program module -0 string \<ar> System V Release 1 ar archive -0 string =<ar> archive -# -# XXX - from "vax", which appears to collect a bunch of byte-swapped -# thingies, to help you recognize VAX files on big-endian machines; -# with "leshort", "lelong", and "string", that's no longer necessary.... -# -0 belong 0x65ff0000 VAX 3.0 archive -0 belong 0x3c61723e VAX 5.0 archive -# -0 long 0x213c6172 archive file -0 lelong 0177555 very old VAX archive -0 leshort 0177555 very old PDP-11 archive -# -# XXX - "pdp" claims that 0177545 can have an __.SYMDEF member and thus -# be a random library (it said 0xff65 rather than 0177545). -# -0 lelong 0177545 old VAX archive ->8 string __.SYMDEF random library -0 leshort 0177545 old PDP-11 archive ->8 string __.SYMDEF random library -# -# From "pdp" (but why a 4-byte quantity?) -# -0 lelong 0x39bed PDP-11 old archive -0 lelong 0x39bee PDP-11 4.0 archive - -# ARC archiver, from Daniel Quinlan (quinlan@yggdrasil.com) -# -# The first byte is the magic (0x1a), byte 2 is the compression type for -# the first file (0x01 through 0x09), and bytes 3 to 15 are the MS-DOS -# filename of the first file (null terminated). Since some types collide -# we only test some types on basis of frequency: 0x08 (83%), 0x09 (5%), -# 0x02 (5%), 0x03 (3%), 0x04 (2%), 0x06 (2%). 0x01 collides with terminfo. -0 lelong&0x8080ffff 0x0000081a ARC archive data, dynamic LZW -0 lelong&0x8080ffff 0x0000091a ARC archive data, squashed -0 lelong&0x8080ffff 0x0000021a ARC archive data, uncompressed -0 lelong&0x8080ffff 0x0000031a ARC archive data, packed -0 lelong&0x8080ffff 0x0000041a ARC archive data, squeezed -0 lelong&0x8080ffff 0x0000061a ARC archive data, crunched - -# Acorn archive formats (Disaster prone simpleton, m91dps@ecs.ox.ac.uk) -# I can't create either SPARK or ArcFS archives so I have not tested this stuff -# [GRR: the original entries collide with ARC, above; replaced with combined -# version (not tested)] -#0 byte 0x1a RISC OS archive -#>1 string archive (ArcFS format) -0 string \032archive RISC OS archive (ArcFS format) - -# ARJ archiver (jason@jarthur.Claremont.EDU) -0 leshort 0xea60 ARJ archive data ->5 byte x \b, v%d, ->8 byte &0x04 multi-volume, ->8 byte &0x10 slash-switched, ->8 byte &0x20 backup, ->34 string x original name: %s, ->7 byte 0 os: MS-DOS ->7 byte 1 os: PRIMOS ->7 byte 2 os: Unix ->7 byte 3 os: Amiga ->7 byte 4 os: Macintosh ->7 byte 5 os: OS/2 ->7 byte 6 os: Apple ][ GS ->7 byte 7 os: Atari ST ->7 byte 8 os: NeXT ->7 byte 9 os: VAX/VMS ->3 byte >0 %d] - -# HA archiver (Greg Roelofs, newt@uchicago.edu) -# This is a really bad format. A file containing HAWAII will match this... -#0 string HA HA archive data, -#>2 leshort =1 1 file, -#>2 leshort >1 %u files, -#>4 byte&0x0f =0 first is type CPY -#>4 byte&0x0f =1 first is type ASC -#>4 byte&0x0f =2 first is type HSC -#>4 byte&0x0f =0x0e first is type DIR -#>4 byte&0x0f =0x0f first is type SPECIAL - -# HPACK archiver (Peter Gutmann, pgut1@cs.aukuni.ac.nz) -0 string HPAK HPACK archive data - -# JAM Archive volume format, by Dmitry.Kohmanyuk@UA.net -0 string \351,\001JAM\ JAM archive, ->7 string >\0 version %.4s ->0x26 byte =0x27 - ->>0x2b string >\0 label %.11s, ->>0x27 lelong x serial %08x, ->>0x36 string >\0 fstype %.8s - -# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu) -2 string -lh0- LHarc 1.x archive data [lh0] -2 string -lh1- LHarc 1.x archive data [lh1] -2 string -lz4- LHarc 1.x archive data [lz4] -2 string -lz5- LHarc 1.x archive data [lz5] -# [never seen any but the last; -lh4- reported in comp.compression:] -2 string -lzs- LHa 2.x? archive data [lzs] -2 string -lh\40- LHa 2.x? archive data [lh ] -2 string -lhd- LHa 2.x? archive data [lhd] -2 string -lh2- LHa 2.x? archive data [lh2] -2 string -lh3- LHa 2.x? archive data [lh3] -2 string -lh4- LHa (2.x) archive data [lh4] -2 string -lh5- LHa (2.x) archive data [lh5] ->20 byte x - header level %d - -# RAR archiver (Greg Roelofs, newt@uchicago.edu) -0 string Rar! RAR archive data - -# SQUISH archiver (Greg Roelofs, newt@uchicago.edu) -0 string SQSH squished archive data (Acorn RISCOS) - -# UC2 archiver (Greg Roelofs, newt@uchicago.edu) -# I can't figure out the self-extracting form of these buggers... -0 string UC2\x1a UC2 archive data - -# ZIP archives (Greg Roelofs, c/o zip-bugs@wkuvx1.wku.edu) -0 string PK\003\004 Zip archive data ->4 byte 0x09 \b, at least v0.9 to extract ->4 byte 0x0a \b, at least v1.0 to extract ->4 byte 0x0b \b, at least v1.1 to extract ->4 byte 0x14 \b, at least v2.0 to extract - -# Zoo archiver -20 lelong 0xfdc4a7dc Zoo archive data ->4 byte >48 \b, v%c. ->>6 byte >47 \b%c ->>>7 byte >47 \b%c ->32 byte >0 \b, modify: v%d ->>33 byte x \b.%d+ ->42 lelong 0xfdc4a7dc \b, ->>70 byte >0 extract: v%d ->>>71 byte x \b.%d+ - -# Shell archives -10 string #\ This\ is\ a\ shell\ archive shell archive text - -# -# LBR. NB: May conflict with the questionable -# "binary Computer Graphics Metafile" format. -# -0 string \0\ \ \ \ \ \ \ \ \ \ \ \0\0 LBR archive data -# -# PMA (CP/M derivative of LHA) -# -2 string -pm0- PMarc archive data [pm0] -2 string -pm1- PMarc archive data [pm1] -2 string -pm2- PMarc archive data [pm2] -2 string -pms- PMarc SFX archive (CP/M, DOS) -5 string -pc1- PopCom compressed executable (CP/M) - -# From rafael@icp.inpg.fr (Rafael Laboissiere) -# The Project Revision Control System (see -# http://www.XCF.Berkeley.EDU/~jmacd/prcs.html) generates a packaged project -# file which is recognized by the following entry: -0 leshort 0xeb81 PRCS packaged project diff --git a/contrib/file/Magdir/asterix b/contrib/file/Magdir/asterix deleted file mode 100644 index d89504a2407f9..0000000000000 --- a/contrib/file/Magdir/asterix +++ /dev/null @@ -1,17 +0,0 @@ - -#------------------------------------------------------------------------------ -# asterix: file(1) magic for Aster*x; SunOS 5.5.1 gave the 4-character -# strings as "long" - we assume they're just strings: -# From: guy@netapp.com (Guy Harris) -# -0 string *STA Aster*x ->7 string WORD Words Document ->7 string GRAP Graphic ->7 string SPRE Spreadsheet ->7 string MACR Macro -0 string 2278 Aster*x Version 2 ->29 byte 0x36 Words Document ->29 byte 0x35 Graphic ->29 byte 0x32 Spreadsheet ->29 byte 0x38 Macro - diff --git a/contrib/file/Magdir/att3b b/contrib/file/Magdir/att3b deleted file mode 100644 index 884ad4aa43323..0000000000000 --- a/contrib/file/Magdir/att3b +++ /dev/null @@ -1,40 +0,0 @@ - -#------------------------------------------------------------------------------ -# att3b: file(1) magic for AT&T 3B machines -# -# The `versions' should be un-commented if they work for you. -# (Was the problem just one of endianness?) -# -# 3B20 -# -# The 3B20 conflicts with SCCS. -#0 beshort 0550 3b20 COFF executable -#>12 belong >0 not stripped -#>22 beshort >0 - version %ld -#0 beshort 0551 3b20 COFF executable (TV) -#>12 belong >0 not stripped -#>22 beshort >0 - version %ld -# -# WE32K -# -0 beshort 0560 WE32000 COFF ->18 beshort ^00000020 object ->18 beshort &00000020 executable ->12 belong >0 not stripped ->18 beshort ^00010000 N/A on 3b2/300 w/paging ->18 beshort &00020000 32100 required ->18 beshort &00040000 and MAU hardware required ->20 beshort 0407 (impure) ->20 beshort 0410 (pure) ->20 beshort 0413 (demand paged) ->20 beshort 0443 (target shared library) ->22 beshort >0 - version %ld -0 beshort 0561 WE32000 COFF executable (TV) ->12 belong >0 not stripped -#>18 beshort &00020000 - 32100 required -#>18 beshort &00040000 and MAU hardware required -#>22 beshort >0 - version %ld -# -# core file for 3b2 -0 string \000\004\036\212\200 3b2 core file ->364 string >\0 of '%s' diff --git a/contrib/file/Magdir/blender b/contrib/file/Magdir/blender deleted file mode 100644 index 01d4e54f3ee72..0000000000000 --- a/contrib/file/Magdir/blender +++ /dev/null @@ -1,17 +0,0 @@ -#------------------------------------------------------------------------------ -# blender: file(1) magic for Blender 3D data files -# -# Coded by Guillermo S. Romero <gsromero@alumnos.euitt.upm.es> using the -# data from Ton Roosendaal <ton@blender.nl>. Ton or his company do not -# support the rule, so mail GSR if problems with it. Rule version: 1.1. -# You can get latest version with comments and details about the format -# at http://acd.asoc.euitt.upm.es/~gsromero/3d/blender/magic.blender - -0 string =BLENDER Blender3D, ->7 string =_ saved as 32-bits ->7 string =- saved as 64-bits ->8 string =v little endian ->8 string =V big endian ->9 byte x with version %c. ->10 byte x \b%c ->11 byte x \b%c diff --git a/contrib/file/Magdir/blit b/contrib/file/Magdir/blit deleted file mode 100644 index 7a470ed4a6692..0000000000000 --- a/contrib/file/Magdir/blit +++ /dev/null @@ -1,19 +0,0 @@ - -#------------------------------------------------------------------------------ -# blit: file(1) magic for 68K Blit stuff as seen from 680x0 machine -# -# Note that this 0407 conflicts with several other a.out formats... -# -# XXX - should this be redone with "be" and "le", so that it works on -# little-endian machines as well? If so, what's the deal with -# "VAX-order" and "VAX-order2"? -# -#0 long 0407 68K Blit (standalone) executable -#0 short 0407 VAX-order2 68K Blit (standalone) executable -0 short 03401 VAX-order 68K Blit (standalone) executable -0 long 0406 68k Blit mpx/mux executable -0 short 0406 VAX-order2 68k Blit mpx/mux executable -0 short 03001 VAX-order 68k Blit mpx/mux executable -# Need more values for WE32 DMD executables. -# Note that 0520 is the same as COFF -#0 short 0520 tty630 layers executable diff --git a/contrib/file/Magdir/bsdi b/contrib/file/Magdir/bsdi deleted file mode 100644 index ad547599ba83d..0000000000000 --- a/contrib/file/Magdir/bsdi +++ /dev/null @@ -1,41 +0,0 @@ -#------------------------------------------------------------------------------ -# bsdi: file(1) magic for BSD/OS (from BSDI) objects -# - -0 lelong 0314 386 compact demand paged pure executable ->16 lelong >0 not stripped ->32 byte 0x6a (uses shared libs) - -0 lelong 0407 386 executable ->16 lelong >0 not stripped ->32 byte 0x6a (uses shared libs) - -0 lelong 0410 386 pure executable ->16 lelong >0 not stripped ->32 byte 0x6a (uses shared libs) - -0 lelong 0413 386 demand paged pure executable ->16 lelong >0 not stripped ->32 byte 0x6a (uses shared libs) - -# same as in SunOS 4.x, except for static shared libraries -0 belong&077777777 0600413 sparc demand paged ->0 byte &0x80 ->>20 belong <4096 shared library ->>20 belong =4096 dynamically linked executable ->>20 belong >4096 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped ->36 belong 0xb4100001 (uses shared libs) - -0 belong&077777777 0600410 sparc pure ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped ->36 belong 0xb4100001 (uses shared libs) - -0 belong&077777777 0600407 sparc ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped ->36 belong 0xb4100001 (uses shared libs) diff --git a/contrib/file/Magdir/c-lang b/contrib/file/Magdir/c-lang deleted file mode 100644 index 1b0147595b7dc..0000000000000 --- a/contrib/file/Magdir/c-lang +++ /dev/null @@ -1,13 +0,0 @@ - -#------------------------------------------------------------------------------ -# c-lang: file(1) magic for C programs (or REXX) -# - -# XPM icons (Greg Roelofs, newt@uchicago.edu) -# if you uncomment "/*" for C/REXX below, also uncomment this entry -#0 string /*\ XPM\ */ X pixmap image data - -# this first will upset you if you're a PL/1 shop... -# in which case rm it; ascmagic will catch real C programs -#0 string /* C or REXX program text -0 string // C++ program text diff --git a/contrib/file/Magdir/chi b/contrib/file/Magdir/chi deleted file mode 100644 index ee450f5558815..0000000000000 --- a/contrib/file/Magdir/chi +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# chi: file(1) magic for ChiWriter files -# -0 string \\1cw\ ChiWriter file ->5 string >\0 version %s -0 string \\1cw ChiWriter file diff --git a/contrib/file/Magdir/cisco b/contrib/file/Magdir/cisco deleted file mode 100644 index 77e3efb5e39d7..0000000000000 --- a/contrib/file/Magdir/cisco +++ /dev/null @@ -1,10 +0,0 @@ -#------------------------------------------------------------------------------ -# cisco: file(1) magic for cisco Systems routers -# -# Most cisco file-formats are covered by the generic elf code -# -# Microcode files are non-ELF, 0x8501 conflicts with NetBSD/alpha. -0 belong&0xffffff00 0x85011400 cisco IOS microcode ->7 string >\0 for '%s' -0 belong&0xffffff00 0x8501cb00 cisco IOS experimental microcode ->7 string >\0 for '%s' diff --git a/contrib/file/Magdir/claris b/contrib/file/Magdir/claris deleted file mode 100644 index b18bd915d5ed6..0000000000000 --- a/contrib/file/Magdir/claris +++ /dev/null @@ -1,46 +0,0 @@ - -#------------------------------------------------------------------------------ -# claris: file(1) magic for claris -# "H. Nanosecond" <aldomel@ix.netcom.com> -# Claris Works a word processor, etc. -# Version 3.0 - -# .pct claris works clip art files -#0000000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 -#* -#0001000 #010 250 377 377 377 377 000 213 000 230 000 021 002 377 014 000 -#null to byte 1000 octal -514 string \377\377\377\377\000 Claris clip art? ->0 string \0\0\0\0\0\0\0\0\0\0\0\0\0 yes. -514 string \377\377\377\377\001 Claris clip art? ->0 string \0\0\0\0\0\0\0\0\0\0\0\0\0 yes. - -# Claris works files -# .cwk -0 string \002\000\210\003\102\117\102\117\000\001\206 Claris works document -# .plt -0 string \020\341\000\000\010\010 Claris Works pallete files .plt - -# .msp a dictionary file I am not sure about this I have only one .msp file -0 string \002\271\262\000\040\002\000\164 Claris works dictionary - -# .usp are user dictionary bits -# I am not sure about a magic header: -#0000000 001 123 160 146 070 125 104 040 136 123 015 012 160 157 144 151 -# soh S p f 8 U D sp ^ S cr nl p o d i -#0000020 141 164 162 151 163 164 040 136 123 015 012 144 151 166 040 043 -# a t r i s t sp ^ S cr nl d i v sp # - -# .mth Thesaurus -# statrts with \0 but no magic header - -# .chy Hyphenation file -# I am not sure: 000 210 034 000 000 - -# other claris files -#./windows/claris/useng.ndx: data -#./windows/claris/xtndtran.l32: data -#./windows/claris/xtndtran.lst: data -#./windows/claris/clworks.lbl: data -#./windows/claris/clworks.prf: data -#./windows/claris/userd.spl: data diff --git a/contrib/file/Magdir/clipper b/contrib/file/Magdir/clipper deleted file mode 100644 index c325cb8f7c7de..0000000000000 --- a/contrib/file/Magdir/clipper +++ /dev/null @@ -1,64 +0,0 @@ - -#------------------------------------------------------------------------------ -# clipper: file(1) magic for Intergraph (formerly Fairchild) Clipper. -# -# XXX - what byte order does the Clipper use? -# -# XXX - what's the "!" stuff: -# -# >18 short !074000,000000 C1 R1 -# >18 short !074000,004000 C2 R1 -# >18 short !074000,010000 C3 R1 -# >18 short !074000,074000 TEST -# -# I shall assume it's ANDing the field with the first value and -# comparing it with the second, and rewrite it as: -# -# >18 short&074000 000000 C1 R1 -# >18 short&074000 004000 C2 R1 -# >18 short&074000 010000 C3 R1 -# >18 short&074000 074000 TEST -# -# as SVR3.1's "file" doesn't support anything of the "!074000,000000" -# sort, nor does SunOS 4.x, so either it's something Intergraph added -# in CLIX, or something AT&T added in SVR3.2 or later, or something -# somebody else thought was a good idea; it's not documented in the -# man page for this version of "magic", nor does it appear to be -# implemented (at least not after I blew off the bogus code to turn -# old-style "&"s into new-style "&"s, which just didn't work at all). -# -0 short 0575 CLIPPER COFF executable (VAX #) ->20 short 0407 (impure) ->20 short 0410 (5.2 compatible) ->20 short 0411 (pure) ->20 short 0413 (demand paged) ->20 short 0443 (target shared library) ->12 long >0 not stripped ->22 short >0 - version %ld -0 short 0577 CLIPPER COFF executable ->18 short&074000 000000 C1 R1 ->18 short&074000 004000 C2 R1 ->18 short&074000 010000 C3 R1 ->18 short&074000 074000 TEST ->20 short 0407 (impure) ->20 short 0410 (pure) ->20 short 0411 (separate I&D) ->20 short 0413 (paged) ->20 short 0443 (target shared library) ->12 long >0 not stripped ->22 short >0 - version %ld ->48 long&01 01 alignment trap enabled ->52 byte 1 -Ctnc ->52 byte 2 -Ctsw ->52 byte 3 -Ctpw ->52 byte 4 -Ctcb ->53 byte 1 -Cdnc ->53 byte 2 -Cdsw ->53 byte 3 -Cdpw ->53 byte 4 -Cdcb ->54 byte 1 -Csnc ->54 byte 2 -Cssw ->54 byte 3 -Cspw ->54 byte 4 -Cscb -4 string pipe CLIPPER instruction trace -4 string prof CLIPPER instruction profile diff --git a/contrib/file/Magdir/commands b/contrib/file/Magdir/commands deleted file mode 100644 index 16308aa67f4f3..0000000000000 --- a/contrib/file/Magdir/commands +++ /dev/null @@ -1,62 +0,0 @@ - -#------------------------------------------------------------------------------ -# commands: file(1) magic for various shells and interpreters -# -0 string :\ shell archive or script for antique kernel text -0 string/b #!\ /bin/sh Bourne shell script text executable -0 string/b #!\ /bin/csh C shell script text executable -# korn shell magic, sent by George Wu, gwu@clyde.att.com -0 string/b #!\ /bin/ksh Korn shell script text executable -0 string/b #!\ /bin/tcsh Tenex C shell script text executable -0 string/b #!\ /usr/local/tcsh Tenex C shell script text executable -0 string/b #!\ /usr/local/bin/tcsh Tenex C shell script text executable - -# -# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson) -0 string/b #!\ /usr/local/bin/zsh Paul Falstad's zsh script text executable -0 string/b #!\ /usr/local/bin/ash Neil Brown's ash script text executable -0 string/b #!\ /usr/local/bin/ae Neil Brown's ae script text executable -0 string/b #!\ /bin/nawk new awk script text executable -0 string/b #!\ /usr/bin/nawk new awk script text executable -0 string/b #!\ /usr/local/bin/nawk new awk script text executable -0 string/b #!\ /bin/gawk GNU awk script text executable -0 string/b #!\ /usr/bin/gawk GNU awk script text executable -0 string/b #!\ /usr/local/bin/gawk GNU awk script text executable -# -0 string/b #!\ /bin/awk awk script text executable -0 string/b #!\ /usr/bin/awk awk script text executable -0 string BEGIN awk script text - -# For Larry Wall's perl language. The ``eval'' line recognizes an -# outrageously clever hack for USG systems. -# Keith Waclena <keith@cerberus.uchicago.edu> -0 string/b #!\ /bin/perl perl script text executable -0 string eval\ "exec\ /bin/perl perl script text -0 string/b #!\ /usr/bin/perl perl script text executable -0 string eval\ "exec\ /usr/bin/perl perl script text -0 string/b #!\ /usr/local/bin/perl perl script text -0 string eval\ "exec\ /usr/local/bin/perl perl script text executable - -# AT&T Bell Labs' Plan 9 shell -0 string/b #!\ /bin/rc Plan 9 rc shell script text executable - -# bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de) -0 string/b #!\ /bin/bash Bourne-Again shell script text executable -0 string/b #!\ /usr/local/bin/bash Bourne-Again shell script text executable - -# using env -0 string #!/usr/bin/env a ->15 string >\0 %s script text executable -0 string #!\ /usr/bin/env a ->16 string >\0 %s script text executable - - -# generic shell magic -0 string #!\ / a ->3 string >\0 %s script text executable -0 string #!\ / a ->3 string >\0 %s script text executable -0 string #!/ a ->2 string >\0 %s script text executable -0 string #!\ script text executable ->3 string >\0 for %s diff --git a/contrib/file/Magdir/compress b/contrib/file/Magdir/compress deleted file mode 100644 index f4fe4a47d5e0f..0000000000000 --- a/contrib/file/Magdir/compress +++ /dev/null @@ -1,146 +0,0 @@ - -#------------------------------------------------------------------------------ -# compress: file(1) magic for pure-compression formats (no archives) -# -# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc. -# -# Formats for various forms of compressed data -# Formats for "compress" proper have been moved into "compress.c", -# because it tries to uncompress it to figure out what's inside. - -# standard unix compress -0 string \037\235 compress'd data ->2 byte&0x80 >0 block compressed ->2 byte&0x1f x %d bits - -# gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver) -0 string \037\213 gzip compressed data ->2 byte <8 \b, reserved method, ->2 byte 8 \b, deflated, ->3 byte &0x01 ASCII, ->3 byte &0x02 continuation, ->3 byte &0x04 extra field, ->3 byte &0x08 original filename, ->>10 string x `%s', ->3 byte &0x10 comment, ->3 byte &0x20 encrypted, ->4 ledate x last modified: %s, ->8 byte 2 max compression, ->8 byte 4 max speed, ->9 byte =0x00 os: MS-DOS ->9 byte =0x01 os: Amiga ->9 byte =0x02 os: VMS ->9 byte =0x03 os: Unix ->9 byte =0x05 os: Atari ->9 byte =0x06 os: OS/2 ->9 byte =0x07 os: MacOS ->9 byte =0x0A os: Tops/20 ->9 byte =0x0B os: Win/32 - -# packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis -0 string \037\036 packed data ->2 belong >1 \b, %d characters originally ->2 belong =1 \b, %d character originally -# -# This magic number is byte-order-independent. XXX - Does that mean this -# is big-endian, little-endian, either, or that you can't tell? -# this short is valid for SunOS -0 short 017437 old packed data - -# XXX - why *two* entries for "compacted data", one of which is -# byte-order independent, and one of which is byte-order dependent? -# -0 short 0x1fff compacted data -# This string is valid for SunOS (BE) and a matching "short" is listed -# in the Ultrix (LE) magic file. -0 string \377\037 compacted data -0 short 0145405 huf output - -# bzip2 -0 string BZh bzip2 compressed data ->3 byte >47 \b, block size = %c00k - -# squeeze and crunch -# Michael Haardt <michael@cantor.informatik.rwth-aachen.de> -0 beshort 0x76FF squeezed data, ->4 string x original name %s -0 beshort 0x76FE crunched data, ->2 string x original name %s -0 beshort 0x76FD LZH compressed data, ->2 string x original name %s - -# Freeze -0 string \037\237 frozen file 2.1 -0 string \037\236 frozen file 1.0 (or gzip 0.5) - -# SCO compress -H (LZH) -0 string \037\240 SCO compress -H (LZH) data - -# European GSM 06.10 is a provisional standard for full-rate speech -# transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse -# excitation/long term prediction) coding at 13 kbit/s. -# -# There's only a magic nibble (4 bits); that nibble repeats every 33 -# bytes. This isn't suited for use, but maybe we can use it someday. -# -# This will cause very short GSM files to be declared as data and -# mismatches to be declared as data too! -#0 byte&0xF0 0xd0 data -#>33 byte&0xF0 0xd0 -#>66 byte&0xF0 0xd0 -#>99 byte&0xF0 0xd0 -#>132 byte&0xF0 0xd0 GSM 06.10 compressed audio - -# bzip a block-sorting file compressor -# by Julian Seward <sewardj@cs.man.ac.uk> and others -# -0 string BZ bzip compressed data ->2 byte x \b, version: %c ->3 string =1 \b, compression block size 100k ->3 string =2 \b, compression block size 200k ->3 string =3 \b, compression block size 300k ->3 string =4 \b, compression block size 400k ->3 string =5 \b, compression block size 500k ->3 string =6 \b, compression block size 600k ->3 string =7 \b, compression block size 700k ->3 string =8 \b, compression block size 800k ->3 string =9 \b, compression block size 900k - -# lzop from <markus.oberhumer@jk.uni-linz.ac.at> -0 string \x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a lzop compressed data ->9 beshort <0x0940 ->>9 byte&0xf0 =0x00 - version 0. ->>9 beshort&0x0fff x \b%03x, ->>13 byte 1 LZO1X-1, ->>13 byte 2 LZO1X-1(15), ->>13 byte 3 LZO1X-999, -## >>22 bedate >0 last modified: %s, ->>14 byte =0x00 os: MS-DOS ->>14 byte =0x01 os: Amiga ->>14 byte =0x02 os: VMS ->>14 byte =0x03 os: Unix ->>14 byte =0x05 os: Atari ->>14 byte =0x06 os: OS/2 ->>14 byte =0x07 os: MacOS ->>14 byte =0x0A os: Tops/20 ->>14 byte =0x0B os: WinNT ->>14 byte =0x0E os: Win32 ->9 beshort >0x0939 ->>9 byte&0xf0 =0x00 - version 0. ->>9 byte&0xf0 =0x10 - version 1. ->>9 byte&0xf0 =0x20 - version 2. ->>9 beshort&0x0fff x \b%03x, ->>15 byte 1 LZO1X-1, ->>15 byte 2 LZO1X-1(15), ->>15 byte 3 LZO1X-999, -## >>25 bedate >0 last modified: %s, ->>17 byte =0x00 os: MS-DOS ->>17 byte =0x01 os: Amiga ->>17 byte =0x02 os: VMS ->>17 byte =0x03 os: Unix ->>17 byte =0x05 os: Atari ->>17 byte =0x06 os: OS/2 ->>17 byte =0x07 os: MacOS ->>17 byte =0x0A os: Tops/20 ->>17 byte =0x0B os: WinNT ->>17 byte =0x0E os: Win32 diff --git a/contrib/file/Magdir/console b/contrib/file/Magdir/console deleted file mode 100644 index f8d2ebb5ae072..0000000000000 --- a/contrib/file/Magdir/console +++ /dev/null @@ -1,122 +0,0 @@ -#------------------------------------------------------------------------------ -# Console game magic -# Toby Deshane <hac@shoelace.digivill.net> -# ines: file(1) magic for Marat's iNES Nintendo Entertainment System -# ROM dump format - -0 string NES\032 iNES ROM dump, ->4 byte x %dx16k PRG ->5 byte x \b, %dx8k CHR ->6 byte&0x01 =0x1 \b, [Vert.] ->6 byte&0x01 =0x0 \b, [Horiz.] ->6 byte&0x02 =0x2 \b, [SRAM] ->6 byte&0x04 =0x4 \b, [Trainer] ->6 byte&0x04 =0x8 \b, [4-Scr] - -#------------------------------------------------------------------------------ -# gameboy: file(1) magic for the Nintendo (Color) Gameboy raw ROM format -# -0x104 belong 0xCEED6666 Gameboy ROM: ->0x134 string >\0 "%.16s" ->0x146 byte 0x03 \b,[SGB] ->0x147 byte 0x00 \b, [ROM ONLY] ->0x147 byte 0x01 \b, [ROM+MBC1] ->0x147 byte 0x02 \b, [ROM+MBC1+RAM] ->0x147 byte 0x03 \b, [ROM+MBC1+RAM+BATT] ->0x147 byte 0x05 \b, [ROM+MBC2] ->0x147 byte 0x06 \b, [ROM+MBC2+BATTERY] ->0x147 byte 0x08 \b, [ROM+RAM] ->0x147 byte 0x09 \b, [ROM+RAM+BATTERY] ->0x147 byte 0x0B \b, [ROM+MMM01] ->0x147 byte 0x0C \b, [ROM+MMM01+SRAM] ->0x147 byte 0x0D \b, [ROM+MMM01+SRAM+BATT] ->0x147 byte 0x0F \b, [ROM+MBC3+TIMER+BATT] ->0x147 byte 0x10 \b, [ROM+MBC3+TIMER+RAM+BATT] ->0x147 byte 0x11 \b, [ROM+MBC3] ->0x147 byte 0x12 \b, [ROM+MBC3+RAM] ->0x147 byte 0x13 \b, [ROM+MBC3+RAM+BATT] ->0x147 byte 0x19 \b, [ROM+MBC5] ->0x147 byte 0x1A \b, [ROM+MBC5+RAM] ->0x147 byte 0x1B \b, [ROM+MBC5+RAM+BATT] ->0x147 byte 0x1C \b, [ROM+MBC5+RUMBLE] ->0x147 byte 0x1D \b, [ROM+MBC5+RUMBLE+SRAM] ->0x147 byte 0x1E \b, [ROM+MBC5+RUMBLE+SRAM+BATT] ->0x147 byte 0x1F \b, [Pocket Camera] ->0x147 byte 0xFD \b, [Bandai TAMA5] ->0x147 byte 0xFE \b, [Hudson HuC-3] ->0x147 byte 0xFF \b, [Hudson HuC-1] - ->0x148 byte 0 \b, ROM: 256Kbit ->0x148 byte 1 \b, ROM: 512Kbit ->0x148 byte 2 \b, ROM: 1Mbit ->0x148 byte 3 \b, ROM: 2Mbit ->0x148 byte 4 \b, ROM: 4Mbit ->0x148 byte 5 \b, ROM: 8Mbit ->0x148 byte 6 \b, ROM: 16Mbit ->0x148 byte 0x52 \b, ROM: 9Mbit ->0x148 byte 0x53 \b, ROM: 10Mbit ->0x148 byte 0x54 \b, ROM: 12Mbit - ->0x149 byte 1 \b, RAM: 16Kbit ->0x149 byte 2 \b, RAM: 64Kbit ->0x149 byte 3 \b, RAM: 128Kbit ->0x149 byte 4 \b, RAM: 1Mbit - -#>0x14e long x \b, CRC: %x - -#------------------------------------------------------------------------------ -# genesis: file(1) magic for the Sega MegaDrive/Genesis raw ROM format -# -0x100 string SEGA Sega MegaDrive/Genesis raw ROM dump ->0x120 string >\0 Name: "%.16s" ->0x110 string >\0 %.16s ->0x1B0 string RA with SRAM - -#------------------------------------------------------------------------------ -# genesis: file(1) magic for the Super MegaDrive ROM dump format -# -0x280 string EAGN Super MagicDrive ROM dump ->0 byte x %dx16k blocks ->2 byte 0 \b, last in series or standalone ->2 byte >0 \b, split ROM ->8 byte 0xAA ->9 byte 0xBB - -#------------------------------------------------------------------------------ -# genesis: file(1) alternate magic for the Super MegaDrive ROM dump format -# -0x280 string EAMG Super MagicDrive ROM dump ->0 byte x %dx16k blocks ->2 byte x \b, last in series or standalone ->8 byte 0xAA ->9 byte 0xBB - -#------------------------------------------------------------------------------ -# smsgg: file(1) magic for Sega Master System and Game Gear ROM dumps -# -# Does not detect all images. Very preliminary guesswork. Need more data -# on format. -# -# FIXME: need a little more info...;P -# -#0 byte 0xF3 -#>1 byte 0xED Sega Master System/Game Gear ROM dump -#>1 byte 0x31 Sega Master System/Game Gear ROM dump -#>1 byte 0xDB Sega Master System/Game Gear ROM dump -#>1 byte 0xAF Sega Master System/Game Gear ROM dump -#>1 byte 0xC3 Sega Master System/Game Gear ROM dump - -#------------------------------------------------------------------------------ -# dreamcast: file(1) uncertain magic for the Sega Dreamcast VMU image format -# -0 belong 0x21068028 Sega Dreamcast VMU game image -0 string LCDi Dream Animator file - -#------------------------------------------------------------------------------ -# v64: file(1) uncertain magic for the V64 format N64 ROM dumps -# -0 belong 0x37804012 V64 Nintendo 64 ROM dump - -#------------------------------------------------------------------------------ -# msx: file(1) magic for MSX game cartridge dumps -0 beshort 0x4142 MSX game cartridge dump diff --git a/contrib/file/Magdir/convex b/contrib/file/Magdir/convex deleted file mode 100644 index b1235d7e79a86..0000000000000 --- a/contrib/file/Magdir/convex +++ /dev/null @@ -1,69 +0,0 @@ -#------------------------------------------------------------------------------ -# convex: file(1) magic for Convex boxes -# -# Convexes are big-endian. -# -# /*\ -# * Below are the magic numbers and tests added for Convex. -# * Added at beginning, because they are expected to be used most. -# \*/ -0 belong 0507 Convex old-style object ->16 belong >0 not stripped -0 belong 0513 Convex old-style demand paged executable ->16 belong >0 not stripped -0 belong 0515 Convex old-style pre-paged executable ->16 belong >0 not stripped -0 belong 0517 Convex old-style pre-paged, non-swapped executable ->16 belong >0 not stripped -0 belong 0x011257 Core file -# -# The following are a series of dump format magic numbers. Each one -# corresponds to a drastically different dump format. The first on is -# the original dump format on a 4.1 BSD or earlier file system. The -# second marks the change between the 4.1 file system and the 4.2 file -# system. The Third marks the changing of the block size from 1K -# to 2K to be compatible with an IDC file system. The fourth indicates -# a dump that is dependent on Convex Storage Manager, because data in -# secondary storage is not physically contained within the dump. -# The restore program uses these number to determine how the data is -# to be extracted. -# -24 belong =60011 dump format, 4.1 BSD or earlier -24 belong =60012 dump format, 4.2 or 4.3 BSD without IDC -24 belong =60013 dump format, 4.2 or 4.3 BSD (IDC compatible) -24 belong =60014 dump format, Convex Storage Manager by-reference dump -# -# what follows is a bunch of bit-mask checks on the flags field of the opthdr. -# If there is no `=' sign, assume just checking for whether the bit is set? -# -0 belong 0601 Convex SOFF ->88 belong&0x000f0000 =0x00000000 c1 ->88 belong &0x00010000 c2 ->88 belong &0x00020000 c2mp ->88 belong &0x00040000 parallel ->88 belong &0x00080000 intrinsic ->88 belong &0x00000001 demand paged ->88 belong &0x00000002 pre-paged ->88 belong &0x00000004 non-swapped ->88 belong &0x00000008 POSIX -# ->84 belong &0x80000000 executable ->84 belong &0x40000000 object ->84 belong&0x20000000 =0 not stripped ->84 belong&0x18000000 =0x00000000 native fpmode ->84 belong&0x18000000 =0x10000000 ieee fpmode ->84 belong&0x18000000 =0x18000000 undefined fpmode -# -0 belong 0605 Convex SOFF core -# -0 belong 0607 Convex SOFF checkpoint ->88 belong&0x000f0000 =0x00000000 c1 ->88 belong &0x00010000 c2 ->88 belong &0x00020000 c2mp ->88 belong &0x00040000 parallel ->88 belong &0x00080000 intrinsic ->88 belong &0x00000008 POSIX -# ->84 belong&0x18000000 =0x00000000 native fpmode ->84 belong&0x18000000 =0x10000000 ieee fpmode ->84 belong&0x18000000 =0x18000000 undefined fpmode diff --git a/contrib/file/Magdir/database b/contrib/file/Magdir/database deleted file mode 100644 index 60058a61bce24..0000000000000 --- a/contrib/file/Magdir/database +++ /dev/null @@ -1,70 +0,0 @@ - -#------------------------------------------------------------------------------ -# database: file(1) magic for various databases -# -# extracted from header/code files by Graeme Wilford (eep2gw@ee.surrey.ac.uk) -# -# -# GDBM magic numbers -# Will be maintained as part of the GDBM distribution in the future. -# <downsj@teeny.org> -0 belong 0x13579ace GNU dbm 1.x or ndbm database, big endian -0 lelong 0x13579ace GNU dbm 1.x or ndbm database, little endian -0 string GDBM GNU dbm 2.x database -# -# Berkeley DB -# -# Ian Darwin's file /etc/magic files: big/little-endian version. -# -# Hash 1.85/1.86 databases store metadata in network byte order. -# Btree 1.85/1.86 databases store the metadata in host byte order. -# Hash and Btree 2.X and later databases store the metadata in host byte order. - -0 long 0x00061561 Berkeley DB ->8 belong 4321 ->>4 belong >2 1.86 ->>4 belong <3 1.85 ->>4 belong >0 (Hash, version %d, native byte-order) ->8 belong 1234 ->>4 belong >2 1.86 ->>4 belong <3 1.85 ->>4 belong >0 (Hash, version %d, little-endian) - -0 belong 0x00061561 Berkeley DB ->8 belong 4321 ->>4 belong >2 1.86 ->>4 belong <3 1.85 ->>4 belong >0 (Hash, version %d, big-endian) ->8 belong 1234 ->>4 belong >2 1.86 ->>4 belong <3 1.85 ->>4 belong >0 (Hash, version %d, native byte-order) - -0 long 0x00053162 Berkeley DB 1.85/1.86 ->4 long >0 (Btree, version %d, native byte-order) -0 belong 0x00053162 Berkeley DB 1.85/1.86 ->4 belong >0 (Btree, version %d, big-endian) -0 lelong 0x00053162 Berkeley DB 1.85/1.86 ->4 lelong >0 (Btree, version %d, little-endian) - -12 long 0x00061561 Berkeley DB ->16 long >0 (Hash, version %d, native byte-order) -12 belong 0x00061561 Berkeley DB ->16 belong >0 (Hash, version %d, big-endian) -12 lelong 0x00061561 Berkeley DB ->16 lelong >0 (Hash, version %d, little-endian) - -12 long 0x00053162 Berkeley DB ->16 long >0 (Btree, version %d, native byte-order) -12 belong 0x00053162 Berkeley DB ->16 belong >0 (Btree, version %d, big-endian) -12 lelong 0x00053162 Berkeley DB ->16 lelong >0 (Btree, version %d, little-endian) - -12 long 0x00042253 Berkeley DB ->16 long >0 (Queue, version %d, native byte-order) -12 belong 0x00042253 Berkeley DB ->16 belong >0 (Queue, version %d, big-endian) -12 lelong 0x00042253 Berkeley DB ->16 lelong >0 (Queue, version %d, little-endian) - diff --git a/contrib/file/Magdir/diamond b/contrib/file/Magdir/diamond deleted file mode 100644 index 1abd01e0300f7..0000000000000 --- a/contrib/file/Magdir/diamond +++ /dev/null @@ -1,11 +0,0 @@ - -#------------------------------------------------------------------------------ -# diamond: file(1) magic for Diamond system -# -# ... diamond is a multi-media mail and electronic conferencing system.... -# -# XXX - I think it was either renamed Slate, or replaced by Slate.... -# -# The full deal is too long... -#0 string <list>\n<protocol\ bbn-multimedia-format> Diamond Multimedia Document -0 string =<list>\n<protocol\ bbn-m Diamond Multimedia Document diff --git a/contrib/file/Magdir/diff b/contrib/file/Magdir/diff deleted file mode 100644 index 81a9b82ab8d87..0000000000000 --- a/contrib/file/Magdir/diff +++ /dev/null @@ -1,13 +0,0 @@ - -#------------------------------------------------------------------------------ -# diff: file(1) magic for diff(1) output -# -0 string diff\ 'diff' output text -0 string ***\ 'diff' output text -0 string Only\ in\ 'diff' output text -0 string Common\ subdirectories:\ 'diff' output text - -# xdelta is like diff(1) for binary files (works for text, too). -# Available from: ftp://ftp.xcf.berkeley.edu/pub/xdelta/ -0 string %XDZ xdelta diff file ->4 string >% version %.3s diff --git a/contrib/file/Magdir/digital b/contrib/file/Magdir/digital deleted file mode 100644 index 6a573a6e05252..0000000000000 --- a/contrib/file/Magdir/digital +++ /dev/null @@ -1,41 +0,0 @@ -# Digital UNIX - Info -# -0 string !<arch>\n________64E Alpha archive ->22 string X -- out of date -# -# Alpha COFF Based Executables -# The stripped stuff really needs to be an 8 byte (64 bit) compare, -# but this works -0 leshort 0x183 COFF format alpha ->22 leshort&020000 &010000 sharable library, ->22 leshort&020000 ^010000 dynamically linked, ->24 leshort 0410 pure ->24 leshort 0413 demand paged ->8 lelong >0 executable or object module, not stripped ->8 lelong 0 ->>12 lelong 0 executable or object module, stripped ->>12 lelong >0 executable or object module, not stripped ->27 byte >0 - version %d. ->26 byte >0 %d- ->28 leshort >0 %d -# -# The next is incomplete, we could tell more about this format, -# but its not worth it. -0 leshort 0x188 Alpha compressed COFF -0 leshort 0x18f Alpha u-code object -# -# -# Some other interesting Digital formats, -0 string \377\377\177 ddis/ddif -0 string \377\377\174 ddis/dots archive -0 string \377\377\176 ddis/dtif table data -0 string \033c\033 LN03 output -0 long 04553207 X image -# -0 string !<PDF>!\n profiling data file -# -# Locale data tables (MIPS and Alpha). -# -0 short 0x0501 locale data table ->6 short 0x24 for MIPS ->6 short 0x40 for Alpha diff --git a/contrib/file/Magdir/dump b/contrib/file/Magdir/dump deleted file mode 100644 index 628ead86c6131..0000000000000 --- a/contrib/file/Magdir/dump +++ /dev/null @@ -1,81 +0,0 @@ - -#------------------------------------------------------------------------------ -# dump: file(1) magic for dump file format--for new and old dump filesystems -# -# We specify both byte orders in order to recognize byte-swapped dumps. -# -24 belong 60012 new-fs dump file (big endian), ->4 bedate x Previous dump %s, ->8 bedate x This dump %s, ->12 belong >0 Volume %ld, ->692 belong 0 Level zero, type: ->692 belong >0 Level %d, type: ->0 belong 1 tape header, ->0 belong 2 beginning of file record, ->0 belong 3 map of inodes on tape, ->0 belong 4 continuation of file record, ->0 belong 5 end of volume, ->0 belong 6 map of inodes deleted, ->0 belong 7 end of medium (for floppy), ->676 string >\0 Label %s, ->696 string >\0 Filesystem %s, ->760 string >\0 Device %s, ->824 string >\0 Host %s, ->888 belong >0 Flags %x - -24 belong 60011 old-fs dump file (big endian), -#>4 bedate x Previous dump %s, -#>8 bedate x This dump %s, ->12 belong >0 Volume %ld, ->692 belong 0 Level zero, type: ->692 belong >0 Level %d, type: ->0 belong 1 tape header, ->0 belong 2 beginning of file record, ->0 belong 3 map of inodes on tape, ->0 belong 4 continuation of file record, ->0 belong 5 end of volume, ->0 belong 6 map of inodes deleted, ->0 belong 7 end of medium (for floppy), ->676 string >\0 Label %s, ->696 string >\0 Filesystem %s, ->760 string >\0 Device %s, ->824 string >\0 Host %s, ->888 belong >0 Flags %x - -24 lelong 60012 new-fs dump file (little endian), ->4 ledate x This dump %s, ->8 ledate x Previous dump %s, ->12 lelong >0 Volume %ld, ->692 lelong 0 Level zero, type: ->692 lelong >0 Level %d, type: ->0 lelong 1 tape header, ->0 lelong 2 beginning of file record, ->0 lelong 3 map of inodes on tape, ->0 lelong 4 continuation of file record, ->0 lelong 5 end of volume, ->0 lelong 6 map of inodes deleted, ->0 lelong 7 end of medium (for floppy), ->676 string >\0 Label %s, ->696 string >\0 Filesystem %s, ->760 string >\0 Device %s, ->824 string >\0 Host %s, ->888 lelong >0 Flags %x - -24 lelong 60011 old-fs dump file (little endian), -#>4 ledate x Previous dump %s, -#>8 ledate x This dump %s, ->12 lelong >0 Volume %ld, ->692 lelong 0 Level zero, type: ->692 lelong >0 Level %d, type: ->0 lelong 1 tape header, ->0 lelong 2 beginning of file record, ->0 lelong 3 map of inodes on tape, ->0 lelong 4 continuation of file record, ->0 lelong 5 end of volume, ->0 lelong 6 map of inodes deleted, ->0 lelong 7 end of medium (for floppy), ->676 string >\0 Label %s, ->696 string >\0 Filesystem %s, ->760 string >\0 Device %s, ->824 string >\0 Host %s, ->888 lelong >0 Flags %x diff --git a/contrib/file/Magdir/encore b/contrib/file/Magdir/encore deleted file mode 100644 index 63cb5d4f9f429..0000000000000 --- a/contrib/file/Magdir/encore +++ /dev/null @@ -1,21 +0,0 @@ - -#------------------------------------------------------------------------------ -# encore: file(1) magic for Encore machines -# -# XXX - needs to have the byte order specified (NS32K was little-endian, -# dunno whether they run the 88K in little-endian mode or not). -# -0 short 0x154 Encore ->20 short 0x107 executable ->20 short 0x108 pure executable ->20 short 0x10b demand-paged executable ->20 short 0x10f unsupported executable ->12 long >0 not stripped ->22 short >0 - version %ld ->22 short 0 - -#>4 date x stamp %s -0 short 0x155 Encore unsupported executable ->12 long >0 not stripped ->22 short >0 - version %ld ->22 short 0 - -#>4 date x stamp %s diff --git a/contrib/file/Magdir/epoc b/contrib/file/Magdir/epoc deleted file mode 100644 index 29bd94799b206..0000000000000 --- a/contrib/file/Magdir/epoc +++ /dev/null @@ -1,10 +0,0 @@ - -#------------------------------------------------------------------------------ -# Epoc 32 : file(1) magic for Epoc Documents [psion/osaris -# Stefan Praszalowicz (hpicollo@worldnet.fr) -#0 lelong 0x10000037 Epoc32 ->4 lelong 0x1000006D ->>8 lelong 0x1000007F Word ->>8 lelong 0x10000088 Sheet ->>8 lelong 0x1000007D Sketch ->>8 lelong 0x10000085 TextEd diff --git a/contrib/file/Magdir/filesystems b/contrib/file/Magdir/filesystems deleted file mode 100644 index 80b5ea3c87924..0000000000000 --- a/contrib/file/Magdir/filesystems +++ /dev/null @@ -1,91 +0,0 @@ - -#------------------------------------------------------------------------------ -# filesystems: file(1) magic for different filesystems -# -0 string \366\366\366\366 PC formatted floppy with no filesystem -# Sun disk labels -# From /usr/include/sun/dklabel.h: -0774 beshort 0xdabe Sun disk label ->0 string x '%s ->>31 string >\0 \b%s ->>>63 string >\0 \b%s ->>>>95 string >\0 \b%s ->0 string x \b' ->0734 short >0 %d rpm, ->0736 short >0 %d phys cys, ->0740 short >0 %d alts/cyl, ->0746 short >0 %d interleave, ->0750 short >0 %d data cyls, ->0752 short >0 %d alt cyls, ->0754 short >0 %d heads/partition, ->0756 short >0 %d sectors/track, ->0764 long >0 start cyl %ld, ->0770 long x %ld blocks -# Is there a boot block written 1 sector in? ->512 belong&077777777 0600407 \b, boot block present -0x1FE leshort 0xAA55 x86 boot sector ->2 string OSBS \b, OS/BS MBR ->0x8C string Invalid\ partition\ table \b, MS-DOS MBR ->0 string \0\0\0\0 \b, extended partition table ->0 leshort 0x3CEB \b, system ->>3 string >\0 %s ->>0x36 string FAT \b, %s ->>>0x39 string 12 (%s bit) ->>>0x39 string 16 (%s bit) ->0x52 string FAT32 \b, FAT (32 bit) ->>>43 string >NO\ NAME label: %.11s, ->>>43 string <NO\ NAME label: %.11s, ->>>43 string NO\ NAME unlabeled, ->>>19 leshort >0 %d sectors ->>>19 leshort 0 ->>>>32 lelong x %d sectors ->0x200 lelong 0x82564557 \b, BSD disklabel - -# Minix filesystems - Juan Cespedes <cespedes@debian.org> -0x410 leshort 0x137f Minix filesystem -0x410 leshort 0x138f Minix filesystem, 30 char names -0x410 leshort 0x2468 Minix filesystem, version 2 -0x410 leshort 0x2478 Minix filesystem, version 2, 30 char names - -# romfs filesystems - Juan Cespedes <cespedes@debian.org> -0 string -rom1fs-\0 romfs filesystem, version 1 ->8 belong x %d bytes, ->16 string x named %s. - -# netboot image - Juan Cespedes <cespedes@debian.org> -0 lelong 0x1b031336L Netboot image, ->4 lelong&0xFFFFFF00 0 ->>4 lelong&0x100 0x000 mode 2 ->>4 lelong&0x100 0x100 mode 3 ->4 lelong&0xFFFFFF00 !0 unknown mode - -0x18b string OS/2 OS/2 Boot Manager - -9564 lelong 0x00011954 Unix Fast File system, ->8404 string x last mounted on %s, ->9504 ledate x last checkd at %s, ->8224 ledate x last writen at %s, ->8228 lelong x number of blocks %d, ->8232 lelong x number of data blocks %d, ->8236 lelong x number of cylinder groups %d, ->8240 lelong x number of basic blocks %d, ->8244 lelong x number of fragment blocks %d, ->8248 lelong x minimum percentage of free blocks %d, ->8252 lelong x rotational delay %dms, ->8256 lelong x disk rotational speed %drps, ->8320 lelong 0 TIME optimization ->8320 lelong 1 SPACE optimization - -# ext2/ext3 filesystems - Andreas Dilger <adilger@turbolabs.com> -0x438 leshort 0xEF53 Linux ->0x44c lelong x rev %d ->0x43e leshort x \b.%d ->0x45c lelong ^0x0000004 ext2 filesystem data ->>0x43a leshort ^0x0000001 (mounted or unclean) ->0x45c lelong &0x0000004 ext3 filesystem data ->>0x460 lelong &0x0000004 (needs journal recovery) ->0x43a leshort &0x0000002 (errors) ->0x460 lelong &0x0000001 (compressed) -#>0x460 lelong &0x0000002 (filetype) -#>0x464 lelong &0x0000001 (sparse_super) ->0x464 lelong &0x0000002 (large files) diff --git a/contrib/file/Magdir/flash b/contrib/file/Magdir/flash deleted file mode 100644 index 1d6f7b766cd14..0000000000000 --- a/contrib/file/Magdir/flash +++ /dev/null @@ -1,10 +0,0 @@ - -#------------------------------------------------------------------------------ -# flash: file(1) magic for Macromedia Flash file format -# -# See -# -# http://www.macromedia.com/software/flash/open/ -# -0 string FWS Macromedia Flash data, ->3 byte x version %d diff --git a/contrib/file/Magdir/fonts b/contrib/file/Magdir/fonts deleted file mode 100644 index d0dc225993c67..0000000000000 --- a/contrib/file/Magdir/fonts +++ /dev/null @@ -1,51 +0,0 @@ - -#------------------------------------------------------------------------------ -# fonts: file(1) magic for font data -# -0 string FONT ASCII vfont text -0 short 0436 Berkeley vfont data -0 short 017001 byte-swapped Berkeley vfont data - -# PostScript fonts (must precede "printer" entries), quinlan@yggdrasil.com -0 string %!PS-AdobeFont-1.0 PostScript Type 1 font text ->20 string >\0 (%s) -6 string %!PS-AdobeFont-1.0 PostScript Type 1 font program data - -# X11 font files in SNF (Server Natural Format) format -0 belong 00000004 X11 SNF font data, MSB first -0 lelong 00000004 X11 SNF font data, LSB first - -# X11 Bitmap Distribution Format, from Daniel Quinlan (quinlan@yggdrasil.com) -0 string STARTFONT\040 X11 BDF font text - -# X11 fonts, from Daniel Quinlan (quinlan@yggdrasil.com) -# PCF must come before SGI additions ("MIPSEL MIPS-II COFF" collides) -0 string \001fcp X11 Portable Compiled Font data ->12 byte 0x02 \b, LSB first ->12 byte 0x0a \b, MSB first -0 string D1.0\015 X11 Speedo font data - -#------------------------------------------------------------------------------ -# FIGlet fonts and controlfiles -# From figmagic supplied with Figlet version 2.2 -# "David E. O'Brien" <obrien@FreeBSD.ORG> -0 string flf FIGlet font ->3 string >2a version %-2.2s -0 string flc FIGlet controlfile ->3 string >2a version %-2.2s - -# libGrx graphics lib fonts, from Albert Cahalan (acahalan@cs.uml.edu) -# Used with djgpp (DOS Gnu C++), sometimes Linux or Turbo C++ -0 belong 0x14025919 libGrx font data, ->8 leshort x %dx ->10 leshort x \b%d ->40 string x %s -# Misc. DOS VGA fonts, from Albert Cahalan (acahalan@cs.uml.edu) -0 belong 0xff464f4e DOS code page font data collection -7 belong 0x00454741 DOS code page font data -7 belong 0x00564944 DOS code page font data (from Linux?) -4098 string DOSFONT DOSFONT2 encrypted font data - -# downloadable fonts for browser (prints type) anthon@mnt.org -0 string PFR1 PFR1 font ->102 string >0 \b: %s diff --git a/contrib/file/Magdir/frame b/contrib/file/Magdir/frame deleted file mode 100644 index 1b397df05799a..0000000000000 --- a/contrib/file/Magdir/frame +++ /dev/null @@ -1,38 +0,0 @@ - -#------------------------------------------------------------------------------ -# frame: file(1) magic for FrameMaker files -# -# This stuff came on a FrameMaker demo tape, most of which is -# copyright, but this file is "published" as witness the following: -# -0 string \<MakerFile FrameMaker document ->11 string 5.5 (5.5 ->11 string 5.0 (5.0 ->11 string 4.0 (4.0 ->11 string 3.0 (3.0 ->11 string 2.0 (2.0 ->11 string 1.0 (1.0 ->14 byte x %c) -0 string \<MIFFile FrameMaker MIF (ASCII) file ->9 string 4.0 (4.0) ->9 string 3.0 (3.0) ->9 string 2.0 (2.0) ->9 string 1.0 (1.x) -0 string \<MakerDictionary FrameMaker Dictionary text ->17 string 3.0 (3.0) ->17 string 2.0 (2.0) ->17 string 1.0 (1.x) -0 string \<MakerScreenFont FrameMaker Font file ->17 string 1.01 (%s) -0 string \<MML FrameMaker MML file -0 string \<BookFile FrameMaker Book file ->10 string 3.0 (3.0 ->10 string 2.0 (2.0 ->10 string 1.0 (1.0 ->13 byte x %c) -# XXX - this book entry should be verified, if you find one, uncomment this -#0 string \<Book\ FrameMaker Book (ASCII) file -#>6 string 3.0 (3.0) -#>6 string 2.0 (2.0) -#>6 string 1.0 (1.0) -0 string \<Maker Intermediate Print File FrameMaker IPL file diff --git a/contrib/file/Magdir/freebsd b/contrib/file/Magdir/freebsd deleted file mode 100644 index 2370c257841ed..0000000000000 --- a/contrib/file/Magdir/freebsd +++ /dev/null @@ -1,130 +0,0 @@ - -#------------------------------------------------------------------------------ -# freebsd: file(1) magic for FreeBSD objects -# -# All new-style FreeBSD magic numbers are in host byte order (i.e., -# little-endian on x86). -# -# XXX - this comes from the file "freebsd" in a recent FreeBSD version of -# "file"; it, and the NetBSD stuff in "netbsd", appear to use different -# schemes for distinguishing between executable images, shared libraries, -# and object files. -# -# FreeBSD says: -# -# Regardless of whether it's pure, demand-paged, or none of the -# above: -# -# if the entry point is < 4096, then it's a shared library if -# the "has run-time loader information" bit is set, and is -# position-independent if the "is position-independent" bit -# is set; -# -# if the entry point is >= 4096 (or >4095, same thing), then it's -# an executable, and is dynamically-linked if the "has run-time -# loader information" bit is set. -# -# On x86, NetBSD says: -# -# If it's neither pure nor demand-paged: -# -# if it has the "has run-time loader information" bit set, it's -# a dynamically-linked executable; -# -# if it doesn't have that bit set, then: -# -# if it has the "is position-independent" bit set, it's -# position-independent; -# -# if the entry point is non-zero, it's an executable, otherwise -# it's an object file. -# -# If it's pure: -# -# if it has the "has run-time loader information" bit set, it's -# a dynamically-linked executable, otherwise it's just an -# executable. -# -# If it's demand-paged: -# -# if it has the "has run-time loader information" bit set, -# then: -# -# if the entry point is < 4096, it's a shared library; -# -# if the entry point is = 4096 or > 4096 (i.e., >= 4096), -# it's a dynamically-linked executable); -# -# if it doesn't have the "has run-time loader information" bit -# set, then it's just an executable. -# -# (On non-x86, NetBSD does much the same thing, except that it uses -# 8192 on 68K - except for "68k4k", which is presumably "68K with 4K -# pages - SPARC, and MIPS, presumably because Sun-3's and Sun-4's -# had 8K pages; dunno about MIPS.) -# -# I suspect the two will differ only in perverse and uninteresting cases -# ("shared" libraries that aren't demand-paged and whose pages probably -# won't actually be shared, executables with entry points <4096). -# -# I leave it to those more familiar with FreeBSD and NetBSD to figure out -# what the right answer is (although using ">4095", FreeBSD-style, is -# probably better than separately checking for "=4096" and ">4096", -# NetBSD-style). (The old "netbsd" file analyzed FreeBSD demand paged -# executables using the NetBSD technique.) -# -0 lelong&0377777777 041400407 FreeBSD/i386 ->20 lelong <4096 ->>3 byte&0xC0 &0x80 shared library ->>3 byte&0xC0 0x40 PIC object ->>3 byte&0xC0 0x00 object ->20 lelong >4095 ->>3 byte&0x80 0x80 dynamically linked executable ->>3 byte&0x80 0x00 executable ->16 lelong >0 not stripped - -0 lelong&0377777777 041400410 FreeBSD/i386 pure ->20 lelong <4096 ->>3 byte&0xC0 &0x80 shared library ->>3 byte&0xC0 0x40 PIC object ->>3 byte&0xC0 0x00 object ->20 lelong >4095 ->>3 byte&0x80 0x80 dynamically linked executable ->>3 byte&0x80 0x00 executable ->16 lelong >0 not stripped - -0 lelong&0377777777 041400413 FreeBSD/i386 demand paged ->20 lelong <4096 ->>3 byte&0xC0 &0x80 shared library ->>3 byte&0xC0 0x40 PIC object ->>3 byte&0xC0 0x00 object ->20 lelong >4095 ->>3 byte&0x80 0x80 dynamically linked executable ->>3 byte&0x80 0x00 executable ->16 lelong >0 not stripped - -0 lelong&0377777777 041400314 FreeBSD/i386 compact demand paged ->20 lelong <4096 ->>3 byte&0xC0 &0x80 shared library ->>3 byte&0xC0 0x40 PIC object ->>3 byte&0xC0 0x00 object ->20 lelong >4095 ->>3 byte&0x80 0x80 dynamically linked executable ->>3 byte&0x80 0x00 executable ->16 lelong >0 not stripped - -# XXX gross hack to identify core files -# cores start with a struct tss; we take advantage of the following: -# byte 7: highest byte of the kernel stack pointer, always 0xfe -# 8/9: kernel (ring 0) ss value, always 0x0010 -# 10 - 27: ring 1 and 2 ss/esp, unused, thus always 0 -# 28: low order byte of the current PTD entry, always 0 since the -# PTD is page-aligned -# -7 string \357\020\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 FreeBSD/i386 a.out core file ->1039 string >\0 from '%s' - -# /var/run/ld.so.hints -# What are you laughing about? -0 lelong 011421044151 ld.so hints file ->4 lelong >0 (version %d) diff --git a/contrib/file/Magdir/fsav b/contrib/file/Magdir/fsav deleted file mode 100644 index 4218936e48459..0000000000000 --- a/contrib/file/Magdir/fsav +++ /dev/null @@ -1,27 +0,0 @@ - -#------------------------------------------------------------------------------ -# fsav: file(1) magic for datafellows fsav virus definition files -# Anthon van der Neut (anthon@mnt.org) -0 beshort 0x1575 fsav (linux) macro virus ->8 leshort >0 (%d- ->11 byte >0 \b%02d- ->10 byte >0 \b%02d) - -# comment this out for now because it regognizes every file where -# the eighth character is \n -#8 byte 0x0a -#>12 byte 0x07 -#>11 leshort >0 fsav (linux) virus (%d- -#>10 byte 0 \b01- -#>10 byte 1 \b02- -#>10 byte 2 \b03- -#>10 byte 3 \b04- -#>10 byte 4 \b05- -#>10 byte 5 \b06- -#>10 byte 6 \b07- -#>10 byte 7 \b08- -#>10 byte 8 \b08- -#>10 byte 9 \b10- -#>10 byte 10 \b11- -#>10 byte 11 \b12- -#>9 byte >0 \b%02d) diff --git a/contrib/file/Magdir/gimp b/contrib/file/Magdir/gimp deleted file mode 100644 index 9a9d61e2f79c3..0000000000000 --- a/contrib/file/Magdir/gimp +++ /dev/null @@ -1,36 +0,0 @@ -#------------------------------------------------------------------------------ -# GIMP Gradient: file(1) magic for the GIMP's gradient data files -# by Federico Mena <federico@nuclecu.unam.mx> - -0 string GIMP\ Gradient GIMP gradient data - -#------------------------------------------------------------------------------ -# XCF: file(1) magic for the XCF image format used in the GIMP developed -# by Spencer Kimball and Peter Mattis -# ('Bucky' LaDieu, nega@vt.edu) - -0 string gimp\ xcf GIMP XCF image data, ->9 string file version 0, ->9 string v version ->>10 string >\0 %s, ->14 belong x %lu x ->18 belong x %lu, ->22 belong 0 RGB Color ->22 belong 1 Greyscale ->22 belong 2 Indexed Color ->22 belong >2 Unknown Image Type. - -#------------------------------------------------------------------------------ -# XCF: file(1) magic for the patterns used in the GIMP, developed -# by Spencer Kimball and Peter Mattis -# ('Bucky' LaDieu, nega@vt.edu) - -20 string GPAT GIMP pattern data, ->24 string x %s - -#------------------------------------------------------------------------------ -# XCF: file(1) magic for the brushes used in the GIMP, developed -# by Spencer Kimball and Peter Mattis -# ('Bucky' LaDieu, nega@vt.edu) - -20 string GIMP GIMP brush data diff --git a/contrib/file/Magdir/gnu b/contrib/file/Magdir/gnu deleted file mode 100644 index a385fc972e8d3..0000000000000 --- a/contrib/file/Magdir/gnu +++ /dev/null @@ -1,12 +0,0 @@ -# -# GNU nlsutils message catalog file format -# -0 string \336\22\4\225 GNU message catalog (little endian), ->4 lelong x revision %d, ->8 lelong x %d messages -0 string \225\4\22\336 GNU message catalog (big endian), ->4 belong x revision %d, ->8 belong x %d messages -# message catalogs, from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk> -0 string *nazgul* Nazgul style compiled message catalog ->8 lelong >0 \b, version %ld diff --git a/contrib/file/Magdir/grace b/contrib/file/Magdir/grace deleted file mode 100644 index a5f143359ec32..0000000000000 --- a/contrib/file/Magdir/grace +++ /dev/null @@ -1,20 +0,0 @@ - -#------------------------------------------------------------------------------ -# ACE/gr and Grace type files - PLEASE DO NOT REMOVE THIS LINE -# -# ACE/gr binary -0 string \000\000\0001\000\000\0000\000\000\0000\000\000\0002\000\000\0000\000\000\0000\000\000\0003 old ACE/gr binary file ->39 byte >0 - version %c -# ACE/gr ascii -0 string #\ xvgr\ parameter\ file ACE/gr ascii file -0 string #\ xmgr\ parameter\ file ACE/gr ascii file -0 string #\ ACE/gr\ parameter\ file ACE/gr ascii file -# Grace projects -0 string #\ Grace\ project\ file Grace project file ->23 string @version\ (version ->>32 byte >0 %c ->>33 string >\0 \b.%.2s ->>35 string >\0 \b.%.2s) -# ACE/gr fit description files -0 string #\ ACE/gr\ fit\ description\ ACE/gr fit description file -# end of ACE/gr and Grace type files - PLEASE DO NOT REMOVE THIS LINE diff --git a/contrib/file/Magdir/hp b/contrib/file/Magdir/hp deleted file mode 100644 index 5ffeee85c0282..0000000000000 --- a/contrib/file/Magdir/hp +++ /dev/null @@ -1,251 +0,0 @@ - -#------------------------------------------------------------------------------ -# hp: file(1) magic for Hewlett Packard machines (see also "printer") -# -# XXX - somebody should figure out whether any byte order needs to be -# applied to the "TML" stuff; I'm assuming the Apollo stuff is -# big-endian as it was mostly 68K-based. -# -# I think the 500 series was the old stack-based machines, running a -# UNIX environment atop the "SUN kernel"; dunno whether it was -# big-endian or little-endian. -# -# Daniel Quinlan (quinlan@yggdrasil.com): hp200 machines are 68010 based; -# hp300 are 68020+68881 based; hp400 are also 68k. The following basic -# HP magic is useful for reference, but using "long" magic is a better -# practice in order to avoid collisions. -# -# Guy Harris (guy@netapp.com): some additions to this list came from -# HP-UX 10.0's "/usr/include/sys/unistd.h" (68030, 68040, PA-RISC 1.1, -# 1.2, and 2.0). The 1.2 and 2.0 stuff isn't in the HP-UX 10.0 -# "/etc/magic", though, except for the "archive file relocatable library" -# stuff, and the 68030 and 68040 stuff isn't there at all - are they not -# used in executables, or have they just not yet updated "/etc/magic" -# completely? -# -# 0 beshort 200 hp200 (68010) BSD binary -# 0 beshort 300 hp300 (68020+68881) BSD binary -# 0 beshort 0x20c hp200/300 HP-UX binary -# 0 beshort 0x20d hp400 (68030) HP-UX binary -# 0 beshort 0x20e hp400 (68040?) HP-UX binary -# 0 beshort 0x20b PA-RISC1.0 HP-UX binary -# 0 beshort 0x210 PA-RISC1.1 HP-UX binary -# 0 beshort 0x211 PA-RISC1.2 HP-UX binary -# 0 beshort 0x214 PA-RISC2.0 HP-UX binary - -# -# The "misc" stuff needs a byte order; the archives look suspiciously -# like the old 177545 archives (0xff65 = 0177545). -# -#### Old Apollo stuff -0 beshort 0627 Apollo m68k COFF executable ->18 beshort ^040000 not stripped ->22 beshort >0 - version %ld -0 beshort 0624 apollo a88k COFF executable ->18 beshort ^040000 not stripped ->22 beshort >0 - version %ld -0 long 01203604016 TML 0123 byte-order format -0 long 01702407010 TML 1032 byte-order format -0 long 01003405017 TML 2301 byte-order format -0 long 01602007412 TML 3210 byte-order format -#### PA-RISC 1.1 -0 belong 0x02100106 PA-RISC1.1 relocatable object -0 belong 0x02100107 PA-RISC1.1 executable ->168 belong &0x00000004 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x02100108 PA-RISC1.1 shared executable ->168 belong&0x4 0x4 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x0210010b PA-RISC1.1 demand-load executable ->168 belong&0x4 0x4 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x0210010e PA-RISC1.1 shared library ->96 belong >0 - not stripped - -0 belong 0x0210010d PA-RISC1.1 dynamic load library ->96 belong >0 - not stripped - -#### PA-RISC 2.0 -0 belong 0x02140106 PA-RISC2.0 relocatable object - -0 belong 0x02140107 PA-RISC2.0 executable ->168 belong &0x00000004 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x02140108 PA-RISC2.0 shared executable ->168 belong &0x00000004 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x0214010b PA-RISC2.0 demand-load executable ->168 belong &0x00000004 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x0214010e PA-RISC2.0 shared library ->96 belong >0 - not stripped - -0 belong 0x0214010d PA-RISC2.0 dynamic load library ->96 belong >0 - not stripped - -#### 800 -0 belong 0x020b0106 PA-RISC1.0 relocatable object - -0 belong 0x020b0107 PA-RISC1.0 executable ->168 belong&0x4 0x4 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x020b0108 PA-RISC1.0 shared executable ->168 belong&0x4 0x4 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x020b010b PA-RISC1.0 demand-load executable ->168 belong&0x4 0x4 dynamically linked ->(144) belong 0x054ef630 dynamically linked ->96 belong >0 - not stripped - -0 belong 0x020b010e PA-RISC1.0 shared library ->96 belong >0 - not stripped - -0 belong 0x020b010d PA-RISC1.0 dynamic load library ->96 belong >0 - not stripped - -0 belong 0x213c6172 archive file ->68 belong 0x020b0619 - PA-RISC1.0 relocatable library ->68 belong 0x02100619 - PA-RISC1.1 relocatable library ->68 belong 0x02110619 - PA-RISC1.2 relocatable library ->68 belong 0x02140619 - PA-RISC2.0 relocatable library - -#### 500 -0 long 0x02080106 HP s500 relocatable executable ->16 long >0 - version %ld - -0 long 0x02080107 HP s500 executable ->16 long >0 - version %ld - -0 long 0x02080108 HP s500 pure executable ->16 long >0 - version %ld - -#### 200 -0 belong 0x020c0108 HP s200 pure executable ->4 beshort >0 - version %ld ->8 belong &0x80000000 save fp regs ->8 belong &0x40000000 dynamically linked ->8 belong &0x20000000 debuggable ->36 belong >0 not stripped - -0 belong 0x020c0107 HP s200 executable ->4 beshort >0 - version %ld ->8 belong &0x80000000 save fp regs ->8 belong &0x40000000 dynamically linked ->8 belong &0x20000000 debuggable ->36 belong >0 not stripped - -0 belong 0x020c010b HP s200 demand-load executable ->4 beshort >0 - version %ld ->8 belong &0x80000000 save fp regs ->8 belong &0x40000000 dynamically linked ->8 belong &0x20000000 debuggable ->36 belong >0 not stripped - -0 belong 0x020c0106 HP s200 relocatable executable ->4 beshort >0 - version %ld ->6 beshort >0 - highwater %d ->8 belong &0x80000000 save fp regs ->8 belong &0x20000000 debuggable ->8 belong &0x10000000 PIC - -0 belong 0x020a0108 HP s200 (2.x release) pure executable ->4 beshort >0 - version %ld ->36 belong >0 not stripped - -0 belong 0x020a0107 HP s200 (2.x release) executable ->4 beshort >0 - version %ld ->36 belong >0 not stripped - -0 belong 0x020c010e HP s200 shared library ->4 beshort >0 - version %ld ->6 beshort >0 - highwater %d ->36 belong >0 not stripped - -0 belong 0x020c010d HP s200 dynamic load library ->4 beshort >0 - version %ld ->6 beshort >0 - highwater %d ->36 belong >0 not stripped - -#### MISC -0 long 0x0000ff65 HP old archive -0 long 0x020aff65 HP s200 old archive -0 long 0x020cff65 HP s200 old archive -0 long 0x0208ff65 HP s500 old archive - -0 long 0x015821a6 HP core file - -0 long 0x4da7eee8 HP-WINDOWS font ->8 byte >0 - version %ld -0 string Bitmapfile HP Bitmapfile - -0 string IMGfile CIS compimg HP Bitmapfile -# XXX - see "lif" -#0 short 0x8000 lif file -0 long 0x020c010c compiled Lisp - -0 string msgcat01 HP NLS message catalog, ->8 long >0 %d messages - -# addendum to /etc/magic with HP-48sx file-types by phk@data.fls.dk 1jan92 -0 string HPHP48- HP48 binary ->7 byte >0 - Rev %c ->8 beshort 0x1129 (ADR) ->8 beshort 0x3329 (REAL) ->8 beshort 0x5529 (LREAL) ->8 beshort 0x7729 (COMPLX) ->8 beshort 0x9d29 (LCOMPLX) ->8 beshort 0xbf29 (CHAR) ->8 beshort 0xe829 (ARRAY) ->8 beshort 0x0a2a (LNKARRAY) ->8 beshort 0x2c2a (STRING) ->8 beshort 0x4e2a (HXS) ->8 beshort 0x742a (LIST) ->8 beshort 0x962a (DIR) ->8 beshort 0xb82a (ALG) ->8 beshort 0xda2a (UNIT) ->8 beshort 0xfc2a (TAGGED) ->8 beshort 0x1e2b (GROB) ->8 beshort 0x402b (LIB) ->8 beshort 0x622b (BACKUP) ->8 beshort 0x882b (LIBDATA) ->8 beshort 0x9d2d (PROG) ->8 beshort 0xcc2d (CODE) ->8 beshort 0x482e (GNAME) ->8 beshort 0x6d2e (LNAME) ->8 beshort 0x922e (XLIB) -0 string %%HP: HP48 text ->6 string T(0) - T(0) ->6 string T(1) - T(1) ->6 string T(2) - T(2) ->6 string T(3) - T(3) ->10 string A(D) A(D) ->10 string A(R) A(R) ->10 string A(G) A(G) ->14 string F(.) F(.); ->14 string F(,) F(,); - -# hpBSD magic numbers -0 beshort 200 hp200 (68010) BSD ->2 beshort 0407 impure binary ->2 beshort 0410 read-only binary ->2 beshort 0413 demand paged binary -0 beshort 300 hp300 (68020+68881) BSD ->2 beshort 0407 impure binary ->2 beshort 0410 read-only binary ->2 beshort 0413 demand paged binary diff --git a/contrib/file/Magdir/ibm370 b/contrib/file/Magdir/ibm370 deleted file mode 100644 index 8cd9da27ae6a9..0000000000000 --- a/contrib/file/Magdir/ibm370 +++ /dev/null @@ -1,47 +0,0 @@ - -#------------------------------------------------------------------------------ -# ibm370: file(1) magic for IBM 370 and compatibles. -# -# "ibm370" said that 0x15d == 0535 was "ibm 370 pure executable". -# What the heck *is* "USS/370"? -# AIX 4.1's "/etc/magic" has -# -# 0 short 0535 370 sysV executable -# >12 long >0 not stripped -# >22 short >0 - version %d -# >30 long >0 - 5.2 format -# 0 short 0530 370 sysV pure executable -# >12 long >0 not stripped -# >22 short >0 - version %d -# >30 long >0 - 5.2 format -# -# instead of the "USS/370" versions of the same magic numbers. -# -0 beshort 0537 370 XA sysV executable ->12 belong >0 not stripped ->22 beshort >0 - version %d ->30 belong >0 - 5.2 format -0 beshort 0532 370 XA sysV pure executable ->12 belong >0 not stripped ->22 beshort >0 - version %d ->30 belong >0 - 5.2 format -0 beshort 054001 370 sysV pure executable ->12 belong >0 not stripped -0 beshort 055001 370 XA sysV pure executable ->12 belong >0 not stripped -0 beshort 056401 370 sysV executable ->12 belong >0 not stripped -0 beshort 057401 370 XA sysV executable ->12 belong >0 not stripped -0 beshort 0531 SVR2 executable (Amdahl-UTS) ->12 belong >0 not stripped ->24 belong >0 - version %ld -0 beshort 0534 SVR2 pure executable (Amdahl-UTS) ->12 belong >0 not stripped ->24 belong >0 - version %ld -0 beshort 0530 SVR2 pure executable (USS/370) ->12 belong >0 not stripped ->24 belong >0 - version %ld -0 beshort 0535 SVR2 executable (USS/370) ->12 belong >0 not stripped ->24 belong >0 - version %ld diff --git a/contrib/file/Magdir/ibm6000 b/contrib/file/Magdir/ibm6000 deleted file mode 100644 index 8e1077b9b8c82..0000000000000 --- a/contrib/file/Magdir/ibm6000 +++ /dev/null @@ -1,17 +0,0 @@ - -#------------------------------------------------------------------------------ -# ibm6000: file(1) magic for RS/6000 and the RT PC. -# -0 beshort 0x01df executable (RISC System/6000 V3.1) or obj module ->12 belong >0 not stripped -# Breaks sun4 statically linked execs. -#0 beshort 0x0103 executable (RT Version 2) or obj module -#>2 byte 0x50 pure -#>28 belong >0 not stripped -#>6 beshort >0 - version %ld -0 beshort 0x0104 shared library -0 beshort 0x0105 ctab data -0 beshort 0xfe04 structured file -0 string 0xabcdef AIX message catalog -0 belong 0x000001f9 AIX compiled message catalog -0 string \<aiaff> archive diff --git a/contrib/file/Magdir/iff b/contrib/file/Magdir/iff deleted file mode 100644 index 68d1b79bd86c8..0000000000000 --- a/contrib/file/Magdir/iff +++ /dev/null @@ -1,28 +0,0 @@ - -#------------------------------------------------------------------------------ -# iff: file(1) magic for Interchange File Format (see also "audio" & "images") -# -# Daniel Quinlan (quinlan@yggdrasil.com) -- IFF was designed by Electronic -# Arts for file interchange. It has also been used by Apple, SGI, and -# especially Commodore-Amiga. -# -# IFF files begin with an 8 byte FORM header, followed by a 4 character -# FORM type, which is followed by the first chunk in the FORM. - -0 string FORM IFF data -#>4 belong x \b, FORM is %d bytes long -# audio formats ->8 string AIFF \b, AIFF audio ->8 string AIFC \b, AIFF-C compressed audio ->8 string 8SVX \b, 8SVX 8-bit sampled sound voice ->8 string SAMP \b, SAMP sampled audio -# image formats ->8 string ILBMBMHD \b, ILBM interleaved image ->>20 beshort x \b, %d x ->>22 beshort x %d ->8 string RGBN \b, RGBN 12-bit RGB image ->8 string RGB8 \b, RGB8 24-bit RGB image ->8 string DR2D \b, DR2D 2-D object ->8 string TDDD \b, TDDD 3-D rendering -# other formats ->8 string FTXT \b, FTXT formatted text diff --git a/contrib/file/Magdir/intel b/contrib/file/Magdir/intel deleted file mode 100644 index d450e2661691a..0000000000000 --- a/contrib/file/Magdir/intel +++ /dev/null @@ -1,35 +0,0 @@ - -#------------------------------------------------------------------------------ -# intel: file(1) magic for x86 Unix -# -# Various flavors of x86 UNIX executable/object (other than Xenix, which -# is in "microsoft"). DOS is in "msdos"; the ambitious soul can do -# Windows as well. -# -# Windows NT belongs elsewhere, as you need x86 and MIPS and Alpha and -# whatever comes next (HP-PA Hummingbird?). OS/2 may also go elsewhere -# as well, if, as, and when IBM makes it portable. -# -# The `versions' should be un-commented if they work for you. -# (Was the problem just one of endianness?) -# -0 leshort 0502 basic-16 executable ->12 lelong >0 not stripped -#>22 leshort >0 - version %ld -0 leshort 0503 basic-16 executable (TV) ->12 lelong >0 not stripped -#>22 leshort >0 - version %ld -0 leshort 0510 x86 executable ->12 lelong >0 not stripped -0 leshort 0511 x86 executable (TV) ->12 lelong >0 not stripped -0 leshort =0512 iAPX 286 executable small model (COFF) ->12 lelong >0 not stripped -#>22 leshort >0 - version %ld -0 leshort =0522 iAPX 286 executable large model (COFF) ->12 lelong >0 not stripped -#>22 leshort >0 - version %ld -# SGI labeled the next entry as "iAPX 386 executable" --Dan Quinlan -0 leshort =0514 80386 COFF executable ->12 lelong >0 not stripped ->22 leshort >0 - version %ld diff --git a/contrib/file/Magdir/interleaf b/contrib/file/Magdir/interleaf deleted file mode 100644 index 3eea3cff2690a..0000000000000 --- a/contrib/file/Magdir/interleaf +++ /dev/null @@ -1,8 +0,0 @@ - -#------------------------------------------------------------------------------ -# interleaf: file(1) magic for InterLeaf TPS: -# -0 string =\210OPS Interleaf saved data -0 string =<!OPS Interleaf document text ->5 string ,\ Version\ = \b, version ->>17 string >\0 %.3s diff --git a/contrib/file/Magdir/island b/contrib/file/Magdir/island deleted file mode 100644 index 9903cddf9217d..0000000000000 --- a/contrib/file/Magdir/island +++ /dev/null @@ -1,9 +0,0 @@ - -#------------------------------------------------------------------------------ -# island: file(1) magic for IslandWite/IslandDraw, from SunOS 5.5.1 -# "/etc/magic": -# From: guy@netapp.com (Guy Harris) -# -4 string pgscriptver IslandWrite document -13 string DrawFile IslandDraw document - diff --git a/contrib/file/Magdir/ispell b/contrib/file/Magdir/ispell deleted file mode 100644 index 592f064ed63c7..0000000000000 --- a/contrib/file/Magdir/ispell +++ /dev/null @@ -1,62 +0,0 @@ - -#------------------------------------------------------------------------------ -# ispell: file(1) magic for ispell -# -# Ispell 3.0 has a magic of 0x9601 and ispell 3.1 has 0x9602. This magic -# will match 0x9600 through 0x9603 in *both* little endian and big endian. -# (No other current magic entries collide.) -# -# Updated by Daniel Quinlan (quinlan@yggdrasil.com) -# -0 leshort&0xFFFC 0x9600 little endian ispell ->0 byte 0 hash file (?), ->0 byte 1 3.0 hash file, ->0 byte 2 3.1 hash file, ->0 byte 3 hash file (?), ->2 leshort 0x00 8-bit, no capitalization, 26 flags ->2 leshort 0x01 7-bit, no capitalization, 26 flags ->2 leshort 0x02 8-bit, capitalization, 26 flags ->2 leshort 0x03 7-bit, capitalization, 26 flags ->2 leshort 0x04 8-bit, no capitalization, 52 flags ->2 leshort 0x05 7-bit, no capitalization, 52 flags ->2 leshort 0x06 8-bit, capitalization, 52 flags ->2 leshort 0x07 7-bit, capitalization, 52 flags ->2 leshort 0x08 8-bit, no capitalization, 128 flags ->2 leshort 0x09 7-bit, no capitalization, 128 flags ->2 leshort 0x0A 8-bit, capitalization, 128 flags ->2 leshort 0x0B 7-bit, capitalization, 128 flags ->2 leshort 0x0C 8-bit, no capitalization, 256 flags ->2 leshort 0x0D 7-bit, no capitalization, 256 flags ->2 leshort 0x0E 8-bit, capitalization, 256 flags ->2 leshort 0x0F 7-bit, capitalization, 256 flags ->4 leshort >0 and %d string characters -0 beshort&0xFFFC 0x9600 big endian ispell ->1 byte 0 hash file (?), ->1 byte 1 3.0 hash file, ->1 byte 2 3.1 hash file, ->1 byte 3 hash file (?), ->2 beshort 0x00 8-bit, no capitalization, 26 flags ->2 beshort 0x01 7-bit, no capitalization, 26 flags ->2 beshort 0x02 8-bit, capitalization, 26 flags ->2 beshort 0x03 7-bit, capitalization, 26 flags ->2 beshort 0x04 8-bit, no capitalization, 52 flags ->2 beshort 0x05 7-bit, no capitalization, 52 flags ->2 beshort 0x06 8-bit, capitalization, 52 flags ->2 beshort 0x07 7-bit, capitalization, 52 flags ->2 beshort 0x08 8-bit, no capitalization, 128 flags ->2 beshort 0x09 7-bit, no capitalization, 128 flags ->2 beshort 0x0A 8-bit, capitalization, 128 flags ->2 beshort 0x0B 7-bit, capitalization, 128 flags ->2 beshort 0x0C 8-bit, no capitalization, 256 flags ->2 beshort 0x0D 7-bit, no capitalization, 256 flags ->2 beshort 0x0E 8-bit, capitalization, 256 flags ->2 beshort 0x0F 7-bit, capitalization, 256 flags ->4 beshort >0 and %d string characters -# ispell 4.0 hash files kromJx <kromJx@crosswinds.net> -# Ispell 4.0 -0 string ISPL ispell ->4 long x hash file version %d, ->8 long x lexletters %d, ->12 long x lexsize %d, ->16 long x hashsize %d, ->20 long x stblsize %d diff --git a/contrib/file/Magdir/java b/contrib/file/Magdir/java deleted file mode 100644 index d0677bf7040be..0000000000000 --- a/contrib/file/Magdir/java +++ /dev/null @@ -1,11 +0,0 @@ -#------------------------------------------------------------ -# Java ByteCode -# From Larry Schwimmer (schwim@cs.stanford.edu) -0 belong 0xcafebabe compiled Java class data, ->6 beshort x version %d. ->4 beshort x \b%d -#------------------------------------------------------------ -# Java serialization -# From Martin Pool (m.pool@pharos.com.au) -0 beshort 0xaced Java serialization data ->2 beshort >0x0004 \b, version %d diff --git a/contrib/file/Magdir/jpeg b/contrib/file/Magdir/jpeg deleted file mode 100644 index 089405a68872b..0000000000000 --- a/contrib/file/Magdir/jpeg +++ /dev/null @@ -1,61 +0,0 @@ - -#------------------------------------------------------------------------------ -# JPEG images -# SunOS 5.5.1 had -# -# 0 string \377\330\377\340 JPEG file -# 0 string \377\330\377\356 JPG file -# -# both of which turn into "JPEG image data" here. -# -0 beshort 0xffd8 JPEG image data ->6 string JFIF \b, JFIF standard - -# The following added by Erik Rossen <rossen@freesurf.ch> 1999-09-06 -# in a vain attempt to add image size reporting for JFIF. Note that these -# tests are not fool-proof since some perfectly valid JPEGs are currently -# impossible to specify in magic(4) format. -# First, a little JFIF version info: ->11 byte x \b %d. ->12 byte x \b%02d -# Next, the resolution or aspect ratio of the image: ->13 byte 0 \b, aspect ratio ->13 byte 1 \b, resolution (DPI) ->13 byte 2 \b, resolution (DPCM) ->14 beshort x \b X%d: ->16 beshort x \bY%d -#>4 beshort x \b, segment length %d -# Next, show thumbnail info, if it exists: ->18 byte !0 \b, thumbnail %dx ->>19 byte x \b%d -# Here things get sticky. We can do ONE MORE marker segment with -# indirect addressing, and that's all. It would be great if we could -# do pointer arithemetic like in an assembler language. Christos? -# And if there was some sort of looping construct to do searches, plus a few -# named accumulators, it would be even more effective... -# At least we can show a comment if no other segments got inserted before: ->(4.S+5) byte 0xFE ->>(4.S+8) string >\0 \b, "%s" -#>(4.S+5) byte 0xFE \b, comment -#>>(4.S+6) beshort x \b length=%d -#>>(4.S+8) string >\0 \b, "%s" -# Or, we can show the encoding type (I've included only the three most common) -# and image dimensions if we are lucky and the SOFn (image segment) is here: ->(4.S+5) byte 0xC0 \b, baseline ->>(4.S+6) byte x \b, precision %d ->>(4.S+7) beshort x \b, %dx ->>(4.S+9) beshort x \b%d ->(4.S+5) byte 0xC1 \b, extended sequential ->>(4.S+6) byte x \b, precision %d ->>(4.S+7) beshort x \b, %dx ->>(4.S+9) beshort x \b%d ->(4.S+5) byte 0xC2 \b, progressive ->>(4.S+6) byte x \b, precision %d ->>(4.S+7) beshort x \b, %dx ->>(4.S+9) beshort x \b%d -# I've commented-out quantisation table reporting. I doubt anyone cares yet. -#>(4.S+5) byte 0xDB \b, quantisation table -#>>(4.S+6) beshort x \b length=%d - -# HSI is Handmade Software's proprietary JPEG encoding scheme -0 string hsi1 JPEG image data, HSI proprietary diff --git a/contrib/file/Magdir/karma b/contrib/file/Magdir/karma deleted file mode 100644 index 89e77727ea4e4..0000000000000 --- a/contrib/file/Magdir/karma +++ /dev/null @@ -1,8 +0,0 @@ - -#------------------------------------------------------------------------------ -# karma: file(1) magic for Karma data files -# -# From <rgooch@atnf.csiro.au> - -0 string KarmaRHD Version Karma Data Structure Version ->16 belong x %lu diff --git a/contrib/file/Magdir/lecter b/contrib/file/Magdir/lecter deleted file mode 100644 index 87c186bab3632..0000000000000 --- a/contrib/file/Magdir/lecter +++ /dev/null @@ -1,4 +0,0 @@ -#------------------------------------------------------------------------------ -# DEC SRC Virtual Paper: Lectern files -# Karl M. Hegbloom <karlheg@inetarena.com> -0 string lect DEC SRC Virtual Paper Lectern file diff --git a/contrib/file/Magdir/lex b/contrib/file/Magdir/lex deleted file mode 100644 index 7b6d0f74a4004..0000000000000 --- a/contrib/file/Magdir/lex +++ /dev/null @@ -1,11 +0,0 @@ - -#------------------------------------------------------------------------------ -# lex: file(1) magic for lex -# -# derived empirically, your offsets may vary! -53 string yyprevious C program text (from lex) ->3 string >\0 for %s -# C program text from GNU flex, from Daniel Quinlan <quinlan@yggdrasil.com> -21 string generated\ by\ flex C program text (from flex) -# lex description file, from Daniel Quinlan <quinlan@yggdrasil.com> -0 string %{ lex description text diff --git a/contrib/file/Magdir/lif b/contrib/file/Magdir/lif deleted file mode 100644 index cf20e4997d832..0000000000000 --- a/contrib/file/Magdir/lif +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# lif: file(1) magic for lif -# -# (Daniel Quinlan <quinlan@yggdrasil.com>) -# -0 beshort 0x8000 lif file diff --git a/contrib/file/Magdir/linux b/contrib/file/Magdir/linux deleted file mode 100644 index 295edd9d01a39..0000000000000 --- a/contrib/file/Magdir/linux +++ /dev/null @@ -1,101 +0,0 @@ - -#------------------------------------------------------------------------------ -# linux: file(1) magic for Linux files -# -# Values for Linux/i386 binaries, from Daniel Quinlan <quinlan@yggdrasil.com> -# The following basic Linux magic is useful for reference, but using -# "long" magic is a better practice in order to avoid collisions. -# -# 2 leshort 100 Linux/i386 -# >0 leshort 0407 impure executable (OMAGIC) -# >0 leshort 0410 pure executable (NMAGIC) -# >0 leshort 0413 demand-paged executable (ZMAGIC) -# >0 leshort 0314 demand-paged executable (QMAGIC) -# -0 lelong 0x00640107 Linux/i386 impure executable (OMAGIC) ->16 lelong 0 \b, stripped -0 lelong 0x00640108 Linux/i386 pure executable (NMAGIC) ->16 lelong 0 \b, stripped -0 lelong 0x0064010b Linux/i386 demand-paged executable (ZMAGIC) ->16 lelong 0 \b, stripped -0 lelong 0x006400cc Linux/i386 demand-paged executable (QMAGIC) ->16 lelong 0 \b, stripped -# -0 string \007\001\000 Linux/i386 object file ->20 lelong >0x1020 \b, DLL library -# Linux-8086 stuff: -0 string \01\03\020\04 Linux-8086 impure executable ->28 long !0 not stripped -0 string \01\03\040\04 Linux-8086 executable ->28 long !0 not stripped -# -0 string \243\206\001\0 Linux-8086 object file -# -0 string \01\03\020\20 Minix-386 impure executable ->28 long !0 not stripped -0 string \01\03\040\20 Minix-386 executable ->28 long !0 not stripped -# core dump file, from Bill Reynolds <bill@goshawk.lanl.gov> -216 lelong 0421 Linux/i386 core file ->220 string >\0 of '%s' ->200 lelong >0 (signal %d) -# -# LILO boot/chain loaders, from Daniel Quinlan <quinlan@yggdrasil.com> -# this can be overridden by the DOS executable (COM) entry -2 string LILO Linux/i386 LILO boot/chain loader -# -# Debian Packages, from Peter Tobias <tobias@server.et-inf.fho-emden.de> -0 string 0.9 ->8 byte 0x0a old Debian Binary Package ->>3 byte >0 \b, created by dpkg 0.9%c ->>4 byte >0 pl%c -# PSF fonts, from H. Peter Anvin <hpa@yggdrasil.com> -0 leshort 0x0436 Linux/i386 PC Screen Font data, ->2 byte 0 256 characters, no directory, ->2 byte 1 512 characters, no directory, ->2 byte 2 256 characters, Unicode directory, ->2 byte 3 512 characters, Unicode directory, ->3 byte >0 8x%d -# Linux swap file, from Daniel Quinlan <quinlan@yggdrasil.com> -4086 string SWAP-SPACE Linux/i386 swap file -# ECOFF magic for OSF/1 and Linux (only tested under Linux though) -# -# from Erik Troan (ewt@redhat.com) examining od dumps, so this -# could be wrong -# updated by David Mosberger (davidm@azstarnet.com) based on -# GNU BFD and MIPS info found below. -# -0 leshort 0x0183 ECOFF alpha ->24 leshort 0407 executable ->24 leshort 0410 pure ->24 leshort 0413 demand paged ->8 long >0 not stripped ->8 long 0 stripped ->23 leshort >0 - version %ld. -# -# Linux kernel boot images, from Albert Cahalan <acahalan@cs.uml.edu> -# and others such as Axel Kohlmeyer <akohlmey@rincewind.chemie.uni-ulm.de> -# and Nicolás Lichtmaier <nick@debian.org> -# All known start with: b8 c0 07 8e d8 b8 00 90 8e c0 b9 00 01 29 f6 29 -514 string HdrS Linux kernel ->518 leshort >0 ->>529 byte 0 zImage data, ->>529 byte 1 bzImage data, ->0x048c byte 0x31 ->>0x048c string x version %s ->0x0493 byte 0x31 ->>0x0493 string x version %s ->0x048c byte 0x32 ->>0x048c string x version %s ->0x0493 byte 0x32 ->>0x0493 string x version %s ->0x04df byte 0x32 ->>0x04df string x version %s ->0x04fb byte 0x32 ->>0x04fb string x version %s -# This also matches new kernels, which were caught above by "HdrS". -0 belong 0xb8c0078e Linux kernel ->0x1e3 string Loading version 1.3.79 or older ->0x1e9 string Loading from prehistoric times -# LSM entries - Nicolás Lichtmaier <nick@feedback.net.ar> -0 string Begin3 Linux Software Map entry text diff --git a/contrib/file/Magdir/lisp b/contrib/file/Magdir/lisp deleted file mode 100644 index 4064dab20928e..0000000000000 --- a/contrib/file/Magdir/lisp +++ /dev/null @@ -1,21 +0,0 @@ - -#------------------------------------------------------------------------------ -# lisp: file(1) magic for lisp programs -# -# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com) -0 string ;; Lisp/Scheme program text -# Emacs 18 - this is always correct, but not very magical. -0 string \012( byte-compiled Emacs-Lisp program data -# Emacs 19 -0 string ;ELC\023\000\000\000 byte-compiled Emacs-Lisp program data -# -# Files produced by CLISP Common Lisp From: Bruno Haible <haible@ilog.fr> -0 string (SYSTEM::VERSION\040' CLISP byte-compiled Lisp program text -0 long 0x70768BD2 CLISP memory image data -0 long 0xD28B7670 CLISP memory image data, other endian -# Files produced by GNU gettext -0 long 0xDE120495 GNU-format message catalog data -0 long 0x950412DE GNU-format message catalog data - -#.com and .bin for MIT scheme -0 string \372\372\372\372 MIT scheme (library?) diff --git a/contrib/file/Magdir/mach b/contrib/file/Magdir/mach deleted file mode 100644 index e0f4808eea5b9..0000000000000 --- a/contrib/file/Magdir/mach +++ /dev/null @@ -1,43 +0,0 @@ -#------------------------------------------------------------------------------ -# mach file description -# -0 belong 0xcafebabe Mach-O fat file ->4 belong 1 with 1 architecture ->4 belong >1 ->>4 belong x with %ld architectures -# -0 belong 0xfeedface Mach-O ->12 belong 1 object ->12 belong 2 executable ->12 belong 3 shared library ->12 belong 4 core ->12 belong 5 preload executable ->12 belong >5 ->>12 belong x filetype=%ld ->4 belong <0 ->>4 belong x architecture=%ld ->4 belong 1 vax ->4 belong 2 romp ->4 belong 3 architecture=3 ->4 belong 4 ns32032 ->4 belong 5 ns32332 ->4 belong 6 for m68k architecture -# from NeXTstep 3.0 <mach/machine.h> -# i.e. mc680x0_all, ignore -# >>8 belong 1 (mc68030) ->>8 belong 2 (mc68040) ->>8 belong 3 (mc68030 only) ->4 belong 7 i386 ->4 belong 8 mips ->4 belong 9 ns32532 ->4 belong 10 architecture=10 ->4 belong 11 hp pa-risc ->4 belong 12 acorn ->4 belong 13 m88k ->4 belong 14 sparc ->4 belong 15 i860-big ->4 belong 16 i860 ->4 belong 17 rs6000 ->4 belong 18 powerPC ->4 belong >18 ->>4 belong x architecture=%ld diff --git a/contrib/file/Magdir/magic b/contrib/file/Magdir/magic deleted file mode 100644 index 4a639c6579cd1..0000000000000 --- a/contrib/file/Magdir/magic +++ /dev/null @@ -1,5 +0,0 @@ - -#------------------------------------------------------------------------------ -# magic: file(1) magic for magic files -# -0 string #\ Magic magic text file for file(1) cmd diff --git a/contrib/file/Magdir/mail.news b/contrib/file/Magdir/mail.news deleted file mode 100644 index 9713d29b3f4fa..0000000000000 --- a/contrib/file/Magdir/mail.news +++ /dev/null @@ -1,24 +0,0 @@ - -#------------------------------------------------------------------------------ -# mail.news: file(1) magic for mail and news -# -# Unfortunately, saved netnews also has From line added in some news software. -#0 string From mail text -# There are tests to ascmagic.c to cope with mail and news. -0 string Relay-Version: old news text -0 string #!\ rnews batched news text -0 string N#!\ rnews mailed, batched news text -0 string Forward\ to mail forwarding text -0 string Pipe\ to mail piping text -0 string Return-Path: smtp mail text -0 string Path: news text -0 string Xref: news text -0 string From: news or mail text -0 string Article saved news text -0 string BABYL Emacs RMAIL text -0 string Received: RFC 822 mail text -0 string MIME-Version: MIME entity text -#0 string Content- MIME entity text - -# TNEF files... -0 lelong 0x223E9F78 Transport Neutral Encapsulation Format diff --git a/contrib/file/Magdir/maple b/contrib/file/Magdir/maple deleted file mode 100644 index f39c62d25370c..0000000000000 --- a/contrib/file/Magdir/maple +++ /dev/null @@ -1,57 +0,0 @@ - -#------------------------------------------------------------------------------ -# maple: file(1) magic for maple files -# "H. Nanosecond" <aldomel@ix.netcom.com> -# Maple V release 4, a multi-purpose math program -# - -# maple library .lib -0 string \000MVR4\nI MapleVr4 library - -# .ind -# no magic for these :-( -# they are compiled indexes for maple files - -# .hdb -0 string \000\004\000\000 Maple help database - -# .mhp -# this has the form <PACKAGE=name> -0 string \<PACKAGE= Maple help file -0 string \<HELP\ NAME= Maple help file -0 string \n\<HELP\ NAME= Maple help file with extra carriage return at start (yuck) -0 string #\ Newton Maple help file, old style -0 string #\ daub Maple help file, old style -0 string #=========== Maple help file, old style - -# .mws -0 string \000\000\001\044\000\221 Maple worksheet -#this is anomalous -0 string WriteNow\000\002\000\001\000\000\000\000\100\000\000\000\000\000 Maple worksheet, but weird -# this has the form {VERSION 2 3 "IBM INTEL NT" "2.3" }\n -# that is {VERSION major_version miunor_version computer_type version_string} -0 string {VERSION\ Maple worksheet ->9 string >\0 version %.1s. ->>10 string ->>>11 string >\0 %.1s - -# .mps -0 string \0\0\001$ Maple something -# from byte 4 it is either 'nul E' or 'soh R' -# I think 'nul E' means a file that was saved as a different name -# a sort of revision marking -# 'soh R' means new ->4 string \000\105 An old revision ->4 string \001\122 The latest save - -# .mpl -# some of these are the same as .mps above -#0000000 000 000 001 044 000 105 same as .mps -#0000000 000 000 001 044 001 122 same as .mps - -0 string #\n##\ <SHAREFILE= Maple something -0 string \n#\n##\ <SHAREFILE= Maple something -0 string ##\ <SHAREFILE= Maple something -0 string #\r##\ <SHAREFILE= Maple something -0 string \r#\r##\ <SHAREFILE= Maple something -0 string #\ \r##\ <DESCRIBE> Maple something anomalous. diff --git a/contrib/file/Magdir/mathematica b/contrib/file/Magdir/mathematica deleted file mode 100644 index 136c25361eed1..0000000000000 --- a/contrib/file/Magdir/mathematica +++ /dev/null @@ -1,59 +0,0 @@ - -#------------------------------------------------------------------------------ -# mathematica: file(1) magic for mathematica files -# "H. Nanosecond" <aldomel@ix.netcom.com> -# Mathematica a multi-purpose math program -# versions 2.2 and 3.0 - -#mathematica .mb -0 string \064\024\012\000\035\000\000\000 Mathematica version 2 notebook -0 string \064\024\011\000\035\000\000\000 Mathematica version 2 notebook - -# .ma -# multiple possibilites: - -0 string (*^\n\n::[\011frontEndVersion\ =\ Mathematica notebook -#>41 string >\0 %s - -#0 string (*^\n\n::[\011palette Mathematica notebook version 2.x - -#0 string (*^\n\n::[\011Information Mathematica notebook version 2.x -#>675 string >\0 %s #doesn't work well - -# there may be 'cr' instread of 'nl' in some does this matter? - -# generic: -0 string (*^\r\r::[\011 Mathematica notebook version 2.x -0 string \(\*\^\r\n\r\n\:\:\[\011 Mathematica notebook version 2.x -0 string (*^\015 Mathematica notebook version 2.x -0 string (*^\n\r\n\r::[\011 Mathematica notebook version 2.x -0 string (*^\r::[\011 Mathematica notebook version 2.x -0 string (*^\r\n::[\011 Mathematica notebook version 2.x -0 string (*^\n\n::[\011 Mathematica notebook version 2.x -0 string (*^\n::[\011 Mathematica notebook version 2.x - - -# Mathematica .mx files - -#0 string (*This\ is\ a\ Mathematica\ binary\ dump\ file.\ It\ can\ be\ loaded\ with\ Get.*) Mathematica binary file -0 string (*This\ is\ a\ Mathematica\ binary\ Mathematica binary file -#>71 string \000\010\010\010\010\000\000\000\000\000\000\010\100\010\000\000\000 -# >71... is optional ->88 string >\0 from %s - - -# Mathematica files PBF: -# 115 115 101 120 102 106 000 001 000 000 000 203 000 001 000 -0 string MMAPBF\000\001\000\000\000\203\000\001\000 Mathematica PBF (fonts I think) - -# .ml files These are menu resources I think -# these start with "[0-9][0-9][0-9]\ A~[0-9][0-9][0-9]\ -# how to put that into a magic rule? -4 string \ A~ MAthematica .ml file - -# .nb files -#too long 0 string (***********************************************************************\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Mathematica-Compatible Notebook Mathematica 3.0 notebook -0 string (*********************** Mathematica 3.0 notebook - -# other (* matches it is a comment start in these langs -0 string (* Mathematica, or Pascal, Modula-2 or 3 code diff --git a/contrib/file/Magdir/mcrypt b/contrib/file/Magdir/mcrypt deleted file mode 100644 index 6416104da46dc..0000000000000 --- a/contrib/file/Magdir/mcrypt +++ /dev/null @@ -1,31 +0,0 @@ -#------------------------------------------------------------------------------ -# Mavroyanopoulos Nikos <nmav@hellug.gr> -# mcrypt: file(1) magic for mcrypt 2.2.x; -0 string \0m\2 mcrypt 2.2 encrypted data, ->3 byte 0 algorithm: blowfish-448, ->3 byte 1 algorithm: DES, ->3 byte 2 algorithm: 3DES, ->3 byte 3 algorithm: 3-WAY, ->3 byte 4 algorithm: GOST, ->3 byte 6 algorithm: SAFER-SK64, ->3 byte 7 algorithm: SAFER-SK128, ->3 byte 8 algorithm: CAST-128, ->3 byte 9 algorithm: xTEA, ->3 byte 10 algorithm: TWOFISH-128, ->3 byte 11 algorithm: RC2, ->3 byte 12 algorithm: TWOFISH-192, ->3 byte 13 algorithm: TWOFISH-256, ->3 byte 14 algorithm: blowfish-128, ->3 byte 15 algorithm: blowfish-192, ->3 byte 16 algorithm: blowfish-256, ->3 byte 100 algorithm: RC6, ->3 byte 101 algorithm: IDEA, ->4 byte 0 mode: CBC, ->4 byte 1 mode: ECB, ->4 byte 2 mode: CFB, ->4 byte 3 mode: OFB, ->4 byte 4 mode: nOFB, ->5 byte 0 keymode: 8bit ->5 byte 1 keymode: 4bit ->5 byte 2 keymode: SHA-1 hash ->5 byte 3 keymode: MD5 hash diff --git a/contrib/file/Magdir/mime b/contrib/file/Magdir/mime deleted file mode 100644 index 0102709191a5d..0000000000000 --- a/contrib/file/Magdir/mime +++ /dev/null @@ -1,7 +0,0 @@ -#------------------------------------------------------------------------------ -# mime: file(1) magic for MIME encoded files -# -0 string Content-Type:\ ->14 string >\0 %s -0 string Content-Type: ->13 string >\0 %s diff --git a/contrib/file/Magdir/mirage b/contrib/file/Magdir/mirage deleted file mode 100644 index 73c3747bb7fde..0000000000000 --- a/contrib/file/Magdir/mirage +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# mirage: file(1) magic for Mirage executables -# -# XXX - byte order? -# -0 long 31415 Mirage Assembler m.out executable diff --git a/contrib/file/Magdir/mkid b/contrib/file/Magdir/mkid deleted file mode 100644 index dfb2d93f4389c..0000000000000 --- a/contrib/file/Magdir/mkid +++ /dev/null @@ -1,10 +0,0 @@ - -#------------------------------------------------------------------------------ -# mkid: file(1) magic for mkid(1) databases -# -# ID is the binary tags database produced by mkid(1). -# -# XXX - byte order? -# -0 string \311\304 ID tags data ->2 short >0 version %d diff --git a/contrib/file/Magdir/mmdf b/contrib/file/Magdir/mmdf deleted file mode 100644 index 72cd9f32581b6..0000000000000 --- a/contrib/file/Magdir/mmdf +++ /dev/null @@ -1,5 +0,0 @@ - -#------------------------------------------------------------------------------ -# mmdf: file(1) magic for MMDF mail files -# -0 string \001\001\001\001 MMDF mailbox diff --git a/contrib/file/Magdir/modem b/contrib/file/Magdir/modem deleted file mode 100644 index 73e747e161dcf..0000000000000 --- a/contrib/file/Magdir/modem +++ /dev/null @@ -1,33 +0,0 @@ -#------------------------------------------------------------------------------ -# modem: file(1) magic for modem programs -# -# From: Florian La Roche <florian@knorke.saar.de> -4 string Research, Digifax-G3-File ->29 byte 1 , fine resolution ->29 byte 0 , normal resolution - -0 short 0x0100 raw G3 data, byte-padded -0 short 0x1400 raw G3 data -# -# Magic data for vgetty voice formats -# (Martin Seine & Marc Eberhard) - -# -# raw modem data version 1 -# -0 string RMD1 raw modem data ->4 string >\0 (%s / ->20 short >0 compression type 0x%04x) - -# -# portable voice format 1 -# -0 string PVF1\n portable voice format ->5 string >\0 (binary %s) - -# -# portable voice format 2 -# -0 string PVF2\n portable voice format ->5 string >\0 (ascii %s) - diff --git a/contrib/file/Magdir/motorola b/contrib/file/Magdir/motorola deleted file mode 100644 index efed159746ed3..0000000000000 --- a/contrib/file/Magdir/motorola +++ /dev/null @@ -1,32 +0,0 @@ - -#------------------------------------------------------------------------------ -# motorola: file(1) magic for Motorola 68K and 88K binaries -# -# 68K -# -0 beshort 0520 mc68k COFF ->18 beshort ^00000020 object ->18 beshort &00000020 executable ->12 belong >0 not stripped ->168 string .lowmem Apple toolbox ->20 beshort 0407 (impure) ->20 beshort 0410 (pure) ->20 beshort 0413 (demand paged) ->20 beshort 0421 (standalone) -0 beshort 0521 mc68k executable (shared) ->12 belong >0 not stripped -0 beshort 0522 mc68k executable (shared demand paged) ->12 belong >0 not stripped -# -# Motorola/UniSoft 68K Binary Compatibility Standard (BCS) -# -0 beshort 0554 68K BCS executable -# -# 88K -# -# Motorola/88Open BCS -# -0 beshort 0555 88K BCS executable -# -# Motorola S-Records, from Gerd Truschinski <gt@freebsd.first.gmd.de> -0 string S0 Motorola S-Record; binary data in text format diff --git a/contrib/file/Magdir/msvc b/contrib/file/Magdir/msvc deleted file mode 100644 index 95853fec9b375..0000000000000 --- a/contrib/file/Magdir/msvc +++ /dev/null @@ -1,44 +0,0 @@ - -#------------------------------------------------------------------------------ -# msvc: file(1) magic for msvc -# "H. Nanosecond" <aldomel@ix.netcom.com> -# Microsoft visual C -# -# I have version 1.0 - -# .aps -0 string HWB\000\377\001\000\000\000 Microsoft Visual C .APS file - -# .ide -#too long 0 string \102\157\162\154\141\156\144\040\103\053\053\040\120\162\157\152\145\143\164\040\106\151\154\145\012\000\032\000\002\000\262\000\272\276\372\316 MSVC .ide -0 string \102\157\162\154\141\156\144\040\103\053\053\040\120\162\157 MSVC .ide - -# .res -0 string \000\000\000\000\040\000\000\000\377 MSVC .res -0 string \377\003\000\377\001\000\020\020\350 MSVC .res -0 string \377\003\000\377\001\000\060\020\350 MSVC .res - -#.lib -0 string \360\015\000\000 Microsoft Visual C library -0 string \360\075\000\000 Microsoft Visual C library -0 string \360\175\000\000 Microsoft Visual C library - -#.pch -0 string DTJPCH0\000\022\103\006\200 Microsoft Visual C .pch - -# .pdb -# too long 0 string Microsoft\ C/C++\ program\ database\ -0 string Microsoft\ C/C++\ MSVC program database ->18 string program\ database\ ->33 string >\0 ver %s - -#.sbr -0 string \000\002\000\007\000 MSVC .sbr ->5 string >\0 %s - -#.bsc -0 string \002\000\002\001 MSVC .bsc - -#.wsp -0 string 1.00\ .0000.0000\000\003 MSVC .wsp version 1.0000.0000 -# these seem to start with the version and contain menus diff --git a/contrib/file/Magdir/ncr b/contrib/file/Magdir/ncr deleted file mode 100644 index 987c94e4a846e..0000000000000 --- a/contrib/file/Magdir/ncr +++ /dev/null @@ -1,48 +0,0 @@ - -#------------------------------------------------------------------------------ -# ncr: file(1) magic for NCR Tower objects -# -# contributed by -# Michael R. Wayne *** TMC & Associates *** INTERNET: wayne@ford-vax.arpa -# uucp: {philabs | pyramid} !fmsrl7!wayne OR wayne@fmsrl7.UUCP -# -0 beshort 000610 Tower/XP rel 2 object ->12 belong >0 not stripped ->20 beshort 0407 executable ->20 beshort 0410 pure executable ->22 beshort >0 - version %ld -0 beshort 000615 Tower/XP rel 2 object ->12 belong >0 not stripped ->20 beshort 0407 executable ->20 beshort 0410 pure executable ->22 beshort >0 - version %ld -0 beshort 000620 Tower/XP rel 3 object ->12 belong >0 not stripped ->20 beshort 0407 executable ->20 beshort 0410 pure executable ->22 beshort >0 - version %ld -0 beshort 000625 Tower/XP rel 3 object ->12 belong >0 not stripped ->20 beshort 0407 executable ->20 beshort 0410 pure executable ->22 beshort >0 - version %ld -0 beshort 000630 Tower32/600/400 68020 object ->12 belong >0 not stripped ->20 beshort 0407 executable ->20 beshort 0410 pure executable ->22 beshort >0 - version %ld -0 beshort 000640 Tower32/800 68020 ->18 beshort &020000 w/68881 object ->18 beshort &040000 compatible object ->18 beshort &~060000 object ->20 beshort 0407 executable ->20 beshort 0413 pure executable ->12 belong >0 not stripped ->22 beshort >0 - version %ld -0 beshort 000645 Tower32/800 68010 ->18 beshort &040000 compatible object ->18 beshort &~060000 object ->20 beshort 0407 executable ->20 beshort 0413 pure executable ->12 belong >0 not stripped ->22 beshort >0 - version %ld diff --git a/contrib/file/Magdir/netscape b/contrib/file/Magdir/netscape deleted file mode 100644 index eb4361c06c578..0000000000000 --- a/contrib/file/Magdir/netscape +++ /dev/null @@ -1,21 +0,0 @@ - -#------------------------------------------------------------------------------ -# netscape: file(1) magic for Netscape files -# "H. Nanosecond" <aldomel@ix.netcom.com> -# version 3 and 4 I think -# - -# Netscape Address book .nab -0 string \000\017\102\104\000\000\000\000\000\000\001\000\000\000\000\002\000\000\000\002\000\000\004\000 Netscape Address book - -# .snm Caches -0 string #\ Netscape\ folder\ cache Netscape folder cache -0 string \000\036\204\220\000 Netscape folder cache -# .n2p -# Net 2 Phone -#0 string 123\130\071\066\061\071\071\071\060\070\061\060\061\063\060 -0 string SX961999 Net2phone - -# -#This is files ending in .art, FIXME add more rules -0 string JG\004\016\0\0\0\0 ART diff --git a/contrib/file/Magdir/news b/contrib/file/Magdir/news deleted file mode 100644 index 0ac4fa2697480..0000000000000 --- a/contrib/file/Magdir/news +++ /dev/null @@ -1,12 +0,0 @@ - -#------------------------------------------------------------------------------ -# news: file(1) magic for SunOS NeWS fonts (not "news" as in "netnews") -# -0 string StartFontMetrics ASCII font metrics -0 string StartFont ASCII font bits -0 belong 0x137A2944 NeWS bitmap font -0 belong 0x137A2947 NeWS font family -0 belong 0x137A2950 scalable OpenFont binary -0 belong 0x137A2951 encrypted scalable OpenFont binary -8 belong 0x137A2B45 X11/NeWS bitmap font -8 belong 0x137A2B48 X11/NeWS font family diff --git a/contrib/file/Magdir/octave b/contrib/file/Magdir/octave deleted file mode 100644 index 309314820e45b..0000000000000 --- a/contrib/file/Magdir/octave +++ /dev/null @@ -1,4 +0,0 @@ -#------------------------------------------------------------------------------ -# octave binary data file(1) magic, from Dirk Eddelbuettel <edd@debian.org> -0 string Octave-1-L Octave binary data (little endian) -0 string Octave-1-B Octave binary data (big endian) diff --git a/contrib/file/Magdir/olf b/contrib/file/Magdir/olf deleted file mode 100644 index e698c36a49eea..0000000000000 --- a/contrib/file/Magdir/olf +++ /dev/null @@ -1,97 +0,0 @@ - -#------------------------------------------------------------------------------ -# olf: file(1) magic for OLF executables -# -# We have to check the byte order flag to see what byte order all the -# other stuff in the header is in. -# -# MIPS R3000 may also be for MIPS R2000. -# What're the correct byte orders for the nCUBE and the Fujitsu VPP500? -# -# Created by Erik Theisen <etheisen@openbsd.org> -# Based on elf from Daniel Quinlan <quinlan@yggdrasil.com> -0 string \177OLF OLF ->4 byte 0 invalid class ->4 byte 1 32-bit ->4 byte 2 64-bit ->7 byte 0 invalid os ->7 byte 1 OpenBSD ->7 byte 2 NetBSD ->7 byte 3 FreeBSD ->7 byte 4 4.4BSD ->7 byte 5 Linux ->7 byte 6 SVR4 ->7 byte 7 esix ->7 byte 8 Solaris ->7 byte 9 Irix ->7 byte 10 SCO ->7 byte 11 Dell ->7 byte 12 NCR ->5 byte 0 invalid byte order ->5 byte 1 LSB ->>16 leshort 0 no file type, ->>16 leshort 1 relocatable, ->>16 leshort 2 executable, ->>16 leshort 3 shared object, -# Core handling from Peter Tobias <tobias@server.et-inf.fho-emden.de> -# corrections by Christian 'Dr. Disk' Hechelmann <drdisk@ds9.au.s.shuttle.de> ->>16 leshort 4 core file ->>>(0x38+0xcc) string >\0 of '%s' ->>>(0x38+0x10) lelong >0 (signal %d), ->>16 leshort &0xff00 processor-specific, ->>18 leshort 0 no machine, ->>18 leshort 1 AT&T WE32100 - invalid byte order, ->>18 leshort 2 SPARC - invalid byte order, ->>18 leshort 3 Intel 80386, ->>18 leshort 4 Motorola 68000 - invalid byte order, ->>18 leshort 5 Motorola 88000 - invalid byte order, ->>18 leshort 6 Intel 80486, ->>18 leshort 7 Intel 80860, ->>18 leshort 8 MIPS R3000_BE - invalid byte order, ->>18 leshort 9 Amdahl - invalid byte order, ->>18 leshort 10 MIPS R3000_LE, ->>18 leshort 11 RS6000 - invalid byte order, ->>18 leshort 15 PA-RISC - invalid byte order, ->>18 leshort 16 nCUBE, ->>18 leshort 17 VPP500, ->>18 leshort 18 SPARC32PLUS, ->>18 leshort 20 PowerPC, ->>18 leshort 0x9026 Alpha, ->>20 lelong 0 invalid version ->>20 lelong 1 version 1 ->>36 lelong 1 MathCoPro/FPU/MAU Required ->8 string >\0 (%s) ->5 byte 2 MSB ->>16 beshort 0 no file type, ->>16 beshort 1 relocatable, ->>16 beshort 2 executable, ->>16 beshort 3 shared object, ->>16 beshort 4 core file, ->>>(0x38+0xcc) string >\0 of '%s' ->>>(0x38+0x10) belong >0 (signal %d), ->>16 beshort &0xff00 processor-specific, ->>18 beshort 0 no machine, ->>18 beshort 1 AT&T WE32100, ->>18 beshort 2 SPARC, ->>18 beshort 3 Intel 80386 - invalid byte order, ->>18 beshort 4 Motorola 68000, ->>18 beshort 5 Motorola 88000, ->>18 beshort 6 Intel 80486 - invalid byte order, ->>18 beshort 7 Intel 80860, ->>18 beshort 8 MIPS R3000_BE, ->>18 beshort 9 Amdahl, ->>18 beshort 10 MIPS R3000_LE - invalid byte order, ->>18 beshort 11 RS6000, ->>18 beshort 15 PA-RISC, ->>18 beshort 16 nCUBE, ->>18 beshort 17 VPP500, ->>18 beshort 18 SPARC32PLUS, ->>18 beshort 20 PowerPC or cisco 4500, ->>18 beshort 21 cisco 7500, ->>18 beshort 24 cisco SVIP, ->>18 beshort 25 cisco 7200, ->>18 beshort 36 cisco 12000, ->>18 beshort 0x9026 Alpha, ->>20 belong 0 invalid version ->>20 belong 1 version 1 ->>36 belong 1 MathCoPro/FPU/MAU Required diff --git a/contrib/file/Magdir/os2 b/contrib/file/Magdir/os2 deleted file mode 100644 index 7ae67c7c45853..0000000000000 --- a/contrib/file/Magdir/os2 +++ /dev/null @@ -1,47 +0,0 @@ - -#------------------------------------------------------------------------------ -# os2: file(1) magic for OS/2 files -# - -# Provided 1998/08/22 by -# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net> -1 string InternetShortcut MS Windows 95 Internet shortcut text ->24 string >\ (URL=<%s>) - -# OS/2 URL objects -# Provided 1998/08/22 by -# David Mediavilla <davidme.news@REMOVEIFNOTSPAMusa.net> -0 string http: OS/2 URL object text ->5 string >\ (WWW) <http:%s> -0 string mailto: OS/2 URL object text ->7 string >\ (email) <%s> -0 string news: OS/2 URL object text ->5 string >\ (Usenet) <%s> -0 string ftp: OS/2 URL object text ->4 string >\ (FTP) <ftp:%s> -0 string file: OS/2 URL object text ->5 string >\ (Local file) <%s> - -# >>>>> OS/2 INF/HLP <<<<< (source: Daniel Dissett ddissett@netcom.com) -# Carl Hauser (chauser.parc@xerox.com) and -# Marcus Groeber (marcusg@ph-cip.uni-koeln.de) -# list the following header format in inf02a.doc: -# -# int16 ID; // ID magic word (5348h = "HS") -# int8 unknown1; // unknown purpose, could be third letter of ID -# int8 flags; // probably a flag word... -# // bit 0: set if INF style file -# // bit 4: set if HLP style file -# // patching this byte allows reading HLP files -# // using the VIEW command, while help files -# // seem to work with INF settings here as well. -# int16 hdrsize; // total size of header -# int16 unknown2; // unknown purpose -# -0 string HSP\x01\x9b\x00 OS/2 INF ->107 string >0 (%s) -0 string HSP\x10\x9b\x00 OS/2 HLP ->107 string >0 (%s) - -# OS/2 INI (this is a guess) -0 string \xff\xff\xff\xff\x14\0\0\0 OS/2 INI diff --git a/contrib/file/Magdir/os9 b/contrib/file/Magdir/os9 deleted file mode 100644 index 95d23f19980c6..0000000000000 --- a/contrib/file/Magdir/os9 +++ /dev/null @@ -1,86 +0,0 @@ -# -# $NetBSD: os9,v 1.2 1997/01/09 20:19:04 tls Exp $ -# -# Copyright (c) 1996 Ignatios Souvatzis. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. All advertising materials mentioning features or use of this software -# must display the following acknowledgement: -# This product includes software developed by Ignatios Souvatzis for -# the NetBSD project. -# 4. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# -# -# OS9/6809 module descriptions: -# -0 beshort 0x87CD OS9/6809 module: -# ->6 byte&0x0f 0x00 non-executable ->6 byte&0x0f 0x01 machine language ->6 byte&0x0f 0x02 BASIC I-code ->6 byte&0x0f 0x03 P-code ->6 byte&0x0f 0x04 C I-code ->6 byte&0x0f 0x05 COBOL I-code ->6 byte&0x0f 0x06 FORTRAN I-code -# ->6 byte&0xf0 0x10 program executable ->6 byte&0xf0 0x20 subroutine ->6 byte&0xf0 0x30 multi-module ->6 byte&0xf0 0x40 data module -# ->6 byte&0xf0 0xC0 system module ->6 byte&0xf0 0xD0 file manager ->6 byte&0xf0 0xE0 device driver ->6 byte&0xf0 0xF0 device descriptor -# -# OS9/m68k stuff (to be continued) -# -0 beshort 0x4AFC OS9/68K module: -# -# attr ->14 byte&0x80 0x80 re-entrant ->14 byte&0x40 0x40 ghost ->14 byte&0x20 0x20 system-state -# -# lang: -# ->13 byte 1 machine language ->13 byte 2 BASIC I-code ->13 byte 3 P-code ->13 byte 4 C I-code ->13 byte 5 COBOL I-code ->13 byte 6 Fortran I-code -# -# -# type: -# ->12 byte 1 program executable ->12 byte 2 subroutine ->12 byte 3 multi-module ->12 byte 4 data module ->12 byte 11 trap library ->12 byte 12 system module ->12 byte 13 file manager ->12 byte 14 device driver ->12 byte 15 device descriptor diff --git a/contrib/file/Magdir/osf1 b/contrib/file/Magdir/osf1 deleted file mode 100644 index 31166c1f34b72..0000000000000 --- a/contrib/file/Magdir/osf1 +++ /dev/null @@ -1,7 +0,0 @@ -# -# Mach magic number info -# -0 long 0xefbe OSF/Rose object -# I386 magic number info -# -0 short 0565 i386 COFF object diff --git a/contrib/file/Magdir/palm b/contrib/file/Magdir/palm deleted file mode 100644 index 46bc632e1521f..0000000000000 --- a/contrib/file/Magdir/palm +++ /dev/null @@ -1,15 +0,0 @@ - -#------------------------------------------------------------------------------ -# palm: file(1) magic for PalmOS {.prc,.pdb}: applications, docfiles, and hacks -# -# Brian Lalor <blalor@hcirisc.cs.binghamton.edu> - -# appl -60 belong 0x6170706c PalmOS application ->0 string >\0 "%s" -# TEXt -60 belong 0x54455874 AportisDoc file ->0 string >\0 "%s" -# HACK -60 belong 0x4841434b HackMaster hack ->0 string >\0 "%s" diff --git a/contrib/file/Magdir/pbm b/contrib/file/Magdir/pbm deleted file mode 100644 index 98c15f79485c4..0000000000000 --- a/contrib/file/Magdir/pbm +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# pbm: file(1) magic for Portable Bitmap files -# -# XXX - byte order? -# -0 short 0x2a17 "compact bitmap" format (Poskanzer) diff --git a/contrib/file/Magdir/pdf b/contrib/file/Magdir/pdf deleted file mode 100644 index a1aef1339372e..0000000000000 --- a/contrib/file/Magdir/pdf +++ /dev/null @@ -1,7 +0,0 @@ -#------------------------------------------------------------------------------ -# pdf: file(1) magic for Portable Document Format -# - -0 string %PDF- PDF document ->5 byte x \b, version %c ->7 byte x \b.%c diff --git a/contrib/file/Magdir/pdp b/contrib/file/Magdir/pdp deleted file mode 100644 index 545200529d8bf..0000000000000 --- a/contrib/file/Magdir/pdp +++ /dev/null @@ -1,35 +0,0 @@ - -#------------------------------------------------------------------------------ -# pdp: file(1) magic for PDP-11 executable/object and APL workspace -# -0 lelong 0101555 PDP-11 single precision APL workspace -0 lelong 0101554 PDP-11 double precision APL workspace -# -# PDP-11 a.out -# -0 leshort 0407 PDP-11 executable ->8 leshort >0 not stripped ->15 byte >0 - version %ld - -0 leshort 0401 PDP-11 UNIX/RT ldp -0 leshort 0405 PDP-11 old overlay - -0 leshort 0410 PDP-11 pure executable ->8 leshort >0 not stripped ->15 byte >0 - version %ld - -0 leshort 0411 PDP-11 separate I&D executable ->8 leshort >0 not stripped ->15 byte >0 - version %ld - -0 leshort 0437 PDP-11 kernel overlay - -# These last three are derived from 2.11BSD file(1) -0 leshort 0413 PDP-11 demand-paged pure executable ->8 leshort >0 not stripped - -0 leshort 0430 PDP-11 overlaid pure executable ->8 leshort >0 not stripped - -0 leshort 0431 PDP-11 overlaid separate executable ->8 leshort >0 not stripped diff --git a/contrib/file/Magdir/pgp b/contrib/file/Magdir/pgp deleted file mode 100644 index 038d098ee4acd..0000000000000 --- a/contrib/file/Magdir/pgp +++ /dev/null @@ -1,13 +0,0 @@ - -#------------------------------------------------------------------------------ -# pgp: file(1) magic for Pretty Good Privacy -# -0 beshort 0x9900 PGP key public ring -0 beshort 0x9501 PGP key security ring -0 beshort 0x9500 PGP key security ring -0 beshort 0xa600 PGP encrypted data -0 string -----BEGIN\040PGP PGP armored data ->15 string PUBLIC\040KEY\040BLOCK- public key block ->15 string MESSAGE- message ->15 string SIGNED\040MESSAGE- signed message ->15 string PGP\040SIGNATURE- signature diff --git a/contrib/file/Magdir/pkgadd b/contrib/file/Magdir/pkgadd deleted file mode 100644 index dc8ef5d93ab4d..0000000000000 --- a/contrib/file/Magdir/pkgadd +++ /dev/null @@ -1,5 +0,0 @@ - -#------------------------------------------------------------------------------ -# pkgadd: file(1) magic for SysV R4 PKG Datastreams -# -0 string #\ PaCkAgE\ DaTaStReAm pkg Datastream (SVR4) diff --git a/contrib/file/Magdir/plus5 b/contrib/file/Magdir/plus5 deleted file mode 100644 index acf3bf4037b60..0000000000000 --- a/contrib/file/Magdir/plus5 +++ /dev/null @@ -1,17 +0,0 @@ - -#------------------------------------------------------------------------------ -# plus5: file(1) magic for Plus Five's UNIX MUMPS -# -# XXX - byte order? Paging Hokey.... -# -0 short 0x259 mumps avl global ->2 byte >0 (V%d) ->6 byte >0 with %d byte name ->7 byte >0 and %d byte data cells -0 short 0x25a mumps blt global ->2 byte >0 (V%d) ->8 short >0 - %d byte blocks ->15 byte 0x00 - P/D format ->15 byte 0x01 - P/K/D format ->15 byte 0x02 - K/D format ->15 byte >0x02 - Bad Flags diff --git a/contrib/file/Magdir/printer b/contrib/file/Magdir/printer deleted file mode 100644 index c47ff3baa6e5e..0000000000000 --- a/contrib/file/Magdir/printer +++ /dev/null @@ -1,88 +0,0 @@ - -#------------------------------------------------------------------------------ -# printer: file(1) magic for printer-formatted files -# - -# PostScript, updated by Daniel Quinlan (quinlan@yggdrasil.com) -0 string %! PostScript document text ->2 string PS-Adobe- conforming ->>11 string >\0 at level %.3s ->>>15 string EPS - type %s ->>>15 string Query - type %s ->>>15 string ExitServer - type %s -# Some PCs have the annoying habit of adding a ^D as a document separator -0 string \004%! PostScript document text ->3 string PS-Adobe- conforming ->>12 string >\0 at level %.3s ->>>16 string EPS - type %s ->>>16 string Query - type %s ->>>16 string ExitServer - type %s -0 string \033%-12345X%!PS PostScript document - - -# DOS EPS Binary File Header -# From: Ed Sznyter <ews@Black.Market.NET> -0 belong 0xC5D0D3C6 DOS EPS Binary File ->4 long >0 Postscript starts at byte %d ->>8 long >0 length %d ->>>12 long >0 Metafile starts at byte %d ->>>>16 long >0 length %d ->>>20 long >0 TIFF starts at byte %d ->>>>24 long >0 length %d - -# Adobe's PostScript Printer Description (PPD) files -# Yves Arrouye <arrouye@marin.fdn.fr> -# -0 string *PPD-Adobe: PPD file ->13 string x \b, ve - -# HP Printer Job Language -0 string \033%-12345X@PJL HP Printer Job Language data -# HP Printer Job Language -# The header found on Win95 HP plot files is the "Silliest Thing possible" -# (TM) -# Every driver puts the language at some random position, with random case -# (LANGUAGE and Language) -# For example the LaserJet 5L driver puts the "PJL ENTER LANGUAGE" in line 10 -# From: Uwe Bonnes <bon@elektron.ikp.physik.th-darmstadt.de> -# -0 string \033%-12345X@PJL HP Printer Job Language data ->&0 string >\0 %s ->>&0 string >\0 %s ->>>&0 string >\0 %s ->>>>&0 string >\0 %s -#>15 string \ ENTER\ LANGUAGE\ = -#>31 string PostScript PostScript - -# HP Printer Control Language, Daniel Quinlan (quinlan@yggdrasil.com) -0 string \033E\033 HP PCL printer data ->3 string \&l0A - default page size ->3 string \&l1A - US executive page size ->3 string \&l2A - US letter page size ->3 string \&l3A - US legal page size ->3 string \&l26A - A4 page size ->3 string \&l80A - Monarch envelope size ->3 string \&l81A - No. 10 envelope size ->3 string \&l90A - Intl. DL envelope size ->3 string \&l91A - Intl. C5 envelope size ->3 string \&l100A - Intl. B5 envelope size ->3 string \&l-81A - No. 10 envelope size (landscape) ->3 string \&l-90A - Intl. DL envelope size (landscape) - -# IMAGEN printer-ready files: -0 string @document( Imagen printer -# this only works if "language xxx" is first item in Imagen header. ->10 string language\ impress (imPRESS data) ->10 string language\ daisy (daisywheel text) ->10 string language\ diablo (daisywheel text) ->10 string language\ printer (line printer emulation) ->10 string language\ tektronix (Tektronix 4014 emulation) -# Add any other languages that your Imagen uses - remember -# to keep the word `text' if the file is human-readable. -# [GRR 950115: missing "postscript" or "ultrascript" (whatever it was called)] -# -# Now magic for IMAGEN font files... -0 string Rast RST-format raster font data ->45 string >0 face % -# From Jukka Ukkonen -0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data diff --git a/contrib/file/Magdir/project b/contrib/file/Magdir/project deleted file mode 100644 index 04e8865c2eca4..0000000000000 --- a/contrib/file/Magdir/project +++ /dev/null @@ -1,9 +0,0 @@ - -#------------------------------------------------------------------------------ -# project: file(1) magic for Project management -# -# Magic strings for ftnchek project files. Alexander Mai -0 string FTNCHEK_\ P project file for ftnchek ->10 string 1 version 2.7 ->10 string 2 version 2.8 to 2.10 ->10 string 3 version 2.11 or later diff --git a/contrib/file/Magdir/psdbms b/contrib/file/Magdir/psdbms deleted file mode 100644 index f36121fcbcd40..0000000000000 --- a/contrib/file/Magdir/psdbms +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# psdbms: file(1) magic for psdatabase -# -0 belong&0xff00ffff 0x56000000 ps database ->1 string >\0 version %s ->4 string >\0 from kernel %s diff --git a/contrib/file/Magdir/pyramid b/contrib/file/Magdir/pyramid deleted file mode 100644 index fe16608436b83..0000000000000 --- a/contrib/file/Magdir/pyramid +++ /dev/null @@ -1,11 +0,0 @@ - -#------------------------------------------------------------------------------ -# pyramid: file(1) magic for Pyramids -# -# XXX - byte order? -# -0 long 0x50900107 Pyramid 90x family executable -0 long 0x50900108 Pyramid 90x family pure executable ->16 long >0 not stripped -0 long 0x5090010b Pyramid 90x family demand paged pure executable ->16 long >0 not stripped diff --git a/contrib/file/Magdir/python b/contrib/file/Magdir/python deleted file mode 100644 index 2e7bbe75378f4..0000000000000 --- a/contrib/file/Magdir/python +++ /dev/null @@ -1,5 +0,0 @@ -# often the module starts with a multiline string -0 string """ a python script text executable -# MAGIC as specified in Python/import.c (1.5.2/1.6) -# 20121 ( YEAR - 1995 ) + MONTH + DAY (little endian followed by "\r\n" -0 belong 0x994e0d0a python compiled diff --git a/contrib/file/Magdir/rpm b/contrib/file/Magdir/rpm deleted file mode 100644 index 14ad6db93642d..0000000000000 --- a/contrib/file/Magdir/rpm +++ /dev/null @@ -1,17 +0,0 @@ -#------------------------------------------------------------------------------ -# -# RPM: file(1) magic for Red Hat Packages Erik Troan (ewt@redhat.com) -# -0 beshort 0xedab ->2 beshort 0xeedb RPM ->>4 byte x v%d ->>6 beshort 0 bin ->>6 beshort 1 src ->>8 beshort 1 i386 ->>8 beshort 2 Alpha ->>8 beshort 3 Sparc ->>8 beshort 4 MIPS ->>8 beshort 5 PowerPC ->>8 beshort 6 68000 ->>8 beshort 7 SGI ->>10 string x %s diff --git a/contrib/file/Magdir/rtf b/contrib/file/Magdir/rtf deleted file mode 100644 index 8e2d4166fa58d..0000000000000 --- a/contrib/file/Magdir/rtf +++ /dev/null @@ -1,12 +0,0 @@ - -#------------------------------------------------------------------------------ -# rtf: file(1) magic for Rich Text Format (RTF) -# -# Duncan P. Simpson, D.P.Simpson@dcs.warwick.ac.uk -# -0 string {\\rtf Rich Text Format data, ->5 byte x version %c, ->6 string \\ansi ANSI ->6 string \\mac Apple Macintosh ->6 string \\pc IBM PC, code page 437 ->6 string \\pca IBM PS/2, code page 850 diff --git a/contrib/file/Magdir/sc b/contrib/file/Magdir/sc deleted file mode 100644 index 98599f264781f..0000000000000 --- a/contrib/file/Magdir/sc +++ /dev/null @@ -1,5 +0,0 @@ - -#------------------------------------------------------------------------------ -# sc: file(1) magic for "sc" spreadsheet -# -38 string Spreadsheet sc spreadsheet file diff --git a/contrib/file/Magdir/sccs b/contrib/file/Magdir/sccs deleted file mode 100644 index 11d50b23c003d..0000000000000 --- a/contrib/file/Magdir/sccs +++ /dev/null @@ -1,21 +0,0 @@ - -#------------------------------------------------------------------------------ -# sccs: file(1) magic for SCCS archives -# -# SCCS archive structure: -# \001h01207 -# \001s 00276/00000/00000 -# \001d D 1.1 87/09/23 08:09:20 ian 1 0 -# \001c date and time created 87/09/23 08:09:20 by ian -# \001e -# \001u -# \001U -# ... etc. -# Now '\001h' happens to be the same as the 3B20's a.out magic number (0550). -# *Sigh*. And these both came from various parts of the USG. -# Maybe we should just switch everybody from SCCS to RCS! -# Further, you can't just say '\001h0', because the five-digit number -# is a checksum that could (presumably) have any leading digit, -# and we don't have regular expression matching yet. -# Hence the following official kludge: -8 string \001s\ SCCS archive data diff --git a/contrib/file/Magdir/sendmail b/contrib/file/Magdir/sendmail deleted file mode 100644 index 503ef8967ad5f..0000000000000 --- a/contrib/file/Magdir/sendmail +++ /dev/null @@ -1,10 +0,0 @@ - -#------------------------------------------------------------------------------ -# sendmail: file(1) magic for sendmail config files -# -# XXX - byte order? -# -0 byte 046 Sendmail frozen configuration ->16 string >\0 - version %s -0 short 0x271c Sendmail frozen configuration ->16 string >\0 - version %s diff --git a/contrib/file/Magdir/sequent b/contrib/file/Magdir/sequent deleted file mode 100644 index e6f7b52aacb18..0000000000000 --- a/contrib/file/Magdir/sequent +++ /dev/null @@ -1,34 +0,0 @@ - -#------------------------------------------------------------------------------ -# sequent: file(1) magic for Sequent machines -# -# Sequent information updated by Don Dwiggins <atsun!dwiggins>. -# For Sequent's multiprocessor systems (incomplete). -0 lelong 0x00ea BALANCE NS32000 .o ->16 lelong >0 not stripped ->124 lelong >0 version %ld -0 lelong 0x10ea BALANCE NS32000 executable (0 @ 0) ->16 lelong >0 not stripped ->124 lelong >0 version %ld -0 lelong 0x20ea BALANCE NS32000 executable (invalid @ 0) ->16 lelong >0 not stripped ->124 lelong >0 version %ld -0 lelong 0x30ea BALANCE NS32000 standalone executable ->16 lelong >0 not stripped ->124 lelong >0 version %ld -# -# Symmetry information added by Jason Merrill <jason@jarthur.claremont.edu>. -# Symmetry magic nums will not be reached if DOS COM comes before them; -# byte 0xeb is matched before these get a chance. -0 leshort 0x12eb SYMMETRY i386 .o ->16 lelong >0 not stripped ->124 lelong >0 version %ld -0 leshort 0x22eb SYMMETRY i386 executable (0 @ 0) ->16 lelong >0 not stripped ->124 lelong >0 version %ld -0 leshort 0x32eb SYMMETRY i386 executable (invalid @ 0) ->16 lelong >0 not stripped ->124 lelong >0 version %ld -0 leshort 0x42eb SYMMETRY i386 standalone executable ->16 lelong >0 not stripped ->124 lelong >0 version %ld diff --git a/contrib/file/Magdir/sgml b/contrib/file/Magdir/sgml deleted file mode 100644 index e831c3c3f9e03..0000000000000 --- a/contrib/file/Magdir/sgml +++ /dev/null @@ -1,20 +0,0 @@ - -#------------------------------------------------------------------------------ -# sgml: file(1) magic for Standard Generalized Markup Language -# HyperText Markup Language (HTML) is an SGML document type, -# from Daniel Quinlan (quinlan@yggdrasil.com) -# adapted to string extenstions by Anthon van der Neut <anthon@mnt.org) -0 string/cB \<!doctype\ html HTML document text -0 string/c \<head HTML document text -0 string/c \<title HTML document text -0 string/c \<html HTML document text - -# Extensible markup language (XML), a subset of SGML -# from Marc Prud'hommeaux (marc@apocalypse.org) -0 string/c \<?xml XML document text - - -# SGML, mostly from rph@sq -0 string/c \<!doctype exported SGML document text -0 string/c \<!subdoc exported SGML subdocument text -0 string \<!-- exported SGML document text diff --git a/contrib/file/Magdir/sniffer b/contrib/file/Magdir/sniffer deleted file mode 100644 index 81cb3130c6166..0000000000000 --- a/contrib/file/Magdir/sniffer +++ /dev/null @@ -1,171 +0,0 @@ - -#------------------------------------------------------------------------------ -# sniffer: file(1) magic for packet capture files -# -# From: guy@alum.mit.edu (Guy Harris) -# - -# -# Microsoft Network Monitor 1.x capture files. -# -0 string RTSS NetMon capture file ->4 byte x - version %d ->5 byte x \b.%d ->6 leshort 0 (Unknown) ->6 leshort 1 (Ethernet) ->6 leshort 2 (Token Ring) ->6 leshort 3 (FDDI) - -# -# Microsoft Network Monitor 2.x capture files. -# -0 string GMBU NetMon capture file ->4 byte x - version %d ->5 byte x \b.%d ->6 leshort 0 (Unknown) ->6 leshort 1 (Ethernet) ->6 leshort 2 (Token Ring) ->6 leshort 3 (FDDI) - -# -# Network General Sniffer capture files. -# Sorry, make that "Network Associates Sniffer capture files." -# -0 string TRSNIFF\ data\ \ \ \ \032 Sniffer capture file ->33 byte 2 (compressed) ->23 leshort x - version %d ->25 leshort x \b.%d ->32 byte 0 (Token Ring) ->32 byte 1 (Ethernet) ->32 byte 2 (ARCNET) ->32 byte 3 (StarLAN) ->32 byte 4 (PC Network broadband) ->32 byte 5 (LocalTalk) ->32 byte 6 (Znet) ->32 byte 7 (Internetwork Analyzer) ->32 byte 9 (FDDI) ->32 byte 10 (ATM) - -# -# Cinco Networks NetXRay capture files. -# Sorry, make that "Network General Sniffer Basic capture files." -# Sorry, make that "Network Associates Sniffer Basic capture files." -# Sorry, make that "Network Associates Sniffer Basic, and Windows -# Sniffer Pro", capture files." -# -0 string XCP\0 NetXRay capture file ->4 string >\0 - version %s ->44 leshort 0 (Ethernet) ->44 leshort 1 (Token Ring) ->44 leshort 2 (FDDI) - -# -# "libpcap" capture files. -# (We call them "tcpdump capture file(s)" for now, as "tcpdump" is -# the main program that uses that format, but there are other programs -# that use "libpcap", or that use the same capture file format.) -# -0 ubelong 0xa1b2c3d4 tcpdump capture file (big-endian) ->4 beshort x - version %d ->6 beshort x \b.%d ->20 belong 0 (No link-layer encapsulation ->20 belong 1 (Ethernet ->20 belong 2 (3Mb Ethernet ->20 belong 3 (AX.25 ->20 belong 4 (ProNET ->20 belong 5 (CHAOS ->20 belong 6 (IEEE 802.x network ->20 belong 7 (ARCNET ->20 belong 8 (SLIP ->20 belong 9 (PPP ->20 belong 10 (FDDI ->20 belong 11 (RFC 1483 ATM ->20 belong 12 (raw IP ->20 belong 13 (BSD/OS SLIP ->20 belong 14 (BSD/OS PPP ->16 belong x \b, capture length %d) -0 ulelong 0xa1b2c3d4 tcpdump capture file (little-endian) ->4 leshort x - version %d ->6 leshort x \b.%d ->20 lelong 0 (No link-layer encapsulation ->20 lelong 1 (Ethernet ->20 lelong 2 (3Mb Ethernet ->20 lelong 3 (AX.25 ->20 lelong 4 (ProNET ->20 lelong 5 (CHAOS ->20 lelong 6 (IEEE 802.x network ->20 lelong 7 (ARCNET ->20 lelong 8 (SLIP ->20 lelong 9 (PPP ->20 lelong 10 (FDDI ->20 lelong 11 (RFC 1483 ATM ->20 lelong 12 (raw IP ->20 lelong 13 (BSD/OS SLIP ->20 lelong 14 (BSD/OS PPP ->16 lelong x \b, capture length %d) - -# -# "libpcap"-with-Alexey-Kuznetsov's-patches capture files. -# (We call them "tcpdump capture file(s)" for now, as "tcpdump" is -# the main program that uses that format, but there are other programs -# that use "libpcap", or that use the same capture file format.) -# -0 ubelong 0xa1b2cd34 extended tcpdump capture file (big-endian) ->4 beshort x - version %d ->6 beshort x \b.%d ->20 belong 0 (No link-layer encapsulation ->20 belong 1 (Ethernet ->20 belong 2 (3Mb Ethernet ->20 belong 3 (AX.25 ->20 belong 4 (ProNET ->20 belong 5 (CHAOS ->20 belong 6 (IEEE 802.x network ->20 belong 7 (ARCNET ->20 belong 8 (SLIP ->20 belong 9 (PPP ->20 belong 10 (FDDI ->20 belong 11 (RFC 1483 ATM ->20 belong 12 (raw IP ->20 belong 13 (BSD/OS SLIP ->20 belong 14 (BSD/OS PPP ->16 belong x \b, capture length %d) -0 ulelong 0xa1b2cd34 extended tcpdump capture file (little-endian) ->4 leshort x - version %d ->6 leshort x \b.%d ->20 lelong 0 (No link-layer encapsulation ->20 lelong 1 (Ethernet ->20 lelong 2 (3Mb Ethernet ->20 lelong 3 (AX.25 ->20 lelong 4 (ProNET ->20 lelong 5 (CHAOS ->20 lelong 6 (IEEE 802.x network ->20 lelong 7 (ARCNET ->20 lelong 8 (SLIP ->20 lelong 9 (PPP ->20 lelong 10 (FDDI ->20 lelong 11 (RFC 1483 ATM ->20 lelong 12 (raw IP ->20 lelong 13 (BSD/OS SLIP ->20 lelong 14 (BSD/OS PPP ->16 lelong x \b, capture length %d) - -# -# AIX "iptrace" capture files. -# -0 string iptrace\ 2.0 "iptrace" capture file - -# -# Novell LANalyzer capture files. -# -0 leshort 0x1001 LANalyzer capture file -0 leshort 0x1007 LANalyzer capture file - -# -# HP-UX "nettl" capture files. -# -0 string \x54\x52\x00\x64\x00 "nettl" capture file - -# -# RADCOM WAN/LAN Analyzer capture files. -# -0 string \x42\xd2\x00\x34\x12\x66\x22\x88 RADCOM WAN/LAN Analyzer capture file diff --git a/contrib/file/Magdir/softquad b/contrib/file/Magdir/softquad deleted file mode 100644 index ffad996caa6ea..0000000000000 --- a/contrib/file/Magdir/softquad +++ /dev/null @@ -1,30 +0,0 @@ - -#------------------------------------------------------------------------------ -# softquad: file(1) magic for SoftQuad Publishing Software -# -# $Id: softquad,v 1.9 1995/01/21 21:09:00 christos Exp $ -# Author/Editor and RulesBuilder -# -# XXX - byte order? -# -0 string \<!SQ\ DTD> Compiled SGML rules file ->9 string >\0 Type %s -0 string \<!SQ\ A/E> A/E SGML Document binary ->9 string >\0 Type %s -0 string \<!SQ\ STS> A/E SGML binary styles file ->9 string >\0 Type %s -0 short 0xc0de Compiled PSI (v1) data -0 short 0xc0da Compiled PSI (v2) data ->3 string >\0 (%s) -# Binary sqtroff font/desc files... -0 short 0125252 SoftQuad DESC or font file binary ->2 short >0 - version %d -# Bitmaps... -0 string SQ\ BITMAP1 SoftQuad Raster Format text -#0 string SQ\ BITMAP2 SoftQuad Raster Format data -# sqtroff intermediate language (replacement for ditroff int. lang.) -0 string X\ SoftQuad troff Context intermediate ->2 string 495 for AT&T 495 laser printer ->2 string hp for Hewlett-Packard LaserJet ->2 string impr for IMAGEN imPRESS ->2 string ps for PostScript diff --git a/contrib/file/Magdir/spectrum b/contrib/file/Magdir/spectrum deleted file mode 100644 index e7a5549b675aa..0000000000000 --- a/contrib/file/Magdir/spectrum +++ /dev/null @@ -1,28 +0,0 @@ - -#------------------------------------------------------------------------------ -# spectrum: file(1) magic for Spectrum emulator files. -# -# John Elliott <jce@seasip.demon.co.uk> - -# -# Spectrum +3DOS header -# -0 string PLUS3DOS\032 Spectrum +3 data ->15 byte 0 - BASIC program ->15 byte 1 - number array ->15 byte 2 - character array ->15 byte 3 - memory block ->>16 belong 0x001B0040 (screen) ->15 byte 4 - Tasword document ->15 string TAPEFILE - ZXT tapefile -# -# Tape file. This assumes the .TAP starts with a Spectrum-format header, -# which nearly all will. -# -0 string \023\000\000 Spectrum .TAP data ->4 string x "%-10.10s" ->3 byte 0 - BASIC program ->3 byte 1 - number array ->3 byte 2 - character array ->3 byte 3 - memory block ->>14 belong 0x001B0040 (screen) diff --git a/contrib/file/Magdir/sun b/contrib/file/Magdir/sun deleted file mode 100644 index 10f30b4627dca..0000000000000 --- a/contrib/file/Magdir/sun +++ /dev/null @@ -1,107 +0,0 @@ - -#------------------------------------------------------------------------------ -# sun: file(1) magic for Sun machines -# -# Values for big-endian Sun (MC680x0, SPARC) binaries on pre-5.x -# releases. (5.x uses ELF.) -# -0 belong&077777777 0600413 sparc demand paged ->0 byte &0x80 ->>20 belong <4096 shared library ->>20 belong =4096 dynamically linked executable ->>20 belong >4096 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped -0 belong&077777777 0600410 sparc pure ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped -0 belong&077777777 0600407 sparc ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped - -0 belong&077777777 0400413 mc68020 demand paged ->0 byte &0x80 ->>20 belong <4096 shared library ->>20 belong =4096 dynamically linked executable ->>20 belong >4096 dynamically linked executable ->16 belong >0 not stripped -0 belong&077777777 0400410 mc68020 pure ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped -0 belong&077777777 0400407 mc68020 ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped - -0 belong&077777777 0200413 mc68010 demand paged ->0 byte &0x80 ->>20 belong <4096 shared library ->>20 belong =4096 dynamically linked executable ->>20 belong >4096 dynamically linked executable ->16 belong >0 not stripped -0 belong&077777777 0200410 mc68010 pure ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped -0 belong&077777777 0200407 mc68010 ->0 byte &0x80 dynamically linked executable ->0 byte ^0x80 executable ->16 belong >0 not stripped - -# reworked these to avoid anything beginning with zero becoming "old sun-2" -0 belong 0407 old sun-2 executable ->16 belong >0 not stripped -0 belong 0410 old sun-2 pure executable ->16 belong >0 not stripped -0 belong 0413 old sun-2 demand paged executable ->16 belong >0 not stripped - -# -# Core files. "SPARC 4.x BCP" means "core file from a SunOS 4.x SPARC -# binary executed in compatibility mode under SunOS 5.x". -# -0 belong 0x080456 SunOS core file ->4 belong 432 (SPARC) ->>132 string >\0 from '%s' ->>116 belong =3 (quit) ->>116 belong =4 (illegal instruction) ->>116 belong =5 (trace trap) ->>116 belong =6 (abort) ->>116 belong =7 (emulator trap) ->>116 belong =8 (arithmetic exception) ->>116 belong =9 (kill) ->>116 belong =10 (bus error) ->>116 belong =11 (segmentation violation) ->>116 belong =12 (bad argument to system call) ->>116 belong =29 (resource lost) ->>120 belong x (T=%dK, ->>124 belong x D=%dK, ->>128 belong x S=%dK) ->4 belong 826 (68K) ->>128 string >\0 from '%s' ->4 belong 456 (SPARC 4.x BCP) ->>152 string >\0 from '%s' -# Sun SunPC -0 long 0xfa33c08e SunPC 4.0 Hard Disk -0 string #SUNPC_CONFIG SunPC 4.0 Properties Values -# Sun snoop (see RFC 1761, which describes the capture file format). -# -0 string snoop Snoop capture file ->8 belong >0 - version %ld ->12 belong 0 (IEEE 802.3) ->12 belong 1 (IEEE 802.4) ->12 belong 2 (IEEE 802.5) ->12 belong 3 (IEEE 802.6) ->12 belong 4 (Ethernet) ->12 belong 5 (HDLC) ->12 belong 6 (Character synchronous) ->12 belong 7 (IBM channel-to-channel adapter) ->12 belong 8 (FDDI) ->12 belong 9 (Unknown) -# Sun KCMS -36 string acsp Kodak Color Management System, ICC Profile - - diff --git a/contrib/file/Magdir/teapot b/contrib/file/Magdir/teapot deleted file mode 100644 index d9554bfb738e8..0000000000000 --- a/contrib/file/Magdir/teapot +++ /dev/null @@ -1,4 +0,0 @@ -#------------------------------------------------------------------------------ -# teapot: file(1) magic for "teapot" spreadsheet -# -0 string #!teapot\012xdr teapot work sheet (XDR format) diff --git a/contrib/file/Magdir/terminfo b/contrib/file/Magdir/terminfo deleted file mode 100644 index 2226ce8cee532..0000000000000 --- a/contrib/file/Magdir/terminfo +++ /dev/null @@ -1,9 +0,0 @@ - -#------------------------------------------------------------------------------ -# terminfo: file(1) magic for terminfo -# -# XXX - byte order for screen images? -# -0 string \032\001 Compiled terminfo entry -0 short 0433 Curses screen image -0 short 0434 Curses screen image diff --git a/contrib/file/Magdir/tex b/contrib/file/Magdir/tex deleted file mode 100644 index 79d5bbaaf73b2..0000000000000 --- a/contrib/file/Magdir/tex +++ /dev/null @@ -1,47 +0,0 @@ - -#------------------------------------------------------------------------------ -# tex: file(1) magic for TeX files -# -# From <conklin@talisman.kaleida.com> - -# Although we may know the offset of certain text fields in TeX DVI -# and font files, we can't use them reliably because they are not -# zero terminated. [but we do anyway, christos] -0 string \367\002 TeX DVI file ->16 string >\0 (%s) -0 string \367\203 TeX generic font data -0 string \367\131 TeX packed font data ->3 string >\0 (%s) -0 string \367\312 TeX virtual font data -0 string This\ is\ TeX, TeX transcript text -0 string This\ is\ METAFONT, METAFONT transcript text - -# There is no way to detect TeX Font Metric (*.tfm) files without -# breaking them apart and reading the data. The following patterns -# match most *.tfm files generated by METAFONT or afm2tfm. -2 string \000\021 TeX font metric data ->33 string >\0 (%s) -2 string \000\022 TeX font metric data ->33 string >\0 (%s) - -# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com) -0 string \\input\ texinfo Texinfo source text -0 string This\ is\ Info\ file GNU Info text - -# TeX documents, from Daniel Quinlan (quinlan@yggdrasil.com) -0 string \\input TeX document text -0 string \\section LaTeX document text -0 string \\setlength LaTeX document text -0 string \\documentstyle LaTeX document text -0 string \\chapter LaTeX document text -0 string \\documentclass LaTeX 2e document text -0 string \\relax LaTeX auxiliary file -0 string \\contentsline LaTeX table of contents - -# Index and glossary files -0 string \\indexentry LaTeX raw index file -0 string \\begin{theindex} LaTeX sorted index -0 string \\glossaryentry LaTeX raw glossary -0 string \\begin{theglossary} LaTeX sorted glossary -0 string This\ is\ makeindex Makeindex log file -# End of TeX diff --git a/contrib/file/Magdir/ti-8x b/contrib/file/Magdir/ti-8x deleted file mode 100644 index d740060a5b442..0000000000000 --- a/contrib/file/Magdir/ti-8x +++ /dev/null @@ -1,36 +0,0 @@ -# ------------------------------------------------------------------------ -# ti-8x: file(1) magic for the TI-8x and TI-92 Graphing Calculators. -# -# From: Ryan McGuire (rmcguire@freenet.columbus.oh.us). -# -# NOTE: This list is not complete. -# -# Magic Numbers for the TI-82 -# -0 string **TI82** TI-82 Graphing Calculator ->0x000037 byte 0x0B TI-BASIC Group/Program File. -# -# Magic Numbers for the TI-83 -# -0 string **TI83** TI-83 Graphing Calculator ->0x000037 byte 0x0B TI-BASIC Group/Program File. -# -# Magic Numbers for the TI-85 -# -0 string **TI85** TI-85 Graphing Calculator ->11 string Backup Backup File. ->0x000032 string ZS4 - ZShell Version 4 File. ->0x000032 string ZS3 - ZShell Version 3 File. ->0x00000B string GDatabase Graphics Database. ->0x00003B byte 0x12 TI-BASIC Group/Program File. -# -# Magic Numbers for the TI-92 -# -0 string **TI92** TI-92 Graphing Calculator ->0x000058 byte 0x12 TI-BASIC Group File. ->0x000012 string Function Function. ->0x000048 byte 0x12 TI-BASIC Program. -# Files for the TI-80 and TI-81 are pretty rare. I'm not going to put the -# program/group magic numbers in here because I cannot find any. -0 string **TI80** TI-80 Graphing Calculator File. -0 string **TI81** TI-81 Graphing Calculator File. diff --git a/contrib/file/Magdir/timezone b/contrib/file/Magdir/timezone deleted file mode 100644 index 40e7558f8de10..0000000000000 --- a/contrib/file/Magdir/timezone +++ /dev/null @@ -1,14 +0,0 @@ - -#------------------------------------------------------------------------------ -# timezone: file(1) magic for timezone data -# -# from Daniel Quinlan (quinlan@yggdrasil.com) -# this should work on Linux, SunOS, and maybe others -# Added new official magic number for recent versions of the Olson code -0 string TZif timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1\0 old timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0 old timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\3\0 old timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0 old timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0 old timezone data -0 string \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0 old timezone data diff --git a/contrib/file/Magdir/troff b/contrib/file/Magdir/troff deleted file mode 100644 index ec964e8e2b97a..0000000000000 --- a/contrib/file/Magdir/troff +++ /dev/null @@ -1,27 +0,0 @@ - -#------------------------------------------------------------------------------ -# troff: file(1) magic for *roff -# -# updated by Daniel Quinlan (quinlan@yggdrasil.com) - -# troff input -0 string .\\" troff or preprocessor input text -0 string '\\" troff or preprocessor input text -0 string '.\\" troff or preprocessor input text -0 string \\" troff or preprocessor input text - -# ditroff intermediate output text -0 string x\ T ditroff output text ->4 string cat for the C/A/T phototypesetter ->4 string ps for PostScript ->4 string dvi for DVI ->4 string ascii for ASCII ->4 string lj4 for LaserJet 4 ->4 string latin1 for ISO 8859-1 (Latin 1) ->4 string X75 for xditview at 75dpi ->>7 string -12 (12pt) ->4 string X100 for xditview at 100dpi ->>8 string -12 (12pt) - -# output data formats -0 string \100\357 very old (C/A/T) troff output data diff --git a/contrib/file/Magdir/typeset b/contrib/file/Magdir/typeset deleted file mode 100644 index 2eda7c3e413f5..0000000000000 --- a/contrib/file/Magdir/typeset +++ /dev/null @@ -1,7 +0,0 @@ - -#------------------------------------------------------------------------------ -# typeset: file(1) magic for other typesetting -# -0 string Interpress/Xerox Xerox InterPress data ->16 string / (version ->>17 string >\0 %s) diff --git a/contrib/file/Magdir/unknown b/contrib/file/Magdir/unknown deleted file mode 100644 index 843dc2936db0c..0000000000000 --- a/contrib/file/Magdir/unknown +++ /dev/null @@ -1,36 +0,0 @@ - -#------------------------------------------------------------------------------ -# unknown: file(1) magic for unknown machines -# -# XXX - this probably should be pruned, as it'll match PDP-11 and -# VAX image formats. -# -# 0x107 is 0407; 0x108 is 0410; both are PDP-11 (executable and pure, -# respectively). -# -# 0x109 is 0411; that's PDP-11 split I&D, but the PDP-11 version doesn't -# have the "version %ld", which may be a bogus COFFism (I don't think -# there ever was COFF for the PDP-11). -# -# 0x10B is 0413; that's VAX demand-paged, but this is a short, not a -# long, as it would be on a VAX. -# -# 0x10C is 0414, 0x10D is 0415, and 0x10E is 416; those *are* unknown. -# -0 short 0x107 unknown machine executable ->8 short >0 not stripped ->15 byte >0 - version %ld -0 short 0x108 unknown pure executable ->8 short >0 not stripped ->15 byte >0 - version %ld -0 short 0x109 PDP-11 separate I&D ->8 short >0 not stripped ->15 byte >0 - version %ld -0 short 0x10b unknown pure executable ->8 short >0 not stripped ->15 byte >0 - version %ld -0 long 0x10c unknown demand paged pure executable ->16 long >0 not stripped -0 long 0x10d unknown demand paged pure executable ->16 long >0 not stripped -0 long 0x10e unknown readable demand paged pure executable diff --git a/contrib/file/Magdir/uuencode b/contrib/file/Magdir/uuencode deleted file mode 100644 index 7e88619d5ca96..0000000000000 --- a/contrib/file/Magdir/uuencode +++ /dev/null @@ -1,30 +0,0 @@ - -#------------------------------------------------------------------------------ -# uuencode: file(1) magic for ASCII-encoded files -# - -# GRR: the first line of xxencoded files is identical to that in uuencoded -# files, but the first character in most subsequent lines is 'h' instead of -# 'M'. (xxencoding uses lowercase letters in place of most of uuencode's -# punctuation and survives BITNET gateways better.) If regular expressions -# were supported, this entry could possibly be split into two with -# "begin\040\.\*\012M" or "begin\040\.\*\012h" (where \. and \* are REs). -0 string begin\040 uuencoded or xxencoded text - -# btoa(1) is an alternative to uuencode that requires less space. -0 string xbtoa\ Begin btoa'd text - -# ship(1) is another, much cooler alternative to uuencode. -# Greg Roelofs, newt@uchicago.edu -0 string $\012ship ship'd binary text - -# bencode(8) is used to encode compressed news batches (Bnews/Cnews only?) -# Greg Roelofs, newt@uchicago.edu -0 string Decode\ the\ following\ with\ bdeco bencoded News text - -# BinHex is the Macintosh ASCII-encoded file format (see also "apple") -# Daniel Quinlan, quinlan@yggdrasil.com -11 string must\ be\ converted\ with\ BinHex BinHex binary text ->41 string x \b, version %.3s - -# GRR: is MIME BASE64 encoding handled somewhere? diff --git a/contrib/file/Magdir/vax b/contrib/file/Magdir/vax deleted file mode 100644 index 7dd86ccf53e12..0000000000000 --- a/contrib/file/Magdir/vax +++ /dev/null @@ -1,34 +0,0 @@ - -#------------------------------------------------------------------------------ -# vax: file(1) magic for VAX executable/object and APL workspace -# -0 lelong 0101557 VAX single precision APL workspace -0 lelong 0101556 VAX double precision APL workspace - -# -# VAX a.out (32V, BSD) -# -0 lelong 0407 VAX executable ->16 lelong >0 not stripped - -0 lelong 0410 VAX pure executable ->16 lelong >0 not stripped - -0 lelong 0413 VAX demand paged pure executable ->16 lelong >0 not stripped - -0 lelong 0420 VAX demand paged (first page unmapped) pure executable ->16 lelong >0 not stripped - -# -# VAX COFF -# -# The `versions' should be un-commented if they work for you. -# (Was the problem just one of endianness?) -# -0 leshort 0570 VAX COFF executable ->12 lelong >0 not stripped ->22 leshort >0 - version %ld -0 leshort 0575 VAX COFF pure executable ->12 lelong >0 not stripped ->22 leshort >0 - version %ld diff --git a/contrib/file/Magdir/vicar b/contrib/file/Magdir/vicar deleted file mode 100644 index ab216eeea8161..0000000000000 --- a/contrib/file/Magdir/vicar +++ /dev/null @@ -1,16 +0,0 @@ - -#------------------------------------------------------------------------------ -# vicar: file(1) magic for VICAR files. -# -# From: Ossama Othman <othman@astrosun.tn.cornell.edu -# VICAR is JPL's in-house spacecraft image processing program -# VICAR image -0 string LBLSIZE= VICAR image data ->32 string BYTE \b, 8 bits = VAX byte ->32 string HALF \b, 16 bits = VAX word = Fortran INTEGER*2 ->32 string FULL \b, 32 bits = VAX longword = Fortran INTEGER*4 ->32 string REAL \b, 32 bits = VAX longword = Fortran REAL*4 ->32 string DOUB \b, 64 bits = VAX quadword = Fortran REAL*8 ->32 string COMPLEX \b, 64 bits = VAX quadword = Fortran COMPLEX*8 -# VICAR label file -43 string SFDU_LABEL VICAR label file diff --git a/contrib/file/Magdir/visx b/contrib/file/Magdir/visx deleted file mode 100644 index 491996426091d..0000000000000 --- a/contrib/file/Magdir/visx +++ /dev/null @@ -1,31 +0,0 @@ - -#------------------------------------------------------------------------------ -# visx: file(1) magic for Visx format files -# -0 short 0x5555 VISX image file ->2 byte 0 (zero) ->2 byte 1 (unsigned char) ->2 byte 2 (short integer) ->2 byte 3 (float 32) ->2 byte 4 (float 64) ->2 byte 5 (signed char) ->2 byte 6 (bit-plane) ->2 byte 7 (classes) ->2 byte 8 (statistics) ->2 byte 10 (ascii text) ->2 byte 15 (image segments) ->2 byte 100 (image set) ->2 byte 101 (unsigned char vector) ->2 byte 102 (short integer vector) ->2 byte 103 (float 32 vector) ->2 byte 104 (float 64 vector) ->2 byte 105 (signed char vector) ->2 byte 106 (bit plane vector) ->2 byte 121 (feature vector) ->2 byte 122 (feature vector library) ->2 byte 124 (chain code) ->2 byte 126 (bit vector) ->2 byte 130 (graph) ->2 byte 131 (adjacency graph) ->2 byte 132 (adjacency graph library) ->2 string .VISIX (ascii text) diff --git a/contrib/file/Magdir/vms b/contrib/file/Magdir/vms deleted file mode 100644 index c91186f68c3ef..0000000000000 --- a/contrib/file/Magdir/vms +++ /dev/null @@ -1,27 +0,0 @@ - -#------------------------------------------------------------------------------ -# vms: file(1) magic for VMS executables (experimental) -# -# VMS .exe formats, both VAX and AXP (Greg Roelofs, newt@uchicago.edu) - -# GRR 950122: I'm just guessing on these, based on inspection of the headers -# of three executables each for Alpha and VAX architectures. The VAX files -# all had headers similar to this: -# -# 00000 b0 00 30 00 44 00 60 00 00 00 00 00 30 32 30 35 ..0.D.`.....0205 -# 00010 01 01 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 ................ -# -0 string \xb0\0\x30\0 VMS VAX executable ->44032 string PK\003\004 \b, Info-ZIP SFX archive v5.12 w/decryption -# -# The AXP files all looked like this, except that the byte at offset 0x22 -# was 06 in some of them and 07 in others: -# -# 00000 03 00 00 00 00 00 00 00 ec 02 00 00 10 01 00 00 ................ -# 00010 68 00 00 00 98 00 00 00 b8 00 00 00 00 00 00 00 h............... -# 00020 00 00 07 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -# 00030 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................ -# 00040 00 00 00 00 ff ff ff ff ff ff ff ff 02 00 00 00 ................ -# -0 belong 0x03000000 VMS Alpha executable ->75264 string PK\003\004 \b, Info-ZIP SFX archive v5.12 w/decryption diff --git a/contrib/file/Magdir/vmware b/contrib/file/Magdir/vmware deleted file mode 100644 index 857a4a94524a7..0000000000000 --- a/contrib/file/Magdir/vmware +++ /dev/null @@ -1,12 +0,0 @@ - -# ----------------------------------------------------------- -# VMware specific files (deducted from version 1.1 and log file entries) -# Anthon van der Neut (anthon@mnt.org) -0 belong 0x4d52564e VMware nvram -0 belong 0x434f5744 ->8 byte 3 VMware virtual disk ->>32 lelong x (%d/ ->>36 lelong x \b%d/ ->>40 lelong x \b%d) ->8 byte 2 VMware undoable disk ->>32 string >\0 (%s) diff --git a/contrib/file/Magdir/wordperfect b/contrib/file/Magdir/wordperfect deleted file mode 100644 index c77ac8d1b8881..0000000000000 --- a/contrib/file/Magdir/wordperfect +++ /dev/null @@ -1,91 +0,0 @@ -#WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE -0 string \377WPC\020\000\000\000\022\012\001\001\000\000\000\000 (WP) loadable text ->15 byte 0 Optimized for Intel ->15 byte 1 Optimized for Non-Intel -1 string WPC (Corel/WP) ->8 short 257 WordPerfect macro ->8 short 258 WordPerfect help file ->8 short 259 WordPerfect keyboard file ->8 short 266 WordPerfect document ->8 short 267 WordPerfect dictionary ->8 short 268 WordPerfect thesaurus ->8 short 269 WordPerfect block ->8 short 270 WordPerfect rectangular block ->8 short 271 WordPerfect column block ->8 short 272 WordPerfect printer data ->8 short 275 WordPerfect printer data ->8 short 276 WordPerfect driver resource data ->8 short 279 WordPerfect hyphenation code ->8 short 280 WordPerfect hyphenation data ->8 short 281 WordPerfect macro resource data ->8 short 283 WordPerfect hyphenation lex ->8 short 285 WordPerfect wordlist ->8 short 286 WordPerfect equation resource data ->8 short 289 WordPerfect spell rules ->8 short 290 WordPerfect dictionary rules ->8 short 295 WordPerfect spell rules (Microlytics) ->8 short 299 WordPerfect settings file ->8 short 301 WordPerfect 4.2 document ->8 short 325 WordPerfect dialog file ->8 short 332 WordPerfect button bar ->8 short 513 Shell macro ->8 short 522 Shell definition ->8 short 769 Notebook macro ->8 short 770 Notebook help file ->8 short 771 Notebook keyboard file ->8 short 778 Notebook definition ->8 short 1026 Calculator help file ->8 short 1538 Calendar help file ->8 short 1546 Calendar data file ->8 short 1793 Editor macro ->8 short 1794 Editor help file ->8 short 1795 Editor keyboard file ->8 short 1817 Editor macro resource file ->8 short 2049 Macro editor macro ->8 short 2050 Macro editor help file ->8 short 2051 Macro editor keyboard file ->8 short 2305 PlanPerfect macro ->8 short 2306 PlanPerfect help file ->8 short 2307 PlanPerfect keyboard file ->8 short 2314 PlanPerfect worksheet ->8 short 2319 PlanPerfect printer definition ->8 short 2322 PlanPerfect graphic definition ->8 short 2323 PlanPerfect data ->8 short 2324 PlanPerfect temporary printer ->8 short 2329 PlanPerfect macro resource data ->8 byte 11 Mail ->8 short 2818 help file ->8 short 2821 distribution list ->8 short 2826 out box ->8 short 2827 in box ->8 short 2836 users archived mailbox ->8 short 2837 archived message database ->8 short 2838 archived attachments ->8 short 3083 Printer temporary file ->8 short 3330 Scheduler help file ->8 short 3338 Scheduler in file ->8 short 3339 Scheduler out file ->8 short 3594 GroupWise settings file ->8 short 3601 GroupWise directory services ->8 short 3627 GroupWise settings file ->8 short 4362 Terminal resource data ->8 short 4363 Terminal resource data ->8 short 4395 Terminal resource data ->8 short 4619 GUI loadable text ->8 short 4620 graphics resource data ->8 short 4621 printer settings file ->8 short 4622 port definition file ->8 short 4623 print queue parameters ->8 short 4624 compressed file ->8 short 5130 Network service msg file ->8 short 5131 Network service msg file ->8 short 5132 Async gateway login msg ->8 short 5134 GroupWise message file ->8 short 7956 GroupWise admin domain database ->8 short 7957 GroupWise admin host database ->8 short 7959 GroupWise admin remote host database ->8 short 7960 GroupWise admin ADS deferment data file ->8 short 8458 IntelliTAG (SGML) compiled DTD ->8 long 18219264 WordPerfect graphic image (1.0) ->8 long 18219520 WordPerfect graphic image (2.0) -#end of WordPerfect type files Version 1.6 - PLEASE DO NOT REMOVE THIS LINE diff --git a/contrib/file/Magdir/xdelta b/contrib/file/Magdir/xdelta deleted file mode 100644 index 80c92dac035f4..0000000000000 --- a/contrib/file/Magdir/xdelta +++ /dev/null @@ -1,10 +0,0 @@ - -#------------------------------------------------------------------------------ -# file(1) magic(5) data for xdelta Josh MacDonald <jmacd@CS.Berkeley.EDU> -# -0 string %XDELTA% XDelta binary patch file 0.14 -0 string %XDZ000% XDelta binary patch file 0.18 -0 string %XDZ001% XDelta binary patch file 0.20 -0 string %XDZ002% XDelta binary patch file 1.0 -0 string %XDZ003% XDelta binary patch file 1.0.4 -0 string %XDZ004% XDelta binary patch file 1.1 diff --git a/contrib/file/Magdir/xenix b/contrib/file/Magdir/xenix deleted file mode 100644 index 1acadec62a014..0000000000000 --- a/contrib/file/Magdir/xenix +++ /dev/null @@ -1,72 +0,0 @@ - -#------------------------------------------------------------------------------ -# xenix: file(1) magic for Microsoft Xenix -# -# "Middle model" stuff, and "Xenix 8086 relocatable or 80286 small -# model" lifted from "magic.xenix", with comment "derived empirically; -# treat as folklore until proven" -# -# "small model", "large model", "huge model" stuff lifted from XXX -# -# XXX - "x.out" collides with PDP-11 archives -# -0 string core core file (Xenix) -0 byte 0x80 8086 relocatable (Microsoft) -0 leshort 0xff65 x.out ->2 string __.SYMDEF randomized ->0 byte x archive -0 leshort 0x206 Microsoft a.out ->8 leshort 1 Middle model ->0x1e leshort &0x10 overlay ->0x1e leshort &0x2 separate ->0x1e leshort &0x4 pure ->0x1e leshort &0x800 segmented ->0x1e leshort &0x400 standalone ->0x1e leshort &0x8 fixed-stack ->0x1c byte &0x80 byte-swapped ->0x1c byte &0x40 word-swapped ->0x10 lelong >0 not-stripped ->0x1e leshort ^0xc000 pre-SysV ->0x1e leshort &0x4000 V2.3 ->0x1e leshort &0x8000 V3.0 ->0x1c byte &0x4 86 ->0x1c byte &0xb 186 ->0x1c byte &0x9 286 ->0x1c byte &0xa 386 ->0x1f byte <0x040 small model ->0x1f byte =0x048 large model ->0x1f byte =0x049 huge model ->0x1e leshort &0x1 executable ->0x1e leshort ^0x1 object file ->0x1e leshort &0x40 Large Text ->0x1e leshort &0x20 Large Data ->0x1e leshort &0x120 Huge Objects Enabled ->0x10 lelong >0 not stripped - -0 leshort 0x140 old Microsoft 8086 x.out ->0x3 byte &0x4 separate ->0x3 byte &0x2 pure ->0 byte &0x1 executable ->0 byte ^0x1 relocatable ->0x14 lelong >0 not stripped - -0 lelong 0x206 b.out ->0x1e leshort &0x10 overlay ->0x1e leshort &0x2 separate ->0x1e leshort &0x4 pure ->0x1e leshort &0x800 segmented ->0x1e leshort &0x400 standalone ->0x1e leshort &0x1 executable ->0x1e leshort ^0x1 object file ->0x1e leshort &0x4000 V2.3 ->0x1e leshort &0x8000 V3.0 ->0x1c byte &0x4 86 ->0x1c byte &0xb 186 ->0x1c byte &0x9 286 ->0x1c byte &0x29 286 ->0x1c byte &0xa 386 ->0x1e leshort &0x4 Large Text ->0x1e leshort &0x2 Large Data ->0x1e leshort &0x102 Huge Objects Enabled - -0 leshort 0x580 XENIX 8086 relocatable or 80286 small model diff --git a/contrib/file/Magdir/zilog b/contrib/file/Magdir/zilog deleted file mode 100644 index b746e204f5b93..0000000000000 --- a/contrib/file/Magdir/zilog +++ /dev/null @@ -1,11 +0,0 @@ - -#------------------------------------------------------------------------------ -# zilog: file(1) magic for Zilog Z8000. -# -# Was it big-endian or little-endian? My Product Specification doesn't -# say. -# -0 long 0xe807 object file (z8000 a.out) -0 long 0xe808 pure object file (z8000 a.out) -0 long 0xe809 separate object file (z8000 a.out) -0 long 0xe805 overlay object file (z8000 a.out) diff --git a/contrib/file/Magdir/zyxel b/contrib/file/Magdir/zyxel deleted file mode 100644 index 12a6abd5de8c9..0000000000000 --- a/contrib/file/Magdir/zyxel +++ /dev/null @@ -1,16 +0,0 @@ - -#------------------------------------------------------------------------------ -# zyxel: file(1) magic for ZyXEL modems -# -# From <rob@pe1chl.ampr.org> -# These are the /etc/magic entries to decode datafiles as used for the -# ZyXEL U-1496E DATA/FAX/VOICE modems. (This header conforms to a -# ZyXEL-defined standard) - -0 string ZyXEL\002 ZyXEL voice data ->10 byte 0 - CELP encoding ->10 byte&0x0B 1 - ADPCM2 encoding ->10 byte&0x0B 2 - ADPCM3 encoding ->10 byte&0x0B 3 - ADPCM4 encoding ->10 byte&0x0B 8 - New ADPCM3 encoding ->10 byte&0x04 4 with resync diff --git a/contrib/file/Makefile.am b/contrib/file/Makefile.am deleted file mode 100644 index 85c09bed7dfb0..0000000000000 --- a/contrib/file/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -# don't enforce GNU packaging standards -AUTOMAKE_OPTIONS = foreign no-dependencies - -bin_PROGRAMS = file - -data_DATA = magic magic.mime - -MAGIC = @datadir@/magic -CPPFLAGS = -DMAGIC='"$(MAGIC)"' - -man_MANS = file.1 magic.4 - -file_SOURCES = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ - compress.c is_tar.c readelf.c print.c \ - file.h names.h patchlevel.h readelf.h tar.h - -EXTRA_DIST = LEGAL.NOTICE MAINT PORTING Makefile.std magic2mime \ - Localstuff Header $(magic_FRAGMENTS) file.man magic.man - -CLEANFILES = $(man_MANS) magic - -magic: Header Localstuff $(magic_FRAGMENTS) - cat $(srcdir)/Header $(srcdir)/Localstuff > $@ - for frag in $(magic_FRAGMENTS); do \ - if test -f $(srcdir)/$$frag; then \ - f=$(srcdir)/$$frag; \ - else \ - f=$$frag; \ - fi; \ - cat $$f; \ - done >> $@ - -file.1: Makefile file.man - @rm -f $@ - sed -e s@__CSECTION__@1@g \ - -e s@__FSECTION__@4@g \ - -e s@__VERSION__@${VERSION}@g \ - -e s@__MAGIC__@${MAGIC}@g $(srcdir)/file.man > $@ - -magic.4: Makefile magic.man - @rm -f $@ - sed -e s@__CSECTION__@1@g \ - -e s@__FSECTION__@4@g \ - -e s@__VERSION__@${VERSION}@g \ - -e s@__MAGIC__@${MAGIC}@g $(srcdir)/magic.man > $@ - -magic_FRAGMENTS = Magdir/adventure Magdir/allegro Magdir/alliant \ - Magdir/alpha Magdir/amanda Magdir/amigaos Magdir/animation \ - Magdir/apl Magdir/apple Magdir/applix Magdir/archive Magdir/asterix \ - Magdir/att3b Magdir/audio Magdir/blender Magdir/blit Magdir/bsdi \ - Magdir/c-lang Magdir/chi Magdir/cisco Magdir/claris Magdir/clipper \ - Magdir/commands Magdir/compress Magdir/console Magdir/convex \ - Magdir/database Magdir/diamond Magdir/diff Magdir/digital \ - Magdir/dump Magdir/elf Magdir/encore Magdir/epoc Magdir/filesystems \ - Magdir/flash Magdir/fonts Magdir/frame Magdir/freebsd Magdir/fsav \ - Magdir/gimp Magdir/gnu Magdir/grace Magdir/hp Magdir/ibm370 \ - Magdir/ibm6000 Magdir/iff Magdir/images Magdir/intel \ - Magdir/interleaf Magdir/island Magdir/ispell Magdir/java \ - Magdir/jpeg Magdir/karma Magdir/lecter Magdir/lex Magdir/lif \ - Magdir/linux Magdir/lisp Magdir/mach Magdir/macintosh Magdir/magic \ - Magdir/mail.news Magdir/maple Magdir/mathematica Magdir/mcrypt \ - Magdir/mime Magdir/mirage Magdir/mkid Magdir/mmdf Magdir/modem \ - Magdir/motorola Magdir/msdos Magdir/msvc Magdir/ncr Magdir/netbsd \ - Magdir/netscape Magdir/news Magdir/octave Magdir/olf Magdir/os2 \ - Magdir/os9 Magdir/osf1 Magdir/palm Magdir/pbm Magdir/pdf Magdir/pdp \ - Magdir/pgp Magdir/pkgadd Magdir/plus5 Magdir/printer Magdir/project \ - Magdir/psdbms Magdir/pyramid Magdir/python Magdir/riff Magdir/rpm \ - Magdir/rtf Magdir/sc Magdir/sccs Magdir/sendmail Magdir/sequent \ - Magdir/sgi Magdir/sgml Magdir/sniffer Magdir/softquad Magdir/spectrum \ - Magdir/sun Magdir/teapot Magdir/terminfo Magdir/tex Magdir/ti-8x \ - Magdir/timezone Magdir/troff Magdir/typeset Magdir/unknown \ - Magdir/uuencode Magdir/varied.out Magdir/vax Magdir/vicar Magdir/visx \ - Magdir/vms Magdir/vmware Magdir/wordperfect Magdir/xdelta Magdir/xenix \ - Magdir/zilog Magdir/zyxel diff --git a/contrib/file/README b/contrib/file/README deleted file mode 100644 index 5ca8ef08d6eb6..0000000000000 --- a/contrib/file/README +++ /dev/null @@ -1,91 +0,0 @@ -** README for file(1) Command ** -@(#) $Id: README,v 1.23 2000/08/05 18:25:29 christos Exp $ - -This is Release 3.x of Ian Darwin's (copyright but distributable) -file(1) command. This version is the standard "file" command for Linux, -*BSD, and other systems. (See "patchlevel.h" for the exact release number). - -UNIX is a trademark of UNIX System Laboratories. - -The prime contributor to Release 3.8 was Guy Harris, who put in megachanges -including byte-order independance. - -The prime contributor to Release 3.0 was Christos Zoulas, who put -in hundreds of lines of source code changes, including his own -ANSIfication of the code (I liked my own ANSIfication better, but -his (__P()) is the "Berkeley standard" way of doing it, and I wanted UCB -to include the code...), his HP-like "indirection" (a feature of -the HP file command, I think), and his mods that finally got the -uncompress (-z) mode finished and working. - -This release has compiled in numerous environments; see PORTING -for a list and problems. - -This fine freeware file(1) follows the USG (System V) model of the file -command, rather than the Research (V7) version or the V7-derived 4.[23] -Berkeley one. That is, the file /etc/magic contains much of the ritual -information that is the source of this program's power. My version -knows a little more magic (including tar archives) than System V; the -/etc/magic parsing seems to be compatible with the (poorly documented) -System V /etc/magic format (with one exception; see the man page). - -In addition, the /etc/magic file is built from a subdirectory -for easier(?) maintenance. I will act as a clearinghouse for -magic numbers assigned to all sorts of data files that -are in reasonable circulation. Send your magic numbers, -in magic(4) format please, to the maintainer, Christos Zoulas. - -LEGAL.NOTICE - read this first. -README - read this second (you are currently reading this file). -PORTING - read this only if the program won't compile. -Makefile - read this next, adapt it as needed (particularly - the location of the old existing file command and - the man page layouts), type "make" to compile, - "make try" to try it out against your old version. - Expect some diffs, particularly since your original - file(1) may not grok the imbedded-space ("\ ") in - the current magic file, or may even not use the - magic file. -apprentice.c - parses /etc/magic to learn magic -ascmagic.c - third & last set of tests, based on hardwired assumptions. -core - not included in distribution due to mailer limitations. -debug.c - includes -c printout routine -file.1 - man page for the command -magic.4 - man page for the magic file, courtesy Guy Harris. - Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile. -file.c - main program -file.h - header file -fsmagic.c - first set of tests the program runs, based on filesystem info -is_tar.c, tar.h - knows about tarchives (courtesy John Gilmore). -magdir - directory of /etc/magic pieces - magdir/Makefile - ADJUST THIS FOR YOUR CONFIGURATION -names.h - header file for ascmagic.c -softmagic.c - 2nd set of tests, based on /etc/magic -readelf.[ch] - Standalone elf parsing code. -compress.c - on-the-fly decompression. -internat.c - recognize international `text' files. -print.c - print results, errors, warnings. - -If your gzip sometimes fails to decompress things complaining about a short -file, apply this patch [which is going to be in the next version of gzip]: -*** - Tue Oct 29 02:06:35 1996 ---- util.c Sun Jul 21 21:51:38 1996 -*** 106,111 **** ---- 108,114 ---- - - if (insize == 0) { - if (eof_ok) return EOF; -+ flush_window(); - read_error(); - } - bytes_in += (ulg)insize; - -E-mail: christos@astron.com - -Phone: Do not even think of telephoning me about this program. Send cash first! - -Parts of this software were developed at SoftQuad Inc., 56 Aberfoyle -Cres, # 810, Toronto, Ontario CANADA M8X 2W4. Phone: 416-239-4801 or -800-387-2777. Email: mail@sq.com. Call for information on SGML editing -and browsing, Unix text processing, and customised products on Unix, -DOS and Mac. diff --git a/contrib/file/acinclude.m4 b/contrib/file/acinclude.m4 deleted file mode 100644 index 3da5afb77387e..0000000000000 --- a/contrib/file/acinclude.m4 +++ /dev/null @@ -1,79 +0,0 @@ -dnl cloned from autoconf 2.13 acspecific.m4 -AC_DEFUN(AC_C_LONG_LONG, -[AC_CACHE_CHECK(for long long, ac_cv_c_long_long, -[if test "$GCC" = yes; then - ac_cv_c_long_long=yes -else -AC_TRY_RUN([int main() { -long long foo = 0; -exit(sizeof(long long) < sizeof(long)); }], -ac_cv_c_long_long=yes, ac_cv_c_long_long=no) -fi]) -if test $ac_cv_c_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG) -fi -]) - -dnl from autoconf 2.13 acgeneral.m4, with patch: -dnl Date: Fri, 15 Jan 1999 05:52:41 -0800 -dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com> -dnl From: eggert@twinsun.com (Paul Eggert) -dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars -dnl Newsgroups: gnu.utils.bug - -dnl AC_CHECK_TYPE2(TYPE, DEFAULT) -AC_DEFUN(AC_CHECK_TYPE2, -[AC_REQUIRE([AC_HEADER_STDC])dnl -AC_MSG_CHECKING(for $1) -AC_CACHE_VAL(ac_cv_type_$1, -[AC_EGREP_CPP(dnl -changequote(<<,>>)dnl -<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl -changequote([,]), [#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl -if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) - AC_DEFINE_UNQUOTED($1, $2) -fi -]) - -dnl from autoconf 2.13 acgeneral.m4, with additional third argument -dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]]) -AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES, -[changequote(<<, >>)dnl -dnl The name to #define. -define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(size of $1) -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([$3 -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof($1)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl -AC_MSG_RESULT($AC_CV_NAME) -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - -dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE]) -AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS, -[AC_CHECK_SIZEOF_INCLUDES($1, $2, -[#include <sys/types.h> -#ifdef STDC_HEADERS -#include <stdlib.h> -#endif -]) -]) diff --git a/contrib/file/aclocal.m4 b/contrib/file/aclocal.m4 deleted file mode 100644 index c62b0c8881779..0000000000000 --- a/contrib/file/aclocal.m4 +++ /dev/null @@ -1,209 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4a - -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -dnl cloned from autoconf 2.13 acspecific.m4 -AC_DEFUN(AC_C_LONG_LONG, -[AC_CACHE_CHECK(for long long, ac_cv_c_long_long, -[if test "$GCC" = yes; then - ac_cv_c_long_long=yes -else -AC_TRY_RUN([int main() { -long long foo = 0; -exit(sizeof(long long) < sizeof(long)); }], -ac_cv_c_long_long=yes, ac_cv_c_long_long=no) -fi]) -if test $ac_cv_c_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG) -fi -]) - -dnl from autoconf 2.13 acgeneral.m4, with patch: -dnl Date: Fri, 15 Jan 1999 05:52:41 -0800 -dnl Message-ID: <199901151352.FAA18237@shade.twinsun.com> -dnl From: eggert@twinsun.com (Paul Eggert) -dnl Subject: autoconf 2.13 AC_CHECK_TYPE doesn't allow shell vars -dnl Newsgroups: gnu.utils.bug - -dnl AC_CHECK_TYPE2(TYPE, DEFAULT) -AC_DEFUN(AC_CHECK_TYPE2, -[AC_REQUIRE([AC_HEADER_STDC])dnl -AC_MSG_CHECKING(for $1) -AC_CACHE_VAL(ac_cv_type_$1, -[AC_EGREP_CPP(dnl -changequote(<<,>>)dnl -<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl -changequote([,]), [#include <sys/types.h> -#if STDC_HEADERS -#include <stdlib.h> -#include <stddef.h> -#endif], eval "ac_cv_type_$1=yes", eval "ac_cv_type_$1=no")])dnl -if eval "test \"`echo '$ac_cv_type_'$1`\" = yes"; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) - AC_DEFINE_UNQUOTED($1, $2) -fi -]) - -dnl from autoconf 2.13 acgeneral.m4, with additional third argument -dnl AC_CHECK_SIZEOF_INCLUDES(TYPE [, CROSS-SIZE, [INCLUDES]]) -AC_DEFUN(AC_CHECK_SIZEOF_INCLUDES, -[changequote(<<, >>)dnl -dnl The name to #define. -define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(size of $1) -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([$3 -#include <stdio.h> -main() -{ - FILE *f=fopen("conftestval", "w"); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof($1)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl -AC_MSG_RESULT($AC_CV_NAME) -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - -dnl AC_CHECK_SIZEOF_STDC_HEADERS(TYPE [, CROSS_SIZE]) -AC_DEFUN(AC_CHECK_SIZEOF_STDC_HEADERS, -[AC_CHECK_SIZEOF_INCLUDES($1, $2, -[#include <sys/types.h> -#ifdef STDC_HEADERS -#include <stdlib.h> -#endif -]) -]) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -dnl We require 2.13 because we rely on SHELL being computed by configure. -AC_PREREQ([2.13]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - -# Like AC_CONFIG_HEADER, but automatically create stamp file. - -AC_DEFUN(AM_CONFIG_HEADER, -[AC_PREREQ([2.12]) -AC_CONFIG_HEADER([$1]) -dnl When config.status generates a header, we must update the stamp-h file. -dnl This file resides in the same directory as the config header -dnl that is generated. We must strip everything past the first ":", -dnl and everything past the last "/". -AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, -<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, -<<am_indx=1 -for am_file in <<$1>>; do - case " <<$>>CONFIG_HEADERS " in - *" <<$>>am_file "*<<)>> - echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx - ;; - esac - am_indx=`expr "<<$>>am_indx" + 1` -done<<>>dnl>>) -changequote([,]))]) - diff --git a/contrib/file/apprentice.c b/contrib/file/apprentice.c deleted file mode 100644 index 1c4664b55111c..0000000000000 --- a/contrib/file/apprentice.c +++ /dev/null @@ -1,672 +0,0 @@ -/* - * apprentice - make one pass through /etc/magic, learning its secrets. - * - * Copyright (c) Ian F. Darwin, 1987. - * Written by Ian F. Darwin. - * - * This software is not subject to any license of the American Telephone - * and Telegraph Company or of the Regents of the University of California. - * - * Permission is granted to anyone to use this software for any purpose on - * any computer system, and to alter it and redistribute it freely, subject - * to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of this - * software, no matter how awful, even if they arise from flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, - * credits must appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users - * ever read sources, credits must appear in the documentation. - * - * 4. This notice may not be removed or altered. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <errno.h> -#include "file.h" - -#ifndef lint -FILE_RCSID("@(#)$Id: apprentice.c,v 1.33 2000/08/05 17:36:47 christos Exp $") -#endif /* lint */ - -#define EATAB {while (isascii((unsigned char) *l) && \ - isspace((unsigned char) *l)) ++l;} -#define LOWCASE(l) (isupper((unsigned char) (l)) ? \ - tolower((unsigned char) (l)) : (l)) - - -#ifdef __EMX__ - char PATHSEP=';'; -#else - char PATHSEP=':'; -#endif - - -static int getvalue __P((struct magic *, char **)); -static int hextoint __P((int)); -static char *getstr __P((char *, char *, int, int *)); -static int parse __P((char *, int *, int)); -static void eatsize __P((char **)); - -static int maxmagic = 0; - -static int apprentice_1 __P((const char *, int)); - -int -apprentice(fn, check) - const char *fn; /* list of magic files */ - int check; /* non-zero? checking-only run. */ -{ - char *p, *mfn; - int file_err, errs = -1; - - maxmagic = MAXMAGIS; - magic = (struct magic *) calloc(sizeof(struct magic), maxmagic); - mfn = malloc(strlen(fn)+1); - if (magic == NULL || mfn == NULL) { - (void) fprintf(stderr, "%s: Out of memory.\n", progname); - if (check) - return -1; - else - exit(1); - } - fn = strcpy(mfn, fn); - - while (fn) { - p = strchr(fn, PATHSEP); - if (p) - *p++ = '\0'; - file_err = apprentice_1(fn, check); - if (file_err > errs) - errs = file_err; - fn = p; - } - if (errs == -1) - (void) fprintf(stderr, "%s: couldn't find any magic files!\n", - progname); - if (!check && errs) - exit(1); - - free(mfn); - return errs; -} - -static int -apprentice_1(fn, check) - const char *fn; /* name of magic file */ - int check; /* non-zero? checking-only run. */ -{ - static const char hdr[] = - "cont\toffset\ttype\topcode\tmask\tvalue\tdesc"; - FILE *f; - char line[BUFSIZ+1]; - int errs = 0; - - f = fopen(fn, "r"); - if (f==NULL) { - if (errno != ENOENT) - (void) fprintf(stderr, - "%s: can't read magic file %s (%s)\n", - progname, fn, strerror(errno)); - return -1; - } - - /* parse it */ - if (check) /* print silly verbose header for USG compat. */ - (void) printf("%s\n", hdr); - - for (lineno = 1;fgets(line, BUFSIZ, f) != NULL; lineno++) { - if (line[0]=='#') /* comment, do not parse */ - continue; - if (strlen(line) <= (unsigned)1) /* null line, garbage, etc */ - continue; - line[strlen(line)-1] = '\0'; /* delete newline */ - if (parse(line, &nmagic, check) != 0) - errs = 1; - } - - (void) fclose(f); - return errs; -} - -/* - * extend the sign bit if the comparison is to be signed - */ -uint32 -signextend(m, v) - struct magic *m; - uint32 v; -{ - if (!(m->flag & UNSIGNED)) - switch(m->type) { - /* - * Do not remove the casts below. They are - * vital. When later compared with the data, - * the sign extension must have happened. - */ - case BYTE: - v = (char) v; - break; - case SHORT: - case BESHORT: - case LESHORT: - v = (short) v; - break; - case DATE: - case BEDATE: - case LEDATE: - case LONG: - case BELONG: - case LELONG: - v = (int32) v; - break; - case STRING: - break; - default: - magwarn("can't happen: m->type=%d\n", - m->type); - return -1; - } - return v; -} - -/* - * parse one line from magic file, put into magic[index++] if valid - */ -static int -parse(l, ndx, check) - char *l; - int *ndx, check; -{ - int i = 0, nd = *ndx; - struct magic *m; - char *t, *s; - -#define ALLOC_INCR 200 - if (nd+1 >= maxmagic){ - maxmagic += ALLOC_INCR; - if ((m = (struct magic *) realloc(magic, sizeof(struct magic) * - maxmagic)) == NULL) { - (void) fprintf(stderr, "%s: Out of memory.\n", - progname); - if (magic) - free(magic); - if (check) - return -1; - else - exit(1); - } - magic = m; - memset(&magic[*ndx], 0, sizeof(struct magic) * ALLOC_INCR); - } - m = &magic[*ndx]; - m->flag = 0; - m->cont_level = 0; - - while (*l == '>') { - ++l; /* step over */ - m->cont_level++; - } - - if (m->cont_level != 0 && *l == '(') { - ++l; /* step over */ - m->flag |= INDIR; - } - if (m->cont_level != 0 && *l == '&') { - ++l; /* step over */ - m->flag |= ADD; - } - - /* get offset, then skip over it */ - m->offset = (int) strtoul(l,&t,0); - if (l == t) - magwarn("offset %s invalid", l); - l = t; - - if (m->flag & INDIR) { - m->in.type = LONG; - m->in.offset = 0; - /* - * read [.lbs][+-]nnnnn) - */ - if (*l == '.') { - l++; - switch (*l) { - case 'l': - m->in.type = LELONG; - break; - case 'L': - m->in.type = BELONG; - break; - case 'h': - case 's': - m->in.type = LESHORT; - break; - case 'H': - case 'S': - m->in.type = BESHORT; - break; - case 'c': - case 'b': - case 'C': - case 'B': - m->in.type = BYTE; - break; - default: - magwarn("indirect offset type %c invalid", *l); - break; - } - l++; - } - s = l; - if (*l == '+' || *l == '-') l++; - if (isdigit((unsigned char)*l)) { - m->in.offset = strtoul(l, &t, 0); - if (*s == '-') m->in.offset = - m->in.offset; - } - else - t = l; - if (*t++ != ')') - magwarn("missing ')' in indirect offset"); - l = t; - } - - - while (isascii((unsigned char)*l) && isdigit((unsigned char)*l)) - ++l; - EATAB; - -#define NBYTE 4 -#define NSHORT 5 -#define NLONG 4 -#define NSTRING 6 -#define NDATE 4 -#define NBESHORT 7 -#define NBELONG 6 -#define NBEDATE 6 -#define NLESHORT 7 -#define NLELONG 6 -#define NLEDATE 6 - - if (*l == 'u') { - ++l; - m->flag |= UNSIGNED; - } - - /* get type, skip it */ - if (strncmp(l, "char", NBYTE)==0) { /* HP/UX compat */ - m->type = BYTE; - l += NBYTE; - } else if (strncmp(l, "byte", NBYTE)==0) { - m->type = BYTE; - l += NBYTE; - } else if (strncmp(l, "short", NSHORT)==0) { - m->type = SHORT; - l += NSHORT; - } else if (strncmp(l, "long", NLONG)==0) { - m->type = LONG; - l += NLONG; - } else if (strncmp(l, "string", NSTRING)==0) { - m->type = STRING; - l += NSTRING; - } else if (strncmp(l, "date", NDATE)==0) { - m->type = DATE; - l += NDATE; - } else if (strncmp(l, "beshort", NBESHORT)==0) { - m->type = BESHORT; - l += NBESHORT; - } else if (strncmp(l, "belong", NBELONG)==0) { - m->type = BELONG; - l += NBELONG; - } else if (strncmp(l, "bedate", NBEDATE)==0) { - m->type = BEDATE; - l += NBEDATE; - } else if (strncmp(l, "leshort", NLESHORT)==0) { - m->type = LESHORT; - l += NLESHORT; - } else if (strncmp(l, "lelong", NLELONG)==0) { - m->type = LELONG; - l += NLELONG; - } else if (strncmp(l, "ledate", NLEDATE)==0) { - m->type = LEDATE; - l += NLEDATE; - } else { - magwarn("type %s invalid", l); - return -1; - } - /* New-style anding: "0 byte&0x80 =0x80 dynamically linked" */ - if (*l == '&') { - ++l; - m->mask = signextend(m, strtoul(l, &l, 0)); - eatsize(&l); - } else if (STRING == m->type) { - m->mask = 0L; - if (*l == '/') { - while (!isspace(*++l)) { - switch (*l) { - case CHAR_IGNORE_LOWERCASE: - m->mask |= STRING_IGNORE_LOWERCASE; - break; - case CHAR_COMPACT_BLANK: - m->mask |= STRING_COMPACT_BLANK; - break; - case CHAR_COMPACT_OPTIONAL_BLANK: - m->mask |= - STRING_COMPACT_OPTIONAL_BLANK; - break; - default: - magwarn("string extension %c invalid", - *l); - return -1; - } - } - } - } else - m->mask = ~0L; - EATAB; - - switch (*l) { - case '>': - case '<': - /* Old-style anding: "0 byte &0x80 dynamically linked" */ - case '&': - case '^': - case '=': - m->reln = *l; - ++l; - if (*l == '=') { - /* HP compat: ignore &= etc. */ - ++l; - } - break; - case '!': - if (m->type != STRING) { - m->reln = *l; - ++l; - break; - } - /* FALL THROUGH */ - default: - if (*l == 'x' && isascii((unsigned char)l[1]) && - isspace((unsigned char)l[1])) { - m->reln = *l; - ++l; - goto GetDesc; /* Bill The Cat */ - } - m->reln = '='; - break; - } - EATAB; - - if (getvalue(m, &l)) - return -1; - /* - * TODO finish this macro and start using it! - * #define offsetcheck {if (offset > HOWMANY-1) - * magwarn("offset too big"); } - */ - - /* - * now get last part - the description - */ -GetDesc: - EATAB; - if (l[0] == '\b') { - ++l; - m->nospflag = 1; - } else if ((l[0] == '\\') && (l[1] == 'b')) { - ++l; - ++l; - m->nospflag = 1; - } else - m->nospflag = 0; - while ((m->desc[i++] = *l++) != '\0' && i<MAXDESC) - /* NULLBODY */; - - if (check) { - mdump(m); - } - ++(*ndx); /* make room for next */ - return 0; -} - -/* - * Read a numeric value from a pointer, into the value union of a magic - * pointer, according to the magic type. Update the string pointer to point - * just after the number read. Return 0 for success, non-zero for failure. - */ -static int -getvalue(m, p) - struct magic *m; - char **p; -{ - int slen; - - if (m->type == STRING) { - *p = getstr(*p, m->value.s, sizeof(m->value.s), &slen); - m->vallen = slen; - } else - if (m->reln != 'x') { - m->value.l = signextend(m, strtoul(*p, p, 0)); - eatsize(p); - } - return 0; -} - -/* - * Convert a string containing C character escapes. Stop at an unescaped - * space or tab. - * Copy the converted version to "p", returning its length in *slen. - * Return updated scan pointer as function result. - */ -static char * -getstr(s, p, plen, slen) - char *s; - char *p; - int plen, *slen; -{ - char *origs = s, *origp = p; - char *pmax = p + plen - 1; - int c; - int val; - - while ((c = *s++) != '\0') { - if (isspace((unsigned char) c)) - break; - if (p >= pmax) { - fprintf(stderr, "String too long: %s\n", origs); - break; - } - if(c == '\\') { - switch(c = *s++) { - - case '\0': - goto out; - - default: - *p++ = (char) c; - break; - - case 'n': - *p++ = '\n'; - break; - - case 'r': - *p++ = '\r'; - break; - - case 'b': - *p++ = '\b'; - break; - - case 't': - *p++ = '\t'; - break; - - case 'f': - *p++ = '\f'; - break; - - case 'v': - *p++ = '\v'; - break; - - /* \ and up to 3 octal digits */ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - val = c - '0'; - c = *s++; /* try for 2 */ - if(c >= '0' && c <= '7') { - val = (val<<3) | (c - '0'); - c = *s++; /* try for 3 */ - if(c >= '0' && c <= '7') - val = (val<<3) | (c-'0'); - else - --s; - } - else - --s; - *p++ = (char)val; - break; - - /* \x and up to 2 hex digits */ - case 'x': - val = 'x'; /* Default if no digits */ - c = hextoint(*s++); /* Get next char */ - if (c >= 0) { - val = c; - c = hextoint(*s++); - if (c >= 0) - val = (val << 4) + c; - else - --s; - } else - --s; - *p++ = (char)val; - break; - } - } else - *p++ = (char)c; - } -out: - *p = '\0'; - *slen = p - origp; - return s; -} - - -/* Single hex char to int; -1 if not a hex char. */ -static int -hextoint(c) - int c; -{ - if (!isascii((unsigned char) c)) - return -1; - if (isdigit((unsigned char) c)) - return c - '0'; - if ((c >= 'a')&&(c <= 'f')) - return c + 10 - 'a'; - if (( c>= 'A')&&(c <= 'F')) - return c + 10 - 'A'; - return -1; -} - - -/* - * Print a string containing C character escapes. - */ -void -showstr(fp, s, len) - FILE *fp; - const char *s; - int len; -{ - char c; - - for (;;) { - c = *s++; - if (len == -1) { - if (c == '\0') - break; - } - else { - if (len-- == 0) - break; - } - if(c >= 040 && c <= 0176) /* TODO isprint && !iscntrl */ - (void) fputc(c, fp); - else { - (void) fputc('\\', fp); - switch (c) { - - case '\n': - (void) fputc('n', fp); - break; - - case '\r': - (void) fputc('r', fp); - break; - - case '\b': - (void) fputc('b', fp); - break; - - case '\t': - (void) fputc('t', fp); - break; - - case '\f': - (void) fputc('f', fp); - break; - - case '\v': - (void) fputc('v', fp); - break; - - default: - (void) fprintf(fp, "%.3o", c & 0377); - break; - } - } - } -} - -/* - * eatsize(): Eat the size spec from a number [eg. 10UL] - */ -static void -eatsize(p) - char **p; -{ - char *l = *p; - - if (LOWCASE(*l) == 'u') - l++; - - switch (LOWCASE(*l)) { - case 'l': /* long */ - case 's': /* short */ - case 'h': /* short */ - case 'b': /* char/byte */ - case 'c': /* char/byte */ - l++; - /*FALLTHROUGH*/ - default: - break; - } - - *p = l; -} diff --git a/contrib/file/compress.c b/contrib/file/compress.c deleted file mode 100644 index 5f18d8289fdde..0000000000000 --- a/contrib/file/compress.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * compress routines: - * zmagic() - returns 0 if not recognized, uncompresses and prints - * information if recognized - * uncompress(method, old, n, newch) - uncompress old into new, - * using method, return sizeof new - */ -#include "file.h" -#include <stdio.h> -#include <stdlib.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <string.h> -#ifdef HAVE_SYS_WAIT_H -#include <sys/wait.h> -#endif -#ifndef lint -FILE_RCSID("@(#)$Id: compress.c,v 1.17 2000/08/05 17:36:47 christos Exp $") -#endif - - -static struct { - const char *magic; - int maglen; - const char *const argv[3]; - int silent; -} compr[] = { - { "\037\235", 2, { "uncompress", "-c", NULL }, 0 }, /* compressed */ - { "\037\235", 2, { "gzip", "-cdq", NULL }, 1 }, /* compressed */ - { "\037\213", 2, { "gzip", "-cdq", NULL }, 1 }, /* gzipped */ - { "\037\236", 2, { "gzip", "-cdq", NULL }, 1 }, /* frozen */ - { "\037\240", 2, { "gzip", "-cdq", NULL }, 1 }, /* SCO LZH */ - /* the standard pack utilities do not accept standard input */ - { "\037\036", 2, { "gzip", "-cdq", NULL }, 0 }, /* packed */ - { "BZh", 3, { "bzip2", "-d", NULL }, 1 }, /* bzip2-ed */ -}; - -static int ncompr = sizeof(compr) / sizeof(compr[0]); - - -static int uncompress __P((int, const unsigned char *, unsigned char **, int)); - -int -zmagic(buf, nbytes) - unsigned char *buf; - int nbytes; -{ - unsigned char *newbuf; - int newsize; - int i; - - for (i = 0; i < ncompr; i++) { - if (nbytes < compr[i].maglen) - continue; - if (memcmp(buf, compr[i].magic, compr[i].maglen) == 0 && - (newsize = uncompress(i, buf, &newbuf, nbytes)) != 0) { - tryit(newbuf, newsize, 1); - free(newbuf); - printf(" ("); - tryit(buf, nbytes, 0); - printf(")"); - return 1; - } - } - - if (i == ncompr) - return 0; - - return 1; -} - - -static int -uncompress(method, old, newch, n) - int method; - const unsigned char *old; - unsigned char **newch; - int n; -{ - int fdin[2], fdout[2]; - - if (pipe(fdin) == -1 || pipe(fdout) == -1) { - error("cannot create pipe (%s).\n", strerror(errno)); - /*NOTREACHED*/ - } - switch (fork()) { - case 0: /* child */ - (void) close(0); - (void) dup(fdin[0]); - (void) close(fdin[0]); - (void) close(fdin[1]); - - (void) close(1); - (void) dup(fdout[1]); - (void) close(fdout[0]); - (void) close(fdout[1]); - if (compr[method].silent) - (void) close(2); - - execvp(compr[method].argv[0], - (char *const *)compr[method].argv); - exit(1); - /*NOTREACHED*/ - case -1: - error("could not fork (%s).\n", strerror(errno)); - /*NOTREACHED*/ - - default: /* parent */ - (void) close(fdin[0]); - (void) close(fdout[1]); - if (write(fdin[1], old, n) != n) - return 0; - (void) close(fdin[1]); - if ((*newch = (unsigned char *) malloc(n)) == NULL) - return 0; - if ((n = read(fdout[0], *newch, n)) <= 0) { - free(*newch); - return 0; - } - (void) close(fdout[0]); - (void) wait(NULL); - return n; - } -} diff --git a/contrib/file/config.h.in b/contrib/file/config.h.in deleted file mode 100644 index 116676b7af411..0000000000000 --- a/contrib/file/config.h.in +++ /dev/null @@ -1,78 +0,0 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if your struct stat has st_rdev. */ -#undef HAVE_ST_RDEV - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#undef HAVE_SYS_WAIT_H - -/* Define if major, minor, and makedev are declared in <mkdev.h>. */ -#undef MAJOR_IN_MKDEV - -/* Define if major, minor, and makedev are declared in <sysmacros.h>. */ -#undef MAJOR_IN_SYSMACROS - -/* Define to `long' if <sys/types.h> doesn't define. */ -#undef off_t - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -#undef size_t - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define if builtin ELF support is enabled. */ -#undef BUILTIN_ELF - -/* Define if ELF core file support is enabled. */ -#undef ELFCORE - -/* Define if the `long long' type works. */ -#undef HAVE_LONG_LONG - -/* Define to `unsigned char' if standard headers don't define. */ -#undef uint8_t - -/* Define to `unsigned short' if standard headers don't define. */ -#undef uint16_t - -/* Define to `unsigned int' if standard headers don't define. */ -#undef uint32_t - -/* Define to `unsigned long long', if available, or `unsigned long', if - standard headers don't define. */ -#undef uint64_t - -/* The number of bytes in a uint8_t. */ -#define SIZEOF_UINT8_T 0 - -/* The number of bytes in a uint16_t. */ -#define SIZEOF_UINT16_T 0 - -/* The number of bytes in a uint32_t. */ -#define SIZEOF_UINT32_T 0 - -/* The number of bytes in a uint64_t. */ -#define SIZEOF_UINT64_T 0 - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the strtoul function. */ -#undef HAVE_STRTOUL - -/* Define if you have the <locale.h> header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Name of package */ -#undef PACKAGE - -/* Version number of package */ -#undef VERSION - diff --git a/contrib/file/fsmagic.c b/contrib/file/fsmagic.c deleted file mode 100644 index d6a900e168d30..0000000000000 --- a/contrib/file/fsmagic.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * fsmagic - magic based on filesystem info - directory, special files, etc. - * - * Copyright (c) Ian F. Darwin, 1987. - * Written by Ian F. Darwin. - * - * This software is not subject to any license of the American Telephone - * and Telegraph Company or of the Regents of the University of California. - * - * Permission is granted to anyone to use this software for any purpose on - * any computer system, and to alter it and redistribute it freely, subject - * to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of this - * software, no matter how awful, even if they arise from flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, - * credits must appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users - * ever read sources, credits must appear in the documentation. - * - * 4. This notice may not be removed or altered. - */ - -#include "file.h" -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <stdlib.h> -/* Since major is a function on SVR4, we can't use `ifndef major'. */ -#ifdef MAJOR_IN_MKDEV -# include <sys/mkdev.h> -# define HAVE_MAJOR -#endif -#ifdef MAJOR_IN_SYSMACROS -# include <sys/sysmacros.h> -# define HAVE_MAJOR -#endif -#ifdef major /* Might be defined in sys/types.h. */ -# define HAVE_MAJOR -#endif - -#ifndef HAVE_MAJOR -# define major(dev) (((dev) >> 8) & 0xff) -# define minor(dev) ((dev) & 0xff) -#endif -#undef HAVE_MAJOR - -#ifndef lint -FILE_RCSID("@(#)$Id: fsmagic.c,v 1.33 2000/08/05 17:36:48 christos Exp $") -#endif /* lint */ - -int -fsmagic(fn, sb) - const char *fn; - struct stat *sb; -{ - int ret = 0; - - /* - * Fstat is cheaper but fails for files you don't have read perms on. - * On 4.2BSD and similar systems, use lstat() to identify symlinks. - */ -#ifdef S_IFLNK - if (!lflag) - ret = lstat(fn, sb); - else -#endif - ret = stat(fn, sb); /* don't merge into if; see "ret =" above */ - - if (ret) { - ckfprintf(stdout, - /* Yes, I do mean stdout. */ - /* No \n, caller will provide. */ - "can't stat `%s' (%s).", fn, strerror(errno)); - return 1; - } - - if (iflag) { - if ((sb->st_mode & S_IFMT) != S_IFREG) { - ckfputs("application/x-not-regular-file", stdout); - return 1; - } - } - else { -#ifdef S_ISUID - if (sb->st_mode & S_ISUID) ckfputs("setuid ", stdout); -#endif -#ifdef S_ISGID - if (sb->st_mode & S_ISGID) ckfputs("setgid ", stdout); -#endif -#ifdef S_ISVTX - if (sb->st_mode & S_ISVTX) ckfputs("sticky ", stdout); -#endif - } - - switch (sb->st_mode & S_IFMT) { - case S_IFDIR: - ckfputs("directory", stdout); - return 1; -#ifdef S_IFCHR - case S_IFCHR: - /* - * If -s has been specified, treat character special files - * like ordinary files. Otherwise, just report that they - * are block special files and go on to the next file. - */ - if (sflag) - break; -#ifdef HAVE_ST_RDEV -# ifdef dv_unit - (void) printf("character special (%d/%d/%d)", - major(sb->st_rdev), - dv_unit(sb->st_rdev), - dv_subunit(sb->st_rdev)); -# else - (void) printf("character special (%ld/%ld)", - (long) major(sb->st_rdev), (long) minor(sb->st_rdev)); -# endif -#else - (void) printf("character special"); -#endif - return 1; -#endif -#ifdef S_IFBLK - case S_IFBLK: - /* - * If -s has been specified, treat block special files - * like ordinary files. Otherwise, just report that they - * are block special files and go on to the next file. - */ - if (sflag) - break; -#ifdef HAVE_ST_RDEV -# ifdef dv_unit - (void) printf("block special (%d/%d/%d)", - major(sb->st_rdev), - dv_unit(sb->st_rdev), - dv_subunit(sb->st_rdev)); -# else - (void) printf("block special (%ld/%ld)", - (long) major(sb->st_rdev), (long) minor(sb->st_rdev)); -# endif -#else - (void) printf("block special"); -#endif - return 1; -#endif - /* TODO add code to handle V7 MUX and Blit MUX files */ -#ifdef S_IFIFO - case S_IFIFO: - ckfputs("fifo (named pipe)", stdout); - return 1; -#endif -#ifdef S_IFDOOR - case S_IFDOOR: - ckfputs("door", stdout); - return 1; -#endif -#ifdef S_IFLNK - case S_IFLNK: - { - char buf[BUFSIZ+4]; - int nch; - struct stat tstatbuf; - - if ((nch = readlink(fn, buf, BUFSIZ-1)) <= 0) { - ckfprintf(stdout, "unreadable symlink (%s).", - strerror(errno)); - return 1; - } - buf[nch] = '\0'; /* readlink(2) forgets this */ - - /* If broken symlink, say so and quit early. */ - if (*buf == '/') { - if (stat(buf, &tstatbuf) < 0) { - ckfprintf(stdout, - "broken symbolic link to %s", buf); - return 1; - } - } - else { - char *tmp; - char buf2[BUFSIZ+BUFSIZ+4]; - - if ((tmp = strrchr(fn, '/')) == NULL) { - tmp = buf; /* in current directory anyway */ - } - else { - strcpy (buf2, fn); /* take directory part */ - buf2[tmp-fn+1] = '\0'; - strcat (buf2, buf); /* plus (relative) symlink */ - tmp = buf2; - } - if (stat(tmp, &tstatbuf) < 0) { - ckfprintf(stdout, - "broken symbolic link to %s", buf); - return 1; - } - } - - /* Otherwise, handle it. */ - if (lflag) { - process(buf, strlen(buf)); - return 1; - } else { /* just print what it points to */ - ckfputs("symbolic link to ", stdout); - ckfputs(buf, stdout); - } - } - return 1; -#endif -#ifdef S_IFSOCK -#ifndef __COHERENT__ - case S_IFSOCK: - ckfputs("socket", stdout); - return 1; -#endif -#endif - case S_IFREG: - break; - default: - error("invalid mode 0%o.\n", sb->st_mode); - /*NOTREACHED*/ - } - - /* - * regular file, check next possibility - * - * If stat() tells us the file has zero length, report here that - * the file is empty, so we can skip all the work of opening and - * reading the file. - * But if the -s option has been given, we skip this optimization, - * since on some systems, stat() reports zero size for raw disk - * partitions. (If the block special device really has zero length, - * the fact that it is empty will be detected and reported correctly - * when we read the file.) - */ - if (!sflag && sb->st_size == 0) { - ckfputs(iflag ? "application/x-empty" : "empty", stdout); - return 1; - } - return 0; -} diff --git a/contrib/file/install-sh b/contrib/file/install-sh deleted file mode 100755 index 89fc9b098b8c5..0000000000000 --- a/contrib/file/install-sh +++ /dev/null @@ -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 diff --git a/contrib/file/is_tar.c b/contrib/file/is_tar.c deleted file mode 100644 index 6c5b61ce77928..0000000000000 --- a/contrib/file/is_tar.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * is_tar() -- figure out whether file is a tar archive. - * - * Stolen (by the author!) from the public domain tar program: - * Public Domain version written 26 Aug 1985 John Gilmore (ihnp4!hoptoad!gnu). - * - * @(#)list.c 1.18 9/23/86 Public Domain - gnu - * $Id: is_tar.c,v 1.13 2000/08/05 17:36:48 christos Exp $ - * - * Comments changed and some code/comments reformatted - * for file command by Ian Darwin. - */ - -#include <string.h> -#include <ctype.h> -#include <sys/types.h> -#include "tar.h" -#include "file.h" - -#ifndef lint -FILE_RCSID("@(#)$Id: is_tar.c,v 1.13 2000/08/05 17:36:48 christos Exp $") -#endif - -#define isodigit(c) ( ((c) >= '0') && ((c) <= '7') ) - -static int from_oct __P((int, char *)); /* Decode octal number */ - -/* - * Return - * 0 if the checksum is bad (i.e., probably not a tar archive), - * 1 for old UNIX tar file, - * 2 for Unix Std (POSIX) tar file. - */ -int -is_tar(buf, nbytes) - unsigned char *buf; - int nbytes; -{ - union record *header = (union record *)buf; - int i; - int sum, recsum; - char *p; - - if (nbytes < sizeof(union record)) - return 0; - - recsum = from_oct(8, header->header.chksum); - - sum = 0; - p = header->charptr; - for (i = sizeof(union record); --i >= 0;) { - /* - * We can't use unsigned char here because of old compilers, - * e.g. V7. - */ - sum += 0xFF & *p++; - } - - /* Adjust checksum to count the "chksum" field as blanks. */ - for (i = sizeof(header->header.chksum); --i >= 0;) - sum -= 0xFF & header->header.chksum[i]; - sum += ' '* sizeof header->header.chksum; - - if (sum != recsum) - return 0; /* Not a tar archive */ - - if (0==strcmp(header->header.magic, TMAGIC)) - return 2; /* Unix Standard tar archive */ - - return 1; /* Old fashioned tar archive */ -} - - -/* - * Quick and dirty octal conversion. - * - * Result is -1 if the field is invalid (all blank, or nonoctal). - */ -static int -from_oct(digs, where) - int digs; - char *where; -{ - int value; - - while (isspace((unsigned char)*where)) { /* Skip spaces */ - where++; - if (--digs <= 0) - return -1; /* All blank field */ - } - value = 0; - while (digs > 0 && isodigit(*where)) { /* Scan til nonoctal */ - value = (value << 3) | (*where++ - '0'); - --digs; - } - - if (digs > 0 && *where && !isspace((unsigned char)*where)) - return -1; /* Ended on non-space/nul */ - - return value; -} diff --git a/contrib/file/magic.man b/contrib/file/magic.man deleted file mode 100644 index 55ad4a4f3059b..0000000000000 --- a/contrib/file/magic.man +++ /dev/null @@ -1,215 +0,0 @@ -.TH MAGIC __FSECTION__ "Public Domain" -.\" install as magic.4 on USG, magic.5 on V7 or Berkeley systems. -.SH NAME -magic \- file command's magic number file -.SH DESCRIPTION -This manual page documents the format of the magic file as -used by the -.BR file (__CSECTION__) -command, version __VERSION__. The -.B file -command identifies the type of a file using, -among other tests, -a test for whether the file begins with a certain -.IR "magic number" . -The file -.I __MAGIC__ -specifies what magic numbers are to be tested for, -what message to print if a particular magic number is found, -and additional information to extract from the file. -.PP -Each line of the file specifies a test to be performed. -A test compares the data starting at a particular offset -in the file with a 1-byte, 2-byte, or 4-byte numeric value or -a string. If the test succeeds, a message is printed. -The line consists of the following fields: -.IP offset \w'message'u+2n -A number specifying the offset, in bytes, into the file of the data -which is to be tested. -.IP type -The type of the data to be tested. The possible values are: -.RS -.IP byte \w'message'u+2n -A one-byte value. -.IP short -A two-byte value (on most systems) in this machine's native byte order. -.IP long -A four-byte value (on most systems) in this machine's native byte order. -.IP string -A string of bytes. The string type specification can be optionally followed -by /[Bbc]*. The ``B'' flag compacts whitespace in the target, which must -contain at least one whitespace character. If the magic has "n" consecutive -blanks, the target needs at least "n" consecutive blanks to match. The ``b'' -flag treats every blank in the target as an optional blank. Finally the ``c'' -flag, specifies case insensitive matching: lowercase characters in the magic -match both lower and upper case characters in the targer, whereas upper case -characters in the magic, only much uppercase characters in the target. -.IP date -A four-byte value interpreted as a unix date. -.IP beshort -A two-byte value (on most systems) in big-endian byte order. -.IP belong -A four-byte value (on most systems) in big-endian byte order. -.IP bedate -A four-byte value (on most systems) in big-endian byte order, -interpreted as a unix date. -.IP leshort -A two-byte value (on most systems) in little-endian byte order. -.IP lelong -A four-byte value (on most systems) in little-endian byte order. -.IP ledate -A four-byte value (on most systems) in little-endian byte order, -interpreted as a unix date. -.RE -.PP -The numeric types may optionally be followed by -.B & -and a numeric value, -to specify that the value is to be AND'ed with the -numeric value before any comparisons are done. Prepending a -.B u -to the type indicates that ordered comparisons should be unsigned. -.IP test -The value to be compared with the value from the file. If the type is -numeric, this value -is specified in C form; if it is a string, it is specified as a C string -with the usual escapes permitted (e.g. \en for new-line). -.IP -Numeric values -may be preceded by a character indicating the operation to be performed. -It may be -.BR = , -to specify that the value from the file must equal the specified value, -.BR < , -to specify that the value from the file must be less than the specified -value, -.BR > , -to specify that the value from the file must be greater than the specified -value, -.BR & , -to specify that the value from the file must have set all of the bits -that are set in the specified value, -.BR ^ , -to specify that the value from the file must have clear any of the bits -that are set in the specified value, or -.BR x , -to specify that any value will match. If the character is omitted, -it is assumed to be -.BR = . -.IP -Numeric values are specified in C form; e.g. -.B 13 -is decimal, -.B 013 -is octal, and -.B 0x13 -is hexadecimal. -.IP -For string values, the byte string from the -file must match the specified byte string. -The operators -.BR = , -.B < -and -.B > -(but not -.BR & ) -can be applied to strings. -The length used for matching is that of the string argument -in the magic file. This means that a line can match any string, and -then presumably print that string, by doing -.B >\e0 -(because all strings are greater than the null string). -.IP message -The message to be printed if the comparison succeeds. If the string -contains a -.BR printf (3S) -format specification, the value from the file (with any specified masking -performed) is printed using the message as the format string. -.PP -Some file formats contain additional information which is to be printed -along with the file type. A line which begins with the character -.B > -indicates additional tests and messages to be printed. The number of -.B > -on the line indicates the level of the test; a line with no -.B > -at the beginning is considered to be at level 0. -Each line at level -.IB n \(pl1 -is under the control of the line at level -.IB n -most closely preceding it in the magic file. -If the test on a line at level -.I n -succeeds, the tests specified in all the subsequent lines at level -.IB n \(pl1 -are performed, and the messages printed if the tests succeed. The next -line at level -.I n -terminates this. -If the first character following the last -.B > -is a -.B ( -then the string after the parenthesis is interpreted as an indirect offset. -That means that the number after the parenthesis is used as an offset in -the file. The value at that offset is read, and is used again as an offset -in the file. Indirect offsets are of the form: -.BI (( x [.[bslBSL]][+-][ y ]). -The value of -.I x -is used as an offset in the file. A byte, short or long is read at that offset -depending on the -.B [bslBSL] -type specifier. The capitalized types interpret the number as a big endian -value, whereas the small letter versions interpet the number as a little -endian value. To that number the value of -.I y -is added and the result is used as an offset in the file. The default type -if one is not specified is long. -.PP -Sometimes you do not know the exact offset as this depends on the length of -preceding fields. You can specify an offset relative to the end of the -last uplevel field (of course this may only be done for sublevel tests, i.e. -test beginning with -.B > -). Such a relative offset is specified using -.B & -as a prefix to the offset. -.SH BUGS -The formats -.IR long , -.IR belong , -.IR lelong , -.IR short , -.IR beshort , -.IR leshort , -.IR date , -.IR bedate , -and -.I ledate -are system-dependent; perhaps they should be specified as a number -of bytes (2B, 4B, etc), -since the files being recognized typically come from -a system on which the lengths are invariant. -.PP -There is (currently) no support for specified-endian data to be used in -indirect offsets. -.SH SEE ALSO -.BR file (__CSECTION__) -\- the command that reads this file. -.\" -.\" From: guy@sun.uucp (Guy Harris) -.\" Newsgroups: net.bugs.usg -.\" Subject: /etc/magic's format isn't well documented -.\" Message-ID: <2752@sun.uucp> -.\" Date: 3 Sep 85 08:19:07 GMT -.\" Organization: Sun Microsystems, Inc. -.\" Lines: 136 -.\" -.\" Here's a manual page for the format accepted by the "file" made by adding -.\" the changes I posted to the S5R2 version. -.\" -.\" Modified for Ian Darwin's version of the file command. -.\" @(#)$Id: magic.man,v 1.16 1999/11/28 20:02:29 christos Exp $ diff --git a/contrib/file/magic.mime b/contrib/file/magic.mime deleted file mode 100644 index c01840f0156fa..0000000000000 --- a/contrib/file/magic.mime +++ /dev/null @@ -1,531 +0,0 @@ -# Magic data for KMimeMagic (originally for file(1) command) -# -# The format is 4-5 columns: -# Column #1: byte number to begin checking from, ">" indicates continuation -# Column #2: type of data to match -# Column #3: contents of data to match -# Column #4: MIME type of result -# Column #5: MIME encoding of result (optional) - -#------------------------------------------------------------------------------ -# Localstuff: file(1) magic for locally observed files -# Add any locally observed files here. - -#------------------------------------------------------------------------------ -# end local stuff -#------------------------------------------------------------------------------ - -#------------------------------------------------------------------------------ -# Java - -0 short 0xcafe ->2 short 0xbabe application/java - -#------------------------------------------------------------------------------ -# audio: file(1) magic for sound formats -# -# from Jan Nicolai Langfeldt <janl@ifi.uio.no>, -# - -# Sun/NeXT audio data -0 string .snd ->12 belong 1 audio/basic ->12 belong 2 audio/basic ->12 belong 3 audio/basic ->12 belong 4 audio/basic ->12 belong 5 audio/basic ->12 belong 6 audio/basic ->12 belong 7 audio/basic - ->12 belong 23 audio/x-adpcm - -# DEC systems (e.g. DECstation 5000) use a variant of the Sun/NeXT format -# that uses little-endian encoding and has a different magic number -# (0x0064732E in little-endian encoding). -0 lelong 0x0064732E ->12 lelong 1 audio/x-dec-basic ->12 lelong 2 audio/x-dec-basic ->12 lelong 3 audio/x-dec-basic ->12 lelong 4 audio/x-dec-basic ->12 lelong 5 audio/x-dec-basic ->12 lelong 6 audio/x-dec-basic ->12 lelong 7 audio/x-dec-basic -# compressed (G.721 ADPCM) ->12 lelong 23 audio/x-dec-adpcm - -# Bytes 0-3 of AIFF, AIFF-C, & 8SVX audio files are "FORM" -# AIFF audio data -8 string AIFF audio/x-aiff -# AIFF-C audio data -8 string AIFC audio/x-aiff -# IFF/8SVX audio data -8 string 8SVX audio/x-aiff - -# Creative Labs AUDIO stuff -# Standard MIDI data -0 string MThd audio/unknown -#>9 byte >0 (format %d) -#>11 byte >1 using %d channels -# Creative Music (CMF) data -0 string CTMF audio/unknown -# SoundBlaster instrument data -0 string SBI audio/unknown -# Creative Labs voice data -0 string Creative\ Voice\ File audio/unknown -## is this next line right? it came this way... -#>19 byte 0x1A -#>23 byte >0 - version %d -#>22 byte >0 \b.%d - -# [GRR 950115: is this also Creative Labs? Guessing that first line -# should be string instead of unknown-endian long...] -#0 long 0x4e54524b MultiTrack sound data -#0 string NTRK MultiTrack sound data -#>4 long x - version %ld - -# Microsoft WAVE format (*.wav) -# [GRR 950115: probably all of the shorts and longs should be leshort/lelong] -# Microsoft RIFF -0 string RIFF audio/unknown -# - WAVE format ->8 string WAVE audio/x-wav -# -0 belong 0x2e7261fd application/x-realaudio - -# MPEG Layer 3 sound files -# Modified the 11/20/97 at 15:59:04 by Christophe Prud'homme <christophe.prudhomme@asci.fr> -0 belong 0xfffb audio/x-mp3 - -#------------------------------------------------------------------------------ -# c-lang: file(1) magic for C programs or various scripts -# - -# XPM icons (Greg Roelofs, newt@uchicago.edu) -# ideally should go into "images", but entries below would tag XPM as C source -0 string /*\ XPM image/x-xpm 7bit - -# this first will upset you if you're a PL/1 shop... (are there any left?) -# in which case rm it; ascmagic will catch real C programs -# C or REXX program text -#0 string /* text/x-c -# C++ program text -#0 string // text/x-c++ - -#------------------------------------------------------------------------------ -# commands: file(1) magic for various shells and interpreters -# -#0 string :\ shell archive or commands for antique kernel text -0 string #!/bin/sh application/x-shellscript -0 string #!\ /bin/sh application/x-shellscript -0 string #!/bin/csh application/x-shellscript -0 string #!\ /bin/csh application/x-shellscript -# korn shell magic, sent by George Wu, gwu@clyde.att.com -0 string #!/bin/ksh application/x-shellscript -0 string #!\ /bin/ksh application/x-shellscript -0 string #!/bin/tcsh application/x-shellscript -0 string #!\ /bin/tcsh application/x-shellscript -0 string #!/usr/local/tcsh application/x-shellscript -0 string #!\ /usr/local/tcsh application/x-shellscript -0 string #!/usr/local/bin/tcsh application/x-shellscript -0 string #!\ /usr/local/bin/tcsh application/x-shellscript -# bash shell magic, from Peter Tobias (tobias@server.et-inf.fho-emden.de) -0 string #!/bin/bash application/x-shellscript -0 string #!\ /bin/bash application/x-shellscript -0 string #!/usr/local/bin/bash application/x-shellscript -0 string #!\ /usr/local/bin/bash application/x-shellscript - -# -# zsh/ash/ae/nawk/gawk magic from cameron@cs.unsw.oz.au (Cameron Simpson) -0 string #!/usr/local/bin/zsh application/x-shellscript -0 string #!\ /usr/local/bin/zsh application/x-shellscript -0 string #!/usr/local/bin/ash application/x-shellscript -0 string #!\ /usr/local/bin/ash application/x-shellscript -#0 string #!/usr/local/bin/ae Neil Brown's ae -#0 string #!\ /usr/local/bin/ae Neil Brown's ae -0 string #!/bin/nawk application/x-nawk -0 string #!\ /bin/nawk application/x-nawk -0 string #!/usr/bin/nawk application/x-nawk -0 string #!\ /usr/bin/nawk application/x-nawk -0 string #!/usr/local/bin/nawk application/x-nawk -0 string #!\ /usr/local/bin/nawk application/x-nawk -0 string #!/bin/gawk application/x-gawk -0 string #!\ /bin/gawk application/x-gawk -0 string #!/usr/bin/gawk application/x-gawk -0 string #!\ /usr/bin/gawk application/x-gawk -0 string #!/usr/local/bin/gawk application/x-gawk -0 string #!\ /usr/local/bin/gawk application/x-gawk -# -0 string #!/bin/awk application/x-awk -0 string #!\ /bin/awk application/x-awk -0 string #!/usr/bin/awk application/x-awk -0 string #!\ /usr/bin/awk application/x-awk -0 string BEGIN application/x-awk - -# For Larry Wall's perl language. The ``eval'' line recognizes an -# outrageously clever hack for USG systems. -# Keith Waclena <keith@cerberus.uchicago.edu> -0 string #!/bin/perl application/x-perl -0 string #!\ /bin/perl application/x-perl -0 string eval\ "exec\ /bin/perl application/x-perl -0 string #!/usr/bin/perl application/x-perl -0 string #!\ /usr/bin/perl application/x-perl -0 string eval\ "exec\ /usr/bin/perl application/x-perl -0 string #!/usr/local/bin/perl application/x-perl -0 string #!\ /usr/local/bin/perl application/x-perl -0 string eval\ "exec\ /usr/local/bin/perl application/x-perl - -#------------------------------------------------------------------------------ -# compress: file(1) magic for pure-compression formats (no archives) -# -# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, whap, etc. -# -# Formats for various forms of compressed data -# Formats for "compress" proper have been moved into "compress.c", -# because it tries to uncompress it to figure out what's inside. - -# standard unix compress -0 string \037\235 application/x-compress - -# gzip (GNU zip, not to be confused with [Info-ZIP/PKWARE] zip archiver) -0 string \037\213 application/x-gzip - -0 string PK\003\004 application/x-zip - -# According to gzip.h, this is the correct byte order for packed data. -0 string \037\036 application/octet-stream -# -# This magic number is byte-order-independent. -# -0 short 017437 application/octet-stream - -# XXX - why *two* entries for "compacted data", one of which is -# byte-order independent, and one of which is byte-order dependent? -# -# compacted data -0 short 0x1fff application/octet-stream -0 string \377\037 application/octet-stream -# huf output -0 short 0145405 application/octet-stream - -# Squeeze and Crunch... -# These numbers were gleaned from the Unix versions of the programs to -# handle these formats. Note that I can only uncrunch, not crunch, and -# I didn't have a crunched file handy, so the crunch number is untested. -# Keith Waclena <keith@cerberus.uchicago.edu> -#0 leshort 0x76FF squeezed data (CP/M, DOS) -#0 leshort 0x76FE crunched data (CP/M, DOS) - -# Freeze -#0 string \037\237 Frozen file 2.1 -#0 string \037\236 Frozen file 1.0 (or gzip 0.5) - -# lzh? -#0 string \037\240 LZH compressed data - -257 string ustar\0 application/x-tar posix -257 string ustar\040\040\0 application/x-tar gnu - -0 short 070707 application/x-cpio -0 short 0143561 application/x-cpio swapped - -0 string =<ar> application/x-archive -0 string !<arch> application/x-archive ->8 string debian application/x-debian-package - -#------------------------------------------------------------------------------ -# -# RPM: file(1) magic for Red Hat Packages Erik Troan (ewt@redhat.com) -# -0 beshort 0xedab ->2 beshort 0xeedb application/x-rpm - -0 lelong&0x8080ffff 0x0000081a application/x-arc lzw -0 lelong&0x8080ffff 0x0000091a application/x-arc squashed -0 lelong&0x8080ffff 0x0000021a application/x-arc uncompressed -0 lelong&0x8080ffff 0x0000031a application/x-arc packed -0 lelong&0x8080ffff 0x0000041a application/x-arc squeezed -0 lelong&0x8080ffff 0x0000061a application/x-arc crunched - -0 leshort 0xea60 application/octet-stream x-arj - -# LHARC/LHA archiver (Greg Roelofs, newt@uchicago.edu) -2 string -lh0- application/x-lharc lh0 -2 string -lh1- application/x-lharc lh1 -2 string -lz4- application/x-lharc lz4 -2 string -lz5- application/x-lharc lz5 -# [never seen any but the last; -lh4- reported in comp.compression:] -2 string -lzs- application/x-lha lzs -2 string -lh\ - application/x-lha lh -2 string -lhd- application/x-lha lhd -2 string -lh2- application/x-lha lh2 -2 string -lh3- application/x-lha lh3 -2 string -lh4- application/x-lha lh4 -2 string -lh5- application/x-lha lh5 -# Shell archives -10 string #\ This\ is\ a\ shell\ archive application/octet-stream x-shell - -#------------------------------------------------------------------------------ -# frame: file(1) magic for FrameMaker files -# -# This stuff came on a FrameMaker demo tape, most of which is -# copyright, but this file is "published" as witness the following: -# -0 string \<MakerFile application/x-frame -0 string \<MIFFile application/x-frame -0 string \<MakerDictionary application/x-frame -0 string \<MakerScreenFon application/x-frame -0 string \<MML application/x-frame -0 string \<Book application/x-frame -0 string \<Maker application/x-frame - -#------------------------------------------------------------------------------ -# html: file(1) magic for HTML (HyperText Markup Language) docs -# -# from Daniel Quinlan <quinlan@yggdrasil.com> -# -0 string \<HEAD text/html -0 string \<head text/html -0 string \<TITLE text/html -0 string \<title text/html -0 string \<html text/html -0 string \<HTML text/html -0 string \<!-- text/html -0 string \<h1 text/html -0 string \<H1 text/html -0 string \<!doctype\ HTML text/html -0 string \<!DOCTYPE\ HTML text/html -0 string \<!doctype\ html text/html - -#------------------------------------------------------------------------------ -# images: file(1) magic for image formats (see also "c-lang" for XPM bitmaps) -# -# originally from jef@helios.ee.lbl.gov (Jef Poskanzer), -# additions by janl@ifi.uio.no as well as others. Jan also suggested -# merging several one- and two-line files into here. -# -# XXX - byte order for GIF and TIFF fields? -# [GRR: TIFF allows both byte orders; GIF is probably little-endian] -# - -# [GRR: what the hell is this doing in here?] -#0 string xbtoa btoa'd file - -# PBMPLUS -# PBM file -0 string P1 image/x-portable-bitmap 7bit -# PGM file -0 string P2 image/x-portable-greymap 7bit -# PPM file -0 string P3 image/x-portable-pixmap 7bit -# PBM "rawbits" file -0 string P4 image/x-portable-bitmap -# PGM "rawbits" file -0 string P5 image/x-portable-greymap -# PPM "rawbits" file -0 string P6 image/x-portable-pixmap - -# NIFF (Navy Interchange File Format, a modification of TIFF) -# [GRR: this *must* go before TIFF] -0 string IIN1 image/x-niff - -# TIFF and friends -# TIFF file, big-endian -0 string MM image/tiff -# TIFF file, little-endian -0 string II image/tiff - -# possible GIF replacements; none yet released! -# (Greg Roelofs, newt@uchicago.edu) -# -# GRR 950115: this was mine ("Zip GIF"): -# ZIF image (GIF+deflate alpha) -0 string GIF94z image/unknown -# -# GRR 950115: this is Jeremy Wohl's Free Graphics Format (better): -# FGF image (GIF+deflate beta) -0 string FGF95a image/unknown -# -# GRR 950115: this is Thomas Boutell's Portable Bitmap Format proposal -# (best; not yet implemented): -# PBF image (deflate compression) -0 string PBF image/unknown - -# GIF -0 string GIF image/gif - -# JPEG images -0 beshort 0xffd8 image/jpeg - -# PC bitmaps (OS/2, Windoze BMP files) (Greg Roelofs, newt@uchicago.edu) -0 string BM image/bmp -#>14 byte 12 (OS/2 1.x format) -#>14 byte 64 (OS/2 2.x format) -#>14 byte 40 (Windows 3.x format) -#0 string IC icon -#0 string PI pointer -#0 string CI color icon -#0 string CP color pointer -#0 string BA bitmap array - - -#------------------------------------------------------------------------------ -# lisp: file(1) magic for lisp programs -# -# various lisp types, from Daniel Quinlan (quinlan@yggdrasil.com) -0 string ;; text/plain 8bit -# Emacs 18 - this is always correct, but not very magical. -0 string \012( application/x-elc -# Emacs 19 -0 string ;ELC\023\000\000\000 application/x-elc - -#------------------------------------------------------------------------------ -# mail.news: file(1) magic for mail and news -# -# There are tests to ascmagic.c to cope with mail and news. -0 string Relay-Version: message/rfc822 7bit -0 string #!\ rnews message/rfc822 7bit -0 string N#!\ rnews message/rfc822 7bit -0 string Forward\ to message/rfc822 7bit -0 string Pipe\ to message/rfc822 7bit -0 string Return-Path: message/rfc822 7bit -0 string Path: message/news 8bit -0 string Xref: message/news 8bit -0 string From: message/rfc822 7bit -0 string Article message/news 8bit -#------------------------------------------------------------------------------ -# msword: file(1) magic for MS Word files -# -# Contributor claims: -# Reversed-engineered MS Word magic numbers -# - -0 string \376\067\0\043 application/msword -0 string \320\317\021\340\241\261 application/msword -0 string \333\245-\0\0\0 application/msword - - - -#------------------------------------------------------------------------------ -# printer: file(1) magic for printer-formatted files -# - -# PostScript -0 string %! application/postscript -0 string \004%! application/postscript - -# Acrobat -# (due to clamen@cs.cmu.edu) -0 string %PDF- application/pdf - -#------------------------------------------------------------------------------ -# sc: file(1) magic for "sc" spreadsheet -# -38 string Spreadsheet application/x-sc - -#------------------------------------------------------------------------------ -# tex: file(1) magic for TeX files -# -# XXX - needs byte-endian stuff (big-endian and little-endian DVI?) -# -# From <conklin@talisman.kaleida.com> - -# Although we may know the offset of certain text fields in TeX DVI -# and font files, we can't use them reliably because they are not -# zero terminated. [but we do anyway, christos] -0 string \367\002 application/x-dvi -#0 string \367\203 TeX generic font data -#0 string \367\131 TeX packed font data -#0 string \367\312 TeX virtual font data -#0 string This\ is\ TeX, TeX transcript text -#0 string This\ is\ METAFONT, METAFONT transcript text - -# There is no way to detect TeX Font Metric (*.tfm) files without -# breaking them apart and reading the data. The following patterns -# match most *.tfm files generated by METAFONT or afm2tfm. -2 string \000\021 application/x-tex-tfm -2 string \000\022 application/x-tex-tfm -#>34 string >\0 (%s) - -# Texinfo and GNU Info, from Daniel Quinlan (quinlan@yggdrasil.com) -#0 string \\input\ texinfo Texinfo source text -#0 string This\ is\ Info\ file GNU Info text - -# correct TeX magic for Linux (and maybe more) -# from Peter Tobias (tobias@server.et-inf.fho-emden.de) -# -0 leshort 0x02f7 application/x-dvi - -# RTF - Rich Text Format -0 string {\\rtf text/rtf - -#------------------------------------------------------------------------------ -# animation: file(1) magic for animation/movie formats -# -# animation formats, originally from vax@ccwf.cc.utexas.edu (VaX#n8) -# MPEG file -0 string \000\000\001\263 video/mpeg -# FLI animation format -0 leshort 0xAF11 video/fli -# FLC animation format -0 leshort 0xAF12 video/flc -# AVI ->8 string AVI\ video/avi -# -# SGI and Apple formats -# -0 string MOVI video/sgi -4 string moov video/quicktime moov -4 string mdat video/quicktime mdat -# The contributor claims: -# I couldn't find a real magic number for these, however, this -# -appears- to work. Note that it might catch other files, too, -# so BE CAREFUL! -# -# Note that title and author appear in the two 20-byte chunks -# at decimal offsets 2 and 22, respectively, but they are XOR'ed with -# 255 (hex FF)! DL format SUCKS BIG ROCKS. -# -# DL file version 1 , medium format (160x100, 4 images/screen) -0 byte 1 video/unknown -0 byte 2 video/unknown -# -# Databases -# -# GDBM magic numbers -# Will be maintained as part of the GDBM distribution in the future. -# <downsj@teeny.org> -0 belong 0x13579ace application/x-gdbm -0 lelong 0x13579ace application/x-gdbm -0 string GDBM application/x-gdbm -# -0 belong 0x061561 application/x-dbm -# -# Executables -# -0 string \177ELF ->4 byte 0 ->4 byte 1 ->4 byte 2 ->5 byte 0 ->5 byte 1 ->>16 leshort 0 ->>16 leshort 1 application/x-object ->>16 leshort 2 application/x-executable ->>16 leshort 3 application/x-sharedlib ->>16 leshort 4 application/x-coredump -# -# DOS -0 string MZ application/x-dosexec -# -# KDE -0 string [KDE\ Desktop\ Entry] application/x-kdelnk -0 string \#\ KDE\ Config\ File application/x-kdelnk -# xmcd database file for kscd -0 string \#\ xmcd text/xmcd - -#------------------------------------------------------------------------------ -# pkgadd: file(1) magic for SysV R4 PKG Datastreams -# -0 string #\ PaCkAgE\ DaTaStReAm application/x-svr4-package - - diff --git a/contrib/file/magic2mime b/contrib/file/magic2mime deleted file mode 100755 index 9c6b4ecd630ee..0000000000000 --- a/contrib/file/magic2mime +++ /dev/null @@ -1,68 +0,0 @@ -#! /usr/local/bin/perl -# -*- PERL -*- -# $Id: magic2mime,v 1.1 1998/02/15 23:18:53 christos Exp $ -# Copyright (c) 1996, 1997 vax@linkdead.paranoia.com (VaX#n8) -# -# Usage: echo 'your-file-output-here' | file_to_ctype.pl -# file -b files... | file_to_ctype.pl -# It acts like a filter, reading from STDIN and any files on the command -# line, printing to STDOUT. - -## refs -# http://www.faqs.org/faqs/mail/mime-faq/part1/index.html -# comp.mail.mime FAQ -# ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types -# assigned content-types -# ftp://ftp.uu.net/inet/rfc/rfc-index -# RFC index; search for MIME - -@mapping = -( - # defaults - 'data', 'application/octet-stream', - 'text', 'text/plain', - # more specific - '^Rich Text Format data', 'text/richtext', - '^HTML document text', 'text/html', - '^exported SGML document text', 'text/sgml', - 'mail text', 'message/rfc822', - 'news text', 'message/news', - '^PostScript document text', 'application/postscript', - '^BinHex binary text', 'application/mac-binhex40', - '^Zip archive data', 'application/zip', - '^Microsoft Word', 'application/msword', - '^PGP key', 'application/pgp-keys', - '^PGP encrypted', 'application/pgp-encrypted', - '^PGP armored data signature', 'application/pgp-signature', - '^JPEG image', 'image/jpeg', - '^GIF image', 'image/gif', - '^PNG image', 'image/png', - '^TIFF image', 'image/tiff', - 'Computer Graphics Metafile', 'image/cgf', - '^Sun/NeXT audio data', 'audio/basic', - '^MPEG', 'video/mpeg', - '^Apple QuickTime movie', 'video/quicktime', - # made up by me - '^bitmap', 'image/x-bitmap', - '^PC bitmap data, Windows 3.x format', 'image/x-msw3bmp', - '^FLI', 'video/x-fli', - '^FLC', 'video/x-flc', - 'AVI data', 'video/x-avi', - 'WAVE', 'audio/x-wav', - 'VOC', 'audio/x-voc', -); - -local($mimetype,$index,$regexp); -while (<>) - { - chop; - $index = $#mapping - 1; - while ($index > -1 && !defined($mimetype)) - { - $mimetype = $mapping[$index + 1] if (/$mapping[$index]/); - $index -= 2; - } - print "$mimetype\n"; - undef $mimetype; # hack - } -0; diff --git a/contrib/file/missing b/contrib/file/missing deleted file mode 100755 index e69de29bb2d1d..0000000000000 --- a/contrib/file/missing +++ /dev/null diff --git a/contrib/file/names.h b/contrib/file/names.h deleted file mode 100644 index 856632a9dc3ac..0000000000000 --- a/contrib/file/names.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Names.h - names and types used by ascmagic in file(1). - * These tokens are here because they can appear anywhere in - * the first HOWMANY bytes, while tokens in /etc/magic must - * appear at fixed offsets into the file. Don't make HOWMANY - * too high unless you have a very fast CPU. - * - * Copyright (c) Ian F. Darwin, 1987. - * Written by Ian F. Darwin. - * - * See LEGAL.NOTICE - * - * $Id: names.h,v 1.18 2000/08/05 17:36:49 christos Exp $ - */ - -/* - modified by Chris Lowth - 9 April 2000 - to add mime type strings to the types table. -*/ - -/* these types are used to index the table 'types': keep em in sync! */ -#define L_C 0 /* first and foremost on UNIX */ -#define L_CC 1 /* Bjarne's postincrement */ -#define L_FORT 2 /* the oldest one */ -#define L_MAKE 3 /* Makefiles */ -#define L_PLI 4 /* PL/1 */ -#define L_MACH 5 /* some kinda assembler */ -#define L_ENG 6 /* English */ -#define L_PAS 7 /* Pascal */ -#define L_MAIL 8 /* Electronic mail */ -#define L_NEWS 9 /* Usenet Netnews */ -#define L_JAVA 10 /* Java code */ -#define L_HTML 11 /* HTML */ -#define L_BCPL 12 /* BCPL */ -#define L_M4 13 /* M4 */ - -static const struct { - char *human; - char *mime; -} types[] = { - { "C program", "text/x-c", }, - { "C++ program", "text/x-c++" }, - { "FORTRAN program", "text/x-fortran" }, - { "make commands", "text/x-makefile" }, - { "PL/1 program", "text/x-pl1" }, - { "assembler program", "text/x-asm" }, - { "English", "text/plain, English" }, - { "Pascal program", "text/x-pascal" }, - { "mail", "text/x-mail" }, - { "news", "text/x-news" }, - { "Java program", "text/x-java" }, - { "HTML document", "text/html", }, - { "BCPL program", "text/x-bcpl" }, - { "M4 macro language pre-processor", "text/x-m4" }, - { "can't happen error on names.h/types", "error/x-error" }, - { 0, 0} -}; - -/* - * XXX - how should we distinguish Java from C++? - * The trick used in a Debian snapshot, of having "extends" or "implements" - * as tags for Java, doesn't work very well, given that those keywords - * are often preceded by "class", which flags it as C++. - * - * Perhaps we need to be able to say - * - * If "class" then - * - * if "extends" or "implements" then - * Java - * else - * C++ - * endif - * - * Or should we use other keywords, such as "package" or "import"? - * Unfortunately, Ada95 uses "package", and Modula-3 uses "import", - * although I infer from the language spec at - * - * http://www.research.digital.com/SRC/m3defn/html/m3.html - * - * that Modula-3 uses "IMPORT" rather than "import", i.e. it must be - * in all caps. - * - * So, for now, we go with "import". We must put it before the C++ - * stuff, so that we don't misidentify Java as C++. Not using "package" - * means we won't identify stuff that defines a package but imports - * nothing; hopefully, very little Java code imports nothing (one of the - * reasons for doing OO programming is to import as much as possible - * and write only what you need to, right?). - * - * Unfortunately, "import" may cause us to misidentify English text - * as Java, as it comes after "the" and "The". Perhaps we need a fancier - * heuristic to identify Java? - */ -static struct names { - const char *name; - short type; -} names[] = { - /* These must be sorted by eye for optimal hit rate */ - /* Add to this list only after substantial meditation */ - {"dnl", L_M4}, - {"import", L_JAVA}, - {"\"libhdr\"", L_BCPL}, - {"\"LIBHDR\"", L_BCPL}, - {"//", L_CC}, - {"template", L_CC}, - {"virtual", L_CC}, - {"class", L_CC}, - {"public:", L_CC}, - {"private:", L_CC}, - {"/*", L_C}, /* must precede "The", "the", etc. */ - {"#include", L_C}, - {"char", L_C}, - {"The", L_ENG}, - {"the", L_ENG}, - {"double", L_C}, - {"extern", L_C}, - {"float", L_C}, - {"struct", L_C}, - {"union", L_C}, - {"CFLAGS", L_MAKE}, - {"LDFLAGS", L_MAKE}, - {"all:", L_MAKE}, - {".PRECIOUS", L_MAKE}, -/* Too many files of text have these words in them. Find another way - * to recognize Fortrash. - */ -#ifdef NOTDEF - {"subroutine", L_FORT}, - {"function", L_FORT}, - {"block", L_FORT}, - {"common", L_FORT}, - {"dimension", L_FORT}, - {"integer", L_FORT}, - {"data", L_FORT}, -#endif /*NOTDEF*/ - {".ascii", L_MACH}, - {".asciiz", L_MACH}, - {".byte", L_MACH}, - {".even", L_MACH}, - {".globl", L_MACH}, - {".text", L_MACH}, - {"clr", L_MACH}, - {"(input,", L_PAS}, - {"dcl", L_PLI}, - {"Received:", L_MAIL}, - {">From", L_MAIL}, - {"Return-Path:",L_MAIL}, - {"Cc:", L_MAIL}, - {"Newsgroups:", L_NEWS}, - {"Path:", L_NEWS}, - {"Organization:",L_NEWS}, - {"href=", L_HTML}, - {"HREF=", L_HTML}, - {"<body", L_HTML}, - {"<BODY", L_HTML}, - {NULL, 0} -}; -#define NNAMES ((sizeof(names)/sizeof(struct names)) - 1) diff --git a/contrib/file/print.c b/contrib/file/print.c deleted file mode 100644 index 7992f5c578f7e..0000000000000 --- a/contrib/file/print.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * print.c - debugging printout routines - * - * Copyright (c) Ian F. Darwin, 1987. - * Written by Ian F. Darwin. - * - * This software is not subject to any license of the American Telephone - * and Telegraph Company or of the Regents of the University of California. - * - * Permission is granted to anyone to use this software for any purpose on - * any computer system, and to alter it and redistribute it freely, subject - * to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of this - * software, no matter how awful, even if they arise from flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, - * credits must appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users - * ever read sources, credits must appear in the documentation. - * - * 4. This notice may not be removed or altered. - */ - -#include "file.h" -#include <stdio.h> -#include <errno.h> -#include <string.h> -#ifdef __STDC__ -# include <stdarg.h> -#else -# include <varargs.h> -#endif -#include <stdlib.h> -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <time.h> - -#ifndef lint -FILE_RCSID("@(#)$Id: print.c,v 1.31 2000/08/05 17:36:49 christos Exp $") -#endif /* lint */ - -#define SZOF(a) (sizeof(a) / sizeof(a[0])) - -void -mdump(m) - struct magic *m; -{ - static const char *typ[] = { "invalid", "byte", "short", "invalid", - "long", "string", "date", "beshort", - "belong", "bedate", "leshort", "lelong", - "ledate" }; - (void) fputc('[', stderr); - (void) fprintf(stderr, ">>>>>>>> %d" + 8 - (m->cont_level & 7), - m->offset); - - if (m->flag & INDIR) - (void) fprintf(stderr, "(%s,%d),", - /* Note: in.type is unsigned */ - (m->in.type < SZOF(typ)) ? - typ[m->in.type] : "*bad*", - m->in.offset); - - (void) fprintf(stderr, " %s%s", (m->flag & UNSIGNED) ? "u" : "", - /* Note: type is unsigned */ - (m->type < SZOF(typ)) ? typ[m->type] : "*bad*"); - if (m->mask != ~((uint32)0)) { - if(STRING != m->type) - (void) fprintf(stderr, " & %.8x", m->mask); - else { - (void) fputc('/', stderr); - if (m->mask & STRING_IGNORE_LOWERCASE) - (void) fputc(CHAR_IGNORE_LOWERCASE, stderr); - if (m->mask & STRING_COMPACT_BLANK) - (void) fputc(CHAR_COMPACT_BLANK, stderr); - if (m->mask & STRING_COMPACT_OPTIONAL_BLANK) - (void) fputc(CHAR_COMPACT_OPTIONAL_BLANK, - stderr); - } - } - - (void) fprintf(stderr, ",%c", m->reln); - - if (m->reln != 'x') { - switch (m->type) { - case BYTE: - case SHORT: - case LONG: - case LESHORT: - case LELONG: - case BESHORT: - case BELONG: - (void) fprintf(stderr, "%d", m->value.l); - break; - case STRING: - showstr(stderr, m->value.s, -1); - break; - case DATE: - case LEDATE: - case BEDATE: - { - time_t t = m->value.l; - char *rt, *pp = ctime(&t); - - if ((rt = strchr(pp, '\n')) != NULL) - *rt = '\0'; - (void) fprintf(stderr, "%s,", pp); - if (rt) - *rt = '\n'; - } - break; - default: - (void) fputs("*bad*", stderr); - break; - } - } - (void) fprintf(stderr, ",\"%s\"]\n", m->desc); -} - -/* - * ckfputs - futs, but with error checking - * ckfprintf - fprintf, but with error checking - */ -void -ckfputs(str, fil) - const char *str; - FILE *fil; -{ - if (fputs(str,fil) == EOF) - error("write failed.\n"); -} - -/*VARARGS*/ -void -#ifdef __STDC__ -ckfprintf(FILE *f, const char *fmt, ...) -#else -ckfprintf(va_alist) - va_dcl -#endif -{ - va_list va; -#ifdef __STDC__ - va_start(va, fmt); -#else - FILE *f; - const char *fmt; - va_start(va); - f = va_arg(va, FILE *); - fmt = va_arg(va, const char *); -#endif - (void) vfprintf(f, fmt, va); - if (ferror(f)) - error("write failed.\n"); - va_end(va); -} - -/* - * error - print best error message possible and exit - */ -/*VARARGS*/ -void -#ifdef __STDC__ -error(const char *f, ...) -#else -error(va_alist) - va_dcl -#endif -{ - va_list va; -#ifdef __STDC__ - va_start(va, f); -#else - const char *f; - va_start(va); - f = va_arg(va, const char *); -#endif - /* cuz we use stdout for most, stderr here */ - (void) fflush(stdout); - - if (progname != NULL) - (void) fprintf(stderr, "%s: ", progname); - (void) vfprintf(stderr, f, va); - va_end(va); - exit(1); -} - -/*VARARGS*/ -void -#ifdef __STDC__ -magwarn(const char *f, ...) -#else -magwarn(va_alist) - va_dcl -#endif -{ - va_list va; -#ifdef __STDC__ - va_start(va, f); -#else - const char *f; - va_start(va); - f = va_arg(va, const char *); -#endif - /* cuz we use stdout for most, stderr here */ - (void) fflush(stdout); - - if (progname != NULL) - (void) fprintf(stderr, "%s: %s, %d: ", - progname, magicfile, lineno); - (void) vfprintf(stderr, f, va); - va_end(va); - fputc('\n', stderr); -} diff --git a/contrib/file/readelf.h b/contrib/file/readelf.h deleted file mode 100644 index d0ae3337394bc..0000000000000 --- a/contrib/file/readelf.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * readelf.h - * @(#)$Id: readelf.h,v 1.7 1999/02/14 17:16:11 christos Exp $ - * - * Provide elf data structures for non-elf machines, allowing file - * non-elf hosts to determine if an elf binary is stripped. - * Note: cobbled from the linux header file, with modifications - */ -#ifndef __fake_elf_h__ -#define __fake_elf_h__ - -typedef uint32_t Elf32_Addr; -typedef uint32_t Elf32_Off; -typedef uint16_t Elf32_Half; -typedef uint32_t Elf32_Word; -typedef uint8_t Elf32_Char; - -#if SIZEOF_UINT64_T != 8 -#define USE_ARRAY_FOR_64BIT_TYPES -typedef uint32_t Elf64_Addr[2]; -typedef uint32_t Elf64_Off[2]; -typedef uint32_t Elf64_Xword[2]; -#else -typedef uint64_t Elf64_Addr; -typedef uint64_t Elf64_Off; -typedef uint64_t Elf64_Xword; -#endif -typedef uint16_t Elf64_Half; -typedef uint32_t Elf64_Word; -typedef uint8_t Elf64_Char; - -#define EI_NIDENT 16 - -typedef struct { - Elf32_Char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; /* Entry point */ - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; -} Elf32_Ehdr; - -typedef struct { - Elf64_Char e_ident[EI_NIDENT]; - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; /* Entry point */ - Elf64_Off e_phoff; - Elf64_Off e_shoff; - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; -} Elf64_Ehdr; - -/* e_type */ -#define ET_EXEC 2 -#define ET_CORE 4 - -/* sh_type */ -#define SHT_SYMTAB 2 -#define SHT_NOTE 7 -#define SHT_DYNSYM 11 - -/* elf type */ -#define ELFDATANONE 0 /* e_ident[EI_DATA] */ -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - -/* elf class */ -#define ELFCLASSNONE 0 -#define ELFCLASS32 1 -#define ELFCLASS64 2 - -/* magic number */ -#define EI_MAG0 0 /* e_ident[] indexes */ -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 -#define EI_PAD 7 - -#define ELFMAG0 0x7f /* EI_MAG */ -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' -#define ELFMAG "\177ELF" - -#define OLFMAG1 'O' -#define OLFMAG "\177OLF" - -typedef struct { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; -} Elf32_Phdr; - -typedef struct { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; - Elf64_Addr p_vaddr; - Elf64_Addr p_paddr; - Elf64_Xword p_filesz; - Elf64_Xword p_memsz; - Elf64_Xword p_align; -} Elf64_Phdr; - -#define PT_NULL 0 /* p_type */ -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_NUM 7 - -typedef struct { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; -} Elf32_Shdr; - -typedef struct { - Elf64_Word sh_name; - Elf64_Word sh_type; - Elf64_Off sh_flags; - Elf64_Addr sh_addr; - Elf64_Off sh_offset; - Elf64_Off sh_size; - Elf64_Word sh_link; - Elf64_Word sh_info; - Elf64_Off sh_addralign; - Elf64_Off sh_entsize; -} Elf64_Shdr; - -/* Notes used in ET_CORE */ -#define NT_PRSTATUS 1 -#define NT_PRFPREG 2 -#define NT_PRPSINFO 3 -#define NT_TASKSTRUCT 4 - -/* Note header in a PT_NOTE section */ -typedef struct elf_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ -} Elf32_Nhdr; - -typedef struct { - Elf64_Word n_namesz; - Elf64_Word n_descsz; - Elf64_Word n_type; -} Elf64_Nhdr; - -#define NT_PRSTATUS 1 -#define NT_PRFPREG 2 -#define NT_PRPSINFO 3 -#define NT_PRXREG 4 -#define NT_PLATFORM 5 -#define NT_AUXV 6 - -#endif diff --git a/contrib/file/softmagic.c b/contrib/file/softmagic.c deleted file mode 100644 index 2fb4c4a5e0b79..0000000000000 --- a/contrib/file/softmagic.c +++ /dev/null @@ -1,569 +0,0 @@ -/* - * softmagic - interpret variable magic from /etc/magic - * - * Copyright (c) Ian F. Darwin, 1987. - * Written by Ian F. Darwin. - * - * This software is not subject to any license of the American Telephone - * and Telegraph Company or of the Regents of the University of California. - * - * Permission is granted to anyone to use this software for any purpose on - * any computer system, and to alter it and redistribute it freely, subject - * to the following restrictions: - * - * 1. The author is not responsible for the consequences of use of this - * software, no matter how awful, even if they arise from flaws in it. - * - * 2. The origin of this software must not be misrepresented, either by - * explicit claim or by omission. Since few users ever read sources, - * credits must appear in the documentation. - * - * 3. Altered versions must be plainly marked as such, and must not be - * misrepresented as being the original software. Since few users - * ever read sources, credits must appear in the documentation. - * - * 4. This notice may not be removed or altered. - */ - -#include <stdio.h> -#include <string.h> -#include <ctype.h> -#include <stdlib.h> -#include <time.h> -#include <sys/types.h> - -#include "file.h" - -#ifndef lint -FILE_RCSID("@(#)$Id: softmagic.c,v 1.42 2000/08/05 17:36:49 christos Exp $") -#endif /* lint */ - -static int match __P((unsigned char *, int)); -static int mget __P((union VALUETYPE *, - unsigned char *, struct magic *, int)); -static int mcheck __P((union VALUETYPE *, struct magic *)); -static int32 mprint __P((union VALUETYPE *, struct magic *)); -static void mdebug __P((int32, char *, int)); -static int mconvert __P((union VALUETYPE *, struct magic *)); - -/* - * softmagic - lookup one file in database - * (already read from /etc/magic by apprentice.c). - * Passed the name and FILE * of one file to be typed. - */ -/*ARGSUSED1*/ /* nbytes passed for regularity, maybe need later */ -int -softmagic(buf, nbytes) - unsigned char *buf; - int nbytes; -{ - if (match(buf, nbytes)) - return 1; - - return 0; -} - -/* - * Go through the whole list, stopping if you find a match. Process all - * the continuations of that match before returning. - * - * We support multi-level continuations: - * - * At any time when processing a successful top-level match, there is a - * current continuation level; it represents the level of the last - * successfully matched continuation. - * - * Continuations above that level are skipped as, if we see one, it - * means that the continuation that controls them - i.e, the - * lower-level continuation preceding them - failed to match. - * - * Continuations below that level are processed as, if we see one, - * it means we've finished processing or skipping higher-level - * continuations under the control of a successful or unsuccessful - * lower-level continuation, and are now seeing the next lower-level - * continuation and should process it. The current continuation - * level reverts to the level of the one we're seeing. - * - * Continuations at the current level are processed as, if we see - * one, there's no lower-level continuation that may have failed. - * - * If a continuation matches, we bump the current continuation level - * so that higher-level continuations are processed. - */ -static int -match(s, nbytes) - unsigned char *s; - int nbytes; -{ - int magindex = 0; - int cont_level = 0; - int need_separator = 0; - union VALUETYPE p; - static int32 *tmpoff = NULL; - static size_t tmplen = 0; - int32 oldoff = 0; - int returnval = 0; /* if a match is found it is set to 1*/ - extern int kflag; - int firstline = 1; /* a flag to print X\n X\n- X */ - - if (tmpoff == NULL) - if ((tmpoff = (int32 *) malloc(tmplen = 20)) == NULL) - error("out of memory\n"); - - for (magindex = 0; magindex < nmagic; magindex++) { - /* if main entry matches, print it... */ - if (!mget(&p, s, &magic[magindex], nbytes) || - !mcheck(&p, &magic[magindex])) { - /* - * main entry didn't match, - * flush its continuations - */ - while (magindex < nmagic && - magic[magindex + 1].cont_level != 0) - magindex++; - continue; - } - - if (! firstline) { /* we found another match */ - /* put a newline and '-' to do some simple formatting*/ - printf("\n- "); - } - - tmpoff[cont_level] = mprint(&p, &magic[magindex]); - /* - * If we printed something, we'll need to print - * a blank before we print something else. - */ - if (magic[magindex].desc[0]) - need_separator = 1; - /* and any continuations that match */ - if (++cont_level >= tmplen) - if ((tmpoff = (int32 *) realloc(tmpoff, - tmplen += 20)) == NULL) - error("out of memory\n"); - while (magic[magindex+1].cont_level != 0 && - ++magindex < nmagic) { - if (cont_level >= magic[magindex].cont_level) { - if (cont_level > magic[magindex].cont_level) { - /* - * We're at the end of the level - * "cont_level" continuations. - */ - cont_level = magic[magindex].cont_level; - } - if (magic[magindex].flag & ADD) { - oldoff=magic[magindex].offset; - magic[magindex].offset += tmpoff[cont_level-1]; - } - if (mget(&p, s, &magic[magindex], nbytes) && - mcheck(&p, &magic[magindex])) { - /* - * This continuation matched. - * Print its message, with - * a blank before it if - * the previous item printed - * and this item isn't empty. - */ - /* space if previous printed */ - if (need_separator - && (magic[magindex].nospflag == 0) - && (magic[magindex].desc[0] != '\0') - ) { - (void) putchar(' '); - need_separator = 0; - } - tmpoff[cont_level] = mprint(&p, &magic[magindex]); - if (magic[magindex].desc[0]) - need_separator = 1; - - /* - * If we see any continuations - * at a higher level, - * process them. - */ - if (++cont_level >= tmplen) - if ((tmpoff = - (int32 *) realloc(tmpoff, - tmplen += 20)) == NULL) - error("out of memory\n"); - } - if (magic[magindex].flag & ADD) { - magic[magindex].offset = oldoff; - } - } - } - firstline = 0; - returnval = 1; - if (!kflag) { - return 1; /* don't keep searching */ - } - } - return returnval; /* This is hit if -k is set or there is no match */ -} - -static int32 -mprint(p, m) - union VALUETYPE *p; - struct magic *m; -{ - char *pp, *rt; - uint32 v; - time_t curtime; - int32 t=0 ; - - - switch (m->type) { - case BYTE: - v = p->b; - v = signextend(m, v) & m->mask; - (void) printf(m->desc, (unsigned char) v); - t = m->offset + sizeof(char); - break; - - case SHORT: - case BESHORT: - case LESHORT: - v = p->h; - v = signextend(m, v) & m->mask; - (void) printf(m->desc, (unsigned short) v); - t = m->offset + sizeof(short); - break; - - case LONG: - case BELONG: - case LELONG: - v = p->l; - v = signextend(m, v) & m->mask; - (void) printf(m->desc, (uint32) v); - t = m->offset + sizeof(int32); - break; - - case STRING: - if (m->reln == '=') { - (void) printf(m->desc, m->value.s); - t = m->offset + strlen(m->value.s); - } - else { - if (*m->value.s == '\0') { - char *cp = strchr(p->s,'\n'); - if (cp) - *cp = '\0'; - } - (void) printf(m->desc, p->s); - t = m->offset + strlen(p->s); - } - break; - - case DATE: - case BEDATE: - case LEDATE: - curtime = p->l; - pp = ctime(&curtime); - if ((rt = strchr(pp, '\n')) != NULL) - *rt = '\0'; - (void) printf(m->desc, pp); - t = m->offset + sizeof(time_t); - break; - - default: - error("invalid m->type (%d) in mprint().\n", m->type); - /*NOTREACHED*/ - } - return(t); -} - -/* - * Convert the byte order of the data we are looking at - */ -static int -mconvert(p, m) - union VALUETYPE *p; - struct magic *m; -{ - switch (m->type) { - case BYTE: - case SHORT: - case LONG: - case DATE: - return 1; - case STRING: - { - char *ptr; - - /* Null terminate and eat the return */ - p->s[sizeof(p->s) - 1] = '\0'; - if ((ptr = strchr(p->s, '\n')) != NULL) - *ptr = '\0'; - return 1; - } - case BESHORT: - p->h = (short)((p->hs[0]<<8)|(p->hs[1])); - return 1; - case BELONG: - case BEDATE: - p->l = (int32) - ((p->hl[0]<<24)|(p->hl[1]<<16)|(p->hl[2]<<8)|(p->hl[3])); - return 1; - case LESHORT: - p->h = (short)((p->hs[1]<<8)|(p->hs[0])); - return 1; - case LELONG: - case LEDATE: - p->l = (int32) - ((p->hl[3]<<24)|(p->hl[2]<<16)|(p->hl[1]<<8)|(p->hl[0])); - return 1; - default: - error("invalid type %d in mconvert().\n", m->type); - return 0; - } -} - - -static void -mdebug(offset, str, len) - int32 offset; - char *str; - int len; -{ - (void) fprintf(stderr, "mget @%d: ", offset); - showstr(stderr, (char *) str, len); - (void) fputc('\n', stderr); - (void) fputc('\n', stderr); -} - -static int -mget(p, s, m, nbytes) - union VALUETYPE* p; - unsigned char *s; - struct magic *m; - int nbytes; -{ - int32 offset = m->offset; - - if (offset + sizeof(union VALUETYPE) <= nbytes) - memcpy(p, s + offset, sizeof(union VALUETYPE)); - else { - /* - * the usefulness of padding with zeroes eludes me, it - * might even cause problems - */ - int32 have = nbytes - offset; - memset(p, 0, sizeof(union VALUETYPE)); - if (have > 0) - memcpy(p, s + offset, have); - } - - - if (debug) { - mdebug(offset, (char *) p, sizeof(union VALUETYPE)); - mdump(m); - } - - if (m->flag & INDIR) { - - switch (m->in.type) { - case BYTE: - offset = p->b + m->in.offset; - break; - case BESHORT: - offset = (short)((p->hs[0]<<8)|(p->hs[1]))+ - m->in.offset; - break; - case LESHORT: - offset = (short)((p->hs[1]<<8)|(p->hs[0]))+ - m->in.offset; - break; - case SHORT: - offset = p->h + m->in.offset; - break; - case BELONG: - offset = (int32)((p->hl[0]<<24)|(p->hl[1]<<16)| - (p->hl[2]<<8)|(p->hl[3]))+ - m->in.offset; - break; - case LELONG: - offset = (int32)((p->hl[3]<<24)|(p->hl[2]<<16)| - (p->hl[1]<<8)|(p->hl[0]))+ - m->in.offset; - break; - case LONG: - offset = p->l + m->in.offset; - break; - } - - if (offset + sizeof(union VALUETYPE) > nbytes) - return 0; - - memcpy(p, s + offset, sizeof(union VALUETYPE)); - - if (debug) { - mdebug(offset, (char *) p, sizeof(union VALUETYPE)); - mdump(m); - } - } - if (!mconvert(p, m)) - return 0; - return 1; -} - -static int -mcheck(p, m) - union VALUETYPE* p; - struct magic *m; -{ - uint32 l = m->value.l; - uint32 v; - int matched; - - if ( (m->value.s[0] == 'x') && (m->value.s[1] == '\0') ) { - fprintf(stderr, "BOINK"); - return 1; - } - - - switch (m->type) { - case BYTE: - v = p->b; - break; - - case SHORT: - case BESHORT: - case LESHORT: - v = p->h; - break; - - case LONG: - case BELONG: - case LELONG: - case DATE: - case BEDATE: - case LEDATE: - v = p->l; - break; - - case STRING: { - /* - * What we want here is: - * v = strncmp(m->value.s, p->s, m->vallen); - * but ignoring any nulls. bcmp doesn't give -/+/0 - * and isn't universally available anyway. - */ - unsigned char *a = (unsigned char*)m->value.s; - unsigned char *b = (unsigned char*)p->s; - int len = m->vallen; - l = 0; - v = 0; - if (0L == m->mask) { /* normal string: do it fast */ - while (--len >= 0) - if ((v = *b++ - *a++) != '\0') - break; - } else { /* combine the others */ - while (--len >= 0) { - if ((m->mask & STRING_IGNORE_LOWERCASE) && - islower(*a)) { - if ((v = tolower(*b++) - *a++) != '\0') - break; - } else if ((m->mask & STRING_COMPACT_BLANK) && - isspace(*a)) { - a++; - if (isspace(*b++)) { - while (isspace(*b)) - b++; - } else { - v = 1; - break; - } - } else if (isspace(*a) && - (m->mask & STRING_COMPACT_OPTIONAL_BLANK)) { - a++; - while (isspace(*b)) - b++; - } else { - if ((v = *b++ - *a++) != '\0') - break; - } - } - } - break; - } - default: - error("invalid type %d in mcheck().\n", m->type); - return 0;/*NOTREACHED*/ - } - - if(m->type != STRING) - v = signextend(m, v) & m->mask; - - switch (m->reln) { - case 'x': - if (debug) - (void) fprintf(stderr, "%u == *any* = 1\n", v); - matched = 1; - break; - - case '!': - matched = v != l; - if (debug) - (void) fprintf(stderr, "%u != %u = %d\n", - v, l, matched); - break; - - case '=': - matched = v == l; - if (debug) - (void) fprintf(stderr, "%u == %u = %d\n", - v, l, matched); - break; - - case '>': - if (m->flag & UNSIGNED) { - matched = v > l; - if (debug) - (void) fprintf(stderr, "%u > %u = %d\n", - v, l, matched); - } - else { - matched = (int32) v > (int32) l; - if (debug) - (void) fprintf(stderr, "%d > %d = %d\n", - v, l, matched); - } - break; - - case '<': - if (m->flag & UNSIGNED) { - matched = v < l; - if (debug) - (void) fprintf(stderr, "%u < %u = %d\n", - v, l, matched); - } - else { - matched = (int32) v < (int32) l; - if (debug) - (void) fprintf(stderr, "%d < %d = %d\n", - v, l, matched); - } - break; - - case '&': - matched = (v & l) == l; - if (debug) - (void) fprintf(stderr, "((%x & %x) == %x) = %d\n", - v, l, l, matched); - break; - - case '^': - matched = (v & l) != l; - if (debug) - (void) fprintf(stderr, "((%x & %x) != %x) = %d\n", - v, l, l, matched); - break; - - default: - matched = 0; - error("mcheck: can't happen: invalid relation %d.\n", m->reln); - break;/*NOTREACHED*/ - } - - return matched; -} diff --git a/contrib/file/stamp-h.in b/contrib/file/stamp-h.in deleted file mode 100644 index 9788f70238c91..0000000000000 --- a/contrib/file/stamp-h.in +++ /dev/null @@ -1 +0,0 @@ -timestamp diff --git a/contrib/file/tar.h b/contrib/file/tar.h deleted file mode 100644 index c5fce4ed7198e..0000000000000 --- a/contrib/file/tar.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Header file for public domain tar (tape archive) program. - * - * @(#)tar.h 1.20 86/10/29 Public Domain. - * - * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu. - * - * $Id: tar.h,v 1.5 1999/01/13 15:44:10 christos Exp $ # checkin only - */ - -/* - * Kludge for handling systems that can't cope with multiple - * external definitions of a variable. In ONE routine (tar.c), - * we #define TAR_EXTERN to null; here, we set it to "extern" if - * it is not already set. - */ -#ifndef TAR_EXTERN -#define TAR_EXTERN extern -#endif - -/* - * Header block on tape. - * - * I'm going to use traditional DP naming conventions here. - * A "block" is a big chunk of stuff that we do I/O on. - * A "record" is a piece of info that we care about. - * Typically many "record"s fit into a "block". - */ -#define RECORDSIZE 512 -#define NAMSIZ 100 -#define TUNMLEN 32 -#define TGNMLEN 32 - -union record { - char charptr[RECORDSIZE]; - struct header { - char name[NAMSIZ]; - char mode[8]; - char uid[8]; - char gid[8]; - char size[12]; - char mtime[12]; - char chksum[8]; - char linkflag; - char linkname[NAMSIZ]; - char magic[8]; - char uname[TUNMLEN]; - char gname[TGNMLEN]; - char devmajor[8]; - char devminor[8]; - } header; -}; - -/* The checksum field is filled with this while the checksum is computed. */ -#define CHKBLANKS " " /* 8 blanks, no null */ - -/* The magic field is filled with this if uname and gname are valid. */ -#define TMAGIC "ustar " /* 7 chars and a null */ - -/* The linkflag defines the type of file */ -#define LF_OLDNORMAL '\0' /* Normal disk file, Unix compat */ -#define LF_NORMAL '0' /* Normal disk file */ -#define LF_LINK '1' /* Link to previously dumped file */ -#define LF_SYMLINK '2' /* Symbolic link */ -#define LF_CHR '3' /* Character special file */ -#define LF_BLK '4' /* Block special file */ -#define LF_DIR '5' /* Directory */ -#define LF_FIFO '6' /* FIFO special file */ -#define LF_CONTIG '7' /* Contiguous file */ -/* Further link types may be defined later. */ - -/* - * Exit codes from the "tar" program - */ -#define EX_SUCCESS 0 /* success! */ -#define EX_ARGSBAD 1 /* invalid args */ -#define EX_BADFILE 2 /* invalid filename */ -#define EX_BADARCH 3 /* bad archive */ -#define EX_SYSTEM 4 /* system gave unexpected error */ - - -/* - * Global variables - */ -TAR_EXTERN union record *ar_block; /* Start of block of archive */ -TAR_EXTERN union record *ar_record; /* Current record of archive */ -TAR_EXTERN union record *ar_last; /* Last+1 record of archive block */ -TAR_EXTERN char ar_reading; /* 0 writing, !0 reading archive */ -TAR_EXTERN int blocking; /* Size of each block, in records */ -TAR_EXTERN int blocksize; /* Size of each block, in bytes */ -TAR_EXTERN char *ar_file; /* File containing archive */ -TAR_EXTERN char *name_file; /* File containing names to work on */ -TAR_EXTERN char *tar; /* Name of this program */ - -/* - * Flags from the command line - */ -TAR_EXTERN char f_reblock; /* -B */ -TAR_EXTERN char f_create; /* -c */ -TAR_EXTERN char f_debug; /* -d */ -TAR_EXTERN char f_sayblock; /* -D */ -TAR_EXTERN char f_follow_links; /* -h */ -TAR_EXTERN char f_ignorez; /* -i */ -TAR_EXTERN char f_keep; /* -k */ -TAR_EXTERN char f_modified; /* -m */ -TAR_EXTERN char f_oldarch; /* -o */ -TAR_EXTERN char f_use_protection; /* -p */ -TAR_EXTERN char f_sorted_names; /* -s */ -TAR_EXTERN char f_list; /* -t */ -TAR_EXTERN char f_namefile; /* -T */ -TAR_EXTERN char f_verbose; /* -v */ -TAR_EXTERN char f_extract; /* -x */ -TAR_EXTERN char f_compress; /* -z */ - -/* - * We now default to Unix Standard format rather than 4.2BSD tar format. - * The code can actually produce all three: - * f_standard ANSI standard - * f_oldarch V7 - * neither 4.2BSD - * but we don't bother, since 4.2BSD can read ANSI standard format anyway. - * The only advantage to the "neither" option is that we can cmp(1) our - * output to the output of 4.2BSD tar, for debugging. - */ -#define f_standard (!f_oldarch) - -/* - * Structure for keeping track of filenames and lists thereof. - */ -struct name { - struct name *next; - short length; - char found; - char name[NAMSIZ+1]; -}; - -TAR_EXTERN struct name *namelist; /* Points to first name in list */ -TAR_EXTERN struct name *namelast; /* Points to last name in list */ - -TAR_EXTERN int archive; /* File descriptor for archive file */ -TAR_EXTERN int errors; /* # of files in error */ - -/* - * - * Due to the next struct declaration, each routine that includes - * "tar.h" must also include <sys/types.h>. I tried to make it automatic, - * but System V has no defines in <sys/types.h>, so there is no way of - * knowing when it has been included. In addition, it cannot be included - * twice, but must be included exactly once. Argghh! - * - * Thanks, typedef. Thanks, USG. - */ -struct link { - struct link *next; - dev_t dev; - ino_t ino; - short linkcount; - char name[NAMSIZ+1]; -}; - -TAR_EXTERN struct link *linklist; /* Points to first link in list */ - - -/* - * Error recovery stuff - */ -TAR_EXTERN char read_error_flag; - - -#if 0 -/* - * Declarations of functions available to the world. - */ -/*LINTLIBRARY*/ -#define annorec(stream, msg) anno(stream, msg, 0) /* Cur rec */ -#define annofile(stream, msg) anno(stream, msg, 1) /* Saved rec */ -#endif diff --git a/contrib/gperf/AUTHORS b/contrib/gperf/AUTHORS deleted file mode 100644 index 3429c03166d0a..0000000000000 --- a/contrib/gperf/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Douglas C. Schmidt <schmidt@ics.uci.edu> -Bruno Haible <haible@clisp.cons.org> diff --git a/contrib/gperf/FREEBSD-Xlist b/contrib/gperf/FREEBSD-Xlist deleted file mode 100644 index 181d8b0f455c2..0000000000000 --- a/contrib/gperf/FREEBSD-Xlist +++ /dev/null @@ -1,7 +0,0 @@ -$FreeBSD$ -*/*.dvi -*/*.html -*/*.info -*/*.ps -*/texinfo.tex -*/tests diff --git a/contrib/gperf/INSTALL b/contrib/gperf/INSTALL deleted file mode 100644 index 350b32f51311a..0000000000000 --- a/contrib/gperf/INSTALL +++ /dev/null @@ -1,183 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes a while. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - diff --git a/contrib/gperf/Makefile.devel b/contrib/gperf/Makefile.devel deleted file mode 100644 index cd6b6282acfeb..0000000000000 --- a/contrib/gperf/Makefile.devel +++ /dev/null @@ -1,38 +0,0 @@ -# This is the developer's makefile, not the user's makefile. -# Don't use it unless you know exactly what you do! - -SHELL = /bin/sh -MAKE = make - -all : configures src/config.h.in doc/gperf.1 - -CONFIGURES = configure lib/configure src/configure tests/configure doc/configure - -configures : $(CONFIGURES) - -configure : configure.in aclocal.m4 - autoconf -l . - -lib/configure : lib/configure.in aclocal.m4 - cd lib && autoconf -l .. - -src/configure : src/configure.in aclocal.m4 - cd src && autoconf -l .. - -tests/configure : tests/configure.in aclocal.m4 - cd tests && autoconf -l .. - -doc/configure : doc/configure.in aclocal.m4 - cd doc && autoconf -l .. - -check-configures : $(CONFIGURES) - set -e; for f in $(CONFIGURES); do bash -x -n $$f; done - -src/config.h.in : src/configure.in aclocal.m4 - cd src && autoheader -l .. - -doc/gperf.1 : force - prog=`PATH=build/src:src:$$PATH which gperf`; if test -n "$$prog"; then doc/help2man --name='generate a perfect hash function from a key set' --section=1 $$prog > doc/gperf.1; fi - -force : - diff --git a/contrib/gperf/Makefile.in b/contrib/gperf/Makefile.in deleted file mode 100644 index 1d9336afa8a98..0000000000000 --- a/contrib/gperf/Makefile.in +++ /dev/null @@ -1,62 +0,0 @@ -# Makefile for gperf - -# Copyright (C) 1989, 1992, 1993, 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 -# 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 : - diff --git a/contrib/gperf/NEWS b/contrib/gperf/NEWS deleted file mode 100644 index 9a2877f053847..0000000000000 --- a/contrib/gperf/NEWS +++ /dev/null @@ -1,21 +0,0 @@ -New in 2.7.2: - -* Keywords may now be enclosed in double quotes; this permits the use of - '#', ',', space or NUL inside keywords. -* Bug fixes. - -New in 2.7.1: - -* Added option "-F" for gcc. - -New in 2.7: - -* gperf is now a stand-alone package, untied from libg++. -* Autoconfiguring. -* Removed the "-a" and "-g" options, extended the "-L" option instead. -* Removed the "-p" option, it is the default. -* Added long options ("--help", "--version" etc.). -* 8-bit cleanliness is now the default; use "-7" to get the old behaviour. -* Compiles with any C++ compiler. -* Numerous small improvements. - diff --git a/contrib/gperf/acconfig.h b/contrib/gperf/acconfig.h deleted file mode 100644 index cd040d450f7e0..0000000000000 --- a/contrib/gperf/acconfig.h +++ /dev/null @@ -1,4 +0,0 @@ - -/* Define if the C++ compiler supports "throw ()" declarations. */ -#undef HAVE_THROW_DECL - diff --git a/contrib/gperf/aclocal.m4 b/contrib/gperf/aclocal.m4 deleted file mode 100644 index bb22edca357dc..0000000000000 --- a/contrib/gperf/aclocal.m4 +++ /dev/null @@ -1,71 +0,0 @@ -AC_PREREQ(2.12) - -AC_DEFUN(CL_PROG_RANLIB, [AC_CHECK_PROG(RANLIB, ranlib, ranlib, true)]) - -AC_DEFUN(CL_PROG_INSTALL, -[dnl This is mostly copied from AC_PROG_INSTALL. -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -AC_MSG_CHECKING(for a BSD compatible install) -if test -z "$INSTALL"; then -AC_CACHE_VAL(cl_cv_path_install, -[ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - if test $ac_prog = installbsd && - grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX installbsd doesn't work without option "-g". - : - else - cl_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - fi - done - ;; - esac - done - IFS="$ac_save_ifs" - # As a last resort, use cp. - test -z "$cl_cv_path_install" && cl_cv_path_install="cp" -])dnl - INSTALL="$cl_cv_path_install" -fi -dnl We do special magic for INSTALL instead of AC_SUBST, to get -dnl relative paths right. -AC_MSG_RESULT($INSTALL) -AC_SUBST(INSTALL)dnl -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)' -AC_SUBST(INSTALL_PROGRAM)dnl -if test -z "$INSTALL_DATA"; then - case "$INSTALL" in - cp | */cp ) INSTALL_DATA='$(INSTALL)' ;; - * ) INSTALL_DATA='$(INSTALL) -m 644' ;; - esac -fi -AC_SUBST(INSTALL_DATA)dnl -]) - diff --git a/contrib/gperf/configure b/contrib/gperf/configure deleted file mode 100755 index 77123803d9558..0000000000000 --- a/contrib/gperf/configure +++ /dev/null @@ -1,914 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=doc/gperf.1 - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:526: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -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 -} -' -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@SET_MAKE@%$SET_MAKE%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - - -if test "$no_recursion" != yes; then - - # Remove --cache-file and --srcdir arguments so they do not pile up. - ac_sub_configure_args= - ac_prev= - for ac_arg in $ac_configure_args; do - if test -n "$ac_prev"; then - ac_prev= - continue - fi - case "$ac_arg" in - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - ;; - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - ;; - *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; - esac - done - - for ac_config_dir in lib src tests doc; do - - # Do not complain, so a configure script can configure whichever - # parts of a large source tree are present. - if test ! -d $srcdir/$ac_config_dir; then - continue - fi - - echo configuring in $ac_config_dir - - case "$srcdir" in - .) ;; - *) - if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; - else - { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } - fi - ;; - esac - - ac_popdir=`pwd` - cd $ac_config_dir - - # A "../" for each directory in /$ac_config_dir. - ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` - - case "$srcdir" in - .) # No --srcdir option. We are building in place. - ac_sub_srcdir=$srcdir ;; - /*) # Absolute path. - ac_sub_srcdir=$srcdir/$ac_config_dir ;; - *) # Relative path. - ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; - esac - - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_sub_srcdir/configure; then - ac_sub_configure=$ac_sub_srcdir/configure - elif test -f $ac_sub_srcdir/configure.in; then - ac_sub_configure=$ac_configure - else - echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 - ac_sub_configure= - fi - - # The recursion is here. - if test -n "$ac_sub_configure"; then - - # Make the cache file name correct relative to the subdirectory. - case "$cache_file" in - /*) ac_sub_cache_file=$cache_file ;; - *) # Relative path. - ac_sub_cache_file="$ac_dots$cache_file" ;; - esac - - echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" - # The eval makes quoting arguments work. - if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir - then : - else - { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } - fi - fi - - cd $ac_popdir - done -fi - diff --git a/contrib/gperf/configure.in b/contrib/gperf/configure.in deleted file mode 100644 index 5ac1499aa1245..0000000000000 --- a/contrib/gperf/configure.in +++ /dev/null @@ -1,46 +0,0 @@ -dnl autoconf configuration for gperf - -dnl Copyright (C) 1998 Free Software Foundation, Inc. -dnl written by Douglas C. Schmidt (schmidt@ics.uci.edu) -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) diff --git a/contrib/gperf/doc/Makefile.in b/contrib/gperf/doc/Makefile.in deleted file mode 100644 index 99ac03d1b68ce..0000000000000 --- a/contrib/gperf/doc/Makefile.in +++ /dev/null @@ -1,135 +0,0 @@ -# Makefile for gperf/doc - -# Copyright (C) 1998, 2000 Free Software Foundation, Inc. -# -# 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@ -datadir = @datadir@ -infodir = @infodir@ -mandir = @mandir@ -man1dir = $(mandir)/man1 -docdir = $(prefix)/doc/@PACKAGE@ -dvidir = $(docdir) -psdir = $(docdir) -htmldir = $(docdir) - -# Programs used by "make": -RM = rm -f -@SET_MAKE@ - -# Programs used by "make" if you have changed the documentation files: -TEX = tex -TEXI2DVI = texi2dvi -DVIPS = dvips -D600 -MAKEINFO = LANG= LANGUAGE= makeinfo -TEXI2HTML = texi2html - -# Programs used by "make install": -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = $(SHELL) $(srcdir)/../mkinstalldirs - -#### End of system configuration section. #### - -SHELL = /bin/sh - -VPATH = $(srcdir) - -all : info dvi ps html - - -info : $(srcdir)/gperf.info - -$(srcdir)/gperf.info : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo - cd $(srcdir) && $(MAKEINFO) --no-split gperf.texi - - -dvi : $(srcdir)/gperf.dvi - -$(srcdir)/gperf.dvi : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo - cd $(srcdir) && $(RM) gperf.aux gperf.toc gperf.cp gperf.fn gperf.ky gperf.pg gperf.tp gperf.vr gperf.log gperf.cps - cd $(srcdir) && $(TEXI2DVI) gperf.texi - cd $(srcdir) && $(RM) gperf.aux gperf.toc gperf.cp gperf.fn gperf.ky gperf.pg gperf.tp gperf.vr gperf.log gperf.cps - - -ps : $(srcdir)/gperf.ps - -$(srcdir)/gperf.ps : $(srcdir)/gperf.dvi - $(DVIPS) -o $@ $< - - -html : gperf.html gperf_toc.html - -gperf.html : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo - cd $(srcdir) && $(TEXI2HTML) -expandinfo -number -monolithic gperf.texi - -gperf_toc.html : $(srcdir)/gperf.texi $(srcdir)/gpl.texinfo - cd $(srcdir) && $(RM) gperf_*.html - cd $(srcdir) && $(TEXI2HTML) -expandinfo -number -split_chapter gperf.texi - - -install : all force - $(MKINSTALLDIRS) $(DESTDIR)$(infodir) - $(INSTALL_DATA) $(srcdir)/gperf.info $(DESTDIR)$(infodir)/gperf.info - $(MKINSTALLDIRS) $(DESTDIR)$(man1dir) - $(INSTALL_DATA) $(srcdir)/gperf.1 $(DESTDIR)$(man1dir)/gperf.1 -# $(MKINSTALLDIRS) $(DESTDIR)$(dvidir) -# $(INSTALL_DATA) $(srcdir)/gperf.dvi $(DESTDIR)$(dvidir)/gperf.dvi -# $(MKINSTALLDIRS) $(DESTDIR)$(psdir) -# $(INSTALL_DATA) $(srcdir)/gperf.ps $(DESTDIR)$(dvidir)/gperf.ps - $(MKINSTALLDIRS) $(DESTDIR)$(htmldir) - $(INSTALL_DATA) $(srcdir)/gperf.html $(DESTDIR)$(htmldir)/gperf.html - -installdirs : force - $(MKINSTALLDIRS) $(DESTDIR)$(infodir) - $(MKINSTALLDIRS) $(DESTDIR)$(man1dir) -# $(MKINSTALLDIRS) $(DESTDIR)$(dvidir) -# $(MKINSTALLDIRS) $(DESTDIR)$(psdir) - $(MKINSTALLDIRS) $(DESTDIR)$(htmldir) - -uninstall : force - $(RM) $(DESTDIR)$(infodir)/gperf.info - $(RM) $(DESTDIR)$(man1dir)/gperf.1 -# $(RM) $(DESTDIR)$(dvidir)/gperf.dvi -# $(RM) $(DESTDIR)$(psdir)/gperf.ps - $(RM) $(DESTDIR)$(htmldir)/gperf.html - -check : all - -mostlyclean : clean - -clean : force - $(RM) *~ *.aux *.toc *.cp *.fn *.ky *.pg *.tp *.vr *.my *.log *.cps core - -distclean : clean - $(RM) config.status config.log config.cache Makefile - -maintainer-clean : distclean - $(RM) *.info *.dvi *.ps *.html - -force : - diff --git a/contrib/gperf/doc/configure b/contrib/gperf/doc/configure deleted file mode 100755 index a10049f45e636..0000000000000 --- a/contrib/gperf/doc/configure +++ /dev/null @@ -1,871 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=gperf.1 - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -PACKAGE=gperf - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:528: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:565: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'cl_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - if test $ac_prog = installbsd && - grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX installbsd doesn't work without option "-g". - : - else - cl_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - fi - done - ;; - esac - done - IFS="$ac_save_ifs" - # As a last resort, use cp. - test -z "$cl_cv_path_install" && cl_cv_path_install="cp" - -fi - INSTALL="$cl_cv_path_install" -fi -echo "$ac_t""$INSTALL" 1>&6 -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)' -if test -z "$INSTALL_DATA"; then - case "$INSTALL" in - cp | */cp ) INSTALL_DATA='$(INSTALL)' ;; - * ) INSTALL_DATA='$(INSTALL) -m 644' ;; - esac -fi - - trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@PACKAGE@%$PACKAGE%g -s%@SET_MAKE@%$SET_MAKE%g -s%@INSTALL@%$INSTALL%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/gperf/doc/configure.in b/contrib/gperf/doc/configure.in deleted file mode 100644 index 944b862cf3158..0000000000000 --- a/contrib/gperf/doc/configure.in +++ /dev/null @@ -1,35 +0,0 @@ -dnl autoconf configuration for gperf/doc - -dnl Copyright (C) 1998, 2000 Free Software Foundation, Inc. -dnl written by Douglas C. Schmidt (schmidt@ics.uci.edu) -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(gperf.1) -PACKAGE=gperf -AC_SUBST(PACKAGE) -AC_PROG_MAKE_SET -dnl -dnl checks for programs -dnl -CL_PROG_INSTALL - dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM -dnl -dnl That's it. -dnl -AC_OUTPUT(Makefile) diff --git a/contrib/gperf/doc/gperf.1 b/contrib/gperf/doc/gperf.1 deleted file mode 100644 index dd425e0c7e2c0..0000000000000 --- a/contrib/gperf/doc/gperf.1 +++ /dev/null @@ -1,187 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.022. -.TH GPERF "1" "September 2000" "GNU gperf 2.7.2" FSF -.SH NAME -gperf \- generate a perfect hash function from a key set -.SH SYNOPSIS -.B gperf -[\fIOPTION\fR]... [\fIINPUT-FILE\fR] -.SH DESCRIPTION -GNU `gperf' generates perfect hash functions. -.PP -If a long option shows an argument as mandatory, then it is mandatory -for the equivalent short option also. -.SS "Input file interpretation:" -.TP -\fB\-e\fR, \fB\-\-delimiters\fR=\fIDELIMITER\-LIST\fR -Allow user to provide a string containing delimiters -used to separate keywords from their attributes. -Default is ",\en". -.TP -\fB\-t\fR, \fB\-\-struct\-type\fR -Allows the user to include a structured type -declaration for generated code. Any text before %% -is considered part of the type declaration. Key -words and additional fields may follow this, one -group of fields per line. -.SS "Language for the output code:" -.TP -\fB\-L\fR, \fB\-\-language\fR=\fILANGUAGE\-NAME\fR -Generates code in the specified language. Languages -handled are currently C++, ANSI-C, C, and KR-C. The -default is C. -.SS "Details in the output code:" -.TP -\fB\-K\fR, \fB\-\-slot\-name\fR=\fINAME\fR -Select name of the keyword component in the keyword -structure. -.TP -\fB\-F\fR, \fB\-\-initializer\-suffix\fR=\fIINITIALIZERS\fR -Initializers for additional components in the keyword -structure. -.TP -\fB\-H\fR, \fB\-\-hash\-fn\-name\fR=\fINAME\fR -Specify name of generated hash function. Default is -`hash'. -.TP -\fB\-N\fR, \fB\-\-lookup\-fn\-name\fR=\fINAME\fR -Specify name of generated lookup function. Default -name is `in_word_set'. -.TP -\fB\-Z\fR, \fB\-\-class\-name\fR=\fINAME\fR -Specify name of generated C++ class. Default name is -`Perfect_Hash'. -.TP -\fB\-7\fR, \fB\-\-seven\-bit\fR -Assume 7-bit characters. -.TP -\fB\-c\fR, \fB\-\-compare\-strncmp\fR -Generate comparison code using strncmp rather than -strcmp. -.TP -\fB\-C\fR, \fB\-\-readonly\-tables\fR -Make the contents of generated lookup tables -constant, i.e., readonly. -.TP -\fB\-E\fR, \fB\-\-enum\fR -Define constant values using an enum local to the -lookup function rather than with defines. -.TP -\fB\-I\fR, \fB\-\-includes\fR -Include the necessary system include file <string.h> -at the beginning of the code. -.TP -\fB\-G\fR, \fB\-\-global\fR -Generate the static table of keywords as a static -global variable, rather than hiding it inside of the -lookup function (which is the default behavior). -.TP -\fB\-W\fR, \fB\-\-word\-array\-name\fR=\fINAME\fR -Specify name of word list array. Default name is -`wordlist'. -.TP -\fB\-S\fR, \fB\-\-switch\fR=\fICOUNT\fR -Causes the generated C code to use a switch -statement scheme, rather than an array lookup table. -This can lead to a reduction in both time and space -requirements for some keyfiles. The COUNT argument -determines how many switch statements are generated. -A value of 1 generates 1 switch containing all the -elements, a value of 2 generates 2 tables with 1/2 -the elements in each table, etc. If COUNT is very -large, say 1000000, the generated C code does a -binary search. -.TP -\fB\-T\fR, \fB\-\-omit\-struct\-type\fR -Prevents the transfer of the type declaration to the -output file. Use this option if the type is already -defined elsewhere. -.SS "Algorithm employed by gperf:" -.TP -\fB\-k\fR, \fB\-\-key\-positions\fR=\fIKEYS\fR -Select the key positions used in the hash function. -The allowable choices range between 1-126, inclusive. -The positions are separated by commas, ranges may be -used, and key positions may occur in any order. -Also, the meta-character '*' causes the generated -hash function to consider ALL key positions, and $ -indicates the ``final character'' of a key, e.g., -$,1,2,4,6-10. -.TP -\fB\-l\fR, \fB\-\-compare\-strlen\fR -Compare key lengths before trying a string -comparison. This helps cut down on the number of -string comparisons made during the lookup. -.TP -\fB\-D\fR, \fB\-\-duplicates\fR -Handle keywords that hash to duplicate values. This -is useful for certain highly redundant keyword sets. -.TP -\fB\-f\fR, \fB\-\-fast\fR=\fIITERATIONS\fR -Generate the gen-perf.hash function ``fast''. This -decreases gperf's running time at the cost of -minimizing generated table size. The numeric -argument represents the number of times to iterate -when resolving a collision. `0' means ``iterate by -the number of keywords''. -.TP -\fB\-i\fR, \fB\-\-initial\-asso\fR=\fIN\fR -Provide an initial value for the associate values -array. Default is 0. Setting this value larger helps -inflate the size of the final table. -.TP -\fB\-j\fR, \fB\-\-jump\fR=\fIJUMP\-VALUE\fR -Affects the ``jump value'', i.e., how far to advance -the associated character value upon collisions. Must -be an odd number, default is 5. -.TP -\fB\-n\fR, \fB\-\-no\-strlen\fR -Do not include the length of the keyword when -computing the hash function. -.TP -\fB\-o\fR, \fB\-\-occurrence\-sort\fR -Reorders input keys by frequency of occurrence of -the key sets. This should decrease the search time -dramatically. -.TP -\fB\-r\fR, \fB\-\-random\fR -Utilizes randomness to initialize the associated -values table. -.TP -\fB\-s\fR, \fB\-\-size\-multiple\fR=\fIN\fR -Affects the size of the generated hash table. The -numeric argument N indicates ``how many times larger -or smaller'' the associated value range should be, -in relationship to the number of keys, e.g. a value -of 3 means ``allow the maximum associated value to -be about 3 times larger than the number of input -keys.'' Conversely, a value of \fB\-3\fR means ``make the -maximum associated value about 3 times smaller than -the number of input keys. A larger table should -decrease the time required for an unsuccessful -search, at the expense of extra table space. Default -value is 1. -.SS "Informative output:" -.TP -\fB\-h\fR, \fB\-\-help\fR -Print this message. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the gperf version number. -.TP -\fB\-d\fR, \fB\-\-debug\fR -Enables the debugging option (produces verbose -output to the standard error). -.SH "REPORTING BUGS" -Report bugs to <bug-gnu-utils@gnu.org>. -.SH "SEE ALSO" -The full documentation for -.B gperf -is maintained as a Texinfo manual. If the -.B info -and -.B gperf -programs are properly installed at your site, the command -.IP -.B info gperf -.PP -should give you access to the complete manual. diff --git a/contrib/gperf/doc/gperf.texi b/contrib/gperf/doc/gperf.texi deleted file mode 100644 index e510ac97021fa..0000000000000 --- a/contrib/gperf/doc/gperf.texi +++ /dev/null @@ -1,1051 +0,0 @@ -\input texinfo @c -*- texinfo -*- -@c %**start of header -@setfilename gperf.info -@settitle Perfect Hash Function Generator -@c @setchapternewpage odd -@c %**end of header - -@c some day we should @include version.texi instead of defining -@c these values at hand. -@set UPDATED 26 September 2000 -@set EDITION 2.7.2 -@set VERSION 2.7.2 -@c --------------------- - -@c remove the black boxes generated in the GPL appendix. -@finalout - -@c Merge functions into the concept index -@syncodeindex fn cp -@c @synindex pg cp - -@dircategory Programming Tools -@direntry -* Gperf: (gperf). Perfect Hash Function Generator. -@end direntry - -@ifinfo -This file documents the features of the GNU Perfect Hash Function -Generator @value{VERSION}. - -Copyright @copyright{} 1989-2000 Free Software Foundation, Inc. - -Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - -@ignore -Permission is granted to process this file through TeX and print the -results, provided the printed document carries a copying permission -notice identical to this one except for the removal of this paragraph -(this paragraph not being relevant to the printed manual). - -@end ignore - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included exactly as -in the original, and 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 manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' and this -permission notice may be included in translations approved by the Free -Software Foundation instead of in the original English. - -@end ifinfo - -@titlepage -@title User's Guide to @code{gperf} @value{VERSION} -@subtitle The GNU Perfect Hash Function Generator -@subtitle Edition @value{EDITION}, @value{UPDATED} -@author Douglas C. Schmidt - -@page -@vskip 0pt plus 1filll -Copyright @copyright{} 1989-2000 Free Software Foundation, Inc. - - -Permission is granted to make and distribute verbatim copies of -this manual provided the copyright notice and this permission notice -are preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided also that the -section entitled ``GNU General Public License'' is included -exactly as in the original, and 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 manual -into another language, under the above conditions for modified versions, -except that the section entitled ``GNU General Public License'' may be -included in a translation approved by the author instead of in the -original English. -@end titlepage - -@ifinfo -@node Top, Copying, (dir), (dir) -@top Introduction - -This manual documents the GNU @code{gperf} perfect hash function generator -utility, focusing on its features and how to use them, and how to report -bugs. - -@menu -* Copying:: GNU @code{gperf} General Public License says - how you can copy and share @code{gperf}. -* Contributors:: People who have contributed to @code{gperf}. -* Motivation:: Static search structures and GNU GPERF. -* Search Structures:: Static search structures and GNU @code{gperf} -* Description:: High-level discussion of how GPERF functions. -* Options:: A description of options to the program. -* Bugs:: Known bugs and limitations with GPERF. -* Projects:: Things still left to do. -* Implementation:: Implementation Details for GNU GPERF. -* Bibliography:: Material Referenced in this Report. - -* Concept Index:: - -@detailmenu --- The Detailed Node Listing --- - -High-Level Description of GNU @code{gperf} - -* Input Format:: Input Format to @code{gperf} -* Output Format:: Output Format for Generated C Code with @code{gperf} -* Binary Strings:: Use of NUL characters - -Input Format to @code{gperf} - -* Declarations:: @code{struct} Declarations and C Code Inclusion. -* Keywords:: Format for Keyword Entries. -* Functions:: Including Additional C Functions. - -Invoking @code{gperf} - -* Input Details:: Options that affect Interpretation of the Input File -* Output Language:: Specifying the Language for the Output Code -* Output Details:: Fine tuning Details in the Output Code -* Algorithmic Details:: Changing the Algorithms employed by @code{gperf} -* Verbosity:: Informative Output - -@end detailmenu -@end menu - -@end ifinfo - -@node Copying, Contributors, Top, Top -@unnumbered GNU GENERAL PUBLIC LICENSE -@include gpl.texinfo - -@node Contributors, Motivation, Copying, Top -@unnumbered Contributors to GNU @code{gperf} Utility - -@itemize @bullet -@item -@cindex Bugs -The GNU @code{gperf} perfect hash function generator utility was -originally written in GNU C++ by Douglas C. Schmidt. It is now also -available in a highly-portable ``old-style'' C version. The general -idea for the perfect hash function generator was inspired by Keith -Bostic's algorithm written in C, and distributed to net.sources around -1984. The current program is a heavily modified, enhanced, and extended -implementation of Keith's basic idea, created at the University of -California, Irvine. Bugs, patches, and suggestions should be reported -to both @code{<bug-gnu-utils@@gnu.org>} and -@code{<gperf-bugs@@lists.sourceforge.net>}. - -@item -Special thanks is extended to Michael Tiemann and Doug Lea, for -providing a useful compiler, and for giving me a forum to exhibit my -creation. - -In addition, Adam de Boor and Nels Olson provided many tips and insights -that greatly helped improve the quality and functionality of @code{gperf}. - -@item -A testsuite was added by Bruno Haible. He also rewrote the output -routines for better reliability. -@end itemize - -@node Motivation, Search Structures, Contributors, Top -@chapter Introduction - -@code{gperf} is a perfect hash function generator written in C++. It -transforms an @var{n} element user-specified keyword set @var{W} into a -perfect hash function @var{F}. @var{F} uniquely maps keywords in -@var{W} onto the range 0..@var{k}, where @var{k} >= @var{n}. If @var{k} -= @var{n} then @var{F} is a @emph{minimal} perfect hash function. -@code{gperf} generates a 0..@var{k} element static lookup table and a -pair of C functions. These functions determine whether a given -character string @var{s} occurs in @var{W}, using at most one probe into -the lookup table. - -@code{gperf} currently generates the reserved keyword recognizer for -lexical analyzers in several production and research compilers and -language processing tools, including GNU C, GNU C++, GNU Pascal, GNU -Modula 3, and GNU indent. Complete C++ source code for @code{gperf} is -available via anonymous ftp from @code{ftp://ftp.gnu.org/pub/gnu/gperf/}. -A paper describing @code{gperf}'s design and implementation in greater -detail is available in the Second USENIX C++ Conference proceedings. - -@node Search Structures, Description, Motivation, Top -@chapter Static search structures and GNU @code{gperf} -@cindex Static search structure - -A @dfn{static search structure} is an Abstract Data Type with certain -fundamental operations, e.g., @emph{initialize}, @emph{insert}, -and @emph{retrieve}. Conceptually, all insertions occur before any -retrievals. In practice, @code{gperf} generates a @code{static} array -containing search set keywords and any associated attributes specified -by the user. Thus, there is essentially no execution-time cost for the -insertions. It is a useful data structure for representing @emph{static -search sets}. Static search sets occur frequently in software system -applications. Typical static search sets include compiler reserved -words, assembler instruction opcodes, and built-in shell interpreter -commands. Search set members, called @dfn{keywords}, are inserted into -the structure only once, usually during program initialization, and are -not generally modified at run-time. - -Numerous static search structure implementations exist, e.g., -arrays, linked lists, binary search trees, digital search tries, and -hash tables. Different approaches offer trade-offs between space -utilization and search time efficiency. For example, an @var{n} element -sorted array is space efficient, though the average-case time -complexity for retrieval operations using binary search is -proportional to log @var{n}. Conversely, hash table implementations -often locate a table entry in constant time, but typically impose -additional memory overhead and exhibit poor worst case performance. - -@cindex Minimal perfect hash functions -@emph{Minimal perfect hash functions} provide an optimal solution for a -particular class of static search sets. A minimal perfect hash -function is defined by two properties: - -@itemize @bullet -@item -It allows keyword recognition in a static search set using at most -@emph{one} probe into the hash table. This represents the ``perfect'' -property. -@item -The actual memory allocated to store the keywords is precisely large -enough for the keyword set, and @emph{no larger}. This is the -``minimal'' property. -@end itemize - -For most applications it is far easier to generate @emph{perfect} hash -functions than @emph{minimal perfect} hash functions. Moreover, -non-minimal perfect hash functions frequently execute faster than -minimal ones in practice. This phenomena occurs since searching a -sparse keyword table increases the probability of locating a ``null'' -entry, thereby reducing string comparisons. @code{gperf}'s default -behavior generates @emph{near-minimal} perfect hash functions for -keyword sets. However, @code{gperf} provides many options that permit -user control over the degree of minimality and perfection. - -Static search sets often exhibit relative stability over time. For -example, Ada's 63 reserved words have remained constant for nearly a -decade. It is therefore frequently worthwhile to expend concerted -effort building an optimal search structure @emph{once}, if it -subsequently receives heavy use multiple times. @code{gperf} removes -the drudgery associated with constructing time- and space-efficient -search structures by hand. It has proven a useful and practical tool -for serious programming projects. Output from @code{gperf} is currently -used in several production and research compilers, including GNU C, GNU -C++, GNU Pascal, and GNU Modula 3. The latter two compilers are not yet -part of the official GNU distribution. Each compiler utilizes -@code{gperf} to automatically generate static search structures that -efficiently identify their respective reserved keywords. - -@node Description, Options, Search Structures, Top -@chapter High-Level Description of GNU @code{gperf} - -@menu -* Input Format:: Input Format to @code{gperf} -* Output Format:: Output Format for Generated C Code with @code{gperf} -* Binary Strings:: Use of NUL characters -@end menu - -The perfect hash function generator @code{gperf} reads a set of -``keywords'' from a @dfn{keyfile} (or from the standard input by -default). It attempts to derive a perfect hashing function that -recognizes a member of the @dfn{static keyword set} with at most a -single probe into the lookup table. If @code{gperf} succeeds in -generating such a function it produces a pair of C source code routines -that perform hashing and table lookup recognition. All generated C code -is directed to the standard output. Command-line options described -below allow you to modify the input and output format to @code{gperf}. - -By default, @code{gperf} attempts to produce time-efficient code, with -less emphasis on efficient space utilization. However, several options -exist that permit trading-off execution time for storage space and vice -versa. In particular, expanding the generated table size produces a -sparse search structure, generally yielding faster searches. -Conversely, you can direct @code{gperf} to utilize a C @code{switch} -statement scheme that minimizes data space storage size. Furthermore, -using a C @code{switch} may actually speed up the keyword retrieval time -somewhat. Actual results depend on your C compiler, of course. - -In general, @code{gperf} assigns values to the characters it is using -for hashing until some set of values gives each keyword a unique value. -A helpful heuristic is that the larger the hash value range, the easier -it is for @code{gperf} to find and generate a perfect hash function. -Experimentation is the key to getting the most from @code{gperf}. - -@node Input Format, Output Format, Description, Description -@section Input Format to @code{gperf} -@cindex Format -@cindex Declaration section -@cindex Keywords section -@cindex Functions section -You can control the input keyfile format by varying certain command-line -arguments, in particular the @samp{-t} option. The input's appearance -is similar to GNU utilities @code{flex} and @code{bison} (or UNIX -utilities @code{lex} and @code{yacc}). Here's an outline of the general -format: - -@example -@group -declarations -%% -keywords -%% -functions -@end group -@end example - -@emph{Unlike} @code{flex} or @code{bison}, all sections of -@code{gperf}'s input are optional. The following sections describe the -input format for each section. - -@menu -* Declarations:: @code{struct} Declarations and C Code Inclusion. -* Keywords:: Format for Keyword Entries. -* Functions:: Including Additional C Functions. -@end menu - -@node Declarations, Keywords, Input Format, Input Format -@subsection @code{struct} Declarations and C Code Inclusion - -The keyword input file optionally contains a section for including -arbitrary C declarations and definitions, as well as provisions for -providing a user-supplied @code{struct}. If the @samp{-t} option -@emph{is} enabled, you @emph{must} provide a C @code{struct} as the last -component in the declaration section from the keyfile file. The first -field in this struct must be a @code{char *} or @code{const char *} -identifier called @samp{name}, although it is possible to modify this -field's name with the @samp{-K} option described below. - -Here is a simple example, using months of the year and their attributes as -input: - -@example -@group -struct months @{ char *name; int number; int days; int leap_days; @}; -%% -january, 1, 31, 31 -february, 2, 28, 29 -march, 3, 31, 31 -april, 4, 30, 30 -may, 5, 31, 31 -june, 6, 30, 30 -july, 7, 31, 31 -august, 8, 31, 31 -september, 9, 30, 30 -october, 10, 31, 31 -november, 11, 30, 30 -december, 12, 31, 31 -@end group -@end example - -@cindex @samp{%%} -Separating the @code{struct} declaration from the list of keywords and -other fields are a pair of consecutive percent signs, @samp{%%}, -appearing left justified in the first column, as in the UNIX utility -@code{lex}. - -@cindex @samp{%@{} -@cindex @samp{%@}} -Using a syntax similar to GNU utilities @code{flex} and @code{bison}, it -is possible to directly include C source text and comments verbatim into -the generated output file. This is accomplished by enclosing the region -inside left-justified surrounding @samp{%@{}, @samp{%@}} pairs. Here is -an input fragment based on the previous example that illustrates this -feature: - -@example -@group -%@{ -#include <assert.h> -/* This section of code is inserted directly into the output. */ -int return_month_days (struct months *months, int is_leap_year); -%@} -struct months @{ char *name; int number; int days; int leap_days; @}; -%% -january, 1, 31, 31 -february, 2, 28, 29 -march, 3, 31, 31 -... -@end group -@end example - -It is possible to omit the declaration section entirely. In this case -the keyfile begins directly with the first keyword line, e.g.: - -@example -@group -january, 1, 31, 31 -february, 2, 28, 29 -march, 3, 31, 31 -april, 4, 30, 30 -... -@end group -@end example - -@node Keywords, Functions, Declarations, Input Format -@subsection Format for Keyword Entries - -The second keyfile format section contains lines of keywords and any -associated attributes you might supply. A line beginning with @samp{#} -in the first column is considered a comment. Everything following the -@samp{#} is ignored, up to and including the following newline. - -The first field of each non-comment line is always the key itself. It -can be given in two ways: as a simple name, i.e., without surrounding -string quotation marks, or as a string enclosed in double-quotes, in -C syntax, possibly with backslash escapes like @code{\"} or @code{\234} -or @code{\xa8}. In either case, it must start right at the beginning -of the line, without leading whitespace. -In this context, a ``field'' is considered to extend up to, but -not include, the first blank, comma, or newline. Here is a simple -example taken from a partial list of C reserved words: - -@example -@group -# These are a few C reserved words, see the c.gperf file -# for a complete list of ANSI C reserved words. -unsigned -sizeof -switch -signed -if -default -for -while -return -@end group -@end example - -Note that unlike @code{flex} or @code{bison} the first @samp{%%} marker -may be elided if the declaration section is empty. - -Additional fields may optionally follow the leading keyword. Fields -should be separated by commas, and terminate at the end of line. What -these fields mean is entirely up to you; they are used to initialize the -elements of the user-defined @code{struct} provided by you in the -declaration section. If the @samp{-t} option is @emph{not} enabled -these fields are simply ignored. All previous examples except the last -one contain keyword attributes. - -@node Functions, , Keywords, Input Format -@subsection Including Additional C Functions - -The optional third section also corresponds closely with conventions -found in @code{flex} and @code{bison}. All text in this section, -starting at the final @samp{%%} and extending to the end of the input -file, is included verbatim into the generated output file. Naturally, -it is your responsibility to ensure that the code contained in this -section is valid C. - -@node Output Format, Binary Strings, Input Format, Description -@section Output Format for Generated C Code with @code{gperf} -@cindex hash table - -Several options control how the generated C code appears on the standard -output. Two C function are generated. They are called @code{hash} and -@code{in_word_set}, although you may modify their names with a command-line -option. Both functions require two arguments, a string, @code{char *} -@var{str}, and a length parameter, @code{int} @var{len}. Their default -function prototypes are as follows: - -@deftypefun {unsigned int} hash (const char * @var{str}, unsigned int @var{len}) -By default, the generated @code{hash} function returns an integer value -created by adding @var{len} to several user-specified @var{str} key -positions indexed into an @dfn{associated values} table stored in a -local static array. The associated values table is constructed -internally by @code{gperf} and later output as a static local C array -called @samp{hash_table}; its meaning and properties are described below -(@pxref{Implementation}). The relevant key positions are specified via -the @samp{-k} option when running @code{gperf}, as detailed in the -@emph{Options} section below(@pxref{Options}). -@end deftypefun - -@deftypefun {} in_word_set (const char * @var{str}, unsigned int @var{len}) -If @var{str} is in the keyword set, returns a pointer to that -keyword. More exactly, if the option @samp{-t} was given, it returns -a pointer to the matching keyword's structure. Otherwise it returns -@code{NULL}. -@end deftypefun - -If the option @samp{-c} is not used, @var{str} must be a NUL terminated -string of exactly length @var{len}. If @samp{-c} is used, @var{str} must -simply be an array of @var{len} characters and does not need to be NUL -terminated. - -The code generated for these two functions is affected by the following -options: - -@table @samp -@item -t -@itemx --struct-type -Make use of the user-defined @code{struct}. - -@item -S @var{total-switch-statements} -@itemx --switch=@var{total-switch-statements} -@cindex @code{switch} -Generate 1 or more C @code{switch} statement rather than use a large, -(and potentially sparse) static array. Although the exact time and -space savings of this approach vary according to your C compiler's -degree of optimization, this method often results in smaller and faster -code. -@end table - -If the @samp{-t} and @samp{-S} options are omitted, the default action -is to generate a @code{char *} array containing the keys, together with -additional null strings used for padding the array. By experimenting -with the various input and output options, and timing the resulting C -code, you can determine the best option choices for different keyword -set characteristics. - -@node Binary Strings, , Output Format, Description -@section Use of NUL characters -@cindex NUL - -By default, the code generated by @code{gperf} operates on zero -terminated strings, the usual representation of strings in C. This means -that the keywords in the input file must not contain NUL characters, -and the @var{str} argument passed to @code{hash} or @code{in_word_set} -must be NUL terminated and have exactly length @var{len}. - -If option @samp{-c} is used, then the @var{str} argument does not need -to be NUL terminated. The code generated by @code{gperf} will only -access the first @var{len}, not @var{len+1}, bytes starting at @var{str}. -However, the keywords in the input file still must not contain NUL -characters. - -If option @samp{-l} is used, then the hash table performs binary -comparison. The keywords in the input file may contain NUL characters, -written in string syntax as @code{\000} or @code{\x00}, and the code -generated by @code{gperf} will treat NUL like any other character. -Also, in this case the @samp{-c} option is ignored. - -@node Options, Bugs, Description, Top -@chapter Invoking @code{gperf} - -There are @emph{many} options to @code{gperf}. They were added to make -the program more convenient for use with real applications. ``On-line'' -help is readily available via the @samp{-h} option. Here is the -complete list of options. - -@menu -* Input Details:: Options that affect Interpretation of the Input File -* Output Language:: Specifying the Language for the Output Code -* Output Details:: Fine tuning Details in the Output Code -* Algorithmic Details:: Changing the Algorithms employed by @code{gperf} -* Verbosity:: Informative Output -@end menu - -@node Input Details, Output Language, Options, Options -@section Options that affect Interpretation of the Input File - -@table @samp -@item -e @var{keyword-delimiter-list} -@itemx --delimiters=@var{keyword-delimiter-list} -@cindex Delimiters -Allows the user to provide a string containing delimiters used to -separate keywords from their attributes. The default is ",\n". This -option is essential if you want to use keywords that have embedded -commas or newlines. One useful trick is to use -e'TAB', where TAB is -the literal tab character. - -@item -t -@itemx --struct-type -Allows you to include a @code{struct} type declaration for generated -code. Any text before a pair of consecutive @samp{%%} is considered -part of the type declaration. Keywords and additional fields may follow -this, one group of fields per line. A set of examples for generating -perfect hash tables and functions for Ada, C, C++, Pascal, Modula 2, -Modula 3 and JavaScript reserved words are distributed with this release. -@end table - -@node Output Language, Output Details, Input Details, Options -@section Options to specify the Language for the Output Code - -@table @samp -@item -L @var{generated-language-name} -@itemx --language=@var{generated-language-name} -Instructs @code{gperf} to generate code in the language specified by the -option's argument. Languages handled are currently: - -@table @samp -@item KR-C -Old-style K&R C. This language is understood by old-style C compilers and -ANSI C compilers, but ANSI C compilers may flag warnings (or even errors) -because of lacking @samp{const}. - -@item C -Common C. This language is understood by ANSI C compilers, and also by -old-style C compilers, provided that you @code{#define const} to empty -for compilers which don't know about this keyword. - -@item ANSI-C -ANSI C. This language is understood by ANSI C compilers and C++ compilers. - -@item C++ -C++. This language is understood by C++ compilers. -@end table - -The default is C. - -@item -a -This option is supported for compatibility with previous releases of -@code{gperf}. It does not do anything. - -@item -g -This option is supported for compatibility with previous releases of -@code{gperf}. It does not do anything. -@end table - -@node Output Details, Algorithmic Details, Output Language, Options -@section Options for fine tuning Details in the Output Code - -@table @samp -@item -K @var{key-name} -@itemx --slot-name=@var{key-name} -@cindex Slot name -This option is only useful when option @samp{-t} has been given. -By default, the program assumes the structure component identifier for -the keyword is @samp{name}. This option allows an arbitrary choice of -identifier for this component, although it still must occur as the first -field in your supplied @code{struct}. - -@item -F @var{initializers} -@itemx --initializer-suffix=@var{initializers} -@cindex Initializers -This option is only useful when option @samp{-t} has been given. -It permits to specify initializers for the structure members following -@var{key name} in empty hash table entries. The list of initializers -should start with a comma. By default, the emitted code will -zero-initialize structure members following @var{key name}. - -@item -H @var{hash-function-name} -@itemx --hash-fn-name=@var{hash-function-name} -Allows you to specify the name for the generated hash function. Default -name is @samp{hash}. This option permits the use of two hash tables in -the same file. - -@item -N @var{lookup-function-name} -@itemx --lookup-fn-name=@var{lookup-function-name} -Allows you to specify the name for the generated lookup function. -Default name is @samp{in_word_set}. This option permits completely -automatic generation of perfect hash functions, especially when multiple -generated hash functions are used in the same application. - -@item -Z @var{class-name} -@itemx --class-name=@var{class-name} -@cindex Class name -This option is only useful when option @samp{-L C++} has been given. It -allows you to specify the name of generated C++ class. Default name is -@code{Perfect_Hash}. - -@item -7 -@itemx --seven-bit -This option specifies that all strings that will be passed as arguments -to the generated hash function and the generated lookup function will -solely consist of 7-bit ASCII characters (characters in the range 0..127). -(Note that the ANSI C functions @code{isalnum} and @code{isgraph} do -@emph{not} guarantee that a character is in this range. Only an explicit -test like @samp{c >= 'A' && c <= 'Z'} guarantees this.) This was the -default in versions of @code{gperf} earlier than 2.7; now the default is -to assume 8-bit characters. - -@item -c -@itemx --compare-strncmp -Generates C code that uses the @code{strncmp} function to perform -string comparisons. The default action is to use @code{strcmp}. - -@item -C -@itemx --readonly-tables -Makes the contents of all generated lookup tables constant, i.e., -``readonly''. Many compilers can generate more efficient code for this -by putting the tables in readonly memory. - -@item -E -@itemx --enum -Define constant values using an enum local to the lookup function rather -than with #defines. This also means that different lookup functions can -reside in the same file. Thanks to James Clark @code{<jjc@@ai.mit.edu>}. - -@item -I -@itemx --includes -Include the necessary system include file, @code{<string.h>}, at the -beginning of the code. By default, this is not done; the user must -include this header file himself to allow compilation of the code. - -@item -G -@itemx --global -Generate the static table of keywords as a static global variable, -rather than hiding it inside of the lookup function (which is the -default behavior). - -@item -W @var{hash-table-array-name} -@itemx --word-array-name=@var{hash-table-array-name} -@cindex Array name -Allows you to specify the name for the generated array containing the -hash table. Default name is @samp{wordlist}. This option permits the -use of two hash tables in the same file, even when the option @samp{-G} -is given. - -@item -S @var{total-switch-statements} -@itemx --switch=@var{total-switch-statements} -@cindex @code{switch} -Causes the generated C code to use a @code{switch} statement scheme, -rather than an array lookup table. This can lead to a reduction in both -time and space requirements for some keyfiles. The argument to this -option determines how many @code{switch} statements are generated. A -value of 1 generates 1 @code{switch} containing all the elements, a -value of 2 generates 2 tables with 1/2 the elements in each -@code{switch}, etc. This is useful since many C compilers cannot -correctly generate code for large @code{switch} statements. This option -was inspired in part by Keith Bostic's original C program. - -@item -T -@itemx --omit-struct-type -Prevents the transfer of the type declaration to the output file. Use -this option if the type is already defined elsewhere. - -@item -p -This option is supported for compatibility with previous releases of -@code{gperf}. It does not do anything. -@end table - -@node Algorithmic Details, Verbosity, Output Details, Options -@section Options for changing the Algorithms employed by @code{gperf} - -@table @samp -@item -k @var{keys} -@itemx --key-positions=@var{keys} -Allows selection of the character key positions used in the keywords' -hash function. The allowable choices range between 1-126, inclusive. -The positions are separated by commas, e.g., @samp{-k 9,4,13,14}; -ranges may be used, e.g., @samp{-k 2-7}; and positions may occur -in any order. Furthermore, the meta-character '*' causes the generated -hash function to consider @strong{all} character positions in each key, -whereas '$' instructs the hash function to use the ``final character'' -of a key (this is the only way to use a character position greater than -126, incidentally). - -For instance, the option @samp{-k 1,2,4,6-10,'$'} generates a hash -function that considers positions 1,2,4,6,7,8,9,10, plus the last -character in each key (which may differ for each key, obviously). Keys -with length less than the indicated key positions work properly, since -selected key positions exceeding the key length are simply not -referenced in the hash function. - -@item -l -@itemx --compare-strlen -Compare key lengths before trying a string comparison. This might cut -down on the number of string comparisons made during the lookup, since -keys with different lengths are never compared via @code{strcmp}. -However, using @samp{-l} might greatly increase the size of the -generated C code if the lookup table range is large (which implies that -the switch option @samp{-S} is not enabled), since the length table -contains as many elements as there are entries in the lookup table. -This option is mandatory for binary comparisons (@pxref{Binary Strings}). - -@item -D -@itemx --duplicates -@cindex Duplicates -Handle keywords whose key position sets hash to duplicate values. -Duplicate hash values occur for two reasons: - -@itemize @bullet -@item -Since @code{gperf} does not backtrack it is possible for it to process -all your input keywords without finding a unique mapping for each word. -However, frequently only a very small number of duplicates occur, and -the majority of keys still require one probe into the table. - -@item -Sometimes a set of keys may have the same names, but possess different -attributes. With the -D option @code{gperf} treats all these keys as -part of an equivalence class and generates a perfect hash function with -multiple comparisons for duplicate keys. It is up to you to completely -disambiguate the keywords by modifying the generated C code. However, -@code{gperf} helps you out by organizing the output. -@end itemize - -Option @samp{-D} is extremely useful for certain large or highly -redundant keyword sets, e.g., assembler instruction opcodes. -Using this option usually means that the generated hash function is no -longer perfect. On the other hand, it permits @code{gperf} to work on -keyword sets that it otherwise could not handle. - -@item -f @var{iteration-amount} -@itemx --fast=@var{iteration-amount} -Generate the perfect hash function ``fast''. This decreases -@code{gperf}'s running time at the cost of minimizing generated -table-size. The iteration amount represents the number of times to -iterate when resolving a collision. `0' means iterate by the number of -keywords. This option is probably most useful when used in conjunction -with options @samp{-D} and/or @samp{-S} for @emph{large} keyword sets. - -@item -i @var{initial-value} -@itemx --initial-asso=@var{initial-value} -Provides an initial @var{value} for the associate values array. Default -is 0. Increasing the initial value helps inflate the final table size, -possibly leading to more time efficient keyword lookups. Note that this -option is not particularly useful when @samp{-S} is used. Also, -@samp{-i} is overridden when the @samp{-r} option is used. - -@item -j @var{jump-value} -@itemx --jump=@var{jump-value} -@cindex Jump value -Affects the ``jump value'', i.e., how far to advance the associated -character value upon collisions. @var{Jump-value} is rounded up to an -odd number, the default is 5. If the @var{jump-value} is 0 @code{gperf} -jumps by random amounts. - -@item -n -@itemx --no-strlen -Instructs the generator not to include the length of a keyword when -computing its hash value. This may save a few assembly instructions in -the generated lookup table. - -@item -o -@itemx --occurrence-sort -Reorders the keywords by sorting the keywords so that frequently -occuring key position set components appear first. A second reordering -pass follows so that keys with ``already determined values'' are placed -towards the front of the keylist. This may decrease the time required -to generate a perfect hash function for many keyword sets, and also -produce more minimal perfect hash functions. The reason for this is -that the reordering helps prune the search time by handling inevitable -collisions early in the search process. On the other hand, if the -number of keywords is @emph{very} large using @samp{-o} may -@emph{increase} @code{gperf}'s execution time, since collisions will -begin earlier and continue throughout the remainder of keyword -processing. See Cichelli's paper from the January 1980 Communications -of the ACM for details. - -@item -r -@itemx --random -Utilizes randomness to initialize the associated values table. This -frequently generates solutions faster than using deterministic -initialization (which starts all associated values at 0). Furthermore, -using the randomization option generally increases the size of the -table. If @code{gperf} has difficultly with a certain keyword set try using -@samp{-r} or @samp{-D}. - -@item -s @var{size-multiple} -@itemx --size-multiple=@var{size-multiple} -Affects the size of the generated hash table. The numeric argument for -this option indicates ``how many times larger or smaller'' the maximum -associated value range should be, in relationship to the number of keys. -If the @var{size-multiple} is negative the maximum associated value is -calculated by @emph{dividing} it into the total number of keys. For -example, a value of 3 means ``allow the maximum associated value to be -about 3 times larger than the number of input keys''. - -Conversely, a value of -3 means ``allow the maximum associated value to -be about 3 times smaller than the number of input keys''. Negative -values are useful for limiting the overall size of the generated hash -table, though this usually increases the number of duplicate hash -values. - -If `generate switch' option @samp{-S} is @emph{not} enabled, the maximum -associated value influences the static array table size, and a larger -table should decrease the time required for an unsuccessful search, at -the expense of extra table space. - -The default value is 1, thus the default maximum associated value about -the same size as the number of keys (for efficiency, the maximum -associated value is always rounded up to a power of 2). The actual -table size may vary somewhat, since this technique is essentially a -heuristic. In particular, setting this value too high slows down -@code{gperf}'s runtime, since it must search through a much larger range -of values. Judicious use of the @samp{-f} option helps alleviate this -overhead, however. -@end table - -@node Verbosity, , Algorithmic Details, Options -@section Informative Output - -@table @samp -@item -h -@itemx --help -Prints a short summary on the meaning of each program option. Aborts -further program execution. - -@item -v -@itemx --version -Prints out the current version number. - -@item -d -@itemx --debug -Enables the debugging option. This produces verbose diagnostics to -``standard error'' when @code{gperf} is executing. It is useful both for -maintaining the program and for determining whether a given set of -options is actually speeding up the search for a solution. Some useful -information is dumped at the end of the program when the @samp{-d} -option is enabled. -@end table - -@node Bugs, Projects, Options, Top -@chapter Known Bugs and Limitations with @code{gperf} - -The following are some limitations with the current release of -@code{gperf}: - -@itemize @bullet -@item -The @code{gperf} utility is tuned to execute quickly, and works quickly -for small to medium size data sets (around 1000 keywords). It is -extremely useful for maintaining perfect hash functions for compiler -keyword sets. Several recent enhancements now enable @code{gperf} to -work efficiently on much larger keyword sets (over 15,000 keywords). -When processing large keyword sets it helps greatly to have over 8 megs -of RAM. - -However, since @code{gperf} does not backtrack no guaranteed solution -occurs on every run. On the other hand, it is usually easy to obtain a -solution by varying the option parameters. In particular, try the -@samp{-r} option, and also try changing the default arguments to the -@samp{-s} and @samp{-j} options. To @emph{guarantee} a solution, use -the @samp{-D} and @samp{-S} options, although the final results are not -likely to be a @emph{perfect} hash function anymore! Finally, use the -@samp{-f} option if you want @code{gperf} to generate the perfect hash -function @emph{fast}, with less emphasis on making it minimal. - -@item -The size of the generate static keyword array can get @emph{extremely} -large if the input keyword file is large or if the keywords are quite -similar. This tends to slow down the compilation of the generated C -code, and @emph{greatly} inflates the object code size. If this -situation occurs, consider using the @samp{-S} option to reduce data -size, potentially increasing keyword recognition time a negligible -amount. Since many C compilers cannot correctly generated code for -large switch statements it is important to qualify the @var{-S} option -with an appropriate numerical argument that controls the number of -switch statements generated. - -@item -The maximum number of key positions selected for a given key has an -arbitrary limit of 126. This restriction should be removed, and if -anyone considers this a problem write me and let me know so I can remove -the constraint. -@end itemize - -@node Projects, Implementation, Bugs, Top -@chapter Things Still Left to Do - -It should be ``relatively'' easy to replace the current perfect hash -function algorithm with a more exhaustive approach; the perfect hash -module is essential independent from other program modules. Additional -worthwhile improvements include: - -@itemize @bullet -@item -Make the algorithm more robust. At present, the program halts with an -error diagnostic if it can't find a direct solution and the @samp{-D} -option is not enabled. A more comprehensive, albeit computationally -expensive, approach would employ backtracking or enable alternative -options and retry. It's not clear how helpful this would be, in -general, since most search sets are rather small in practice. - -@item -Another useful extension involves modifying the program to generate -``minimal'' perfect hash functions (under certain circumstances, the -current version can be rather extravagant in the generated table size). -Again, this is mostly of theoretical interest, since a sparse table -often produces faster lookups, and use of the @samp{-S} @code{switch} -option can minimize the data size, at the expense of slightly longer -lookups (note that the gcc compiler generally produces good code for -@code{switch} statements, reducing the need for more complex schemes). - -@item -In addition to improving the algorithm, it would also be useful to -generate a C++ class or Ada package as the code output, in addition to -the current C routines. -@end itemize - -@node Implementation, Bibliography, Projects, Top -@chapter Implementation Details of GNU @code{gperf} - -A paper describing the high-level description of the data structures and -algorithms used to implement @code{gperf} will soon be available. This -paper is useful not only from a maintenance and enhancement perspective, -but also because they demonstrate several clever and useful programming -techniques, e.g., `Iteration Number' boolean arrays, double -hashing, a ``safe'' and efficient method for reading arbitrarily long -input from a file, and a provably optimal algorithm for simultaneously -determining both the minimum and maximum elements in a list. - -@page - -@node Bibliography, Concept Index, Implementation, Top -@chapter Bibliography - -[1] Chang, C.C.: @i{A Scheme for Constructing Ordered Minimal Perfect -Hashing Functions} Information Sciences 39(1986), 187-195. - -[2] Cichelli, Richard J. @i{Author's Response to ``On Cichelli's Minimal Perfect Hash -Functions Method''} Communications of the ACM, 23, 12(December 1980), 729. - -[3] Cichelli, Richard J. @i{Minimal Perfect Hash Functions Made Simple} -Communications of the ACM, 23, 1(January 1980), 17-19. - -[4] Cook, C. R. and Oldehoeft, R.R. @i{A Letter Oriented Minimal -Perfect Hashing Function} SIGPLAN Notices, 17, 9(September 1982), 18-27. - -[5] Cormack, G. V. and Horspool, R. N. S. and Kaiserwerth, M. -@i{Practical Perfect Hashing} Computer Journal, 28, 1(January 1985), 54-58. - -[6] Jaeschke, G. @i{Reciprocal Hashing: A Method for Generating Minimal -Perfect Hashing Functions} Communications of the ACM, 24, 12(December -1981), 829-833. - -[7] Jaeschke, G. and Osterburg, G. @i{On Cichelli's Minimal Perfect -Hash Functions Method} Communications of the ACM, 23, 12(December 1980), -728-729. - -[8] Sager, Thomas J. @i{A Polynomial Time Generator for Minimal Perfect -Hash Functions} Communications of the ACM, 28, 5(December 1985), 523-532 - -[9] Schmidt, Douglas C. @i{GPERF: A Perfect Hash Function Generator} -Second USENIX C++ Conference Proceedings, April 1990. - -[10] Sebesta, R.W. and Taylor, M.A. @i{Minimal Perfect Hash Functions -for Reserved Word Lists} SIGPLAN Notices, 20, 12(September 1985), 47-53. - -[11] Sprugnoli, R. @i{Perfect Hashing Functions: A Single Probe -Retrieving Method for Static Sets} Communications of the ACM, 20 -11(November 1977), 841-850. - -[12] Stallman, Richard M. @i{Using and Porting GNU CC} Free Software Foundation, -1988. - -[13] Stroustrup, Bjarne @i{The C++ Programming Language.} Addison-Wesley, 1986. - -[14] Tiemann, Michael D. @i{User's Guide to GNU C++} Free Software -Foundation, 1989. - -@node Concept Index, , Bibliography, Top -@unnumbered Concept Index - -@printindex cp - -@contents -@bye diff --git a/contrib/gperf/doc/gpl.texinfo b/contrib/gperf/doc/gpl.texinfo deleted file mode 100644 index be2dc253c4702..0000000000000 --- a/contrib/gperf/doc/gpl.texinfo +++ /dev/null @@ -1,398 +0,0 @@ -@c This GPL is meant to be included from other files. -@c To format a standalone GPL, use license.texi. - -@center Version 2, June 1991 - -@display -Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. -@end display - -@unnumberedsec Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software---to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - -@iftex -@unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end iftex -@ifinfo -@center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -@end ifinfo - -@enumerate 0 -@item -This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The ``Program'', below, -refers to any such program or work, and a ``work based on the Program'' -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term ``modification''.) Each licensee is addressed as ``you''. - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - -@item -You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - -@item -You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - -@enumerate a -@item -You must cause the modified files to carry prominent notices -stating that you changed the files and the date of any change. - -@item -You must cause any work that you distribute or publish, that in -whole or in part contains or is derived from the Program or any -part thereof, to be licensed as a whole at no charge to all third -parties under the terms of this License. - -@item -If the modified program normally reads commands interactively -when run, you must cause it, when started running for such -interactive use in the most ordinary way, to print or display an -announcement including an appropriate copyright notice and a -notice that there is no warranty (or else, saying that you provide -a warranty) and that users may redistribute the program under -these conditions, and telling the user how to view a copy of this -License. (Exception: if the Program itself is interactive but -does not normally print such an announcement, your work based on -the Program is not required to print an announcement.) -@end enumerate - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - -@item -You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - -@enumerate a -@item -Accompany it with the complete corresponding machine-readable -source code, which must be distributed under the terms of Sections -1 and 2 above on a medium customarily used for software interchange; or, - -@item -Accompany it with a written offer, valid for at least three -years, to give any third party, for a charge no more than your -cost of physically performing source distribution, a complete -machine-readable copy of the corresponding source code, to be -distributed under the terms of Sections 1 and 2 above on a medium -customarily used for software interchange; or, - -@item -Accompany it with the information you received as to the offer -to distribute corresponding source code. (This alternative is -allowed only for noncommercial distribution and only if you -received the program in object code or executable form with such -an offer, in accord with Subsection b above.) -@end enumerate - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - -@item -You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - -@item -You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -@item -Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - -@item -If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - -@item -If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - -@item -The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and ``any -later version'', you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - -@item -If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - -@iftex -@vskip -@baselineskip -@vskip -@baselineskip -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo - -@item -BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - -@item -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. -@end enumerate - -@iftex -@heading END OF TERMS AND CONDITIONS -@end iftex -@ifinfo -@center END OF TERMS AND CONDITIONS -@end ifinfo - -@page -@unnumberedsec How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the ``copyright'' line and a pointer to where the full notice is found. - -@smallexample -@var{one line to give the program's name and an idea of what it does.} -Copyright (C) @var{year} @var{name of author} - -This program 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 program 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. -@end smallexample - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - -@smallexample -Gnomovision version 69, Copyright (C) @var{year} @var{name of author} -Gnomovision comes with ABSOLUTELY NO WARRANTY; for details -type `show w'. This is free software, and you are welcome -to redistribute it under certain conditions; type `show c' -for details. -@end smallexample - -The hypothetical commands @samp{show w} and @samp{show c} should show -the appropriate parts of the General Public License. Of course, the -commands you use may be called something other than @samp{show w} and -@samp{show c}; they could even be mouse-clicks or menu items---whatever -suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a ``copyright disclaimer'' for the program, if -necessary. Here is a sample; alter the names: - -@example -@group -Yoyodyne, Inc., hereby disclaims all copyright -interest in the program `Gnomovision' -(which makes passes at compilers) written -by James Hacker. - -@var{signature of Ty Coon}, 1 April 1989 -Ty Coon, President of Vice -@end group -@end example - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/contrib/gperf/doc/help2man b/contrib/gperf/doc/help2man deleted file mode 100755 index 2c8164789aa7d..0000000000000 --- a/contrib/gperf/doc/help2man +++ /dev/null @@ -1,513 +0,0 @@ -#!/usr/bin/perl -w - -# Generate a short man page from --help and --version output. -# Copyright © 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - -# This program 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, or (at your option) -# any later version. - -# This program 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. - -# Written by Brendan O'Dea <bod@compusol.com.au> -# Available from ftp://ftp.gnu.org/gnu/help2man/ - -use 5.004; -use strict; -use Getopt::Long; -use Text::Tabs qw(expand); -use POSIX qw(strftime setlocale LC_TIME); - -my $this_program = 'help2man'; -my $this_version = '1.022'; -my $version_info = <<EOT; -GNU $this_program $this_version - -Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -Written by Brendan O'Dea <bod\@compusol.com.au> -EOT - -my $help_info = <<EOT; -`$this_program' generates a man page out of `--help' and `--version' output. - -Usage: $this_program [OPTION]... EXECUTABLE - - -n, --name=STRING use `STRING' as the description for the NAME paragraph - -s, --section=SECTION use `SECTION' as the section for the man page - -i, --include=FILE include material from `FILE' - -I, --opt-include=FILE include material from `FILE' if it exists - -o, --output=FILE send output to `FILE' - -N, --no-info suppress pointer to Texinfo manual - --help print this help, then exit - --version print version number, then exit - -EXECUTABLE should accept `--help' and `--version' options. - -Report bugs to <bug-help2man\@gnu.org>. -EOT - -my $section = 1; -my ($opt_name, @opt_include, $opt_output, $opt_no_info); - -# Parse options. -Getopt::Long::config('bundling'); -GetOptions ( - 'n|name=s' => \$opt_name, - 's|section=s' => \$section, - 'i|include=s' => sub { push @opt_include, [ pop, 1 ] }, - 'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] }, - 'o|output=s' => \$opt_output, - 'N|no-info' => \$opt_no_info, - help => sub { print $help_info; exit }, - version => sub { print $version_info; exit }, -) or die $help_info; - -die $help_info unless @ARGV == 1; - -my %include = (); -my %append = (); -my @include = (); # retain order given in include file - -# Provide replacement `quote-regex' operator for pre-5.005. -BEGIN { eval q(sub qr { '' =~ $_[0]; $_[0] }) if $] < 5.005 } - -# Process include file (if given). Format is: -# -# [section name] -# verbatim text -# -# or -# -# /pattern/ -# verbatim text -# - -for (@opt_include) -{ - my ($inc, $required) = @$_; - - next unless -f $inc or $required; - die "$this_program: can't open `$inc' ($!)\n" - unless open INC, $inc; - - my $key; - my $hash = \%include; - - while (<INC>) - { - # [section] - if (/^\[([^]]+)\]/) - { - $key = uc $1; - $key =~ s/^\s+//; - $key =~ s/\s+$//; - $hash = \%include; - push @include, $key unless $include{$key}; - next; - } - - # /pattern/ - if (m!^/(.*)/([ims]*)!) - { - my $pat = $2 ? "(?$2)$1" : $1; - - # Check pattern. - eval { $key = qr($pat) }; - if ($@) - { - $@ =~ s/ at .*? line \d.*//; - die "$inc:$.:$@"; - } - - $hash = \%append; - next; - } - - # Silently ignore anything before the first - # section--allows for comments and revision info. - next unless $key; - - $hash->{$key} ||= ''; - $hash->{$key} .= $_; - } - - close INC; - - die "$this_program: no valid information found in `$inc'\n" - unless $key; -} - -# Compress trailing blank lines. -for my $hash (\(%include, %append)) -{ - for (keys %$hash) { $hash->{$_} =~ s/\n+$/\n/ } -} - -# Turn off localisation of executable's ouput. -@ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; - -# Turn off localisation of date (for strftime). -setlocale LC_TIME, 'C'; - -# Grab help and version info from executable. -my ($help_text, $version_text) = map { - join '', map { s/ +$//; expand $_ } `$ARGV[0] --$_ 2>/dev/null` - or die "$this_program: can't get `--$_' info from $ARGV[0]\n" -} qw(help version); - -my $date = strftime "%B %Y", localtime; -(my $program = $ARGV[0]) =~ s!.*/!!; -my $package = $program; -my $version; - -if ($opt_output) -{ - unlink $opt_output - or die "$this_program: can't unlink $opt_output ($!)\n" - if -e $opt_output; - - open STDOUT, ">$opt_output" - or die "$this_program: can't create $opt_output ($!)\n"; -} - -# The first line of the --version information is assumed to be in one -# of the following formats: -# -# <version> -# <program> <version> -# {GNU,Free} <program> <version> -# <program> ({GNU,Free} <package>) <version> -# <program> - {GNU,Free} <package> <version> -# -# and seperated from any copyright/author details by a blank line. - -($_, $version_text) = split /\n+/, $version_text, 2; - -if (/^(\S+) +\(((?:GNU|Free) +[^)]+)\) +(.*)/ or - /^(\S+) +- *((?:GNU|Free) +\S+) +(.*)/) -{ - $program = $1; - $package = $2; - $version = $3; -} -elsif (/^((?:GNU|Free) +)?(\S+) +(.*)/) -{ - $program = $2; - $package = $1 ? "$1$2" : $2; - $version = $3; -} -else -{ - $version = $_; -} - -$program =~ s!.*/!!; - -# No info for `info' itself. -$opt_no_info = 1 if $program eq 'info'; - -# --name overrides --include contents. -$include{NAME} = "$program \\- $opt_name\n" if $opt_name; - -# Default (useless) NAME paragraph. -$include{NAME} ||= "$program \\- manual page for $program $version\n"; - -# Man pages traditionally have the page title in caps. -my $PROGRAM = uc $program; - -# Extract usage clause(s) [if any] for SYNOPSIS. -if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| *or: +\S).*)*)//m) -{ - my @syn = $2 . $3; - - if ($_ = $4) - { - s/^\n//; - for (split /\n/) { s/^ *(or: +)?//; push @syn, $_ } - } - - my $synopsis = ''; - for (@syn) - { - $synopsis .= ".br\n" if $synopsis; - s!^\S*/!!; - s/^(\S+) *//; - $synopsis .= ".B $1\n"; - s/\s+$//; - s/(([][]|\.\.+)+)/\\fR$1\\fI/g; - s/^/\\fI/ unless s/^\\fR//; - $_ .= '\fR'; - s/(\\fI)( *)/$2$1/g; - s/\\fI\\fR//g; - s/^\\fR//; - s/\\fI$//; - s/^\./\\&./; - - $synopsis .= "$_\n"; - } - - $include{SYNOPSIS} ||= $synopsis; -} - -# Process text, initial section is DESCRIPTION. -my $sect = 'DESCRIPTION'; -$_ = "$help_text\n\n$version_text"; - -# Normalise paragraph breaks. -s/^\n+//; -s/\n*$/\n/; -s/\n\n+/\n\n/g; - -# Temporarily exchange leading dots and backslashes for tokens. -s/^\./\x80/mg; -s/\\/\x81/g; - -# Start a new paragraph (if required) for these. -s/([^\n])\n(Report +bugs|Email +bug +reports +to|Written +by)/$1\n\n$2/g; - -sub convert_option; - -while (length) -{ - # Convert some standard paragraph names. - if (s/^(Options|Examples): *\n//) - { - $sect = uc $1; - next; - } - - # Copyright section - if (/^Copyright +[(\xa9]/) - { - $sect = 'COPYRIGHT'; - $include{$sect} ||= ''; - $include{$sect} .= ".PP\n" if $include{$sect}; - - my $copy; - ($copy, $_) = split /\n\n/, $_, 2; - - for ($copy) - { - # Add back newline - s/\n*$/\n/; - - # Convert iso9959-1 copyright symbol or (c) to nroff - # character. - s/^Copyright +(?:\xa9|\([Cc]\))/Copyright \\(co/mg; - - # Insert line breaks before additional copyright messages - # and the disclaimer. - s/(.)\n(Copyright |This +is +free +software)/$1\n.br\n$2/g; - - # Join hyphenated lines. - s/([A-Za-z])-\n */$1/g; - } - - $include{$sect} .= $copy; - $_ ||= ''; - next; - } - - # Catch bug report text. - if (/^(Report +bugs|Email +bug +reports +to) /) - { - $sect = 'REPORTING BUGS'; - } - - # Author section. - elsif (/^Written +by/) - { - $sect = 'AUTHOR'; - } - - # Examples, indicated by an indented leading $, % or > are - # rendered in a constant width font. - if (/^( +)([\$\%>] )\S/) - { - my $indent = $1; - my $prefix = $2; - my $break = '.IP'; - $include{$sect} ||= ''; - while (s/^$indent\Q$prefix\E(\S.*)\n*//) - { - $include{$sect} .= "$break\n\\f(CW$prefix$1\\fR\n"; - $break = '.br'; - } - - next; - } - - my $matched = ''; - $include{$sect} ||= ''; - - # Sub-sections have a trailing colon and the second line indented. - if (s/^(\S.*:) *\n / /) - { - $matched .= $& if %append; - $include{$sect} .= qq(.SS "$1"\n); - } - - my $indent = 0; - my $content = ''; - - # Option with description. - if (s/^( {1,10}([+-]\S.*?))(?:( +)|\n( {20,}))(\S.*)\n//) - { - $matched .= $& if %append; - $indent = length ($4 || "$1$3"); - $content = ".TP\n\x82$2\n\x82$5\n"; - unless ($4) - { - # Indent may be different on second line. - $indent = length $& if /^ {20,}/; - } - } - - # Option without description. - elsif (s/^ {1,10}([+-]\S.*)\n//) - { - $matched .= $& if %append; - $content = ".HP\n\x82$1\n"; - $indent = 80; # not continued - } - - # Indented paragraph with tag. - elsif (s/^( +(\S.*?) +)(\S.*)\n//) - { - $matched .= $& if %append; - $indent = length $1; - $content = ".TP\n\x82$2\n\x82$3\n"; - } - - # Indented paragraph. - elsif (s/^( +)(\S.*)\n//) - { - $matched .= $& if %append; - $indent = length $1; - $content = ".IP\n\x82$2\n"; - } - - # Left justified paragraph. - else - { - s/(.*)\n//; - $matched .= $& if %append; - $content = ".PP\n" if $include{$sect}; - $content .= "$1\n"; - } - - # Append continuations. - while (s/^ {$indent}(\S.*)\n//) - { - $matched .= $& if %append; - $content .= "\x82$1\n" - } - - # Move to next paragraph. - s/^\n+//; - - for ($content) - { - # Leading dot protection. - s/\x82\./\x80/g; - s/\x82//g; - - # Convert options. - s/(^| )(-[][\w=-]+)/$1 . convert_option $2/mge; - } - - # Check if matched paragraph contains /pat/. - if (%append) - { - for my $pat (keys %append) - { - if ($matched =~ $pat) - { - $content .= ".PP\n" unless $append{$pat} =~ /^\./; - $content .= $append{$pat}; - } - } - } - - $include{$sect} .= $content; -} - -# Refer to the real documentation. -unless ($opt_no_info) -{ - $sect = 'SEE ALSO'; - $include{$sect} ||= ''; - $include{$sect} .= ".PP\n" if $include{$sect}; - $include{$sect} .= <<EOT; -The full documentation for -.B $program -is maintained as a Texinfo manual. If the -.B info -and -.B $program -programs are properly installed at your site, the command -.IP -.B info $program -.PP -should give you access to the complete manual. -EOT -} - -# Output header. -print <<EOT; -.\\" DO NOT MODIFY THIS FILE! It was generated by $this_program $this_version. -.TH $PROGRAM "$section" "$date" "$package $version" FSF -EOT - -# Section ordering. -my @pre = qw(NAME SYNOPSIS DESCRIPTION OPTIONS EXAMPLES); -my @post = ('AUTHOR', 'REPORTING BUGS', 'COPYRIGHT', 'SEE ALSO'); -my $filter = join '|', @pre, @post; - -# Output content. -for (@pre, (grep ! /^($filter)$/o, @include), @post) -{ - if ($include{$_}) - { - my $quote = /\W/ ? '"' : ''; - print ".SH $quote$_$quote\n"; - - for ($include{$_}) - { - # Replace leading dot an backslash tokens. - s/\x80/\\&./g; - s/\x81/\\e/g; - print; - } - } -} - -exit; - -# Convert option dashes to \- to stop nroff from hyphenating 'em, and -# embolden. Option arguments get italicised. -sub convert_option -{ - local $_ = '\fB' . shift; - - s/-/\\-/g; - unless (s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/) - { - s/=(.)/\\fR=\\fI$1/; - s/ (.)/ \\fI$1/; - $_ .= '\fR'; - } - - $_; -} diff --git a/contrib/gperf/doc/texinfo.tex b/contrib/gperf/doc/texinfo.tex deleted file mode 100644 index faad86b0e2478..0000000000000 --- a/contrib/gperf/doc/texinfo.tex +++ /dev/null @@ -1,5999 +0,0 @@ -% texinfo.tex -- TeX macros to handle Texinfo files. -% -% Load plain if necessary, i.e., if running under initex. -\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi -% -\def\texinfoversion{2000-05-28.15} -% -% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 -% Free Software Foundation, Inc. -% -% This texinfo.tex 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, or (at -% your option) any later version. -% -% This texinfo.tex 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 texinfo.tex file; see the file COPYING. If not, write -% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -% Boston, MA 02111-1307, USA. -% -% In other words, you are welcome to use, share and improve this program. -% You are forbidden to forbid anyone else to use, share and improve -% what you give them. Help stamp out software-hoarding! -% -% Please try the latest version of texinfo.tex before submitting bug -% reports; you can get the latest version from: -% ftp://ftp.gnu.org/gnu/texinfo.tex -% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) -% ftp://texinfo.org/tex/texinfo.tex -% ftp://us.ctan.org/macros/texinfo/texinfo.tex -% (and all CTAN mirrors, finger ctan@us.ctan.org for a list). -% /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% The texinfo.tex in any given Texinfo distribution could well be out -% of date, so if that's what you're using, please check. -% Texinfo has a small home page at http://texinfo.org/. -% -% Send bug reports to bug-texinfo@gnu.org. Please include including a -% complete document in each bug report with which we can reproduce the -% problem. Patches are, of course, greatly appreciated. -% -% To process a Texinfo manual with TeX, it's most reliable to use the -% texi2dvi shell script that comes with the distribution. For a simple -% manual foo.texi, however, you can get away with this: -% tex foo.texi -% texindex foo.?? -% tex foo.texi -% tex foo.texi -% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. -% The extra runs of TeX get the cross-reference information correct. -% Sometimes one run after texindex suffices, and sometimes you need more -% than two; texi2dvi does it as many times as necessary. -% -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. - -\message{Loading texinfo [version \texinfoversion]:} - -% If in a .fmt file, print the version number -% and turn on active characters that we couldn't do earlier because -% they might have appeared in the input file name. -\everyjob{\message{[Texinfo version \texinfoversion]}% - \catcode`+=\active \catcode`\_=\active} - -% Save some parts of plain tex whose names we will redefine. -\let\ptexb=\b -\let\ptexbullet=\bullet -\let\ptexc=\c -\let\ptexcomma=\, -\let\ptexdot=\. -\let\ptexdots=\dots -\let\ptexend=\end -\let\ptexequiv=\equiv -\let\ptexexclam=\! -\let\ptexi=\i -\let\ptexlbrace=\{ -\let\ptexrbrace=\} -\let\ptexstar=\* -\let\ptext=\t - -% We never want plain's outer \+ definition in Texinfo. -% For @tex, we can use \tabalign. -\let\+ = \relax - -\message{Basics,} -\chardef\other=12 - -% If this character appears in an error message or help string, it -% starts a new line in the output. -\newlinechar = `^^J - -% Set up fixed words for English if not already set. -\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi -\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi -\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi -\ifx\putwordin\undefined \gdef\putwordin{in}\fi -\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi -\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi -\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi -\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi -\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi -\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi -\ifx\putwordof\undefined \gdef\putwordof{of}\fi -\ifx\putwordon\undefined \gdef\putwordon{on}\fi -\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi -\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi -\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi -\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi -\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi -\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi -\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi -% -\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi -\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi -\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi -\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi -\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi -\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi -\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi -\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi -\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi -\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi -\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi -\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi -% -\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi -\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi -\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi -\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi -\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi -\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi -\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi - -% Ignore a token. -% -\def\gobble#1{} - -\hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} -\hyphenation{eshell} -\hyphenation{white-space} - -% Margin to add to right of even pages, to left of odd pages. -\newdimen \bindingoffset -\newdimen \normaloffset -\newdimen\pagewidth \newdimen\pageheight - -% Sometimes it is convenient to have everything in the transcript file -% and nothing on the terminal. We don't just call \tracingall here, -% since that produces some useless output on the terminal. -% -\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% -\ifx\eTeXversion\undefined -\def\loggingall{\tracingcommands2 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\else -\def\loggingall{\tracingcommands3 \tracingstats2 - \tracingpages1 \tracingoutput1 \tracinglostchars1 - \tracingmacros2 \tracingparagraphs1 \tracingrestores1 - \tracingscantokens1 \tracingassigns1 \tracingifs1 - \tracinggroups1 \tracingnesting2 - \showboxbreadth\maxdimen\showboxdepth\maxdimen -}% -\fi - -% For @cropmarks command. -% Do @cropmarks to get crop marks. -% -\newif\ifcropmarks -\let\cropmarks = \cropmarkstrue -% -% Dimensions to add cropmarks at corners. -% Added by P. A. MacKay, 12 Nov. 1986 -% -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\cornerlong \cornerlong=1pc -\newdimen\cornerthick \cornerthick=.3pt -\newdimen\topandbottommargin \topandbottommargin=.75in - -% Main output routine. -\chardef\PAGE = 255 -\output = {\onepageout{\pagecontents\PAGE}} - -\newbox\headlinebox -\newbox\footlinebox - -% \onepageout takes a vbox as an argument. Note that \pagecontents -% does insertions, but you have to call it yourself. -\def\onepageout#1{% - \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi - % - \ifodd\pageno \advance\hoffset by \bindingoffset - \else \advance\hoffset by -\bindingoffset\fi - % - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). - \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% - \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% - % - {% - % Have to do this stuff outside the \shipout because we want it to - % take effect in \write's, yet the group defined by the \vbox ends - % before the \shipout runs. - % - \escapechar = `\\ % use backslash in output files. - \indexdummies % don't expand commands in the output. - \normalturnoffactive % \ in index entries must not stay \, e.g., if - % the page break happens to be in the middle of an example. - \shipout\vbox{% - % Do this early so pdf references go to the beginning of the page. - \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi - % - \ifcropmarks \vbox to \outervsize\bgroup - \hsize = \outerhsize - \vskip-\topandbottommargin - \vtop to0pt{% - \line{\ewtop\hfil\ewtop}% - \nointerlineskip - \line{% - \vbox{\moveleft\cornerthick\nstop}% - \hfill - \vbox{\moveright\cornerthick\nstop}% - }% - \vss}% - \vskip\topandbottommargin - \line\bgroup - \hfil % center the page within the outer (page) hsize. - \ifodd\pageno\hskip\bindingoffset\fi - \vbox\bgroup - \fi - % - \unvbox\headlinebox - \pagebody{#1}% - \ifdim\ht\footlinebox > 0pt - % Only leave this space if the footline is nonempty. - % (We lessened \vsize for it in \oddfootingxxx.) - % The \baselineskip=24pt in plain's \makefootline has no effect. - \vskip 2\baselineskip - \unvbox\footlinebox - \fi - % - \ifcropmarks - \egroup % end of \vbox\bgroup - \hfil\egroup % end of (centering) \line\bgroup - \vskip\topandbottommargin plus1fill minus1fill - \boxmaxdepth = \cornerthick - \vbox to0pt{\vss - \line{% - \vbox{\moveleft\cornerthick\nsbot}% - \hfill - \vbox{\moveright\cornerthick\nsbot}% - }% - \nointerlineskip - \line{\ewbot\hfil\ewbot}% - }% - \egroup % \vbox from first cropmarks clause - \fi - }% end of \shipout\vbox - }% end of group with \turnoffactive - \advancepageno - \ifnum\outputpenalty>-20000 \else\dosupereject\fi -} - -\newinsert\margin \dimen\margin=\maxdimen - -\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} -{\catcode`\@ =11 -\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi -% marginal hacks, juha@viisa.uucp (Juha Takala) -\ifvoid\margin\else % marginal info is present - \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi -\dimen@=\dp#1 \unvbox#1 -\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi -\ifr@ggedbottom \kern-\dimen@ \vfil \fi} -} - -% Here are the rules for the cropmarks. Note that they are -% offset so that the space between them is truly \outerhsize or \outervsize -% (P. A. MacKay, 12 November, 1986) -% -\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} -\def\nstop{\vbox - {\hrule height\cornerthick depth\cornerlong width\cornerthick}} -\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} -\def\nsbot{\vbox - {\hrule height\cornerlong depth\cornerthick width\cornerthick}} - -% Parse an argument, then pass it to #1. The argument is the rest of -% the input line (except we remove a trailing comment). #1 should be a -% macro which expects an ordinary undelimited TeX argument. -% -\def\parsearg#1{% - \let\next = #1% - \begingroup - \obeylines - \futurelet\temp\parseargx -} - -% If the next token is an obeyed space (from an @example environment or -% the like), remove it and recurse. Otherwise, we're done. -\def\parseargx{% - % \obeyedspace is defined far below, after the definition of \sepspaces. - \ifx\obeyedspace\temp - \expandafter\parseargdiscardspace - \else - \expandafter\parseargline - \fi -} - -% Remove a single space (as the delimiter token to the macro call). -{\obeyspaces % - \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} - -{\obeylines % - \gdef\parseargline#1^^M{% - \endgroup % End of the group started in \parsearg. - % - % First remove any @c comment, then any @comment. - % Result of each macro is put in \toks0. - \argremovec #1\c\relax % - \expandafter\argremovecomment \the\toks0 \comment\relax % - % - % Call the caller's macro, saved as \next in \parsearg. - \expandafter\next\expandafter{\the\toks0}% - }% -} - -% Since all \c{,omment} does is throw away the argument, we can let TeX -% do that for us. The \relax here is matched by the \relax in the call -% in \parseargline; it could be more or less anything, its purpose is -% just to delimit the argument to the \c. -\def\argremovec#1\c#2\relax{\toks0 = {#1}} -\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} - -% \argremovec{,omment} might leave us with trailing spaces, though; e.g., -% @end itemize @c foo -% will have two active spaces as part of the argument with the -% `itemize'. Here we remove all active spaces from #1, and assign the -% result to \toks0. -% -% This loses if there are any *other* active characters besides spaces -% in the argument -- _ ^ +, for example -- since they get expanded. -% Fortunately, Texinfo does not define any such commands. (If it ever -% does, the catcode of the characters in questionwill have to be changed -% here.) But this means we cannot call \removeactivespaces as part of -% \argremovec{,omment}, since @c uses \parsearg, and thus the argument -% that \parsearg gets might well have any character at all in it. -% -\def\removeactivespaces#1{% - \begingroup - \ignoreactivespaces - \edef\temp{#1}% - \global\toks0 = \expandafter{\temp}% - \endgroup -} - -% Change the active space to expand to nothing. -% -\begingroup - \obeyspaces - \gdef\ignoreactivespaces{\obeyspaces\let =\empty} -\endgroup - - -\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} - -%% These are used to keep @begin/@end levels from running away -%% Call \inENV within environments (after a \begingroup) -\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} -\def\ENVcheck{% -\ifENV\errmessage{Still within an environment; press RETURN to continue} -\endgroup\fi} % This is not perfect, but it should reduce lossage - -% @begin foo is the same as @foo, for now. -\newhelp\EMsimple{Press RETURN to continue.} - -\outer\def\begin{\parsearg\beginxxx} - -\def\beginxxx #1{% -\expandafter\ifx\csname #1\endcsname\relax -{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else -\csname #1\endcsname\fi} - -% @end foo executes the definition of \Efoo. -% -\def\end{\parsearg\endxxx} -\def\endxxx #1{% - \removeactivespaces{#1}% - \edef\endthing{\the\toks0}% - % - \expandafter\ifx\csname E\endthing\endcsname\relax - \expandafter\ifx\csname \endthing\endcsname\relax - % There's no \foo, i.e., no ``environment'' foo. - \errhelp = \EMsimple - \errmessage{Undefined command `@end \endthing'}% - \else - \unmatchedenderror\endthing - \fi - \else - % Everything's ok; the right environment has been started. - \csname E\endthing\endcsname - \fi -} - -% There is an environment #1, but it hasn't been started. Give an error. -% -\def\unmatchedenderror#1{% - \errhelp = \EMsimple - \errmessage{This `@end #1' doesn't have a matching `@#1'}% -} - -% Define the control sequence \E#1 to give an unmatched @end error. -% -\def\defineunmatchedend#1{% - \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% -} - - -% Single-spacing is done by various environments (specifically, in -% \nonfillstart and \quotations). -\newskip\singlespaceskip \singlespaceskip = 12.5pt -\def\singlespace{% - % Why was this kern here? It messes up equalizing space above and below - % environments. --karl, 6may93 - %{\advance \baselineskip by -\singlespaceskip - %\kern \baselineskip}% - \setleading \singlespaceskip -} - -%% Simple single-character @ commands - -% @@ prints an @ -% Kludge this until the fonts are right (grr). -\def\@{{\tt\char64}} - -% This is turned off because it was never documented -% and you can use @w{...} around a quote to suppress ligatures. -%% Define @` and @' to be the same as ` and ' -%% but suppressing ligatures. -%\def\`{{`}} -%\def\'{{'}} - -% Used to generate quoted braces. -\def\mylbrace {{\tt\char123}} -\def\myrbrace {{\tt\char125}} -\let\{=\mylbrace -\let\}=\myrbrace -\begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 - \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup - -% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. -\let\, = \c -\let\dotaccent = \. -\def\ringaccent#1{{\accent23 #1}} -\let\tieaccent = \t -\let\ubaraccent = \b -\let\udotaccent = \d - -% Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. -\def\questiondown{?`} -\def\exclamdown{!`} - -% Dotless i and dotless j, used for accents. -\def\imacro{i} -\def\jmacro{j} -\def\dotless#1{% - \def\temp{#1}% - \ifx\temp\imacro \ptexi - \else\ifx\temp\jmacro \j - \else \errmessage{@dotless can be used only with i or j}% - \fi\fi -} - -% Be sure we're in horizontal mode when doing a tie, since we make space -% equivalent to this in @example-like environments. Otherwise, a space -% at the beginning of a line will start with \penalty -- and -% since \penalty is valid in vertical mode, we'd end up putting the -% penalty on the vertical list instead of in the new paragraph. -{\catcode`@ = 11 - % Avoid using \@M directly, because that causes trouble - % if the definition is written into an index file. - \global\let\tiepenalty = \@M - \gdef\tie{\leavevmode\penalty\tiepenalty\ } -} - -% @: forces normal size whitespace following. -\def\:{\spacefactor=1000 } - -% @* forces a line break. -\def\*{\hfil\break\hbox{}\ignorespaces} - -% @. is an end-of-sentence period. -\def\.{.\spacefactor=3000 } - -% @! is an end-of-sentence bang. -\def\!{!\spacefactor=3000 } - -% @? is an end-of-sentence query. -\def\?{?\spacefactor=3000 } - -% @w prevents a word break. Without the \leavevmode, @w at the -% beginning of a paragraph, when TeX is still in vertical mode, would -% produce a whole line of output instead of starting the paragraph. -\def\w#1{\leavevmode\hbox{#1}} - -% @group ... @end group forces ... to be all on one page, by enclosing -% it in a TeX vbox. We use \vtop instead of \vbox to construct the box -% to keep its height that of a normal line. According to the rules for -% \topskip (p.114 of the TeXbook), the glue inserted is -% max (\topskip - \ht (first item), 0). If that height is large, -% therefore, no glue is inserted, and the space between the headline and -% the text is small, which looks bad. -% -\def\group{\begingroup - \ifnum\catcode13=\active \else - \errhelp = \groupinvalidhelp - \errmessage{@group invalid in context where filling is enabled}% - \fi - % - % The \vtop we start below produces a box with normal height and large - % depth; thus, TeX puts \baselineskip glue before it, and (when the - % next line of text is done) \lineskip glue after it. (See p.82 of - % the TeXbook.) Thus, space below is not quite equal to space - % above. But it's pretty close. - \def\Egroup{% - \egroup % End the \vtop. - \endgroup % End the \group. - }% - % - \vtop\bgroup - % We have to put a strut on the last line in case the @group is in - % the midst of an example, rather than completely enclosing it. - % Otherwise, the interline space between the last line of the group - % and the first line afterwards is too small. But we can't put the - % strut in \Egroup, since there it would be on a line by itself. - % Hence this just inserts a strut at the beginning of each line. - \everypar = {\strut}% - % - % Since we have a strut on every line, we don't need any of TeX's - % normal interline spacing. - \offinterlineskip - % - % OK, but now we have to do something about blank - % lines in the input in @example-like environments, which normally - % just turn into \lisppar, which will insert no space now that we've - % turned off the interline space. Simplest is to make them be an - % empty paragraph. - \ifx\par\lisppar - \edef\par{\leavevmode \par}% - % - % Reset ^^M's definition to new definition of \par. - \obeylines - \fi - % - % Do @comment since we are called inside an environment such as - % @example, where each end-of-line in the input causes an - % end-of-line in the output. We don't want the end-of-line after - % the `@group' to put extra space in the output. Since @group - % should appear on a line by itself (according to the Texinfo - % manual), we don't worry about eating any user text. - \comment -} -% -% TeX puts in an \escapechar (i.e., `@') at the beginning of the help -% message, so this ends up printing `@group can only ...'. -% -\newhelp\groupinvalidhelp{% -group can only be used in environments such as @example,^^J% -where each line of input produces a line of output.} - -% @need space-in-mils -% forces a page break if there is not space-in-mils remaining. - -\newdimen\mil \mil=0.001in - -\def\need{\parsearg\needx} - -% Old definition--didn't work. -%\def\needx #1{\par % -%% This method tries to make TeX break the page naturally -%% if the depth of the box does not fit. -%{\baselineskip=0pt% -%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak -%\prevdepth=-1000pt -%}} - -\def\needx#1{% - % Ensure vertical mode, so we don't make a big box in the middle of a - % paragraph. - \par - % - % If the @need value is less than one line space, it's useless. - \dimen0 = #1\mil - \dimen2 = \ht\strutbox - \advance\dimen2 by \dp\strutbox - \ifdim\dimen0 > \dimen2 - % - % Do a \strut just to make the height of this box be normal, so the - % normal leading is inserted relative to the preceding line. - % And a page break here is fine. - \vtop to #1\mil{\strut\vfil}% - % - % TeX does not even consider page breaks if a penalty added to the - % main vertical list is 10000 or more. But in order to see if the - % empty box we just added fits on the page, we must make it consider - % page breaks. On the other hand, we don't want to actually break the - % page after the empty box. So we use a penalty of 9999. - % - % There is an extremely small chance that TeX will actually break the - % page at this \penalty, if there are no other feasible breakpoints in - % sight. (If the user is using lots of big @group commands, which - % almost-but-not-quite fill up a page, TeX will have a hard time doing - % good page breaking, for example.) However, I could not construct an - % example where a page broke at this \penalty; if it happens in a real - % document, then we can reconsider our strategy. - \penalty9999 - % - % Back up by the size of the box, whether we did a page break or not. - \kern -#1\mil - % - % Do not allow a page break right after this kern. - \nobreak - \fi -} - -% @br forces paragraph break - -\let\br = \par - -% @dots{} output an ellipsis using the current font. -% We do .5em per period so that it has the same spacing in a typewriter -% font as three actual period characters. -% -\def\dots{% - \leavevmode - \hbox to 1.5em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% -} - -% @enddots{} is an end-of-sentence ellipsis. -% -\def\enddots{% - \leavevmode - \hbox to 2em{% - \hskip 0pt plus 0.25fil minus 0.25fil - .\hss.\hss.\hss.% - \hskip 0pt plus 0.5fil minus 0.5fil - }% - \spacefactor=3000 -} - - -% @page forces the start of a new page -% -\def\page{\par\vfill\supereject} - -% @exdent text.... -% outputs text on separate line in roman font, starting at standard page margin - -% This records the amount of indent in the innermost environment. -% That's how much \exdent should take out. -\newskip\exdentamount - -% This defn is used inside fill environments such as @defun. -\def\exdent{\parsearg\exdentyyy} -\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} - -% This defn is used inside nofill environments such as @example. -\def\nofillexdent{\parsearg\nofillexdentyyy} -\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount -\leftline{\hskip\leftskip{\rm#1}}}} - -% @inmargin{TEXT} puts TEXT in the margin next to the current paragraph. - -\def\inmargin#1{% -\strut\vadjust{\nobreak\kern-\strutdepth - \vtop to \strutdepth{\baselineskip\strutdepth\vss - \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} -\newskip\inmarginspacing \inmarginspacing=1cm -\def\strutdepth{\dp\strutbox} - -%\hbox{{\rm#1}}\hfil\break}} - -% @include file insert text of that file as input. -% Allow normal characters that we make active in the argument (a file name). -\def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 - \parsearg\includezzz} -% Restore active chars for included file. -\def\includezzz#1{\endgroup\begingroup - % Read the included file in a group so nested @include's work. - \def\thisfile{#1}% - \input\thisfile -\endgroup} - -\def\thisfile{} - -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} - -% @sp n outputs n lines of vertical space - -\def\sp{\parsearg\spxxx} -\def\spxxx #1{\vskip #1\baselineskip} - -% @comment ...line which is ignored... -% @c is the same as @comment -% @ignore ... @end ignore is another way to write a comment - -\def\comment{\begingroup \catcode`\^^M=\other% -\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% -\commentxxx} -{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} - -\let\c=\comment - -% @paragraphindent NCHARS -% We'll use ems for NCHARS, close enough. -% We cannot implement @paragraphindent asis, though. -% -\def\asisword{asis} % no translation, these are keywords -\def\noneword{none} -% -\def\paragraphindent{\parsearg\doparagraphindent} -\def\doparagraphindent#1{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \defaultparindent = 0pt - \else - \defaultparindent = #1em - \fi - \fi - \parindent = \defaultparindent -} - -% @exampleindent NCHARS -% We'll use ems for NCHARS like @paragraphindent. -% It seems @exampleindent asis isn't necessary, but -% I preserve it to make it similar to @paragraphindent. -\def\exampleindent{\parsearg\doexampleindent} -\def\doexampleindent#1{% - \def\temp{#1}% - \ifx\temp\asisword - \else - \ifx\temp\noneword - \lispnarrowing = 0pt - \else - \lispnarrowing = #1em - \fi - \fi -} - -% @asis just yields its argument. Used with @table, for example. -% -\def\asis#1{#1} - -% @math means output in math mode. -% We don't use $'s directly in the definition of \math because control -% sequences like \math are expanded when the toc file is written. Then, -% we read the toc file back, the $'s will be normal characters (as they -% should be, according to the definition of Texinfo). So we must use a -% control sequence to switch into and out of math mode. -% -% This isn't quite enough for @math to work properly in indices, but it -% seems unlikely it will ever be needed there. -% -\let\implicitmath = $ -\def\math#1{\implicitmath #1\implicitmath} - -% @bullet and @minus need the same treatment as @math, just above. -\def\bullet{\implicitmath\ptexbullet\implicitmath} -\def\minus{\implicitmath-\implicitmath} - -% @refill is a no-op. -\let\refill=\relax - -% If working on a large document in chapters, it is convenient to -% be able to disable indexing, cross-referencing, and contents, for test runs. -% This is done with @novalidate (before @setfilename). -% -\newif\iflinks \linkstrue % by default we want the aux files. -\let\novalidate = \linksfalse - -% @setfilename is done at the beginning of every texinfo file. -% So open here the files we need to have open while reading the input. -% This makes it possible to make a .fmt file for texinfo. -\def\setfilename{% - \iflinks - \readauxfile - \fi % \openindices needs to do some work in any case. - \openindices - \fixbackslash % Turn off hack to swallow `\input texinfo'. - \global\let\setfilename=\comment % Ignore extra @setfilename cmds. - % - % If texinfo.cnf is present on the system, read it. - % Useful for site-wide @afourpaper, etc. - % Just to be on the safe side, close the input stream before the \input. - \openin 1 texinfo.cnf - \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi - \closein1 - \temp - % - \comment % Ignore the actual filename. -} - -% Called from \setfilename. -% -\def\openindices{% - \newindex{cp}% - \newcodeindex{fn}% - \newcodeindex{vr}% - \newcodeindex{tp}% - \newcodeindex{ky}% - \newcodeindex{pg}% -} - -% @bye. -\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} - - -\message{pdf,} -% adobe `portable' document format -\newcount\tempnum -\newcount\lnkcount -\newtoks\filename -\newcount\filenamelength -\newcount\pgn -\newtoks\toksA -\newtoks\toksB -\newtoks\toksC -\newtoks\toksD -\newbox\boxA -\newcount\countA -\newif\ifpdf -\newif\ifpdfmakepagedest - -\ifx\pdfoutput\undefined - \pdffalse - \let\pdfmkdest = \gobble - \let\pdfurl = \gobble - \let\endlink = \relax - \let\linkcolor = \relax - \let\pdfmakeoutlines = \relax -\else - \pdftrue - \pdfoutput = 1 - \input pdfcolor - \def\dopdfimage#1#2#3{% - \def\imagewidth{#2}% - \def\imageheight{#3}% - \ifnum\pdftexversion < 14 - \pdfimage - \else - \pdfximage - \fi - \ifx\empty\imagewidth\else width \imagewidth \fi - \ifx\empty\imageheight\else height \imageheight \fi - {#1.pdf}% - \ifnum\pdftexversion < 14 \else - \pdfrefximage \pdflastximage - \fi} - \def\pdfmkdest#1{\pdfdest name{#1@} xyz} - \def\pdfmkpgn#1{#1@} - \let\linkcolor = \Blue % was Cyan, but that seems light? - \def\endlink{\Black\pdfendlink} - % Adding outlines to PDF; macros for calculating structure of outlines - % come from Petr Olsak - \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% - \else \csname#1\endcsname \fi} - \def\advancenumber#1{\tempnum=\expnumber{#1}\relax - \advance\tempnum by1 - \expandafter\xdef\csname#1\endcsname{\the\tempnum}} - \def\pdfmakeoutlines{{% - \openin 1 \jobname.toc - \ifeof 1\else\bgroup - \closein 1 - \indexnofonts - \def\tt{} - \let\_ = \normalunderscore - % Thanh's hack / proper braces in bookmarks - \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace - \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace - % - \def\chapentry ##1##2##3{} - \def\unnumbchapentry ##1##2{} - \def\secentry ##1##2##3##4{\advancenumber{chap##2}} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} - \def\unnumbsubsubsecentry ##1##2{} - \input \jobname.toc - \def\chapentry ##1##2##3{% - \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} - \def\unnumbchapentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\secentry ##1##2##3##4{% - \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} - \def\unnumbsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsecentry ##1##2##3##4##5{% - \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} - \def\unnumbsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \def\subsubsecentry ##1##2##3##4##5##6{% - \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} - \def\unnumbsubsubsecentry ##1##2{% - \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} - \input \jobname.toc - \egroup\fi - }} - \def\makelinks #1,{% - \def\params{#1}\def\E{END}% - \ifx\params\E - \let\nextmakelinks=\relax - \else - \let\nextmakelinks=\makelinks - \ifnum\lnkcount>0,\fi - \picknum{#1}% - \startlink attr{/Border [0 0 0]} - goto name{\pdfmkpgn{\the\pgn}}% - \linkcolor #1% - \advance\lnkcount by 1% - \endlink - \fi - \nextmakelinks - } - \def\picknum#1{\expandafter\pn#1} - \def\pn#1{% - \def\p{#1}% - \ifx\p\lbrace - \let\nextpn=\ppn - \else - \let\nextpn=\ppnn - \def\first{#1} - \fi - \nextpn - } - \def\ppn#1{\pgn=#1\gobble} - \def\ppnn{\pgn=\first} - \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\skipspaces#1{\def\PP{#1}\def\D{|}% - \ifx\PP\D\let\nextsp\relax - \else\let\nextsp\skipspaces - \ifx\p\space\else\addtokens{\filename}{\PP}% - \advance\filenamelength by 1 - \fi - \fi - \nextsp} - \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} - \ifnum\pdftexversion < 14 - \let \startlink \pdfannotlink - \else - \let \startlink \pdfstartlink - \fi - \def\pdfurl#1{% - \begingroup - \normalturnoffactive\def\@{@}% - \leavevmode\Red - \startlink attr{/Border [0 0 0]}% - user{/Subtype /Link /A << /S /URI /URI (#1) >>}% - % #1 - \endgroup} - \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} - \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} - \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} - \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} - \def\maketoks{% - \expandafter\poptoks\the\toksA|ENDTOKS| - \ifx\first0\adn0 - \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 - \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 - \else - \ifnum0=\countA\else\makelink\fi - \ifx\first.\let\next=\done\else - \let\next=\maketoks - \addtokens{\toksB}{\the\toksD} - \ifx\first,\addtokens{\toksB}{\space}\fi - \fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \next} - \def\makelink{\addtokens{\toksB}% - {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} - \def\pdflink#1{% - \startlink attr{/Border [0 0 0]} goto name{\mkpgn{#1}} - \linkcolor #1\endlink} - \def\mkpgn#1{#1@} - \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % \ifx\pdfoutput - - -\message{fonts,} -% Font-change commands. - -% Texinfo sort of supports the sans serif font style, which plain TeX does not. -% So we set up a \sf analogous to plain's \rm, etc. -\newfam\sffam -\def\sf{\fam=\sffam \tensf} -\let\li = \sf % Sometimes we call it \li, not \sf. - -% We don't need math for this one. -\def\ttsl{\tenttsl} - -% Use Computer Modern fonts at \magstephalf (11pt). -\newcount\mainmagstep -\mainmagstep=\magstephalf - -% Set the font macro #1 to the font named #2, adding on the -% specified font prefix (normally `cm'). -% #3 is the font's design size, #4 is a scale factor -\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} - -% Use cm as the default font prefix. -% To specify the font prefix, you must define \fontprefix -% before you read in texinfo.tex. -\ifx\fontprefix\undefined -\def\fontprefix{cm} -\fi -% Support font families that don't use the same naming scheme as CM. -\def\rmshape{r} -\def\rmbshape{bx} %where the normal face is bold -\def\bfshape{b} -\def\bxshape{bx} -\def\ttshape{tt} -\def\ttbshape{tt} -\def\ttslshape{sltt} -\def\itshape{ti} -\def\itbshape{bxti} -\def\slshape{sl} -\def\slbshape{bxsl} -\def\sfshape{ss} -\def\sfbshape{ss} -\def\scshape{csc} -\def\scbshape{csc} - -\ifx\bigger\relax -\let\mainmagstep=\magstep1 -\setfont\textrm\rmshape{12}{1000} -\setfont\texttt\ttshape{12}{1000} -\else -\setfont\textrm\rmshape{10}{\mainmagstep} -\setfont\texttt\ttshape{10}{\mainmagstep} -\fi -% Instead of cmb10, you many want to use cmbx10. -% cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. -\setfont\textbf\bfshape{10}{\mainmagstep} -\setfont\textit\itshape{10}{\mainmagstep} -\setfont\textsl\slshape{10}{\mainmagstep} -\setfont\textsf\sfshape{10}{\mainmagstep} -\setfont\textsc\scshape{10}{\mainmagstep} -\setfont\textttsl\ttslshape{10}{\mainmagstep} -\font\texti=cmmi10 scaled \mainmagstep -\font\textsy=cmsy10 scaled \mainmagstep - -% A few fonts for @defun, etc. -\setfont\defbf\bxshape{10}{\magstep1} %was 1314 -\setfont\deftt\ttshape{10}{\magstep1} -\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} - -% Fonts for indices, footnotes, small examples (9pt). -\setfont\smallrm\rmshape{9}{1000} -\setfont\smalltt\ttshape{9}{1000} -\setfont\smallbf\bfshape{10}{900} -\setfont\smallit\itshape{9}{1000} -\setfont\smallsl\slshape{9}{1000} -\setfont\smallsf\sfshape{9}{1000} -\setfont\smallsc\scshape{10}{900} -\setfont\smallttsl\ttslshape{10}{900} -\font\smalli=cmmi9 -\font\smallsy=cmsy9 - -% Fonts for title page: -\setfont\titlerm\rmbshape{12}{\magstep3} -\setfont\titleit\itbshape{10}{\magstep4} -\setfont\titlesl\slbshape{10}{\magstep4} -\setfont\titlett\ttbshape{12}{\magstep3} -\setfont\titlettsl\ttslshape{10}{\magstep4} -\setfont\titlesf\sfbshape{17}{\magstep1} -\let\titlebf=\titlerm -\setfont\titlesc\scbshape{10}{\magstep4} -\font\titlei=cmmi12 scaled \magstep3 -\font\titlesy=cmsy10 scaled \magstep4 -\def\authorrm{\secrm} - -% Chapter (and unnumbered) fonts (17.28pt). -\setfont\chaprm\rmbshape{12}{\magstep2} -\setfont\chapit\itbshape{10}{\magstep3} -\setfont\chapsl\slbshape{10}{\magstep3} -\setfont\chaptt\ttbshape{12}{\magstep2} -\setfont\chapttsl\ttslshape{10}{\magstep3} -\setfont\chapsf\sfbshape{17}{1000} -\let\chapbf=\chaprm -\setfont\chapsc\scbshape{10}{\magstep3} -\font\chapi=cmmi12 scaled \magstep2 -\font\chapsy=cmsy10 scaled \magstep3 - -% Section fonts (14.4pt). -\setfont\secrm\rmbshape{12}{\magstep1} -\setfont\secit\itbshape{10}{\magstep2} -\setfont\secsl\slbshape{10}{\magstep2} -\setfont\sectt\ttbshape{12}{\magstep1} -\setfont\secttsl\ttslshape{10}{\magstep2} -\setfont\secsf\sfbshape{12}{\magstep1} -\let\secbf\secrm -\setfont\secsc\scbshape{10}{\magstep2} -\font\seci=cmmi12 scaled \magstep1 -\font\secsy=cmsy10 scaled \magstep2 - -% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. -% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. -% \setfont\ssecsl\slshape{10}{\magstep1} -% \setfont\ssectt\ttshape{10}{\magstep1} -% \setfont\ssecsf\sfshape{10}{\magstep1} - -%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. -%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than -%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. -%\setfont\ssectt\ttshape{10}{1315} -%\setfont\ssecsf\sfshape{10}{1315} - -%\let\ssecbf=\ssecrm - -% Subsection fonts (13.15pt). -\setfont\ssecrm\rmbshape{12}{\magstephalf} -\setfont\ssecit\itbshape{10}{1315} -\setfont\ssecsl\slbshape{10}{1315} -\setfont\ssectt\ttbshape{12}{\magstephalf} -\setfont\ssecttsl\ttslshape{10}{1315} -\setfont\ssecsf\sfbshape{12}{\magstephalf} -\let\ssecbf\ssecrm -\setfont\ssecsc\scbshape{10}{\magstep1} -\font\sseci=cmmi12 scaled \magstephalf -\font\ssecsy=cmsy10 scaled 1315 -% The smallcaps and symbol fonts should actually be scaled \magstep1.5, -% but that is not a standard magnification. - -% In order for the font changes to affect most math symbols and letters, -% we have to define the \textfont of the standard families. Since -% texinfo doesn't allow for producing subscripts and superscripts, we -% don't bother to reset \scriptfont and \scriptscriptfont (which would -% also require loading a lot more fonts). -% -\def\resetmathfonts{% - \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy - \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf - \textfont\ttfam = \tentt \textfont\sffam = \tensf -} - - -% The font-changing commands redefine the meanings of \tenSTYLE, instead -% of just \STYLE. We do this so that font changes will continue to work -% in math mode, where it is the current \fam that is relevant in most -% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam -% \tenbf}, for example. By redefining \tenbf, we obviate the need to -% redefine \bf itself. -\def\textfonts{% - \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl - \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc - \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl - \resetmathfonts} -\def\titlefonts{% - \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl - \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc - \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy - \let\tenttsl=\titlettsl - \resetmathfonts \setleading{25pt}} -\def\titlefont#1{{\titlefonts\rm #1}} -\def\chapfonts{% - \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl - \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc - \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl - \resetmathfonts \setleading{19pt}} -\def\secfonts{% - \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl - \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc - \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl - \resetmathfonts \setleading{16pt}} -\def\subsecfonts{% - \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl - \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc - \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl - \resetmathfonts \setleading{15pt}} -\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? -\def\smallfonts{% - \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl - \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc - \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy - \let\tenttsl=\smallttsl - \resetmathfonts \setleading{11pt}} - -% Set up the default fonts, so we can use them for creating boxes. -% -\textfonts - -% Define these so they can be easily changed for other fonts. -\def\angleleft{$\langle$} -\def\angleright{$\rangle$} - -% Count depth in font-changes, for error checks -\newcount\fontdepth \fontdepth=0 - -% Fonts for short table of contents. -\setfont\shortcontrm\rmshape{12}{1000} -\setfont\shortcontbf\bxshape{12}{1000} -\setfont\shortcontsl\slshape{12}{1000} - -%% Add scribe-like font environments, plus @l for inline lisp (usually sans -%% serif) and @ii for TeX italic - -% \smartitalic{ARG} outputs arg in italics, followed by an italic correction -% unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} -\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} -\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} - -\let\i=\smartitalic -\let\var=\smartslanted -\let\dfn=\smartslanted -\let\emph=\smartitalic -\let\cite=\smartslanted - -\def\b#1{{\bf #1}} -\let\strong=\b - -% We can't just use \exhyphenpenalty, because that only has effect at -% the end of a paragraph. Restore normal hyphenation at the end of the -% group within which \nohyphenation is presumably called. -% -\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} -\def\restorehyphenation{\hyphenchar\font = `- } - -\def\t#1{% - {\tt \rawbackslash \frenchspacing #1}% - \null -} -\let\ttfont=\t -\def\samp#1{`\tclose{#1}'\null} -\setfont\keyrm\rmshape{8}{1000} -\font\keysy=cmsy9 -\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% - \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% - \vbox{\hrule\kern-0.4pt - \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% - \kern-0.4pt\hrule}% - \kern-.06em\raise0.4pt\hbox{\angleright}}}} -% The old definition, with no lozenge: -%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} -\def\ctrl #1{{\tt \rawbackslash \hat}#1} - -% @file, @option are the same as @samp. -\let\file=\samp -\let\option=\samp - -% @code is a modification of @t, -% which makes spaces the same size as normal in the surrounding text. -\def\tclose#1{% - {% - % Change normal interword space to be same as for the current font. - \spaceskip = \fontdimen2\font - % - % Switch to typewriter. - \tt - % - % But `\ ' produces the large typewriter interword space. - \def\ {{\spaceskip = 0pt{} }}% - % - % Turn off hyphenation. - \nohyphenation - % - \rawbackslash - \frenchspacing - #1% - }% - \null -} - -% We *must* turn on hyphenation at `-' and `_' in \code. -% Otherwise, it is too hard to avoid overfull hboxes -% in the Emacs manual, the Library manual, etc. - -% Unfortunately, TeX uses one parameter (\hyphenchar) to control -% both hyphenation at - and hyphenation within words. -% We must therefore turn them both off (\tclose does that) -% and arrange explicitly to hyphenate at a dash. -% -- rms. -{ - \catcode`\-=\active - \catcode`\_=\active - % - \global\def\code{\begingroup - \catcode`\-=\active \let-\codedash - \catcode`\_=\active \let_\codeunder - \codex - } - % - % If we end up with any active - characters when handling the index, - % just treat them as a normal -. - \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} -} - -\def\realdash{-} -\def\codedash{-\discretionary{}{}{}} -\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} -\def\codex #1{\tclose{#1}\endgroup} - -%\let\exp=\tclose %Was temporary - -% @kbd is like @code, except that if the argument is just one @key command, -% then @kbd has no effect. - -% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), -% `example' (@kbd uses ttsl only inside of @example and friends), -% or `code' (@kbd uses normal tty font always). -\def\kbdinputstyle{\parsearg\kbdinputstylexxx} -\def\kbdinputstylexxx#1{% - \def\arg{#1}% - \ifx\arg\worddistinct - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% - \else\ifx\arg\wordexample - \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% - \else\ifx\arg\wordcode - \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% - \fi\fi\fi -} -\def\worddistinct{distinct} -\def\wordexample{example} -\def\wordcode{code} - -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} - -\def\xkey{\key} -\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% -\ifx\one\xkey\ifx\threex\three \key{#2}% -\else{\tclose{\kbdfont\look}}\fi -\else{\tclose{\kbdfont\look}}\fi} - -% For @url, @env, @command quotes seem unnecessary, so use \code. -\let\url=\code -\let\env=\code -\let\command=\code - -% @uref (abbreviation for `urlref') takes an optional (comma-separated) -% second argument specifying the text to display and an optional third -% arg as text to display instead of (rather than in addition to) the url -% itself. First (mandatory) arg is the url. Perhaps eventually put in -% a hypertex \special here. -% -\def\uref#1{\douref #1,,,\finish} -\def\douref#1,#2,#3,#4\finish{\begingroup - \unsepspaces - \pdfurl{#1}% - \setbox0 = \hbox{\ignorespaces #3}% - \ifdim\wd0 > 0pt - \unhbox0 % third arg given, show only that - \else - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0 > 0pt - \ifpdf - \unhbox0 % PDF: 2nd arg given, show only it - \else - \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url - \fi - \else - \code{#1}% only url given, so show it - \fi - \fi - \endlink -\endgroup} - -% rms does not like angle brackets --karl, 17may97. -% So now @email is just like @uref, unless we are pdf. -% -%\def\email#1{\angleleft{\tt #1}\angleright} -\ifpdf - \def\email#1{\doemail#1,,\finish} - \def\doemail#1,#2,#3\finish{\begingroup - \unsepspaces - \pdfurl{mailto:#1}% - \setbox0 = \hbox{\ignorespaces #2}% - \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi - \endlink - \endgroup} -\else - \let\email=\uref -\fi - -% Check if we are currently using a typewriter font. Since all the -% Computer Modern typewriter fonts have zero interword stretch (and -% shrink), and it is reasonable to expect all typewriter fonts to have -% this property, we can check that font parameter. -% -\def\ifmonospace{\ifdim\fontdimen3\font=0pt } - -% Typeset a dimension, e.g., `in' or `pt'. The only reason for the -% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. -% -\def\dmn#1{\thinspace #1} - -\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} - -% @l was never documented to mean ``switch to the Lisp font'', -% and it is not used as such in any manual I can find. We need it for -% Polish suppressed-l. --karl, 22sep96. -%\def\l#1{{\li #1}\null} - -% Explicit font changes: @r, @sc, undocumented @ii. -\def\r#1{{\rm #1}} % roman font -\def\sc#1{{\smallcaps#1}} % smallcaps font -\def\ii#1{{\it #1}} % italic font - -% @acronym downcases the argument and prints in smallcaps. -\def\acronym#1{{\smallcaps \lowercase{#1}}} - -% @pounds{} is a sterling sign. -\def\pounds{{\it\$}} - - -\message{page headings,} - -\newskip\titlepagetopglue \titlepagetopglue = 1.5in -\newskip\titlepagebottomglue \titlepagebottomglue = 2pc - -% First the title page. Must do @settitle before @titlepage. -\newif\ifseenauthor -\newif\iffinishedtitlepage - -% Do an implicit @contents or @shortcontents after @end titlepage if the -% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. -% -\newif\ifsetcontentsaftertitlepage - \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue -\newif\ifsetshortcontentsaftertitlepage - \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue - -\def\shorttitlepage{\parsearg\shorttitlepagezzz} -\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% - \endgroup\page\hbox{}\page} - -\def\titlepage{\begingroup \parindent=0pt \textfonts - \let\subtitlerm=\tenrm - \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% - % - \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% - % - % Leave some space at the very top of the page. - \vglue\titlepagetopglue - % - % Now you can print the title using @title. - \def\title{\parsearg\titlezzz}% - \def\titlezzz##1{\leftline{\titlefonts\rm ##1} - % print a rule at the page bottom also. - \finishedtitlepagefalse - \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% - % No rule at page bottom unless we print one at the top with @title. - \finishedtitlepagetrue - % - % Now you can put text using @subtitle. - \def\subtitle{\parsearg\subtitlezzz}% - \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% - % - % @author should come last, but may come many times. - \def\author{\parsearg\authorzzz}% - \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi - {\authorfont \leftline{##1}}}% - % - % Most title ``pages'' are actually two pages long, with space - % at the top of the second. We don't want the ragged left on the second. - \let\oldpage = \page - \def\page{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - \oldpage - \let\page = \oldpage - \hbox{}}% -% \def\page{\oldpage \hbox{}} -} - -\def\Etitlepage{% - \iffinishedtitlepage\else - \finishtitlepage - \fi - % It is important to do the page break before ending the group, - % because the headline and footline are only empty inside the group. - % If we use the new definition of \page, we always get a blank page - % after the title page, which we certainly don't want. - \oldpage - \endgroup - % - % If they want short, they certainly want long too. - \ifsetshortcontentsaftertitlepage - \shortcontents - \contents - \global\let\shortcontents = \relax - \global\let\contents = \relax - \fi - % - \ifsetcontentsaftertitlepage - \contents - \global\let\contents = \relax - \global\let\shortcontents = \relax - \fi - % - \ifpdf \pdfmakepagedesttrue \fi - % - \HEADINGSon -} - -\def\finishtitlepage{% - \vskip4pt \hrule height 2pt width \hsize - \vskip\titlepagebottomglue - \finishedtitlepagetrue -} - -%%% Set up page headings and footings. - -\let\thispage=\folio - -\newtoks\evenheadline % headline on even pages -\newtoks\oddheadline % headline on odd pages -\newtoks\evenfootline % footline on even pages -\newtoks\oddfootline % footline on odd pages - -% Now make Tex use those variables -\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline - \else \the\evenheadline \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} -\let\HEADINGShook=\relax - -% Commands to set those variables. -% For example, this is what @headings on does -% @evenheading @thistitle|@thispage|@thischapter -% @oddheading @thischapter|@thispage|@thistitle -% @evenfooting @thisfile|| -% @oddfooting ||@thisfile - -\def\evenheading{\parsearg\evenheadingxxx} -\def\oddheading{\parsearg\oddheadingxxx} -\def\everyheading{\parsearg\everyheadingxxx} - -\def\evenfooting{\parsearg\evenfootingxxx} -\def\oddfooting{\parsearg\oddfootingxxx} -\def\everyfooting{\parsearg\everyfootingxxx} - -{\catcode`\@=0 % - -\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} -\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% -\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} -\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% -\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% - -\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} -\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% -\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} - -\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} -\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% - \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% - % - % Leave some space for the footline. Hopefully ok to assume - % @evenfooting will not be used by itself. - \global\advance\pageheight by -\baselineskip - \global\advance\vsize by -\baselineskip -} - -\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} -% -}% unbind the catcode of @. - -% @headings double turns headings on for double-sided printing. -% @headings single turns headings on for single-sided printing. -% @headings off turns them off. -% @headings on same as @headings double, retained for compatibility. -% @headings after turns on double-sided headings after this page. -% @headings doubleafter turns on double-sided headings after this page. -% @headings singleafter turns on single-sided headings after this page. -% By default, they are off at the start of a document, -% and turned `on' after @end titlepage. - -\def\headings #1 {\csname HEADINGS#1\endcsname} - -\def\HEADINGSoff{ -\global\evenheadline={\hfil} \global\evenfootline={\hfil} -\global\oddheadline={\hfil} \global\oddfootline={\hfil}} -\HEADINGSoff -% When we turn headings on, set the page number to 1. -% For double-sided printing, put current file name in lower left corner, -% chapter name on inside top of right hand pages, document -% title on inside top of left hand pages, and page numbers on outside top -% edge of all pages. -\def\HEADINGSdouble{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} -\let\contentsalignmacro = \chappager - -% For single-sided printing, chapter title goes across top left of page, -% page number on top right. -\def\HEADINGSsingle{ -\global\pageno=1 -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} -\def\HEADINGSon{\HEADINGSdouble} - -\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} -\let\HEADINGSdoubleafter=\HEADINGSafter -\def\HEADINGSdoublex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\folio\hfil\thistitle}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chapoddpage -} - -\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} -\def\HEADINGSsinglex{% -\global\evenfootline={\hfil} -\global\oddfootline={\hfil} -\global\evenheadline={\line{\thischapter\hfil\folio}} -\global\oddheadline={\line{\thischapter\hfil\folio}} -\global\let\contentsalignmacro = \chappager -} - -% Subroutines used in generating headings -% This produces Day Month Year style of output. -% Only define if not already defined, in case a txi-??.tex file has set -% up a different format (e.g., txi-cs.tex does this). -\ifx\today\undefined -\def\today{% - \number\day\space - \ifcase\month - \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr - \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug - \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec - \fi - \space\number\year} -\fi - -% @settitle line... specifies the title of the document, for headings. -% It generates no output of its own. -\def\thistitle{\putwordNoTitle} -\def\settitle{\parsearg\settitlezzz} -\def\settitlezzz #1{\gdef\thistitle{#1}} - - -\message{tables,} -% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). - -% default indentation of table text -\newdimen\tableindent \tableindent=.8in -% default indentation of @itemize and @enumerate text -\newdimen\itemindent \itemindent=.3in -% margin between end of table item and start of table text. -\newdimen\itemmargin \itemmargin=.1in - -% used internally for \itemindent minus \itemmargin -\newdimen\itemmax - -% Note @table, @vtable, and @vtable define @item, @itemx, etc., with -% these defs. -% They also define \itemindex -% to index the item name in whatever manner is desired (perhaps none). - -\newif\ifitemxneedsnegativevskip - -\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} - -\def\internalBitem{\smallbreak \parsearg\itemzzz} -\def\internalBitemx{\itemxpar \parsearg\itemzzz} - -\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} -\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} - -\def\internalBkitem{\smallbreak \parsearg\kitemzzz} -\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} - -\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% - \itemzzz {#1}} - -\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% - \itemzzz {#1}} - -\def\itemzzz #1{\begingroup % - \advance\hsize by -\rightskip - \advance\hsize by -\tableindent - \setbox0=\hbox{\itemfont{#1}}% - \itemindex{#1}% - \nobreak % This prevents a break before @itemx. - % - % If the item text does not fit in the space we have, put it on a line - % by itself, and do not allow a page break either before or after that - % line. We do not start a paragraph here because then if the next - % command is, e.g., @kindex, the whatsit would get put into the - % horizontal list on a line by itself, resulting in extra blank space. - \ifdim \wd0>\itemmax - % - % Make this a paragraph so we get the \parskip glue and wrapping, - % but leave it ragged-right. - \begingroup - \advance\leftskip by-\tableindent - \advance\hsize by\tableindent - \advance\rightskip by0pt plus1fil - \leavevmode\unhbox0\par - \endgroup - % - % We're going to be starting a paragraph, but we don't want the - % \parskip glue -- logically it's part of the @item we just started. - \nobreak \vskip-\parskip - % - % Stop a page break at the \parskip glue coming up. Unfortunately - % we can't prevent a possible page break at the following - % \baselineskip glue. - \nobreak - \endgroup - \itemxneedsnegativevskipfalse - \else - % The item text fits into the space. Start a paragraph, so that the - % following text (if any) will end up on the same line. - \noindent - % Do this with kerns and \unhbox so that if there is a footnote in - % the item text, it can migrate to the main vertical list and - % eventually be printed. - \nobreak\kern-\tableindent - \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 - \unhbox0 - \nobreak\kern\dimen0 - \endgroup - \itemxneedsnegativevskiptrue - \fi -} - -\def\item{\errmessage{@item while not in a table}} -\def\itemx{\errmessage{@itemx while not in a table}} -\def\kitem{\errmessage{@kitem while not in a table}} -\def\kitemx{\errmessage{@kitemx while not in a table}} -\def\xitem{\errmessage{@xitem while not in a table}} -\def\xitemx{\errmessage{@xitemx while not in a table}} - -% Contains a kludge to get @end[description] to work. -\def\description{\tablez{\dontindex}{1}{}{}{}{}} - -% @table, @ftable, @vtable. -\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} -{\obeylines\obeyspaces% -\gdef\tablex #1^^M{% -\tabley\dontindex#1 \endtabley}} - -\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} -{\obeylines\obeyspaces% -\gdef\ftablex #1^^M{% -\tabley\fnitemindex#1 \endtabley -\def\Eftable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} -{\obeylines\obeyspaces% -\gdef\vtablex #1^^M{% -\tabley\vritemindex#1 \endtabley -\def\Evtable{\endgraf\afterenvbreak\endgroup}% -\let\Etable=\relax}} - -\def\dontindex #1{} -\def\fnitemindex #1{\doind {fn}{\code{#1}}}% -\def\vritemindex #1{\doind {vr}{\code{#1}}}% - -{\obeyspaces % -\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% -\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} - -\def\tablez #1#2#3#4#5#6{% -\aboveenvbreak % -\begingroup % -\def\Edescription{\Etable}% Necessary kludge. -\let\itemindex=#1% -\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % -\ifnum 0#4>0 \tableindent=#4\mil \fi % -\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % -\def\itemfont{#2}% -\itemmax=\tableindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \tableindent % -\exdentamount=\tableindent -\parindent = 0pt -\parskip = \smallskipamount -\ifdim \parskip=0pt \parskip=2pt \fi% -\def\Etable{\endgraf\afterenvbreak\endgroup}% -\let\item = \internalBitem % -\let\itemx = \internalBitemx % -\let\kitem = \internalBkitem % -\let\kitemx = \internalBkitemx % -\let\xitem = \internalBxitem % -\let\xitemx = \internalBxitemx % -} - -% This is the counter used by @enumerate, which is really @itemize - -\newcount \itemno - -\def\itemize{\parsearg\itemizezzz} - -\def\itemizezzz #1{% - \begingroup % ended by the @end itemize - \itemizey {#1}{\Eitemize} -} - -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } - -% \splitoff TOKENS\endmark defines \first to be the first token in -% TOKENS, and \rest to be the remainder. -% -\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% - -% Allow an optional argument of an uppercase letter, lowercase letter, -% or number, to specify the first label in the enumerated list. No -% argument is the same as `1'. -% -\def\enumerate{\parsearg\enumeratezzz} -\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} -\def\enumeratey #1 #2\endenumeratey{% - \begingroup % ended by the @end enumerate - % - % If we were given no argument, pretend we were given `1'. - \def\thearg{#1}% - \ifx\thearg\empty \def\thearg{1}\fi - % - % Detect if the argument is a single token. If so, it might be a - % letter. Otherwise, the only valid thing it can be is a number. - % (We will always have one token, because of the test we just made. - % This is a good thing, since \splitoff doesn't work given nothing at - % all -- the first parameter is undelimited.) - \expandafter\splitoff\thearg\endmark - \ifx\rest\empty - % Only one token in the argument. It could still be anything. - % A ``lowercase letter'' is one whose \lccode is nonzero. - % An ``uppercase letter'' is one whose \lccode is both nonzero, and - % not equal to itself. - % Otherwise, we assume it's a number. - % - % We need the \relax at the end of the \ifnum lines to stop TeX from - % continuing to look for a <number>. - % - \ifnum\lccode\expandafter`\thearg=0\relax - \numericenumerate % a number (we hope) - \else - % It's a letter. - \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax - \lowercaseenumerate % lowercase letter - \else - \uppercaseenumerate % uppercase letter - \fi - \fi - \else - % Multiple tokens in the argument. We hope it's a number. - \numericenumerate - \fi -} - -% An @enumerate whose labels are integers. The starting integer is -% given in \thearg. -% -\def\numericenumerate{% - \itemno = \thearg - \startenumeration{\the\itemno}% -} - -% The starting (lowercase) letter is in \thearg. -\def\lowercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more lowercase letters in @enumerate; get a bigger - alphabet}% - \fi - \char\lccode\itemno - }% -} - -% The starting (uppercase) letter is in \thearg. -\def\uppercaseenumerate{% - \itemno = \expandafter`\thearg - \startenumeration{% - % Be sure we're not beyond the end of the alphabet. - \ifnum\itemno=0 - \errmessage{No more uppercase letters in @enumerate; get a bigger - alphabet} - \fi - \char\uccode\itemno - }% -} - -% Call itemizey, adding a period to the first argument and supplying the -% common last two arguments. Also subtract one from the initial value in -% \itemno, since @item increments \itemno. -% -\def\startenumeration#1{% - \advance\itemno by -1 - \itemizey{#1.}\Eenumerate\flushcr -} - -% @alphaenumerate and @capsenumerate are abbreviations for giving an arg -% to @enumerate. -% -\def\alphaenumerate{\enumerate{a}} -\def\capsenumerate{\enumerate{A}} -\def\Ealphaenumerate{\Eenumerate} -\def\Ecapsenumerate{\Eenumerate} - -% Definition of @item while inside @itemize. - -\def\itemizeitem{% -\advance\itemno by 1 -{\let\par=\endgraf \smallbreak}% -\ifhmode \errmessage{In hmode at itemizeitem}\fi -{\parskip=0in \hskip 0pt -\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% -\vadjust{\penalty 1200}}% -\flushcr} - -% @multitable macros -% Amy Hendrickson, 8/18/94, 3/6/96 -% -% @multitable ... @end multitable will make as many columns as desired. -% Contents of each column will wrap at width given in preamble. Width -% can be specified either with sample text given in a template line, -% or in percent of \hsize, the current width of text on page. - -% Table can continue over pages but will only break between lines. - -% To make preamble: -% -% Either define widths of columns in terms of percent of \hsize: -% @multitable @columnfractions .25 .3 .45 -% @item ... -% -% Numbers following @columnfractions are the percent of the total -% current hsize to be used for each column. You may use as many -% columns as desired. - - -% Or use a template: -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item ... -% using the widest term desired in each column. -% -% For those who want to use more than one line's worth of words in -% the preamble, break the line within one argument and it -% will parse correctly, i.e., -% -% @multitable {Column 1 template} {Column 2 template} {Column 3 -% template} -% Not: -% @multitable {Column 1 template} {Column 2 template} -% {Column 3 template} - -% Each new table line starts with @item, each subsequent new column -% starts with @tab. Empty columns may be produced by supplying @tab's -% with nothing between them for as many times as empty columns are needed, -% ie, @tab@tab@tab will produce two empty columns. - -% @item, @tab, @multitable or @end multitable do not need to be on their -% own lines, but it will not hurt if they are. - -% Sample multitable: - -% @multitable {Column 1 template} {Column 2 template} {Column 3 template} -% @item first col stuff @tab second col stuff @tab third col -% @item -% first col stuff -% @tab -% second col stuff -% @tab -% third col -% @item first col stuff @tab second col stuff -% @tab Many paragraphs of text may be used in any column. -% -% They will wrap at the width determined by the template. -% @item@tab@tab This will be in third column. -% @end multitable - -% Default dimensions may be reset by user. -% @multitableparskip is vertical space between paragraphs in table. -% @multitableparindent is paragraph indent in table. -% @multitablecolmargin is horizontal space to be left between columns. -% @multitablelinespace is space to leave between table items, baseline -% to baseline. -% 0pt means it depends on current normal line spacing. -% -\newskip\multitableparskip -\newskip\multitableparindent -\newdimen\multitablecolspace -\newskip\multitablelinespace -\multitableparskip=0pt -\multitableparindent=6pt -\multitablecolspace=12pt -\multitablelinespace=0pt - -% Macros used to set up halign preamble: -% -\let\endsetuptable\relax -\def\xendsetuptable{\endsetuptable} -\let\columnfractions\relax -\def\xcolumnfractions{\columnfractions} -\newif\ifsetpercent - -% #1 is the part of the @columnfraction before the decimal point, which -% is presumably either 0 or the empty string (but we don't check, we -% just throw it away). #2 is the decimal part, which we use as the -% percent of \hsize for this column. -\def\pickupwholefraction#1.#2 {% - \global\advance\colcount by 1 - \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% - \setuptable -} - -\newcount\colcount -\def\setuptable#1{% - \def\firstarg{#1}% - \ifx\firstarg\xendsetuptable - \let\go = \relax - \else - \ifx\firstarg\xcolumnfractions - \global\setpercenttrue - \else - \ifsetpercent - \let\go\pickupwholefraction - \else - \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. - \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% - \fi - \fi - \ifx\go\pickupwholefraction - % Put the argument back for the \pickupwholefraction call, so - % we'll always have a period there to be parsed. - \def\go{\pickupwholefraction#1}% - \else - \let\go = \setuptable - \fi% - \fi - \go -} - -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} - -% @multitable ... @end multitable definitions: -% -\def\multitable{\parsearg\dotable} -\def\dotable#1{\bgroup - \vskip\parskip - \let\item\crcr - \tolerance=9500 - \hbadness=9500 - \setmultitablespacing - \parskip=\multitableparskip - \parindent=\multitableparindent - \overfullrule=0pt - \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% - % - % To parse everything between @multitable and @item: - \setuptable#1 \endsetuptable - % - % \everycr will reset column counter, \colcount, at the end of - % each line. Every column entry will cause \colcount to advance by one. - % The table preamble - % looks at the current \colcount to find the correct column width. - \everycr{\noalign{% - % - % \filbreak%% keeps underfull box messages off when table breaks over pages. - % Maybe so, but it also creates really weird page breaks when the table - % breaks over pages. Wouldn't \vfil be better? Wait until the problem - % manifests itself, so it can be fixed for real --karl. - \global\colcount=0\relax}}% - % - % This preamble sets up a generic column definition, which will - % be used as many times as user calls for columns. - % \vtop will set a single line and will also let text wrap and - % continue for many paragraphs if desired. - \halign\bgroup&\global\advance\colcount by 1\relax - \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname - % - % In order to keep entries from bumping into each other - % we will add a \leftskip of \multitablecolspace to all columns after - % the first one. - % - % If a template has been used, we will add \multitablecolspace - % to the width of each template entry. - % - % If the user has set preamble in terms of percent of \hsize we will - % use that dimension as the width of the column, and the \leftskip - % will keep entries from bumping into each other. Table will start at - % left margin and final column will justify at right margin. - % - % Make sure we don't inherit \rightskip from the outer environment. - \rightskip=0pt - \ifnum\colcount=1 - % The first column will be indented with the surrounding text. - \advance\hsize by\leftskip - \else - \ifsetpercent \else - % If user has not set preamble in terms of percent of \hsize - % we will advance \hsize by \multitablecolspace. - \advance\hsize by \multitablecolspace - \fi - % In either case we will make \leftskip=\multitablecolspace: - \leftskip=\multitablecolspace - \fi - % Ignoring space at the beginning and end avoids an occasional spurious - % blank line, when TeX decides to break the line at the space before the - % box from the multistrut, so the strut ends up on a line by itself. - % For example: - % @multitable @columnfractions .11 .89 - % @item @code{#} - % @tab Legal holiday which is valid in major parts of the whole country. - % Is automatically provided with highlighting sequences respectively marking - % characters. - \noindent\ignorespaces##\unskip\multistrut}\cr -} - -\def\setmultitablespacing{% test to see if user has set \multitablelinespace. -% If so, do nothing. If not, give it an appropriate dimension based on -% current baselineskip. -\ifdim\multitablelinespace=0pt -\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip -\global\advance\multitablelinespace by-\ht0 -%% strut to put in table in case some entry doesn't have descenders, -%% to keep lines equally spaced -\let\multistrut = \strut -\else -%% FIXME: what is \box0 supposed to be? -\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 -width0pt\relax} \fi -%% Test to see if parskip is larger than space between lines of -%% table. If not, do nothing. -%% If so, set to same dimension as multitablelinespace. -\ifdim\multitableparskip>\multitablelinespace -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi% -\ifdim\multitableparskip=0pt -\global\multitableparskip=\multitablelinespace -\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller - %% than skip between lines in the table. -\fi} - - -\message{conditionals,} -% Prevent errors for section commands. -% Used in @ignore and in failing conditionals. -\def\ignoresections{% - \let\chapter=\relax - \let\unnumbered=\relax - \let\top=\relax - \let\unnumberedsec=\relax - \let\unnumberedsection=\relax - \let\unnumberedsubsec=\relax - \let\unnumberedsubsection=\relax - \let\unnumberedsubsubsec=\relax - \let\unnumberedsubsubsection=\relax - \let\section=\relax - \let\subsec=\relax - \let\subsubsec=\relax - \let\subsection=\relax - \let\subsubsection=\relax - \let\appendix=\relax - \let\appendixsec=\relax - \let\appendixsection=\relax - \let\appendixsubsec=\relax - \let\appendixsubsection=\relax - \let\appendixsubsubsec=\relax - \let\appendixsubsubsection=\relax - \let\contents=\relax - \let\smallbook=\relax - \let\titlepage=\relax -} - -% Used in nested conditionals, where we have to parse the Texinfo source -% and so want to turn off most commands, in case they are used -% incorrectly. -% -\def\ignoremorecommands{% - \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax - \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypeop = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax - \let\evenheading = \relax - \let\oddheading = \relax - \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax - \let\headings = \relax - \let\include = \relax - \let\lowersections = \relax - \let\down = \relax - \let\raisesections = \relax - \let\up = \relax - \let\set = \relax - \let\clear = \relax - \let\item = \relax -} - -% Ignore @ignore ... @end ignore. -% -\def\ignore{\doignore{ignore}} - -% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. -% -\def\ifinfo{\doignore{ifinfo}} -\def\ifhtml{\doignore{ifhtml}} -\def\ifnottex{\doignore{ifnottex}} -\def\html{\doignore{html}} -\def\menu{\doignore{menu}} -\def\direntry{\doignore{direntry}} - -% @dircategory CATEGORY -- specify a category of the dir file -% which this file should belong to. Ignore this in TeX. -\let\dircategory = \comment - -% Ignore text until a line `@end #1'. -% -\def\doignore#1{\begingroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define a command to swallow text until we reach `@end #1'. - % This @ is a catcode 12 token (that is the normal catcode of @ in - % this texinfo.tex file). We change the catcode of @ below to match. - \long\def\doignoretext##1@end #1{\enddoignore}% - % - % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 - % - % Ignore braces, too, so mismatched braces don't cause trouble. - \catcode`\{ = 9 - \catcode`\} = 9 - % - % We must not have @c interpreted as a control sequence. - \catcode`\@ = 12 - % - % Make the letter c a comment character so that the rest of the line - % will be ignored. This way, the document can have (for example) - % @c @end ifinfo - % and the @end ifinfo will be properly ignored. - % (We've just changed @ to catcode 12.) - \catcode`\c = 14 - % - % And now expand that command. - \doignoretext -} - -% What we do to finish off ignored text. -% -\def\enddoignore{\endgroup\ignorespaces}% - -\newif\ifwarnedobs\warnedobsfalse -\def\obstexwarn{% - \ifwarnedobs\relax\else - % We need to warn folks that they may have trouble with TeX 3.0. - % This uses \immediate\write16 rather than \message to get newlines. - \immediate\write16{} - \immediate\write16{WARNING: for users of Unix TeX 3.0!} - \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} - \immediate\write16{If you are running another version of TeX, relax.} - \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} - \immediate\write16{ Then upgrade your TeX installation if you can.} - \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} - \immediate\write16{If you are stuck with version 3.0, run the} - \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} - \immediate\write16{ to use a workaround.} - \immediate\write16{} - \global\warnedobstrue - \fi -} - -% **In TeX 3.0, setting text in \nullfont hangs tex. For a -% workaround (which requires the file ``dummy.tfm'' to be installed), -% uncomment the following line: -%%%%%\font\nullfont=dummy\let\obstexwarn=\relax - -% Ignore text, except that we keep track of conditional commands for -% purposes of nesting, up to an `@end #1' command. -% -\def\nestedignore#1{% - \obstexwarn - % We must actually expand the ignored text to look for the @end - % command, so that nested ignore constructs work. Thus, we put the - % text into a \vbox and then do nothing with the result. To minimize - % the change of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. - % - \setbox0 = \vbox\bgroup - % Don't complain about control sequences we have declared \outer. - \ignoresections - % - % Define `@end #1' to end the box, which will in turn undefine the - % @end command again. - \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% - % - % We are going to be parsing Texinfo commands. Most cause no - % trouble when they are used incorrectly, but some commands do - % complicated argument parsing or otherwise get confused, so we - % undefine them. - % - % We can't do anything about stray @-signs, unfortunately; - % they'll produce `undefined control sequence' errors. - \ignoremorecommands - % - % Set the current font to be \nullfont, a TeX primitive, and define - % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still - % produce output, but that should be an extremely small amount of - % stuff compared to the main input. - % - \nullfont - \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont - \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont - \let\tensf=\nullfont - % Similarly for index fonts (mostly for their use in smallexample). - \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont - \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont - \let\smallsf=\nullfont - % - % Don't complain when characters are missing from the fonts. - \tracinglostchars = 0 - % - % Don't bother to do space factor calculations. - \frenchspacing - % - % Don't report underfull hboxes. - \hbadness = 10000 - % - % Do minimal line-breaking. - \pretolerance = 10000 - % - % Do not execute instructions in @tex - \def\tex{\doignore{tex}}% - % Do not execute macro definitions. - % `c' is a comment character, so the word `macro' will get cut off. - \def\macro{\doignore{ma}}% -} - -% @set VAR sets the variable VAR to an empty value. -% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. -% -% Since we want to separate VAR from REST-OF-LINE (which might be -% empty), we can't just use \parsearg; we have to insert a space of our -% own to delimit the rest of the line, and then take it out again if we -% didn't need it. Make sure the catcode of space is correct to avoid -% losing inside @example, for instance. -% -\def\set{\begingroup\catcode` =10 - \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. - \parsearg\setxxx} -\def\setxxx#1{\setyyy#1 \endsetyyy} -\def\setyyy#1 #2\endsetyyy{% - \def\temp{#2}% - \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty - \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. - \fi - \endgroup -} -% Can't use \xdef to pre-expand #2 and save some time, since \temp or -% \next or other control sequences that we've defined might get us into -% an infinite loop. Consider `@set foo @cite{bar}'. -\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} - -% @clear VAR clears (i.e., unsets) the variable VAR. -% -\def\clear{\parsearg\clearxxx} -\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} - -% @value{foo} gets the text saved in variable foo. -{ - \catcode`\_ = \active - % - % We might end up with active _ or - characters in the argument if - % we're called from @code, as @code{@value{foo-bar_}}. So \let any - % such active characters to their normal equivalents. - \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 - \indexbreaks \let_\normalunderscore - \valuexxx} -} -\def\valuexxx#1{\expandablevalue{#1}\endgroup} - -% We have this subroutine so that we can handle at least some @value's -% properly in indexes (we \let\value to this in \indexdummies). Ones -% whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). -% -\def\expandablevalue#1{% - \expandafter\ifx\csname SET#1\endcsname\relax - {[No value for ``#1'']}% - \else - \csname SET#1\endcsname - \fi -} - -% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined -% with @set. -% -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail - \else - \expandafter\ifsetsucceed - \fi -} -\def\ifsetsucceed{\conditionalsucceed{ifset}} -\def\ifsetfail{\nestedignore{ifset}} -\defineunmatchedend{ifset} - -% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been -% defined with @set, or has been undefined with @clear. -% -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% - \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed - \else - \expandafter\ifclearfail - \fi -} -\def\ifclearsucceed{\conditionalsucceed{ifclear}} -\def\ifclearfail{\nestedignore{ifclear}} -\defineunmatchedend{ifclear} - -% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text -% following, through the first @end iftex (etc.). Make `@end iftex' -% (etc.) valid only after an @iftex. -% -\def\iftex{\conditionalsucceed{iftex}} -\def\ifnothtml{\conditionalsucceed{ifnothtml}} -\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} -\defineunmatchedend{iftex} -\defineunmatchedend{ifnothtml} -\defineunmatchedend{ifnotinfo} - -% We can't just want to start a group at @iftex (for example) and end it -% at @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. -% -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} - -% @defininfoenclose. -\let\definfoenclose=\comment - - -\message{indexing,} -% Index generation facilities - -% Define \newwrite to be identical to plain tex's \newwrite -% except not \outer, so it can be used within \newindex. -{\catcode`\@=11 -\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} - -% \newindex {foo} defines an index named foo. -% It automatically defines \fooindex such that -% \fooindex ...rest of line... puts an entry in the index foo. -% It also defines \fooindfile to be the number of the output channel for -% the file that accumulates this index. The file's extension is foo. -% The name of an index should be no more than 2 characters long -% for the sake of vms. -% -\def\newindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 % Open the file - \fi - \expandafter\xdef\csname#1index\endcsname{% % Define @#1index - \noexpand\doindex{#1}} -} - -% @defindex foo == \newindex{foo} - -\def\defindex{\parsearg\newindex} - -% Define @defcodeindex, like @defindex except put all entries in @code. - -\def\newcodeindex#1{% - \iflinks - \expandafter\newwrite \csname#1indfile\endcsname - \openout \csname#1indfile\endcsname \jobname.#1 - \fi - \expandafter\xdef\csname#1index\endcsname{% - \noexpand\docodeindex{#1}} -} - -\def\defcodeindex{\parsearg\newcodeindex} - -% @synindex foo bar makes index foo feed into index bar. -% Do this instead of @defindex foo if you don't want it as a separate index. -% The \closeout helps reduce unnecessary open files; the limit on the -% Acorn RISC OS is a mere 16 files. -\def\synindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\doindex{#2}}% -} - -% @syncodeindex foo bar similar, but put all entries made for index foo -% inside @code. -\def\syncodeindex#1 #2 {% - \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname - \expandafter\closeout\csname#1indfile\endcsname - \expandafter\let\csname#1indfile\endcsname=\synindexfoo - \expandafter\xdef\csname#1index\endcsname{% define \xxxindex - \noexpand\docodeindex{#2}}% -} - -% Define \doindex, the driver for all \fooindex macros. -% Argument #1 is generated by the calling \fooindex macro, -% and it is "foo", the name of the index. - -% \doindex just uses \parsearg; it calls \doind for the actual work. -% This is because \doind is more useful to call from other macros. - -% There is also \dosubind {index}{topic}{subtopic} -% which makes an entry in a two-level index such as the operation index. - -\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} -\def\singleindexer #1{\doind{\indexname}{#1}} - -% like the previous two, but they put @code around the argument. -\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} -\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} - -\def\indexdummies{% -\def\ { }% -% Take care of the plain tex accent commands. -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -% Take care of the plain tex special European modified letters. -\def\oe{\realbackslash oe}% -\def\ae{\realbackslash ae}% -\def\aa{\realbackslash aa}% -\def\OE{\realbackslash OE}% -\def\AE{\realbackslash AE}% -\def\AA{\realbackslash AA}% -\def\o{\realbackslash o}% -\def\O{\realbackslash O}% -\def\l{\realbackslash l}% -\def\L{\realbackslash L}% -\def\ss{\realbackslash ss}% -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -\def\@{@}% will be @@ when we switch to @ as escape char. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\def\w{\realbackslash w }% -\def\bf{\realbackslash bf }% -%\def\rm{\realbackslash rm }% -\def\sl{\realbackslash sl }% -\def\sf{\realbackslash sf}% -\def\tt{\realbackslash tt}% -\def\gtr{\realbackslash gtr}% -\def\less{\realbackslash less}% -\def\hat{\realbackslash hat}% -\def\TeX{\realbackslash TeX}% -\def\dots{\realbackslash dots }% -\def\result{\realbackslash result}% -\def\equiv{\realbackslash equiv}% -\def\expansion{\realbackslash expansion}% -\def\print{\realbackslash print}% -\def\error{\realbackslash error}% -\def\point{\realbackslash point}% -\def\copyright{\realbackslash copyright}% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\dotless##1{\realbackslash dotless {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\,##1{\realbackslash ,{##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\b##1{\realbackslash b {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\emph##1{\realbackslash emph {##1}}% -\def\acronym##1{\realbackslash acronym {##1}}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros -} - -% If an index command is used in an @example environment, any spaces -% therein should become regular spaces in the raw index file, not the -% expansion of \tie (\\leavevmode \penalty \@M \ ). -{\obeyspaces - \gdef\unsepspaces{\obeyspaces\let =\space}} - -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} -\def\indexdummytex{TeX} -\def\indexdummydots{...} - -\def\indexnofonts{% -% Just ignore accents. -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\oe{oe}% -\def\ae{ae}% -\def\aa{aa}% -\def\OE{OE}% -\def\AE{AE}% -\def\AA{AA}% -\def\o{o}% -\def\O{O}% -\def\l{l}% -\def\L{L}% -\def\ss{ss}% -\let\w=\indexdummyfont -\let\t=\indexdummyfont -\let\r=\indexdummyfont -\let\i=\indexdummyfont -\let\b=\indexdummyfont -\let\emph=\indexdummyfont -\let\strong=\indexdummyfont -\let\cite=\indexdummyfont -\let\sc=\indexdummyfont -%Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |... -%\let\tt=\indexdummyfont -\let\tclose=\indexdummyfont -\let\code=\indexdummyfont -\let\url=\indexdummyfont -\let\uref=\indexdummyfont -\let\env=\indexdummyfont -\let\acronym=\indexdummyfont -\let\command=\indexdummyfont -\let\option=\indexdummyfont -\let\file=\indexdummyfont -\let\samp=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\var=\indexdummyfont -\let\TeX=\indexdummytex -\let\dots=\indexdummydots -\def\@{@}% -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} - -\let\indexbackslash=0 %overridden during \printindex. -\let\SETmarginindex=\relax % put index entries in margin (undocumented)? - -% For \ifx comparisons. -\def\emptymacro{\empty} - -% Most index entries go through here, but \dosubind is the general case. -% -\def\doind#1#2{\dosubind{#1}{#2}\empty} - -% Workhorse for all \fooindexes. -% #1 is name of index, #2 is stuff to put there, #3 is subentry -- -% \empty if called from \doind, as we usually are. The main exception -% is with defuns, which call us directly. -% -\def\dosubind#1#2#3{% - % Put the index entry in the margin if desired. - \ifx\SETmarginindex\relax\else - \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% - \fi - {% - \count255=\lastpenalty - {% - \indexdummies % Must do this here, since \bf, etc expand at this stage - \escapechar=`\\ - {% - \let\folio = 0% We will expand all macros now EXCEPT \folio. - \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now - % so it will be output as is; and it will print as backslash. - % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. - \toks0 = {#2}% - % - % If third (subentry) arg is present, add it to the index - % string. And include a space. - \ifx\thirdarg\emptymacro \else - \toks0 = \expandafter{\the\toks0 \space #3}% - \fi - % - % Set up the complete index entry, with both the sort key - % and the original text, including any font commands. We write - % three arguments to \entry to the .?? file, texindex reduces to - % two when writing the .??s sorted result. - \edef\temp{% - \write\csname#1indfile\endcsname{% - \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% - }% - % - % If a skip is the last thing on the list now, preserve it - % by backing up by \lastskip, doing the \write, then inserting - % the skip again. Otherwise, the whatsit generated by the - % \write will make \lastskip zero. The result is that sequences - % like this: - % @end defun - % @tindex whatever - % @defun ... - % will have extra space inserted, because the \medbreak in the - % start of the @defun won't see the skip inserted by the @end of - % the previous defun. - % - % But don't do any of this if we're not in vertical mode. We - % don't want to do a \vskip and prematurely end a paragraph. - % - % Avoid page breaks due to these extra skips, too. - % - \iflinks - \ifvmode - \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi - \fi - % - \temp % do the write - % - % - \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi - \fi - }% - }% - \penalty\count255 - }% -} - -% The index entry written in the file actually looks like -% \entry {sortstring}{page}{topic} -% or -% \entry {sortstring}{page}{topic}{subtopic} -% The texindex program reads in these files and writes files -% containing these kinds of lines: -% \initial {c} -% before the first topic whose initial is c -% \entry {topic}{pagelist} -% for a topic that is used without subtopics -% \primary {topic} -% for the beginning of a topic that is used with subtopics -% \secondary {subtopic}{pagelist} -% for each subtopic. - -% Define the user-accessible indexing commands -% @findex, @vindex, @kindex, @cindex. - -\def\findex {\fnindex} -\def\kindex {\kyindex} -\def\cindex {\cpindex} -\def\vindex {\vrindex} -\def\tindex {\tpindex} -\def\pindex {\pgindex} - -\def\cindexsub {\begingroup\obeylines\cindexsub} -{\obeylines % -\gdef\cindexsub "#1" #2^^M{\endgroup % -\dosubind{cp}{#2}{#1}}} - -% Define the macros used in formatting output of the sorted index material. - -% @printindex causes a particular index (the ??s file) to get printed. -% It does not print any chapter heading (usually an @unnumbered). -% -\def\printindex{\parsearg\doprintindex} -\def\doprintindex#1{\begingroup - \dobreak \chapheadingskip{10000}% - % - \smallfonts \rm - \tolerance = 9500 - \indexbreaks - % - % See if the index file exists and is nonempty. - % Change catcode of @ here so that if the index file contains - % \initial {@} - % as its first line, TeX doesn't complain about mismatched braces - % (because it thinks @} is a control sequence). - \catcode`\@ = 11 - \openin 1 \jobname.#1s - \ifeof 1 - % \enddoublecolumns gets confused if there is no text in the index, - % and it loses the chapter title and the aux file entries for the - % index. The easiest way to prevent this problem is to make sure - % there is some text. - \putwordIndexNonexistent - \else - % - % If the index file exists but is empty, then \openin leaves \ifeof - % false. We have to make TeX try to read something from the file, so - % it can discover if there is anything in it. - \read 1 to \temp - \ifeof 1 - \putwordIndexIsEmpty - \else - % Index files are almost Texinfo source, but we use \ as the escape - % character. It would be better to use @, but that's too big a change - % to make right now. - \def\indexbackslash{\rawbackslashxx}% - \catcode`\\ = 0 - \escapechar = `\\ - \begindoublecolumns - \input \jobname.#1s - \enddoublecolumns - \fi - \fi - \closein 1 -\endgroup} - -% These macros are used by the sorted index file itself. -% Change them to control the appearance of the index. - -\def\initial#1{{% - % Some minor font changes for the special characters. - \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt - % - % Remove any glue we may have, we'll be inserting our own. - \removelastskip - % - % We like breaks before the index initials, so insert a bonus. - \penalty -300 - % - % Typeset the initial. Making this add up to a whole number of - % baselineskips increases the chance of the dots lining up from column - % to column. It still won't often be perfect, because of the stretch - % we need before each entry, but it's better. - % - % No shrink because it confuses \balancecolumns. - \vskip 1.67\baselineskip plus .5\baselineskip - \leftline{\secbf #1}% - \vskip .33\baselineskip plus .1\baselineskip - % - % Do our best not to break after the initial. - \nobreak -}} - -% This typesets a paragraph consisting of #1, dot leaders, and then #2 -% flush to the right margin. It is used for index and table of contents -% entries. The paragraph is indented by \leftskip. -% -\def\entry#1#2{\begingroup - % - % Start a new paragraph if necessary, so our assignments below can't - % affect previous text. - \par - % - % Do not fill out the last line with white space. - \parfillskip = 0in - % - % No extra space above this paragraph. - \parskip = 0in - % - % Do not prefer a separate line ending with a hyphen to fewer lines. - \finalhyphendemerits = 0 - % - % \hangindent is only relevant when the entry text and page number - % don't both fit on one line. In that case, bob suggests starting the - % dots pretty far over on the line. Unfortunately, a large - % indentation looks wrong when the entry text itself is broken across - % lines. So we use a small indentation and put up with long leaders. - % - % \hangafter is reset to 1 (which is the value we want) at the start - % of each paragraph, so we need not do anything with that. - \hangindent = 2em - % - % When the entry text needs to be broken, just fill out the first line - % with blank space. - \rightskip = 0pt plus1fil - % - % A bit of stretch before each entry for the benefit of balancing columns. - \vskip 0pt plus1pt - % - % Start a ``paragraph'' for the index entry so the line breaking - % parameters we've set above will have an effect. - \noindent - % - % Insert the text of the index entry. TeX will do line-breaking on it. - #1% - % The following is kludged to not output a line of dots in the index if - % there are no page numbers. The next person who breaks this will be - % cursed by a Unix daemon. - \def\tempa{{\rm }}% - \def\tempb{#2}% - \edef\tempc{\tempa}% - \edef\tempd{\tempb}% - \ifx\tempc\tempd\ \else% - % - % If we must, put the page number on a line of its own, and fill out - % this line with blank space. (The \hfil is overwhelmed with the - % fill leaders glue in \indexdotfill if the page number does fit.) - \hfil\penalty50 - \null\nobreak\indexdotfill % Have leaders before the page number. - % - % The `\ ' here is removed by the implicit \unskip that TeX does as - % part of (the primitive) \par. Without it, a spurious underfull - % \hbox ensues. - \ifpdf - \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. - \else - \ #2% The page number ends the paragraph. - \fi - \fi% - \par -\endgroup} - -% Like \dotfill except takes at least 1 em. -\def\indexdotfill{\cleaders - \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} - -\def\primary #1{\line{#1\hfil}} - -\newskip\secondaryindent \secondaryindent=0.5cm - -\def\secondary #1#2{ -{\parfillskip=0in \parskip=0in -\hangindent =1in \hangafter=1 -\noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par -}} - -% Define two-column mode, which we use to typeset indexes. -% Adapted from the TeXbook, page 416, which is to say, -% the manmac.tex format used to print the TeXbook itself. -\catcode`\@=11 - -\newbox\partialpage -\newdimen\doublecolumnhsize - -\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns - % Grab any single-column material above us. - \output = {% - % - % Here is a possibility not foreseen in manmac: if we accumulate a - % whole lot of material, we might end up calling this \output - % routine twice in a row (see the doublecol-lose test, which is - % essentially a couple of indexes with @setchapternewpage off). In - % that case we just ship out what is in \partialpage with the normal - % output routine. Generally, \partialpage will be empty when this - % runs and this will be a no-op. See the indexspread.tex test case. - \ifvoid\partialpage \else - \onepageout{\pagecontents\partialpage}% - \fi - % - \global\setbox\partialpage = \vbox{% - % Unvbox the main output page. - \unvbox\PAGE - \kern-\topskip \kern\baselineskip - }% - }% - \eject % run that output routine to set \partialpage - % - % Use the double-column output routine for subsequent pages. - \output = {\doublecolumnout}% - % - % Change the page size parameters. We could do this once outside this - % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 - % format, but then we repeat the same computation. Repeating a couple - % of assignments once per index is clearly meaningless for the - % execution time, so we may as well do it in one place. - % - % First we halve the line length, less a little for the gutter between - % the columns. We compute the gutter based on the line length, so it - % changes automatically with the paper format. The magic constant - % below is chosen so that the gutter has the same value (well, +-<1pt) - % as it did when we hard-coded it. - % - % We put the result in a separate register, \doublecolumhsize, so we - % can restore it in \pagesofar, after \hsize itself has (potentially) - % been clobbered. - % - \doublecolumnhsize = \hsize - \advance\doublecolumnhsize by -.04154\hsize - \divide\doublecolumnhsize by 2 - \hsize = \doublecolumnhsize - % - % Double the \vsize as well. (We don't need a separate register here, - % since nobody clobbers \vsize.) - \advance\vsize by -\ht\partialpage - \vsize = 2\vsize -} - -% The double-column output routine for all double-column pages except -% the last. -% -\def\doublecolumnout{% - \splittopskip=\topskip \splitmaxdepth=\maxdepth - % Get the available space for the double columns -- the normal - % (undoubled) page height minus any material left over from the - % previous page. - \dimen@ = \vsize - \divide\dimen@ by 2 - % - % box0 will be the left-hand column, box2 the right. - \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ - \onepageout\pagesofar - \unvbox255 - \penalty\outputpenalty -} -\def\pagesofar{% - % Re-output the contents of the output page -- any previous material, - % followed by the two boxes we just split, in box0 and box2. - \unvbox\partialpage - % - \hsize = \doublecolumnhsize - \wd0=\hsize \wd2=\hsize - \hbox to\pagewidth{\box0\hfil\box2}% -} -\def\enddoublecolumns{% - \output = {% - % Split the last of the double-column material. Leave it on the - % current page, no automatic page break. - \balancecolumns - % - % If we end up splitting too much material for the current page, - % though, there will be another page break right after this \output - % invocation ends. Having called \balancecolumns once, we do not - % want to call it again. Therefore, reset \output to its normal - % definition right away. (We hope \balancecolumns will never be - % called on to balance too much material, but if it is, this makes - % the output somewhat more palatable.) - \global\output = {\onepageout{\pagecontents\PAGE}}% - }% - \eject - \endgroup % started in \begindoublecolumns - % - % \pagegoal was set to the doubled \vsize above, since we restarted - % the current page. We're now back to normal single-column - % typesetting, so reset \pagegoal to the normal \vsize (after the - % \endgroup where \vsize got restored). - \pagegoal = \vsize -} -\def\balancecolumns{% - % Called at the end of the double column material. - \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. - \dimen@ = \ht0 - \advance\dimen@ by \topskip - \advance\dimen@ by-\baselineskip - \divide\dimen@ by 2 % target to split to - %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% - \splittopskip = \topskip - % Loop until we get a decent breakpoint. - {% - \vbadness = 10000 - \loop - \global\setbox3 = \copy0 - \global\setbox1 = \vsplit3 to \dimen@ - \ifdim\ht3>\dimen@ - \global\advance\dimen@ by 1pt - \repeat - }% - %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% - \setbox0=\vbox to\dimen@{\unvbox1}% - \setbox2=\vbox to\dimen@{\unvbox3}% - % - \pagesofar -} -\catcode`\@ = \other - - -\message{sectioning,} -% Chapters, sections, etc. - -\newcount\chapno -\newcount\secno \secno=0 -\newcount\subsecno \subsecno=0 -\newcount\subsubsecno \subsubsecno=0 - -% This counter is funny since it counts through charcodes of letters A, B, ... -\newcount\appendixno \appendixno = `\@ -% \def\appendixletter{\char\the\appendixno} -% We do the following for the sake of pdftex, which needs the actual -% letter in the expansion, not just typeset. -\def\appendixletter{% - \ifnum\appendixno=`A A% - \else\ifnum\appendixno=`B B% - \else\ifnum\appendixno=`C C% - \else\ifnum\appendixno=`D D% - \else\ifnum\appendixno=`E E% - \else\ifnum\appendixno=`F F% - \else\ifnum\appendixno=`G G% - \else\ifnum\appendixno=`H H% - \else\ifnum\appendixno=`I I% - \else\ifnum\appendixno=`J J% - \else\ifnum\appendixno=`K K% - \else\ifnum\appendixno=`L L% - \else\ifnum\appendixno=`M M% - \else\ifnum\appendixno=`N N% - \else\ifnum\appendixno=`O O% - \else\ifnum\appendixno=`P P% - \else\ifnum\appendixno=`Q Q% - \else\ifnum\appendixno=`R R% - \else\ifnum\appendixno=`S S% - \else\ifnum\appendixno=`T T% - \else\ifnum\appendixno=`U U% - \else\ifnum\appendixno=`V V% - \else\ifnum\appendixno=`W W% - \else\ifnum\appendixno=`X X% - \else\ifnum\appendixno=`Y Y% - \else\ifnum\appendixno=`Z Z% - % The \the is necessary, despite appearances, because \appendixletter is - % expanded while writing the .toc file. \char\appendixno is not - % expandable, thus it is written literally, thus all appendixes come out - % with the same letter (or @) in the toc without it. - \else\char\the\appendixno - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} - -% Each @chapter defines this as the name of the chapter. -% page headings and footings can use it. @section does likewise. -\def\thischapter{} -\def\thissection{} - -\newcount\absseclevel % used to calculate proper heading level -\newcount\secbase\secbase=0 % @raise/lowersections modify this count - -% @raisesections: treat @section as chapter, @subsection as section, etc. -\def\raisesections{\global\advance\secbase by -1} -\let\up=\raisesections % original BFox name - -% @lowersections: treat @chapter as section, @section as subsection, etc. -\def\lowersections{\global\advance\secbase by 1} -\let\down=\lowersections % original BFox name - -% Choose a numbered-heading macro -% #1 is heading level if unmodified by @raisesections or @lowersections -% #2 is text for heading -\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \chapterzzz{#2} -\or - \seczzz{#2} -\or - \numberedsubseczzz{#2} -\or - \numberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \chapterzzz{#2} - \else - \numberedsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses appendix heading levels -\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \appendixzzz{#2} -\or - \appendixsectionzzz{#2} -\or - \appendixsubseczzz{#2} -\or - \appendixsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \appendixzzz{#2} - \else - \appendixsubsubseczzz{#2} - \fi -\fi -} - -% like \numhead, but chooses numberless heading levels -\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 -\ifcase\absseclevel - \unnumberedzzz{#2} -\or - \unnumberedseczzz{#2} -\or - \unnumberedsubseczzz{#2} -\or - \unnumberedsubsubseczzz{#2} -\else - \ifnum \absseclevel<0 - \unnumberedzzz{#2} - \else - \unnumberedsubsubseczzz{#2} - \fi -\fi -} - -% @chapter, @appendix, @unnumbered. -\def\thischaptername{No Chapter Title} -\outer\def\chapter{\parsearg\chapteryyy} -\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz -\def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec -} - -\outer\def\appendix{\parsearg\appendixyyy} -\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz -\def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\putwordAppendix{} \appendixletter}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\putwordAppendix{} \appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec -} - -% @centerchap is like @unnumbered, but the heading is centered. -\outer\def\centerchap{\parsearg\centerchapyyy} -\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} - -% @top is like @unnumbered. -\outer\def\top{\parsearg\unnumberedyyy} - -\outer\def\unnumbered{\parsearg\unnumberedyyy} -\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz -\def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the<toks register> to achieve this: TeX expands \the<toks> only once, -% simply yielding the contents of <toks register>. (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec -} - -% Sections. -\outer\def\numberedsec{\parsearg\secyyy} -\def\secyyy #1{\numhead1{#1}} % normally calls seczzz -\def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsection{\parsearg\appendixsecyyy} -\outer\def\appendixsec{\parsearg\appendixsecyyy} -\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz -\def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} -\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz -\def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% Subsections. -\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} -\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz -\def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} -\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz -\def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} -\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz -\def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% Subsubsections. -\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} -\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz -\def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak -} - -\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} -\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz -\def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak -} - -\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} -\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz -\def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}}}% -\temp -\unnumbnoderef -\nobreak -} - -% These are variants which are not "outer", so they can appear in @ifinfo. -% Actually, they should now be obsolete; ordinary section commands should work. -\def\infotop{\parsearg\unnumberedzzz} -\def\infounnumbered{\parsearg\unnumberedzzz} -\def\infounnumberedsec{\parsearg\unnumberedseczzz} -\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} -\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} - -\def\infoappendix{\parsearg\appendixzzz} -\def\infoappendixsec{\parsearg\appendixseczzz} -\def\infoappendixsubsec{\parsearg\appendixsubseczzz} -\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} - -\def\infochapter{\parsearg\chapterzzz} -\def\infosection{\parsearg\sectionzzz} -\def\infosubsection{\parsearg\subsectionzzz} -\def\infosubsubsection{\parsearg\subsubsectionzzz} - -% These macros control what the section commands do, according -% to what kind of chapter we are in (ordinary, appendix, or unnumbered). -% Define them by default for a numbered chapter. -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec - -% Define @majorheading, @heading and @subheading - -% NOTE on use of \vbox for chapter headings, section headings, and such: -% 1) We use \vbox rather than the earlier \line to permit -% overlong headings to fold. -% 2) \hyphenpenalty is set to 10000 because hyphenation in a -% heading is obnoxious; this forbids it. -% 3) Likewise, headings look best if no \parindent is used, and -% if justification is not attempted. Hence \raggedright. - - -\def\majorheading{\parsearg\majorheadingzzz} -\def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -\def\chapheading{\parsearg\chapheadingzzz} -\def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} - -% @heading, @subheading, @subsubheading. -\def\heading{\parsearg\plainsecheading} -\def\subheading{\parsearg\plainsubsecheading} -\def\subsubheading{\parsearg\plainsubsubsecheading} - -% These macros generate a chapter, section, etc. heading only -% (including whitespace, linebreaking, etc. around it), -% given all the information in convenient, parsed form. - -%%% Args are the skip and penalty (usually negative) -\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} - -\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} - -%%% Define plain chapter starts, and page on/off switching for it -% Parameter controlling skip before chapter headings (if needed) - -\newskip\chapheadingskip - -\def\chapbreak{\dobreak \chapheadingskip {-4000}} -\def\chappager{\par\vfill\supereject} -\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} - -\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} - -\def\CHAPPAGoff{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chapbreak -\global\let\pagealignmacro=\chappager} - -\def\CHAPPAGon{% -\global\let\contentsalignmacro = \chappager -\global\let\pchapsepmacro=\chappager -\global\let\pagealignmacro=\chappager -\global\def\HEADINGSon{\HEADINGSsingle}} - -\def\CHAPPAGodd{ -\global\let\contentsalignmacro = \chapoddpage -\global\let\pchapsepmacro=\chapoddpage -\global\let\pagealignmacro=\chapoddpage -\global\def\HEADINGSon{\HEADINGSdouble}} - -\CHAPPAGon - -\def\CHAPFplain{ -\global\let\chapmacro=\chfplain -\global\let\unnumbchapmacro=\unnchfplain -\global\let\centerchapmacro=\centerchfplain} - -% Plain chapter opening. -% #1 is the text, #2 the chapter number or empty if unnumbered. -\def\chfplain#1#2{% - \pchapsepmacro - {% - \chapfonts \rm - \def\chapnum{#2}% - \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 \centerparametersmaybe - \unhbox0 #1\par}% - }% - \nobreak\bigskip % no page break after a chapter title - \nobreak -} - -% Plain opening for unnumbered. -\def\unnchfplain#1{\chfplain{#1}{}} - -% @centerchap -- centered and unnumbered. -\let\centerparametersmaybe = \relax -\def\centerchfplain#1{{% - \def\centerparametersmaybe{% - \advance\rightskip by 3\rightskip - \leftskip = \rightskip - \parfillskip = 0pt - }% - \chfplain{#1}{}% -}} - -\CHAPFplain % The default - -\def\unnchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\nobreak -} - -\def\chfopen #1#2{\chapoddpage {\chapfonts -\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% -\par\penalty 5000 % -} - -\def\centerchfopen #1{% -\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt - \hfill {\rm #1}\hfill}}\bigskip \par\nobreak -} - -\def\CHAPFopen{ -\global\let\chapmacro=\chfopen -\global\let\unnumbchapmacro=\unnchfopen -\global\let\centerchapmacro=\centerchfopen} - - -% Section titles. -\newskip\secheadingskip -\def\secheadingbreak{\dobreak \secheadingskip {-1000}} -\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} -\def\plainsecheading#1{\sectionheading{sec}{}{#1}} - -% Subsection titles. -\newskip \subsecheadingskip -\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} -\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} -\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} - -% Subsubsection titles. -\let\subsubsecheadingskip = \subsecheadingskip -\let\subsubsecheadingbreak = \subsecheadingbreak -\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} -\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} - - -% Print any size section title. -% -% #1 is the section type (sec/subsec/subsubsec), #2 is the section -% number (maybe empty), #3 the text. -\def\sectionheading#1#2#3{% - {% - \expandafter\advance\csname #1headingskip\endcsname by \parskip - \csname #1headingbreak\endcsname - }% - {% - % Switch to the right set of fonts. - \csname #1fonts\endcsname \rm - % - % Only insert the separating space if we have a section number. - \def\secnum{#2}% - \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% - % - \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright - \hangindent = \wd0 % zero if no section number - \unhbox0 #3}% - }% - \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak -} - - -\message{toc,} -% Table of contents. -\newwrite\tocfile - -% Write an entry to the toc file, opening it if necessary. -% Called from @chapter, etc. We supply {\folio} at the end of the -% argument, which will end up as the last argument to the \...entry macro. -% -% We open the .toc file here instead of at @setfilename or any other -% given time so that @contents can be put in the document anywhere. -% -\newif\iftocfileopened -\def\writetocentry#1{% - \iftocfileopened\else - \immediate\openout\tocfile = \jobname.toc - \global\tocfileopenedtrue - \fi - \iflinks \write\tocfile{#1{\folio}}\fi -} - -\newskip\contentsrightmargin \contentsrightmargin=1in -\newcount\savepageno -\newcount\lastnegativepageno \lastnegativepageno = -1 - -% Finish up the main text and prepare to read what we've written -% to \tocfile. -% -\def\startcontents#1{% - % If @setchapternewpage on, and @headings double, the contents should - % start on an odd page, unlike chapters. Thus, we maintain - % \contentsalignmacro in parallel with \pagealignmacro. - % From: Torbjorn Granlund <tege@matematik.su.se> - \contentsalignmacro - \immediate\closeout\tocfile - % - % Don't need to put `Contents' or `Short Contents' in the headline. - % It is abundantly clear what they are. - \unnumbchapmacro{#1}\def\thischapter{}% - \savepageno = \pageno - \begingroup % Set up to handle contents files properly. - \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 - % We can't do this, because then an actual ^ in a section - % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. - %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi - \raggedbottom % Worry more about breakpoints than the bottom. - \advance\hsize by -\contentsrightmargin % Don't use the full line length. - % - % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi -} - - -% Normal (long) toc. -\def\contents{% - \startcontents{\putwordTOC}% - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \pdfmakeoutlines - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno -} - -% And just the chapters. -\def\summarycontents{% - \startcontents{\putwordShortTOC}% - % - \let\chapentry = \shortchapentry - \let\unnumbchapentry = \shortunnumberedentry - % We want a true roman here for the page numbers. - \secfonts - \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl - \rm - \hyphenpenalty = 10000 - \advance\baselineskip by 1pt % Open it up a little. - \def\secentry ##1##2##3##4{} - \def\unnumbsecentry ##1##2{} - \def\subsecentry ##1##2##3##4##5{} - \def\unnumbsubsecentry ##1##2{} - \def\subsubsecentry ##1##2##3##4##5##6{} - \def\unnumbsubsubsecentry ##1##2{} - \openin 1 \jobname.toc - \ifeof 1 \else - \closein 1 - \input \jobname.toc - \fi - \vfill \eject - \contentsalignmacro % in case @setchapternewpage odd is in effect - \endgroup - \lastnegativepageno = \pageno - \pageno = \savepageno -} -\let\shortcontents = \summarycontents - -\ifpdf - \pdfcatalog{/PageMode /UseOutlines}% -\fi - -% These macros generate individual entries in the table of contents. -% The first argument is the chapter or section name. -% The last argument is the page number. -% The arguments in between are the chapter number, section number, ... - -% Chapter-level things, for both the long and short contents. -\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} - -% See comments in \dochapentry re vbox and related settings -\def\shortchapentry#1#2#3{% - \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% -} - -% Typeset the label for a chapter or appendix for the short contents. -% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. -% We could simplify the code here by writing out an \appendixentry -% command in the toc file for appendices, instead of using \chapentry -% for both, but it doesn't seem worth it. -% -\newdimen\shortappendixwidth -% -\def\shortchaplabel#1{% - % Compute width of word "Appendix", may change with language. - \setbox0 = \hbox{\shortcontrm \putwordAppendix}% - \shortappendixwidth = \wd0 - % - % We typeset #1 in a box of constant width, regardless of the text of - % #1, so the chapter titles will come out aligned. - \setbox0 = \hbox{#1}% - \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi - % - % This space should be plenty, since a single number is .5em, and the - % widest letter (M) is 1em, at least in the Computer Modern fonts. - % (This space doesn't include the extra space that gets added after - % the label; that gets put in by \shortchapentry above.) - \advance\dimen0 by 1.1em - \hbox to \dimen0{#1\hfil}% -} - -\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} -\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} - -% Sections. -\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} -\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} - -% Subsections. -\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} -\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} - -% And subsubsections. -\def\subsubsecentry#1#2#3#4#5#6{% - \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} -\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} - -% This parameter controls the indentation of the various levels. -\newdimen\tocindent \tocindent = 3pc - -% Now for the actual typesetting. In all these, #1 is the text and #2 is the -% page number. -% -% If the toc has to be broken over pages, we want it to be at chapters -% if at all possible; hence the \penalty. -\def\dochapentry#1#2{% - \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip - \begingroup - \chapentryfonts - \tocentry{#1}{\dopageno\bgroup#2\egroup}% - \endgroup - \nobreak\vskip .25\baselineskip plus.1\baselineskip -} - -\def\dosecentry#1#2{\begingroup - \secentryfonts \leftskip=\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsecentry#1#2{\begingroup - \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -\def\dosubsubsecentry#1#2{\begingroup - \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{\dopageno\bgroup#2\egroup}% -\endgroup} - -% Final typesetting of a toc entry; we use the same \entry macro as for -% the index entries, but we want to suppress hyphenation here. (We -% can't do that in the \entry macro, since index entries might consist -% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) -\def\tocentry#1#2{\begingroup - \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks - % Do not use \turnoffactive in these arguments. Since the toc is - % typeset in cmr, so characters such as _ would come out wrong; we - % have to do the usual translation tricks. - \entry{#1}{#2}% -\endgroup} - -% Space between chapter (or whatever) number and the title. -\def\labelspace{\hskip1em \relax} - -\def\dopageno#1{{\rm #1}} -\def\doshortpageno#1{{\rm #1}} - -\def\chapentryfonts{\secfonts \rm} -\def\secentryfonts{\textfonts} -\let\subsecentryfonts = \textfonts -\let\subsubsecentryfonts = \textfonts - - -\message{environments,} -% @foo ... @end foo. - -% Since these characters are used in examples, it should be an even number of -% \tt widths. Each \tt character is 1en, so two makes it 1em. -% Furthermore, these definitions must come after we define our fonts. -\newbox\dblarrowbox \newbox\longdblarrowbox -\newbox\pushcharbox \newbox\bullbox -\newbox\equivbox \newbox\errorbox - -%{\tentt -%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} -%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} -%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} -%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} -% Adapted from the manmac format (p.420 of TeXbook) -%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex -% depth .1ex\hfil} -%} - -% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -\def\point{$\star$} -\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} -\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} -\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} -\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} - -% Adapted from the TeXbook's \boxit. -{\tentt \global\dimen0 = 3em}% Width of the box. -\dimen2 = .55pt % Thickness of rules -% The text. (`r' is open on the right, `e' somewhat less so on the left.) -\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} - -\global\setbox\errorbox=\hbox to \dimen0{\hfil - \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. - \advance\hsize by -2\dimen2 % Rules. - \vbox{ - \hrule height\dimen2 - \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. - \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. - \kern3pt\vrule width\dimen2}% Space to right. - \hrule height\dimen2} - \hfil} - -% The @error{} command. -\def\error{\leavevmode\lower.7ex\copy\errorbox} - -% @tex ... @end tex escapes into raw Tex temporarily. -% One exception: @ is still an escape character, so that @end tex works. -% But \@ or @@ will get a plain tex @ character. - -\def\tex{\begingroup - \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 - \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie - \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \escapechar=`\\ - % - \let\b=\ptexb - \let\bullet=\ptexbullet - \let\c=\ptexc - \let\,=\ptexcomma - \let\.=\ptexdot - \let\dots=\ptexdots - \let\equiv=\ptexequiv - \let\!=\ptexexclam - \let\i=\ptexi - \let\{=\ptexlbrace - \let\+=\tabalign - \let\}=\ptexrbrace - \let\*=\ptexstar - \let\t=\ptext - % - \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% - \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% - \def\@{@}% -\let\Etex=\endgroup} - -% Define @lisp ... @endlisp. -% @lisp does a \begingroup so it can rebind things, -% including the definition of @endlisp (which normally is erroneous). - -% Amount to narrow the margins by for @lisp. -\newskip\lispnarrowing \lispnarrowing=0.4in - -% This is the definition that ^^M gets inside @lisp, @example, and other -% such environments. \null is better than a space, since it doesn't -% have any width. -\def\lisppar{\null\endgraf} - -% Make each space character in the input produce a normal interword -% space in the output. Don't allow a line break at this space, as this -% is used only in environments like @example, where each line of input -% should produce a line of output anyway. -% -{\obeyspaces % -\gdef\sepspaces{\obeyspaces\let =\tie}} - -% Define \obeyedspace to be our active space, whatever it is. This is -% for use in \parsearg. -{\sepspaces% -\global\let\obeyedspace= } - -% This space is always present above and below environments. -\newskip\envskipamount \envskipamount = 0pt - -% Make spacing and below environment symmetrical. We use \parskip here -% to help in doing that, since in @example-like environments \parskip -% is reset to zero; thus the \afterenvbreak inserts no space -- but the -% start of the next paragraph will insert \parskip -% -\def\aboveenvbreak{{\advance\envskipamount by \parskip -\endgraf \ifdim\lastskip<\envskipamount -\removelastskip \penalty-50 \vskip\envskipamount \fi}} - -\let\afterenvbreak = \aboveenvbreak - -% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. -\let\nonarrowing=\relax - -% @cartouche ... @end cartouche: draw rectangle w/rounded corners around -% environment contents. -\font\circle=lcircle10 -\newdimen\circthick -\newdimen\cartouter\newdimen\cartinner -\newskip\normbskip\newskip\normpskip\newskip\normlskip -\circthick=\fontdimen8\circle -% -\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth -\def\ctr{{\hskip 6pt\circle\char'010}} -\def\cbl{{\circle\char'012\hskip -6pt}} -\def\cbr{{\hskip 6pt\circle\char'011}} -\def\carttop{\hbox to \cartouter{\hskip\lskip - \ctl\leaders\hrule height\circthick\hfil\ctr - \hskip\rskip}} -\def\cartbot{\hbox to \cartouter{\hskip\lskip - \cbl\leaders\hrule height\circthick\hfil\cbr - \hskip\rskip}} -% -\newskip\lskip\newskip\rskip - -\long\def\cartouche{% -\begingroup - \lskip=\leftskip \rskip=\rightskip - \leftskip=0pt\rightskip=0pt %we want these *outside*. - \cartinner=\hsize \advance\cartinner by-\lskip - \advance\cartinner by-\rskip - \cartouter=\hsize - \advance\cartouter by 18.4pt % allow for 3pt kerns on either -% side, and for 6pt waste from -% each corner char, and rule thickness - \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip - % Flag to tell @lisp, etc., not to narrow margin. - \let\nonarrowing=\comment - \vbox\bgroup - \baselineskip=0pt\parskip=0pt\lineskip=0pt - \carttop - \hbox\bgroup - \hskip\lskip - \vrule\kern3pt - \vbox\bgroup - \hsize=\cartinner - \kern3pt - \begingroup - \baselineskip=\normbskip - \lineskip=\normlskip - \parskip=\normpskip - \vskip -\parskip -\def\Ecartouche{% - \endgroup - \kern3pt - \egroup - \kern3pt\vrule - \hskip\rskip - \egroup - \cartbot - \egroup -\endgroup -}} - - -% This macro is called at the beginning of all the @example variants, -% inside a group. -\def\nonfillstart{% - \aboveenvbreak - \inENV % This group ends at the end of the body - \hfuzz = 12pt % Don't be fussy - \sepspaces % Make spaces be word-separators rather than space tokens. - \singlespace - \let\par = \lisppar % don't ignore blank lines - \obeylines % each line of input is a line of output - \parskip = 0pt - \parindent = 0pt - \emergencystretch = 0pt % don't try to avoid overfull boxes - % @cartouche defines \nonarrowing to inhibit narrowing - % at next level down. - \ifx\nonarrowing\relax - \advance \leftskip by \lispnarrowing - \exdentamount=\lispnarrowing - \let\exdent=\nofillexdent - \let\nonarrowing=\relax - \fi -} - -% Define the \E... control sequence only if we are inside the particular -% environment, so the error checking in \end will work. -% -% To end an @example-like environment, we first end the paragraph (via -% \afterenvbreak's vertical glue), and then the group. That way we keep -% the zero \parskip that the environments set -- \parskip glue will be -% inserted at the beginning of the next paragraph in the document, after -% the environment. -% -\def\nonfillfinish{\afterenvbreak\endgroup} - -% @lisp: indented, narrowed, typewriter font. -\def\lisp{\begingroup - \nonfillstart - \let\Elisp = \nonfillfinish - \tt - \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. - \gobble % eat return -} - -% @example: Same as @lisp. -\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} - -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. -% -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. -% Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup - \def\Esmalllisp{\nonfillfinish\endgroup}% - \def\Esmallexample{\nonfillfinish\endgroup}% - \smallfonts - \lisp -} - -% @display: same as @lisp except keep current font. -% -\def\display{\begingroup - \nonfillstart - \let\Edisplay = \nonfillfinish - \gobble -} - -% @smalldisplay (when @smallbook): @display plus smaller fonts. -% -\def\smalldisplayx{\begingroup - \def\Esmalldisplay{\nonfillfinish\endgroup}% - \smallfonts \rm - \display -} - -% @format: same as @display except don't narrow margins. -% -\def\format{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eformat = \nonfillfinish - \gobble -} - -% @smallformat (when @smallbook): @format plus smaller fonts. -% -\def\smallformatx{\begingroup - \def\Esmallformat{\nonfillfinish\endgroup}% - \smallfonts \rm - \format -} - -% @flushleft (same as @format). -% -\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} - -% @flushright. -% -\def\flushright{\begingroup - \let\nonarrowing = t - \nonfillstart - \let\Eflushright = \nonfillfinish - \advance\leftskip by 0pt plus 1fill - \gobble -} - -% @quotation does normal linebreaking (hence we can't use \nonfillstart) -% and narrows the margins. -% -\def\quotation{% - \begingroup\inENV %This group ends at the end of the @quotation body - {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip - \singlespace - \parindent=0pt - % We have retained a nonzero parskip for the environment, since we're - % doing normal filling. So to avoid extra space below the environment... - \def\Equotation{\parskip = 0pt \nonfillfinish}% - % - % @cartouche defines \nonarrowing to inhibit narrowing at next level down. - \ifx\nonarrowing\relax - \advance\leftskip by \lispnarrowing - \advance\rightskip by \lispnarrowing - \exdentamount = \lispnarrowing - \let\nonarrowing = \relax - \fi -} - - -\message{defuns,} -% @defun etc. - -% Allow user to change definition object font (\df) internally -\def\setdeffont #1 {\csname DEF#1\endcsname} - -\newskip\defbodyindent \defbodyindent=.4in -\newskip\defargsindent \defargsindent=50pt -\newskip\deftypemargin \deftypemargin=12pt -\newskip\deflastargmargin \deflastargmargin=18pt - -\newcount\parencount -% define \functionparens, which makes ( and ) and & do special things. -% \functionparens affects the group it is contained in. -\def\activeparens{% -\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active -\catcode`\[=\active \catcode`\]=\active} - -% Make control sequences which act like normal parenthesis chars. -\let\lparen = ( \let\rparen = ) - -{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) - -% Be sure that we always have a definition for `(', etc. For example, -% if the fn name has parens in it, \boldbrax will not be in effect yet, -% so TeX would otherwise complain about undefined control sequence. -\global\let(=\lparen \global\let)=\rparen -\global\let[=\lbrack \global\let]=\rbrack - -\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } -\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} -% This is used to turn on special parens -% but make & act ordinary (given that it's active). -\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} - -% Definitions of (, ) and & used in args for functions. -% This is the definition of ( outside of all parentheses. -\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested - \global\advance\parencount by 1 -} -% -% This is the definition of ( when already inside a level of parens. -\gdef\opnested{\char`\(\global\advance\parencount by 1 } -% -\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. - % also in that case restore the outer-level definition of (. - \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi - \global\advance \parencount by -1 } -% If we encounter &foo, then turn on ()-hacking afterwards -\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } -% -\gdef\normalparens{\boldbrax\let&=\ampnr} -} % End of definition inside \activeparens -%% These parens (in \boldbrax) actually are a little bolder than the -%% contained text. This is especially needed for [ and ] -\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } -\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } -\let\ampnr = \& -\def\lbrb{{\bf\char`\[}} -\def\rbrb{{\bf\char`\]}} - -% Active &'s sneak into the index arguments, so make sure it's defined. -{ - \catcode`& = 13 - \global\let& = \ampnr -} - -% First, defname, which formats the header line itself. -% #1 should be the function name. -% #2 should be the type of definition, such as "Function". - -\def\defname #1#2{% -% Get the values of \leftskip and \rightskip as they were -% outside the @def... -\dimen2=\leftskip -\advance\dimen2 by -\defbodyindent -\noindent -\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% -\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line -\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations -\parshape 2 0in \dimen0 \defargsindent \dimen1 -% Now output arg 2 ("Function" or some such) -% ending at \deftypemargin from the right margin, -% but stuck inside a box of width 0 so it does not interfere with linebreaking -{% Adjust \hsize to exclude the ambient margins, -% so that \rightline will obey them. -\advance \hsize by -\dimen2 -\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% -% Make all lines underfull and no complaints: -\tolerance=10000 \hbadness=10000 -\advance\leftskip by -\defbodyindent -\exdentamount=\defbodyindent -{\df #1}\enskip % Generate function name -} - -% Actually process the body of a definition -% #1 should be the terminating control sequence, such as \Edefun. -% #2 should be the "another name" control sequence, such as \defunx. -% #3 should be the control sequence that actually processes the header, -% such as \defunheader. - -\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % 61 is `=' -\obeylines\activeparens\spacesplit#3} - -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by the space, is the class name. -% -\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} - -% Used for @deftypemethod and @deftypeivar. -% #1 is the \E... control sequence to end the definition (which we define). -% #2 is the \...x control sequence for consecutive fns (which we define). -% #3 is the control sequence to call to resume processing. -% #4, delimited by a space, is the class name. -% #5 is the method's return type. -% -\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} - -% Used for @deftypeop. The change from \deftypemethparsebody is an -% extra argument at the beginning which is the `category', instead of it -% being the hardwired string `Method' or `Instance Variable'. We have -% to account for this both in the \...x definition and in parsing the -% input at hand. Thus also need a control sequence (passed as #5) for -% the \E... definition to assign the category name to. -% -\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV - \medbreak - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 ##2 ##3 {% - \def#4{##1}% - \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} - -\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} - -% These parsing functions are similar to the preceding ones -% except that they do not make parens into active characters. -% These are used for "variables" since they have no arguments. - -\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2{\begingroup\obeylines\spacesplit#3}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup % -\catcode 61=\active % -\obeylines\spacesplit#3} - -% This is used for \def{tp,vr}parsebody. It could probably be used for -% some of the others, too, with some judicious conditionals. -% -\def\parsebodycommon#1#2#3{% - \begingroup\inENV % - \medbreak % - % Define the end token that this defining construct specifies - % so that it will exit this group. - \def#1{\endgraf\endgroup\medbreak}% - \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% - \parindent=0in - \advance\leftskip by \defbodyindent - \exdentamount=\defbodyindent - \begingroup\obeylines -} - -\def\defvrparsebody#1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{#3{#4}}% -} - -% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the -% type is just `struct', because we lose the braces in `{struct -% termios}' when \spacesplit reads its undelimited argument. Sigh. -% \let\deftpparsebody=\defvrparsebody -% -% So, to get around this, we put \empty in with the type name. That -% way, TeX won't find exactly `{...}' as an undelimited argument, and -% won't strip off the braces. -% -\def\deftpparsebody #1#2#3#4 {% - \parsebodycommon{#1}{#2}{#3}% - \spacesplit{\parsetpheaderline{#3{#4}}}\empty -} - -% Fine, but then we have to eventually remove the \empty *and* the -% braces (if any). That's what this does. -% -\def\removeemptybraces\empty#1\relax{#1} - -% After \spacesplit has done its work, this is called -- #1 is the final -% thing to call, #2 the type name (which starts with \empty), and #3 -% (which might be empty) the arguments. -% -\def\parsetpheaderline#1#2#3{% - #1{\removeemptybraces#2\relax}{#3}% -}% - -\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % -\medbreak % -% Define the end token that this defining construct specifies -% so that it will exit this group. -\def#1{\endgraf\endgroup\medbreak}% -\def#2##1 ##2 {\def#4{##1}% -\begingroup\obeylines\spacesplit{#3{##2}}}% -\parindent=0in -\advance\leftskip by \defbodyindent -\exdentamount=\defbodyindent -\begingroup\obeylines\spacesplit{#3{#5}}} - -% Split up #2 at the first space token. -% call #1 with two arguments: -% the first is all of #2 before the space token, -% the second is all of #2 after that space token. -% If #2 contains no space token, all of it is passed as the first arg -% and the second is passed as empty. - -{\obeylines -\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% -\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% -\ifx\relax #3% -#1{#2}{}\else #1{#2}{#3#4}\fi}} - -% So much for the things common to all kinds of definitions. - -% Define @defun. - -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up - -\def\defunargs#1{\functionparens \sl -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Set the font temporarily and use \font in case \setfont made \tensl a macro. -{\tensl\hyphenchar\font=0}% -#1% -{\tensl\hyphenchar\font=45}% -\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -\def\deftypefunargs #1{% -% Expand, preventing hyphenation at `-' chars. -% Note that groups don't affect changes in \hyphenchar. -% Use \boldbraxnoamp, not \functionparens, so that & is not special. -\boldbraxnoamp -\tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak -} - -% Do complete processing of one @defun or @defunx line already parsed. - -% @deffn Command forward-char nchars - -\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} - -\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% -\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defun == @deffn Function - -\def\defun{\defparsebody\Edefun\defunx\defunheader} - -\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDeffunc}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefun int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} - -% #1 is the data type. #2 is the name and args. -\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} -% #1 is the data type, #2 the name, #3 the args. -\def\deftypefunheaderx #1#2 #3\relax{% -\doind {fn}{\code{#2}}% Make entry in function index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% -\deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) - -\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} - -% \defheaderxcond#1\relax$$$ -% puts #1 in @code, followed by a space, but does nothing if #1 is null. -\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} - -% #1 is the classification. #2 is the data type. #3 is the name and args. -\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} -% #1 is the classification, #2 the data type, #3 the name, #4 the args. -\def\deftypefnheaderx #1#2#3 #4\relax{% -\doind {fn}{\code{#3}}% Make entry in function index -\begingroup -\normalparens % notably, turn off `&' magic, which prevents -% at least some C++ text from working -\defname {\defheaderxcond#2\relax$$$#3}{#1}% -\deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defmac == @deffn Macro - -\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} - -\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefmac}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defspec == @deffn Special Form - -\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} - -\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index -\begingroup\defname {#1}{\putwordDefspec}% -\defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody -} - -% @defop CATEGORY CLASS OPERATION ARG... -% -\def\defop #1 {\def\defoptype{#1}% -\defopparsebody\Edefop\defopx\defopheader\defoptype} -% -\def\defopheader#1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % -} - -% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... -% -\def\deftypeop #1 {\def\deftypeopcategory{#1}% - \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader - \deftypeopcategory} -% -% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. -\def\deftypeopheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3} - {\deftypeopcategory\ \putwordon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypemethod CLASS TYPE METHOD ARG... -% -\def\deftypemethod{% - \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} -% -% #1 is the class name, #2 the data type, #3 the method name, #4 the args. -\def\deftypemethodheader#1#2#3#4{% - \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% - \deftypefunargs{#4}% - \endgroup -} - -% @deftypeivar CLASS TYPE VARNAME -% -\def\deftypeivar{% - \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} -% -% #1 is the class name, #2 the data type, #3 the variable name. -\def\deftypeivarheader#1#2#3{% - \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index - \begingroup - \defname{\defheaderxcond#2\relax$$$#3} - {\putwordInstanceVariableof\ \code{#1}}% - \defvarargs{#3}% - \endgroup -} - -% @defmethod == @defop Method -% -\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} -% -% #1 is the class name, #2 the method name, #3 the args. -\def\defmethodheader#1#2#3{% - \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index - \begingroup - \defname{#2}{\putwordMethodon\ \code{#1}}% - \defunargs{#3}% - \endgroup -} - -% @defcv {Class Option} foo-class foo-flag - -\def\defcv #1 {\def\defcvtype{#1}% -\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} - -\def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % -} - -% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME -% -\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} -% -\def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index - \begingroup - \defname{#2}{\putwordInstanceVariableof\ #1}% - \defvarargs{#3}% - \endgroup -} - -% @defvar -% First, define the processing that is wanted for arguments of @defvar. -% This is actually simple: just print them in roman. -% This must expand the args and terminate the paragraph they make up -\def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} - -% @defvr Counter foo-count - -\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} - -\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% -\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} - -% @defvar == @defvr Variable - -\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} - -\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefvar}% -\defvarargs {#2}\endgroup % -} - -% @defopt == @defvr {User Option} - -\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} - -\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index -\begingroup\defname {#1}{\putwordDefopt}% -\defvarargs {#2}\endgroup % -} - -% @deftypevar int foobar - -\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} - -% #1 is the data type. #2 is the name, perhaps followed by text that -% is actually part of the data type, which should not be put into the index. -\def\deftypevarheader #1#2{% -\dovarind#2 \relax% Make entry in variables index -\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} -\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} - -% @deftypevr {Global Flag} int enable - -\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} - -\def\deftypevrheader #1#2#3{\dovarind#3 \relax% -\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak -\endgroup} - -% Now define @deftp -% Args are printed in bold, a slight difference from @defvar. - -\def\deftpargs #1{\bf \defvarargs{#1}} - -% @deftp Class window height width ... - -\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} - -\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% -\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} - -% These definitions are used if you use @defunx (etc.) -% anywhere other than immediately after a @defun or @defunx. -% -\def\defcvx#1 {\errmessage{@defcvx in invalid context}} -\def\deffnx#1 {\errmessage{@deffnx in invalid context}} -\def\defivarx#1 {\errmessage{@defivarx in invalid context}} -\def\defmacx#1 {\errmessage{@defmacx in invalid context}} -\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} -\def\defoptx #1 {\errmessage{@defoptx in invalid context}} -\def\defopx#1 {\errmessage{@defopx in invalid context}} -\def\defspecx#1 {\errmessage{@defspecx in invalid context}} -\def\deftpx#1 {\errmessage{@deftpx in invalid context}} -\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} -\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} -\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} -\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} -\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} -\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} -\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} -\def\defunx#1 {\errmessage{@defunx in invalid context}} -\def\defvarx#1 {\errmessage{@defvarx in invalid context}} -\def\defvrx#1 {\errmessage{@defvrx in invalid context}} - - -\message{macros,} -% @macro. - -% To do this right we need a feature of e-TeX, \scantokens, -% which we arrange to emulate with a temporary file in ordinary TeX. -\ifx\eTeXversion\undefined - \newwrite\macscribble - \def\scanmacro#1{% - \begingroup \newlinechar`\^^M - % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ - % Append \endinput to make sure that TeX does not see the ending newline. - \toks0={#1\endinput}% - \immediate\openout\macscribble=\jobname.tmp - \immediate\write\macscribble{\the\toks0}% - \immediate\closeout\macscribble - \let\xeatspaces\eatspaces - \input \jobname.tmp - \endgroup -} -\else -\def\scanmacro#1{% -\begingroup \newlinechar`\^^M -% Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ -\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} -\fi - -\newcount\paramno % Count of parameters -\newtoks\macname % Macro name -\newif\ifrecursive % Is it recursive? -\def\macrolist{} % List of all defined macros in the form - % \do\macro1\do\macro2... - -% Utility routines. -% Thisdoes \let #1 = #2, except with \csnames. -\def\cslet#1#2{% -\expandafter\expandafter -\expandafter\let -\expandafter\expandafter -\csname#1\endcsname -\csname#2\endcsname} - -% Trim leading and trailing spaces off a string. -% Concepts from aro-bend problem 15 (see CTAN). -{\catcode`\@=11 -\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} -\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} -\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} -\def\unbrace#1{#1} -\unbrace{\gdef\trim@@@ #1 } #2@{#1} -} - -% Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% -\gdef\eatcr #1{\eatcra #1Q^^MQ}% -\gdef\eatcra#1^^MQ{\eatcrb#1Q}% -\gdef\eatcrb#1Q#2Q{#1}% -} - -% Macro bodies are absorbed as an argument in a context where -% all characters are catcode 10, 11 or 12, except \ which is active -% (as in normal texinfo). It is necessary to change the definition of \. - -% It's necessary to have hard CRs when the macro is executed. This is -% done by making ^^M (\endlinechar) catcode 12 when reading the macro -% body, and then making it the \newlinechar in \scanmacro. - -\def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 - \usembodybackslash} - -\def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} - -% \mbodybackslash is the definition of \ in @macro bodies. -% It maps \foo\ => \csname macarg.foo\endcsname => #N -% where N is the macro parameter number. -% We define \csname macarg.\endcsname to be \realbackslash, so -% \\ in macro replacement text gets you a backslash. - -{\catcode`@=0 @catcode`@\=@active - @gdef@usembodybackslash{@let\=@mbodybackslash} - @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} -} -\expandafter\def\csname macarg.\endcsname{\realbackslash} - -\def\macro{\recursivefalse\parsearg\macroxxx} -\def\rmacro{\recursivetrue\parsearg\macroxxx} - -\def\macroxxx#1{% - \getargs{#1}% now \macname is the macname and \argl the arglist - \ifx\argl\empty % no arguments - \paramno=0% - \else - \expandafter\parsemargdef \argl;% - \fi - \if1\csname ismacro.\the\macname\endcsname - \message{Warning: redefining \the\macname}% - \else - \expandafter\ifx\csname \the\macname\endcsname \relax - \else \errmessage{The name \the\macname\space is reserved}\fi - \global\cslet{macsave.\the\macname}{\the\macname}% - \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% - % Add the macroname to \macrolist - \toks0 = \expandafter{\macrolist\do}% - \xdef\macrolist{\the\toks0 - \expandafter\noexpand\csname\the\macname\endcsname}% - \fi - \begingroup \macrobodyctxt - \ifrecursive \expandafter\parsermacbody - \else \expandafter\parsemacbody - \fi} - -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% - \if1\csname ismacro.#1\endcsname - \global\cslet{#1}{macsave.#1}% - \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist - \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist - \endgroup - \else - \errmessage{Macro #1 not defined}% - \fi -} - -% This makes use of the obscure feature that if the last token of a -% <parameter list> is #, then the preceding argument is delimited by -% an opening brace, and that opening brace is not consumed. -\def\getargs#1{\getargsxxx#1{}} -\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} -\def\getmacname #1 #2\relax{\macname={#1}} -\def\getmacargs#1{\def\argl{#1}} - -% Parse the optional {params} list. Set up \paramno and \paramlist -% so \defmacro knows what to do. Define \macarg.blah for each blah -% in the params list, to be ##N where N is the position in that list. -% That gets used by \mbodybackslash (above). - -% We need to get `macro parameter char #' into several definitions. -% The technique used is stolen from LaTeX: let \hash be something -% unexpandable, insert that wherever you need a #, and then redefine -% it to # just before using the token list produced. -% -% The same technique is used to protect \eatspaces till just before -% the macro is used. - -\def\parsemargdef#1;{\paramno=0\def\paramlist{}% - \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} -\def\parsemargdefxxx#1,{% - \if#1;\let\next=\relax - \else \let\next=\parsemargdefxxx - \advance\paramno by 1% - \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname - {\xeatspaces{\hash\the\paramno}}% - \edef\paramlist{\paramlist\hash\the\paramno,}% - \fi\next} - -% These two commands read recursive and nonrecursive macro bodies. -% (They're different since rec and nonrec macros end differently.) - -\long\def\parsemacbody#1@end macro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% -\long\def\parsermacbody#1@end rmacro% -{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% - -% This defines the macro itself. There are six cases: recursive and -% nonrecursive macros of zero, one, and many arguments. -% Much magic with \expandafter here. -% \xdef is used so that macro definitions will survive the file -% they're defined in; @include reads the file inside a group. -\def\defmacro{% - \let\hash=##% convert placeholders to macro parameter chars - \ifrecursive - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\scanmacro{\temp}}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup\noexpand\scanmacro{\temp}}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{\egroup\noexpand\scanmacro{\temp}}% - \fi - \else - \ifcase\paramno - % 0 - \expandafter\xdef\csname\the\macname\endcsname{% - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \or % 1 - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \noexpand\braceorline - \expandafter\noexpand\csname\the\macname xxx\endcsname}% - \expandafter\xdef\csname\the\macname xxx\endcsname##1{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \else % many - \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt - \expandafter\noexpand\csname\the\macname xx\endcsname}% - \expandafter\xdef\csname\the\macname xx\endcsname##1{% - \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% - \expandafter\expandafter - \expandafter\xdef - \expandafter\expandafter - \csname\the\macname xxx\endcsname - \paramlist{% - \egroup - \noexpand\norecurse{\the\macname}% - \noexpand\scanmacro{\temp}\egroup}% - \fi - \fi} - -\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} - -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg) -\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} -\def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg - \fi \next} - -% We mant to disable all macros during \shipout so that they are not -% expanded by \write. -\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% - \edef\next{\macrolist}\expandafter\endgroup\next} - - -% @alias. -% We need some trickery to remove the optional spaces around the equal -% sign. Just make them active and then expand them all to nothing. -\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} -\def\aliasxxx #1{\aliasyyy#1\relax} -\def\aliasyyy #1=#2\relax{\ignoreactivespaces -\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% - \expandafter\noexpand\csname#2\endcsname}% -\expandafter\endgroup\next} - - -\message{cross references,} -% @xref etc. - -\newwrite\auxfile - -\newif\ifhavexrefs % True if xref values are known. -\newif\ifwarnedxrefs % True if we warned once that they aren't known. - -% @inforef is relatively simple. -\def\inforef #1{\inforefzzz #1,,,,**} -\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, - node \samp{\ignorespaces#1{}}} - -% @node's job is to define \lastnode. -\def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} -\let\nwnode=\node -\let\lastnode=\relax - -% The sectioning commands (@chapter, etc.) call these. -\def\donoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Ysectionnumberandtype}% - \global\let\lastnode=\relax - \fi -} -\def\unnumbnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% - \global\let\lastnode=\relax - \fi -} -\def\appendixnoderef{% - \ifx\lastnode\relax\else - \expandafter\expandafter\expandafter\setref{\lastnode}% - {Yappendixletterandtype}% - \global\let\lastnode=\relax - \fi -} - - -% @anchor{NAME} -- define xref target at arbitrary point. -% -\newcount\savesfregister -\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} -\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} -\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} - -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. -% -\def\setref#1#2{{% - \indexdummies - \pdfmkdest{#1}% - \dosetq{#1-title}{Ytitle}% - \dosetq{#1-pg}{Ypagenumber}% - \dosetq{#1-snt}{#2}% -}} - -% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is -% the node name, #2 the name of the Info cross-reference, #3 the printed -% node name, #4 the name of the Info file, #5 the name of the printed -% manual. All but the node name can be omitted. -% -\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} -\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} -\def\ref#1{\xrefX[#1,,,,,,,]} -\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup - \unsepspaces - \def\printedmanual{\ignorespaces #5}% - \def\printednodename{\ignorespaces #3}% - \setbox1=\hbox{\printedmanual}% - \setbox0=\hbox{\printednodename}% - \ifdim \wd0 = 0pt - % No printed node name was explicitly given. - \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax - % Use the node name inside the square brackets. - \def\printednodename{\ignorespaces #1}% - \else - % Use the actual chapter/section title appear inside - % the square brackets. Use the real section title if we have it. - \ifdim \wd1 > 0pt - % It is in another manual, so we don't have it. - \def\printednodename{\ignorespaces #1}% - \else - \ifhavexrefs - % We know the real title if we have the xref values. - \def\printednodename{\refx{#1-title}{}}% - \else - % Otherwise just copy the Info node name. - \def\printednodename{\ignorespaces #1}% - \fi% - \fi - \fi - \fi - % - % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not - % insert empty discretionaries after hyphens, which means that it will - % not find a line break at a hyphen in a node names. Since some manuals - % are best written with fairly long node names, containing hyphens, this - % is a loss. Therefore, we give the text of the node name again, so it - % is as if TeX is seeing it for the first time. - \ifpdf - \leavevmode - \getfilename{#4}% - \ifnum\filenamelength>0 - \startlink attr{/Border [0 0 0]}% - goto file{\the\filename.pdf} name{#1@}% - \else - \startlink attr{/Border [0 0 0]}% - goto name{#1@}% - \fi - \linkcolor - \fi - % - \ifdim \wd1 > 0pt - \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% - \else - % _ (for example) has to be the character _ for the purposes of the - % control sequence corresponding to the node, but it has to expand - % into the usual \leavevmode...\vrule stuff for purposes of - % printing. So we \turnoffactive for the \refx-snt, back on for the - % printing, back off for the \refx-pg. - {\normalturnoffactive - % Only output a following space if the -snt ref is nonempty; for - % @unnumbered and @anchor, it won't be. - \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% - \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi - }% - % [mynode], - [\printednodename],\space - % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% - \fi - \endlink -\endgroup} - -% \dosetq is the interface for calls from other macros - -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) -\def\dosetq#1#2{% - {\let\folio=0% - \normalturnoffactive - \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi - }% -} - -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq - -\def\Ypagenumber{\folio} - -\def\Ytitle{\thissection} - -\def\Ynothing{} - -\def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} - -% Use TeX 3.0's \inputlineno to get the line number, for better error -% messages, but if we're using an old version of TeX, don't do anything. -% -\ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. -\else - \def\linenumber{\the\inputlineno:\space} -\fi - -% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. -% If its value is nonempty, SUFFIX is output afterward. - -\def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax - % If not defined, say something at least. - \angleleft un\-de\-fined\angleright - \iflinks - \ifhavexrefs - \message{\linenumber Undefined cross reference `#1'.}% - \else - \ifwarnedxrefs\else - \global\warnedxrefstrue - \message{Cross reference values unknown; you must run TeX again.}% - \fi - \fi - \fi - \else - % It's defined, so just use it. - \csname X#1\endcsname - \fi - #2% Output the suffix in any case. -} - -% This is the macro invoked by entries in the aux file. -% -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname -} - -% Read the last existing aux file, if any. No error if none exists. -\def\readauxfile{\begingroup - \catcode`\^^@=\other - \catcode`\^^A=\other - \catcode`\^^B=\other - \catcode`\^^C=\other - \catcode`\^^D=\other - \catcode`\^^E=\other - \catcode`\^^F=\other - \catcode`\^^G=\other - \catcode`\^^H=\other - \catcode`\^^K=\other - \catcode`\^^L=\other - \catcode`\^^N=\other - \catcode`\^^P=\other - \catcode`\^^Q=\other - \catcode`\^^R=\other - \catcode`\^^S=\other - \catcode`\^^T=\other - \catcode`\^^U=\other - \catcode`\^^V=\other - \catcode`\^^W=\other - \catcode`\^^X=\other - \catcode`\^^Z=\other - \catcode`\^^[=\other - \catcode`\^^\=\other - \catcode`\^^]=\other - \catcode`\^^^=\other - \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. - % in xref tags, i.e., node names. But since ^^e4 notation isn't - % supported in the main text, it doesn't seem desirable. Furthermore, - % that is not enough: for node names that actually contain a ^ - % character, we would end up writing a line like this: 'xrdef {'hat - % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first - % argument, and \hat is not an expandable control sequence. It could - % all be worked out, but why? Either we support ^^ or we don't. - % - % The other change necessary for this was to define \auxhat: - % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter - % and then to call \auxhat in \setq. - % - \catcode`\~=\other - \catcode`\[=\other - \catcode`\]=\other - \catcode`\"=\other - \catcode`\_=\other - \catcode`\|=\other - \catcode`\<=\other - \catcode`\>=\other - \catcode`\$=\other - \catcode`\#=\other - \catcode`\&=\other - \catcode`+=\other % avoid \+ for paranoia even though we've turned it off - % Make the characters 128-255 be printing characters - {% - \count 1=128 - \def\loop{% - \catcode\count 1=\other - \advance\count 1 by 1 - \ifnum \count 1<256 \loop \fi - }% - }% - % The aux file uses ' as the escape (for now). - % Turn off \ as an escape so we do not lose on - % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ - % Reference to such entries still does not work the way one would wish, - % but at least they do not bomb out when the aux file is read in. - \catcode`\{=1 - \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other - % - \openin 1 \jobname.aux - \ifeof 1 \else - \closein 1 - \input \jobname.aux - \global\havexrefstrue - \global\warnedobstrue - \fi - % Open the new aux file. TeX will close it automatically at exit. - \openout\auxfile=\jobname.aux -\endgroup} - - -% Footnotes. - -\newcount \footnoteno - -% The trailing space in the following definition for supereject is -% vital for proper filling; pages come out unaligned when you do a -% pagealignmacro call if that space before the closing brace is -% removed. (Generally, numeric constants should always be followed by a -% space to prevent strange expansion errors.) -\def\supereject{\par\penalty -20000\footnoteno =0 } - -% @footnotestyle is meaningful for info output only. -\let\footnotestyle=\comment - -\let\ptexfootnote=\footnote - -{\catcode `\@=11 -% -% Auto-number footnotes. Otherwise like plain. -\gdef\footnote{% - \global\advance\footnoteno by \@ne - \edef\thisfootno{$^{\the\footnoteno}$}% - % - % In case the footnote comes at the end of a sentence, preserve the - % extra spacing after we do the footnote number. - \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi - % - % Remove inadvertent blank space before typesetting the footnote number. - \unskip - \thisfootno\@sf - \footnotezzz -}% - -% Don't bother with the trickery in plain.tex to not require the -% footnote text as a parameter. Our footnotes don't need to be so general. -% -% Oh yes, they do; otherwise, @ifset and anything else that uses -% \parseargline fail inside footnotes because the tokens are fixed when -% the footnote is read. --karl, 16nov96. -% -\long\gdef\footnotezzz{\insert\footins\bgroup - % We want to typeset this text as a normal paragraph, even if the - % footnote reference occurs in (for example) a display environment. - % So reset some parameters. - \interlinepenalty\interfootnotelinepenalty - \splittopskip\ht\strutbox % top baseline for broken footnotes - \splitmaxdepth\dp\strutbox - \floatingpenalty\@MM - \leftskip\z@skip - \rightskip\z@skip - \spaceskip\z@skip - \xspaceskip\z@skip - \parindent\defaultparindent - % - \smallfonts \rm - % - % Hang the footnote text off the number. - \hang - \textindent{\thisfootno}% - % - % Don't crash into the line above the footnote text. Since this - % expands into a box, it must come within the paragraph, lest it - % provide a place where TeX can split the footnote. - \footstrut - \futurelet\next\fo@t -} -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\par\egroup} - -}%end \catcode `\@=11 - -% Set the baselineskip to #1, and the lineskip and strut size -% correspondingly. There is no deep meaning behind these magic numbers -% used as factors; they just match (closely enough) what Knuth defined. -% -\def\lineskipfactor{.08333} -\def\strutheightpercent{.70833} -\def\strutdepthpercent {.29167} -% -\def\setleading#1{% - \normalbaselineskip = #1\relax - \normallineskip = \lineskipfactor\normalbaselineskip - \normalbaselines - \setbox\strutbox =\hbox{% - \vrule width0pt height\strutheightpercent\baselineskip - depth \strutdepthpercent \baselineskip - }% -} - -% @| inserts a changebar to the left of the current line. It should -% surround any changed text. This approach does *not* work if the -% change spans more than two lines of output. To handle that, we would -% have adopt a much more difficult approach (putting marks into the main -% vertical list for the beginning and end of each change). -% -\def\|{% - % \vadjust can only be used in horizontal mode. - \leavevmode - % - % Append this vertical mode material after the current line in the output. - \vadjust{% - % We want to insert a rule with the height and depth of the current - % leading; that is exactly what \strutbox is supposed to record. - \vskip-\baselineskip - % - % \vadjust-items are inserted at the left edge of the type. So - % the \llap here moves out into the left-hand margin. - \llap{% - % - % For a thicker or thinner bar, change the `1pt'. - \vrule height\baselineskip width1pt - % - % This is the space between the bar and the text. - \hskip 12pt - }% - }% -} - -% For a final copy, take out the rectangles -% that mark overfull boxes (in case you have decided -% that the text looks ok even though it passes the margin). -% -\def\finalout{\overfullrule=0pt} - -% @image. We use the macros from epsf.tex to support this. -% If epsf.tex is not installed and @image is used, we complain. -% -% Check for and read epsf.tex up front. If we read it only at @image -% time, we might be inside a group, and then its definitions would get -% undone and the next image would fail. -\openin 1 = epsf.tex -\ifeof 1 \else - \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). - \def\epsfannounce{\toks0 = }% - \input epsf.tex -\fi -% -% We will only complain once about lack of epsf.tex. -\newif\ifwarnednoepsf -\newhelp\noepsfhelp{epsf.tex must be installed for images to - work. It is also included in the Texinfo distribution, or you can get - it from ftp://tug.org/tex/epsf.tex.} -% -\def\image#1{% - \ifx\epsfbox\undefined - \ifwarnednoepsf \else - \errhelp = \noepsfhelp - \errmessage{epsf.tex not found, images will be ignored}% - \global\warnednoepsftrue - \fi - \else - \imagexxx #1,,,\finish - \fi -} -% -% Arguments to @image: -% #1 is (mandatory) image filename; we tack on .eps extension. -% #2 is (optional) width, #3 is (optional) height. -% #4 is just the usual extra ignored arg for parsing this stuff. -\def\imagexxx#1,#2,#3,#4\finish{% - \ifpdf - \centerline{\dopdfimage{#1}{#2}{#3}}% - \else - % \epsfbox itself resets \epsf?size at each figure. - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi - \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi - \begingroup - \catcode`\^^M = 5 % in case we're inside an example - % If the image is by itself, center it. - \ifvmode - \nobreak\bigskip - % Usually we'll have text after the image which will insert - % \parskip glue, so insert it here too to equalize the space - % above and below. - \nobreak\vskip\parskip - \nobreak - \centerline{\epsfbox{#1.eps}}% - \bigbreak - \else - % In the middle of a paragraph, no extra space. - \epsfbox{#1.eps}% - \fi - \endgroup - \fi -} - - -\message{localization,} -% and i18n. - -% @documentlanguage is usually given very early, just after -% @setfilename. If done too late, it may not override everything -% properly. Single argument is the language abbreviation. -% It would be nice if we could set up a hyphenation file here. -% -\def\documentlanguage{\parsearg\dodocumentlanguage} -\def\dodocumentlanguage#1{% - \tex % read txi-??.tex file in plain TeX. - % Read the file if it exists. - \openin 1 txi-#1.tex - \ifeof1 - \errhelp = \nolanghelp - \errmessage{Cannot read language file txi-#1.tex}% - \let\temp = \relax - \else - \def\temp{\input txi-#1.tex }% - \fi - \temp - \endgroup -} -\newhelp\nolanghelp{The given language definition file cannot be found or -is empty. Maybe you need to install it? In the current directory -should work if nowhere else does.} - - -% @documentencoding should change something in TeX eventually, most -% likely, but for now just recognize it. -\let\documentencoding = \comment - - -% Page size parameters. -% -\newdimen\defaultparindent \defaultparindent = 15pt - -\chapheadingskip = 15pt plus 4pt minus 2pt -\secheadingskip = 12pt plus 3pt minus 2pt -\subsecheadingskip = 9pt plus 2pt minus 2pt - -% Prevent underfull vbox error messages. -\vbadness = 10000 - -% Don't be so finicky about underfull hboxes, either. -\hbadness = 2000 - -% Following George Bush, just get rid of widows and orphans. -\widowpenalty=10000 -\clubpenalty=10000 - -% Use TeX 3.0's \emergencystretch to help line breaking, but if we're -% using an old version of TeX, don't do anything. We want the amount of -% stretch added to depend on the line length, hence the dependence on -% \hsize. We call this whenever the paper size is set. -% -\def\setemergencystretch{% - \ifx\emergencystretch\thisisundefined - % Allow us to assign to \emergencystretch anyway. - \def\emergencystretch{\dimen0}% - \else - \emergencystretch = .15\hsize - \fi -} - -% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; -% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can -% set \parskip and call \setleading for \baselineskip. -% -\def\internalpagesizes#1#2#3#4#5#6{% - \voffset = #3\relax - \topskip = #6\relax - \splittopskip = \topskip - % - \vsize = #1\relax - \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin - \pageheight = \vsize - % - \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in - \pagewidth = \hsize - % - \normaloffset = #4\relax - \bindingoffset = #5\relax - % - \parindent = \defaultparindent - \setemergencystretch -} - -% @letterpaper (the default). -\def\letterpaper{{\globaldefs = 1 - \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% - % - % If page is nothing but text, make it come out even. - \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% -}} - -% Use @smallbook to reset parameters for 7x9.5 (or so) format. -\def\smallbook{{\globaldefs = 1 - \parskip = 2pt plus 1pt - \setleading{12pt}% - % - \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% - % - \lispnarrowing = 0.3in - \tolerance = 700 - \hfuzz = 1pt - \contentsrightmargin = 0pt - \deftypemargin = 0pt - \defbodyindent = .5cm - % - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx -}} - -% Use @afourpaper to print on European A4 paper. -\def\afourpaper{{\globaldefs = 1 - \setleading{12pt}% - \parskip = 3pt plus 2pt minus 1pt - % - \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% - % - \tolerance = 700 - \hfuzz = 1pt -}} - -% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin -% 29mm, hence bottom margin 28mm, nominal side margin 3cm. -\def\afourlatex{{\globaldefs = 1 - \setleading{13.6pt}% - % - \afourpaper - \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% - % - \globaldefs = 0 -}} - -% Use @afourwide to print on European A4 paper in wide format. -\def\afourwide{% - \afourpaper - \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% - % - \globaldefs = 0 -} - -% @pagesizes TEXTHEIGHT[,TEXTWIDTH] -% Perhaps we should allow setting the margins, \topskip, \parskip, -% and/or leading, also. Or perhaps we should compute them somehow. -% -\def\pagesizes{\parsearg\pagesizesxxx} -\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} -\def\pagesizesyyy#1,#2,#3\finish{{% - \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi - \globaldefs = 1 - % - \parskip = 3pt plus 2pt minus 1pt - \setleading{13.2pt}% - % - \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% -}} - -% Set default to letter. -% -\letterpaper - - -\message{and turning on texinfo input format.} - -% Define macros to output various characters with catcode for normal text. -\catcode`\"=\other -\catcode`\~=\other -\catcode`\^=\other -\catcode`\_=\other -\catcode`\|=\other -\catcode`\<=\other -\catcode`\>=\other -\catcode`\+=\other -\catcode`\$=\other -\def\normaldoublequote{"} -\def\normaltilde{~} -\def\normalcaret{^} -\def\normalunderscore{_} -\def\normalverticalbar{|} -\def\normalless{<} -\def\normalgreater{>} -\def\normalplus{+} -\def\normaldollar{$} - -% This macro is used to make a character print one way in ttfont -% where it can probably just be output, and another way in other fonts, -% where something hairier probably needs to be done. -% -% #1 is what to print if we are indeed using \tt; #2 is what to print -% otherwise. Since all the Computer Modern typewriter fonts have zero -% interword stretch (and shrink), and it is reasonable to expect all -% typewriter fonts to have this, we can check that font parameter. -% -\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} - -% Same as above, but check for italic font. Actually this also catches -% non-italic slanted fonts since it is impossible to distinguish them from -% italic fonts. But since this is only used by $ and it uses \sl anyway -% this is not a problem. -\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} - -% Turn off all special characters except @ -% (and those which the user can use as if they were ordinary). -% Most of these we simply print from the \tt font, but for some, we can -% use math or other variants that look better in normal text. - -\catcode`\"=\active -\def\activedoublequote{{\tt\char34}} -\let"=\activedoublequote -\catcode`\~=\active -\def~{{\tt\char126}} -\chardef\hat=`\^ -\catcode`\^=\active -\def^{{\tt \hat}} - -\catcode`\_=\active -\def_{\ifusingtt\normalunderscore\_} -% Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} - -\catcode`\|=\active -\def|{{\tt\char124}} -\chardef \less=`\< -\catcode`\<=\active -\def<{{\tt \less}} -\chardef \gtr=`\> -\catcode`\>=\active -\def>{{\tt \gtr}} -\catcode`\+=\active -\def+{{\tt \char 43}} -\catcode`\$=\active -\def${\ifusingit{{\sl\$}}\normaldollar} -%\catcode 27=\active -%\def^^[{$\diamondsuit$} - -% Set up an active definition for =, but don't enable it most of the time. -{\catcode`\==\active -\global\def={{\tt \char 61}}} - -\catcode`+=\active -\catcode`\_=\active - -% If a .fmt file is being used, characters that might appear in a file -% name cannot be active until we have parsed the command line. -% So turn them off again, and have \everyjob (or @setfilename) turn them on. -% \otherifyactive is called near the end of this file. -\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} - -\catcode`\@=0 - -% \rawbackslashxx output one backslash character in current font -\global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} - -% \rawbackslash redefines \ as input to do \rawbackslashxx. -{\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} - -% \normalbackslash outputs one backslash in fixed width font. -\def\normalbackslash{{\tt\rawbackslashxx}} - -% \catcode 17=0 % Define control-q -\catcode`\\=\active - -% Used sometimes to turn off (effectively) the active characters -% even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -@def@normalturnoffactive{@let"=@normaldoublequote -@let\=@normalbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar} - -% Make _ and + \other characters, temporarily. -% This is canceled by @fixbackslash. -@otherifyactive - -% If a .fmt file is being used, we don't want the `\input texinfo' to show up. -% That is what \eatinput is for; after that, the `\' should revert to printing -% a backslash. -% -@gdef@eatinput input texinfo{@fixbackslash} -@global@let\ = @eatinput - -% On the other hand, perhaps the file did not have a `\input texinfo'. Then -% the first `\{ in the file would cause an error. This macro tries to fix -% that, assuming it is called before the first `\' could plausibly occur. -% Also back turn on active characters that might appear in the input -% file name, in case not using a pre-dumped format. -% -@gdef@fixbackslash{% - @ifx\@eatinput @let\ = @normalbackslash @fi - @catcode`+=@active - @catcode`@_=@active -} - -% Say @foo, not \foo, in error messages. -@escapechar = `@@ - -% These look ok in all fonts, so just make them not special. -@catcode`@& = @other -@catcode`@# = @other -@catcode`@% = @other - -@c Set initial fonts. -@textfonts -@rm - - -@c Local variables: -@c eval: (add-hook 'write-file-hooks 'time-stamp) -@c page-delimiter: "^\\\\message" -@c time-stamp-start: "def\\\\texinfoversion{" -@c time-stamp-format: "%:y-%02m-%02d.%02H" -@c time-stamp-end: "}" -@c End: diff --git a/contrib/gperf/lib/Makefile.in b/contrib/gperf/lib/Makefile.in deleted file mode 100644 index 3b1ee9dd34208..0000000000000 --- a/contrib/gperf/lib/Makefile.in +++ /dev/null @@ -1,109 +0,0 @@ -# Makefile for gperf/lib - -# Copyright (C) 1989, 1992, 1993, 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. - -#### 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 : diff --git a/contrib/gperf/lib/configure b/contrib/gperf/lib/configure deleted file mode 100755 index 80fa25bb7f9c6..0000000000000 --- a/contrib/gperf/lib/configure +++ /dev/null @@ -1,1391 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=hash.cc - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:526: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:555: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:585: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:636: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:668: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 679 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:710: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:715: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:743: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:775: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 790 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 807 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 824 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - - for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:859: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:891: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 902 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:933: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:938: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:966: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - - echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:998: checking how to run the C++ preprocessor" >&5 -if test -z "$CXXCPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - CXXCPP="${CXX-g++} -E" - cat > conftest.$ac_ext <<EOF -#line 1011 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CXXCPP=/lib/cpp -fi -rm -f conftest* - ac_cv_prog_CXXCPP="$CXXCPP" -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross -fi -fi -CXXCPP="$ac_cv_prog_CXXCPP" -echo "$ac_t""$CXXCPP" 1>&6 - - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1043: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB="true" -fi -fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - # Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1081: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'cl_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - if test $ac_prog = installbsd && - grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX installbsd doesn't work without option "-g". - : - else - cl_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - fi - done - ;; - esac - done - IFS="$ac_save_ifs" - # As a last resort, use cp. - test -z "$cl_cv_path_install" && cl_cv_path_install="cp" - -fi - INSTALL="$cl_cv_path_install" -fi -echo "$ac_t""$INSTALL" 1>&6 -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)' -if test -z "$INSTALL_DATA"; then - case "$INSTALL" in - cp | */cp ) INSTALL_DATA='$(INSTALL)' ;; - * ) INSTALL_DATA='$(INSTALL) -m 644' ;; - esac -fi - - trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@CXX@%$CXX%g -s%@CXXCPP@%$CXXCPP%g -s%@RANLIB@%$RANLIB%g -s%@INSTALL@%$INSTALL%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/gperf/lib/configure.in b/contrib/gperf/lib/configure.in deleted file mode 100644 index 98266a1239f60..0000000000000 --- a/contrib/gperf/lib/configure.in +++ /dev/null @@ -1,43 +0,0 @@ -dnl autoconf configuration for gperf/lib - -dnl Copyright (C) 1998 Free Software Foundation, Inc. -dnl written by Douglas C. Schmidt (schmidt@ics.uci.edu) -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) diff --git a/contrib/gperf/lib/getopt.c b/contrib/gperf/lib/getopt.c deleted file mode 100644 index 2341d04b22bed..0000000000000 --- a/contrib/gperf/lib/getopt.c +++ /dev/null @@ -1,1042 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98 - Free Software Foundation, Inc. - - 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. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. - Ditto for AIX 3.2 and <stdlib.h>. */ -#ifndef _NO_PROTO -#define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#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__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -#include <stdlib.h> -#include <unistd.h> -#endif /* GNU C library. */ - -#ifdef VMS -#include <unixlib.h> -#if HAVE_STRING_H - 0 -#include <string.h> -#endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -#ifdef HAVE_LIBINTL_H -# include <libintl.h> -# define _(msgid) gettext (msgid) -#else -# define _(msgid) (msgid) -#endif -#endif - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg = NULL; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -int optind = 1; - -/* Formerly, initialization of getopt depended on optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -int __getopt_initialized = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return -1 with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -#include <string.h> -#define my_index strchr -#else - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -extern char *getenv (); -extern int strncmp (); - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -#if !defined __STDC__ || !__STDC__ -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -#endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *_getopt_initialize (int, char *const *, const char *); -#endif -static const char * -_getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns -1. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - optarg = NULL; - - if (optind == 0 || !__getopt_initialized) - { - if (optind == 0) - optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = _getopt_initialize (argc, argv, optstring); - __getopt_initialized = 1; - } - - /* Test whether ARGV[optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ - || (optind < nonoption_flags_len \ - && __getopt_nonoption_flags[optind] == '1')) -#else -#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > optind) - last_nonopt = optind; - if (first_nonopt > optind) - first_nonopt = optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc && NONOPTION_P) - optind++; - last_nonopt = optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[optind][1] == '-' - || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[optind - 1][0], pfound->name); - - nextchar += strlen (nextchar); - - optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct option *p; - const struct option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - - /* optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = nameend + 1; - else - { - if (opterr) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - 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 '?': - 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 */ diff --git a/contrib/gperf/lib/getopt.c.patch b/contrib/gperf/lib/getopt.c.patch deleted file mode 100644 index 6fedd84a8315e..0000000000000 --- a/contrib/gperf/lib/getopt.c.patch +++ /dev/null @@ -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) diff --git a/contrib/gperf/lib/getopt.h b/contrib/gperf/lib/getopt.h deleted file mode 100644 index a9d75f22c815c..0000000000000 --- a/contrib/gperf/lib/getopt.h +++ /dev/null @@ -1,138 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989-1998, 2000 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. */ - -#ifndef _GETOPT_H -#define _GETOPT_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -#if (defined (__STDC__) && __STDC__) || defined (__cplusplus) - const char *name; -#else - char *name; -#endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -#if (defined (__STDC__) && __STDC__) || defined (__cplusplus) -#ifdef __cplusplus -/* SunOS4 declares getopt with the following prototype: - extern int getopt (int argc, const char *const *argv, const char *shortopts); - We cannot redeclare it when compiling C++ code. */ -#define getopt(x,y,z) getopt_long(x, y, z, (const struct option *) 0, (int *) 0) -#else /* not __cplusplus */ -#ifdef __GNU_LIBRARY__ -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int argc, char *const *argv, const char *shortopts); -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -#endif /* __GNU_LIBRARY__ */ -#endif /* __cplusplus */ -extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); -extern int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); -#else /* not __STDC__ */ -extern int getopt (); -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -#endif /* __STDC__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* getopt.h */ diff --git a/contrib/gperf/lib/getopt.h.patch b/contrib/gperf/lib/getopt.h.patch deleted file mode 100644 index 8094b1a65d409..0000000000000 --- a/contrib/gperf/lib/getopt.h.patch +++ /dev/null @@ -1,70 +0,0 @@ -getopt.h is a modified version of the getopt.h 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.h.orig getopt.h -*** getopt.h.orig Sat Jun 21 03:01:53 1997 ---- getopt.h Mon Aug 28 12:36:27 2000 -*************** -*** 1,5 **** - /* Declarations for getopt. -! Copyright (C) 1989,90,91,92,93,94,96,97 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 ---- 1,5 ---- - /* Declarations for getopt. -! Copyright (C) 1989-1998, 2000 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 -*************** -*** 78,84 **** - - struct option - { -! #if defined (__STDC__) && __STDC__ - const char *name; - #else - char *name; ---- 78,84 ---- - - struct option - { -! #if (defined (__STDC__) && __STDC__) || defined (__cplusplus) - const char *name; - #else - char *name; -*************** -*** 96,102 **** - #define required_argument 1 - #define optional_argument 2 - -! #if defined (__STDC__) && __STDC__ - #ifdef __GNU_LIBRARY__ - /* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation ---- 96,108 ---- - #define required_argument 1 - #define optional_argument 2 - -! #if (defined (__STDC__) && __STDC__) || defined (__cplusplus) -! #ifdef __cplusplus -! /* SunOS4 declares getopt with the following prototype: -! extern int getopt (int argc, const char *const *argv, const char *shortopts); -! We cannot redeclare it when compiling C++ code. */ -! #define getopt(x,y,z) getopt_long(x, y, z, (const struct option *) 0, (int *) 0) -! #else /* not __cplusplus */ - #ifdef __GNU_LIBRARY__ - /* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation -*************** -*** 105,110 **** ---- 111,117 ---- - #else /* not __GNU_LIBRARY__ */ - extern int getopt (); - #endif /* __GNU_LIBRARY__ */ -+ #endif /* __cplusplus */ - extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); - extern int getopt_long_only (int argc, char *const *argv, diff --git a/contrib/gperf/lib/getopt1.c b/contrib/gperf/lib/getopt1.c deleted file mode 100644 index 3d264f2db4d5b..0000000000000 --- a/contrib/gperf/lib/getopt1.c +++ /dev/null @@ -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 */ diff --git a/contrib/gperf/lib/hash.cc b/contrib/gperf/lib/hash.cc deleted file mode 100644 index b5bb4ad66836a..0000000000000 --- a/contrib/gperf/lib/hash.cc +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright (C) 1990, 2000 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) -*/ - -#include <hash.h> - -/* - Some useful hash function. - It's not a particularly good hash function (<< 5 would be better than << 4), - but people believe in it because it comes from Dragon book. -*/ - -unsigned int -hashpjw (const char *x, unsigned int len) // From Dragon book, p436 -{ - unsigned int h = 0; - unsigned int g; - - for (; len > 0; len--) - { - h = (h << 4) + (unsigned char) *x++; - if ((g = h & 0xf0000000) != 0) - h = (h ^ (g >> 24)) ^ g; - } - return h; -} diff --git a/contrib/gperf/lib/hash.h b/contrib/gperf/lib/hash.h deleted file mode 100644 index 5dbc92b7a186f..0000000000000 --- a/contrib/gperf/lib/hash.h +++ /dev/null @@ -1,15 +0,0 @@ -// This may look like C code, but it is really -*- C++ -*- - -/* -Copyright (C) 1988, 1992, 2000 Free Software Foundation - written by Doug Lea (dl@rocky.oswego.edu) -*/ - -#ifndef _hash_h -#define _hash_h 1 - -/* a hash function for char[] arrays using the - method described in Aho, Sethi, & Ullman, p 436. */ -extern unsigned int hashpjw (const char *string, unsigned int len); - -#endif diff --git a/contrib/gperf/mkinstalldirs b/contrib/gperf/mkinstalldirs deleted file mode 100755 index 4f58503ea4e09..0000000000000 --- a/contrib/gperf/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/contrib/gperf/src/Makefile.in b/contrib/gperf/src/Makefile.in deleted file mode 100644 index 60f73c735a342..0000000000000 --- a/contrib/gperf/src/Makefile.in +++ /dev/null @@ -1,146 +0,0 @@ -# Makefile for gperf/src - -# Copyright (C) 1989, 1992, 1993, 1998, 2000 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. - -#### 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@ -bindir = @bindir@ - -# Programs used by "make": -# C compiler -CC = @CC@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -# C++ compiler -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ -CXXCPP = @CXXCPP@ -# Both C and C++ compiler -LDFLAGS = @LDFLAGS@ -# Other -MV = mv -LN = ln -RM = rm -f -@SET_MAKE@ - -# Programs used by "make install": -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = $(SHELL) $(srcdir)/../mkinstalldirs - -#### End of system configuration section. #### - -SHELL = /bin/sh - -VPATH = $(srcdir) - -OBJECTS = new.o options.o iterator.o main.o gen-perf.o key-list.o list-node.o \ - hash-table.o bool-array.o read-line.o trace.o vectors.o version.o -LIBS = ../lib/libgp.a -lm -CPPFLAGS = -I. -I$(srcdir)/../lib - -TARGETPROG = gperf - -all : $(TARGETPROG) - -$(TARGETPROG): $(OBJECTS) - $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS) - -# 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 $< - -# Dependencies. -CONFIG_H = config.h -VERSION_H = version.h -VECTORS_H = vectors.h -TRACE_H = trace.h -READ_LINE_H = read-line.h read-line.icc $(TRACE_H) -OPTIONS_H = options.h options.icc $(TRACE_H) -LIST_NODE_H = list-node.h $(VECTORS_H) -KEY_LIST_H = key-list.h $(LIST_NODE_H) $(VECTORS_H) $(READ_LINE_H) -ITERATOR_H = iterator.h -HASH_TABLE_H = hash-table.h $(LIST_NODE_H) -BOOL_ARRAY_H = bool-array.h bool-array.icc $(TRACE_H) $(OPTIONS_H) -GEN_PERF_H = gen-perf.h $(KEY_LIST_H) $(BOOL_ARRAY_H) - -bool-array.o : bool-array.cc $(BOOL_ARRAY_H) $(OPTIONS_H) $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/bool-array.cc -gen-perf.o : gen-perf.cc $(GEN_PERF_H) $(OPTIONS_H) $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/gen-perf.cc -hash-table.o : hash-table.cc $(HASH_TABLE_H) $(OPTIONS_H) $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash-table.cc -iterator.o : iterator.cc $(ITERATOR_H) $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/iterator.cc -key-list.o : key-list.cc $(KEY_LIST_H) $(OPTIONS_H) $(READ_LINE_H) $(HASH_TABLE_H) $(TRACE_H) $(VERSION_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/key-list.cc -list-node.o : list-node.cc $(LIST_NODE_H) $(OPTIONS_H) $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/list-node.cc -main.o : main.cc $(OPTIONS_H) $(GEN_PERF_H) $(TRACE_H) $(CONFIG_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/main.cc -new.o : new.cc $(TRACE_H) $(CONFIG_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/new.cc -options.o : options.cc $(OPTIONS_H) $(ITERATOR_H) $(TRACE_H) $(VECTORS_H) $(VERSION_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/options.cc -read-line.o : read-line.cc $(READ_LINE_H) $(OPTIONS_H) $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/read-line.cc -trace.o : trace.cc $(TRACE_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/trace.cc -vectors.o : vectors.cc $(VECTORS_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/vectors.cc -version.o : version.cc $(VERSION_H) - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/version.cc - -install : all force - $(MKINSTALLDIRS) $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) $(TARGETPROG) $(DESTDIR)$(bindir)/$(TARGETPROG) - -installdirs : force - $(MKINSTALLDIRS) $(DESTDIR)$(bindir) - -uninstall : force - $(RM) $(DESTDIR)$(bindir)/$(TARGETPROG) - -check : all - -mostlyclean : clean - -clean : force - $(RM) *~ *.s *.o *.a $(TARGETPROG) core - -distclean : clean - $(RM) config.status config.log config.cache Makefile config.h - -maintainer-clean : distclean - -force : diff --git a/contrib/gperf/src/bool-array.cc b/contrib/gperf/src/bool-array.cc deleted file mode 100644 index 0774b2d65265e..0000000000000 --- a/contrib/gperf/src/bool-array.cc +++ /dev/null @@ -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__ */ diff --git a/contrib/gperf/src/bool-array.h b/contrib/gperf/src/bool-array.h deleted file mode 100644 index 8330fcd220190..0000000000000 --- a/contrib/gperf/src/bool-array.h +++ /dev/null @@ -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 diff --git a/contrib/gperf/src/bool-array.icc b/contrib/gperf/src/bool-array.icc deleted file mode 100644 index 6de6f236e7123..0000000000000 --- a/contrib/gperf/src/bool-array.icc +++ /dev/null @@ -1,85 +0,0 @@ -/* Inline Functions for bool-array.{h,cc}. - - 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. */ - -// 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); - } - } -} diff --git a/contrib/gperf/src/config.h.in b/contrib/gperf/src/config.h.in deleted file mode 100644 index 4d3d76212d6cc..0000000000000 --- a/contrib/gperf/src/config.h.in +++ /dev/null @@ -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 diff --git a/contrib/gperf/src/configure b/contrib/gperf/src/configure deleted file mode 100755 index edd1fd7f05204..0000000000000 --- a/contrib/gperf/src/configure +++ /dev/null @@ -1,1660 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.13 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.13" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=gen-perf.cc - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:527: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:556: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:586: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:637: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - ;; - esac - fi - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:669: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext << EOF - -#line 680 "configure" -#include "confdefs.h" - -main(){return(0);} -EOF -if { (eval echo configure:685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:711: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:716: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes -else - GCC= -fi - -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:744: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi - - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:776: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 791 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:797: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 808 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext <<EOF -#line 825 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - - for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:860: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:892: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext << EOF - -#line 903 "configure" -#include "confdefs.h" - -int main(){return(0);} -EOF -if { (eval echo configure:908: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:934: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:939: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes -else - GXX= -fi - -ac_test_CXXFLAGS="${CXXFLAGS+set}" -ac_save_CXXFLAGS="$CXXFLAGS" -CXXFLAGS= -echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:967: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi - - echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:999: checking how to run the C++ preprocessor" >&5 -if test -z "$CXXCPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - CXXCPP="${CXX-g++} -E" - cat > conftest.$ac_ext <<EOF -#line 1012 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CXXCPP=/lib/cpp -fi -rm -f conftest* - ac_cv_prog_CXXCPP="$CXXCPP" -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross -fi -fi -CXXCPP="$ac_cv_prog_CXXCPP" -echo "$ac_t""$CXXCPP" 1>&6 - - # Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1052: checking for a BSD compatible install" >&5 -if test -z "$INSTALL"; then -if eval "test \"`echo '$''{'cl_cv_path_install'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - # Account for people who put trailing slashes in PATH elements. - case "$ac_dir/" in - /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall installbsd scoinst install; do - if test -f $ac_dir/$ac_prog; then - if test $ac_prog = install && - grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - # OSF/1 installbsd also uses dspmsg, but is usable. - : - else - if test $ac_prog = installbsd && - grep src/bos $ac_dir/$ac_prog >/dev/null 2>&1; then - # AIX installbsd doesn't work without option "-g". - : - else - cl_cv_path_install="$ac_dir/$ac_prog -c" - break 2 - fi - fi - fi - done - ;; - esac - done - IFS="$ac_save_ifs" - # As a last resort, use cp. - test -z "$cl_cv_path_install" && cl_cv_path_install="cp" - -fi - INSTALL="$cl_cv_path_install" -fi -echo "$ac_t""$INSTALL" 1>&6 -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='$(INSTALL)' -if test -z "$INSTALL_DATA"; then - case "$INSTALL" in - cp | */cp ) INSTALL_DATA='$(INSTALL)' ;; - * ) INSTALL_DATA='$(INSTALL) -m 644' ;; - esac -fi - - echo $ac_n "checking for working throw()""... $ac_c" 1>&6 -echo "configure:1105: checking for working throw()" >&5 -if eval "test \"`echo '$''{'gp_cv_cxx_throw_decl'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext <<EOF -#line 1119 "configure" -#include "confdefs.h" -#include <stdlib.h> -void operator delete (void* ptr) throw() {} -int main() { - -; return 0; } -EOF -if { (eval echo configure:1127: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - gp_cv_cxx_throw_decl=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - gp_cv_cxx_throw_decl=no -fi -rm -f conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - - -fi - -echo "$ac_t""$gp_cv_cxx_throw_decl" 1>&6 -if test $gp_cv_cxx_throw_decl = yes; then - cat >> confdefs.h <<\EOF -#define HAVE_THROW_DECL 1 -EOF - -fi -for ac_hdr in unistd.h sys/time.h sys/resource.h -do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1158: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1163 "configure" -#include "confdefs.h" -#include <$ac_hdr> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* -fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <<EOF -#define $ac_tr_hdr 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - - if test $ac_cv_header_sys_resource_h = yes; then -for ac_func in getrlimit -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1198: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1203 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1226: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - - if test $ac_cv_func_getrlimit = yes; then -for ac_func in setrlimit -do -echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1254: checking for $ac_func" >&5 -if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <<EOF -#line 1259 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func(); below. */ -#include <assert.h> -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func(); - -int main() { - -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -$ac_func(); -#endif - -; return 0; } -EOF -if { (eval echo configure:1282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_func_$ac_func=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_func_$ac_func=no" -fi -rm -f conftest* -fi - -if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` - cat >> confdefs.h <<EOF -#define $ac_tr_func 1 -EOF - -else - echo "$ac_t""no" 1>&6 -fi -done - - fi -fi -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -DEFS=-DHAVE_CONFIG_H - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.13" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@CXX@%$CXX%g -s%@CXXCPP@%$CXXCPP%g -s%@INSTALL@%$INSTALL%g -s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g -s%@INSTALL_DATA@%$INSTALL_DATA%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' -ac_dC='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' -ac_uC=' ' -ac_uD='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <<EOF - CONFIG_HEADERS="config.h" -EOF -cat >> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - echo creating $ac_file - - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. And first: -# Protect against being on the right side of a sed subst in config.status. -# Protect against being in an unquoted here document in config.status. -rm -f conftest.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >> conftest.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. - -rm -f conftest.tail -while : -do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS - echo 'CEOF - sed -f conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h - else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file - fi -fi; done - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/gperf/src/configure.in b/contrib/gperf/src/configure.in deleted file mode 100644 index e8880d507f859..0000000000000 --- a/contrib/gperf/src/configure.in +++ /dev/null @@ -1,71 +0,0 @@ -dnl autoconf configuration for gperf/src - -dnl Copyright (C) 1998, 2000 Free Software Foundation, Inc. -dnl written by Douglas C. Schmidt (schmidt@ics.uci.edu) -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(gen-perf.cc) -AC_CONFIG_HEADER(config.h) -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_INSTALL - dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM -dnl -dnl checks for compiler characteristics -dnl -AC_MSG_CHECKING([for working throw()]) -AC_CACHE_VAL(gp_cv_cxx_throw_decl,[ -AC_LANG_SAVE() -AC_LANG_CPLUSPLUS() -AC_TRY_COMPILE([#include <stdlib.h> -void operator delete (void* ptr) throw() {}], [], -gp_cv_cxx_throw_decl=yes, gp_cv_cxx_throw_decl=no) -AC_LANG_RESTORE() -]) -AC_MSG_RESULT([$]gp_cv_cxx_throw_decl) -if test [$]gp_cv_cxx_throw_decl = yes; then - AC_DEFINE(HAVE_THROW_DECL) -fi -dnl -dnl checks for functions and declarations -dnl -AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h) - dnl DEFs HAVE_UNISTD_H, HAVE_SYS_TIME_H, HAVE_SYS_RESOURCE_H -if test $ac_cv_header_sys_resource_h = yes; then -AC_CHECK_FUNCS(getrlimit) - dnl DEFS HAVE_GETRLIMIT -if test $ac_cv_func_getrlimit = yes; then -AC_CHECK_FUNCS(setrlimit) - dnl DEFS HAVE_SETRLIMIT -fi -fi -dnl -dnl That's it. -dnl -AC_OUTPUT(Makefile) diff --git a/contrib/gperf/src/gen-perf.cc b/contrib/gperf/src/gen-perf.cc deleted file mode 100644 index 0b5109d4ff4d4..0000000000000 --- a/contrib/gperf/src/gen-perf.cc +++ /dev/null @@ -1,359 +0,0 @@ -/* Provides high-level routines to manipulate the keywork list - structures the code generation output. - Copyright (C) 1989-1998, 2000 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 <stdio.h> -#include <stdlib.h> /* declares rand(), srand() */ -#include <time.h> /* declares time() */ -#include "options.h" -#include "gen-perf.h" -#include "trace.h" - -/* Efficiently returns the least power of two greater than or equal to X! */ -#define POW(X) ((!X)?1:(X-=1,X|=X>>1,X|=X>>2,X|=X>>4,X|=X>>8,X|=X>>16,(++X))) - -/* Reads input keys, possibly applies the reordering heuristic, sets the - maximum associated value size (rounded up to the nearest power of 2), - may initialize the associated values array, and determines the maximum - hash table size. Note: using the random numbers is often helpful, - though not as deterministic, of course! */ - -Gen_Perf::Gen_Perf (void) -{ - T (Trace t ("Gen_Perf::Gen_Perf");) - int asso_value_max; - int non_linked_length; - - Key_List::read_keys (); - if (option[ORDER]) - reorder (); - asso_value_max = option.get_asso_max (); - non_linked_length = Key_List::keyword_list_length (); - num_done = 1; - fewest_collisions = 0; - if (asso_value_max == 0) - asso_value_max = non_linked_length; - else if (asso_value_max > 0) - asso_value_max *= non_linked_length; - else /* if (asso_value_max < 0) */ - asso_value_max = non_linked_length / -asso_value_max; - option.set_asso_max (POW (asso_value_max)); - - if (option[RANDOM]) - { - srand ((long) time (0)); - - for (int i = 0; i < ALPHA_SIZE; i++) - asso_values[i] = (rand () & asso_value_max - 1); - } - else - { - int asso_value = option.initial_value (); - - if (asso_value) /* Initialize array if user requests non-zero default. */ - for (int i = ALPHA_SIZE - 1; i >= 0; i--) - asso_values[i] = asso_value & option.get_asso_max () - 1; - } - max_hash_value = Key_List::max_key_length () + option.get_asso_max () * - option.get_max_keysig_size (); - - if (option[DEBUG]) - fprintf (stderr, "total non-linked keys = %d\nmaximum associated value is %d" - "\nmaximum size of generated hash table is %d\n", - non_linked_length, asso_value_max, max_hash_value); -} - -/* Merge two disjoint hash key multisets to form the ordered disjoint union of the sets. - (In a multiset, an element can occur multiple times.) - Precondition: both set_1 and set_2 must be ordered. Returns the length - of the combined set. */ - -inline int -Gen_Perf::compute_disjoint_union (const char *set_1, int size_1, const char *set_2, int size_2, char *set_3) -{ - T (Trace t ("Gen_Perf::compute_disjoint_union");) - char *base = set_3; - - while (size_1 > 0 && size_2 > 0) - if (*set_1 == *set_2) - set_1++, size_1--, set_2++, size_2--; - else - { - char next; - if (*set_1 < *set_2) - next = *set_1++, size_1--; - else - next = *set_2++, size_2--; - if (set_3 == base || next != set_3[-1]) - *set_3++ = next; - } - - while (size_1 > 0) - { - char next; - next = *set_1++, size_1--; - if (set_3 == base || next != set_3[-1]) - *set_3++ = next; - } - - while (size_2 > 0) - { - char next; - next = *set_2++, size_2--; - if (set_3 == base || next != set_3[-1]) - *set_3++ = next; - } - return set_3 - base; -} - -/* Sort the UNION_SET in increasing frequency of occurrence. - This speeds up later processing since we may assume the resulting - set (Set_3, in this case), is ordered. Uses insertion sort, since - the UNION_SET is typically short. */ - -inline void -Gen_Perf::sort_set (char *union_set, int len) -{ - T (Trace t ("Gen_Perf::sort_set");) - int i, j; - - for (i = 0, j = len - 1; i < j; i++) - { - int curr; - char tmp; - - for (curr = i + 1, tmp = union_set[curr]; - curr > 0 && occurrences[(unsigned char)tmp] < occurrences[(unsigned char)(union_set[curr-1])]; - curr--) - union_set[curr] = union_set[curr - 1]; - - union_set[curr] = tmp; - } -} - -/* Generate a key set's hash value. */ - -inline int -Gen_Perf::hash (List_Node *key_node) -{ - T (Trace t ("Gen_Perf::hash");) - int sum = option[NOLENGTH] ? 0 : key_node->key_length; - - const char *p = key_node->char_set; - int i = key_node->char_set_length; - for (; i > 0; p++, i--) - sum += asso_values[(unsigned char)(*p)]; - - return key_node->hash_value = sum; -} - -/* Find out how character value change affects successfully hashed items. - Returns FALSE if no other hash values are affected, else returns TRUE. - Note that because Option.Get_Asso_Max is a power of two we can guarantee - that all legal Asso_Values are visited without repetition since - Option.Get_Jump was forced to be an odd value! */ - -inline int -Gen_Perf::affects_prev (char c, List_Node *curr) -{ - T (Trace t ("Gen_Perf::affects_prev");) - int original_char = asso_values[(unsigned char)c]; - int total_iterations = !option[FAST] - ? option.get_asso_max () : option.get_iterations () ? option.get_iterations () : keyword_list_length (); - - /* Try all legal associated values. */ - - for (int i = total_iterations - 1; i >= 0; i--) - { - int collisions = 0; - - asso_values[(unsigned char)c] = - (asso_values[(unsigned char)c] + (option.get_jump () ? option.get_jump () : rand ())) - & (option.get_asso_max () - 1); - - /* Iteration Number array is a win, O(1) intialization time! */ - reset (); - - /* See how this asso_value change affects previous keywords. If - it does better than before we'll take it! */ - - for (List_Node *ptr = head; - !Bool_Array::find (hash (ptr)) || ++collisions < fewest_collisions; - ptr = ptr->next) - if (ptr == curr) - { - fewest_collisions = collisions; - if (option[DEBUG]) - fprintf (stderr, "- resolved after %d iterations", total_iterations - i); - return 0; - } - } - - /* Restore original values, no more tries. */ - asso_values[(unsigned char)c] = original_char; - /* If we're this far it's time to try the next character.... */ - return 1; -} - -/* Change a character value, try least-used characters first. */ - -void -Gen_Perf::change (List_Node *prior, List_Node *curr) -{ - T (Trace t ("Gen_Perf::change");) - static char *union_set; - int union_set_length; - - if (!union_set) - union_set = new char [2 * option.get_max_keysig_size ()]; - - if (option[DEBUG]) - { - fprintf (stderr, "collision on keyword #%d, prior = \"%.*s\", curr = \"%.*s\" hash = %d\n", - num_done, - prior->key_length, prior->key, - curr->key_length, curr->key, - curr->hash_value); - fflush (stderr); - } - union_set_length = compute_disjoint_union (prior->char_set, prior->char_set_length, curr->char_set, curr->char_set_length, union_set); - sort_set (union_set, union_set_length); - - /* Try changing some values, if change doesn't alter other values continue normal action. */ - fewest_collisions++; - - const char *p = union_set; - int i = union_set_length; - for (; i > 0; p++, i--) - if (!affects_prev (*p, curr)) - { - if (option[DEBUG]) - { - fprintf (stderr, " by changing asso_value['%c'] (char #%d) to %d\n", - *p, p - union_set + 1, asso_values[(unsigned char)(*p)]); - fflush (stderr); - } - return; /* Good, doesn't affect previous hash values, we'll take it. */ - } - - for (List_Node *ptr = head; ptr != curr; ptr = ptr->next) - hash (ptr); - - hash (curr); - - if (option[DEBUG]) - { - fprintf (stderr, "** collision not resolved after %d iterations, %d duplicates remain, continuing...\n", - !option[FAST] ? option.get_asso_max () : option.get_iterations () ? option.get_iterations () : keyword_list_length (), - fewest_collisions + total_duplicates); - fflush (stderr); - } -} - -/* Does the hard stuff.... - Initializes the Iteration Number array, and attempts to find a perfect - function that will hash all the key words without getting any - duplications. This is made much easier since we aren't attempting - to generate *minimum* functions, only perfect ones. - If we can't generate a perfect function in one pass *and* the user - hasn't enabled the DUP option, we'll inform the user to try the - randomization option, use -D, or choose alternative key positions. - The alternatives (e.g., back-tracking) are too time-consuming, i.e, - exponential in the number of keys. */ - -int -Gen_Perf::operator() (void) -{ - T (Trace t ("Gen_Perf::operator()");) -#if LARGE_STACK_ARRAYS - STORAGE_TYPE buffer[max_hash_value + 1]; -#else - // Note: we don't use new, because that invokes a custom operator new. - STORAGE_TYPE *buffer - = (STORAGE_TYPE*) malloc (sizeof(STORAGE_TYPE) * (max_hash_value + 1)); - if (buffer == NULL) - abort (); -#endif - - Bool_Array::init (buffer, max_hash_value + 1); - - List_Node *curr; - for (curr = head; curr; curr = curr->next) - { - hash (curr); - - for (List_Node *ptr = head; ptr != curr; ptr = ptr->next) - if (ptr->hash_value == curr->hash_value) - { - change (ptr, curr); - break; - } - num_done++; - } - - /* Make one final check, just to make sure nothing weird happened.... */ - - Bool_Array::reset (); - - for (curr = head; curr; curr = curr->next) - if (Bool_Array::find (hash (curr))) - if (option[DUP]) /* Keep track of this number... */ - total_duplicates++; - else /* Yow, big problems. we're outta here! */ - { - fprintf (stderr, "\nInternal error, duplicate value %d:\n" - "try options -D or -r, or use new key positions.\n\n", hash (curr)); -#if !LARGE_STACK_ARRAYS - free ((char *) buffer); -#endif - return 1; - } - - /* Sorts the key word list by hash value, and then outputs the list. - The generated hash table code is only output if the early stage of - processing turned out O.K. */ - - sort (); - output (); -#if !LARGE_STACK_ARRAYS - free ((char *) buffer); -#endif - return 0; -} - -/* Prints out some diagnostics upon completion. */ - -Gen_Perf::~Gen_Perf (void) -{ - T (Trace t ("Gen_Perf::~Gen_Perf");) - if (option[DEBUG]) - { - fprintf (stderr, "\ndumping occurrence and associated values tables\n"); - - for (int i = 0; i < ALPHA_SIZE; i++) - if (occurrences[i]) - fprintf (stderr, "asso_values[%c] = %6d, occurrences[%c] = %6d\n", - i, asso_values[i], i, occurrences[i]); - - fprintf (stderr, "end table dumping\n"); - - } -} - diff --git a/contrib/gperf/src/gen-perf.h b/contrib/gperf/src/gen-perf.h deleted file mode 100644 index 602d160131d33..0000000000000 --- a/contrib/gperf/src/gen-perf.h +++ /dev/null @@ -1,50 +0,0 @@ -/* This may look like C code, but it is really -*- C++ -*- */ - -/* Provides high-level routines to manipulate the keyword list - structures the code generation output. - - Copyright (C) 1989-1998, 2000 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 gen_perf_h -#define gen_perf_h 1 - -#include "key-list.h" -#include "bool-array.h" - -class Gen_Perf : private Key_List, private Bool_Array -{ -private: - int max_hash_value; /* Maximum possible hash value. */ - int fewest_collisions; /* Records fewest # of collisions for asso value. */ - int num_done; /* Number of keywords processed without a collision. */ - - void change (List_Node *prior, List_Node *curr); - int affects_prev (char c, List_Node *curr); - static int hash (List_Node *key_node); - static int compute_disjoint_union (const char *set_1, int size_1, const char *set_2, int size_2, char *set_3); - static void sort_set (char *union_set, int len); - -public: - Gen_Perf (void); - ~Gen_Perf (void); - int operator () (void); -}; - -#endif diff --git a/contrib/gperf/src/hash-table.cc b/contrib/gperf/src/hash-table.cc deleted file mode 100644 index a147674b30742..0000000000000 --- a/contrib/gperf/src/hash-table.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* Hash table for checking keyword links. Implemented using double hashing. - Copyright (C) 1989-1998, 2000 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 "hash-table.h" - -#include <stdio.h> -#include <string.h> /* declares memset(), strcmp() */ -#include <hash.h> -#include "options.h" -#include "trace.h" - -/* The size of the hash table is always the smallest power of 2 >= the size - indicated by the user. This allows several optimizations, including - the use of double hashing and elimination of the mod instruction. - Note that the size had better be larger than the number of items - in the hash table, else there's trouble!!! Note that the memory - for the hash table is allocated *outside* the intialization routine. - This compromises information hiding somewhat, but greatly reduces - memory fragmentation, since we can now use alloca! */ - -Hash_Table::Hash_Table (List_Node **table_ptr, int s, int ignore_len): - table (table_ptr), size (s), collisions (0), ignore_length (ignore_len) -{ - T (Trace t ("Hash_Table::Hash_Table");) - memset ((char *) table, 0, size * sizeof (*table)); -} - -Hash_Table::~Hash_Table (void) -{ - T (Trace t ("Hash_Table::~Hash_Table");) - if (option[DEBUG]) - { - int field_width = option.get_max_keysig_size (); - - fprintf (stderr, - "\ndumping the hash table\n" - "total available table slots = %d, total bytes = %d, total collisions = %d\n" - "location, %*s, keyword\n", - size, size * (int) sizeof (*table), collisions, - field_width, "keysig"); - - for (int i = size - 1; i >= 0; i--) - if (table[i]) - fprintf (stderr, "%8d, %*.*s, %.*s\n", - i, - field_width, table[i]->char_set_length, table[i]->char_set, - table[i]->key_length, table[i]->key); - - fprintf (stderr, "\nend dumping hash table\n\n"); - } -} - -/* If the ITEM is already in the hash table return the item found - in the table. Otherwise inserts the ITEM, and returns FALSE. - Uses double hashing. */ - -List_Node * -Hash_Table::insert (List_Node *item) -{ - T (Trace t ("Hash_Table::operator()");) - unsigned hash_val = hashpjw (item->char_set, item->char_set_length); - int probe = hash_val & (size - 1); - int increment = ((hash_val ^ item->key_length) | 1) & (size - 1); - - while (table[probe]) - { - if (table[probe]->char_set_length == item->char_set_length - && memcmp (table[probe]->char_set, item->char_set, item->char_set_length) == 0 - && (ignore_length || table[probe]->key_length == item->key_length)) - return table[probe]; - - collisions++; - probe = (probe + increment) & (size - 1); - } - - table[probe] = item; - return (List_Node *) 0; -} diff --git a/contrib/gperf/src/hash-table.h b/contrib/gperf/src/hash-table.h deleted file mode 100644 index 86438d00f7d6c..0000000000000 --- a/contrib/gperf/src/hash-table.h +++ /dev/null @@ -1,43 +0,0 @@ -/* This may look like C code, but it is really -*- C++ -*- */ - -/* Hash table used to check for duplicate keyword entries. - - Copyright (C) 1989-1998, 2000 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 hash_table_h -#define hash_table_h 1 - -#include "list-node.h" - -class Hash_Table -{ -private: - List_Node **table; /* Vector of pointers to linked lists of List_Node's. */ - int size; /* Size of the vector. */ - int collisions; /* Find out how well our double hashing is working! */ - int ignore_length; - -public: - Hash_Table (List_Node **t, int s, int ignore_len); - ~Hash_Table (void); - List_Node *insert (List_Node *item); -}; - -#endif diff --git a/contrib/gperf/src/iterator.cc b/contrib/gperf/src/iterator.cc deleted file mode 100644 index ca66bbb8aca48..0000000000000 --- a/contrib/gperf/src/iterator.cc +++ /dev/null @@ -1,87 +0,0 @@ -/* Provides an Iterator for keyword characters. - Copyright (C) 1989-1998, 2000 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 "iterator.h" - -#include <ctype.h> -#include "trace.h" - -/* Constructor for Iterator. */ - -Iterator::Iterator (const char *s, int lo, int hi, int word_end, int bad_val, int key_end) -{ - T (Trace t ("Iterator::Iterator");) - end = key_end; - error_value = bad_val; - end_word = word_end; - str = s; - hi_bound = hi; - lo_bound = lo; -} - -/* Provide an Iterator, returning the ``next'' value from - the list of valid values given in the constructor. */ - -int -Iterator::operator() (void) -{ - T (Trace t ("Iterator::operator()");) -/* Variables to record the Iterator's status when handling ranges, e.g., 3-12. */ - - static int size; - static int curr_value; - static int upper_bound; - - if (size) - { - if (++curr_value >= upper_bound) - size = 0; - return curr_value; - } - else - { - while (*str) - switch (*str) - { - default: return error_value; - case ',': str++; break; - case '$': str++; return end_word; - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - for (curr_value = 0; isdigit ((unsigned char)(*str)); str++) - curr_value = curr_value * 10 + (*str - '0'); - - if (*str == '-') - { - - for (size = 1, upper_bound = 0; - isdigit ((unsigned char)(*++str)); - upper_bound = upper_bound * 10 + (*str - '0')); - - if (upper_bound <= curr_value || upper_bound > hi_bound) - return error_value; - } - return curr_value >= lo_bound && curr_value <= hi_bound - ? curr_value : error_value; - } - - return end; - } -} diff --git a/contrib/gperf/src/key-list.cc b/contrib/gperf/src/key-list.cc deleted file mode 100644 index 1c941a4535796..0000000000000 --- a/contrib/gperf/src/key-list.cc +++ /dev/null @@ -1,2184 +0,0 @@ -/* Routines for building, ordering, and printing the keyword list. - Copyright (C) 1989-1998, 2000 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 <stdio.h> -#include <string.h> /* declares strncpy(), strchr() */ -#include <stdlib.h> /* declares malloc(), free(), abs(), exit(), abort() */ -#include <ctype.h> /* declares isprint() */ -#include <assert.h> /* defines assert() */ -#include <limits.h> /* defines SCHAR_MAX etc. */ -#include "options.h" -#include "read-line.h" -#include "hash-table.h" -#include "key-list.h" -#include "trace.h" -#include "version.h" - -/* Make the hash table 8 times larger than the number of keyword entries. */ -static const int TABLE_MULTIPLE = 10; - -/* Efficiently returns the least power of two greater than or equal to X! */ -#define POW(X) ((!X)?1:(X-=1,X|=X>>1,X|=X>>2,X|=X>>4,X|=X>>8,X|=X>>16,(++X))) - -int Key_List::determined[MAX_ALPHA_SIZE]; - -/* Destructor dumps diagnostics during debugging. */ - -Key_List::~Key_List (void) -{ - T (Trace t ("Key_List::~Key_List");) - if (option[DEBUG]) - { - fprintf (stderr, "\nDumping key list information:\ntotal non-static linked keywords = %d" - "\ntotal keywords = %d\ntotal duplicates = %d\nmaximum key length = %d\n", - list_len, total_keys, total_duplicates, max_key_len); - dump (); - fprintf (stderr, "End dumping list.\n\n"); - } -} - -/* Gathers the input stream into a buffer until one of two things occur: - - 1. We read a '%' followed by a '%' - 2. We read a '%' followed by a '}' - - The first symbolizes the beginning of the keyword list proper, - The second symbolizes the end of the C source code to be generated - verbatim in the output file. - - I assume that the keys are separated from the optional preceding struct - declaration by a consecutive % followed by either % or } starting in - the first column. The code below uses an expandible buffer to scan off - and return a pointer to all the code (if any) appearing before the delimiter. */ - -const char * -Key_List::get_special_input (char delimiter) -{ - T (Trace t ("Key_List::get_special_input");) - int size = 80; - char *buf = new char[size]; - int c, i; - - for (i = 0; (c = getchar ()) != EOF; i++) - { - if (c == '%') - { - if ((c = getchar ()) == delimiter) - { - - while ((c = getchar ()) != '\n') - ; /* discard newline */ - - if (i == 0) - return ""; - else - { - buf[delimiter == '%' && buf[i - 2] == ';' ? i - 2 : i - 1] = '\0'; - return buf; - } - } - else - buf[i++] = '%'; - } - else if (i >= size) /* Yikes, time to grow the buffer! */ - { - char *temp = new char[size *= 2]; - int j; - - for (j = 0; j < i; j++) - temp[j] = buf[j]; - - buf = temp; - } - buf[i] = c; - } - - return 0; /* Problem here. */ -} - -/* Stores any C text that must be included verbatim into the - generated code output. */ - -const char * -Key_List::save_include_src (void) -{ - T (Trace t ("Key_List::save_include_src");) - int c; - - if ((c = getchar ()) != '%') - ungetc (c, stdin); - else if ((c = getchar ()) != '{') - { - fprintf (stderr, "internal error, %c != '{' on line %d in file %s", c, __LINE__, __FILE__); - exit (1); - } - else - return get_special_input ('}'); - return ""; -} - -/* Determines from the input file whether the user wants to build a table - from a user-defined struct, or whether the user is content to simply - use the default array of keys. */ - -const char * -Key_List::get_array_type (void) -{ - T (Trace t ("Key_List::get_array_type");) - return get_special_input ('%'); -} - -/* strcspn - find length of initial segment of S consisting entirely - of characters not from REJECT (borrowed from Henry Spencer's - ANSI string package, when GNU libc comes out I'll replace this...). */ - -#ifndef strcspn -inline int -Key_List::strcspn (const char *s, const char *reject) -{ - T (Trace t ("Key_List::strcspn");) - const char *scan; - const char *rej_scan; - int count = 0; - - for (scan = s; *scan; scan++) - { - - for (rej_scan = reject; *rej_scan; rej_scan++) - if (*scan == *rej_scan) - return count; - - count++; - } - - return count; -} -#endif - -/* Sets up the Return_Type, the Struct_Tag type and the Array_Type - based upon various user Options. */ - -void -Key_List::set_output_types (void) -{ - T (Trace t ("Key_List::set_output_types");) - if (option[TYPE]) - { - array_type = get_array_type (); - if (!array_type) - /* Something's wrong, but we'll catch it later on, in read_keys()... */ - return; - /* Yow, we've got a user-defined type... */ - int i = strcspn (array_type, "{\n\0"); - /* Remove trailing whitespace. */ - while (i > 0 && strchr (" \t", array_type[i-1])) - i--; - int struct_tag_length = i; - - /* Set `struct_tag' to a naked "struct something". */ - char *structtag = new char[struct_tag_length + 1]; - strncpy (structtag, array_type, struct_tag_length); - structtag[struct_tag_length] = '\0'; - struct_tag = structtag; - - /* The return type of the lookup function is "struct something *". - No "const" here, because if !option[CONST], some user code might want - to modify the structure. */ - char *rettype = new char[struct_tag_length + 3]; - strncpy (rettype, array_type, struct_tag_length); - rettype[struct_tag_length] = ' '; - rettype[struct_tag_length + 1] = '*'; - rettype[struct_tag_length + 2] = '\0'; - return_type = rettype; - } -} - -/* Extracts a key from an input line and creates a new List_Node for it. */ - -static List_Node * -parse_line (const char *line, const char *delimiters) -{ - if (*line == '"') - { - /* Parse a string in ANSI C syntax. */ - char *key = new char[strlen(line)]; - char *kp = key; - const char *lp = line + 1; - - for (; *lp;) - { - char c = *lp; - - if (c == '\0') - { - fprintf (stderr, "unterminated string: %s\n", line); - exit (1); - } - else if (c == '\\') - { - c = *++lp; - switch (c) - { - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - { - int code = 0; - int count = 0; - while (count < 3 && *lp >= '0' && *lp <= '7') - { - code = (code << 3) + (*lp - '0'); - lp++; - count++; - } - if (code > UCHAR_MAX) - fprintf (stderr, "octal escape out of range: %s\n", line); - *kp = (char) code; - break; - } - case 'x': - { - int code = 0; - int count = 0; - lp++; - while ((*lp >= '0' && *lp <= '9') - || (*lp >= 'A' && *lp <= 'F') - || (*lp >= 'a' && *lp <= 'f')) - { - code = (code << 4) - + (*lp >= 'A' && *lp <= 'F' ? *lp - 'A' + 10 : - *lp >= 'a' && *lp <= 'f' ? *lp - 'a' + 10 : - *lp - '0'); - lp++; - count++; - } - if (count == 0) - fprintf (stderr, "hexadecimal escape without any hex digits: %s\n", line); - if (code > UCHAR_MAX) - fprintf (stderr, "hexadecimal escape out of range: %s\n", line); - *kp = (char) code; - break; - } - case '\\': case '\'': case '"': - *kp = c; - lp++; - break; - case 'n': - *kp = '\n'; - lp++; - break; - case 't': - *kp = '\t'; - lp++; - break; - case 'r': - *kp = '\r'; - lp++; - break; - case 'f': - *kp = '\f'; - lp++; - break; - case 'b': - *kp = '\b'; - lp++; - break; - case 'a': - *kp = '\a'; - lp++; - break; - case 'v': - *kp = '\v'; - lp++; - break; - default: - fprintf (stderr, "invalid escape sequence in string: %s\n", line); - exit (1); - } - } - else if (c == '"') - break; - else - { - *kp = c; - lp++; - } - kp++; - } - lp++; - if (*lp != '\0') - { - if (strchr (delimiters, *lp) == NULL) - { - fprintf (stderr, "string not followed by delimiter: %s\n", line); - exit (1); - } - lp++; - } - return new List_Node (key, kp - key, option[TYPE] ? lp : ""); - } - else - { - /* Not a string. Look for the delimiter. */ - int len = strcspn (line, delimiters); - const char *rest; - - if (line[len] == '\0') - rest = ""; - else - /* Skip the first delimiter. */ - rest = &line[len + 1]; - return new List_Node (line, len, option[TYPE] ? rest : ""); - } -} - -/* Reads in all keys from standard input and creates a linked list pointed - to by Head. This list is then quickly checked for ``links,'' i.e., - unhashable elements possessing identical key sets and lengths. */ - -void -Key_List::read_keys (void) -{ - T (Trace t ("Key_List::read_keys");) - char *ptr; - - include_src = save_include_src (); - set_output_types (); - - /* Oops, problem with the input file. */ - if (! (ptr = Read_Line::get_line ())) - { - fprintf (stderr, "No words in input file, did you forget to prepend %s or use -t accidentally?\n", "%%"); - exit (1); - } - - /* Read in all the keywords from the input file. */ - else - { - const char *delimiter = option.get_delimiter (); - List_Node *temp, *trail = 0; - - head = parse_line (ptr, delimiter); - - for (temp = head; - (ptr = Read_Line::get_line ()) && strcmp (ptr, "%%"); - temp = temp->next) - { - temp->next = parse_line (ptr, delimiter); - total_keys++; - } - - /* See if any additional C code is included at end of this file. */ - if (ptr) - additional_code = 1; - - /* Hash table this number of times larger than keyword number. */ - int table_size = (list_len = total_keys) * TABLE_MULTIPLE; - -#if LARGE_STACK_ARRAYS - /* By allocating the memory here we save on dynamic allocation overhead. - Table must be a power of 2 for the hash function scheme to work. */ - List_Node *table[POW (table_size)]; -#else - // Note: we don't use new, because that invokes a custom operator new. - int malloc_size = POW (table_size) * sizeof(List_Node*); - if (malloc_size == 0) malloc_size = 1; - List_Node **table = (List_Node**)malloc(malloc_size); - if (table == NULL) - abort (); -#endif - - /* Make large hash table for efficiency. */ - Hash_Table found_link (table, table_size, option[NOLENGTH]); - - /* Test whether there are any links and also set the maximum length of - an identifier in the keyword list. */ - - for (temp = head; temp; temp = temp->next) - { - List_Node *ptr = found_link.insert (temp); - - /* Check for links. We deal with these by building an equivalence class - of all duplicate values (i.e., links) so that only 1 keyword is - representative of the entire collection. This *greatly* simplifies - processing during later stages of the program. */ - - if (ptr) - { - total_duplicates++; - list_len--; - trail->next = temp->next; - temp->link = ptr->link; - ptr->link = temp; - - /* Complain if user hasn't enabled the duplicate option. */ - if (!option[DUP] || option[DEBUG]) - fprintf (stderr, "Key link: \"%.*s\" = \"%.*s\", with key set \"%.*s\".\n", - temp->key_length, temp->key, - ptr->key_length, ptr->key, - temp->char_set_length, temp->char_set); - } - else - trail = temp; - - /* Update minimum and maximum keyword length, if needed. */ - if (max_key_len < temp->key_length) - max_key_len = temp->key_length; - if (min_key_len > temp->key_length) - min_key_len = temp->key_length; - } - -#if !LARGE_STACK_ARRAYS - free ((char *) table); -#endif - - /* Exit program if links exists and option[DUP] not set, since we can't continue */ - if (total_duplicates) - { - if (option[DUP]) - fprintf (stderr, "%d input keys have identical hash values, examine output carefully...\n", - total_duplicates); - else - { - fprintf (stderr, "%d input keys have identical hash values,\ntry different key positions or use option -D.\n", - total_duplicates); - exit (1); - } - } - /* Exit program if an empty string is used as key, since the comparison - expressions don't work correctly for looking up an empty string. */ - if (min_key_len == 0) - { - fprintf (stderr, "Empty input key is not allowed.\nTo recognize an empty input key, your code should check for\nlen == 0 before calling the gperf generated lookup function.\n"); - exit (1); - } - if (option[ALLCHARS]) - option.set_keysig_size (max_key_len); - } -} - -/* Recursively merges two sorted lists together to form one sorted list. The - ordering criteria is by frequency of occurrence of elements in the key set - or by the hash value. This is a kludge, but permits nice sharing of - almost identical code without incurring the overhead of a function - call comparison. */ - -List_Node * -Key_List::merge (List_Node *list1, List_Node *list2) -{ - T (Trace t ("Key_List::merge");) - List_Node *result; - List_Node **resultp = &result; - for (;;) - { - if (!list1) - { - *resultp = list2; - break; - } - if (!list2) - { - *resultp = list1; - break; - } - if (occurrence_sort && list1->occurrence < list2->occurrence - || hash_sort && list1->hash_value > list2->hash_value) - { - *resultp = list2; - resultp = &list2->next; list2 = list1; list1 = *resultp; - } - else - { - *resultp = list1; - resultp = &list1->next; list1 = *resultp; - } - } - return result; -} - -/* Applies the merge sort algorithm to recursively sort the key list by - frequency of occurrence of elements in the key set. */ - -List_Node * -Key_List::merge_sort (List_Node *head) -{ - T (Trace t ("Key_List::merge_sort");) - if (!head || !head->next) - return head; - else - { - List_Node *middle = head; - List_Node *temp = head->next->next; - - while (temp) - { - temp = temp->next; - middle = middle->next; - if (temp) - temp = temp->next; - } - - temp = middle->next; - middle->next = 0; - return merge (merge_sort (head), merge_sort (temp)); - } -} - -/* Returns the frequency of occurrence of elements in the key set. */ - -inline int -Key_List::get_occurrence (List_Node *ptr) -{ - T (Trace t ("Key_List::get_occurrence");) - int value = 0; - - const char *p = ptr->char_set; - unsigned int i = ptr->char_set_length; - for (; i > 0; p++, i--) - value += occurrences[(unsigned char)(*p)]; - - return value; -} - -/* Enables the index location of all key set elements that are now - determined. */ - -inline void -Key_List::set_determined (List_Node *ptr) -{ - T (Trace t ("Key_List::set_determined");) - - const char *p = ptr->char_set; - unsigned int i = ptr->char_set_length; - for (; i > 0; p++, i--) - determined[(unsigned char)(*p)] = 1; -} - -/* Returns TRUE if PTR's key set is already completely determined. */ - -inline int -Key_List::already_determined (List_Node *ptr) -{ - T (Trace t ("Key_List::already_determined");) - int is_determined = 1; - - const char *p = ptr->char_set; - unsigned int i = ptr->char_set_length; - for (; is_determined && i > 0; p++, i--) - is_determined = determined[(unsigned char)(*p)]; - - return is_determined; -} - -/* Reorders the table by first sorting the list so that frequently occuring - keys appear first, and then the list is reorded so that keys whose values - are already determined will be placed towards the front of the list. This - helps prune the search time by handling inevitable collisions early in the - search process. See Cichelli's paper from Jan 1980 JACM for details.... */ - -void -Key_List::reorder (void) -{ - T (Trace t ("Key_List::reorder");) - List_Node *ptr; - for (ptr = head; ptr; ptr = ptr->next) - ptr->occurrence = get_occurrence (ptr); - - hash_sort = 0; - occurrence_sort = 1; - - for (ptr = head = merge_sort (head); ptr->next; ptr = ptr->next) - { - set_determined (ptr); - - if (already_determined (ptr->next)) - continue; - else - { - List_Node *trail_ptr = ptr->next; - List_Node *run_ptr = trail_ptr->next; - - for (; run_ptr; run_ptr = trail_ptr->next) - { - - if (already_determined (run_ptr)) - { - trail_ptr->next = run_ptr->next; - run_ptr->next = ptr->next; - ptr = ptr->next = run_ptr; - } - else - trail_ptr = run_ptr; - } - } - } -} - -/* ============================ Output routines ============================ */ - -/* The "const " qualifier. */ -static const char *const_always; - -/* The "const " qualifier, for read-only arrays. */ -static const char *const_readonly_array; - -/* The "const " qualifier, for the array type. */ -static const char *const_for_struct; - -/* Returns the smallest unsigned C type capable of holding integers up to N. */ - -static const char * -smallest_integral_type (int n) -{ - if (n <= UCHAR_MAX) return "unsigned char"; - if (n <= USHRT_MAX) return "unsigned short"; - return "unsigned int"; -} - -/* Returns the smallest signed C type capable of holding integers - from MIN to MAX. */ - -static const char * -smallest_integral_type (int min, int max) -{ - if (option[ANSIC] | option[CPLUSPLUS]) - if (min >= SCHAR_MIN && max <= SCHAR_MAX) return "signed char"; - if (min >= SHRT_MIN && max <= SHRT_MAX) return "short"; - return "int"; -} - -/* A cast from `char' to a valid array index. */ -static const char *char_to_index; - -/* ------------------------------------------------------------------------- */ - -/* Computes the maximum and minimum hash values. Since the - list is already sorted by hash value all we need to do is - find the final item! */ - -void -Key_List::compute_min_max (void) -{ - T (Trace t ("Key_List::compute_min_max");) - List_Node *temp; - for (temp = head; temp->next; temp = temp->next) - ; - - min_hash_value = head->hash_value; - max_hash_value = temp->hash_value; -} - -/* ------------------------------------------------------------------------- */ - -/* Returns the number of different hash values. */ - -int -Key_List::num_hash_values (void) -{ - T (Trace t ("Key_List::num_hash_values");) - int count = 1; - List_Node *temp; - int value; - - for (temp = head, value = temp->hash_value; temp->next; ) - { - temp = temp->next; - if (value != temp->hash_value) - { - value = temp->hash_value; - count++; - } - } - return count; -} - -/* -------------------- Output_Constants and subclasses -------------------- */ - -/* This class outputs an enumeration defining some constants. */ - -struct Output_Constants -{ - virtual void output_start () = 0; - virtual void output_item (const char *name, int value) = 0; - virtual void output_end () = 0; - Output_Constants () {} - virtual ~Output_Constants () {} -}; - -/* This class outputs an enumeration in #define syntax. */ - -struct Output_Defines : public Output_Constants -{ - virtual void output_start (); - virtual void output_item (const char *name, int value); - virtual void output_end (); - Output_Defines () {} - virtual ~Output_Defines () {} -}; - -void Output_Defines::output_start () -{ - T (Trace t ("Output_Defines::output_start");) - printf ("\n"); -} - -void Output_Defines::output_item (const char *name, int value) -{ - T (Trace t ("Output_Defines::output_item");) - printf ("#define %s %d\n", name, value); -} - -void Output_Defines::output_end () -{ - T (Trace t ("Output_Defines::output_end");) -} - -/* This class outputs an enumeration using `enum'. */ - -struct Output_Enum : public Output_Constants -{ - virtual void output_start (); - virtual void output_item (const char *name, int value); - virtual void output_end (); - Output_Enum (const char *indent) : indentation (indent) {} - virtual ~Output_Enum () {} -private: - const char *indentation; - int pending_comma; -}; - -void Output_Enum::output_start () -{ - T (Trace t ("Output_Enum::output_start");) - printf ("%senum\n" - "%s {\n", - indentation, indentation); - pending_comma = 0; -} - -void Output_Enum::output_item (const char *name, int value) -{ - T (Trace t ("Output_Enum::output_item");) - if (pending_comma) - printf (",\n"); - printf ("%s %s = %d", indentation, name, value); - pending_comma = 1; -} - -void Output_Enum::output_end () -{ - T (Trace t ("Output_Enum::output_end");) - if (pending_comma) - printf ("\n"); - printf ("%s };\n\n", indentation); -} - -/* Outputs the maximum and minimum hash values etc. */ - -void -Key_List::output_constants (struct Output_Constants& style) -{ - T (Trace t ("Key_List::output_constants");) - - style.output_start (); - style.output_item ("TOTAL_KEYWORDS", total_keys); - style.output_item ("MIN_WORD_LENGTH", min_key_len); - style.output_item ("MAX_WORD_LENGTH", max_key_len); - style.output_item ("MIN_HASH_VALUE", min_hash_value); - style.output_item ("MAX_HASH_VALUE", max_hash_value); - style.output_end (); -} - -/* ------------------------------------------------------------------------- */ - -/* Outputs a keyword, as a string: enclosed in double quotes, escaping - backslashes, double quote and unprintable characters. */ - -static void -output_string (const char *key, int len) -{ - T (Trace t ("output_string");) - - putchar ('"'); - for (; len > 0; len--) - { - unsigned char c = (unsigned char) *key++; - if (isprint (c)) - { - if (c == '"' || c == '\\') - putchar ('\\'); - putchar (c); - } - else - { - /* Use octal escapes, not hexadecimal escapes, because some old - C compilers didn't understand hexadecimal escapes, and because - hexadecimal escapes are not limited to 2 digits, thus needing - special care if the following character happens to be a digit. */ - putchar ('\\'); - putchar ('0' + ((c >> 6) & 7)); - putchar ('0' + ((c >> 3) & 7)); - putchar ('0' + (c & 7)); - } - } - putchar ('"'); -} - -/* ------------------------------------------------------------------------- */ - -/* Outputs a type and a const specifier. - The output is terminated with a space. */ - -static void -output_const_type (const char *const_string, const char *type_string) -{ - if (type_string[strlen(type_string)-1] == '*') - printf ("%s %s", type_string, const_string); - else - printf ("%s%s ", const_string, type_string); -} - -/* ----------------------- Output_Expr and subclasses ----------------------- */ - -/* This class outputs a general expression. */ - -struct Output_Expr -{ - virtual void output_expr () const = 0; - Output_Expr () {} - virtual ~Output_Expr () {} -}; - -/* This class outputs an expression formed by a single string. */ - -struct Output_Expr1 : public Output_Expr -{ - virtual void output_expr () const; - Output_Expr1 (const char *piece1) : p1 (piece1) {} - virtual ~Output_Expr1 () {} -private: - const char *p1; -}; - -void Output_Expr1::output_expr () const -{ - T (Trace t ("Output_Expr1::output_expr");) - printf ("%s", p1); -} - -#if 0 /* unused */ - -/* This class outputs an expression formed by the concatenation of two - strings. */ - -struct Output_Expr2 : public Output_Expr -{ - virtual void output_expr () const; - Output_Expr2 (const char *piece1, const char *piece2) - : p1 (piece1), p2 (piece2) {} - virtual ~Output_Expr2 () {} -private: - const char *p1; - const char *p2; -}; - -void Output_Expr2::output_expr () const -{ - T (Trace t ("Output_Expr2::output_expr");) - printf ("%s%s", p1, p2); -} - -#endif - -/* --------------------- Output_Compare and subclasses --------------------- */ - -/* This class outputs a comparison expression. */ - -struct Output_Compare -{ - virtual void output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const = 0; - Output_Compare () {} - virtual ~Output_Compare () {} -}; - -/* This class outputs a comparison using strcmp. */ - -struct Output_Compare_Strcmp : public Output_Compare -{ - virtual void output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const; - Output_Compare_Strcmp () {} - virtual ~Output_Compare_Strcmp () {} -}; - -void Output_Compare_Strcmp::output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const -{ - T (Trace t ("Output_Compare_Strcmp::output_comparison");) - printf ("*"); - expr1.output_expr (); - printf (" == *"); - expr2.output_expr (); - printf (" && !strcmp ("); - expr1.output_expr (); - printf (" + 1, "); - expr2.output_expr (); - printf (" + 1)"); -} - -/* This class outputs a comparison using strncmp. - Note that the length of expr1 will be available through the local variable - `len'. */ - -struct Output_Compare_Strncmp : public Output_Compare -{ - virtual void output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const; - Output_Compare_Strncmp () {} - virtual ~Output_Compare_Strncmp () {} -}; - -void Output_Compare_Strncmp::output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const -{ - T (Trace t ("Output_Compare_Strncmp::output_comparison");) - printf ("*"); - expr1.output_expr (); - printf (" == *"); - expr2.output_expr (); - printf (" && !strncmp ("); - expr1.output_expr (); - printf (" + 1, "); - expr2.output_expr (); - printf (" + 1, len - 1) && "); - expr2.output_expr (); - printf ("[len] == '\\0'"); -} - -/* This class outputs a comparison using memcmp. - Note that the length of expr1 (available through the local variable `len') - must be verified to be equal to the length of expr2 prior to this - comparison. */ - -struct Output_Compare_Memcmp : public Output_Compare -{ - virtual void output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const; - Output_Compare_Memcmp () {} - virtual ~Output_Compare_Memcmp () {} -}; - -void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1, - const Output_Expr& expr2) const -{ - T (Trace t ("Output_Compare_Memcmp::output_comparison");) - printf ("*"); - expr1.output_expr (); - printf (" == *"); - expr2.output_expr (); - printf (" && !memcmp ("); - expr1.output_expr (); - printf (" + 1, "); - expr2.output_expr (); - printf (" + 1, len - 1)"); -} - -/* ------------------------------------------------------------------------- */ - -/* Generates C code for the hash function that returns the - proper encoding for each key word. */ - -void -Key_List::output_hash_function (void) -{ - T (Trace t ("Key_List::output_hash_function");) - const int max_column = 10; - int field_width; - - /* Calculate maximum number of digits required for MAX_HASH_VALUE. */ - field_width = 2; - for (int trunc = max_hash_value; (trunc /= 10) > 0;) - field_width++; - - /* Output the function's head. */ - if (option[CPLUSPLUS]) - printf ("inline "); - else if (option[KRC] | option[C] | option[ANSIC]) - printf ("#ifdef __GNUC__\n" - "__inline\n" - "#else\n" - "#ifdef __cplusplus\n" - "inline\n" - "#endif\n" - "#endif\n"); - - if (option[KRC] | option[C] | option[ANSIC]) - printf ("static "); - printf ("unsigned int\n"); - if (option[CPLUSPLUS]) - printf ("%s::", option.get_class_name ()); - printf ("%s ", option.get_hash_name ()); - printf (option[KRC] ? - "(str, len)\n" - " register char *str;\n" - " register unsigned int len;\n" : - option[C] ? - "(str, len)\n" - " register const char *str;\n" - " register unsigned int len;\n" : - option[ANSIC] | option[CPLUSPLUS] ? - "(register const char *str, register unsigned int len)\n" : - ""); - - /* Note that when the hash function is called, it has already been verified - that min_key_len <= len <= max_key_len. */ - - /* Output the function's body. */ - printf ("{\n"); - - /* First the asso_values array. */ - printf (" static %s%s asso_values[] =\n" - " {", - const_readonly_array, - smallest_integral_type (max_hash_value + 1)); - - for (int count = 0; count < ALPHA_SIZE; count++) - { - if (count > 0) - printf (","); - if (!(count % max_column)) - printf ("\n "); - printf ("%*d", field_width, - occurrences[count] ? asso_values[count] : max_hash_value + 1); - } - - printf ("\n" - " };\n"); - - /* Optimize special case of ``-k 1,$'' */ - if (option[DEFAULTCHARS]) - printf (" return %sasso_values[%sstr[len - 1]] + asso_values[%sstr[0]];\n", - option[NOLENGTH] ? "" : "len + ", - char_to_index, char_to_index); - else - { - int key_pos; - - option.reset (); - - /* Get first (also highest) key position. */ - key_pos = option.get (); - - if (!option[ALLCHARS] && (key_pos == WORD_END || key_pos <= min_key_len)) - { - /* We can perform additional optimizations here: - Write it out as a single expression. Note that the values - are added as `int's even though the asso_values array may - contain `unsigned char's or `unsigned short's. */ - - printf (" return %s", - option[NOLENGTH] ? "" : "len + "); - - for (; key_pos != WORD_END; ) - { - printf ("asso_values[%sstr[%d]]", char_to_index, key_pos - 1); - if ((key_pos = option.get ()) != EOS) - printf (" + "); - else - break; - } - - if (key_pos == WORD_END) - printf ("asso_values[%sstr[len - 1]]", char_to_index); - - printf (";\n"); - } - else - { - /* We've got to use the correct, but brute force, technique. */ - printf (" register int hval = %s;\n\n" - " switch (%s)\n" - " {\n" - " default:\n", - option[NOLENGTH] ? "0" : "len", - option[NOLENGTH] ? "len" : "hval"); - - /* User wants *all* characters considered in hash. */ - if (option[ALLCHARS]) - { - for (int i = max_key_len; i > 0; i--) - printf (" case %d:\n" - " hval += asso_values[%sstr[%d]];\n", - i, char_to_index, i - 1); - - printf (" break;\n" - " }\n" - " return hval;\n"); - } - else /* do the hard part... */ - { - while (key_pos != WORD_END && key_pos > max_key_len) - if ((key_pos = option.get ()) == EOS) - break; - - if (key_pos != EOS && key_pos != WORD_END) - { - int i = key_pos; - do - { - for ( ; i >= key_pos; i--) - printf (" case %d:\n", i); - - printf (" hval += asso_values[%sstr[%d]];\n", - char_to_index, key_pos - 1); - - key_pos = option.get (); - } - while (key_pos != EOS && key_pos != WORD_END); - - for ( ; i >= min_key_len; i--) - printf (" case %d:\n", i); - } - - printf (" break;\n" - " }\n" - " return hval"); - if (key_pos == WORD_END) - printf (" + asso_values[%sstr[len - 1]]", char_to_index); - printf (";\n"); - } - } - } - printf ("}\n\n"); -} - -/* ------------------------------------------------------------------------- */ - -/* Prints out a table of keyword lengths, for use with the - comparison code in generated function ``in_word_set''. */ - -void -Key_List::output_keylength_table (void) -{ - T (Trace t ("Key_List::output_keylength_table");) - const int columns = 14; - int index; - int column; - const char *indent = option[GLOBAL] ? "" : " "; - List_Node *temp; - - printf ("%sstatic %s%s lengthtable[] =\n%s {", - indent, const_readonly_array, - smallest_integral_type (max_key_len), - indent); - - /* Generate an array of lengths, similar to output_keyword_table. */ - - column = 0; - for (temp = head, index = 0; temp; temp = temp->next) - { - if (option[SWITCH] && !option[TYPE] - && !(temp->link - || (temp->next && temp->hash_value == temp->next->hash_value))) - continue; - - if (index < temp->hash_value && !option[SWITCH] && !option[DUP]) - { - /* Some blank entries. */ - for ( ; index < temp->hash_value; index++) - { - if (index > 0) - printf (","); - if ((column++ % columns) == 0) - printf ("\n%s ", indent); - printf ("%3d", 0); - } - } - - if (index > 0) - printf (","); - if ((column++ % columns) == 0) - printf("\n%s ", indent); - printf ("%3d", temp->key_length); - - /* Deal with links specially. */ - if (temp->link) // implies option[DUP] - for (List_Node *links = temp->link; links; links = links->link) - { - ++index; - printf (","); - if ((column++ % columns) == 0) - printf("\n%s ", indent); - printf ("%3d", links->key_length); - } - - index++; - } - - printf ("\n%s };\n", indent); - if (option[GLOBAL]) - printf ("\n"); -} - -/* ------------------------------------------------------------------------- */ - -static void -output_keyword_entry (List_Node *temp, const char *indent) -{ - printf ("%s ", indent); - if (option[TYPE]) - printf ("{"); - output_string (temp->key, temp->key_length); - if (option[TYPE]) - { - if (strlen (temp->rest) > 0) - printf (",%s", temp->rest); - printf ("}"); - } - if (option[DEBUG]) - printf (" /* hash value = %d, index = %d */", - temp->hash_value, temp->index); -} - -static void -output_keyword_blank_entries (int count, const char *indent) -{ - int columns; - if (option[TYPE]) - { - columns = 58 / (6 + strlen (option.get_initializer_suffix())); - if (columns == 0) - columns = 1; - } - else - { - columns = 9; - } - int column = 0; - for (int i = 0; i < count; i++) - { - if ((column % columns) == 0) - { - if (i > 0) - printf (",\n"); - printf ("%s ", indent); - } - else - { - if (i > 0) - printf (", "); - } - if (option[TYPE]) - printf ("{\"\"%s}", option.get_initializer_suffix()); - else - printf ("\"\""); - column++; - } -} - -/* Prints out the array containing the key words for the hash function. */ - -void -Key_List::output_keyword_table (void) -{ - T (Trace t ("Key_List::output_keyword_table");) - const char *indent = option[GLOBAL] ? "" : " "; - int index; - List_Node *temp; - - printf ("%sstatic ", - indent); - output_const_type (const_readonly_array, struct_tag); - printf ("%s[] =\n" - "%s {\n", - option.get_wordlist_name (), - indent); - - /* Generate an array of reserved words at appropriate locations. */ - - for (temp = head, index = 0; temp; temp = temp->next) - { - if (option[SWITCH] && !option[TYPE] - && !(temp->link - || (temp->next && temp->hash_value == temp->next->hash_value))) - continue; - - if (index > 0) - printf (",\n"); - - if (index < temp->hash_value && !option[SWITCH] && !option[DUP]) - { - /* Some blank entries. */ - output_keyword_blank_entries (temp->hash_value - index, indent); - printf (",\n"); - index = temp->hash_value; - } - - temp->index = index; - - output_keyword_entry (temp, indent); - - /* Deal with links specially. */ - if (temp->link) // implies option[DUP] - for (List_Node *links = temp->link; links; links = links->link) - { - links->index = ++index; - printf (",\n"); - output_keyword_entry (links, indent); - } - - index++; - } - if (index > 0) - printf ("\n"); - - printf ("%s };\n\n", indent); -} - -/* ------------------------------------------------------------------------- */ - -/* Generates the large, sparse table that maps hash values into - the smaller, contiguous range of the keyword table. */ - -void -Key_List::output_lookup_array (void) -{ - T (Trace t ("Key_List::output_lookup_array");) - if (option[DUP]) - { - const int DEFAULT_VALUE = -1; - - /* Because of the way output_keyword_table works, every duplicate set is - stored contiguously in the wordlist array. */ - struct duplicate_entry - { - int hash_value; /* Hash value for this particular duplicate set. */ - int index; /* Index into the main keyword storage array. */ - int count; /* Number of consecutive duplicates at this index. */ - }; - -#if LARGE_STACK_ARRAYS - duplicate_entry duplicates[total_duplicates]; - int lookup_array[max_hash_value + 1 + 2*total_duplicates]; -#else - // Note: we don't use new, because that invokes a custom operator new. - duplicate_entry *duplicates = (duplicate_entry *) - malloc (total_duplicates * sizeof(duplicate_entry) + 1); - int *lookup_array = (int *) - malloc ((max_hash_value + 1 + 2*total_duplicates) * sizeof(int)); - if (duplicates == NULL || lookup_array == NULL) - abort(); -#endif - int lookup_array_size = max_hash_value + 1; - duplicate_entry *dup_ptr = &duplicates[0]; - int *lookup_ptr = &lookup_array[max_hash_value + 1 + 2*total_duplicates]; - - while (lookup_ptr > lookup_array) - *--lookup_ptr = DEFAULT_VALUE; - - /* Now dup_ptr = &duplicates[0] and lookup_ptr = &lookup_array[0]. */ - - for (List_Node *temp = head; temp; temp = temp->next) - { - int hash_value = temp->hash_value; - lookup_array[hash_value] = temp->index; - if (option[DEBUG]) - fprintf (stderr, "keyword = %.*s, index = %d\n", - temp->key_length, temp->key, temp->index); - if (temp->link - || (temp->next && hash_value == temp->next->hash_value)) - { - /* Start a duplicate entry. */ - dup_ptr->hash_value = hash_value; - dup_ptr->index = temp->index; - dup_ptr->count = 1; - - for (;;) - { - for (List_Node *ptr = temp->link; ptr; ptr = ptr->link) - { - dup_ptr->count++; - if (option[DEBUG]) - fprintf (stderr, - "static linked keyword = %.*s, index = %d\n", - ptr->key_length, ptr->key, ptr->index); - } - - if (!(temp->next && hash_value == temp->next->hash_value)) - break; - - temp = temp->next; - - dup_ptr->count++; - if (option[DEBUG]) - fprintf (stderr, "dynamic linked keyword = %.*s, index = %d\n", - temp->key_length, temp->key, temp->index); - } - assert (dup_ptr->count >= 2); - dup_ptr++; - } - } - - while (dup_ptr > duplicates) - { - dup_ptr--; - - if (option[DEBUG]) - fprintf (stderr, - "dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n", - dup_ptr - duplicates, - dup_ptr->hash_value, dup_ptr->index, dup_ptr->count); - - int i; - /* Start searching for available space towards the right part - of the lookup array. */ - for (i = dup_ptr->hash_value; i < lookup_array_size-1; i++) - if (lookup_array[i] == DEFAULT_VALUE - && lookup_array[i + 1] == DEFAULT_VALUE) - goto found_i; - /* If we didn't find it to the right look to the left instead... */ - for (i = dup_ptr->hash_value-1; i >= 0; i--) - if (lookup_array[i] == DEFAULT_VALUE - && lookup_array[i + 1] == DEFAULT_VALUE) - goto found_i; - /* Append to the end of lookup_array. */ - i = lookup_array_size; - lookup_array_size += 2; - found_i: - /* Put in an indirection from dup_ptr->hash_value to i. - At i and i+1 store dup_ptr->index and dup_ptr->count. */ - assert (lookup_array[dup_ptr->hash_value] == dup_ptr->index); - lookup_array[dup_ptr->hash_value] = - 1 - total_keys - i; - lookup_array[i] = - total_keys + dup_ptr->index; - lookup_array[i + 1] = - dup_ptr->count; - /* All these three values are <= -2, distinct from DEFAULT_VALUE. */ - } - - /* The values of the lookup array are now known. */ - - int min = INT_MAX; - int max = INT_MIN; - lookup_ptr = lookup_array + lookup_array_size; - while (lookup_ptr > lookup_array) - { - int val = *--lookup_ptr; - if (min > val) - min = val; - if (max < val) - max = val; - } - - const char *indent = option[GLOBAL] ? "" : " "; - printf ("%sstatic %s%s lookup[] =\n" - "%s {", - indent, const_readonly_array, smallest_integral_type (min, max), - indent); - - int field_width; - /* Calculate maximum number of digits required for MIN..MAX. */ - { - field_width = 2; - for (int trunc = max; (trunc /= 10) > 0;) - field_width++; - } - if (min < 0) - { - int neg_field_width = 2; - for (int trunc = -min; (trunc /= 10) > 0;) - neg_field_width++; - neg_field_width++; /* account for the minus sign */ - if (field_width < neg_field_width) - field_width = neg_field_width; - } - - const int columns = 42 / field_width; - int column; - - column = 0; - for (int i = 0; i < lookup_array_size; i++) - { - if (i > 0) - printf (","); - if ((column++ % columns) == 0) - printf("\n%s ", indent); - printf ("%*d", field_width, lookup_array[i]); - } - printf ("\n%s };\n\n", indent); - -#if !LARGE_STACK_ARRAYS - free ((char *) duplicates); - free ((char *) lookup_array); -#endif - } -} - -/* ------------------------------------------------------------------------- */ - -/* Generate all the tables needed for the lookup function. */ - -void -Key_List::output_lookup_tables (void) -{ - T (Trace t ("Key_List::output_lookup_tables");) - - if (option[SWITCH]) - { - /* Use the switch in place of lookup table. */ - if (option[LENTABLE] && (option[DUP] && total_duplicates > 0)) - output_keylength_table (); - if (option[TYPE] || (option[DUP] && total_duplicates > 0)) - output_keyword_table (); - } - else - { - /* Use the lookup table, in place of switch. */ - if (option[LENTABLE]) - output_keylength_table (); - output_keyword_table (); - output_lookup_array (); - } -} - -/* ------------------------------------------------------------------------- */ - -/* Output a single switch case (including duplicates). Advance list. */ - -static List_Node * -output_switch_case (List_Node *list, int indent, int *jumps_away) -{ - T (Trace t ("output_switch_case");) - - if (option[DEBUG]) - printf ("%*s/* hash value = %4d, keyword = \"%.*s\" */\n", - indent, "", list->hash_value, list->key_length, list->key); - - if (option[DUP] - && (list->link - || (list->next && list->hash_value == list->next->hash_value))) - { - if (option[LENTABLE]) - printf ("%*slengthptr = &lengthtable[%d];\n", - indent, "", list->index); - printf ("%*swordptr = &%s[%d];\n", - indent, "", option.get_wordlist_name (), list->index); - - int count = 0; - for (List_Node *temp = list; ; temp = temp->next) - { - for (List_Node *links = temp; links; links = links->link) - count++; - if (!(temp->next && temp->hash_value == temp->next->hash_value)) - break; - } - - printf ("%*swordendptr = wordptr + %d;\n" - "%*sgoto multicompare;\n", - indent, "", count, - indent, ""); - *jumps_away = 1; - } - else - { - if (option[LENTABLE]) - { - printf ("%*sif (len == %d)\n" - "%*s {\n", - indent, "", list->key_length, - indent, ""); - indent += 4; - } - printf ("%*sresword = ", - indent, ""); - if (option[TYPE]) - printf ("&%s[%d]", option.get_wordlist_name (), list->index); - else - output_string (list->key, list->key_length); - printf (";\n"); - printf ("%*sgoto compare;\n", - indent, ""); - if (option[LENTABLE]) - { - indent -= 4; - printf ("%*s }\n", - indent, ""); - } - else - *jumps_away = 1; - } - - while (list->next && list->hash_value == list->next->hash_value) - list = list->next; - list = list->next; - return list; -} - -/* Output a total of size cases, grouped into num_switches switch statements, - where 0 < num_switches <= size. */ - -static void -output_switches (List_Node *list, int num_switches, int size, int min_hash_value, int max_hash_value, int indent) -{ - T (Trace t ("output_switches");) - - if (option[DEBUG]) - printf ("%*s/* know %d <= key <= %d, contains %d cases */\n", - indent, "", min_hash_value, max_hash_value, size); - - if (num_switches > 1) - { - int part1 = num_switches / 2; - int part2 = num_switches - part1; - int size1 = (int)((double)size / (double)num_switches * (double)part1 + 0.5); - int size2 = size - size1; - - List_Node *temp = list; - for (int count = size1; count > 0; count--) - { - while (temp->hash_value == temp->next->hash_value) - temp = temp->next; - temp = temp->next; - } - - printf ("%*sif (key < %d)\n" - "%*s {\n", - indent, "", temp->hash_value, - indent, ""); - - output_switches (list, part1, size1, min_hash_value, temp->hash_value-1, indent+4); - - printf ("%*s }\n" - "%*selse\n" - "%*s {\n", - indent, "", indent, "", indent, ""); - - output_switches (temp, part2, size2, temp->hash_value, max_hash_value, indent+4); - - printf ("%*s }\n", - indent, ""); - } - else - { - /* Output a single switch. */ - int lowest_case_value = list->hash_value; - if (size == 1) - { - int jumps_away = 0; - assert (min_hash_value <= lowest_case_value); - assert (lowest_case_value <= max_hash_value); - if (min_hash_value == max_hash_value) - output_switch_case (list, indent, &jumps_away); - else - { - printf ("%*sif (key == %d)\n" - "%*s {\n", - indent, "", lowest_case_value, - indent, ""); - output_switch_case (list, indent+4, &jumps_away); - printf ("%*s }\n", - indent, ""); - } - } - else - { - if (lowest_case_value == 0) - printf ("%*sswitch (key)\n", indent, ""); - else - printf ("%*sswitch (key - %d)\n", indent, "", lowest_case_value); - printf ("%*s {\n", - indent, ""); - for (; size > 0; size--) - { - int jumps_away = 0; - printf ("%*s case %d:\n", - indent, "", list->hash_value - lowest_case_value); - list = output_switch_case (list, indent+6, &jumps_away); - if (!jumps_away) - printf ("%*s break;\n", - indent, ""); - } - printf ("%*s }\n", - indent, ""); - } - } -} - -/* Generates C code to perform the keyword lookup. */ - -void -Key_List::output_lookup_function_body (const Output_Compare& comparison) -{ - T (Trace t ("Key_List::output_lookup_function_body");) - - printf (" if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)\n" - " {\n" - " register int key = %s (str, len);\n\n", - option.get_hash_name ()); - - if (option[SWITCH]) - { - int switch_size = num_hash_values (); - int num_switches = option.get_total_switches (); - if (num_switches > switch_size) - num_switches = switch_size; - - printf (" if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)\n" - " {\n"); - if (option[DUP]) - { - if (option[LENTABLE]) - printf (" register %s%s *lengthptr;\n", - const_always, smallest_integral_type (max_key_len)); - printf (" register "); - output_const_type (const_readonly_array, struct_tag); - printf ("*wordptr;\n"); - printf (" register "); - output_const_type (const_readonly_array, struct_tag); - printf ("*wordendptr;\n"); - } - if (option[TYPE]) - { - printf (" register "); - output_const_type (const_readonly_array, struct_tag); - printf ("*resword;\n\n"); - } - else - printf (" register %sresword;\n\n", - struct_tag); - - output_switches (head, num_switches, switch_size, min_hash_value, max_hash_value, 10); - - if (option[DUP]) - { - int indent = 8; - printf ("%*s return 0;\n" - "%*smulticompare:\n" - "%*s while (wordptr < wordendptr)\n" - "%*s {\n", - indent, "", indent, "", indent, "", indent, ""); - if (option[LENTABLE]) - { - printf ("%*s if (len == *lengthptr)\n" - "%*s {\n", - indent, "", indent, ""); - indent += 4; - } - printf ("%*s register %schar *s = ", - indent, "", const_always); - if (option[TYPE]) - printf ("wordptr->%s", option.get_key_name ()); - else - printf ("*wordptr"); - printf (";\n\n" - "%*s if (", - indent, ""); - comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s")); - printf (")\n" - "%*s return %s;\n", - indent, "", - option[TYPE] ? "wordptr" : "s"); - if (option[LENTABLE]) - { - indent -= 4; - printf ("%*s }\n", - indent, ""); - } - if (option[LENTABLE]) - printf ("%*s lengthptr++;\n", - indent, ""); - printf ("%*s wordptr++;\n" - "%*s }\n", - indent, "", indent, ""); - } - printf (" return 0;\n" - " compare:\n"); - if (option[TYPE]) - { - printf (" {\n" - " register %schar *s = resword->%s;\n\n" - " if (", - const_always, option.get_key_name ()); - comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s")); - printf (")\n" - " return resword;\n" - " }\n"); - } - else - { - printf (" if ("); - comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("resword")); - printf (")\n" - " return resword;\n"); - } - printf (" }\n"); - } - else - { - printf (" if (key <= MAX_HASH_VALUE && key >= 0)\n"); - - if (option[DUP]) - { - int indent = 8; - printf ("%*s{\n" - "%*s register int index = lookup[key];\n\n" - "%*s if (index >= 0)\n", - indent, "", indent, "", indent, ""); - if (option[LENTABLE]) - { - printf ("%*s {\n" - "%*s if (len == lengthtable[index])\n", - indent, "", indent, ""); - indent += 4; - } - printf ("%*s {\n" - "%*s register %schar *s = %s[index]", - indent, "", - indent, "", const_always, option.get_wordlist_name ()); - if (option[TYPE]) - printf (".%s", option.get_key_name ()); - printf (";\n\n" - "%*s if (", - indent, ""); - comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s")); - printf (")\n" - "%*s return ", - indent, ""); - if (option[TYPE]) - printf ("&%s[index]", option.get_wordlist_name ()); - else - printf ("s"); - printf (";\n" - "%*s }\n", - indent, ""); - if (option[LENTABLE]) - { - indent -= 4; - printf ("%*s }\n", indent, ""); - } - if (total_duplicates > 0) - { - printf ("%*s else if (index < -TOTAL_KEYWORDS)\n" - "%*s {\n" - "%*s register int offset = - 1 - TOTAL_KEYWORDS - index;\n", - indent, "", indent, "", indent, ""); - if (option[LENTABLE]) - printf ("%*s register %s%s *lengthptr = &lengthtable[TOTAL_KEYWORDS + lookup[offset]];\n", - indent, "", const_always, smallest_integral_type (max_key_len)); - printf ("%*s register ", - indent, ""); - output_const_type (const_readonly_array, struct_tag); - printf ("*wordptr = &%s[TOTAL_KEYWORDS + lookup[offset]];\n", - option.get_wordlist_name ()); - printf ("%*s register ", - indent, ""); - output_const_type (const_readonly_array, struct_tag); - printf ("*wordendptr = wordptr + -lookup[offset + 1];\n\n"); - printf ("%*s while (wordptr < wordendptr)\n" - "%*s {\n", - indent, "", indent, ""); - if (option[LENTABLE]) - { - printf ("%*s if (len == *lengthptr)\n" - "%*s {\n", - indent, "", indent, ""); - indent += 4; - } - printf ("%*s register %schar *s = ", - indent, "", const_always); - if (option[TYPE]) - printf ("wordptr->%s", option.get_key_name ()); - else - printf ("*wordptr"); - printf (";\n\n" - "%*s if (", - indent, ""); - comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s")); - printf (")\n" - "%*s return %s;\n", - indent, "", - option[TYPE] ? "wordptr" : "s"); - if (option[LENTABLE]) - { - indent -= 4; - printf ("%*s }\n", - indent, ""); - } - if (option[LENTABLE]) - printf ("%*s lengthptr++;\n", - indent, ""); - printf ("%*s wordptr++;\n" - "%*s }\n" - "%*s }\n", - indent, "", indent, "", indent, ""); - } - printf ("%*s}\n", - indent, ""); - } - else - { - int indent = 8; - if (option[LENTABLE]) - { - printf ("%*sif (len == lengthtable[key])\n", - indent, ""); - indent += 2; - } - - printf ("%*s{\n" - "%*s register %schar *s = %s[key]", - indent, "", - indent, "", const_always, option.get_wordlist_name ()); - - if (option[TYPE]) - printf (".%s", option.get_key_name ()); - - printf (";\n\n" - "%*s if (", - indent, ""); - comparison.output_comparison (Output_Expr1 ("str"), Output_Expr1 ("s")); - printf (")\n" - "%*s return ", - indent, ""); - if (option[TYPE]) - printf ("&%s[key]", option.get_wordlist_name ()); - else - printf ("s"); - printf (";\n" - "%*s}\n", - indent, ""); - } - } - printf (" }\n" - " return 0;\n"); -} - -/* Generates C code for the lookup function. */ - -void -Key_List::output_lookup_function (void) -{ - T (Trace t ("Key_List::output_lookup_function");) - - /* Output the function's head. */ - if (option[KRC] | option[C] | option[ANSIC]) - printf ("#ifdef __GNUC__\n" - "__inline\n" - "#endif\n"); - - printf ("%s%s\n", - const_for_struct, return_type); - if (option[CPLUSPLUS]) - printf ("%s::", option.get_class_name ()); - printf ("%s ", option.get_function_name ()); - printf (option[KRC] ? - "(str, len)\n" - " register char *str;\n" - " register unsigned int len;\n" : - option[C] ? - "(str, len)\n" - " register const char *str;\n" - " register unsigned int len;\n" : - option[ANSIC] | option[CPLUSPLUS] ? - "(register const char *str, register unsigned int len)\n" : - ""); - - /* Output the function's body. */ - printf ("{\n"); - - if (option[ENUM] && !option[GLOBAL]) - { - Output_Enum style (" "); - output_constants (style); - } - - if (!option[GLOBAL]) - output_lookup_tables (); - - if (option[LENTABLE]) - output_lookup_function_body (Output_Compare_Memcmp ()); - else - { - if (option[COMP]) - output_lookup_function_body (Output_Compare_Strncmp ()); - else - output_lookup_function_body (Output_Compare_Strcmp ()); - } - - printf ("}\n"); -} - -/* ------------------------------------------------------------------------- */ - -/* Generates the hash function and the key word recognizer function - based upon the user's Options. */ - -void -Key_List::output (void) -{ - T (Trace t ("Key_List::output");) - - compute_min_max (); - - if (option[C] | option[ANSIC] | option[CPLUSPLUS]) - { - const_always = "const "; - const_readonly_array = (option[CONST] ? "const " : ""); - const_for_struct = ((option[CONST] && option[TYPE]) ? "const " : ""); - } - else - { - const_always = ""; - const_readonly_array = ""; - const_for_struct = ""; - } - - if (!option[TYPE]) - { - return_type = (const_always[0] ? "const char *" : "char *"); - struct_tag = (const_always[0] ? "const char *" : "char *"); - } - - char_to_index = (option[SEVENBIT] ? "" : "(unsigned char)"); - - printf ("/* "); - if (option[KRC]) - printf ("KR-C"); - else if (option[C]) - printf ("C"); - else if (option[ANSIC]) - printf ("ANSI-C"); - else if (option[CPLUSPLUS]) - printf ("C++"); - printf (" code produced by gperf version %s */\n", version_string); - Options::print_options (); - - printf ("%s\n", include_src); - - if (option[TYPE] && !option[NOTYPE]) /* Output type declaration now, reference it later on.... */ - printf ("%s;\n", array_type); - - if (option[INCLUDE]) - printf ("#include <string.h>\n"); /* Declare strlen(), strcmp(), strncmp(). */ - - if (!option[ENUM]) - { - Output_Defines style; - output_constants (style); - } - else if (option[GLOBAL]) - { - Output_Enum style (""); - output_constants (style); - } - - printf ("/* maximum key range = %d, duplicates = %d */\n\n", - max_hash_value - min_hash_value + 1, total_duplicates); - - if (option[CPLUSPLUS]) - printf ("class %s\n" - "{\n" - "private:\n" - " static inline unsigned int %s (const char *str, unsigned int len);\n" - "public:\n" - " static %s%s%s (const char *str, unsigned int len);\n" - "};\n" - "\n", - option.get_class_name (), option.get_hash_name (), - const_for_struct, return_type, option.get_function_name ()); - - output_hash_function (); - - if (option[GLOBAL]) - output_lookup_tables (); - - output_lookup_function (); - - if (additional_code) - for (int c; (c = getchar ()) != EOF; putchar (c)) - ; - - fflush (stdout); -} - -/* ========================= End of Output routines ========================= */ - -/* Sorts the keys by hash value. */ - -void -Key_List::sort (void) -{ - T (Trace t ("Key_List::sort");) - hash_sort = 1; - occurrence_sort = 0; - - head = merge_sort (head); -} - -/* Dumps the key list to stderr stream. */ - -void -Key_List::dump () -{ - T (Trace t ("Key_List::dump");) - int field_width = option.get_max_keysig_size (); - - fprintf (stderr, "\nList contents are:\n(hash value, key length, index, %*s, keyword):\n", - field_width, "char_set"); - - for (List_Node *ptr = head; ptr; ptr = ptr->next) - fprintf (stderr, "%11d,%11d,%6d, %*.*s, %.*s\n", - ptr->hash_value, ptr->key_length, ptr->index, - field_width, ptr->char_set_length, ptr->char_set, - ptr->key_length, ptr->key); -} - -/* Simple-minded constructor action here... */ - -Key_List::Key_List (void) -{ - T (Trace t ("Key_List::Key_List");) - total_keys = 1; - max_key_len = INT_MIN; - min_key_len = INT_MAX; - array_type = 0; - return_type = 0; - struct_tag = 0; - head = 0; - total_duplicates = 0; - additional_code = 0; -} - -/* Returns the length of entire key list. */ - -int -Key_List::keyword_list_length (void) -{ - T (Trace t ("Key_List::keyword_list_length");) - return list_len; -} - -/* Returns length of longest key read. */ - -int -Key_List::max_key_length (void) -{ - T (Trace t ("Key_List::max_key_length");) - return max_key_len; -} - diff --git a/contrib/gperf/src/key-list.h b/contrib/gperf/src/key-list.h deleted file mode 100644 index 98b8fa5e0c849..0000000000000 --- a/contrib/gperf/src/key-list.h +++ /dev/null @@ -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 diff --git a/contrib/gperf/src/list-node.cc b/contrib/gperf/src/list-node.cc deleted file mode 100644 index 57a04a071fe44..0000000000000 --- a/contrib/gperf/src/list-node.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* Creates and initializes a new list node. - Copyright (C) 1989-1998, 2000 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 "list-node.h" - -#include <stdio.h> -#include <stdlib.h> /* declares exit() */ -#include "options.h" -#include "trace.h" - -/* Sorts the key set alphabetically to speed up subsequent operations. - Uses insertion sort since the set is probably quite small. */ - -inline void -List_Node::set_sort (char *base, int len) -{ - T (Trace t ("List_Node::set_sort");) - int i, j; - - for (i = 0, j = len - 1; i < j; i++) - { - char curr, tmp; - - for (curr = i + 1, tmp = base[curr]; curr > 0 && tmp < base[curr-1]; curr--) - base[curr] = base[curr - 1]; - - base[curr] = tmp; - - } -} - -/* Initializes a List_Node. This requires obtaining memory for the CHAR_SET - initializing them using the information stored in the KEY_POSITIONS array in Options, - and checking for simple errors. It's important to note that KEY and REST are - both pointers to the different offsets into the same block of dynamic memory pointed - to by parameter K. The data member REST is used to store any additional fields - of the input file (it is set to the "" string if Option[TYPE] is not enabled). - This is useful if the user wishes to incorporate a lookup structure, - rather than just an array of keys. Finally, KEY_NUMBER contains a count - of the total number of keys seen so far. This is used to initialize - the INDEX field to some useful value. */ - -List_Node::List_Node (const char *k, int len, const char *r): - link (0), next (0), key (k), key_length (len), rest (r), index (0) -{ - T (Trace t ("List_Node::List_Node");) - char *key_set = new char[(option[ALLCHARS] ? len : option.get_max_keysig_size ())]; - char *ptr = key_set; - int i; - - if (option[ALLCHARS]) /* Use all the character positions in the KEY. */ - for (i = len; i > 0; k++, ptr++, i--) - ++occurrences[(unsigned char)(*ptr = *k)]; - else /* Only use those character positions specified by the user. */ - { - /* Iterate through the list of key_positions, initializing occurrences table - and char_set (via char * pointer ptr). */ - - for (option.reset (); (i = option.get ()) != EOS; ) - { - if (i == WORD_END) /* Special notation for last KEY position, i.e. '$'. */ - *ptr = key[len - 1]; - else if (i <= len) /* Within range of KEY length, so we'll keep it. */ - *ptr = key[i - 1]; - else /* Out of range of KEY length, so we'll just skip it. */ - continue; - ++occurrences[(unsigned char)(*ptr++)]; - } - - /* Didn't get any hits and user doesn't want to consider the - keylength, so there are essentially no usable hash positions! */ - if (ptr == char_set && option[NOLENGTH]) - { - fprintf (stderr, "Can't hash keyword %.*s with chosen key positions.\n", - key_length, key); - exit (1); - } - } - - /* Sort the KEY_SET items alphabetically. */ - set_sort (key_set, ptr - key_set); - - char_set = key_set; - char_set_length = ptr - key_set; -} diff --git a/contrib/gperf/src/list-node.h b/contrib/gperf/src/list-node.h deleted file mode 100644 index 3bd21b3359df8..0000000000000 --- a/contrib/gperf/src/list-node.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This may look like C code, but it is really -*- C++ -*- */ - -/* Data and function members for defining values and operations of a list node. - - Copyright (C) 1989-1998, 2000 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 list_node_h -#define list_node_h 1 - -#include "vectors.h" - -struct List_Node : private Vectors -{ - List_Node *link; /* TRUE if key has an identical KEY_SET as another key. */ - List_Node *next; /* Points to next element on the list. */ - const char *key; /* Each keyword string stored here. */ - int key_length; /* Length of the key. */ - const char *rest; /* Additional information for building hash function. */ - const char *char_set; /* Set of characters to hash, specified by user. */ - int char_set_length; /* Length of char_set. */ - int hash_value; /* Hash value for the key. */ - int occurrence; /* A metric for frequency of key set occurrences. */ - int index; /* Position of this node relative to other nodes. */ - - List_Node (const char *key, int len, const char *rest); - static void set_sort (char *base, int len); -}; - -#endif diff --git a/contrib/gperf/src/main.cc b/contrib/gperf/src/main.cc deleted file mode 100644 index 03b6c7ea242bc..0000000000000 --- a/contrib/gperf/src/main.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* Driver program for the Gen_Perf hash function generator - Copyright (C) 1989-1998, 2000 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. */ - -/* Simple driver program for the Gen_Perf.hash function generator. - Most of the hard work is done in class Gen_Perf and its class methods. */ - -#include "config.h" -#include <sys/types.h> -#if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#endif - -#include <stdio.h> -#include "options.h" -#include "gen-perf.h" -#include "trace.h" - -int -main (int argc, char *argv[]) -{ - T (Trace t ("main");) - -#if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK) - /* Get rid of any avoidable limit on stack size. */ - { - struct rlimit rlim; - if (getrlimit (RLIMIT_STACK, &rlim) == 0) - if (rlim.rlim_cur < rlim.rlim_max) - { - rlim.rlim_cur = rlim.rlim_max; - setrlimit (RLIMIT_STACK, &rlim); - } - } -#endif /* RLIMIT_STACK */ - - /* Sets the Options. */ - option (argc, argv); - - /* Initializes the key word list. */ - Gen_Perf generate_table; - - /* Generates and prints the Gen_Perf hash table. */ - int status = generate_table (); - - /* Check for write error on stdout. */ - if (fflush (stdout) || ferror (stdout)) - status = 1; - - /* Don't use exit() here, it skips the destructors. */ - return status; -} diff --git a/contrib/gperf/src/new.cc b/contrib/gperf/src/new.cc deleted file mode 100644 index 8c6728ec4b2ae..0000000000000 --- a/contrib/gperf/src/new.cc +++ /dev/null @@ -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; -} diff --git a/contrib/gperf/src/options.cc b/contrib/gperf/src/options.cc deleted file mode 100644 index d15e21cee8ce3..0000000000000 --- a/contrib/gperf/src/options.cc +++ /dev/null @@ -1,727 +0,0 @@ -/* Handles parsing the Options provided to the user. - Copyright (C) 1989-1998, 2000 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 <stdio.h> -#include <stdlib.h> /* declares atoi(), abs(), exit() */ -#include <string.h> /* declares strcmp() */ -#include "getopt.h" -#include "options.h" -#include "iterator.h" -#include "trace.h" -#include "vectors.h" -#include "version.h" - -/* Global option coordinator for the entire program. */ -Options option; - -/* Records the program name. */ -const char *program_name; - -/* Size to jump on a collision. */ -static const int DEFAULT_JUMP_VALUE = 5; - -/* Default name for generated lookup function. */ -static const char *const DEFAULT_NAME = "in_word_set"; - -/* Default name for the key component. */ -static const char *const DEFAULT_KEY = "name"; - -/* Default struct initializer suffix. */ -static const char *const DEFAULT_INITIALIZER_SUFFIX = ""; - -/* Default name for the generated class. */ -static const char *const DEFAULT_CLASS_NAME = "Perfect_Hash"; - -/* Default name for generated hash function. */ -static const char *const DEFAULT_HASH_NAME = "hash"; - -/* Default name for generated hash table array. */ -static const char *const DEFAULT_WORDLIST_NAME = "wordlist"; - -/* Default delimiters that separate keywords from their attributes. */ -static const char *const DEFAULT_DELIMITERS = ",\n"; - -int Options::option_word; -int Options::total_switches; -int Options::total_keysig_size; -int Options::size; -int Options::key_pos; -int Options::jump; -int Options::initial_asso_value; -int Options::argument_count; -int Options::iterations; -char **Options::argument_vector; -const char *Options::function_name; -const char *Options::key_name; -const char *Options::initializer_suffix; -const char *Options::class_name; -const char *Options::hash_name; -const char *Options::wordlist_name; -const char *Options::delimiters; -char Options::key_positions[MAX_KEY_POS]; - -/* Prints program usage to given stream. */ - -void -Options::short_usage (FILE * strm) -{ - T (Trace t ("Options::short_usage");) - fprintf (strm, "Usage: %s [-cCdDef[num]F<initializers>GhH<hashname>i<init>Ijk<keys>K<keyname>lL<language>nN<function name>ors<size>S<switches>tTvW<wordlistname>Z<class name>7] [input-file]\n" - "Try `%s --help' for more information.\n", - program_name, program_name); -} - -void -Options::long_usage (FILE * strm) -{ - T (Trace t ("Options::long_usage");) - fprintf (strm, - "GNU `gperf' generates perfect hash functions.\n" - "\n" - "Usage: %s [OPTION]... [INPUT-FILE]\n" - "\n" - "If a long option shows an argument as mandatory, then it is mandatory\n" - "for the equivalent short option also.\n" - "\n" - "Input file interpretation:\n" - " -e, --delimiters=DELIMITER-LIST\n" - " Allow user to provide a string containing delimiters\n" - " used to separate keywords from their attributes.\n" - " Default is \",\\n\".\n" - " -t, --struct-type Allows the user to include a structured type\n" - " declaration for generated code. Any text before %%%%\n" - " is considered part of the type declaration. Key\n" - " words and additional fields may follow this, one\n" - " group of fields per line.\n" - "\n" - "Language for the output code:\n" - " -L, --language=LANGUAGE-NAME\n" - " Generates code in the specified language. Languages\n" - " handled are currently C++, ANSI-C, C, and KR-C. The\n" - " default is C.\n" - "\n" - "Details in the output code:\n" - " -K, --slot-name=NAME Select name of the keyword component in the keyword\n" - " structure.\n" - " -F, --initializer-suffix=INITIALIZERS\n" - " Initializers for additional components in the keyword\n" - " structure.\n" - " -H, --hash-fn-name=NAME\n" - " Specify name of generated hash function. Default is\n" - " `hash'.\n" - " -N, --lookup-fn-name=NAME\n" - " Specify name of generated lookup function. Default\n" - " name is `in_word_set'.\n" - " -Z, --class-name=NAME Specify name of generated C++ class. Default name is\n" - " `Perfect_Hash'.\n" - " -7, --seven-bit Assume 7-bit characters.\n" - " -c, --compare-strncmp Generate comparison code using strncmp rather than\n" - " strcmp.\n" - " -C, --readonly-tables Make the contents of generated lookup tables\n" - " constant, i.e., readonly.\n" - " -E, --enum Define constant values using an enum local to the\n" - " lookup function rather than with defines.\n" - " -I, --includes Include the necessary system include file <string.h>\n" - " at the beginning of the code.\n" - " -G, --global Generate the static table of keywords as a static\n" - " global variable, rather than hiding it inside of the\n" - " lookup function (which is the default behavior).\n" - " -W, --word-array-name=NAME\n" - " Specify name of word list array. Default name is\n" - " `wordlist'.\n" - " -S, --switch=COUNT Causes the generated C code to use a switch\n" - " statement scheme, rather than an array lookup table.\n" - " This can lead to a reduction in both time and space\n" - " requirements for some keyfiles. The COUNT argument\n" - " determines how many switch statements are generated.\n" - " A value of 1 generates 1 switch containing all the\n" - " elements, a value of 2 generates 2 tables with 1/2\n" - " the elements in each table, etc. If COUNT is very\n" - " large, say 1000000, the generated C code does a\n" - " binary search.\n" - " -T, --omit-struct-type\n" - " Prevents the transfer of the type declaration to the\n" - " output file. Use this option if the type is already\n" - " defined elsewhere.\n" - "\n" - "Algorithm employed by gperf:\n" - " -k, --key-positions=KEYS\n" - " Select the key positions used in the hash function.\n" - " The allowable choices range between 1-%d, inclusive.\n" - " The positions are separated by commas, ranges may be\n" - " used, and key positions may occur in any order.\n" - " Also, the meta-character '*' causes the generated\n" - " hash function to consider ALL key positions, and $\n" - " indicates the ``final character'' of a key, e.g.,\n" - " $,1,2,4,6-10.\n" - " -l, --compare-strlen Compare key lengths before trying a string\n" - " comparison. This helps cut down on the number of\n" - " string comparisons made during the lookup.\n" - " -D, --duplicates Handle keywords that hash to duplicate values. This\n" - " is useful for certain highly redundant keyword sets.\n" - " -f, --fast=ITERATIONS Generate the gen-perf.hash function ``fast''. This\n" - " decreases gperf's running time at the cost of\n" - " minimizing generated table size. The numeric\n" - " argument represents the number of times to iterate\n" - " when resolving a collision. `0' means ``iterate by\n" - " the number of keywords''.\n" - " -i, --initial-asso=N Provide an initial value for the associate values\n" - " array. Default is 0. Setting this value larger helps\n" - " inflate the size of the final table.\n" - " -j, --jump=JUMP-VALUE Affects the ``jump value'', i.e., how far to advance\n" - " the associated character value upon collisions. Must\n" - " be an odd number, default is %d.\n" - " -n, --no-strlen Do not include the length of the keyword when\n" - " computing the hash function.\n" - " -o, --occurrence-sort Reorders input keys by frequency of occurrence of\n" - " the key sets. This should decrease the search time\n" - " dramatically.\n" - " -r, --random Utilizes randomness to initialize the associated\n" - " values table.\n" - " -s, --size-multiple=N Affects the size of the generated hash table. The\n" - " numeric argument N indicates ``how many times larger\n" - " or smaller'' the associated value range should be,\n" - " in relationship to the number of keys, e.g. a value\n" - " of 3 means ``allow the maximum associated value to\n" - " be about 3 times larger than the number of input\n" - " keys.'' Conversely, a value of -3 means ``make the\n" - " maximum associated value about 3 times smaller than\n" - " the number of input keys. A larger table should\n" - " decrease the time required for an unsuccessful\n" - " search, at the expense of extra table space. Default\n" - " value is 1.\n" - "\n" - "Informative output:\n" - " -h, --help Print this message.\n" - " -v, --version Print the gperf version number.\n" - " -d, --debug Enables the debugging option (produces verbose\n" - " output to the standard error).\n" - "\n" - "Report bugs to <bug-gnu-utils@gnu.org>.\n" - , program_name, MAX_KEY_POS - 1, DEFAULT_JUMP_VALUE); -} - -/* Output command-line Options. */ - -void -Options::print_options (void) -{ - T (Trace t ("Options::print_options");) - int i; - - printf ("/* Command-line: "); - - for (i = 0; i < argument_count; i++) - { - const char *arg = argument_vector[i]; - - /* Escape arg if it contains shell metacharacters. */ - if (*arg == '-') - { - putchar (*arg); - arg++; - if (*arg >= 'A' && *arg <= 'Z' || *arg >= 'a' && *arg <= 'z') - { - putchar (*arg); - arg++; - } - } - if (strpbrk (arg, "\t\n !\"#$&'()*;<>?[\\]`{|}~") != NULL) - { - if (strchr (arg, '\'') != NULL) - { - putchar ('"'); - for (; *arg; arg++) - { - if (*arg == '\"' || *arg == '\\' || *arg == '$') - putchar ('\\'); - putchar (*arg); - } - putchar ('"'); - } - else - { - putchar ('\''); - for (; *arg; arg++) - { - if (*arg == '\\') - putchar ('\\'); - putchar (*arg); - } - putchar ('\''); - } - } - else - printf ("%s", arg); - - printf (" "); - } - - printf (" */"); -} - -/* Sorts the key positions *IN REVERSE ORDER!!* - This makes further routines more efficient. Especially when generating code. - Uses a simple Insertion Sort since the set is probably ordered. - Returns 1 if there are no duplicates, 0 otherwise. */ - -inline int -Options::key_sort (char *base, int len) -{ - T (Trace t ("Options::key_sort");) - int i, j; - - for (i = 0, j = len - 1; i < j; i++) - { - int curr, tmp; - - for (curr = i + 1,tmp = base[curr]; curr > 0 && tmp >= base[curr - 1]; curr--) - if ((base[curr] = base[curr - 1]) == tmp) /* oh no, a duplicate!!! */ - return 0; - - base[curr] = tmp; - } - - return 1; -} - -/* Sets the default Options. */ - -Options::Options (void) -{ - T (Trace t ("Options::Options");) - key_positions[0] = WORD_START; - key_positions[1] = WORD_END; - key_positions[2] = EOS; - total_keysig_size = 2; - delimiters = DEFAULT_DELIMITERS; - jump = DEFAULT_JUMP_VALUE; - option_word = DEFAULTCHARS | C; - function_name = DEFAULT_NAME; - key_name = DEFAULT_KEY; - initializer_suffix = DEFAULT_INITIALIZER_SUFFIX; - hash_name = DEFAULT_HASH_NAME; - wordlist_name = DEFAULT_WORDLIST_NAME; - class_name = DEFAULT_CLASS_NAME; - total_switches = size = 1; - initial_asso_value = iterations = 0; -} - -/* Dumps option status when debug is set. */ - -Options::~Options (void) -{ - T (Trace t ("Options::~Options");) - if (option_word & DEBUG) - { - char *ptr; - - fprintf (stderr, "\ndumping Options:" - "\nDEBUG is.......: %s" - "\nORDER is.......: %s" - "\nTYPE is........: %s" - "\nRANDOM is......: %s" - "\nDEFAULTCHARS is: %s" - "\nSWITCH is......: %s" - "\nNOLENGTH is....: %s" - "\nLENTABLE is....: %s" - "\nDUP is.........: %s" - "\nFAST is........: %s" - "\nCOMP is........: %s" - "\nNOTYPE is......: %s" - "\nGLOBAL is......: %s" - "\nCONST is.......: %s" - "\nKRC is.........: %s" - "\nC is...........: %s" - "\nANSIC is.......: %s" - "\nCPLUSPLUS is...: %s" - "\nENUM is........: %s" - "\nINCLUDE is.....: %s" - "\nSEVENBIT is....: %s" - "\niterations = %d" - "\nlookup function name = %s" - "\nhash function name = %s" - "\nword list name = %s" - "\nkey name = %s" - "\ninitializer suffix = %s" - "\njump value = %d" - "\nmax associated value = %d" - "\ninitial associated value = %d" - "\ndelimiters = %s" - "\nnumber of switch statements = %d\n", - option_word & DEBUG ? "enabled" : "disabled", - option_word & ORDER ? "enabled" : "disabled", - option_word & TYPE ? "enabled" : "disabled", - option_word & RANDOM ? "enabled" : "disabled", - option_word & DEFAULTCHARS ? "enabled" : "disabled", - option_word & SWITCH ? "enabled" : "disabled", - option_word & NOLENGTH ? "enabled" : "disabled", - option_word & LENTABLE ? "enabled" : "disabled", - option_word & DUP ? "enabled" : "disabled", - option_word & FAST ? "enabled" : "disabled", - option_word & COMP ? "enabled" : "disabled", - option_word & NOTYPE ? "enabled" : "disabled", - option_word & GLOBAL ? "enabled" : "disabled", - option_word & CONST ? "enabled" : "disabled", - option_word & KRC ? "enabled" : "disabled", - option_word & C ? "enabled" : "disabled", - option_word & ANSIC ? "enabled" : "disabled", - option_word & CPLUSPLUS ? "enabled" : "disabled", - option_word & ENUM ? "enabled" : "disabled", - option_word & INCLUDE ? "enabled" : "disabled", - option_word & SEVENBIT ? "enabled" : "disabled", - iterations, - function_name, hash_name, wordlist_name, key_name, - initializer_suffix, jump, size - 1, initial_asso_value, - delimiters, total_switches); - if (option_word & ALLCHARS) - fprintf (stderr, "all characters are used in the hash function\n"); - - fprintf (stderr, "maximum keysig size = %d\nkey positions are: \n", - total_keysig_size); - - for (ptr = key_positions; *ptr != EOS; ptr++) - if (*ptr == WORD_END) - fprintf (stderr, "$\n"); - else - fprintf (stderr, "%d\n", *ptr); - - fprintf (stderr, "finished dumping Options\n"); - } -} - - -/* Parses the command line Options and sets appropriate flags in option_word. */ - -static const struct option long_options[] = -{ - { "delimiters", required_argument, 0, 'e' }, - { "struct-type", no_argument, 0, 't' }, - { "language", required_argument, 0, 'L' }, - { "slot-name", required_argument, 0, 'K' }, - { "initializer-suffix", required_argument, 0, 'F' }, - { "hash-fn-name", required_argument, 0, 'H' }, - { "lookup-fn-name", required_argument, 0, 'N' }, - { "class-name", required_argument, 0, 'Z' }, - { "seven-bit", no_argument, 0, '7' }, - { "compare-strncmp", no_argument, 0, 'c' }, - { "readonly-tables", no_argument, 0, 'C' }, - { "enum", no_argument, 0, 'E' }, - { "includes", no_argument, 0, 'I' }, - { "global", no_argument, 0, 'G' }, - { "word-array-name", required_argument, 0, 'W' }, - { "switch", required_argument, 0, 'S' }, - { "omit-struct-type", no_argument, 0, 'T' }, - { "key-positions", required_argument, 0, 'k' }, - { "compare-strlen", no_argument, 0, 'l' }, - { "duplicates", no_argument, 0, 'D' }, - { "fast", required_argument, 0, 'f' }, - { "initial-asso", required_argument, 0, 'i' }, - { "jump", required_argument, 0, 'j' }, - { "no-strlen", no_argument, 0, 'n' }, - { "occurrence-sort", no_argument, 0, 'o' }, - { "random", no_argument, 0, 'r' }, - { "size-multiple", required_argument, 0, 's' }, - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'v' }, - { "debug", no_argument, 0, 'd' }, - { 0, no_argument, 0, 0 } -}; - -void -Options::operator() (int argc, char *argv[]) -{ - T (Trace t ("Options::operator()");) - int option_char; - - program_name = argv[0]; - argument_count = argc; - argument_vector = argv; - - while ((option_char = - getopt_long (argument_count, argument_vector, - "adcCDe:Ef:F:gGhH:i:Ij:k:K:lL:nN:oprs:S:tTvW:Z:7", - long_options, (int *)0)) - != -1) - { - switch (option_char) - { - case 'a': /* Generated code uses the ANSI prototype format. */ - break; /* This is now the default. */ - case 'c': /* Generate strncmp rather than strcmp. */ - { - option_word |= COMP; - break; - } - case 'C': /* Make the generated tables readonly (const). */ - { - option_word |= CONST; - break; - } - case 'd': /* Enable debugging option. */ - { - option_word |= DEBUG; - fprintf (stderr, "Starting program %s, version %s, with debugging on.\n", - program_name, version_string); - break; - } - case 'D': /* Enable duplicate option. */ - { - option_word |= DUP; - break; - } - case 'e': /* Allows user to provide keyword/attribute separator */ - { - option.delimiters = /*getopt*/optarg; - break; - } - case 'E': - { - option_word |= ENUM; - break; - } - case 'f': /* Generate the hash table ``fast.'' */ - { - option_word |= FAST; - if ((iterations = atoi (/*getopt*/optarg)) < 0) - { - fprintf (stderr, "iterations value must not be negative, assuming 0\n"); - iterations = 0; - } - break; - } - case 'F': - { - initializer_suffix = /*getopt*/optarg; - break; - } - case 'g': /* Use the ``inline'' keyword for generated sub-routines, ifdef __GNUC__. */ - break; /* This is now the default. */ - case 'G': /* Make the keyword table a global variable. */ - { - option_word |= GLOBAL; - break; - } - case 'h': /* Displays a list of helpful Options to the user. */ - { - long_usage (stdout); - exit (0); - } - case 'H': /* Sets the name for the hash function */ - { - hash_name = /*getopt*/optarg; - break; - } - case 'i': /* Sets the initial value for the associated values array. */ - { - if ((initial_asso_value = atoi (/*getopt*/optarg)) < 0) - fprintf (stderr, "Initial value %d should be non-zero, ignoring and continuing.\n", initial_asso_value); - if (option[RANDOM]) - fprintf (stderr, "warning, -r option superceeds -i, ignoring -i option and continuing\n"); - break; - } - case 'I': /* Enable #include statements. */ - { - option_word |= INCLUDE; - break; - } - case 'j': /* Sets the jump value, must be odd for later algorithms. */ - { - if ((jump = atoi (/*getopt*/optarg)) < 0) - { - fprintf (stderr, "Jump value %d must be a positive number.\n", jump); - short_usage (stderr); - exit (1); - } - else if (jump && ((jump % 2) == 0)) - fprintf (stderr, "Jump value %d should be odd, adding 1 and continuing...\n", jump++); - break; - } - case 'k': /* Sets key positions used for hash function. */ - { - const int BAD_VALUE = -1; - int value; - Iterator expand (/*getopt*/optarg, 1, MAX_KEY_POS - 1, WORD_END, BAD_VALUE, EOS); - - if (/*getopt*/optarg [0] == '*') /* Use all the characters for hashing!!!! */ - option_word = (option_word & ~DEFAULTCHARS) | ALLCHARS; - else - { - char *key_pos; - - for (key_pos = key_positions; (value = expand ()) != EOS; key_pos++) - if (value == BAD_VALUE) - { - fprintf (stderr, "Illegal key value or range, use 1,2,3-%d,'$' or '*'.\n", - MAX_KEY_POS - 1); - short_usage (stderr); - exit (1); - } - else - *key_pos = value;; - - *key_pos = EOS; - - if (! (total_keysig_size = (key_pos - key_positions))) - { - fprintf (stderr, "No keys selected.\n"); - short_usage (stderr); - exit (1); - } - else if (! key_sort (key_positions, total_keysig_size)) - { - fprintf (stderr, "Duplicate keys selected\n"); - short_usage (stderr); - exit (1); - } - - if (total_keysig_size != 2 - || (key_positions[0] != 1 || key_positions[1] != WORD_END)) - option_word &= ~DEFAULTCHARS; - } - break; - } - case 'K': /* Make this the keyname for the keyword component field. */ - { - key_name = /*getopt*/optarg; - break; - } - case 'l': /* Create length table to avoid extra string compares. */ - { - option_word |= LENTABLE; - break; - } - case 'L': /* Deal with different generated languages. */ - { - option_word &= ~(KRC | C | ANSIC | CPLUSPLUS); - if (!strcmp (/*getopt*/optarg, "KR-C")) - option_word |= KRC; - else if (!strcmp (/*getopt*/optarg, "C")) - option_word |= C; - else if (!strcmp (/*getopt*/optarg, "ANSI-C")) - option_word |= ANSIC; - else if (!strcmp (/*getopt*/optarg, "C++")) - option_word |= CPLUSPLUS; - else - { - fprintf (stderr, "unsupported language option %s, defaulting to C\n", /*getopt*/optarg); - option_word |= C; - } - break; - } - case 'n': /* Don't include the length when computing hash function. */ - { - option_word |= NOLENGTH; - break; - } - case 'N': /* Make generated lookup function name be optarg */ - { - function_name = /*getopt*/optarg; - break; - } - case 'o': /* Order input by frequency of key set occurrence. */ - { - option_word |= ORDER; - break; - } - case 'p': /* Generated lookup function a pointer instead of int. */ - break; /* This is now the default. */ - case 'r': /* Utilize randomness to initialize the associated values table. */ - { - option_word |= RANDOM; - if (option.initial_asso_value != 0) - fprintf (stderr, "warning, -r option superceeds -i, disabling -i option and continuing\n"); - break; - } - case 's': /* Range of associated values, determines size of final table. */ - { - if (abs (size = atoi (/*getopt*/optarg)) > 50) - fprintf (stderr, "%d is excessive, did you really mean this?! (try `%s --help' for help)\n", size, program_name); - break; - } - case 'S': /* Generate switch statement output, rather than lookup table. */ - { - option_word |= SWITCH; - if ((option.total_switches = atoi (/*getopt*/optarg)) <= 0) - { - fprintf (stderr, "number of switches %s must be a positive number\n", /*getopt*/optarg); - short_usage (stderr); - exit (1); - } - break; - } - case 't': /* Enable the TYPE mode, allowing arbitrary user structures. */ - { - option_word |= TYPE; - break; - } - case 'T': /* Don't print structure definition. */ - { - option_word |= NOTYPE; - break; - } - case 'v': /* Print out the version and quit. */ - fprintf (stdout, "GNU gperf %s\n", version_string); - exit (0); - case 'W': /* Sets the name for the hash table array */ - { - wordlist_name = /*getopt*/optarg; - break; - } - case 'Z': /* Set the class name. */ - { - class_name = /*getopt*/optarg; - break; - } - case '7': /* Assume 7-bit characters. */ - { - option_word |= SEVENBIT; - Vectors::ALPHA_SIZE = 128; - break; - } - default: - short_usage (stderr); - exit (1); - } - - } - - if (argv[/*getopt*/optind] && ! freopen (argv[/*getopt*/optind], "r", stdin)) - { - fprintf (stderr, "Cannot open keyword file `%s'\n", argv[/*getopt*/optind]); - short_usage (stderr); - exit (1); - } - - if (++/*getopt*/optind < argc) - { - fprintf (stderr, "Extra trailing arguments to %s.\n", program_name); - short_usage (stderr); - exit (1); - } -} - -#ifndef __OPTIMIZE__ - -#define INLINE /* not inline */ -#include "options.icc" -#undef INLINE - -#endif /* not defined __OPTIMIZE__ */ diff --git a/contrib/gperf/src/options.icc b/contrib/gperf/src/options.icc deleted file mode 100644 index 82fe5375c23fe..0000000000000 --- a/contrib/gperf/src/options.icc +++ /dev/null @@ -1,183 +0,0 @@ -/* Inline Functions for options.{h,cc}. - - Copyright (C) 1989-1998, 2000 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. */ - -// This needs: -//#include "trace.h" - -/* TRUE if option enable, else FALSE. */ -INLINE int -Options::operator[] (Option_Type option) -{ - T (Trace t ("Options::operator[]");) - return option_word & option; -} - -/* Enables option OPT. */ -INLINE void -Options::operator = (enum Option_Type opt) -{ - T (Trace t ("Options::operator=");) - option_word |= opt; -} - -/* Disables option OPT. */ -INLINE void -Options::operator != (enum Option_Type opt) -{ - T (Trace t ("Options::operator!=");) - option_word &= ~opt; -} - -/* Initializes the key Iterator. */ -INLINE void -Options::reset (void) -{ - T (Trace t ("Options::reset");) - key_pos = 0; -} - -/* Returns current key_position and advance index. */ -INLINE int -Options::get (void) -{ - T (Trace t ("Options::get");) - return key_positions[key_pos++]; -} - -/* Sets the size of the table size. */ -INLINE void -Options::set_asso_max (int r) -{ - T (Trace t ("Options::set_asso_max");) - size = r; -} - -/* Returns the size of the table size. */ -INLINE int -Options::get_asso_max (void) -{ - T (Trace t ("Options::get_asso_max");) - return size; -} - -/* Returns total distinct key positions. */ -INLINE int -Options::get_max_keysig_size (void) -{ - T (Trace t ("Options::get_max_keysig_size");) - return total_keysig_size; -} - -/* Sets total distinct key positions. */ -INLINE void -Options::set_keysig_size (int size) -{ - T (Trace t ("Options::set_keysig_size");) - total_keysig_size = size; -} - -/* Returns the jump value. */ -INLINE int -Options::get_jump (void) -{ - T (Trace t ("Options::get_jump");) - return jump; -} - -/* Returns the generated function name. */ -INLINE const char * -Options::get_function_name (void) -{ - T (Trace t ("Options::get_function_name");) - return function_name; -} - -/* Returns the keyword key name. */ -INLINE const char * -Options::get_key_name (void) -{ - T (Trace t ("Options::get_key_name");) - return key_name; -} - -/* Returns the struct initializer suffix. */ -INLINE const char * -Options::get_initializer_suffix (void) -{ - T (Trace t ("Options::get_initializer_suffix");) - return initializer_suffix; -} - -/* Returns the hash function name. */ -INLINE const char * -Options::get_hash_name (void) -{ - T (Trace t ("Options::get_hash_name");) - return hash_name; -} - -/* Returns the hash table array name. */ -INLINE const char * -Options::get_wordlist_name (void) -{ - T (Trace t ("Options::get_wordlist_name");) - return wordlist_name; -} - -/* Returns the generated class name. */ -INLINE const char * -Options::get_class_name (void) -{ - T (Trace t ("Options::get_class_name");) - return class_name; -} - -/* Returns the initial associated character value. */ -INLINE int -Options::initial_value (void) -{ - T (Trace t ("Options::initial_value");) - return initial_asso_value; -} - -/* Returns the iterations value. */ -INLINE int -Options::get_iterations (void) -{ - T (Trace t ("Options::get_iterations");) - return iterations; -} - -/* Returns the string used to delimit keywords from other attributes. */ -INLINE const char * -Options::get_delimiter () -{ - T (Trace t ("Options::get_delimiter");) - return delimiters; -} - -/* Gets the total number of switch statements to generate. */ -INLINE int -Options::get_total_switches () -{ - T (Trace t ("Options::get_total_switches");) - return total_switches; -} diff --git a/contrib/gperf/src/read-line.cc b/contrib/gperf/src/read-line.cc deleted file mode 100644 index 8cb0971cb6b97..0000000000000 --- a/contrib/gperf/src/read-line.cc +++ /dev/null @@ -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__ */ diff --git a/contrib/gperf/src/read-line.h b/contrib/gperf/src/read-line.h deleted file mode 100644 index b243c84749b59..0000000000000 --- a/contrib/gperf/src/read-line.h +++ /dev/null @@ -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 diff --git a/contrib/gperf/src/read-line.icc b/contrib/gperf/src/read-line.icc deleted file mode 100644 index cdb5bf6f8c0a1..0000000000000 --- a/contrib/gperf/src/read-line.icc +++ /dev/null @@ -1,47 +0,0 @@ -/* Inline Functions for read-line.{h,cc}. - - 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. */ - -// 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); -} diff --git a/contrib/gperf/src/trace.cc b/contrib/gperf/src/trace.cc deleted file mode 100644 index e571abae42398..0000000000000 --- a/contrib/gperf/src/trace.cc +++ /dev/null @@ -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); -} diff --git a/contrib/gperf/src/trace.h b/contrib/gperf/src/trace.h deleted file mode 100644 index f16fcc5bd99ec..0000000000000 --- a/contrib/gperf/src/trace.h +++ /dev/null @@ -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 diff --git a/contrib/gperf/src/vectors.cc b/contrib/gperf/src/vectors.cc deleted file mode 100644 index 1da014d4a31ad..0000000000000 --- a/contrib/gperf/src/vectors.cc +++ /dev/null @@ -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]; diff --git a/contrib/gperf/src/vectors.h b/contrib/gperf/src/vectors.h deleted file mode 100644 index 28a105397ebbd..0000000000000 --- a/contrib/gperf/src/vectors.h +++ /dev/null @@ -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 diff --git a/contrib/gperf/src/version.cc b/contrib/gperf/src/version.cc deleted file mode 100644 index 8f07c695d537d..0000000000000 --- a/contrib/gperf/src/version.cc +++ /dev/null @@ -1,22 +0,0 @@ -/* Current program version number. - - Copyright (C) 1989-1998, 2000 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. */ - -const char *version_string = "2.7.2"; diff --git a/contrib/gperf/src/version.h b/contrib/gperf/src/version.h deleted file mode 100644 index 4ffba2ec91a1f..0000000000000 --- a/contrib/gperf/src/version.h +++ /dev/null @@ -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; diff --git a/contrib/gperf/tests/Makefile.in b/contrib/gperf/tests/Makefile.in deleted file mode 100644 index a7e3be0af6c35..0000000000000 --- a/contrib/gperf/tests/Makefile.in +++ /dev/null @@ -1,232 +0,0 @@ -# Makefile for gperf/tests - -# Copyright (C) 1989, 1992, 1993, 1995, 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. - -#### 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 : - diff --git a/contrib/gperf/tests/ada-pred.exp b/contrib/gperf/tests/ada-pred.exp deleted file mode 100644 index 33caaa32ea1f7..0000000000000 --- a/contrib/gperf/tests/ada-pred.exp +++ /dev/null @@ -1,54 +0,0 @@ -in word set boolean -in word set character -in word set constraint_error -in word set false -in word set float -in word set integer -in word set natural -in word set numeric_error -in word set positive -in word set program_error -in word set storage_error -in word set string -in word set tasking_error -in word set true -in word set address -in word set aft -in word set base -in word set callable -in word set constrained -in word set count -in word set delta -in word set digits -in word set emax -in word set epsilon -in word set first -in word set firstbit -in word set fore -in word set image -in word set large -in word set last -in word set lastbit -in word set length -in word set machine_emax -in word set machine_emin -in word set machine_mantissa -in word set machine_overflows -in word set machine_radix -in word set machine_rounds -in word set mantissa -in word set pos -in word set position -in word set pred -in word set range -in word set safe_emax -in word set safe_large -in word set safe_small -in word set size -in word set small -in word set storage_size -in word set succ -in word set terminated -in word set val -in word set value -in word set width diff --git a/contrib/gperf/tests/ada-res.exp b/contrib/gperf/tests/ada-res.exp deleted file mode 100644 index 8134fe861f5fc..0000000000000 --- a/contrib/gperf/tests/ada-res.exp +++ /dev/null @@ -1,63 +0,0 @@ -in word set else -in word set exit -in word set terminate -in word set type -in word set raise -in word set range -in word set reverse -in word set declare -in word set end -in word set record -in word set exception -in word set not -in word set then -in word set return -in word set separate -in word set select -in word set digits -in word set renames -in word set subtype -in word set elsif -in word set function -in word set for -in word set package -in word set procedure -in word set private -in word set while -in word set when -in word set new -in word set entry -in word set delay -in word set case -in word set constant -in word set at -in word set abort -in word set accept -in word set and -in word set delta -in word set access -in word set abs -in word set pragma -in word set array -in word set use -in word set out -in word set do -in word set others -in word set of -in word set or -in word set all -in word set limited -in word set loop -in word set null -in word set task -in word set in -in word set is -in word set if -in word set rem -in word set mod -in word set begin -in word set body -in word set xor -in word set goto -in word set generic -in word set with diff --git a/contrib/gperf/tests/adadefs.gperf b/contrib/gperf/tests/adadefs.gperf deleted file mode 100644 index 875be69abc97c..0000000000000 --- a/contrib/gperf/tests/adadefs.gperf +++ /dev/null @@ -1,54 +0,0 @@ -boolean -character -constraint_error -false -float -integer -natural -numeric_error -positive -program_error -storage_error -string -tasking_error -true -address -aft -base -callable -constrained -count -delta -digits -emax -epsilon -first -firstbit -fore -image -large -last -lastbit -length -machine_emax -machine_emin -machine_mantissa -machine_overflows -machine_radix -machine_rounds -mantissa -pos -position -pred -range -safe_emax -safe_large -safe_small -size -small -storage_size -succ -terminated -val -value -width diff --git a/contrib/gperf/tests/c.exp b/contrib/gperf/tests/c.exp deleted file mode 100644 index 10c8b7f61164c..0000000000000 --- a/contrib/gperf/tests/c.exp +++ /dev/null @@ -1,32 +0,0 @@ -in word set if -in word set do -in word set int -in word set for -in word set case -in word set char -in word set auto -in word set goto -in word set else -in word set long -in word set void -in word set enum -in word set float -in word set short -in word set union -in word set break -in word set while -in word set const -in word set double -in word set static -in word set extern -in word set struct -in word set return -in word set sizeof -in word set switch -in word set signed -in word set typedef -in word set default -in word set unsigned -in word set continue -in word set register -in word set volatile diff --git a/contrib/gperf/tests/configure b/contrib/gperf/tests/configure deleted file mode 100755 index 1c715de8662f0..0000000000000 --- a/contrib/gperf/tests/configure +++ /dev/null @@ -1,1214 +0,0 @@ -#! /bin/sh - -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. - -# Defaults: -ac_help= -ac_default_prefix=/usr/local -# Any additions from configure.in: - -# Initialize some variables set by options. -# The variables have the same names as the options, with -# dashes changed to underlines. -build=NONE -cache_file=./config.cache -exec_prefix=NONE -host=NONE -no_create= -nonopt=NONE -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -target=NONE -verbose= -x_includes=NONE -x_libraries=NONE -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - -ac_prev= -for ac_option -do - - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case "$ac_option" in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; - - -enable-* | --enable-*) - ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "enable_${ac_feature}='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he) - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM - run sed PROGRAM on installed program names -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; - - -host | --host | --hos | --ho) - ac_prev=host ;; - -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix="$ac_optarg" ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix="$ac_optarg" ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12" - exit 0 ;; - - -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; - *) ac_optarg=yes ;; - esac - eval "with_${ac_package}='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` - # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes="$ac_optarg" ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries="$ac_optarg" ;; - - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } - ;; - - *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" - ;; - - esac -done - -if test -n "$ac_prev"; then - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } -fi - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 - -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg -do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; - esac -done - -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo > confdefs.h - -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=c-parse.gperf - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } - else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } - fi -fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` - -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - echo "loading cache $cache_file" - . $cache_file -else - echo "creating cache $cache_file" - > $cache_file -fi - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi - - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:523: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftestmake <<\EOF -all: - @echo 'ac_maketemp="${MAKE}"' -EOF -# GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` -if test -n "$ac_maketemp"; then - eval ac_cv_prog_make_${ac_make}_set=yes -else - eval ac_cv_prog_make_${ac_make}_set=no -fi -rm -f conftestmake -fi -if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 - SET_MAKE= -else - echo "$ac_t""no" 1>&6 - SET_MAKE="MAKE=${MAKE-make}" -fi - -# Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:552: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:581: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - ac_prog_rejected=no - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# -gt 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" - fi -fi -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } -fi - -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:629: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 - -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -cat > conftest.$ac_ext <<EOF -#line 639 "configure" -#include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no - else - ac_cv_prog_cc_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:663: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:668: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:692: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then - ac_cv_prog_cc_g=yes -else - ac_cv_prog_cc_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-O2" - fi -else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi - - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:720: checking how to run the C preprocessor" >&5 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext <<EOF -#line 735 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext <<EOF -#line 752 "configure" -#include "confdefs.h" -#include <assert.h> -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp -fi -rm -f conftest* -fi -rm -f conftest* - ac_cv_prog_CPP="$CPP" -fi - CPP="$ac_cv_prog_CPP" -else - ac_cv_prog_CPP="$CPP" -fi -echo "$ac_t""$CPP" 1>&6 - - for ac_prog in $CCC c++ g++ gcc CC cxx cc++ -do -# Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:785: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CXX="$ac_prog" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CXX="$ac_cv_prog_CXX" -if test -n "$CXX"; then - echo "$ac_t""$CXX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -test -n "$CXX" && break -done -test -n "$CXX" || CXX="gcc" - - -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:816: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 - -ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - -cat > conftest.$ac_ext <<EOF -#line 826 "configure" -#include "confdefs.h" -main(){return(0);} -EOF -if { (eval echo configure:830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - ac_cv_prog_cxx_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cxx_cross=no - else - ac_cv_prog_cxx_cross=yes - fi -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cxx_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6 -if test $ac_cv_prog_cxx_works = no; then - { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:856: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 -cross_compiling=$ac_cv_prog_cxx_cross - -echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:861: checking whether we are using GNU C++" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.C <<EOF -#ifdef __GNUC__ - yes; -#endif -EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gxx=yes -else - ac_cv_prog_gxx=no -fi -fi - -echo "$ac_t""$ac_cv_prog_gxx" 1>&6 - -if test $ac_cv_prog_gxx = yes; then - GXX=yes - ac_test_CXXFLAGS="${CXXFLAGS+set}" - ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS= - echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:885: checking whether ${CXX-g++} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - echo 'void f(){}' > conftest.cc -if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then - ac_cv_prog_cxx_g=yes -else - ac_cv_prog_cxx_g=no -fi -rm -f conftest* - -fi - -echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6 - if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS="$ac_save_CXXFLAGS" - elif test $ac_cv_prog_cxx_g = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-O2" - fi -else - GXX= - test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" -fi - - echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:913: checking how to run the C++ preprocessor" >&5 -if test -z "$CXXCPP"; then -if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_ext=C -# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cxx_cross - CXXCPP="${CXX-g++} -E" - cat > conftest.$ac_ext <<EOF -#line 926 "configure" -#include "confdefs.h" -#include <stdlib.h> -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:931: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` -if test -z "$ac_err"; then - : -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CXXCPP=/lib/cpp -fi -rm -f conftest* - ac_cv_prog_CXXCPP="$CXXCPP" -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross -fi -fi -CXXCPP="$ac_cv_prog_CXXCPP" -echo "$ac_t""$CXXCPP" 1>&6 - - if test $ac_cv_prog_gcc = yes -a $ac_cv_prog_gxx = yes; then - CHECK_LANG_SYNTAX='check-lang-syntax' -else - CHECK_LANG_SYNTAX='' -fi - -trap '' 1 2 15 -cat > confcache <<\EOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. -# -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. -# -EOF -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -(set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote substitution - # turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else - if test -w $cache_file; then - echo "updating cache $cache_file" - cat confcache > $cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' -fi - -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - - -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} - -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $CONFIG_STATUS <<EOF -#! /bin/sh -# Generated automatically by configure. -# Run this file to recreate the current configuration. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# -# Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. - -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option -do - case "\$ac_option" in - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; - esac -done - -ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS <<EOF - -# Protect against being on the right side of a sed subst in config.status. -sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; - s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@SET_MAKE@%$SET_MAKE%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@CXX@%$CXX%g -s%@CXXCPP@%$CXXCPP%g -s%@CHECK_LANG_SYNTAX@%$CHECK_LANG_SYNTAX%g - -CEOF -EOF - -cat >> $CONFIG_STATUS <<\EOF - -# Split the substitutions into bite-sized pieces for seds with -# small command number limits, like on Digital OSF/1 and HP-UX. -ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # Line after last line for current file. -ac_more_lines=: -ac_sed_cmds="" -while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" - else - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" - fi - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` - fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <<EOF - -CONFIG_FILES=\${CONFIG_FILES-"Makefile"} -EOF -cat >> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case "$ac_file" in - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.in" ;; - esac - - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; - *) # Relative path. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac - - - echo creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* - -EOF -cat >> $CONFIG_STATUS <<EOF - -EOF -cat >> $CONFIG_STATUS <<\EOF - -exit 0 -EOF -chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 - diff --git a/contrib/gperf/tests/configure.in b/contrib/gperf/tests/configure.in deleted file mode 100644 index a62450d903e8e..0000000000000 --- a/contrib/gperf/tests/configure.in +++ /dev/null @@ -1,45 +0,0 @@ -dnl autoconf configuration for gperf/tests - -dnl Copyright (C) 1998 Free Software Foundation, Inc. -dnl written by Douglas C. Schmidt (schmidt@ics.uci.edu) -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(c-parse.gperf) -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 -if test $ac_cv_prog_gcc = yes -a $ac_cv_prog_gxx = yes; then - CHECK_LANG_SYNTAX='check-lang-syntax' -else - CHECK_LANG_SYNTAX='' -fi -AC_SUBST(CHECK_LANG_SYNTAX) -dnl -dnl That's it. -dnl -AC_OUTPUT(Makefile) diff --git a/contrib/gperf/tests/irc.gperf b/contrib/gperf/tests/irc.gperf deleted file mode 100644 index afe53c59e7db9..0000000000000 --- a/contrib/gperf/tests/irc.gperf +++ /dev/null @@ -1,63 +0,0 @@ -%{ -extern int m_text(), m_private(), m_who(), m_whois(), m_user(), m_list(); -extern int m_topic(), m_invite(), m_channel(), m_version(), m_quit(); -extern int m_server(), m_kill(), m_info(), m_links(), m_summon(), m_stats(); -extern int m_users(), m_nick(), m_error(), m_help(), m_whoreply(); -extern int m_squit(), m_restart(), m_away(), m_die(), m_connect(); -extern int m_ping(), m_pong(), m_oper(), m_pass(), m_wall(), m_trace(); -extern int m_time(), m_rehash(), m_names(), m_namreply(), m_admin(); -extern int m_linreply(), m_notice(), m_lusers(), m_voice(), m_grph(); -extern int m_xtra(), m_motd(); -%} -struct Message { - char *cmd; - int (* func)(); - int count; - int parameters; -}; -%% -NICK, m_nick, 0, 1 -MSG, m_text, 0, 1 -PRIVMSG, m_private, 0, 2 -WHO, m_who, 0, 1 -WHOIS, m_whois, 0, 4 -USER, m_user, 0, 4 -SERVER, m_server, 0, 2 -LIST, m_list, 0, 1 -TOPIC, m_topic, 0, 1 -INVITE, m_invite, 0, 2 -CHANNEL, m_channel, 0, 1 -VERSION, m_version, 0, 1 -QUIT, m_quit, 0, 2 -SQUIT, m_squit, 0, 2 -KILL, m_kill, 0, 2 -INFO, m_info, 0, 1 -LINKS, m_links, 0, 1 -SUMMON, m_summon, 0, 1 -STATS, m_stats, 0, 1 -USERS, m_users, 0, 1 -RESTART, m_restart, 0, 1 -WHOREPLY,m_whoreply, 0, 7 -HELP, m_help, 0, 2 -ERROR, m_error, 0, 1 -AWAY, m_away, 0, 1 -DIE, m_die, 0, 1 -CONNECT, m_connect, 0, 3 -PING, m_ping, 0, 2 -PONG, m_pong, 0, 3 -OPER, m_oper, 0, 3 -PASS, m_pass, 0, 2 -WALL, m_wall, 0, 1 -TIME, m_time, 0, 1 -REHASH, m_rehash, 0, 1 -NAMES, m_names, 0, 1 -NAMREPLY,m_namreply, 0, 3 -ADMIN, m_admin, 0, 1 -TRACE, m_trace, 0, 1 -LINREPLY,m_linreply, 0, 2 -NOTICE, m_notice, 0, 2 -LUSERS, m_lusers, 0, 1 -VOICE, m_voice, 0, 2 -GRPH, m_grph, 0, 2 -XTRA, m_xtra, 0, 2 -MOTD, m_motd, 0, 2 diff --git a/contrib/gperf/tests/jscript.gperf b/contrib/gperf/tests/jscript.gperf deleted file mode 100644 index 6f420d8883ba0..0000000000000 --- a/contrib/gperf/tests/jscript.gperf +++ /dev/null @@ -1,73 +0,0 @@ -%{ -/* Command-line: gperf -k'1,2,$' -t -p -K 'name' -H 'js_kw_hash' -N 'js_kw_lookup' -a -g jscript.gperf */ -%} -struct js_keyword { - char * name; - int token; -} - -%% -# Javascript reserved words, see "keywords.html" -abstract, TK_ABSTRACT -boolean, TK_BOOLEAN -break, TK_BREAK -byte, TK_BYTE -case, TK_CASE -catch, TK_CATCH -char, TK_CHAR -class, TK_CLASS -const, TK_CONST -continue, TK_CONTINUE -default, TK_DEFAULT -do, TK_DO -double, TK_DOUBLE -else, TK_ELSE -extends, TK_EXTENDS -false, TK_FALSE -final, TK_FINAL -finally, TK_FINALLY -float, TK_FLOAT -for, TK_FOR -function, TK_FUNCTION -goto, TK_GOTO -if, TK_IF -implements, TK_IMPLEMENTS -import, TK_IMPORT -in, TK_IN -instanceof, TK_INSTANCEOF -int, TK_INT -interface, TK_INTERFACE -long, TK_LONG -native, TK_NATIVE -new, TK_NEW -null, TK_NULL -package, TK_PACKAGE -private, TK_PRIVATE -protected, TK_PROTECTED -public, TK_PUBLIC -return, TK_RETURN -short, TK_SHORT -static, TK_STATIC -super, TK_SUPER -switch, TK_SWITCH -synchronized, TK_SYNCHRONIZED -this, TK_THIS -throw, TK_THROW -throws, TK_THROWS -transient, TK_TRANSIENT -true, TK_TRUE -try, TK_TRY -var, TK_VAR -void, TK_VOID -while, TK_WHILE -with, TK_WITH -%% - -int js_keyword_lookup (register const char *str, register int len) -{ - struct js_keyword * keyword = js_kw_lookup(str,len); - if (keyword) - return keyword->token; - else - return TK_IDENT; -} diff --git a/contrib/gperf/tests/jstest1.gperf b/contrib/gperf/tests/jstest1.gperf deleted file mode 100644 index f6696b1868588..0000000000000 --- a/contrib/gperf/tests/jstest1.gperf +++ /dev/null @@ -1,142 +0,0 @@ -abstract -boolean -break -byte -case -catch -char -class -const -continue -default -do -double -else -extends -false -final -finally -float -for -function -goto -if -implements -import -in -instanceof -int -interface -long -native -new -null -package -private -protected -public -return -short -static -super -switch -synchronized -this -throw -throws -transient -true -try -var -void -while -with -%% -#include <stdlib.h> -#include <string.h> -#if defined(__STDC__) || defined(__cplusplus) -#define CONST const -#else -#define CONST -#endif -static CONST char* testdata[] = { - "bogus", - "abstract", - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", - "continue", - "default", - "do", - "double", - "else", - "extends", - "false", - "final", - "finally", - "float", - "for", - "function", - "goto", - "if", - "implements", - "import", - "in", - "instanceof", - "int", - "interface", - "long", - "native", - "new", - "null", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "true", - "try", - "var", - "void", - "while", - "with" -}; -int main () -{ - int i; - for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) - { -#ifdef CPLUSPLUS_TEST - CONST char * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); -#else - CONST char * resword = in_word_set(testdata[i],strlen(testdata[i])); -#endif - if (i > 0) - { - if (!resword) - exit (1); - if (strcmp(testdata[i],resword)) - exit (1); - } - else - { - if (resword) - exit (1); - } - } - return 0; -} diff --git a/contrib/gperf/tests/jstest2.gperf b/contrib/gperf/tests/jstest2.gperf deleted file mode 100644 index ee0fa7fde4148..0000000000000 --- a/contrib/gperf/tests/jstest2.gperf +++ /dev/null @@ -1,147 +0,0 @@ -struct js_keyword { - char * name; - int token; -} -%% -abstract, 1 -boolean, 2 -break, 3 -byte, 4 -case, 5 -catch, 6 -char, 7 -class, 8 -const, 9 -continue, 10 -default, 11 -do, 12 -double, 13 -else, 14 -extends, 15 -false, 16 -final, 17 -finally, 18 -float, 19 -for, 20 -function, 21 -goto, 22 -if, 23 -implements, 24 -import, 25 -in, 26 -instanceof, 27 -int, 28 -interface, 29 -long, 30 -native, 31 -new, 32 -null, 33 -package, 34 -private, 35 -protected, 36 -public, 37 -return, 38 -short, 39 -static, 40 -super, 41 -switch, 42 -synchronized, 43 -this, 44 -throw, 45 -throws, 46 -transient, 47 -true, 48 -try, 49 -var, 50 -void, 51 -while, 52 -with, 53 -%% -#include <stdlib.h> -#include <string.h> -#if defined(__STDC__) || defined(__cplusplus) -#define CONST const -#else -#define CONST -#endif -static CONST char* testdata[] = { - "bogus", - "abstract", - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", - "continue", - "default", - "do", - "double", - "else", - "extends", - "false", - "final", - "finally", - "float", - "for", - "function", - "goto", - "if", - "implements", - "import", - "in", - "instanceof", - "int", - "interface", - "long", - "native", - "new", - "null", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "true", - "try", - "var", - "void", - "while", - "with" -}; -int main () -{ - int i; - for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) - { -#ifdef CPLUSPLUS_TEST - CONST struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); -#else - CONST struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i])); -#endif - if (i > 0) - { - if (!resword) - exit (1); - if (strcmp(testdata[i],resword->name)) - exit (1); - } - else - { - if (resword) - exit (1); - } - } - return 0; -} diff --git a/contrib/gperf/tests/jstest3.gperf b/contrib/gperf/tests/jstest3.gperf deleted file mode 100644 index 54d37ce0e8cf2..0000000000000 --- a/contrib/gperf/tests/jstest3.gperf +++ /dev/null @@ -1,147 +0,0 @@ -struct js_keyword { - const char * name; - int token; -} -%% -abstract, 1 -boolean, 2 -break, 3 -byte, 4 -case, 5 -catch, 6 -char, 7 -class, 8 -const, 9 -continue, 10 -default, 11 -do, 12 -double, 13 -else, 14 -extends, 15 -false, 16 -final, 17 -finally, 18 -float, 19 -for, 20 -function, 21 -goto, 22 -if, 23 -implements, 24 -import, 25 -in, 26 -instanceof, 27 -int, 28 -interface, 29 -long, 30 -native, 31 -new, 32 -null, 33 -package, 34 -private, 35 -protected, 36 -public, 37 -return, 38 -short, 39 -static, 40 -super, 41 -switch, 42 -synchronized, 43 -this, 44 -throw, 45 -throws, 46 -transient, 47 -true, 48 -try, 49 -var, 50 -void, 51 -while, 52 -with, 53 -%% -#include <stdlib.h> -#include <string.h> -#if defined(__STDC__) || defined(__cplusplus) -#define CONST const -#else -#define CONST -#endif -static CONST char* testdata[] = { - "bogus", - "abstract", - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", - "continue", - "default", - "do", - "double", - "else", - "extends", - "false", - "final", - "finally", - "float", - "for", - "function", - "goto", - "if", - "implements", - "import", - "in", - "instanceof", - "int", - "interface", - "long", - "native", - "new", - "null", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "true", - "try", - "var", - "void", - "while", - "with" -}; -int main () -{ - int i; - for (i = 0; i < sizeof(testdata)/sizeof(testdata[0]); i++) - { -#ifdef CPLUSPLUS_TEST - CONST struct js_keyword * resword = Perfect_Hash::in_word_set(testdata[i],strlen(testdata[i])); -#else - CONST struct js_keyword * resword = in_word_set(testdata[i],strlen(testdata[i])); -#endif - if (i > 0) - { - if (!resword) - exit (1); - if (strcmp(testdata[i],resword->name)) - exit (1); - } - else - { - if (resword) - exit (1); - } - } - return 0; -} diff --git a/contrib/gperf/tests/makeinfo.gperf b/contrib/gperf/tests/makeinfo.gperf deleted file mode 100644 index 1488b8e38fbed..0000000000000 --- a/contrib/gperf/tests/makeinfo.gperf +++ /dev/null @@ -1,116 +0,0 @@ -COMMAND; -%% -!, cm_force_sentence_end, false -', insert_self, false -*, cm_asterisk, false -., cm_force_sentence_end, false -:, cm_force_abbreviated_whitespace, false -?, cm_force_sentence_end, false -@, insert_self, false -TeX, cm_TeX, true -`, insert_self, false -appendix, cm_appendix, false -appendixsec, cm_appendixsec, false -appendixsubsec, cm_appendixsubsec, false -asis, cm_asis, true -b, cm_bold, true -br, cm_br, false -bullet, cm_bullet, true -bye, cm_bye, false -c, cm_comment, false -center, cm_center, false -chapter, cm_chapter, false -cindex, cm_cindex, false -cite, cm_cite, true -code, cm_code, true -comment, cm_comment, false -contents, do_nothing, false -copyright, cm_copyright, true -ctrl, cm_ctrl, true -defcodeindex, cm_defindex, false -defindex, cm_defindex, false -dfn, cm_dfn, true -display, cm_display, false -dots, cm_dots, true -emph, cm_emph, true -end, cm_end, false -enumerate, cm_enumerate, false -equiv, cm_equiv, true -error, cm_error, true -example, cm_example, false -exdent, cm_exdent, false -expansion, cm_expansion, true -file, cm_file, true -findex, cm_findex, false -format, cm_format, false -group, cm_group, false -i, cm_italic, true -iappendix, cm_appendix, false -iappendixsec, cm_appendixsec, false -iappendixsubsec, cm_appendixsubsec, false -ichapter, cm_chapter, false -ifinfo, cm_ifinfo, false -iftex, cm_iftex, false -ignore, cm_ignore, false -include, cm_include, false -inforef, cm_inforef, true -input, cm_include, false -isection, cm_section, false -isubsection, cm_subsection, false -isubsubsection, cm_subsubsection, false -item, cm_item, false -itemize, cm_itemize, false -itemx, cm_itemx, false -iunnumbered, cm_unnumbered, false -iunnumberedsec, cm_unnumberedsec, false -iunnumberedsubsec, cm_unnumberedsubsec, false -kbd, cm_kbd, true -key, cm_key, true -kindex, cm_kindex, false -lisp, cm_lisp, false -menu, cm_menu -minus, cm_minus, true -need, cm_need, false -node, cm_node, false -noindent, cm_noindent, false -page, do_nothing, false -pindex, cm_pindex, false -point, cm_point, true -print, cm_print, true -printindex, cm_printindex, false -pxref, cm_pxref, true -quotation, cm_quotation, false -r, cm_roman, true -ref, cm_xref, true -refill, cm_refill, false -result, cm_result, true -samp, cm_samp, true -sc, cm_sc, true -section, cm_section, false -setchapternewpage, cm_setchapternewpage, false -setfilename, cm_setfilename, false -settitle, cm_settitle, false -smallexample, cm_smallexample, false -sp, cm_sp, false -strong, cm_strong, true -subsection, cm_subsection, false -subsubsection, cm_subsubsection, false -summarycontents, do_nothing, false -syncodeindex, cm_synindex, false -synindex, cm_synindex, false -t, cm_title, true -table, cm_table, false -tex, cm_tex, false -tindex, cm_tindex, false -titlepage, cm_titlepage, false -unnumbered, cm_unnumbered, false -unnumberedsec, cm_unnumberedsec, false -unnumberedsubsec, cm_unnumberedsubsec, false -var, cm_var, true -vindex, cm_vindex, false -w, cm_w, true -xref, cm_xref, true -{, insert_self, false -}, insert_self, false -infoinclude, cm_infoinclude, false -footnote, cm_footnote, false diff --git a/contrib/gperf/tests/modula.exp b/contrib/gperf/tests/modula.exp deleted file mode 100644 index cef7d5acad8b9..0000000000000 --- a/contrib/gperf/tests/modula.exp +++ /dev/null @@ -1,106 +0,0 @@ -in word set AND -in word set ARRAY -in word set BEGIN -in word set BITS -in word set BY -in word set CASE -in word set CONST -in word set DIV -in word set DO -in word set ELSE -in word set ELSIF -in word set END -in word set EVAL -in word set EXCEPT -in word set EXCEPTION -in word set EXIT -in word set EXPORTS -in word set FINALLY -in word set FOR -in word set FROM -in word set IF -in word set IMPORT -in word set INTERFACE -in word set IN -in word set INLINE -in word set LOCK -in word set METHODS -in word set MOD -in word set MODULE -in word set NOT -in word set OBJECT -in word set OF -in word set OR -in word set PROCEDURE -in word set RAISES -in word set READONLY -in word set RECORD -in word set REF -in word set REPEAT -in word set RETURN -in word set SET -in word set THEN -in word set TO -in word set TRY -in word set TYPE -in word set TYPECASE -in word set UNSAFE -in word set UNTIL -in word set UNTRACED -in word set VALUE -in word set VAR -in word set WHILE -in word set WITH -in word set and -in word set array -in word set begin -in word set bits -in word set by -in word set case -in word set const -in word set div -in word set do -in word set else -in word set elsif -in word set end -in word set eval -in word set except -in word set exception -in word set exit -in word set exports -in word set finally -in word set for -in word set from -in word set if -in word set import -in word set interface -in word set in -in word set inline -in word set lock -in word set methods -in word set mod -in word set module -in word set not -in word set object -in word set of -in word set or -in word set procedure -in word set raises -in word set readonly -in word set record -in word set ref -in word set repeat -in word set return -in word set set -in word set then -in word set to -in word set try -in word set type -in word set typecase -in word set unsafe -in word set until -in word set untraced -in word set value -in word set var -in word set while -in word set with diff --git a/contrib/gperf/tests/pascal.exp b/contrib/gperf/tests/pascal.exp deleted file mode 100644 index 765e44c6a0feb..0000000000000 --- a/contrib/gperf/tests/pascal.exp +++ /dev/null @@ -1,36 +0,0 @@ -in word set with -in word set array -in word set and -in word set function -in word set case -in word set var -in word set const -in word set until -in word set then -in word set set -in word set record -in word set program -in word set procedure -in word set or -in word set packed -in word set not -in word set nil -in word set label -in word set in -in word set repeat -in word set of -in word set goto -in word set forward -in word set for -in word set while -in word set file -in word set else -in word set downto -in word set do -in word set div -in word set to -in word set type -in word set end -in word set mod -in word set begin -in word set if diff --git a/contrib/gperf/tests/test-1.exp b/contrib/gperf/tests/test-1.exp deleted file mode 100644 index 462fea5d0ec5c..0000000000000 --- a/contrib/gperf/tests/test-1.exp +++ /dev/null @@ -1,153 +0,0 @@ -/* C code produced by gperf version 2.7 */ -/* Command-line: ../src/gperf -p -j1 -g -o -t -N is_reserved_word -k1,3,$ */ -/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ -struct resword { char *name; short token; enum rid rid; }; - -#define TOTAL_KEYWORDS 51 -#define MIN_WORD_LENGTH 2 -#define MAX_WORD_LENGTH 13 -#define MIN_HASH_VALUE 8 -#define MAX_HASH_VALUE 82 -/* maximum key range = 75, duplicates = 0 */ - -#ifdef __GNUC__ -__inline -#endif -static unsigned int -hash (str, len) - register const char *str; - register unsigned int len; -{ - static unsigned char asso_values[] = - { - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 0, 83, 1, 2, 34, - 19, 6, 11, 29, 0, 17, 83, 0, 23, 28, - 26, 30, 31, 83, 15, 1, 0, 28, 13, 4, - 83, 83, 5, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83 - }; - register int hval = len; - - switch (hval) - { - default: - case 3: - hval += asso_values[(unsigned char)str[2]]; - case 2: - case 1: - hval += asso_values[(unsigned char)str[0]]; - break; - } - return hval + asso_values[(unsigned char)str[len - 1]]; -} - -#ifdef __GNUC__ -__inline -#endif -struct resword * -is_reserved_word (str, len) - register const char *str; - register unsigned int len; -{ - static struct resword wordlist[] = - { - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {"__asm__", ASM, NORID}, - {""}, - {"__typeof__", TYPEOF, NORID}, - {"__signed__", TYPESPEC, RID_SIGNED}, - {"__alignof__", ALIGNOF, NORID}, - {"break", BREAK, NORID}, - {"__attribute__", ATTRIBUTE, NORID}, - {""}, {""}, - {"else", ELSE, NORID}, - {"__attribute", ATTRIBUTE, NORID}, - {"__typeof", TYPEOF, NORID}, - {"int", TYPESPEC, RID_INT}, - {"__alignof", ALIGNOF, NORID}, - {"struct", STRUCT, NORID}, - {"sizeof", SIZEOF, NORID}, - {"switch", SWITCH, NORID}, - {"__volatile__", TYPE_QUAL, RID_VOLATILE}, - {""}, - {"__inline__", SCSPEC, RID_INLINE}, - {"__signed", TYPESPEC, RID_SIGNED}, - {"__volatile", TYPE_QUAL, RID_VOLATILE}, - {"if", IF, NORID}, - {"__inline", SCSPEC, RID_INLINE}, - {"while", WHILE, NORID}, - {""}, - {"__asm", ASM, NORID}, - {"auto", SCSPEC, RID_AUTO}, - {"short", TYPESPEC, RID_SHORT}, - {"default", DEFAULT, NORID}, - {"extern", SCSPEC, RID_EXTERN}, - {""}, {""}, - {"__const", TYPE_QUAL, RID_CONST}, - {"static", SCSPEC, RID_STATIC}, - {"__const__", TYPE_QUAL, RID_CONST}, - {"for", FOR, NORID}, - {"case", CASE, NORID}, - {"float", TYPESPEC, RID_FLOAT}, - {"return", RETURN, NORID}, - {"typeof", TYPEOF, NORID}, - {"typedef", SCSPEC, RID_TYPEDEF}, - {"volatile", TYPE_QUAL, RID_VOLATILE}, - {"do", DO, NORID}, - {"inline", SCSPEC, RID_INLINE}, - {"void", TYPESPEC, RID_VOID}, - {"char", TYPESPEC, RID_CHAR}, - {"signed", TYPESPEC, RID_SIGNED}, - {"unsigned", TYPESPEC, RID_UNSIGNED}, - {""}, {""}, - {"double", TYPESPEC, RID_DOUBLE}, - {"asm", ASM, NORID}, - {""}, {""}, - {"goto", GOTO, NORID}, - {""}, - {"const", TYPE_QUAL, RID_CONST}, - {"enum", ENUM, NORID}, - {"register", SCSPEC, RID_REGISTER}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"continue", CONTINUE, NORID}, - {""}, - {"union", UNION, NORID}, - {""}, {""}, {""}, {""}, {""}, - {"long", TYPESPEC, RID_LONG} - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - { - register const char *s = wordlist[key].name; - - if (*str == *s && !strcmp (str + 1, s + 1)) - return &wordlist[key]; - } - } - return 0; -} diff --git a/contrib/gperf/tests/test-2.exp b/contrib/gperf/tests/test-2.exp deleted file mode 100644 index 3b9e7b094131f..0000000000000 --- a/contrib/gperf/tests/test-2.exp +++ /dev/null @@ -1,202 +0,0 @@ -/* C code produced by gperf version 2.7 */ -/* Command-line: ../src/gperf -n -k1-8 -l */ - -#define TOTAL_KEYWORDS 40 -#define MIN_WORD_LENGTH 2 -#define MAX_WORD_LENGTH 14 -#define MIN_HASH_VALUE 1 -#define MAX_HASH_VALUE 256 -/* maximum key range = 256, duplicates = 0 */ - -#ifdef __GNUC__ -__inline -#endif -static unsigned int -hash (str, len) - register const char *str; - register unsigned int len; -{ - static unsigned short asso_values[] = - { - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 25, 30, 35, 21, 0, - 30, 15, 30, 45, 257, 257, 0, 5, 45, 0, - 10, 0, 1, 20, 25, 15, 30, 40, 15, 5, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 257, 257, 257, 257, 257, 257 - }; - register int hval = 0; - - switch (len) - { - default: - case 8: - hval += asso_values[(unsigned char)str[7]]; - case 7: - hval += asso_values[(unsigned char)str[6]]; - case 6: - hval += asso_values[(unsigned char)str[5]]; - case 5: - hval += asso_values[(unsigned char)str[4]]; - case 4: - hval += asso_values[(unsigned char)str[3]]; - case 3: - hval += asso_values[(unsigned char)str[2]]; - case 2: - hval += asso_values[(unsigned char)str[1]]; - case 1: - hval += asso_values[(unsigned char)str[0]]; - break; - } - return hval; -} - -#ifdef __GNUC__ -__inline -#endif -const char * -in_word_set (str, len) - register const char *str; - register unsigned int len; -{ - static unsigned char lengthtable[] = - { - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 2, 0, 0, 0, 2, 3, 0, - 0, 0, 2, 3, 0, 0, 0, 2, 4, 0, 0, 0, 4, 6, - 0, 0, 0, 3, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, - 3, 5, 6, 0, 0, 6, 0, 0, 0, 0, 3, 0, 0, 0, - 3, 0, 0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 0, 9, - 0, 4, 6, 6, 0, 0, 2, 3, 0, 0, 0, 5, 3, 0, - 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, - 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, - 7, 0, 0, 0, 5, 0, 0, 0, 0, 5, 0, 0, 0, 0, - 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10 - }; - static const char * wordlist[] = - { - "", - "OR", - "", "", "", "", "", "", "", "", - "LOOP", - "", "", "", "", "", "", "", "", "", - "ELSE", - "DO", - "", "", "", - "TO", - "MOD", - "", "", "", - "OF", - "FOR", - "", "", "", - "BY", - "FROM", - "", "", "", - "TYPE", - "MODULE", - "", "", "", - "SET", - "", "", "", "", "", - "EXPORT", - "", "", "", "", - "VAR", - "ARRAY", - "RECORD", - "", "", - "REPEAT", - "", "", "", "", - "END", - "", "", "", - "NOT", - "", "", "", "", - "IF", - "", "", "", "", - "CASE", - "", "", - "PROCEDURE", - "", - "EXIT", - "IMPORT", - "RETURN", - "", "", - "IN", - "AND", - "", "", "", - "ELSIF", - "DIV", - "", "", "", - "THEN", - "", "", "", "", "", "", "", "", "", - "IMPLEMENTATION", - "", "", "", "", - "WHILE", - "", "", "", "", "", "", "", "", "", - "CONST", - "POINTER", - "", "", "", - "UNTIL", - "", "", "", "", - "BEGIN", - "", "", "", "", - "WITH", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", - "QUALIFIED", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", "", "", "", "", - "", "", "", "", "", - "DEFINITION" - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - if (len == lengthtable[key]) - { - register const char *s = wordlist[key]; - - if (*str == *s && !strcmp (str + 1, s + 1)) - return s; - } - } - return 0; -} diff --git a/contrib/gperf/tests/test-3.exp b/contrib/gperf/tests/test-3.exp deleted file mode 100644 index fe0a1a6dafdf8..0000000000000 --- a/contrib/gperf/tests/test-3.exp +++ /dev/null @@ -1,186 +0,0 @@ -/* C code produced by gperf version 2.7 */ -/* Command-line: ../src/gperf -p -j 1 -o -a -C -g -t -k1,4,$ */ -/* Command-line: gperf -p -j1 -g -o -t -N is_reserved_word -k1,4,$ gplus.gperf */ -struct resword { char *name; short token; enum rid rid;}; - -#define TOTAL_KEYWORDS 71 -#define MIN_WORD_LENGTH 2 -#define MAX_WORD_LENGTH 13 -#define MIN_HASH_VALUE 4 -#define MAX_HASH_VALUE 147 -/* maximum key range = 144, duplicates = 0 */ - -#ifdef __GNUC__ -__inline -#endif -static unsigned int -hash (str, len) - register const char *str; - register unsigned int len; -{ - static const unsigned char asso_values[] = - { - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 0, 148, 19, 6, 27, - 37, 0, 12, 1, 15, 63, 148, 4, 0, 56, - 20, 15, 42, 148, 31, 5, 26, 39, 32, 10, - 148, 40, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148 - }; - register int hval = len; - - switch (hval) - { - default: - case 4: - hval += asso_values[(unsigned char)str[3]]; - case 3: - case 2: - case 1: - hval += asso_values[(unsigned char)str[0]]; - break; - } - return hval + asso_values[(unsigned char)str[len - 1]]; -} - -#ifdef __GNUC__ -__inline -#endif -const struct resword * -in_word_set (str, len) - register const char *str; - register unsigned int len; -{ - static const struct resword wordlist[] = - { - {""}, {""}, {""}, {""}, - {"else", ELSE, NORID,}, - {""}, - {"long", TYPESPEC, RID_LONG,}, - {""}, {""}, {""}, {""}, - {"__alignof__", ALIGNOF, NORID}, - {"__asm__", ASM, NORID}, - {""}, {""}, - {"while", WHILE, NORID,}, - {""}, {""}, {""}, {""}, {""}, - {"__alignof", ALIGNOF, NORID}, - {"all", ALL, NORID /* Extension */,}, - {"sizeof", SIZEOF, NORID,}, - {"__const__", TYPE_QUAL, RID_CONST}, - {"__volatile", TYPE_QUAL, RID_VOLATILE}, - {"extern", SCSPEC, RID_EXTERN,}, - {"__volatile__", TYPE_QUAL, RID_VOLATILE}, - {"__inline", SCSPEC, RID_INLINE}, - {"exception", AGGR, RID_EXCEPTION /* Extension */,}, - {"__inline__", SCSPEC, RID_INLINE}, - {"case", CASE, NORID,}, - {"except", EXCEPT, NORID /* Extension */,}, - {"new", NEW, NORID,}, - {"break", BREAK, NORID,}, - {"goto", GOTO, NORID,}, - {""}, - {"__attribute", ATTRIBUTE, NORID}, - {""}, - {"__attribute__", ATTRIBUTE, NORID}, - {"this", THIS, NORID,}, - {"raise", RAISE, NORID /* Extension */,}, - {"class", AGGR, RID_CLASS,}, - {"delete", DELETE, NORID,}, - {"typeof", TYPEOF, NORID,}, - {"typedef", SCSPEC, RID_TYPEDEF,}, - {"for", FOR, NORID,}, - {"raises", RAISES, NORID /* Extension */,}, - {"__const", TYPE_QUAL, RID_CONST}, - {"double", TYPESPEC, RID_DOUBLE,}, - {"__typeof__", TYPEOF, NORID}, - {""}, - {"switch", SWITCH, NORID,}, - {"auto", SCSPEC, RID_AUTO,}, - {"do", DO, NORID,}, - {"friend", SCSPEC, RID_FRIEND,}, - {""}, - {"reraise", RERAISE, NORID /* Extension */,}, - {""}, - {"volatile", TYPE_QUAL, RID_VOLATILE,}, - {"__typeof", TYPEOF, NORID}, - {"continue", CONTINUE, NORID,}, - {"float", TYPESPEC, RID_FLOAT,}, - {"const", TYPE_QUAL, RID_CONST,}, - {"static", SCSPEC, RID_STATIC,}, - {"virtual", SCSPEC, RID_VIRTUAL,}, - {"__asm", ASM, NORID}, - {"short", TYPESPEC, RID_SHORT,}, - {"signed", TYPESPEC, RID_SIGNED,}, - {"try", TRY, NORID /* Extension */,}, - {""}, {""}, {""}, - {"__signed__", TYPESPEC, RID_SIGNED}, - {"catch", CATCH, NORID,}, - {"public", PUBLIC, NORID,}, - {"struct", AGGR, RID_RECORD,}, - {"if", IF, NORID,}, - {"asm", ASM, NORID,}, - {"union", AGGR, RID_UNION,}, - {""}, - {"private", PRIVATE, NORID,}, - {""}, {""}, {""}, - {"operator", OPERATOR, NORID,}, - {""}, {""}, {""}, - {"default", DEFAULT, NORID,}, - {"dynamic", DYNAMIC, NORID,}, - {"overload", OVERLOAD, NORID,}, - {"int", TYPESPEC, RID_INT,}, - {"char", TYPESPEC, RID_CHAR,}, - {""}, {""}, - {"return", RETURN, NORID,}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, - {"__signed", TYPESPEC, RID_SIGNED}, - {""}, - {"void", TYPESPEC, RID_VOID,}, - {""}, {""}, {""}, - {"protected", PROTECTED, NORID,}, - {""}, - {"enum", ENUM, NORID,}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"inline", SCSPEC, RID_INLINE,}, - {"register", SCSPEC, RID_REGISTER,}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, - {"unsigned", TYPESPEC, RID_UNSIGNED,} - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - { - register const char *s = wordlist[key].name; - - if (*str == *s && !strcmp (str + 1, s + 1)) - return &wordlist[key]; - } - } - return 0; -} diff --git a/contrib/gperf/tests/test-4.exp b/contrib/gperf/tests/test-4.exp deleted file mode 100644 index b5279688714d0..0000000000000 --- a/contrib/gperf/tests/test-4.exp +++ /dev/null @@ -1,162 +0,0 @@ -/* C code produced by gperf version 2.7 */ -/* Command-line: ../src/gperf -D -p -t */ -/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */ -struct resword { char *name; short token; enum rid rid; }; - -#define TOTAL_KEYWORDS 51 -#define MIN_WORD_LENGTH 2 -#define MAX_WORD_LENGTH 13 -#define MIN_HASH_VALUE 4 -#define MAX_HASH_VALUE 82 -/* maximum key range = 79, duplicates = 2 */ - -#ifdef __GNUC__ -__inline -#endif -static unsigned int -hash (str, len) - register const char *str; - register unsigned int len; -{ - static unsigned char asso_values[] = - { - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 0, 83, 40, 20, 50, - 25, 10, 30, 0, 0, 50, 83, 0, 15, 0, - 35, 0, 83, 83, 20, 0, 10, 40, 5, 15, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, - 83, 83, 83, 83, 83, 83 - }; - return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; -} - -#ifdef __GNUC__ -__inline -#endif -struct resword * -in_word_set (str, len) - register const char *str; - register unsigned int len; -{ - static struct resword wordlist[] = - { - {"goto", GOTO, NORID}, - {"__asm", ASM, NORID}, - {"switch", SWITCH, NORID}, - {"__asm__", ASM, NORID}, - {"__const__", TYPE_QUAL, RID_CONST}, - {"__inline__", SCSPEC, RID_INLINE}, - {"__typeof__", TYPEOF, NORID}, - {"__signed__", TYPESPEC, RID_SIGNED}, - {"__alignof__", ALIGNOF, NORID}, - {"__volatile__", TYPE_QUAL, RID_VOLATILE}, - {"__attribute__", ATTRIBUTE, NORID}, - {"enum", ENUM, NORID}, - {"short", TYPESPEC, RID_SHORT}, - {"struct", STRUCT, NORID}, - {"__const", TYPE_QUAL, RID_CONST}, - {"__inline", SCSPEC, RID_INLINE}, - {"long", TYPESPEC, RID_LONG}, - {"__volatile", TYPE_QUAL, RID_VOLATILE}, - {"__attribute", ATTRIBUTE, NORID}, - {"volatile", TYPE_QUAL, RID_VOLATILE}, - {"else", ELSE, NORID}, - {"break", BREAK, NORID}, - {"do", DO, NORID}, - {"while", WHILE, NORID}, - {"signed", TYPESPEC, RID_SIGNED}, - {"__signed", TYPESPEC, RID_SIGNED}, - {"void", TYPESPEC, RID_VOID}, - {"sizeof", SIZEOF, NORID}, - {"__typeof", TYPEOF, NORID}, - {"__alignof", ALIGNOF, NORID}, - {"double", TYPESPEC, RID_DOUBLE}, - {"default", DEFAULT, NORID}, - {"asm", ASM, NORID}, - {"auto", SCSPEC, RID_AUTO}, - {"float", TYPESPEC, RID_FLOAT}, - {"typeof", TYPEOF, NORID}, - {"typedef", SCSPEC, RID_TYPEDEF}, - {"register", SCSPEC, RID_REGISTER}, - {"extern", SCSPEC, RID_EXTERN}, - {"for", FOR, NORID}, - {"static", SCSPEC, RID_STATIC}, - {"return", RETURN, NORID}, - {"int", TYPESPEC, RID_INT}, - {"case", CASE, NORID}, - {"const", TYPE_QUAL, RID_CONST}, - {"inline", SCSPEC, RID_INLINE}, - {"continue", CONTINUE, NORID}, - {"unsigned", TYPESPEC, RID_UNSIGNED}, - {"char", TYPESPEC, RID_CHAR}, - {"union", UNION, NORID}, - {"if", IF, NORID} - }; - - static short lookup[] = - { - -1, -1, -1, -1, 0, 1, 2, 3, -1, 4, - -80, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, -1, 19, 20, 21, -1, 22, -46, -3, - 23, 24, -1, 25, 26, -1, 27, -1, 28, 29, - -1, 30, 31, 32, 33, 34, 35, 36, 37, -1, - -1, 38, -1, 39, -1, -1, 40, -1, -1, -1, - -1, 41, -1, 42, 43, 44, 45, -1, 46, -1, - -1, -1, -1, 47, 48, -1, -1, -1, -1, -1, - 49, -1, 50 - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - { - register int index = lookup[key]; - - if (index >= 0) - { - register const char *s = wordlist[index].name; - - if (*str == *s && !strcmp (str + 1, s + 1)) - return &wordlist[index]; - } - else if (index < -TOTAL_KEYWORDS) - { - register int offset = - 1 - TOTAL_KEYWORDS - index; - register struct resword *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]]; - register struct resword *wordendptr = wordptr + -lookup[offset + 1]; - - while (wordptr < wordendptr) - { - register const char *s = wordptr->name; - - if (*str == *s && !strcmp (str + 1, s + 1)) - return wordptr; - wordptr++; - } - } - } - } - return 0; -} diff --git a/contrib/gperf/tests/test-5.exp b/contrib/gperf/tests/test-5.exp deleted file mode 100644 index 8f4d9ab8a62c0..0000000000000 --- a/contrib/gperf/tests/test-5.exp +++ /dev/null @@ -1,124 +0,0 @@ -/* C code produced by gperf version 2.7 */ -/* Command-line: ../src/gperf -g -o -j1 -t -p -N is_reserved_word */ -/* ISO Pascal 7185 reserved words. - * - * For GNU Pascal compiler (GPC) by jtv@hut.fi - * - * run this through the Doug Schmidt's gperf program - * with command - * gperf -g -o -j1 -t -p -N is_reserved_word - * - */ -struct resword { char *name; short token; short iclass;}; - -#define TOTAL_KEYWORDS 35 -#define MIN_WORD_LENGTH 2 -#define MAX_WORD_LENGTH 9 -#define MIN_HASH_VALUE 2 -#define MAX_HASH_VALUE 43 -/* maximum key range = 42, duplicates = 0 */ - -#ifdef __GNUC__ -__inline -#endif -static unsigned int -hash (str, len) - register const char *str; - register unsigned int len; -{ - static unsigned char asso_values[] = - { - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 18, 29, 14, 6, 7, - 10, 20, 44, 28, 44, 44, 28, 19, 22, 15, - 0, 44, 9, 23, 0, 23, 26, 2, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 0, 0, 13, 44, 30, 44, 44, 44, 0, 25, - 1, 0, 44, 44, 0, 44, 1, 44, 25, 44, - 44, 0, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44 - }; - return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]]; -} - -#ifdef __GNUC__ -__inline -#endif -struct resword * -is_reserved_word (str, len) - register const char *str; - register unsigned int len; -{ - static struct resword wordlist[] = - { - {""}, {""}, - {"To", TO, PASCAL_ISO}, - {""}, - {"Type", TYPE, PASCAL_ISO}, - {"Then", THEN, PASCAL_ISO}, - {"Packed", PACKED, PASCAL_ISO}, - {"While", WHILE, PASCAL_ISO}, - {"Do", DO, PASCAL_ISO}, - {"Procedure", PROCEDURE, PASCAL_ISO}, - {"End", END, PASCAL_ISO}, - {"Else", ELSE, PASCAL_ISO}, - {"Downto", DOWNTO, PASCAL_ISO}, - {"For", FOR, PASCAL_ISO}, - {"File", FILE_, PASCAL_ISO}, - {"Record", RECORD, PASCAL_ISO}, - {"Repeat", REPEAT, PASCAL_ISO}, - {"Or", OR, PASCAL_ISO}, - {"Case", CASE, PASCAL_ISO}, - {"Function", FUNCTION, PASCAL_ISO}, - {"Const", CONST, PASCAL_ISO}, - {"And", AND, PASCAL_ISO}, - {"Mod", MOD, PASCAL_ISO}, - {"Array", ARRAY, PASCAL_ISO}, - {"Goto", GOTO, PASCAL_ISO}, - {"Nil", NIL, PASCAL_ISO}, - {"Not", NOT, PASCAL_ISO}, - {"Set", SET, PASCAL_ISO}, - {"Until", UNTIL, PASCAL_ISO}, - {"Var", VAR, PASCAL_ISO}, - {"Of", OF, PASCAL_ISO}, - {"In", IN, PASCAL_ISO}, - {"Program",PROGRAM,PASCAL_ISO}, - {"Label", LABEL, PASCAL_ISO}, - {"Div", DIV, PASCAL_ISO}, - {"Begin", BEGIN_, PASCAL_ISO}, - {"With", WITH, PASCAL_ISO}, - {""}, {""}, {""}, {""}, {""}, {""}, - {"If", IF, PASCAL_ISO} - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - { - register const char *s = wordlist[key].name; - - if (*str == *s && !strcmp (str + 1, s + 1)) - return &wordlist[key]; - } - } - return 0; -} diff --git a/contrib/gperf/tests/test-6.exp b/contrib/gperf/tests/test-6.exp deleted file mode 100644 index 3521f13c41c43..0000000000000 --- a/contrib/gperf/tests/test-6.exp +++ /dev/null @@ -1,119 +0,0 @@ -GNU `gperf' generates perfect hash functions. - -Usage: ../src/gperf [OPTION]... [INPUT-FILE] - -If a long option shows an argument as mandatory, then it is mandatory -for the equivalent short option also. - -Input file interpretation: - -e, --delimiters=DELIMITER-LIST - Allow user to provide a string containing delimiters - used to separate keywords from their attributes. - Default is ",\n". - -t, --struct-type Allows the user to include a structured type - declaration for generated code. Any text before %% - is considered part of the type declaration. Key - words and additional fields may follow this, one - group of fields per line. - -Language for the output code: - -L, --language=LANGUAGE-NAME - Generates code in the specified language. Languages - handled are currently C++, ANSI-C, C, and KR-C. The - default is C. - -Details in the output code: - -K, --slot-name=NAME Select name of the keyword component in the keyword - structure. - -H, --hash-fn-name=NAME - Specify name of generated hash function. Default is - `hash'. - -N, --lookup-fn-name=NAME - Specify name of generated lookup function. Default - name is `in_word_set'. - -Z, --class-name=NAME Specify name of generated C++ class. Default name is - `Perfect_Hash'. - -7, --seven-bit Assume 7-bit characters. - -c, --compare-strncmp Generate comparison code using strncmp rather than - strcmp. - -C, --readonly-tables Make the contents of generated lookup tables - constant, i.e., readonly. - -E, --enum Define constant values using an enum local to the - lookup function rather than with defines. - -I, --includes Include the necessary system include file <string.h> - at the beginning of the code. - -G, --global Generate the static table of keywords as a static - global variable, rather than hiding it inside of the - lookup function (which is the default behavior). - -W, --word-array-name=NAME - Specify name of word list array. Default name is - `wordlist'. - -S, --switch=COUNT Causes the generated C code to use a switch - statement scheme, rather than an array lookup table. - This can lead to a reduction in both time and space - requirements for some keyfiles. The COUNT argument - determines how many switch statements are generated. - A value of 1 generates 1 switch containing all the - elements, a value of 2 generates 2 tables with 1/2 - the elements in each table, etc. If COUNT is very - large, say 1000000, the generated C code does a - binary search. - -T, --omit-struct-type - Prevents the transfer of the type declaration to the - output file. Use this option if the type is already - defined elsewhere. - -Algorithm employed by gperf: - -k, --key-positions=KEYS - Select the key positions used in the hash function. - The allowable choices range between 1-126, inclusive. - The positions are separated by commas, ranges may be - used, and key positions may occur in any order. - Also, the meta-character '*' causes the generated - hash function to consider ALL key positions, and $ - indicates the ``final character'' of a key, e.g., - $,1,2,4,6-10. - -l, --compare-strlen Compare key lengths before trying a string - comparison. This helps cut down on the number of - string comparisons made during the lookup. - -D, --duplicates Handle keywords that hash to duplicate values. This - is useful for certain highly redundant keyword sets. - -f, --fast=ITERATIONS Generate the gen-perf.hash function ``fast''. This - decreases gperf's running time at the cost of - minimizing generated table size. The numeric - argument represents the number of times to iterate - when resolving a collision. `0' means ``iterate by - the number of keywords''. - -i, --initial-asso=N Provide an initial value for the associate values - array. Default is 0. Setting this value larger helps - inflate the size of the final table. - -j, --jump=JUMP-VALUE Affects the ``jump value'', i.e., how far to advance - the associated character value upon collisions. Must - be an odd number, default is 5. - -n, --no-strlen Do not include the length of the keyword when - computing the hash function. - -o, --occurrence-sort Reorders input keys by frequency of occurrence of - the key sets. This should decrease the search time - dramatically. - -r, --random Utilizes randomness to initialize the associated - values table. - -s, --size-multiple=N Affects the size of the generated hash table. The - numeric argument N indicates ``how many times larger - or smaller'' the associated value range should be, - in relationship to the number of keys, e.g. a value - of 3 means ``allow the maximum associated value to - be about 3 times larger than the number of input - keys.'' Conversely, a value of -3 means ``make the - maximum associated value about 3 times smaller than - the number of input keys. A larger table should - decrease the time required for an unsuccessful - search, at the expense of extra table space. Default - value is 1. - -Informative output: - -h, --help Print this message. - -v, --version Print the gperf version number. - -d, --debug Enables the debugging option (produces verbose - output to the standard error). - -Report bugs to <bug-gnu-utils@gnu.org>. diff --git a/contrib/gperf/tests/test-7.exp b/contrib/gperf/tests/test-7.exp deleted file mode 100644 index c5c942c10d1f2..0000000000000 --- a/contrib/gperf/tests/test-7.exp +++ /dev/null @@ -1,32 +0,0 @@ -in word set if -in word set do -NOT in word set int -in word set for -in word set case -NOT in word set char -NOT in word set auto -in word set goto -in word set else -NOT in word set long -NOT in word set void -NOT in word set enum -NOT in word set float -NOT in word set short -NOT in word set union -NOT in word set break -in word set while -NOT in word set const -NOT in word set double -NOT in word set static -NOT in word set extern -NOT in word set struct -in word set return -NOT in word set sizeof -NOT in word set switch -NOT in word set signed -NOT in word set typedef -NOT in word set default -NOT in word set unsigned -NOT in word set continue -NOT in word set register -NOT in word set volatile diff --git a/contrib/gperf/tests/validate b/contrib/gperf/tests/validate deleted file mode 100755 index a4813ab3eec1d..0000000000000 --- a/contrib/gperf/tests/validate +++ /dev/null @@ -1,54 +0,0 @@ -#! /bin/sh -# Validate gperf's operation on a given input file. -# Usage: validate languages input.gperf [more gperf options] -# Uses the environment variables GPERF, CC, CFLAGS, CXX, CXXFLAGS. -# Supposes gcc and g++. - -# Exit on error -set -e - -verbose () { - echo "$@" - "$@" -} - -languages=$1 -shift - -for lang in `echo $languages | sed -e 's/,/ /g'`; do - case "$lang" in - KR-C ) - echo "${GPERF} -I -L KR-C $@ > valitest.c" - ${GPERF} -I -L KR-C "$@" > valitest.c - grep -n ' const ' valitest.c /dev/null && exit 1 - verbose ${CC} ${CFLAGS} -traditional valitest.c -o valitest - ./valitest - verbose ${CC} ${CFLAGS} -ansi -pedantic valitest.c -o valitest - ./valitest - ;; - C ) - echo "${GPERF} -I -L C $@ > valitest.c" - ${GPERF} -I -L C "$@" > valitest.c - verbose ${CC} ${CFLAGS} -traditional -Dconst= valitest.c -o valitest - ./valitest - verbose ${CC} ${CFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest - ./valitest - ;; - ANSI-C ) - echo "${GPERF} -I -L ANSI-C $@ > valitest.c" - ${GPERF} -I -L ANSI-C "$@" > valitest.c - verbose ${CC} ${CFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest - ./valitest - verbose ${CXX} ${CXXFLAGS} -ansi -pedantic -pedantic-errors valitest.c -o valitest - ./valitest - ;; - "C++" ) - echo "${GPERF} -I -L C++ $@ > valitest.c" - ${GPERF} -I -L C++ "$@" > valitest.c - verbose ${CXX} ${CXXFLAGS} -ansi -pedantic -pedantic-errors -DCPLUSPLUS_TEST valitest.c -o valitest - ./valitest - ;; - esac -done - -exit 0 diff --git a/contrib/groff/src/libs/libgroff/cmap.cc b/contrib/groff/src/libs/libgroff/cmap.cc deleted file mode 100644 index d08f04d03b438..0000000000000 --- a/contrib/groff/src/libs/libgroff/cmap.cc +++ /dev/null @@ -1,62 +0,0 @@ -// -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.com) - -This file is part of groff. - -groff 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, or (at your option) any later -version. - -groff 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 groff; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include <ctype.h> -#ifdef __FreeBSD__ -#include <locale.h> -#endif -#include "cmap.h" - -cmap cmlower(CMAP_BUILTIN); -cmap cmupper(CMAP_BUILTIN); - -#if defined(isascii) && !defined(__FreeBSD__) -#define ISASCII(c) isascii(c) -#else -#define ISASCII(c) (1) -#endif - -cmap::cmap() -{ - unsigned char *p = v; - for (int i = 0; i <= UCHAR_MAX; i++) - p[i] = i; -} - -cmap::cmap(cmap_builtin) -{ - // these are initialised by cmap_init::cmap_init() -} - -int cmap_init::initialised = 0; - -cmap_init::cmap_init() -{ - if (initialised) - return; - initialised = 1; -#ifdef __FreeBSD__ - (void) setlocale(LC_CTYPE, ""); -#endif - for (int i = 0; i <= UCHAR_MAX; i++) { - cmupper.v[i] = ISASCII(i) && islower(i) ? toupper(i) : i; - cmlower.v[i] = ISASCII(i) && isupper(i) ? tolower(i) : i; - } -} diff --git a/contrib/groff/src/libs/libgroff/cset.cc b/contrib/groff/src/libs/libgroff/cset.cc deleted file mode 100644 index a9da1f1fe99af..0000000000000 --- a/contrib/groff/src/libs/libgroff/cset.cc +++ /dev/null @@ -1,108 +0,0 @@ -// -*- C++ -*- -/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc. - Written by James Clark (jjc@jclark.com) - -This file is part of groff. - -groff 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, or (at your option) any later -version. - -groff 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 groff; see the file COPYING. If not, write to the Free Software -Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -#include <ctype.h> -#ifdef __FreeBSD__ -#include <locale.h> -#endif -#include "cset.h" - -cset csalpha(CSET_BUILTIN); -cset csupper(CSET_BUILTIN); -cset cslower(CSET_BUILTIN); -cset csdigit(CSET_BUILTIN); -cset csxdigit(CSET_BUILTIN); -cset csspace(CSET_BUILTIN); -cset cspunct(CSET_BUILTIN); -cset csalnum(CSET_BUILTIN); -cset csprint(CSET_BUILTIN); -cset csgraph(CSET_BUILTIN); -cset cscntrl(CSET_BUILTIN); - -#if defined(isascii) && !defined(__FreeBSD__) -#define ISASCII(c) isascii(c) -#else -#define ISASCII(c) (1) -#endif - -void cset::clear() -{ - char *p = v; - for (int i = 0; i <= UCHAR_MAX; i++) - p[i] = 0; -} - -cset::cset() -{ - clear(); -} - -cset::cset(const char *s) -{ - clear(); - while (*s) - v[(unsigned char)*s++] = 1; -} - -cset::cset(const unsigned char *s) -{ - clear(); - while (*s) - v[*s++] = 1; -} - -cset::cset(cset_builtin) -{ - // these are initialised by cset_init::cset_init() -} - -cset &cset::operator|=(const cset &cs) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - if (cs.v[i]) - v[i] = 1; - return *this; -} - - -int cset_init::initialised = 0; - -cset_init::cset_init() -{ - if (initialised) - return; - initialised = 1; -#ifdef __FreeBSD__ - (void) setlocale(LC_CTYPE, ""); -#endif - for (int i = 0; i <= UCHAR_MAX; i++) { - csalpha.v[i] = ISASCII(i) && isalpha(i); - csupper.v[i] = ISASCII(i) && isupper(i); - cslower.v[i] = ISASCII(i) && islower(i); - csdigit.v[i] = ISASCII(i) && isdigit(i); - csxdigit.v[i] = ISASCII(i) && isxdigit(i); - csspace.v[i] = ISASCII(i) && isspace(i); - cspunct.v[i] = ISASCII(i) && ispunct(i); - csalnum.v[i] = ISASCII(i) && isalnum(i); - csprint.v[i] = ISASCII(i) && isprint(i); - csgraph.v[i] = ISASCII(i) && isgraph(i); - cscntrl.v[i] = ISASCII(i) && iscntrl(i); - } -} diff --git a/crypto/openssl/README.ENGINE b/crypto/openssl/README.ENGINE deleted file mode 100644 index 3d88ed152ff76..0000000000000 --- a/crypto/openssl/README.ENGINE +++ /dev/null @@ -1,63 +0,0 @@ - - ENGINE - ====== - - With OpenSSL 0.9.6, a new component has been added to support external - crypto devices, for example accelerator cards. The component is called - ENGINE, and has still a pretty experimental status and almost no - documentation. It's designed to be faily easily extensible by the - calling programs. - - There's currently built-in support for the following crypto devices: - - o CryptoSwift - o Compaq Atalla - o nCipher CHIL - - A number of things are still needed and are being worked on: - - o An openssl utility command to handle or at least check available - engines. - o A better way of handling the methods that are handled by the - engines. - o Documentation! - - What already exists is fairly stable as far as it has been tested, but - the test base has been a bit small most of the time. - - Because of this experimental status and what's lacking, the ENGINE - component is not yet part of the default OpenSSL distribution. However, - we have made a separate kit for those who want to try this out, to be - found in the same places as the default OpenSSL distribution, but with - "-engine-" being part of the kit file name. For example, version 0.9.6 - is distributed in the following two files: - - openssl-0.9.6.tar.gz - openssl-engine-0.9.6.tar.gz - - NOTES - ===== - - openssl-engine-0.9.6.tar.gz does not depend on openssl-0.9.6.tar, you do - not need to download both. - - openssl-engine-0.9.6.tar.gz is usable even if you don't have an external - crypto device. The internal OpenSSL functions are contained in the - engine "openssl", and will be used by default. - - No external crypto device is chosen unless you say so. You have actively - tell the openssl utility commands to use it through a new command line - switch called "-engine". And if you want to use the ENGINE library to - do something similar, you must also explicitely choose an external crypto - device, or the built-in crypto routines will be used, just as in the - default OpenSSL distribution. - - - PROBLEMS - ======== - - It seems like the ENGINE part doesn't work too well with Cryptoswift on - Win32. A quick test done right before the release showed that trying - "openssl speed -engine cswift" generated errors. If the DSO gets enabled, - an attempt is made to write at memory address 0x00000002. - diff --git a/crypto/openssl/apps/dh2048.pem b/crypto/openssl/apps/dh2048.pem deleted file mode 100644 index dcd0b8d01b892..0000000000000 --- a/crypto/openssl/apps/dh2048.pem +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DH PARAMETERS----- -MIIBCAKCAQEA9kJXtwh/CBdyorrWqULzBej5UxE5T7bxbrlLOCDaAadWoxTpj0BV -89AHxstDqZSt90xkhkn4DIO9ZekX1KHTUPj1WV/cdlJPPT2N286Z4VeSWc39uK50 -T8X8dryDxUcwYc58yWb/Ffm7/ZFexwGq01uejaClcjrUGvC/RgBYK+X0iP1YTknb -zSC0neSRBzZrM2w4DUUdD3yIsxx8Wy2O9vPJI8BD8KVbGI2Ou1WMuF040zT9fBdX -Q6MdGGzeMyEstSr/POGxKUAYEY18hKcKctaGxAMZyAcpesqVDNmWn6vQClCbAkbT -CD1mpF1Bn5x8vYlLIhkmuquiXsNV6TILOwIBAg== ------END DH PARAMETERS----- - -These are the 2048 bit DH parameters from "Assigned Number for SKIP Protocols" -(http://www.skip-vpn.org/spec/numbers.html). -See there for how they were generated. diff --git a/crypto/openssl/apps/dh4096.pem b/crypto/openssl/apps/dh4096.pem deleted file mode 100644 index 1b35ad8e62ebf..0000000000000 --- a/crypto/openssl/apps/dh4096.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN DH PARAMETERS----- -MIICCAKCAgEA+hRyUsFN4VpJ1O8JLcCo/VWr19k3BCgJ4uk+d+KhehjdRqNDNyOQ -l/MOyQNQfWXPeGKmOmIig6Ev/nm6Nf9Z2B1h3R4hExf+zTiHnvVPeRBhjdQi81rt -Xeoh6TNrSBIKIHfUJWBh3va0TxxjQIs6IZOLeVNRLMqzeylWqMf49HsIXqbcokUS -Vt1BkvLdW48j8PPv5DsKRN3tloTxqDJGo9tKvj1Fuk74A+Xda1kNhB7KFlqMyN98 -VETEJ6c7KpfOo30mnK30wqw3S8OtaIR/maYX72tGOno2ehFDkq3pnPtEbD2CScxc -alJC+EL7RPk5c/tgeTvCngvc1KZn92Y//EI7G9tPZtylj2b56sHtMftIoYJ9+ODM -sccD5Piz/rejE3Ome8EOOceUSCYAhXn8b3qvxVI1ddd1pED6FHRhFvLrZxFvBEM9 -ERRMp5QqOaHJkM+Dxv8Cj6MqrCbfC4u+ZErxodzuusgDgvZiLF22uxMZbobFWyte -OvOzKGtwcTqO/1wV5gKkzu1ZVswVUQd5Gg8lJicwqRWyyNRczDDoG9jVDxmogKTH -AaqLulO7R8Ifa1SwF2DteSGVtgWEN8gDpN3RBmmPTDngyF2DHb5qmpnznwtFKdTL -KWbuHn491xNO25CQWMtem80uKw+pTnisBRF/454n1Jnhub144YRBoN8CAQI= ------END DH PARAMETERS----- - -These are the 4096 bit DH parameters from "Assigned Number for SKIP Protocols" -(http://www.skip-vpn.org/spec/numbers.html). -See there for how they were generated. -Note that g is not a generator, but this is not a problem since p is a safe prime. diff --git a/crypto/openssl/apps/dh512.pem b/crypto/openssl/apps/dh512.pem deleted file mode 100644 index 200d16cd89712..0000000000000 --- a/crypto/openssl/apps/dh512.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN DH PARAMETERS----- -MEYCQQD1Kv884bEpQBgRjXyEpwpy1obEAxnIByl6ypUM2Zafq9AKUJsCRtMIPWak -XUGfnHy9iUsiGSa6q6Jew1XpKgVfAgEC ------END DH PARAMETERS----- - -These are the 512 bit DH parameters from "Assigned Number for SKIP Protocols" -(http://www.skip-vpn.org/spec/numbers.html). -See there for how they were generated. -Note that g is not a generator, but this is not a problem since p is a safe prime. diff --git a/crypto/openssl/apps/rsautl.c b/crypto/openssl/apps/rsautl.c deleted file mode 100644 index bcb94c3d81040..0000000000000 --- a/crypto/openssl/apps/rsautl.c +++ /dev/null @@ -1,290 +0,0 @@ -/* rsautl.c */ -/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ -#include "apps.h" -#include <string.h> -#include <openssl/err.h> -#include <openssl/pem.h> - -#define RSA_SIGN 1 -#define RSA_VERIFY 2 -#define RSA_ENCRYPT 3 -#define RSA_DECRYPT 4 - -#define KEY_PRIVKEY 1 -#define KEY_PUBKEY 2 -#define KEY_CERT 3 - -static void usage(void); - -#undef PROG - -#define PROG rsautl_main - -int MAIN(int argc, char **); - -int MAIN(int argc, char **argv) -{ - BIO *in = NULL, *out = NULL; - char *infile = NULL, *outfile = NULL; - char *keyfile = NULL; - char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY; - int keyform = FORMAT_PEM; - char need_priv = 0, badarg = 0, rev = 0; - char hexdump = 0, asn1parse = 0; - X509 *x; - EVP_PKEY *pkey = NULL; - RSA *rsa = NULL; - unsigned char *rsa_in = NULL, *rsa_out = NULL, pad; - int rsa_inlen, rsa_outlen = 0; - int keysize; - - int ret = 1; - - argc--; - argv++; - - if(!bio_err) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); - ERR_load_crypto_strings(); - OpenSSL_add_all_algorithms(); - pad = RSA_PKCS1_PADDING; - - while(argc >= 1) - { - if (!strcmp(*argv,"-in")) { - if (--argc < 1) badarg = 1; - infile= *(++argv); - } else if (!strcmp(*argv,"-out")) { - if (--argc < 1) badarg = 1; - outfile= *(++argv); - } else if(!strcmp(*argv, "-inkey")) { - if (--argc < 1) badarg = 1; - keyfile = *(++argv); - } else if(!strcmp(*argv, "-pubin")) { - key_type = KEY_PUBKEY; - } else if(!strcmp(*argv, "-certin")) { - key_type = KEY_CERT; - } - else if(!strcmp(*argv, "-asn1parse")) asn1parse = 1; - else if(!strcmp(*argv, "-hexdump")) hexdump = 1; - else if(!strcmp(*argv, "-raw")) pad = RSA_NO_PADDING; - else if(!strcmp(*argv, "-oaep")) pad = RSA_PKCS1_OAEP_PADDING; - else if(!strcmp(*argv, "-ssl")) pad = RSA_SSLV23_PADDING; - else if(!strcmp(*argv, "-pkcs")) pad = RSA_PKCS1_PADDING; - else if(!strcmp(*argv, "-sign")) { - rsa_mode = RSA_SIGN; - need_priv = 1; - } else if(!strcmp(*argv, "-verify")) rsa_mode = RSA_VERIFY; - else if(!strcmp(*argv, "-rev")) rev = 1; - else if(!strcmp(*argv, "-encrypt")) rsa_mode = RSA_ENCRYPT; - else if(!strcmp(*argv, "-decrypt")) { - rsa_mode = RSA_DECRYPT; - need_priv = 1; - } else badarg = 1; - if(badarg) { - usage(); - goto end; - } - argc--; - argv++; - } - - if(need_priv && (key_type != KEY_PRIVKEY)) { - BIO_printf(bio_err, "A private key is needed for this operation\n"); - goto end; - } - -/* FIXME: seed PRNG only if needed */ - app_RAND_load_file(NULL, bio_err, 0); - - switch(key_type) { - case KEY_PRIVKEY: - pkey = load_key(bio_err, keyfile, keyform, NULL); - break; - - case KEY_PUBKEY: - pkey = load_pubkey(bio_err, keyfile, keyform); - break; - - case KEY_CERT: - x = load_cert(bio_err, keyfile, keyform); - if(x) { - pkey = X509_get_pubkey(x); - X509_free(x); - } - break; - } - - if(!pkey) { - BIO_printf(bio_err, "Error loading key\n"); - return 1; - } - - rsa = EVP_PKEY_get1_RSA(pkey); - EVP_PKEY_free(pkey); - - if(!rsa) { - BIO_printf(bio_err, "Error getting RSA key\n"); - ERR_print_errors(bio_err); - goto end; - } - - - if(infile) { - if(!(in = BIO_new_file(infile, "rb"))) { - BIO_printf(bio_err, "Error Reading Input File\n"); - ERR_print_errors(bio_err); - goto end; - } - } else in = BIO_new_fp(stdin, BIO_NOCLOSE); - - if(outfile) { - if(!(out = BIO_new_file(outfile, "wb"))) { - BIO_printf(bio_err, "Error Reading Output File\n"); - ERR_print_errors(bio_err); - goto end; - } - } else { - out = BIO_new_fp(stdout, BIO_NOCLOSE); -#ifdef VMS - { - BIO *tmpbio = BIO_new(BIO_f_linebuffer()); - out = BIO_push(tmpbio, out); - } -#endif - } - - keysize = RSA_size(rsa); - - rsa_in = OPENSSL_malloc(keysize * 2); - rsa_out = OPENSSL_malloc(keysize); - - /* Read the input data */ - rsa_inlen = BIO_read(in, rsa_in, keysize * 2); - if(rsa_inlen <= 0) { - BIO_printf(bio_err, "Error reading input Data\n"); - exit(1); - } - if(rev) { - int i; - unsigned char ctmp; - for(i = 0; i < rsa_inlen/2; i++) { - ctmp = rsa_in[i]; - rsa_in[i] = rsa_in[rsa_inlen - 1 - i]; - rsa_in[rsa_inlen - 1 - i] = ctmp; - } - } - switch(rsa_mode) { - - case RSA_VERIFY: - rsa_outlen = RSA_public_decrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad); - break; - - case RSA_SIGN: - rsa_outlen = RSA_private_encrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad); - break; - - case RSA_ENCRYPT: - rsa_outlen = RSA_public_encrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad); - break; - - case RSA_DECRYPT: - rsa_outlen = RSA_private_decrypt(rsa_inlen, rsa_in, rsa_out, rsa, pad); - break; - - } - - if(rsa_outlen <= 0) { - BIO_printf(bio_err, "RSA operation error\n"); - ERR_print_errors(bio_err); - goto end; - } - ret = 0; - if(asn1parse) { - if(!ASN1_parse_dump(out, rsa_out, rsa_outlen, 1, -1)) { - ERR_print_errors(bio_err); - } - } else if(hexdump) BIO_dump(out, (char *)rsa_out, rsa_outlen); - else BIO_write(out, rsa_out, rsa_outlen); - end: - RSA_free(rsa); - BIO_free(in); - BIO_free_all(out); - if(rsa_in) OPENSSL_free(rsa_in); - if(rsa_out) OPENSSL_free(rsa_out); - return ret; -} - -static void usage() -{ - BIO_printf(bio_err, "Usage: rsautl [options]\n"); - BIO_printf(bio_err, "-in file input file\n"); - BIO_printf(bio_err, "-out file output file\n"); - BIO_printf(bio_err, "-inkey file input key\n"); - BIO_printf(bio_err, "-pubin input is an RSA public\n"); - BIO_printf(bio_err, "-certin input is a certificate carrying an RSA public key\n"); - BIO_printf(bio_err, "-ssl use SSL v2 padding\n"); - BIO_printf(bio_err, "-raw use no padding\n"); - BIO_printf(bio_err, "-pkcs use PKCS#1 v1.5 padding (default)\n"); - BIO_printf(bio_err, "-oaep use PKCS#1 OAEP\n"); - BIO_printf(bio_err, "-sign sign with private key\n"); - BIO_printf(bio_err, "-verify verify with public key\n"); - BIO_printf(bio_err, "-encrypt encrypt with public key\n"); - BIO_printf(bio_err, "-decrypt decrypt with private key\n"); - BIO_printf(bio_err, "-hexdump hex dump output\n"); -} - diff --git a/crypto/openssl/crypto/asn1/a_strex.c b/crypto/openssl/crypto/asn1/a_strex.c deleted file mode 100644 index 569b811998584..0000000000000 --- a/crypto/openssl/crypto/asn1/a_strex.c +++ /dev/null @@ -1,533 +0,0 @@ -/* a_strex.c */ -/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include <string.h> -#include <openssl/crypto.h> -#include <openssl/x509.h> -#include <openssl/asn1.h> - -#include "charmap.h" - -/* ASN1_STRING_print_ex() and X509_NAME_print_ex(). - * Enhanced string and name printing routines handling - * multibyte characters, RFC2253 and a host of other - * options. - */ - - -#define CHARTYPE_BS_ESC (ASN1_STRFLGS_ESC_2253 | CHARTYPE_FIRST_ESC_2253 | CHARTYPE_LAST_ESC_2253) - - -/* Three IO functions for sending data to memory, a BIO and - * and a FILE pointer. - */ - -int send_mem_chars(void *arg, const void *buf, int len) -{ - unsigned char **out = arg; - if(!out) return 1; - memcpy(*out, buf, len); - *out += len; - return 1; -} - -int send_bio_chars(void *arg, const void *buf, int len) -{ - if(!arg) return 1; - if(BIO_write(arg, buf, len) != len) return 0; - return 1; -} - -int send_fp_chars(void *arg, const void *buf, int len) -{ - if(!arg) return 1; - if(fwrite(buf, 1, len, arg) != (unsigned int)len) return 0; - return 1; -} - -typedef int char_io(void *arg, const void *buf, int len); - -/* This function handles display of - * strings, one character at a time. - * It is passed an unsigned long for each - * character because it could come from 2 or even - * 4 byte forms. - */ - -static int do_esc_char(unsigned long c, unsigned char flags, char *do_quotes, char_io *io_ch, void *arg) -{ - unsigned char chflgs, chtmp; - char tmphex[11]; - if(c > 0xffff) { - BIO_snprintf(tmphex, 11, "\\W%08lX", c); - if(!io_ch(arg, tmphex, 10)) return -1; - return 10; - } - if(c > 0xff) { - BIO_snprintf(tmphex, 11, "\\U%04lX", c); - if(!io_ch(arg, tmphex, 6)) return -1; - return 6; - } - chtmp = (unsigned char)c; - if(chtmp > 0x7f) chflgs = flags & ASN1_STRFLGS_ESC_MSB; - else chflgs = char_type[chtmp] & flags; - if(chflgs & CHARTYPE_BS_ESC) { - /* If we don't escape with quotes, signal we need quotes */ - if(chflgs & ASN1_STRFLGS_ESC_QUOTE) { - if(do_quotes) *do_quotes = 1; - if(!io_ch(arg, &chtmp, 1)) return -1; - return 1; - } - if(!io_ch(arg, "\\", 1)) return -1; - if(!io_ch(arg, &chtmp, 1)) return -1; - return 2; - } - if(chflgs & (ASN1_STRFLGS_ESC_CTRL|ASN1_STRFLGS_ESC_MSB)) { - BIO_snprintf(tmphex, 11, "\\%02X", chtmp); - if(!io_ch(arg, tmphex, 3)) return -1; - return 3; - } - if(!io_ch(arg, &chtmp, 1)) return -1; - return 1; -} - -#define BUF_TYPE_WIDTH_MASK 0x7 -#define BUF_TYPE_CONVUTF8 0x8 - -/* This function sends each character in a buffer to - * do_esc_char(). It interprets the content formats - * and converts to or from UTF8 as appropriate. - */ - -static int do_buf(unsigned char *buf, int buflen, - int type, unsigned char flags, char *quotes, char_io *io_ch, void *arg) -{ - int i, outlen, len; - unsigned char orflags, *p, *q; - unsigned long c; - p = buf; - q = buf + buflen; - outlen = 0; - while(p != q) { - if(p == buf) orflags = CHARTYPE_FIRST_ESC_2253; - else orflags = 0; - switch(type & BUF_TYPE_WIDTH_MASK) { - case 4: - c = ((unsigned long)*p++) << 24; - c |= ((unsigned long)*p++) << 16; - c |= ((unsigned long)*p++) << 8; - c |= *p++; - break; - - case 2: - c = ((unsigned long)*p++) << 8; - c |= *p++; - break; - - case 1: - c = *p++; - break; - - case 0: - i = UTF8_getc(p, buflen, &c); - if(i < 0) return -1; /* Invalid UTF8String */ - p += i; - break; - } - if (p == q) orflags = CHARTYPE_LAST_ESC_2253; - if(type & BUF_TYPE_CONVUTF8) { - unsigned char utfbuf[6]; - int utflen; - utflen = UTF8_putc(utfbuf, 6, c); - for(i = 0; i < utflen; i++) { - /* We don't need to worry about setting orflags correctly - * because if utflen==1 its value will be correct anyway - * otherwise each character will be > 0x7f and so the - * character will never be escaped on first and last. - */ - len = do_esc_char(utfbuf[i], (unsigned char)(flags | orflags), quotes, io_ch, arg); - if(len < 0) return -1; - outlen += len; - } - } else { - len = do_esc_char(c, (unsigned char)(flags | orflags), quotes, io_ch, arg); - if(len < 0) return -1; - outlen += len; - } - } - return outlen; -} - -/* This function hex dumps a buffer of characters */ - -static int do_hex_dump(char_io *io_ch, void *arg, unsigned char *buf, int buflen) -{ - const static char hexdig[] = "0123456789ABCDEF"; - unsigned char *p, *q; - char hextmp[2]; - if(arg) { - p = buf; - q = buf + buflen; - while(p != q) { - hextmp[0] = hexdig[*p >> 4]; - hextmp[1] = hexdig[*p & 0xf]; - if(!io_ch(arg, hextmp, 2)) return -1; - p++; - } - } - return buflen << 1; -} - -/* "dump" a string. This is done when the type is unknown, - * or the flags request it. We can either dump the content - * octets or the entire DER encoding. This uses the RFC2253 - * #01234 format. - */ - -int do_dump(unsigned long lflags, char_io *io_ch, void *arg, ASN1_STRING *str) -{ - /* Placing the ASN1_STRING in a temp ASN1_TYPE allows - * the DER encoding to readily obtained - */ - ASN1_TYPE t; - unsigned char *der_buf, *p; - int outlen, der_len; - - if(!io_ch(arg, "#", 1)) return -1; - /* If we don't dump DER encoding just dump content octets */ - if(!(lflags & ASN1_STRFLGS_DUMP_DER)) { - outlen = do_hex_dump(io_ch, arg, str->data, str->length); - if(outlen < 0) return -1; - return outlen + 1; - } - t.type = str->type; - t.value.ptr = (char *)str; - der_len = i2d_ASN1_TYPE(&t, NULL); - der_buf = OPENSSL_malloc(der_len); - if(!der_buf) return -1; - p = der_buf; - i2d_ASN1_TYPE(&t, &p); - outlen = do_hex_dump(io_ch, arg, der_buf, der_len); - OPENSSL_free(der_buf); - if(outlen < 0) return -1; - return outlen + 1; -} - -/* Lookup table to convert tags to character widths, - * 0 = UTF8 encoded, -1 is used for non string types - * otherwise it is the number of bytes per character - */ - -const static char tag2nbyte[] = { - -1, -1, -1, -1, -1, /* 0-4 */ - -1, -1, -1, -1, -1, /* 5-9 */ - -1, -1, 0, -1, /* 10-13 */ - -1, -1, -1, -1, /* 15-17 */ - -1, 1, 1, /* 18-20 */ - -1, 1, -1,-1, /* 21-24 */ - -1, 1, -1, /* 25-27 */ - 4, -1, 2 /* 28-30 */ -}; - -#define ESC_FLAGS (ASN1_STRFLGS_ESC_2253 | \ - ASN1_STRFLGS_ESC_QUOTE | \ - ASN1_STRFLGS_ESC_CTRL | \ - ASN1_STRFLGS_ESC_MSB) - -/* This is the main function, print out an - * ASN1_STRING taking note of various escape - * and display options. Returns number of - * characters written or -1 if an error - * occurred. - */ - -static int do_print_ex(char_io *io_ch, void *arg, unsigned long lflags, ASN1_STRING *str) -{ - int outlen, len; - int type; - char quotes; - unsigned char flags; - quotes = 0; - /* Keep a copy of escape flags */ - flags = (unsigned char)(lflags & ESC_FLAGS); - - type = str->type; - - outlen = 0; - - - if(lflags & ASN1_STRFLGS_SHOW_TYPE) { - const char *tagname; - tagname = ASN1_tag2str(type); - outlen += strlen(tagname); - if(!io_ch(arg, tagname, outlen) || !io_ch(arg, ":", 1)) return -1; - outlen++; - } - - /* Decide what to do with type, either dump content or display it */ - - /* Dump everything */ - if(lflags & ASN1_STRFLGS_DUMP_ALL) type = -1; - /* Ignore the string type */ - else if(lflags & ASN1_STRFLGS_IGNORE_TYPE) type = 1; - else { - /* Else determine width based on type */ - if((type > 0) && (type < 31)) type = tag2nbyte[type]; - else type = -1; - if((type == -1) && !(lflags & ASN1_STRFLGS_DUMP_UNKNOWN)) type = 1; - } - - if(type == -1) { - len = do_dump(lflags, io_ch, arg, str); - if(len < 0) return -1; - outlen += len; - return outlen; - } - - if(lflags & ASN1_STRFLGS_UTF8_CONVERT) { - /* Note: if string is UTF8 and we want - * to convert to UTF8 then we just interpret - * it as 1 byte per character to avoid converting - * twice. - */ - if(!type) type = 1; - else type |= BUF_TYPE_CONVUTF8; - } - - len = do_buf(str->data, str->length, type, flags, "es, io_ch, NULL); - if(outlen < 0) return -1; - outlen += len; - if(quotes) outlen += 2; - if(!arg) return outlen; - if(quotes && !io_ch(arg, "\"", 1)) return -1; - do_buf(str->data, str->length, type, flags, NULL, io_ch, arg); - if(quotes && !io_ch(arg, "\"", 1)) return -1; - return outlen; -} - -/* Used for line indenting: print 'indent' spaces */ - -static int do_indent(char_io *io_ch, void *arg, int indent) -{ - int i; - for(i = 0; i < indent; i++) - if(!io_ch(arg, " ", 1)) return 0; - return 1; -} - - -static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n, - int indent, unsigned long flags) -{ - int i, prev = -1, orflags, cnt; - int fn_opt, fn_nid; - ASN1_OBJECT *fn; - ASN1_STRING *val; - X509_NAME_ENTRY *ent; - char objtmp[80]; - const char *objbuf; - int outlen, len; - char *sep_dn, *sep_mv, *sep_eq; - int sep_dn_len, sep_mv_len, sep_eq_len; - if(indent < 0) indent = 0; - outlen = indent; - if(!do_indent(io_ch, arg, indent)) return -1; - switch (flags & XN_FLAG_SEP_MASK) - { - case XN_FLAG_SEP_MULTILINE: - sep_dn = "\n"; - sep_dn_len = 1; - sep_mv = " + "; - sep_mv_len = 3; - break; - - case XN_FLAG_SEP_COMMA_PLUS: - sep_dn = ","; - sep_dn_len = 1; - sep_mv = "+"; - sep_mv_len = 1; - indent = 0; - break; - - case XN_FLAG_SEP_CPLUS_SPC: - sep_dn = ", "; - sep_dn_len = 2; - sep_mv = " + "; - sep_mv_len = 3; - indent = 0; - break; - - case XN_FLAG_SEP_SPLUS_SPC: - sep_dn = "; "; - sep_dn_len = 2; - sep_mv = " + "; - sep_mv_len = 3; - indent = 0; - break; - - default: - return -1; - } - - if(flags & XN_FLAG_SPC_EQ) { - sep_eq = " = "; - sep_eq_len = 3; - } else { - sep_eq = "="; - sep_eq_len = 1; - } - - fn_opt = flags & XN_FLAG_FN_MASK; - - cnt = X509_NAME_entry_count(n); - for(i = 0; i < cnt; i++) { - if(flags & XN_FLAG_DN_REV) - ent = X509_NAME_get_entry(n, cnt - i - 1); - else ent = X509_NAME_get_entry(n, i); - if(prev != -1) { - if(prev == ent->set) { - if(!io_ch(arg, sep_mv, sep_mv_len)) return -1; - outlen += sep_mv_len; - } else { - if(!io_ch(arg, sep_dn, sep_dn_len)) return -1; - outlen += sep_dn_len; - if(!do_indent(io_ch, arg, indent)) return -1; - outlen += indent; - } - } - prev = ent->set; - fn = X509_NAME_ENTRY_get_object(ent); - val = X509_NAME_ENTRY_get_data(ent); - fn_nid = OBJ_obj2nid(fn); - if(fn_opt != XN_FLAG_FN_NONE) { - int objlen; - if((fn_opt == XN_FLAG_FN_OID) || (fn_nid==NID_undef) ) { - OBJ_obj2txt(objtmp, 80, fn, 1); - objbuf = objtmp; - } else { - if(fn_opt == XN_FLAG_FN_SN) - objbuf = OBJ_nid2sn(fn_nid); - else if(fn_opt == XN_FLAG_FN_LN) - objbuf = OBJ_nid2ln(fn_nid); - else objbuf = ""; - } - objlen = strlen(objbuf); - if(!io_ch(arg, objbuf, objlen)) return -1; - if(!io_ch(arg, sep_eq, sep_eq_len)) return -1; - outlen += objlen + sep_eq_len; - } - /* If the field name is unknown then fix up the DER dump - * flag. We might want to limit this further so it will - * DER dump on anything other than a few 'standard' fields. - */ - if((fn_nid == NID_undef) && (flags & XN_FLAG_DUMP_UNKNOWN_FIELDS)) - orflags = ASN1_STRFLGS_DUMP_ALL; - else orflags = 0; - - len = do_print_ex(io_ch, arg, flags | orflags, val); - if(len < 0) return -1; - outlen += len; - } - return outlen; -} - -/* Wrappers round the main functions */ - -int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags) -{ - return do_name_ex(send_bio_chars, out, nm, indent, flags); -} - - -int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags) -{ - return do_name_ex(send_fp_chars, fp, nm, indent, flags); -} - -int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags) -{ - return do_print_ex(send_bio_chars, out, flags, str); -} - - -int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags) -{ - return do_print_ex(send_fp_chars, fp, flags, str); -} - -/* Utility function: convert any string type to UTF8, returns number of bytes - * in output string or a negative error code - */ - -int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) -{ - ASN1_STRING stmp, *str = &stmp; - int mbflag, type, ret; - if(!*out || !in) return -1; - type = in->type; - if((type < 0) || (type > 30)) return -1; - mbflag = tag2nbyte[type]; - if(mbflag == -1) return -1; - mbflag |= MBSTRING_FLAG; - stmp.data = NULL; - ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); - if(ret < 0) return ret; - if(out) *out = stmp.data; - return stmp.length; -} diff --git a/crypto/openssl/crypto/asn1/charmap.h b/crypto/openssl/crypto/asn1/charmap.h deleted file mode 100644 index bd020a9562fd1..0000000000000 --- a/crypto/openssl/crypto/asn1/charmap.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Auto generated with chartype.pl script. - * Mask of various character properties - */ - -static unsigned char char_type[] = { - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -120, 0, 1,40, 0, 0, 0,16,16,16, 0,25,25,16,16,16, -16,16,16,16,16,16,16,16,16,16,16, 9, 9,16, 9,16, - 0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16, 0, 1, 0, 0, 0, - 0,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16, 0, 0, 0, 0, 2 -}; - diff --git a/crypto/openssl/crypto/asn1/charmap.pl b/crypto/openssl/crypto/asn1/charmap.pl deleted file mode 100644 index 2875c5986728c..0000000000000 --- a/crypto/openssl/crypto/asn1/charmap.pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/local/bin/perl -w - -use strict; - -my ($i, @arr); - -# Set up an array with the type of ASCII characters -# Each set bit represents a character property. - -# RFC2253 character properties -my $RFC2253_ESC = 1; # Character escaped with \ -my $ESC_CTRL = 2; # Escaped control character -# These are used with RFC1779 quoting using " -my $NOESC_QUOTE = 8; # Not escaped if quoted -my $PSTRING_CHAR = 0x10; # Valid PrintableString character -my $RFC2253_FIRST_ESC = 0x20; # Escaped with \ if first character -my $RFC2253_LAST_ESC = 0x40; # Escaped with \ if last character - -for($i = 0; $i < 128; $i++) { - # Set the RFC2253 escape characters (control) - $arr[$i] = 0; - if(($i < 32) || ($i > 126)) { - $arr[$i] |= $ESC_CTRL; - } - - # Some PrintableString characters - if( ( ( $i >= ord("a")) && ( $i <= ord("z")) ) - || ( ( $i >= ord("A")) && ( $i <= ord("Z")) ) - || ( ( $i >= ord("0")) && ( $i <= ord("9")) ) ) { - $arr[$i] |= $PSTRING_CHAR; - } -} - -# Now setup the rest - -# Remaining RFC2253 escaped characters - -$arr[ord(" ")] |= $NOESC_QUOTE | $RFC2253_FIRST_ESC | $RFC2253_LAST_ESC; -$arr[ord("#")] |= $NOESC_QUOTE | $RFC2253_FIRST_ESC; - -$arr[ord(",")] |= $NOESC_QUOTE | $RFC2253_ESC; -$arr[ord("+")] |= $NOESC_QUOTE | $RFC2253_ESC; -$arr[ord("\"")] |= $RFC2253_ESC; -$arr[ord("\\")] |= $RFC2253_ESC; -$arr[ord("<")] |= $NOESC_QUOTE | $RFC2253_ESC; -$arr[ord(">")] |= $NOESC_QUOTE | $RFC2253_ESC; -$arr[ord(";")] |= $NOESC_QUOTE | $RFC2253_ESC; - -# Remaining PrintableString characters - -$arr[ord(" ")] |= $PSTRING_CHAR; -$arr[ord("'")] |= $PSTRING_CHAR; -$arr[ord("(")] |= $PSTRING_CHAR; -$arr[ord(")")] |= $PSTRING_CHAR; -$arr[ord("+")] |= $PSTRING_CHAR; -$arr[ord(",")] |= $PSTRING_CHAR; -$arr[ord("-")] |= $PSTRING_CHAR; -$arr[ord(".")] |= $PSTRING_CHAR; -$arr[ord("/")] |= $PSTRING_CHAR; -$arr[ord(":")] |= $PSTRING_CHAR; -$arr[ord("=")] |= $PSTRING_CHAR; -$arr[ord("?")] |= $PSTRING_CHAR; - -# Now generate the C code - -print <<EOF; -/* Auto generated with chartype.pl script. - * Mask of various character properties - */ - -static unsigned char char_type[] = { -EOF - -for($i = 0; $i < 128; $i++) { - print("\n") if($i && (($i % 16) == 0)); - printf("%2d", $arr[$i]); - print(",") if ($i != 127); -} -print("\n};\n\n"); - diff --git a/crypto/openssl/crypto/bio/bf_lbuf.c b/crypto/openssl/crypto/bio/bf_lbuf.c deleted file mode 100644 index 7bcf8ed9413e7..0000000000000 --- a/crypto/openssl/crypto/bio/bf_lbuf.c +++ /dev/null @@ -1,397 +0,0 @@ -/* crypto/bio/bf_buff.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <errno.h> -#include "cryptlib.h" -#include <openssl/bio.h> -#include <openssl/evp.h> - -static int linebuffer_write(BIO *h, const char *buf,int num); -static int linebuffer_read(BIO *h, char *buf, int size); -static int linebuffer_puts(BIO *h, const char *str); -static int linebuffer_gets(BIO *h, char *str, int size); -static long linebuffer_ctrl(BIO *h, int cmd, long arg1, void *arg2); -static int linebuffer_new(BIO *h); -static int linebuffer_free(BIO *data); -static long linebuffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp); - -/* A 10k maximum should be enough for most purposes */ -#define DEFAULT_LINEBUFFER_SIZE 1024*10 - -/* #define DEBUG */ - -static BIO_METHOD methods_linebuffer= - { - BIO_TYPE_LINEBUFFER, - "linebuffer", - linebuffer_write, - linebuffer_read, - linebuffer_puts, - linebuffer_gets, - linebuffer_ctrl, - linebuffer_new, - linebuffer_free, - linebuffer_callback_ctrl, - }; - -BIO_METHOD *BIO_f_linebuffer(void) - { - return(&methods_linebuffer); - } - -typedef struct bio_linebuffer_ctx_struct - { - char *obuf; /* the output char array */ - int obuf_size; /* how big is the output buffer */ - int obuf_len; /* how many bytes are in it */ - } BIO_LINEBUFFER_CTX; - -static int linebuffer_new(BIO *bi) - { - BIO_LINEBUFFER_CTX *ctx; - - ctx=(BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX)); - if (ctx == NULL) return(0); - ctx->obuf=(char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE); - if (ctx->obuf == NULL) { OPENSSL_free(ctx); return(0); } - ctx->obuf_size=DEFAULT_LINEBUFFER_SIZE; - ctx->obuf_len=0; - - bi->init=1; - bi->ptr=(char *)ctx; - bi->flags=0; - return(1); - } - -static int linebuffer_free(BIO *a) - { - BIO_LINEBUFFER_CTX *b; - - if (a == NULL) return(0); - b=(BIO_LINEBUFFER_CTX *)a->ptr; - if (b->obuf != NULL) OPENSSL_free(b->obuf); - OPENSSL_free(a->ptr); - a->ptr=NULL; - a->init=0; - a->flags=0; - return(1); - } - -static int linebuffer_read(BIO *b, char *out, int outl) - { - int ret=0; - - if (out == NULL) return(0); - if (b->next_bio == NULL) return(0); - ret=BIO_read(b->next_bio,out,outl); - BIO_clear_retry_flags(b); - BIO_copy_next_retry(b); - return(ret); - } - -static int linebuffer_write(BIO *b, const char *in, int inl) - { - int i,num=0,foundnl; - BIO_LINEBUFFER_CTX *ctx; - - if ((in == NULL) || (inl <= 0)) return(0); - ctx=(BIO_LINEBUFFER_CTX *)b->ptr; - if ((ctx == NULL) || (b->next_bio == NULL)) return(0); - - BIO_clear_retry_flags(b); - - do - { - const char *p; - - for(p = in; p < in + inl && *p != '\n'; p++) - ; - if (*p == '\n') - { - p++; - foundnl = 1; - } - else - foundnl = 0; - - /* If a NL was found and we already have text in the save - buffer, concatenate them and write */ - while ((foundnl || p - in > ctx->obuf_size - ctx->obuf_len) - && ctx->obuf_len > 0) - { - int orig_olen = ctx->obuf_len; - - i = ctx->obuf_size - ctx->obuf_len; - if (p - in > 0) - { - if (i >= p - in) - { - memcpy(&(ctx->obuf[ctx->obuf_len]), - in,p - in); - ctx->obuf_len += p - in; - inl -= p - in; - num += p - in; - in = p; - } - else - { - memcpy(&(ctx->obuf[ctx->obuf_len]), - in,i); - ctx->obuf_len += i; - inl -= i; - in += i; - num += i; - } - } - -#ifdef DEBUG -BIO_write(b->next_bio, "<*<", 3); -#endif - i=BIO_write(b->next_bio, - ctx->obuf, ctx->obuf_len); - if (i <= 0) - { - ctx->obuf_len = orig_olen; - BIO_copy_next_retry(b); - -#ifdef DEBUG -BIO_write(b->next_bio, ">*>", 3); -#endif - if (i < 0) return((num > 0)?num:i); - if (i == 0) return(num); - } -#ifdef DEBUG -BIO_write(b->next_bio, ">*>", 3); -#endif - if (i < ctx->obuf_len) - memmove(ctx->obuf, ctx->obuf + i, - ctx->obuf_len - i); - ctx->obuf_len-=i; - } - - /* Now that the save buffer is emptied, let's write the input - buffer if a NL was found and there is anything to write. */ - if ((foundnl || p - in > ctx->obuf_size) && p - in > 0) - { -#ifdef DEBUG -BIO_write(b->next_bio, "<*<", 3); -#endif - i=BIO_write(b->next_bio,in,p - in); - if (i <= 0) - { - BIO_copy_next_retry(b); -#ifdef DEBUG -BIO_write(b->next_bio, ">*>", 3); -#endif - if (i < 0) return((num > 0)?num:i); - if (i == 0) return(num); - } -#ifdef DEBUG -BIO_write(b->next_bio, ">*>", 3); -#endif - num+=i; - in+=i; - inl-=i; - } - } - while(foundnl && inl > 0); - /* We've written as much as we can. The rest of the input buffer, if - any, is text that doesn't and with a NL and therefore needs to be - saved for the next trip. */ - if (inl > 0) - { - memcpy(&(ctx->obuf[ctx->obuf_len]), in, inl); - ctx->obuf_len += inl; - num += inl; - } - return num; - } - -static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr) - { - BIO *dbio; - BIO_LINEBUFFER_CTX *ctx; - long ret=1; - char *p; - int r; - int obs; - - ctx=(BIO_LINEBUFFER_CTX *)b->ptr; - - switch (cmd) - { - case BIO_CTRL_RESET: - ctx->obuf_len=0; - if (b->next_bio == NULL) return(0); - ret=BIO_ctrl(b->next_bio,cmd,num,ptr); - break; - case BIO_CTRL_INFO: - ret=(long)ctx->obuf_len; - break; - case BIO_CTRL_WPENDING: - ret=(long)ctx->obuf_len; - if (ret == 0) - { - if (b->next_bio == NULL) return(0); - ret=BIO_ctrl(b->next_bio,cmd,num,ptr); - } - break; - case BIO_C_SET_BUFF_SIZE: - obs=(int)num; - p=ctx->obuf; - if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size)) - { - p=(char *)OPENSSL_malloc((int)num); - if (p == NULL) - goto malloc_error; - } - if (ctx->obuf != p) - { - if (ctx->obuf_len > obs) - { - ctx->obuf_len = obs; - } - memcpy(p, ctx->obuf, ctx->obuf_len); - OPENSSL_free(ctx->obuf); - ctx->obuf=p; - ctx->obuf_size=obs; - } - break; - case BIO_C_DO_STATE_MACHINE: - if (b->next_bio == NULL) return(0); - BIO_clear_retry_flags(b); - ret=BIO_ctrl(b->next_bio,cmd,num,ptr); - BIO_copy_next_retry(b); - break; - - case BIO_CTRL_FLUSH: - if (b->next_bio == NULL) return(0); - if (ctx->obuf_len <= 0) - { - ret=BIO_ctrl(b->next_bio,cmd,num,ptr); - break; - } - - for (;;) - { - BIO_clear_retry_flags(b); - if (ctx->obuf_len > 0) - { - r=BIO_write(b->next_bio, - ctx->obuf, ctx->obuf_len); -#if 0 -fprintf(stderr,"FLUSH %3d -> %3d\n",ctx->obuf_len,r); -#endif - BIO_copy_next_retry(b); - if (r <= 0) return((long)r); - if (r < ctx->obuf_len) - memmove(ctx->obuf, ctx->obuf + r, - ctx->obuf_len - r); - ctx->obuf_len-=r; - } - else - { - ctx->obuf_len=0; - ret=1; - break; - } - } - ret=BIO_ctrl(b->next_bio,cmd,num,ptr); - break; - case BIO_CTRL_DUP: - dbio=(BIO *)ptr; - if ( !BIO_set_write_buffer_size(dbio,ctx->obuf_size)) - ret=0; - break; - default: - if (b->next_bio == NULL) return(0); - ret=BIO_ctrl(b->next_bio,cmd,num,ptr); - break; - } - return(ret); -malloc_error: - BIOerr(BIO_F_LINEBUFFER_CTRL,ERR_R_MALLOC_FAILURE); - return(0); - } - -static long linebuffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) - { - long ret=1; - - if (b->next_bio == NULL) return(0); - switch (cmd) - { - default: - ret=BIO_callback_ctrl(b->next_bio,cmd,fp); - break; - } - return(ret); - } - -static int linebuffer_gets(BIO *b, char *buf, int size) - { - if (b->next_bio == NULL) return(0); - return(BIO_gets(b->next_bio,buf,size)); - } - -static int linebuffer_puts(BIO *b, const char *str) - { - return(linebuffer_write(b,str,strlen(str))); - } - diff --git a/crypto/openssl/crypto/bn/asm/pa-risc2W.s b/crypto/openssl/crypto/bn/asm/pa-risc2W.s deleted file mode 100644 index 54b6606252eae..0000000000000 --- a/crypto/openssl/crypto/bn/asm/pa-risc2W.s +++ /dev/null @@ -1,1605 +0,0 @@ -; -; PA-RISC 64-bit implementation of bn_asm code -; -; This code is approximately 2x faster than the C version -; for RSA/DSA. -; -; See http://devresource.hp.com/ for more details on the PA-RISC -; architecture. Also see the book "PA-RISC 2.0 Architecture" -; by Gerry Kane for information on the instruction set architecture. -; -; Code written by Chris Ruemmler (with some help from the HP C -; compiler). -; -; The code compiles with HP's assembler -; - - .level 2.0W - .space $TEXT$ - .subspa $CODE$,QUAD=0,ALIGN=8,ACCESS=0x2c,CODE_ONLY - -; -; Global Register definitions used for the routines. -; -; Some information about HP's runtime architecture for 64-bits. -; -; "Caller save" means the calling function must save the register -; if it wants the register to be preserved. -; "Callee save" means if a function uses the register, it must save -; the value before using it. -; -; For the floating point registers -; -; "caller save" registers: fr4-fr11, fr22-fr31 -; "callee save" registers: fr12-fr21 -; "special" registers: fr0-fr3 (status and exception registers) -; -; For the integer registers -; value zero : r0 -; "caller save" registers: r1,r19-r26 -; "callee save" registers: r3-r18 -; return register : r2 (rp) -; return values ; r28 (ret0,ret1) -; Stack pointer ; r30 (sp) -; global data pointer ; r27 (dp) -; argument pointer ; r29 (ap) -; millicode return ptr ; r31 (also a caller save register) - - -; -; Arguments to the routines -; -r_ptr .reg %r26 -a_ptr .reg %r25 -b_ptr .reg %r24 -num .reg %r24 -w .reg %r23 -n .reg %r23 - - -; -; Globals used in some routines -; - -top_overflow .reg %r29 -high_mask .reg %r22 ; value 0xffffffff80000000L - - -;------------------------------------------------------------------------------ -; -; bn_mul_add_words -; -;BN_ULONG bn_mul_add_words(BN_ULONG *r_ptr, BN_ULONG *a_ptr, -; int num, BN_ULONG w) -; -; arg0 = r_ptr -; arg1 = a_ptr -; arg2 = num -; arg3 = w -; -; Local register definitions -; - -fm1 .reg %fr22 -fm .reg %fr23 -ht_temp .reg %fr24 -ht_temp_1 .reg %fr25 -lt_temp .reg %fr26 -lt_temp_1 .reg %fr27 -fm1_1 .reg %fr28 -fm_1 .reg %fr29 - -fw_h .reg %fr7L -fw_l .reg %fr7R -fw .reg %fr7 - -fht_0 .reg %fr8L -flt_0 .reg %fr8R -t_float_0 .reg %fr8 - -fht_1 .reg %fr9L -flt_1 .reg %fr9R -t_float_1 .reg %fr9 - -tmp_0 .reg %r31 -tmp_1 .reg %r21 -m_0 .reg %r20 -m_1 .reg %r19 -ht_0 .reg %r1 -ht_1 .reg %r3 -lt_0 .reg %r4 -lt_1 .reg %r5 -m1_0 .reg %r6 -m1_1 .reg %r7 -rp_val .reg %r8 -rp_val_1 .reg %r9 - -bn_mul_add_words - .export bn_mul_add_words,entry,NO_RELOCATION,LONG_RETURN - .proc - .callinfo frame=128 - .entry - .align 64 - - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - NOP ; Needed to make the loop 16-byte aligned - NOP ; Needed to make the loop 16-byte aligned - - STD %r5,16(%sp) ; save r5 - STD %r6,24(%sp) ; save r6 - STD %r7,32(%sp) ; save r7 - STD %r8,40(%sp) ; save r8 - - STD %r9,48(%sp) ; save r9 - COPY %r0,%ret0 ; return 0 by default - DEPDI,Z 1,31,1,top_overflow ; top_overflow = 1 << 32 - STD w,56(%sp) ; store w on stack - - CMPIB,>= 0,num,bn_mul_add_words_exit ; if (num <= 0) then exit - LDO 128(%sp),%sp ; bump stack - - ; - ; The loop is unrolled twice, so if there is only 1 number - ; then go straight to the cleanup code. - ; - CMPIB,= 1,num,bn_mul_add_words_single_top - FLDD -72(%sp),fw ; load up w into fp register fw (fw_h/fw_l) - - ; - ; This loop is unrolled 2 times (64-byte aligned as well) - ; - ; PA-RISC 2.0 chips have two fully pipelined multipliers, thus - ; two 32-bit mutiplies can be issued per cycle. - ; -bn_mul_add_words_unroll2 - - FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) - FLDD 8(a_ptr),t_float_1 ; load up 64-bit value (fr8L) ht(L)/lt(R) - LDD 0(r_ptr),rp_val ; rp[0] - LDD 8(r_ptr),rp_val_1 ; rp[1] - - XMPYU fht_0,fw_l,fm1 ; m1[0] = fht_0*fw_l - XMPYU fht_1,fw_l,fm1_1 ; m1[1] = fht_1*fw_l - FSTD fm1,-16(%sp) ; -16(sp) = m1[0] - FSTD fm1_1,-48(%sp) ; -48(sp) = m1[1] - - XMPYU flt_0,fw_h,fm ; m[0] = flt_0*fw_h - XMPYU flt_1,fw_h,fm_1 ; m[1] = flt_1*fw_h - FSTD fm,-8(%sp) ; -8(sp) = m[0] - FSTD fm_1,-40(%sp) ; -40(sp) = m[1] - - XMPYU fht_0,fw_h,ht_temp ; ht_temp = fht_0*fw_h - XMPYU fht_1,fw_h,ht_temp_1 ; ht_temp_1 = fht_1*fw_h - FSTD ht_temp,-24(%sp) ; -24(sp) = ht_temp - FSTD ht_temp_1,-56(%sp) ; -56(sp) = ht_temp_1 - - XMPYU flt_0,fw_l,lt_temp ; lt_temp = lt*fw_l - XMPYU flt_1,fw_l,lt_temp_1 ; lt_temp = lt*fw_l - FSTD lt_temp,-32(%sp) ; -32(sp) = lt_temp - FSTD lt_temp_1,-64(%sp) ; -64(sp) = lt_temp_1 - - LDD -8(%sp),m_0 ; m[0] - LDD -40(%sp),m_1 ; m[1] - LDD -16(%sp),m1_0 ; m1[0] - LDD -48(%sp),m1_1 ; m1[1] - - LDD -24(%sp),ht_0 ; ht[0] - LDD -56(%sp),ht_1 ; ht[1] - ADD,L m1_0,m_0,tmp_0 ; tmp_0 = m[0] + m1[0]; - ADD,L m1_1,m_1,tmp_1 ; tmp_1 = m[1] + m1[1]; - - LDD -32(%sp),lt_0 - LDD -64(%sp),lt_1 - CMPCLR,*>>= tmp_0,m1_0, %r0 ; if (m[0] < m1[0]) - ADD,L ht_0,top_overflow,ht_0 ; ht[0] += (1<<32) - - CMPCLR,*>>= tmp_1,m1_1,%r0 ; if (m[1] < m1[1]) - ADD,L ht_1,top_overflow,ht_1 ; ht[1] += (1<<32) - EXTRD,U tmp_0,31,32,m_0 ; m[0]>>32 - DEPD,Z tmp_0,31,32,m1_0 ; m1[0] = m[0]<<32 - - EXTRD,U tmp_1,31,32,m_1 ; m[1]>>32 - DEPD,Z tmp_1,31,32,m1_1 ; m1[1] = m[1]<<32 - ADD,L ht_0,m_0,ht_0 ; ht[0]+= (m[0]>>32) - ADD,L ht_1,m_1,ht_1 ; ht[1]+= (m[1]>>32) - - ADD lt_0,m1_0,lt_0 ; lt[0] = lt[0]+m1[0]; - ADD,DC ht_0,%r0,ht_0 ; ht[0]++ - ADD lt_1,m1_1,lt_1 ; lt[1] = lt[1]+m1[1]; - ADD,DC ht_1,%r0,ht_1 ; ht[1]++ - - ADD %ret0,lt_0,lt_0 ; lt[0] = lt[0] + c; - ADD,DC ht_0,%r0,ht_0 ; ht[0]++ - ADD lt_0,rp_val,lt_0 ; lt[0] = lt[0]+rp[0] - ADD,DC ht_0,%r0,ht_0 ; ht[0]++ - - LDO -2(num),num ; num = num - 2; - ADD ht_0,lt_1,lt_1 ; lt[1] = lt[1] + ht_0 (c); - ADD,DC ht_1,%r0,ht_1 ; ht[1]++ - STD lt_0,0(r_ptr) ; rp[0] = lt[0] - - ADD lt_1,rp_val_1,lt_1 ; lt[1] = lt[1]+rp[1] - ADD,DC ht_1,%r0,%ret0 ; ht[1]++ - LDO 16(a_ptr),a_ptr ; a_ptr += 2 - - STD lt_1,8(r_ptr) ; rp[1] = lt[1] - CMPIB,<= 2,num,bn_mul_add_words_unroll2 ; go again if more to do - LDO 16(r_ptr),r_ptr ; r_ptr += 2 - - CMPIB,=,N 0,num,bn_mul_add_words_exit ; are we done, or cleanup last one - - ; - ; Top of loop aligned on 64-byte boundary - ; -bn_mul_add_words_single_top - FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) - LDD 0(r_ptr),rp_val ; rp[0] - LDO 8(a_ptr),a_ptr ; a_ptr++ - XMPYU fht_0,fw_l,fm1 ; m1 = ht*fw_l - FSTD fm1,-16(%sp) ; -16(sp) = m1 - XMPYU flt_0,fw_h,fm ; m = lt*fw_h - FSTD fm,-8(%sp) ; -8(sp) = m - XMPYU fht_0,fw_h,ht_temp ; ht_temp = ht*fw_h - FSTD ht_temp,-24(%sp) ; -24(sp) = ht - XMPYU flt_0,fw_l,lt_temp ; lt_temp = lt*fw_l - FSTD lt_temp,-32(%sp) ; -32(sp) = lt - - LDD -8(%sp),m_0 - LDD -16(%sp),m1_0 ; m1 = temp1 - ADD,L m_0,m1_0,tmp_0 ; tmp_0 = m + m1; - LDD -24(%sp),ht_0 - LDD -32(%sp),lt_0 - - CMPCLR,*>>= tmp_0,m1_0,%r0 ; if (m < m1) - ADD,L ht_0,top_overflow,ht_0 ; ht += (1<<32) - - EXTRD,U tmp_0,31,32,m_0 ; m>>32 - DEPD,Z tmp_0,31,32,m1_0 ; m1 = m<<32 - - ADD,L ht_0,m_0,ht_0 ; ht+= (m>>32) - ADD lt_0,m1_0,tmp_0 ; tmp_0 = lt+m1; - ADD,DC ht_0,%r0,ht_0 ; ht++ - ADD %ret0,tmp_0,lt_0 ; lt = lt + c; - ADD,DC ht_0,%r0,ht_0 ; ht++ - ADD lt_0,rp_val,lt_0 ; lt = lt+rp[0] - ADD,DC ht_0,%r0,%ret0 ; ht++ - STD lt_0,0(r_ptr) ; rp[0] = lt - -bn_mul_add_words_exit - .EXIT - LDD -80(%sp),%r9 ; restore r9 - LDD -88(%sp),%r8 ; restore r8 - LDD -96(%sp),%r7 ; restore r7 - LDD -104(%sp),%r6 ; restore r6 - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 ; restore r3 - .PROCEND ;in=23,24,25,26,29;out=28; - -;---------------------------------------------------------------------------- -; -;BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w) -; -; arg0 = rp -; arg1 = ap -; arg2 = num -; arg3 = w - -bn_mul_words - .proc - .callinfo frame=128 - .entry - .EXPORT bn_mul_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .align 64 - - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - STD %r5,16(%sp) ; save r5 - STD %r6,24(%sp) ; save r6 - - STD %r7,32(%sp) ; save r7 - COPY %r0,%ret0 ; return 0 by default - DEPDI,Z 1,31,1,top_overflow ; top_overflow = 1 << 32 - STD w,56(%sp) ; w on stack - - CMPIB,>= 0,num,bn_mul_words_exit - LDO 128(%sp),%sp ; bump stack - - ; - ; See if only 1 word to do, thus just do cleanup - ; - CMPIB,= 1,num,bn_mul_words_single_top - FLDD -72(%sp),fw ; load up w into fp register fw (fw_h/fw_l) - - ; - ; This loop is unrolled 2 times (64-byte aligned as well) - ; - ; PA-RISC 2.0 chips have two fully pipelined multipliers, thus - ; two 32-bit mutiplies can be issued per cycle. - ; -bn_mul_words_unroll2 - - FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) - FLDD 8(a_ptr),t_float_1 ; load up 64-bit value (fr8L) ht(L)/lt(R) - XMPYU fht_0,fw_l,fm1 ; m1[0] = fht_0*fw_l - XMPYU fht_1,fw_l,fm1_1 ; m1[1] = ht*fw_l - - FSTD fm1,-16(%sp) ; -16(sp) = m1 - FSTD fm1_1,-48(%sp) ; -48(sp) = m1 - XMPYU flt_0,fw_h,fm ; m = lt*fw_h - XMPYU flt_1,fw_h,fm_1 ; m = lt*fw_h - - FSTD fm,-8(%sp) ; -8(sp) = m - FSTD fm_1,-40(%sp) ; -40(sp) = m - XMPYU fht_0,fw_h,ht_temp ; ht_temp = fht_0*fw_h - XMPYU fht_1,fw_h,ht_temp_1 ; ht_temp = ht*fw_h - - FSTD ht_temp,-24(%sp) ; -24(sp) = ht - FSTD ht_temp_1,-56(%sp) ; -56(sp) = ht - XMPYU flt_0,fw_l,lt_temp ; lt_temp = lt*fw_l - XMPYU flt_1,fw_l,lt_temp_1 ; lt_temp = lt*fw_l - - FSTD lt_temp,-32(%sp) ; -32(sp) = lt - FSTD lt_temp_1,-64(%sp) ; -64(sp) = lt - LDD -8(%sp),m_0 - LDD -40(%sp),m_1 - - LDD -16(%sp),m1_0 - LDD -48(%sp),m1_1 - LDD -24(%sp),ht_0 - LDD -56(%sp),ht_1 - - ADD,L m1_0,m_0,tmp_0 ; tmp_0 = m + m1; - ADD,L m1_1,m_1,tmp_1 ; tmp_1 = m + m1; - LDD -32(%sp),lt_0 - LDD -64(%sp),lt_1 - - CMPCLR,*>>= tmp_0,m1_0, %r0 ; if (m < m1) - ADD,L ht_0,top_overflow,ht_0 ; ht += (1<<32) - CMPCLR,*>>= tmp_1,m1_1,%r0 ; if (m < m1) - ADD,L ht_1,top_overflow,ht_1 ; ht += (1<<32) - - EXTRD,U tmp_0,31,32,m_0 ; m>>32 - DEPD,Z tmp_0,31,32,m1_0 ; m1 = m<<32 - EXTRD,U tmp_1,31,32,m_1 ; m>>32 - DEPD,Z tmp_1,31,32,m1_1 ; m1 = m<<32 - - ADD,L ht_0,m_0,ht_0 ; ht+= (m>>32) - ADD,L ht_1,m_1,ht_1 ; ht+= (m>>32) - ADD lt_0,m1_0,lt_0 ; lt = lt+m1; - ADD,DC ht_0,%r0,ht_0 ; ht++ - - ADD lt_1,m1_1,lt_1 ; lt = lt+m1; - ADD,DC ht_1,%r0,ht_1 ; ht++ - ADD %ret0,lt_0,lt_0 ; lt = lt + c (ret0); - ADD,DC ht_0,%r0,ht_0 ; ht++ - - ADD ht_0,lt_1,lt_1 ; lt = lt + c (ht_0) - ADD,DC ht_1,%r0,ht_1 ; ht++ - STD lt_0,0(r_ptr) ; rp[0] = lt - STD lt_1,8(r_ptr) ; rp[1] = lt - - COPY ht_1,%ret0 ; carry = ht - LDO -2(num),num ; num = num - 2; - LDO 16(a_ptr),a_ptr ; ap += 2 - CMPIB,<= 2,num,bn_mul_words_unroll2 - LDO 16(r_ptr),r_ptr ; rp++ - - CMPIB,=,N 0,num,bn_mul_words_exit ; are we done? - - ; - ; Top of loop aligned on 64-byte boundary - ; -bn_mul_words_single_top - FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) - - XMPYU fht_0,fw_l,fm1 ; m1 = ht*fw_l - FSTD fm1,-16(%sp) ; -16(sp) = m1 - XMPYU flt_0,fw_h,fm ; m = lt*fw_h - FSTD fm,-8(%sp) ; -8(sp) = m - XMPYU fht_0,fw_h,ht_temp ; ht_temp = ht*fw_h - FSTD ht_temp,-24(%sp) ; -24(sp) = ht - XMPYU flt_0,fw_l,lt_temp ; lt_temp = lt*fw_l - FSTD lt_temp,-32(%sp) ; -32(sp) = lt - - LDD -8(%sp),m_0 - LDD -16(%sp),m1_0 - ADD,L m_0,m1_0,tmp_0 ; tmp_0 = m + m1; - LDD -24(%sp),ht_0 - LDD -32(%sp),lt_0 - - CMPCLR,*>>= tmp_0,m1_0,%r0 ; if (m < m1) - ADD,L ht_0,top_overflow,ht_0 ; ht += (1<<32) - - EXTRD,U tmp_0,31,32,m_0 ; m>>32 - DEPD,Z tmp_0,31,32,m1_0 ; m1 = m<<32 - - ADD,L ht_0,m_0,ht_0 ; ht+= (m>>32) - ADD lt_0,m1_0,lt_0 ; lt= lt+m1; - ADD,DC ht_0,%r0,ht_0 ; ht++ - - ADD %ret0,lt_0,lt_0 ; lt = lt + c; - ADD,DC ht_0,%r0,ht_0 ; ht++ - - COPY ht_0,%ret0 ; copy carry - STD lt_0,0(r_ptr) ; rp[0] = lt - -bn_mul_words_exit - .EXIT - LDD -96(%sp),%r7 ; restore r7 - LDD -104(%sp),%r6 ; restore r6 - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 ; restore r3 - .PROCEND ;in=23,24,25,26,29;out=28; - -;---------------------------------------------------------------------------- -; -;void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num) -; -; arg0 = rp -; arg1 = ap -; arg2 = num -; - -bn_sqr_words - .proc - .callinfo FRAME=128,ENTRY_GR=%r3,ARGS_SAVED,ORDERING_AWARE - .EXPORT bn_sqr_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .entry - .align 64 - - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - NOP - STD %r5,16(%sp) ; save r5 - - CMPIB,>= 0,num,bn_sqr_words_exit - LDO 128(%sp),%sp ; bump stack - - ; - ; If only 1, the goto straight to cleanup - ; - CMPIB,= 1,num,bn_sqr_words_single_top - DEPDI,Z -1,32,33,high_mask ; Create Mask 0xffffffff80000000L - - ; - ; This loop is unrolled 2 times (64-byte aligned as well) - ; - -bn_sqr_words_unroll2 - FLDD 0(a_ptr),t_float_0 ; a[0] - FLDD 8(a_ptr),t_float_1 ; a[1] - XMPYU fht_0,flt_0,fm ; m[0] - XMPYU fht_1,flt_1,fm_1 ; m[1] - - FSTD fm,-24(%sp) ; store m[0] - FSTD fm_1,-56(%sp) ; store m[1] - XMPYU flt_0,flt_0,lt_temp ; lt[0] - XMPYU flt_1,flt_1,lt_temp_1 ; lt[1] - - FSTD lt_temp,-16(%sp) ; store lt[0] - FSTD lt_temp_1,-48(%sp) ; store lt[1] - XMPYU fht_0,fht_0,ht_temp ; ht[0] - XMPYU fht_1,fht_1,ht_temp_1 ; ht[1] - - FSTD ht_temp,-8(%sp) ; store ht[0] - FSTD ht_temp_1,-40(%sp) ; store ht[1] - LDD -24(%sp),m_0 - LDD -56(%sp),m_1 - - AND m_0,high_mask,tmp_0 ; m[0] & Mask - AND m_1,high_mask,tmp_1 ; m[1] & Mask - DEPD,Z m_0,30,31,m_0 ; m[0] << 32+1 - DEPD,Z m_1,30,31,m_1 ; m[1] << 32+1 - - LDD -16(%sp),lt_0 - LDD -48(%sp),lt_1 - EXTRD,U tmp_0,32,33,tmp_0 ; tmp_0 = m[0]&Mask >> 32-1 - EXTRD,U tmp_1,32,33,tmp_1 ; tmp_1 = m[1]&Mask >> 32-1 - - LDD -8(%sp),ht_0 - LDD -40(%sp),ht_1 - ADD,L ht_0,tmp_0,ht_0 ; ht[0] += tmp_0 - ADD,L ht_1,tmp_1,ht_1 ; ht[1] += tmp_1 - - ADD lt_0,m_0,lt_0 ; lt = lt+m - ADD,DC ht_0,%r0,ht_0 ; ht[0]++ - STD lt_0,0(r_ptr) ; rp[0] = lt[0] - STD ht_0,8(r_ptr) ; rp[1] = ht[1] - - ADD lt_1,m_1,lt_1 ; lt = lt+m - ADD,DC ht_1,%r0,ht_1 ; ht[1]++ - STD lt_1,16(r_ptr) ; rp[2] = lt[1] - STD ht_1,24(r_ptr) ; rp[3] = ht[1] - - LDO -2(num),num ; num = num - 2; - LDO 16(a_ptr),a_ptr ; ap += 2 - CMPIB,<= 2,num,bn_sqr_words_unroll2 - LDO 32(r_ptr),r_ptr ; rp += 4 - - CMPIB,=,N 0,num,bn_sqr_words_exit ; are we done? - - ; - ; Top of loop aligned on 64-byte boundary - ; -bn_sqr_words_single_top - FLDD 0(a_ptr),t_float_0 ; load up 64-bit value (fr8L) ht(L)/lt(R) - - XMPYU fht_0,flt_0,fm ; m - FSTD fm,-24(%sp) ; store m - - XMPYU flt_0,flt_0,lt_temp ; lt - FSTD lt_temp,-16(%sp) ; store lt - - XMPYU fht_0,fht_0,ht_temp ; ht - FSTD ht_temp,-8(%sp) ; store ht - - LDD -24(%sp),m_0 ; load m - AND m_0,high_mask,tmp_0 ; m & Mask - DEPD,Z m_0,30,31,m_0 ; m << 32+1 - LDD -16(%sp),lt_0 ; lt - - LDD -8(%sp),ht_0 ; ht - EXTRD,U tmp_0,32,33,tmp_0 ; tmp_0 = m&Mask >> 32-1 - ADD m_0,lt_0,lt_0 ; lt = lt+m - ADD,L ht_0,tmp_0,ht_0 ; ht += tmp_0 - ADD,DC ht_0,%r0,ht_0 ; ht++ - - STD lt_0,0(r_ptr) ; rp[0] = lt - STD ht_0,8(r_ptr) ; rp[1] = ht - -bn_sqr_words_exit - .EXIT - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 - .PROCEND ;in=23,24,25,26,29;out=28; - - -;---------------------------------------------------------------------------- -; -;BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n) -; -; arg0 = rp -; arg1 = ap -; arg2 = bp -; arg3 = n - -t .reg %r22 -b .reg %r21 -l .reg %r20 - -bn_add_words - .proc - .entry - .callinfo - .EXPORT bn_add_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .align 64 - - CMPIB,>= 0,n,bn_add_words_exit - COPY %r0,%ret0 ; return 0 by default - - ; - ; If 2 or more numbers do the loop - ; - CMPIB,= 1,n,bn_add_words_single_top - NOP - - ; - ; This loop is unrolled 2 times (64-byte aligned as well) - ; -bn_add_words_unroll2 - LDD 0(a_ptr),t - LDD 0(b_ptr),b - ADD t,%ret0,t ; t = t+c; - ADD,DC %r0,%r0,%ret0 ; set c to carry - ADD t,b,l ; l = t + b[0] - ADD,DC %ret0,%r0,%ret0 ; c+= carry - STD l,0(r_ptr) - - LDD 8(a_ptr),t - LDD 8(b_ptr),b - ADD t,%ret0,t ; t = t+c; - ADD,DC %r0,%r0,%ret0 ; set c to carry - ADD t,b,l ; l = t + b[0] - ADD,DC %ret0,%r0,%ret0 ; c+= carry - STD l,8(r_ptr) - - LDO -2(n),n - LDO 16(a_ptr),a_ptr - LDO 16(b_ptr),b_ptr - - CMPIB,<= 2,n,bn_add_words_unroll2 - LDO 16(r_ptr),r_ptr - - CMPIB,=,N 0,n,bn_add_words_exit ; are we done? - -bn_add_words_single_top - LDD 0(a_ptr),t - LDD 0(b_ptr),b - - ADD t,%ret0,t ; t = t+c; - ADD,DC %r0,%r0,%ret0 ; set c to carry (could use CMPCLR??) - ADD t,b,l ; l = t + b[0] - ADD,DC %ret0,%r0,%ret0 ; c+= carry - STD l,0(r_ptr) - -bn_add_words_exit - .EXIT - BVE (%rp) - NOP - .PROCEND ;in=23,24,25,26,29;out=28; - -;---------------------------------------------------------------------------- -; -;BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n) -; -; arg0 = rp -; arg1 = ap -; arg2 = bp -; arg3 = n - -t1 .reg %r22 -t2 .reg %r21 -sub_tmp1 .reg %r20 -sub_tmp2 .reg %r19 - - -bn_sub_words - .proc - .callinfo - .EXPORT bn_sub_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .entry - .align 64 - - CMPIB,>= 0,n,bn_sub_words_exit - COPY %r0,%ret0 ; return 0 by default - - ; - ; If 2 or more numbers do the loop - ; - CMPIB,= 1,n,bn_sub_words_single_top - NOP - - ; - ; This loop is unrolled 2 times (64-byte aligned as well) - ; -bn_sub_words_unroll2 - LDD 0(a_ptr),t1 - LDD 0(b_ptr),t2 - SUB t1,t2,sub_tmp1 ; t3 = t1-t2; - SUB sub_tmp1,%ret0,sub_tmp1 ; t3 = t3- c; - - CMPCLR,*>> t1,t2,sub_tmp2 ; clear if t1 > t2 - LDO 1(%r0),sub_tmp2 - - CMPCLR,*= t1,t2,%r0 - COPY sub_tmp2,%ret0 - STD sub_tmp1,0(r_ptr) - - LDD 8(a_ptr),t1 - LDD 8(b_ptr),t2 - SUB t1,t2,sub_tmp1 ; t3 = t1-t2; - SUB sub_tmp1,%ret0,sub_tmp1 ; t3 = t3- c; - CMPCLR,*>> t1,t2,sub_tmp2 ; clear if t1 > t2 - LDO 1(%r0),sub_tmp2 - - CMPCLR,*= t1,t2,%r0 - COPY sub_tmp2,%ret0 - STD sub_tmp1,8(r_ptr) - - LDO -2(n),n - LDO 16(a_ptr),a_ptr - LDO 16(b_ptr),b_ptr - - CMPIB,<= 2,n,bn_sub_words_unroll2 - LDO 16(r_ptr),r_ptr - - CMPIB,=,N 0,n,bn_sub_words_exit ; are we done? - -bn_sub_words_single_top - LDD 0(a_ptr),t1 - LDD 0(b_ptr),t2 - SUB t1,t2,sub_tmp1 ; t3 = t1-t2; - SUB sub_tmp1,%ret0,sub_tmp1 ; t3 = t3- c; - CMPCLR,*>> t1,t2,sub_tmp2 ; clear if t1 > t2 - LDO 1(%r0),sub_tmp2 - - CMPCLR,*= t1,t2,%r0 - COPY sub_tmp2,%ret0 - - STD sub_tmp1,0(r_ptr) - -bn_sub_words_exit - .EXIT - BVE (%rp) - NOP - .PROCEND ;in=23,24,25,26,29;out=28; - -;------------------------------------------------------------------------------ -; -; unsigned long bn_div_words(unsigned long h, unsigned long l, unsigned long d) -; -; arg0 = h -; arg1 = l -; arg2 = d -; -; This is mainly just modified assembly from the compiler, thus the -; lack of variable names. -; -;------------------------------------------------------------------------------ -bn_div_words - .proc - .callinfo CALLER,FRAME=272,ENTRY_GR=%r10,SAVE_RP,ARGS_SAVED,ORDERING_AWARE - .EXPORT bn_div_words,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .IMPORT BN_num_bits_word,CODE,NO_RELOCATION - .IMPORT __iob,DATA - .IMPORT fprintf,CODE,NO_RELOCATION - .IMPORT abort,CODE,NO_RELOCATION - .IMPORT $$div2U,MILLICODE - .entry - STD %r2,-16(%r30) - STD,MA %r3,352(%r30) - STD %r4,-344(%r30) - STD %r5,-336(%r30) - STD %r6,-328(%r30) - STD %r7,-320(%r30) - STD %r8,-312(%r30) - STD %r9,-304(%r30) - STD %r10,-296(%r30) - - STD %r27,-288(%r30) ; save gp - - COPY %r24,%r3 ; save d - COPY %r26,%r4 ; save h (high 64-bits) - LDO -1(%r0),%ret0 ; return -1 by default - - CMPB,*= %r0,%arg2,$D3 ; if (d == 0) - COPY %r25,%r5 ; save l (low 64-bits) - - LDO -48(%r30),%r29 ; create ap - .CALL ;in=26,29;out=28; - B,L BN_num_bits_word,%r2 - COPY %r3,%r26 - LDD -288(%r30),%r27 ; restore gp - LDI 64,%r21 - - CMPB,= %r21,%ret0,$00000012 ;if (i == 64) (forward) - COPY %ret0,%r24 ; i - MTSARCM %r24 - DEPDI,Z -1,%sar,1,%r29 - CMPB,*<<,N %r29,%r4,bn_div_err_case ; if (h > 1<<i) (forward) - -$00000012 - SUBI 64,%r24,%r31 ; i = 64 - i; - CMPCLR,*<< %r4,%r3,%r0 ; if (h >= d) - SUB %r4,%r3,%r4 ; h -= d - CMPB,= %r31,%r0,$0000001A ; if (i) - COPY %r0,%r10 ; ret = 0 - MTSARCM %r31 ; i to shift - DEPD,Z %r3,%sar,64,%r3 ; d <<= i; - SUBI 64,%r31,%r19 ; 64 - i; redundent - MTSAR %r19 ; (64 -i) to shift - SHRPD %r4,%r5,%sar,%r4 ; l>> (64-i) - MTSARCM %r31 ; i to shift - DEPD,Z %r5,%sar,64,%r5 ; l <<= i; - -$0000001A - DEPDI,Z -1,31,32,%r19 - EXTRD,U %r3,31,32,%r6 ; dh=(d&0xfff)>>32 - EXTRD,U %r3,63,32,%r8 ; dl = d&0xffffff - LDO 2(%r0),%r9 - STD %r3,-280(%r30) ; "d" to stack - -$0000001C - DEPDI,Z -1,63,32,%r29 ; - EXTRD,U %r4,31,32,%r31 ; h >> 32 - CMPB,*=,N %r31,%r6,$D2 ; if ((h>>32) != dh)(forward) div - COPY %r4,%r26 - EXTRD,U %r4,31,32,%r25 - COPY %r6,%r24 - .CALL ;in=23,24,25,26;out=20,21,22,28,29; (MILLICALL) - B,L $$div2U,%r2 - EXTRD,U %r6,31,32,%r23 - DEPD %r28,31,32,%r29 -$D2 - STD %r29,-272(%r30) ; q - AND %r5,%r19,%r24 ; t & 0xffffffff00000000; - EXTRD,U %r24,31,32,%r24 ; ??? - FLDD -272(%r30),%fr7 ; q - FLDD -280(%r30),%fr8 ; d - XMPYU %fr8L,%fr7L,%fr10 - FSTD %fr10,-256(%r30) - XMPYU %fr8L,%fr7R,%fr22 - FSTD %fr22,-264(%r30) - XMPYU %fr8R,%fr7L,%fr11 - XMPYU %fr8R,%fr7R,%fr23 - FSTD %fr11,-232(%r30) - FSTD %fr23,-240(%r30) - LDD -256(%r30),%r28 - DEPD,Z %r28,31,32,%r2 - LDD -264(%r30),%r20 - ADD,L %r20,%r2,%r31 - LDD -232(%r30),%r22 - DEPD,Z %r22,31,32,%r22 - LDD -240(%r30),%r21 - B $00000024 ; enter loop - ADD,L %r21,%r22,%r23 - -$0000002A - LDO -1(%r29),%r29 - SUB %r23,%r8,%r23 -$00000024 - SUB %r4,%r31,%r25 - AND %r25,%r19,%r26 - CMPB,*<>,N %r0,%r26,$00000046 ; (forward) - DEPD,Z %r25,31,32,%r20 - OR %r20,%r24,%r21 - CMPB,*<<,N %r21,%r23,$0000002A ;(backward) - SUB %r31,%r6,%r31 -;-------------Break path--------------------- - -$00000046 - DEPD,Z %r23,31,32,%r25 ;tl - EXTRD,U %r23,31,32,%r26 ;t - AND %r25,%r19,%r24 ;tl = (tl<<32)&0xfffffff0000000L - ADD,L %r31,%r26,%r31 ;th += t; - CMPCLR,*>>= %r5,%r24,%r0 ;if (l<tl) - LDO 1(%r31),%r31 ; th++; - CMPB,*<<=,N %r31,%r4,$00000036 ;if (n < th) (forward) - LDO -1(%r29),%r29 ;q--; - ADD,L %r4,%r3,%r4 ;h += d; -$00000036 - ADDIB,=,N -1,%r9,$D1 ;if (--count == 0) break (forward) - SUB %r5,%r24,%r28 ; l -= tl; - SUB %r4,%r31,%r24 ; h -= th; - SHRPD %r24,%r28,32,%r4 ; h = ((h<<32)|(l>>32)); - DEPD,Z %r29,31,32,%r10 ; ret = q<<32 - b $0000001C - DEPD,Z %r28,31,32,%r5 ; l = l << 32 - -$D1 - OR %r10,%r29,%r28 ; ret |= q -$D3 - LDD -368(%r30),%r2 -$D0 - LDD -296(%r30),%r10 - LDD -304(%r30),%r9 - LDD -312(%r30),%r8 - LDD -320(%r30),%r7 - LDD -328(%r30),%r6 - LDD -336(%r30),%r5 - LDD -344(%r30),%r4 - BVE (%r2) - .EXIT - LDD,MB -352(%r30),%r3 - -bn_div_err_case - MFIA %r6 - ADDIL L'bn_div_words-bn_div_err_case,%r6,%r1 - LDO R'bn_div_words-bn_div_err_case(%r1),%r6 - ADDIL LT'__iob,%r27,%r1 - LDD RT'__iob(%r1),%r26 - ADDIL L'C$4-bn_div_words,%r6,%r1 - LDO R'C$4-bn_div_words(%r1),%r25 - LDO 64(%r26),%r26 - .CALL ;in=24,25,26,29;out=28; - B,L fprintf,%r2 - LDO -48(%r30),%r29 - LDD -288(%r30),%r27 - .CALL ;in=29; - B,L abort,%r2 - LDO -48(%r30),%r29 - LDD -288(%r30),%r27 - B $D0 - LDD -368(%r30),%r2 - .PROCEND ;in=24,25,26,29;out=28; - -;---------------------------------------------------------------------------- -; -; Registers to hold 64-bit values to manipulate. The "L" part -; of the register corresponds to the upper 32-bits, while the "R" -; part corresponds to the lower 32-bits -; -; Note, that when using b6 and b7, the code must save these before -; using them because they are callee save registers -; -; -; Floating point registers to use to save values that -; are manipulated. These don't collide with ftemp1-6 and -; are all caller save registers -; -a0 .reg %fr22 -a0L .reg %fr22L -a0R .reg %fr22R - -a1 .reg %fr23 -a1L .reg %fr23L -a1R .reg %fr23R - -a2 .reg %fr24 -a2L .reg %fr24L -a2R .reg %fr24R - -a3 .reg %fr25 -a3L .reg %fr25L -a3R .reg %fr25R - -a4 .reg %fr26 -a4L .reg %fr26L -a4R .reg %fr26R - -a5 .reg %fr27 -a5L .reg %fr27L -a5R .reg %fr27R - -a6 .reg %fr28 -a6L .reg %fr28L -a6R .reg %fr28R - -a7 .reg %fr29 -a7L .reg %fr29L -a7R .reg %fr29R - -b0 .reg %fr30 -b0L .reg %fr30L -b0R .reg %fr30R - -b1 .reg %fr31 -b1L .reg %fr31L -b1R .reg %fr31R - -; -; Temporary floating point variables, these are all caller save -; registers -; -ftemp1 .reg %fr4 -ftemp2 .reg %fr5 -ftemp3 .reg %fr6 -ftemp4 .reg %fr7 - -; -; The B set of registers when used. -; - -b2 .reg %fr8 -b2L .reg %fr8L -b2R .reg %fr8R - -b3 .reg %fr9 -b3L .reg %fr9L -b3R .reg %fr9R - -b4 .reg %fr10 -b4L .reg %fr10L -b4R .reg %fr10R - -b5 .reg %fr11 -b5L .reg %fr11L -b5R .reg %fr11R - -b6 .reg %fr12 -b6L .reg %fr12L -b6R .reg %fr12R - -b7 .reg %fr13 -b7L .reg %fr13L -b7R .reg %fr13R - -c1 .reg %r21 ; only reg -temp1 .reg %r20 ; only reg -temp2 .reg %r19 ; only reg -temp3 .reg %r31 ; only reg - -m1 .reg %r28 -c2 .reg %r23 -high_one .reg %r1 -ht .reg %r6 -lt .reg %r5 -m .reg %r4 -c3 .reg %r3 - -SQR_ADD_C .macro A0L,A0R,C1,C2,C3 - XMPYU A0L,A0R,ftemp1 ; m - FSTD ftemp1,-24(%sp) ; store m - - XMPYU A0R,A0R,ftemp2 ; lt - FSTD ftemp2,-16(%sp) ; store lt - - XMPYU A0L,A0L,ftemp3 ; ht - FSTD ftemp3,-8(%sp) ; store ht - - LDD -24(%sp),m ; load m - AND m,high_mask,temp2 ; m & Mask - DEPD,Z m,30,31,temp3 ; m << 32+1 - LDD -16(%sp),lt ; lt - - LDD -8(%sp),ht ; ht - EXTRD,U temp2,32,33,temp1 ; temp1 = m&Mask >> 32-1 - ADD temp3,lt,lt ; lt = lt+m - ADD,L ht,temp1,ht ; ht += temp1 - ADD,DC ht,%r0,ht ; ht++ - - ADD C1,lt,C1 ; c1=c1+lt - ADD,DC ht,%r0,ht ; ht++ - - ADD C2,ht,C2 ; c2=c2+ht - ADD,DC C3,%r0,C3 ; c3++ -.endm - -SQR_ADD_C2 .macro A0L,A0R,A1L,A1R,C1,C2,C3 - XMPYU A0L,A1R,ftemp1 ; m1 = bl*ht - FSTD ftemp1,-16(%sp) ; - XMPYU A0R,A1L,ftemp2 ; m = bh*lt - FSTD ftemp2,-8(%sp) ; - XMPYU A0R,A1R,ftemp3 ; lt = bl*lt - FSTD ftemp3,-32(%sp) - XMPYU A0L,A1L,ftemp4 ; ht = bh*ht - FSTD ftemp4,-24(%sp) ; - - LDD -8(%sp),m ; r21 = m - LDD -16(%sp),m1 ; r19 = m1 - ADD,L m,m1,m ; m+m1 - - DEPD,Z m,31,32,temp3 ; (m+m1<<32) - LDD -24(%sp),ht ; r24 = ht - - CMPCLR,*>>= m,m1,%r0 ; if (m < m1) - ADD,L ht,high_one,ht ; ht+=high_one - - EXTRD,U m,31,32,temp1 ; m >> 32 - LDD -32(%sp),lt ; lt - ADD,L ht,temp1,ht ; ht+= m>>32 - ADD lt,temp3,lt ; lt = lt+m1 - ADD,DC ht,%r0,ht ; ht++ - - ADD ht,ht,ht ; ht=ht+ht; - ADD,DC C3,%r0,C3 ; add in carry (c3++) - - ADD lt,lt,lt ; lt=lt+lt; - ADD,DC ht,%r0,ht ; add in carry (ht++) - - ADD C1,lt,C1 ; c1=c1+lt - ADD,DC,*NUV ht,%r0,ht ; add in carry (ht++) - LDO 1(C3),C3 ; bump c3 if overflow,nullify otherwise - - ADD C2,ht,C2 ; c2 = c2 + ht - ADD,DC C3,%r0,C3 ; add in carry (c3++) -.endm - -; -;void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a) -; arg0 = r_ptr -; arg1 = a_ptr -; - -bn_sqr_comba8 - .PROC - .CALLINFO FRAME=128,ENTRY_GR=%r3,ARGS_SAVED,ORDERING_AWARE - .EXPORT bn_sqr_comba8,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .ENTRY - .align 64 - - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - STD %r5,16(%sp) ; save r5 - STD %r6,24(%sp) ; save r6 - - ; - ; Zero out carries - ; - COPY %r0,c1 - COPY %r0,c2 - COPY %r0,c3 - - LDO 128(%sp),%sp ; bump stack - DEPDI,Z -1,32,33,high_mask ; Create Mask 0xffffffff80000000L - DEPDI,Z 1,31,1,high_one ; Create Value 1 << 32 - - ; - ; Load up all of the values we are going to use - ; - FLDD 0(a_ptr),a0 - FLDD 8(a_ptr),a1 - FLDD 16(a_ptr),a2 - FLDD 24(a_ptr),a3 - FLDD 32(a_ptr),a4 - FLDD 40(a_ptr),a5 - FLDD 48(a_ptr),a6 - FLDD 56(a_ptr),a7 - - SQR_ADD_C a0L,a0R,c1,c2,c3 - STD c1,0(r_ptr) ; r[0] = c1; - COPY %r0,c1 - - SQR_ADD_C2 a1L,a1R,a0L,a0R,c2,c3,c1 - STD c2,8(r_ptr) ; r[1] = c2; - COPY %r0,c2 - - SQR_ADD_C a1L,a1R,c3,c1,c2 - SQR_ADD_C2 a2L,a2R,a0L,a0R,c3,c1,c2 - STD c3,16(r_ptr) ; r[2] = c3; - COPY %r0,c3 - - SQR_ADD_C2 a3L,a3R,a0L,a0R,c1,c2,c3 - SQR_ADD_C2 a2L,a2R,a1L,a1R,c1,c2,c3 - STD c1,24(r_ptr) ; r[3] = c1; - COPY %r0,c1 - - SQR_ADD_C a2L,a2R,c2,c3,c1 - SQR_ADD_C2 a3L,a3R,a1L,a1R,c2,c3,c1 - SQR_ADD_C2 a4L,a4R,a0L,a0R,c2,c3,c1 - STD c2,32(r_ptr) ; r[4] = c2; - COPY %r0,c2 - - SQR_ADD_C2 a5L,a5R,a0L,a0R,c3,c1,c2 - SQR_ADD_C2 a4L,a4R,a1L,a1R,c3,c1,c2 - SQR_ADD_C2 a3L,a3R,a2L,a2R,c3,c1,c2 - STD c3,40(r_ptr) ; r[5] = c3; - COPY %r0,c3 - - SQR_ADD_C a3L,a3R,c1,c2,c3 - SQR_ADD_C2 a4L,a4R,a2L,a2R,c1,c2,c3 - SQR_ADD_C2 a5L,a5R,a1L,a1R,c1,c2,c3 - SQR_ADD_C2 a6L,a6R,a0L,a0R,c1,c2,c3 - STD c1,48(r_ptr) ; r[6] = c1; - COPY %r0,c1 - - SQR_ADD_C2 a7L,a7R,a0L,a0R,c2,c3,c1 - SQR_ADD_C2 a6L,a6R,a1L,a1R,c2,c3,c1 - SQR_ADD_C2 a5L,a5R,a2L,a2R,c2,c3,c1 - SQR_ADD_C2 a4L,a4R,a3L,a3R,c2,c3,c1 - STD c2,56(r_ptr) ; r[7] = c2; - COPY %r0,c2 - - SQR_ADD_C a4L,a4R,c3,c1,c2 - SQR_ADD_C2 a5L,a5R,a3L,a3R,c3,c1,c2 - SQR_ADD_C2 a6L,a6R,a2L,a2R,c3,c1,c2 - SQR_ADD_C2 a7L,a7R,a1L,a1R,c3,c1,c2 - STD c3,64(r_ptr) ; r[8] = c3; - COPY %r0,c3 - - SQR_ADD_C2 a7L,a7R,a2L,a2R,c1,c2,c3 - SQR_ADD_C2 a6L,a6R,a3L,a3R,c1,c2,c3 - SQR_ADD_C2 a5L,a5R,a4L,a4R,c1,c2,c3 - STD c1,72(r_ptr) ; r[9] = c1; - COPY %r0,c1 - - SQR_ADD_C a5L,a5R,c2,c3,c1 - SQR_ADD_C2 a6L,a6R,a4L,a4R,c2,c3,c1 - SQR_ADD_C2 a7L,a7R,a3L,a3R,c2,c3,c1 - STD c2,80(r_ptr) ; r[10] = c2; - COPY %r0,c2 - - SQR_ADD_C2 a7L,a7R,a4L,a4R,c3,c1,c2 - SQR_ADD_C2 a6L,a6R,a5L,a5R,c3,c1,c2 - STD c3,88(r_ptr) ; r[11] = c3; - COPY %r0,c3 - - SQR_ADD_C a6L,a6R,c1,c2,c3 - SQR_ADD_C2 a7L,a7R,a5L,a5R,c1,c2,c3 - STD c1,96(r_ptr) ; r[12] = c1; - COPY %r0,c1 - - SQR_ADD_C2 a7L,a7R,a6L,a6R,c2,c3,c1 - STD c2,104(r_ptr) ; r[13] = c2; - COPY %r0,c2 - - SQR_ADD_C a7L,a7R,c3,c1,c2 - STD c3, 112(r_ptr) ; r[14] = c3 - STD c1, 120(r_ptr) ; r[15] = c1 - - .EXIT - LDD -104(%sp),%r6 ; restore r6 - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 - - .PROCEND - -;----------------------------------------------------------------------------- -; -;void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a) -; arg0 = r_ptr -; arg1 = a_ptr -; - -bn_sqr_comba4 - .proc - .callinfo FRAME=128,ENTRY_GR=%r3,ARGS_SAVED,ORDERING_AWARE - .EXPORT bn_sqr_comba4,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .entry - .align 64 - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - STD %r5,16(%sp) ; save r5 - STD %r6,24(%sp) ; save r6 - - ; - ; Zero out carries - ; - COPY %r0,c1 - COPY %r0,c2 - COPY %r0,c3 - - LDO 128(%sp),%sp ; bump stack - DEPDI,Z -1,32,33,high_mask ; Create Mask 0xffffffff80000000L - DEPDI,Z 1,31,1,high_one ; Create Value 1 << 32 - - ; - ; Load up all of the values we are going to use - ; - FLDD 0(a_ptr),a0 - FLDD 8(a_ptr),a1 - FLDD 16(a_ptr),a2 - FLDD 24(a_ptr),a3 - FLDD 32(a_ptr),a4 - FLDD 40(a_ptr),a5 - FLDD 48(a_ptr),a6 - FLDD 56(a_ptr),a7 - - SQR_ADD_C a0L,a0R,c1,c2,c3 - - STD c1,0(r_ptr) ; r[0] = c1; - COPY %r0,c1 - - SQR_ADD_C2 a1L,a1R,a0L,a0R,c2,c3,c1 - - STD c2,8(r_ptr) ; r[1] = c2; - COPY %r0,c2 - - SQR_ADD_C a1L,a1R,c3,c1,c2 - SQR_ADD_C2 a2L,a2R,a0L,a0R,c3,c1,c2 - - STD c3,16(r_ptr) ; r[2] = c3; - COPY %r0,c3 - - SQR_ADD_C2 a3L,a3R,a0L,a0R,c1,c2,c3 - SQR_ADD_C2 a2L,a2R,a1L,a1R,c1,c2,c3 - - STD c1,24(r_ptr) ; r[3] = c1; - COPY %r0,c1 - - SQR_ADD_C a2L,a2R,c2,c3,c1 - SQR_ADD_C2 a3L,a3R,a1L,a1R,c2,c3,c1 - - STD c2,32(r_ptr) ; r[4] = c2; - COPY %r0,c2 - - SQR_ADD_C2 a3L,a3R,a2L,a2R,c3,c1,c2 - STD c3,40(r_ptr) ; r[5] = c3; - COPY %r0,c3 - - SQR_ADD_C a3L,a3R,c1,c2,c3 - STD c1,48(r_ptr) ; r[6] = c1; - STD c2,56(r_ptr) ; r[7] = c2; - - .EXIT - LDD -104(%sp),%r6 ; restore r6 - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 - - .PROCEND - - -;--------------------------------------------------------------------------- - -MUL_ADD_C .macro A0L,A0R,B0L,B0R,C1,C2,C3 - XMPYU A0L,B0R,ftemp1 ; m1 = bl*ht - FSTD ftemp1,-16(%sp) ; - XMPYU A0R,B0L,ftemp2 ; m = bh*lt - FSTD ftemp2,-8(%sp) ; - XMPYU A0R,B0R,ftemp3 ; lt = bl*lt - FSTD ftemp3,-32(%sp) - XMPYU A0L,B0L,ftemp4 ; ht = bh*ht - FSTD ftemp4,-24(%sp) ; - - LDD -8(%sp),m ; r21 = m - LDD -16(%sp),m1 ; r19 = m1 - ADD,L m,m1,m ; m+m1 - - DEPD,Z m,31,32,temp3 ; (m+m1<<32) - LDD -24(%sp),ht ; r24 = ht - - CMPCLR,*>>= m,m1,%r0 ; if (m < m1) - ADD,L ht,high_one,ht ; ht+=high_one - - EXTRD,U m,31,32,temp1 ; m >> 32 - LDD -32(%sp),lt ; lt - ADD,L ht,temp1,ht ; ht+= m>>32 - ADD lt,temp3,lt ; lt = lt+m1 - ADD,DC ht,%r0,ht ; ht++ - - ADD C1,lt,C1 ; c1=c1+lt - ADD,DC ht,%r0,ht ; bump c3 if overflow,nullify otherwise - - ADD C2,ht,C2 ; c2 = c2 + ht - ADD,DC C3,%r0,C3 ; add in carry (c3++) -.endm - - -; -;void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) -; arg0 = r_ptr -; arg1 = a_ptr -; arg2 = b_ptr -; - -bn_mul_comba8 - .proc - .callinfo FRAME=128,ENTRY_GR=%r3,ARGS_SAVED,ORDERING_AWARE - .EXPORT bn_mul_comba8,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .entry - .align 64 - - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - STD %r5,16(%sp) ; save r5 - STD %r6,24(%sp) ; save r6 - FSTD %fr12,32(%sp) ; save r6 - FSTD %fr13,40(%sp) ; save r7 - - ; - ; Zero out carries - ; - COPY %r0,c1 - COPY %r0,c2 - COPY %r0,c3 - - LDO 128(%sp),%sp ; bump stack - DEPDI,Z 1,31,1,high_one ; Create Value 1 << 32 - - ; - ; Load up all of the values we are going to use - ; - FLDD 0(a_ptr),a0 - FLDD 8(a_ptr),a1 - FLDD 16(a_ptr),a2 - FLDD 24(a_ptr),a3 - FLDD 32(a_ptr),a4 - FLDD 40(a_ptr),a5 - FLDD 48(a_ptr),a6 - FLDD 56(a_ptr),a7 - - FLDD 0(b_ptr),b0 - FLDD 8(b_ptr),b1 - FLDD 16(b_ptr),b2 - FLDD 24(b_ptr),b3 - FLDD 32(b_ptr),b4 - FLDD 40(b_ptr),b5 - FLDD 48(b_ptr),b6 - FLDD 56(b_ptr),b7 - - MUL_ADD_C a0L,a0R,b0L,b0R,c1,c2,c3 - STD c1,0(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a0L,a0R,b1L,b1R,c2,c3,c1 - MUL_ADD_C a1L,a1R,b0L,b0R,c2,c3,c1 - STD c2,8(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a2L,a2R,b0L,b0R,c3,c1,c2 - MUL_ADD_C a1L,a1R,b1L,b1R,c3,c1,c2 - MUL_ADD_C a0L,a0R,b2L,b2R,c3,c1,c2 - STD c3,16(r_ptr) - COPY %r0,c3 - - MUL_ADD_C a0L,a0R,b3L,b3R,c1,c2,c3 - MUL_ADD_C a1L,a1R,b2L,b2R,c1,c2,c3 - MUL_ADD_C a2L,a2R,b1L,b1R,c1,c2,c3 - MUL_ADD_C a3L,a3R,b0L,b0R,c1,c2,c3 - STD c1,24(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a4L,a4R,b0L,b0R,c2,c3,c1 - MUL_ADD_C a3L,a3R,b1L,b1R,c2,c3,c1 - MUL_ADD_C a2L,a2R,b2L,b2R,c2,c3,c1 - MUL_ADD_C a1L,a1R,b3L,b3R,c2,c3,c1 - MUL_ADD_C a0L,a0R,b4L,b4R,c2,c3,c1 - STD c2,32(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a0L,a0R,b5L,b5R,c3,c1,c2 - MUL_ADD_C a1L,a1R,b4L,b4R,c3,c1,c2 - MUL_ADD_C a2L,a2R,b3L,b3R,c3,c1,c2 - MUL_ADD_C a3L,a3R,b2L,b2R,c3,c1,c2 - MUL_ADD_C a4L,a4R,b1L,b1R,c3,c1,c2 - MUL_ADD_C a5L,a5R,b0L,b0R,c3,c1,c2 - STD c3,40(r_ptr) - COPY %r0,c3 - - MUL_ADD_C a6L,a6R,b0L,b0R,c1,c2,c3 - MUL_ADD_C a5L,a5R,b1L,b1R,c1,c2,c3 - MUL_ADD_C a4L,a4R,b2L,b2R,c1,c2,c3 - MUL_ADD_C a3L,a3R,b3L,b3R,c1,c2,c3 - MUL_ADD_C a2L,a2R,b4L,b4R,c1,c2,c3 - MUL_ADD_C a1L,a1R,b5L,b5R,c1,c2,c3 - MUL_ADD_C a0L,a0R,b6L,b6R,c1,c2,c3 - STD c1,48(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a0L,a0R,b7L,b7R,c2,c3,c1 - MUL_ADD_C a1L,a1R,b6L,b6R,c2,c3,c1 - MUL_ADD_C a2L,a2R,b5L,b5R,c2,c3,c1 - MUL_ADD_C a3L,a3R,b4L,b4R,c2,c3,c1 - MUL_ADD_C a4L,a4R,b3L,b3R,c2,c3,c1 - MUL_ADD_C a5L,a5R,b2L,b2R,c2,c3,c1 - MUL_ADD_C a6L,a6R,b1L,b1R,c2,c3,c1 - MUL_ADD_C a7L,a7R,b0L,b0R,c2,c3,c1 - STD c2,56(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a7L,a7R,b1L,b1R,c3,c1,c2 - MUL_ADD_C a6L,a6R,b2L,b2R,c3,c1,c2 - MUL_ADD_C a5L,a5R,b3L,b3R,c3,c1,c2 - MUL_ADD_C a4L,a4R,b4L,b4R,c3,c1,c2 - MUL_ADD_C a3L,a3R,b5L,b5R,c3,c1,c2 - MUL_ADD_C a2L,a2R,b6L,b6R,c3,c1,c2 - MUL_ADD_C a1L,a1R,b7L,b7R,c3,c1,c2 - STD c3,64(r_ptr) - COPY %r0,c3 - - MUL_ADD_C a2L,a2R,b7L,b7R,c1,c2,c3 - MUL_ADD_C a3L,a3R,b6L,b6R,c1,c2,c3 - MUL_ADD_C a4L,a4R,b5L,b5R,c1,c2,c3 - MUL_ADD_C a5L,a5R,b4L,b4R,c1,c2,c3 - MUL_ADD_C a6L,a6R,b3L,b3R,c1,c2,c3 - MUL_ADD_C a7L,a7R,b2L,b2R,c1,c2,c3 - STD c1,72(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a7L,a7R,b3L,b3R,c2,c3,c1 - MUL_ADD_C a6L,a6R,b4L,b4R,c2,c3,c1 - MUL_ADD_C a5L,a5R,b5L,b5R,c2,c3,c1 - MUL_ADD_C a4L,a4R,b6L,b6R,c2,c3,c1 - MUL_ADD_C a3L,a3R,b7L,b7R,c2,c3,c1 - STD c2,80(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a4L,a4R,b7L,b7R,c3,c1,c2 - MUL_ADD_C a5L,a5R,b6L,b6R,c3,c1,c2 - MUL_ADD_C a6L,a6R,b5L,b5R,c3,c1,c2 - MUL_ADD_C a7L,a7R,b4L,b4R,c3,c1,c2 - STD c3,88(r_ptr) - COPY %r0,c3 - - MUL_ADD_C a7L,a7R,b5L,b5R,c1,c2,c3 - MUL_ADD_C a6L,a6R,b6L,b6R,c1,c2,c3 - MUL_ADD_C a5L,a5R,b7L,b7R,c1,c2,c3 - STD c1,96(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a6L,a6R,b7L,b7R,c2,c3,c1 - MUL_ADD_C a7L,a7R,b6L,b6R,c2,c3,c1 - STD c2,104(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a7L,a7R,b7L,b7R,c3,c1,c2 - STD c3,112(r_ptr) - STD c1,120(r_ptr) - - .EXIT - FLDD -88(%sp),%fr13 - FLDD -96(%sp),%fr12 - LDD -104(%sp),%r6 ; restore r6 - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 - - .PROCEND - -;----------------------------------------------------------------------------- -; -;void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b) -; arg0 = r_ptr -; arg1 = a_ptr -; arg2 = b_ptr -; - -bn_mul_comba4 - .proc - .callinfo FRAME=128,ENTRY_GR=%r3,ARGS_SAVED,ORDERING_AWARE - .EXPORT bn_mul_comba4,ENTRY,PRIV_LEV=3,NO_RELOCATION,LONG_RETURN - .entry - .align 64 - - STD %r3,0(%sp) ; save r3 - STD %r4,8(%sp) ; save r4 - STD %r5,16(%sp) ; save r5 - STD %r6,24(%sp) ; save r6 - FSTD %fr12,32(%sp) ; save r6 - FSTD %fr13,40(%sp) ; save r7 - - ; - ; Zero out carries - ; - COPY %r0,c1 - COPY %r0,c2 - COPY %r0,c3 - - LDO 128(%sp),%sp ; bump stack - DEPDI,Z 1,31,1,high_one ; Create Value 1 << 32 - - ; - ; Load up all of the values we are going to use - ; - FLDD 0(a_ptr),a0 - FLDD 8(a_ptr),a1 - FLDD 16(a_ptr),a2 - FLDD 24(a_ptr),a3 - - FLDD 0(b_ptr),b0 - FLDD 8(b_ptr),b1 - FLDD 16(b_ptr),b2 - FLDD 24(b_ptr),b3 - - MUL_ADD_C a0L,a0R,b0L,b0R,c1,c2,c3 - STD c1,0(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a0L,a0R,b1L,b1R,c2,c3,c1 - MUL_ADD_C a1L,a1R,b0L,b0R,c2,c3,c1 - STD c2,8(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a2L,a2R,b0L,b0R,c3,c1,c2 - MUL_ADD_C a1L,a1R,b1L,b1R,c3,c1,c2 - MUL_ADD_C a0L,a0R,b2L,b2R,c3,c1,c2 - STD c3,16(r_ptr) - COPY %r0,c3 - - MUL_ADD_C a0L,a0R,b3L,b3R,c1,c2,c3 - MUL_ADD_C a1L,a1R,b2L,b2R,c1,c2,c3 - MUL_ADD_C a2L,a2R,b1L,b1R,c1,c2,c3 - MUL_ADD_C a3L,a3R,b0L,b0R,c1,c2,c3 - STD c1,24(r_ptr) - COPY %r0,c1 - - MUL_ADD_C a3L,a3R,b1L,b1R,c2,c3,c1 - MUL_ADD_C a2L,a2R,b2L,b2R,c2,c3,c1 - MUL_ADD_C a1L,a1R,b3L,b3R,c2,c3,c1 - STD c2,32(r_ptr) - COPY %r0,c2 - - MUL_ADD_C a2L,a2R,b3L,b3R,c3,c1,c2 - MUL_ADD_C a3L,a3R,b2L,b2R,c3,c1,c2 - STD c3,40(r_ptr) - COPY %r0,c3 - - MUL_ADD_C a3L,a3R,b3L,b3R,c1,c2,c3 - STD c1,48(r_ptr) - STD c2,56(r_ptr) - - .EXIT - FLDD -88(%sp),%fr13 - FLDD -96(%sp),%fr12 - LDD -104(%sp),%r6 ; restore r6 - LDD -112(%sp),%r5 ; restore r5 - LDD -120(%sp),%r4 ; restore r4 - BVE (%rp) - LDD,MB -128(%sp),%r3 - - .PROCEND - - - .SPACE $TEXT$ - .SUBSPA $CODE$ - .SPACE $PRIVATE$,SORT=16 - .IMPORT $global$,DATA - .SPACE $TEXT$ - .SUBSPA $CODE$ - .SUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16 -C$4 - .ALIGN 8 - .STRINGZ "Division would overflow (%d)\n" - .END diff --git a/crypto/openssl/crypto/conf/conf_api.c b/crypto/openssl/crypto/conf/conf_api.c deleted file mode 100644 index d05a778ff6ff1..0000000000000 --- a/crypto/openssl/crypto/conf/conf_api.c +++ /dev/null @@ -1,289 +0,0 @@ -/* conf_api.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* Part of the code in here was originally in conf.c, which is now removed */ - -#ifndef CONF_DEBUG -# undef NDEBUG /* avoid conflicting definitions */ -# define NDEBUG -#endif - -#include <assert.h> -#include <string.h> -#include <openssl/conf.h> -#include <openssl/conf_api.h> - -static void value_free_hash(CONF_VALUE *a, LHASH *conf); -static void value_free_stack(CONF_VALUE *a,LHASH *conf); -static unsigned long hash(CONF_VALUE *v); -static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); - -/* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(CONF *conf, char *section) - { - CONF_VALUE *v,vv; - - if ((conf == NULL) || (section == NULL)) return(NULL); - vv.name=NULL; - vv.section=section; - v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); - return(v); - } - -/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section) - { - CONF_VALUE *v; - - v=_CONF_get_section(conf,section); - if (v != NULL) - return((STACK_OF(CONF_VALUE) *)v->value); - else - return(NULL); - } - -int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) - { - CONF_VALUE *v = NULL; - STACK_OF(CONF_VALUE) *ts; - - ts = (STACK_OF(CONF_VALUE) *)section->value; - - value->section=section->section; - if (!sk_CONF_VALUE_push(ts,value)) - { - return 0; - } - - v = (CONF_VALUE *)lh_insert(conf->data, value); - if (v != NULL) - { - sk_CONF_VALUE_delete_ptr(ts,v); - OPENSSL_free(v->name); - OPENSSL_free(v->value); - OPENSSL_free(v); - } - return 1; - } - -char *_CONF_get_string(CONF *conf, char *section, char *name) - { - CONF_VALUE *v,vv; - char *p; - - if (name == NULL) return(NULL); - if (conf != NULL) - { - if (section != NULL) - { - vv.name=name; - vv.section=section; - v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); - if (v != NULL) return(v->value); - if (strcmp(section,"ENV") == 0) - { - p=Getenv(name); - if (p != NULL) return(p); - } - } - vv.section="default"; - vv.name=name; - v=(CONF_VALUE *)lh_retrieve(conf->data,&vv); - if (v != NULL) - return(v->value); - else - return(NULL); - } - else - return(Getenv(name)); - } - -long _CONF_get_number(CONF *conf, char *section, char *name) - { - char *str; - long ret=0; - - str=_CONF_get_string(conf,section,name); - if (str == NULL) return(0); - for (;;) - { - if (conf->meth->is_number(conf, *str)) - ret=ret*10+conf->meth->to_int(conf, *str); - else - return(ret); - str++; - } - } - -int _CONF_new_data(CONF *conf) - { - if (conf == NULL) - { - return 0; - } - if (conf->data == NULL) - if ((conf->data = lh_new(hash,cmp_conf)) == NULL) - { - return 0; - } - return 1; - } - -void _CONF_free_data(CONF *conf) - { - if (conf == NULL || conf->data == NULL) return; - - conf->data->down_load=0; /* evil thing to make sure the 'OPENSSL_free()' - * works as expected */ - lh_doall_arg(conf->data,(void (*)())value_free_hash,conf->data); - - /* We now have only 'section' entries in the hash table. - * Due to problems with */ - - lh_doall_arg(conf->data,(void (*)())value_free_stack,conf->data); - lh_free(conf->data); - } - -static void value_free_hash(CONF_VALUE *a, LHASH *conf) - { - if (a->name != NULL) - { - a=(CONF_VALUE *)lh_delete(conf,a); - } - } - -static void value_free_stack(CONF_VALUE *a, LHASH *conf) - { - CONF_VALUE *vv; - STACK *sk; - int i; - - if (a->name != NULL) return; - - sk=(STACK *)a->value; - for (i=sk_num(sk)-1; i>=0; i--) - { - vv=(CONF_VALUE *)sk_value(sk,i); - OPENSSL_free(vv->value); - OPENSSL_free(vv->name); - OPENSSL_free(vv); - } - if (sk != NULL) sk_free(sk); - OPENSSL_free(a->section); - OPENSSL_free(a); - } - -static unsigned long hash(CONF_VALUE *v) - { - return((lh_strhash(v->section)<<2)^lh_strhash(v->name)); - } - -static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) - { - int i; - - if (a->section != b->section) - { - i=strcmp(a->section,b->section); - if (i) return(i); - } - - if ((a->name != NULL) && (b->name != NULL)) - { - i=strcmp(a->name,b->name); - return(i); - } - else if (a->name == b->name) - return(0); - else - return((a->name == NULL)?-1:1); - } - -/* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, char *section) - { - STACK *sk=NULL; - int ok=0,i; - CONF_VALUE *v=NULL,*vv; - - if ((sk=sk_new_null()) == NULL) - goto err; - if ((v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))) == NULL) - goto err; - i=strlen(section)+1; - if ((v->section=(char *)OPENSSL_malloc(i)) == NULL) - goto err; - - memcpy(v->section,section,i); - v->name=NULL; - v->value=(char *)sk; - - vv=(CONF_VALUE *)lh_insert(conf->data,v); - assert(vv == NULL); - ok=1; -err: - if (!ok) - { - if (sk != NULL) sk_free(sk); - if (v != NULL) OPENSSL_free(v); - v=NULL; - } - return(v); - } - -IMPLEMENT_STACK_OF(CONF_VALUE) diff --git a/crypto/openssl/crypto/conf/conf_api.h b/crypto/openssl/crypto/conf/conf_api.h deleted file mode 100644 index a5cc17b233a23..0000000000000 --- a/crypto/openssl/crypto/conf/conf_api.h +++ /dev/null @@ -1,87 +0,0 @@ -/* conf_api.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_CONF_API_H -#define HEADER_CONF_API_H - -#include <openssl/lhash.h> -#include <openssl/conf.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Up until OpenSSL 0.9.5a, this was new_section */ -CONF_VALUE *_CONF_new_section(CONF *conf, char *section); -/* Up until OpenSSL 0.9.5a, this was get_section */ -CONF_VALUE *_CONF_get_section(CONF *conf, char *section); -/* Up until OpenSSL 0.9.5a, this was CONF_get_section */ -STACK_OF(CONF_VALUE) *_CONF_get_section_values(CONF *conf, char *section); - -int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); -char *_CONF_get_string(CONF *conf, char *section, char *name); -long _CONF_get_number(CONF *conf, char *section, char *name); - -int _CONF_new_data(CONF *conf); -void _CONF_free_data(CONF *conf); - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/crypto/openssl/crypto/conf/conf_def.c b/crypto/openssl/crypto/conf/conf_def.c deleted file mode 100644 index 773df32c681bb..0000000000000 --- a/crypto/openssl/crypto/conf/conf_def.c +++ /dev/null @@ -1,703 +0,0 @@ -/* crypto/conf/conf.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* Part of the code in here was originally in conf.c, which is now removed */ - -#include <stdio.h> -#include <string.h> -#include <openssl/stack.h> -#include <openssl/lhash.h> -#include <openssl/conf.h> -#include <openssl/conf_api.h> -#include "conf_def.h" -#include <openssl/buffer.h> -#include <openssl/err.h> - -static char *eat_ws(CONF *conf, char *p); -static char *eat_alpha_numeric(CONF *conf, char *p); -static void clear_comments(CONF *conf, char *p); -static int str_copy(CONF *conf,char *section,char **to, char *from); -static char *scan_quote(CONF *conf, char *p); -static char *scan_dquote(CONF *conf, char *p); -#define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2))) - -static CONF *def_create(CONF_METHOD *meth); -static int def_init_default(CONF *conf); -static int def_init_WIN32(CONF *conf); -static int def_destroy(CONF *conf); -static int def_destroy_data(CONF *conf); -static int def_load(CONF *conf, BIO *bp, long *eline); -static int def_dump(CONF *conf, BIO *bp); -static int def_is_number(CONF *conf, char c); -static int def_to_int(CONF *conf, char c); - -const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT; - -static CONF_METHOD default_method = { - "OpenSSL default", - def_create, - def_init_default, - def_destroy, - def_destroy_data, - def_load, - def_dump, - def_is_number, - def_to_int - }; - -static CONF_METHOD WIN32_method = { - "WIN32", - def_create, - def_init_WIN32, - def_destroy, - def_destroy_data, - def_load, - def_dump, - def_is_number, - def_to_int - }; - -CONF_METHOD *NCONF_default() - { - return &default_method; - } -CONF_METHOD *NCONF_WIN32() - { - return &WIN32_method; - } - -static CONF *def_create(CONF_METHOD *meth) - { - CONF *ret; - - ret = (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *)); - if (ret) - if (meth->init(ret) == 0) - { - OPENSSL_free(ret); - ret = NULL; - } - return ret; - } - -static int def_init_default(CONF *conf) - { - if (conf == NULL) - return 0; - - conf->meth = &default_method; - conf->meth_data = (void *)CONF_type_default; - conf->data = NULL; - - return 1; - } - -static int def_init_WIN32(CONF *conf) - { - if (conf == NULL) - return 0; - - conf->meth = &WIN32_method; - conf->meth_data = (void *)CONF_type_win32; - conf->data = NULL; - - return 1; - } - -static int def_destroy(CONF *conf) - { - if (def_destroy_data(conf)) - { - OPENSSL_free(conf); - return 1; - } - return 0; - } - -static int def_destroy_data(CONF *conf) - { - if (conf == NULL) - return 0; - _CONF_free_data(conf); - return 1; - } - -static int def_load(CONF *conf, BIO *in, long *line) - { -#define BUFSIZE 512 - char btmp[16]; - int bufnum=0,i,ii; - BUF_MEM *buff=NULL; - char *s,*p,*end; - int again,n; - long eline=0; - CONF_VALUE *v=NULL,*tv; - CONF_VALUE *sv=NULL; - char *section=NULL,*buf; - STACK_OF(CONF_VALUE) *section_sk=NULL,*ts; - char *start,*psection,*pname; - void *h = (void *)(conf->data); - - if ((buff=BUF_MEM_new()) == NULL) - { - CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); - goto err; - } - - section=(char *)OPENSSL_malloc(10); - if (section == NULL) - { - CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); - goto err; - } - strcpy(section,"default"); - - if (_CONF_new_data(conf) == 0) - { - CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE); - goto err; - } - - sv=_CONF_new_section(conf,section); - if (sv == NULL) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - CONF_R_UNABLE_TO_CREATE_NEW_SECTION); - goto err; - } - section_sk=(STACK_OF(CONF_VALUE) *)sv->value; - - bufnum=0; - for (;;) - { - again=0; - if (!BUF_MEM_grow(buff,bufnum+BUFSIZE)) - { - CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB); - goto err; - } - p= &(buff->data[bufnum]); - *p='\0'; - BIO_gets(in, p, BUFSIZE-1); - p[BUFSIZE-1]='\0'; - ii=i=strlen(p); - if (i == 0) break; - while (i > 0) - { - if ((p[i-1] != '\r') && (p[i-1] != '\n')) - break; - else - i--; - } - /* we removed some trailing stuff so there is a new - * line on the end. */ - if (i == ii) - again=1; /* long line */ - else - { - p[i]='\0'; - eline++; /* another input line */ - } - - /* we now have a line with trailing \r\n removed */ - - /* i is the number of bytes */ - bufnum+=i; - - v=NULL; - /* check for line continuation */ - if (bufnum >= 1) - { - /* If we have bytes and the last char '\\' and - * second last char is not '\\' */ - p= &(buff->data[bufnum-1]); - if (IS_ESC(conf,p[0]) && - ((bufnum <= 1) || !IS_ESC(conf,p[-1]))) - { - bufnum--; - again=1; - } - } - if (again) continue; - bufnum=0; - buf=buff->data; - - clear_comments(conf, buf); - n=strlen(buf); - s=eat_ws(conf, buf); - if (IS_EOF(conf,*s)) continue; /* blank line */ - if (*s == '[') - { - char *ss; - - s++; - start=eat_ws(conf, s); - ss=start; -again: - end=eat_alpha_numeric(conf, ss); - p=eat_ws(conf, end); - if (*p != ']') - { - if (*p != '\0') - { - ss=p; - goto again; - } - CONFerr(CONF_F_CONF_LOAD_BIO, - CONF_R_MISSING_CLOSE_SQUARE_BRACKET); - goto err; - } - *end='\0'; - if (!str_copy(conf,NULL,§ion,start)) goto err; - if ((sv=_CONF_get_section(conf,section)) == NULL) - sv=_CONF_new_section(conf,section); - if (sv == NULL) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - CONF_R_UNABLE_TO_CREATE_NEW_SECTION); - goto err; - } - section_sk=(STACK_OF(CONF_VALUE) *)sv->value; - continue; - } - else - { - pname=s; - psection=NULL; - end=eat_alpha_numeric(conf, s); - if ((end[0] == ':') && (end[1] == ':')) - { - *end='\0'; - end+=2; - psection=pname; - pname=end; - end=eat_alpha_numeric(conf, end); - } - p=eat_ws(conf, end); - if (*p != '=') - { - CONFerr(CONF_F_CONF_LOAD_BIO, - CONF_R_MISSING_EQUAL_SIGN); - goto err; - } - *end='\0'; - p++; - start=eat_ws(conf, p); - while (!IS_EOF(conf,*p)) - p++; - p--; - while ((p != start) && (IS_WS(conf,*p))) - p--; - p++; - *p='\0'; - - if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE)))) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - ERR_R_MALLOC_FAILURE); - goto err; - } - if (psection == NULL) psection=section; - v->name=(char *)OPENSSL_malloc(strlen(pname)+1); - v->value=NULL; - if (v->name == NULL) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - ERR_R_MALLOC_FAILURE); - goto err; - } - strcpy(v->name,pname); - if (!str_copy(conf,psection,&(v->value),start)) goto err; - - if (strcmp(psection,section) != 0) - { - if ((tv=_CONF_get_section(conf,psection)) - == NULL) - tv=_CONF_new_section(conf,psection); - if (tv == NULL) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - CONF_R_UNABLE_TO_CREATE_NEW_SECTION); - goto err; - } - ts=(STACK_OF(CONF_VALUE) *)tv->value; - } - else - { - tv=sv; - ts=section_sk; - } -#if 1 - if (_CONF_add_string(conf, tv, v) == 0) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - ERR_R_MALLOC_FAILURE); - goto err; - } -#else - v->section=tv->section; - if (!sk_CONF_VALUE_push(ts,v)) - { - CONFerr(CONF_F_CONF_LOAD_BIO, - ERR_R_MALLOC_FAILURE); - goto err; - } - vv=(CONF_VALUE *)lh_insert(conf->data,v); - if (vv != NULL) - { - sk_CONF_VALUE_delete_ptr(ts,vv); - OPENSSL_free(vv->name); - OPENSSL_free(vv->value); - OPENSSL_free(vv); - } -#endif - v=NULL; - } - } - if (buff != NULL) BUF_MEM_free(buff); - if (section != NULL) OPENSSL_free(section); - return(1); -err: - if (buff != NULL) BUF_MEM_free(buff); - if (section != NULL) OPENSSL_free(section); - if (line != NULL) *line=eline; - sprintf(btmp,"%ld",eline); - ERR_add_error_data(2,"line ",btmp); - if ((h != conf->data) && (conf->data != NULL)) CONF_free(conf->data); - if (v != NULL) - { - if (v->name != NULL) OPENSSL_free(v->name); - if (v->value != NULL) OPENSSL_free(v->value); - if (v != NULL) OPENSSL_free(v); - } - return(0); - } - -static void clear_comments(CONF *conf, char *p) - { - char *to; - - to=p; - for (;;) - { - if (IS_FCOMMENT(conf,*p)) - { - *p='\0'; - return; - } - if (!IS_WS(conf,*p)) - { - break; - } - p++; - } - - for (;;) - { - if (IS_COMMENT(conf,*p)) - { - *p='\0'; - return; - } - if (IS_DQUOTE(conf,*p)) - { - p=scan_dquote(conf, p); - continue; - } - if (IS_QUOTE(conf,*p)) - { - p=scan_quote(conf, p); - continue; - } - if (IS_ESC(conf,*p)) - { - p=scan_esc(conf,p); - continue; - } - if (IS_EOF(conf,*p)) - return; - else - p++; - } - } - -static int str_copy(CONF *conf, char *section, char **pto, char *from) - { - int q,r,rr=0,to=0,len=0; - char *s,*e,*rp,*p,*rrp,*np,*cp,v; - BUF_MEM *buf; - - if ((buf=BUF_MEM_new()) == NULL) return(0); - - len=strlen(from)+1; - if (!BUF_MEM_grow(buf,len)) goto err; - - for (;;) - { - if (IS_QUOTE(conf,*from)) - { - q= *from; - from++; - while (!IS_EOF(conf,*from) && (*from != q)) - { - if (IS_ESC(conf,*from)) - { - from++; - if (IS_EOF(conf,*from)) break; - } - buf->data[to++]= *(from++); - } - if (*from == q) from++; - } - else if (IS_DQUOTE(conf,*from)) - { - q= *from; - from++; - while (!IS_EOF(conf,*from)) - { - if (*from == q) - { - if (*(from+1) == q) - { - from++; - } - else - { - break; - } - } - buf->data[to++]= *(from++); - } - if (*from == q) from++; - } - else if (IS_ESC(conf,*from)) - { - from++; - v= *(from++); - if (IS_EOF(conf,v)) break; - else if (v == 'r') v='\r'; - else if (v == 'n') v='\n'; - else if (v == 'b') v='\b'; - else if (v == 't') v='\t'; - buf->data[to++]= v; - } - else if (IS_EOF(conf,*from)) - break; - else if (*from == '$') - { - /* try to expand it */ - rrp=NULL; - s= &(from[1]); - if (*s == '{') - q='}'; - else if (*s == '(') - q=')'; - else q=0; - - if (q) s++; - cp=section; - e=np=s; - while (IS_ALPHA_NUMERIC(conf,*e)) - e++; - if ((e[0] == ':') && (e[1] == ':')) - { - cp=np; - rrp=e; - rr= *e; - *rrp='\0'; - e+=2; - np=e; - while (IS_ALPHA_NUMERIC(conf,*e)) - e++; - } - r= *e; - *e='\0'; - rp=e; - if (q) - { - if (r != q) - { - CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); - goto err; - } - e++; - } - /* So at this point we have - * ns which is the start of the name string which is - * '\0' terminated. - * cs which is the start of the section string which is - * '\0' terminated. - * e is the 'next point after'. - * r and s are the chars replaced by the '\0' - * rp and sp is where 'r' and 's' came from. - */ - p=_CONF_get_string(conf,cp,np); - if (rrp != NULL) *rrp=rr; - *rp=r; - if (p == NULL) - { - CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); - goto err; - } - BUF_MEM_grow(buf,(strlen(p)+len-(e-from))); - while (*p) - buf->data[to++]= *(p++); - from=e; - } - else - buf->data[to++]= *(from++); - } - buf->data[to]='\0'; - if (*pto != NULL) OPENSSL_free(*pto); - *pto=buf->data; - OPENSSL_free(buf); - return(1); -err: - if (buf != NULL) BUF_MEM_free(buf); - return(0); - } - -static char *eat_ws(CONF *conf, char *p) - { - while (IS_WS(conf,*p) && (!IS_EOF(conf,*p))) - p++; - return(p); - } - -static char *eat_alpha_numeric(CONF *conf, char *p) - { - for (;;) - { - if (IS_ESC(conf,*p)) - { - p=scan_esc(conf,p); - continue; - } - if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p)) - return(p); - p++; - } - } - -static char *scan_quote(CONF *conf, char *p) - { - int q= *p; - - p++; - while (!(IS_EOF(conf,*p)) && (*p != q)) - { - if (IS_ESC(conf,*p)) - { - p++; - if (IS_EOF(conf,*p)) return(p); - } - p++; - } - if (*p == q) p++; - return(p); - } - - -static char *scan_dquote(CONF *conf, char *p) - { - int q= *p; - - p++; - while (!(IS_EOF(conf,*p))) - { - if (*p == q) - { - if (*(p+1) == q) - { - p++; - } - else - { - break; - } - } - p++; - } - if (*p == q) p++; - return(p); - } - -static void dump_value(CONF_VALUE *a, BIO *out) - { - if (a->name) - BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); - else - BIO_printf(out, "[[%s]]\n", a->section); - } - -static int def_dump(CONF *conf, BIO *out) - { - lh_doall_arg(conf->data, (void (*)())dump_value, out); - return 1; - } - -static int def_is_number(CONF *conf, char c) - { - return IS_NUMBER(conf,c); - } - -static int def_to_int(CONF *conf, char c) - { - return c - '0'; - } - diff --git a/crypto/openssl/crypto/conf/conf_def.h b/crypto/openssl/crypto/conf/conf_def.h deleted file mode 100644 index 3244d9a331cb3..0000000000000 --- a/crypto/openssl/crypto/conf/conf_def.h +++ /dev/null @@ -1,145 +0,0 @@ -/* crypto/conf/conf_def.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* THIS FILE WAS AUTOMAGICALLY GENERATED! - Please modify and use keysets.pl to regenerate it. */ - -#define CONF_NUMBER 1 -#define CONF_UPPER 2 -#define CONF_LOWER 4 -#define CONF_UNDER 256 -#define CONF_PUNCTUATION 512 -#define CONF_WS 16 -#define CONF_ESC 32 -#define CONF_QUOTE 64 -#define CONF_DQUOTE 1024 -#define CONF_COMMENT 128 -#define CONF_FCOMMENT 2048 -#define CONF_EOF 8 -#define CONF_ALPHA (CONF_UPPER|CONF_LOWER) -#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER) -#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \ - CONF_PUNCTUATION) - -#define KEYTYPES(c) ((unsigned short *)((c)->meth_data)) -#ifndef CHARSET_EBCDIC -#define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_COMMENT) -#define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_FCOMMENT) -#define IS_EOF(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_EOF) -#define IS_ESC(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_ESC) -#define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_NUMBER) -#define IS_WS(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_WS) -#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_ALPHA_NUMERIC) -#define IS_ALPHA_NUMERIC_PUNCT(c,a) \ - (KEYTYPES(c)[(a)&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) -#define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_QUOTE) -#define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0x7f]&CONF_DQUOTE) - -#else /*CHARSET_EBCDIC*/ - -#define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_COMMENT) -#define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_FCOMMENT) -#define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_EOF) -#define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_ESC) -#define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_NUMBER) -#define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_WS) -#define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_ALPHA_NUMERIC) -#define IS_ALPHA_NUMERIC_PUNCT(c,a) \ - (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_ALPHA_NUMERIC_PUNCT) -#define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_QUOTE) -#define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a]&0x7f]&CONF_DQUOTE) -#endif /*CHARSET_EBCDIC*/ - -static unsigned short CONF_type_default[128]={ - 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, - 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, - 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, - 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, - 0x010,0x200,0x040,0x080,0x000,0x200,0x200,0x040, - 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, - 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, - 0x001,0x001,0x000,0x200,0x000,0x000,0x000,0x200, - 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, - 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, - 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, - 0x002,0x002,0x002,0x000,0x020,0x000,0x200,0x100, - 0x040,0x004,0x004,0x004,0x004,0x004,0x004,0x004, - 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, - 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, - 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, - }; - -static unsigned short CONF_type_win32[128]={ - 0x008,0x000,0x000,0x000,0x000,0x000,0x000,0x000, - 0x000,0x010,0x010,0x000,0x000,0x010,0x000,0x000, - 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, - 0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000, - 0x010,0x200,0x400,0x000,0x000,0x200,0x200,0x000, - 0x000,0x000,0x200,0x200,0x200,0x200,0x200,0x200, - 0x001,0x001,0x001,0x001,0x001,0x001,0x001,0x001, - 0x001,0x001,0x000,0xA00,0x000,0x000,0x000,0x200, - 0x200,0x002,0x002,0x002,0x002,0x002,0x002,0x002, - 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, - 0x002,0x002,0x002,0x002,0x002,0x002,0x002,0x002, - 0x002,0x002,0x002,0x000,0x000,0x000,0x200,0x100, - 0x000,0x004,0x004,0x004,0x004,0x004,0x004,0x004, - 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, - 0x004,0x004,0x004,0x004,0x004,0x004,0x004,0x004, - 0x004,0x004,0x004,0x000,0x200,0x000,0x200,0x000, - }; - diff --git a/crypto/openssl/crypto/conf/conf_lib.c b/crypto/openssl/crypto/conf/conf_lib.c deleted file mode 100644 index 4c8ca9e9ae4f3..0000000000000 --- a/crypto/openssl/crypto/conf/conf_lib.c +++ /dev/null @@ -1,352 +0,0 @@ -/* conf_lib.c */ -/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include <openssl/crypto.h> -#include <openssl/err.h> -#include <openssl/conf.h> -#include <openssl/conf_api.h> -#include <openssl/lhash.h> - -const char *CONF_version="CONF" OPENSSL_VERSION_PTEXT; - -static CONF_METHOD *default_CONF_method=NULL; - -/* The following section contains the "CONF classic" functions, - rewritten in terms of the new CONF interface. */ - -int CONF_set_default_method(CONF_METHOD *meth) - { - default_CONF_method = meth; - return 1; - } - -LHASH *CONF_load(LHASH *conf, const char *file, long *eline) - { - LHASH *ltmp; - BIO *in=NULL; - -#ifdef VMS - in=BIO_new_file(file, "r"); -#else - in=BIO_new_file(file, "rb"); -#endif - if (in == NULL) - { - CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); - return NULL; - } - - ltmp = CONF_load_bio(conf, in, eline); - BIO_free(in); - - return ltmp; - } - -#ifndef NO_FP_API -LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline) - { - BIO *btmp; - LHASH *ltmp; - if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { - CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); - return NULL; - } - ltmp = CONF_load_bio(conf, btmp, eline); - BIO_free(btmp); - return ltmp; - } -#endif - -LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) - { - CONF ctmp; - int ret; - - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); - - default_CONF_method->init(&ctmp); - ctmp.data = conf; - ret = NCONF_load_bio(&ctmp, bp, eline); - if (ret) - return ctmp.data; - return NULL; - } - -STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) - { - CONF ctmp; - - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); - - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_get_section(&ctmp, section); - } - -char *CONF_get_string(LHASH *conf,char *group,char *name) - { - CONF ctmp; - - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); - - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_get_string(&ctmp, group, name); - } - -long CONF_get_number(LHASH *conf,char *group,char *name) - { - CONF ctmp; - - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); - - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_get_number(&ctmp, group, name); - } - -void CONF_free(LHASH *conf) - { - CONF ctmp; - - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); - - default_CONF_method->init(&ctmp); - ctmp.data = conf; - NCONF_free_data(&ctmp); - } - -#ifndef NO_FP_API -int CONF_dump_fp(LHASH *conf, FILE *out) - { - BIO *btmp; - int ret; - - if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { - CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB); - return 0; - } - ret = CONF_dump_bio(conf, btmp); - BIO_free(btmp); - return ret; - } -#endif - -int CONF_dump_bio(LHASH *conf, BIO *out) - { - CONF ctmp; - - if (default_CONF_method == NULL) - default_CONF_method = NCONF_default(); - - default_CONF_method->init(&ctmp); - ctmp.data = conf; - return NCONF_dump_bio(&ctmp, out); - } - -/* The following section contains the "New CONF" functions. They are - completely centralised around a new CONF structure that may contain - basically anything, but at least a method pointer and a table of data. - These functions are also written in terms of the bridge functions used - by the "CONF classic" functions, for consistency. */ - -CONF *NCONF_new(CONF_METHOD *meth) - { - CONF *ret; - - if (meth == NULL) - meth = NCONF_default(); - - ret = meth->create(meth); - if (ret == NULL) - { - CONFerr(CONF_F_NCONF_NEW,ERR_R_MALLOC_FAILURE); - return(NULL); - } - - return ret; - } - -void NCONF_free(CONF *conf) - { - if (conf == NULL) - return; - conf->meth->destroy(conf); - } - -void NCONF_free_data(CONF *conf) - { - if (conf == NULL) - return; - conf->meth->destroy_data(conf); - } - -int NCONF_load(CONF *conf, const char *file, long *eline) - { - int ret; - BIO *in=NULL; - -#ifdef VMS - in=BIO_new_file(file, "r"); -#else - in=BIO_new_file(file, "rb"); -#endif - if (in == NULL) - { - CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); - return 0; - } - - ret = NCONF_load_bio(conf, in, eline); - BIO_free(in); - - return ret; - } - -#ifndef NO_FP_API -int NCONF_load_fp(CONF *conf, FILE *fp,long *eline) - { - BIO *btmp; - int ret; - if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) - { - CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); - return 0; - } - ret = NCONF_load_bio(conf, btmp, eline); - BIO_free(btmp); - return ret; - } -#endif - -int NCONF_load_bio(CONF *conf, BIO *bp,long *eline) - { - if (conf == NULL) - { - CONFerr(CONF_F_NCONF_LOAD_BIO,CONF_R_NO_CONF); - return 0; - } - - return conf->meth->load(conf, bp, eline); - } - -STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section) - { - if (conf == NULL) - { - CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_CONF); - return NULL; - } - - return _CONF_get_section_values(conf, section); - } - -char *NCONF_get_string(CONF *conf,char *group,char *name) - { - if (conf == NULL) - { - CONFerr(CONF_F_NCONF_GET_STRING,CONF_R_NO_CONF); - return NULL; - } - - return _CONF_get_string(conf, group, name); - } - -long NCONF_get_number(CONF *conf,char *group,char *name) - { - if (conf == NULL) - { - CONFerr(CONF_F_NCONF_GET_NUMBER,CONF_R_NO_CONF); - return 0; - } - - return _CONF_get_number(conf, group, name); - } - -#ifndef NO_FP_API -int NCONF_dump_fp(CONF *conf, FILE *out) - { - BIO *btmp; - int ret; - if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { - CONFerr(CONF_F_NCONF_DUMP_FP,ERR_R_BUF_LIB); - return 0; - } - ret = NCONF_dump_bio(conf, btmp); - BIO_free(btmp); - return ret; - } -#endif - -int NCONF_dump_bio(CONF *conf, BIO *out) - { - if (conf == NULL) - { - CONFerr(CONF_F_NCONF_DUMP_BIO,CONF_R_NO_CONF); - return 0; - } - - return conf->meth->dump(conf, out); - } - diff --git a/crypto/openssl/crypto/dso/Makefile.ssl b/crypto/openssl/crypto/dso/Makefile.ssl deleted file mode 100644 index effc46d2dc94e..0000000000000 --- a/crypto/openssl/crypto/dso/Makefile.ssl +++ /dev/null @@ -1,140 +0,0 @@ -# -# SSLeay/crypto/dso/Makefile -# - -DIR= dso -TOP= ../.. -CC= cc -INCLUDES= -I.. -I../../include -CFLAG=-g -INSTALL_PREFIX= -OPENSSLDIR= /usr/local/ssl -INSTALLTOP=/usr/local/ssl -MAKE= make -f Makefile.ssl -MAKEDEPEND= $(TOP)/util/domd $(TOP) -MAKEFILE= Makefile.ssl -AR= ar r - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST= -APPS= - -LIB=$(TOP)/libcrypto.a -LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \ - dso_openssl.c dso_win32.c dso_vms.c -LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \ - dso_openssl.o dso_win32.o dso_vms.o - -SRC= $(LIBSRC) - -EXHEADER= dso.h -HEADER= $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -top: - (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) - -all: lib - -lib: $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - @touch lib - -files: - $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO - -links: - @$(TOP)/util/point.sh Makefile.ssl Makefile - @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) - @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) - @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) - -install: - @for i in $(EXHEADER) ; \ - do \ - (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ - chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ - done; - -tags: - ctags $(SRC) - -tests: - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) - -dclean: - $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -dso_dl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_dl.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_dl.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_dl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_dl.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -dso_dl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -dso_dl.o: ../../include/openssl/symhacks.h ../cryptlib.h -dso_dlfcn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_dlfcn.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_dlfcn.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_dlfcn.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_dlfcn.o: ../../include/openssl/opensslconf.h -dso_dlfcn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h -dso_dlfcn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h -dso_dlfcn.o: ../cryptlib.h -dso_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h -dso_err.o: ../../include/openssl/dso.h ../../include/openssl/err.h -dso_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslv.h -dso_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -dso_err.o: ../../include/openssl/symhacks.h -dso_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_lib.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_lib.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -dso_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -dso_lib.o: ../../include/openssl/symhacks.h ../cryptlib.h -dso_null.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_null.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_null.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_null.o: ../../include/openssl/opensslconf.h -dso_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h -dso_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h -dso_null.o: ../cryptlib.h -dso_openssl.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_openssl.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_openssl.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_openssl.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_openssl.o: ../../include/openssl/opensslconf.h -dso_openssl.o: ../../include/openssl/opensslv.h -dso_openssl.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -dso_openssl.o: ../../include/openssl/symhacks.h ../cryptlib.h -dso_vms.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_vms.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_vms.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_vms.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_vms.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h -dso_vms.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h -dso_vms.o: ../../include/openssl/symhacks.h ../cryptlib.h -dso_win32.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h -dso_win32.o: ../../include/openssl/crypto.h ../../include/openssl/dso.h -dso_win32.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h -dso_win32.o: ../../include/openssl/err.h ../../include/openssl/lhash.h -dso_win32.o: ../../include/openssl/opensslconf.h -dso_win32.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h -dso_win32.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h -dso_win32.o: ../cryptlib.h diff --git a/crypto/openssl/crypto/dso/README b/crypto/openssl/crypto/dso/README deleted file mode 100644 index 6ba03c5631d66..0000000000000 --- a/crypto/openssl/crypto/dso/README +++ /dev/null @@ -1,24 +0,0 @@ -TODO ----- - -Find a way where name-translation can be done in a way that is -sensitive to particular methods (ie. generic code could still do -different path/filename substitutions on win32 to what it does on -*nix) but doesn't assume some canonical form. Already one case -exists where the "blah -> (libblah.so,blah.dll)" mapping doesn't -suffice. I suspect a callback with an enumerated (or string?) -parameter could be the way to go here ... DSO_ctrl the callback -into place and it can be invoked to handle name translation with -some clue to the calling code as to what kind of system it is. - -NOTES ------ - -I've checked out HPUX (well, version 11 at least) and shl_t is -a pointer type so it's safe to use in the way it has been in -dso_dl.c. On the other hand, HPUX11 support dlfcn too and -according to their man page, prefer developers to move to that. -I'll leave Richard's changes there as I guess dso_dl is needed -for HPUX10.20. - - diff --git a/crypto/openssl/crypto/dso/dso.h b/crypto/openssl/crypto/dso/dso.h deleted file mode 100644 index bed7c464a647e..0000000000000 --- a/crypto/openssl/crypto/dso/dso.h +++ /dev/null @@ -1,250 +0,0 @@ -/* dso.h */ -/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#ifndef HEADER_DSO_H -#define HEADER_DSO_H - -#include <openssl/crypto.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* These values are used as commands to DSO_ctrl() */ -#define DSO_CTRL_GET_FLAGS 1 -#define DSO_CTRL_SET_FLAGS 2 -#define DSO_CTRL_OR_FLAGS 3 - -/* These flags control the translation of file-names from canonical to - * native. Eg. in the CryptoSwift support, the "dl" and "dlfcn" - * methods will translate "swift" -> "libswift.so" whereas the "win32" - * method will translate "swift" -> "swift.dll". NB: Until I can figure - * out how to be more "conventional" with this, the methods will only - * honour this flag if it looks like it was passed a file without any - * path and if the filename is small enough. - */ -#define DSO_FLAG_NAME_TRANSLATION 0x01 - -/* The following flag controls the translation of symbol names to upper - * case. This is currently only being implemented for OpenVMS. - */ -#define DSO_FLAG_UPCASE_SYMBOL 0x02 - - -typedef void (*DSO_FUNC_TYPE)(void); - -typedef struct dso_st DSO; - -typedef struct dso_meth_st - { - const char *name; - /* Loads a shared library */ - int (*dso_load)(DSO *dso, const char *filename); - /* Unloads a shared library */ - int (*dso_unload)(DSO *dso); - /* Binds a variable */ - void *(*dso_bind_var)(DSO *dso, const char *symname); - /* Binds a function - assumes a return type of DSO_FUNC_TYPE. - * This should be cast to the real function prototype by the - * caller. Platforms that don't have compatible representations - * for different prototypes (this is possible within ANSI C) - * are highly unlikely to have shared libraries at all, let - * alone a DSO_METHOD implemented for them. */ - DSO_FUNC_TYPE (*dso_bind_func)(DSO *dso, const char *symname); - -/* I don't think this would actually be used in any circumstances. */ -#if 0 - /* Unbinds a variable */ - int (*dso_unbind_var)(DSO *dso, char *symname, void *symptr); - /* Unbinds a function */ - int (*dso_unbind_func)(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); -#endif - /* The generic (yuck) "ctrl()" function. NB: Negative return - * values (rather than zero) indicate errors. */ - long (*dso_ctrl)(DSO *dso, int cmd, long larg, void *parg); - - /* [De]Initialisation handlers. */ - int (*init)(DSO *dso); - int (*finish)(DSO *dso); - } DSO_METHOD; - -/**********************************************************************/ -/* The low-level handle type used to refer to a loaded shared library */ - -struct dso_st - { - DSO_METHOD *meth; - /* Standard dlopen uses a (void *). Win32 uses a HANDLE. VMS - * doesn't use anything but will need to cache the filename - * for use in the dso_bind handler. All in all, let each - * method control its own destiny. "Handles" and such go in - * a STACK. */ - STACK *meth_data; - int references; - int flags; - /* For use by applications etc ... use this for your bits'n'pieces, - * don't touch meth_data! */ - CRYPTO_EX_DATA ex_data; - }; - - -DSO * DSO_new(void); -DSO * DSO_new_method(DSO_METHOD *method); -int DSO_free(DSO *dso); -int DSO_flags(DSO *dso); -int DSO_up(DSO *dso); -long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg); - -void DSO_set_default_method(DSO_METHOD *meth); -DSO_METHOD *DSO_get_default_method(void); -DSO_METHOD *DSO_get_method(DSO *dso); -DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth); - -/* The all-singing all-dancing load function, you normally pass NULL - * for the first and third parameters. Use DSO_up and DSO_free for - * subsequent reference count handling. Any flags passed in will be set - * in the constructed DSO after its init() function but before the - * load operation. This will be done with; - * DSO_ctrl(dso, DSO_CTRL_SET_FLAGS, flags, NULL); */ -DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags); - -/* This function binds to a variable inside a shared library. */ -void *DSO_bind_var(DSO *dso, const char *symname); - -/* This function binds to a function inside a shared library. */ -DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname); - -/* This method is the default, but will beg, borrow, or steal whatever - * method should be the default on any particular platform (including - * DSO_METH_null() if necessary). */ -DSO_METHOD *DSO_METHOD_openssl(void); - -/* This method is defined for all platforms - if a platform has no - * DSO support then this will be the only method! */ -DSO_METHOD *DSO_METHOD_null(void); - -/* If DSO_DLFCN is defined, the standard dlfcn.h-style functions - * (dlopen, dlclose, dlsym, etc) will be used and incorporated into - * this method. If not, this method will return NULL. */ -DSO_METHOD *DSO_METHOD_dlfcn(void); - -/* If DSO_DL is defined, the standard dl.h-style functions (shl_load, - * shl_unload, shl_findsym, etc) will be used and incorporated into - * this method. If not, this method will return NULL. */ -DSO_METHOD *DSO_METHOD_dl(void); - -/* If WIN32 is defined, use DLLs. If not, return NULL. */ -DSO_METHOD *DSO_METHOD_win32(void); - -/* If VMS is defined, use shared images. If not, return NULL. */ -DSO_METHOD *DSO_METHOD_vms(void); - -void ERR_load_DSO_strings(void); - -/* BEGIN ERROR CODES */ -/* The following lines are auto generated by the script mkerr.pl. Any changes - * made after this point may be overwritten when the script is next run. - */ - -/* Error codes for the DSO functions. */ - -/* Function codes. */ -#define DSO_F_DLFCN_BIND_FUNC 100 -#define DSO_F_DLFCN_BIND_VAR 101 -#define DSO_F_DLFCN_CTRL 102 -#define DSO_F_DLFCN_LOAD 103 -#define DSO_F_DLFCN_UNLOAD 104 -#define DSO_F_DL_BIND_FUNC 105 -#define DSO_F_DL_BIND_VAR 106 -#define DSO_F_DL_CTRL 107 -#define DSO_F_DL_LOAD 108 -#define DSO_F_DL_UNLOAD 109 -#define DSO_F_DSO_BIND_FUNC 110 -#define DSO_F_DSO_BIND_VAR 111 -#define DSO_F_DSO_CTRL 112 -#define DSO_F_DSO_FREE 113 -#define DSO_F_DSO_LOAD 114 -#define DSO_F_DSO_NEW_METHOD 115 -#define DSO_F_DSO_UP 116 -#define DSO_F_VMS_BIND_VAR 122 -#define DSO_F_VMS_CTRL 123 -#define DSO_F_VMS_LOAD 124 -#define DSO_F_VMS_UNLOAD 125 -#define DSO_F_WIN32_BIND_FUNC 117 -#define DSO_F_WIN32_BIND_VAR 118 -#define DSO_F_WIN32_CTRL 119 -#define DSO_F_WIN32_LOAD 120 -#define DSO_F_WIN32_UNLOAD 121 - -/* Reason codes. */ -#define DSO_R_CTRL_FAILED 100 -#define DSO_R_FILENAME_TOO_BIG 109 -#define DSO_R_FINISH_FAILED 101 -#define DSO_R_LOAD_FAILED 102 -#define DSO_R_NULL_HANDLE 103 -#define DSO_R_STACK_ERROR 104 -#define DSO_R_SYM_FAILURE 105 -#define DSO_R_UNKNOWN_COMMAND 106 -#define DSO_R_UNLOAD_FAILED 107 -#define DSO_R_UNSUPPORTED 108 - -#ifdef __cplusplus -} -#endif -#endif - diff --git a/crypto/openssl/crypto/dso/dso_dl.c b/crypto/openssl/crypto/dso/dso_dl.c deleted file mode 100644 index 69810fc3bb93d..0000000000000 --- a/crypto/openssl/crypto/dso/dso_dl.c +++ /dev/null @@ -1,251 +0,0 @@ -/* dso_dl.c */ -/* Written by Richard Levitte (levitte@openssl.org) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/dso.h> - -#ifndef DSO_DL -DSO_METHOD *DSO_METHOD_dl(void) - { - return NULL; - } -#else - -#include <dl.h> - -/* Part of the hack in "dl_load" ... */ -#define DSO_MAX_TRANSLATED_SIZE 256 - -static int dl_load(DSO *dso, const char *filename); -static int dl_unload(DSO *dso); -static void *dl_bind_var(DSO *dso, const char *symname); -static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname); -#if 0 -static int dl_unbind_var(DSO *dso, char *symname, void *symptr); -static int dl_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr); -static int dl_init(DSO *dso); -static int dl_finish(DSO *dso); -#endif -static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg); - -static DSO_METHOD dso_meth_dl = { - "OpenSSL 'dl' shared library method", - dl_load, - dl_unload, - dl_bind_var, - dl_bind_func, -/* For now, "unbind" doesn't exist */ -#if 0 - NULL, /* unbind_var */ - NULL, /* unbind_func */ -#endif - dl_ctrl, - NULL, /* init */ - NULL /* finish */ - }; - -DSO_METHOD *DSO_METHOD_dl(void) - { - return(&dso_meth_dl); - } - -/* For this DSO_METHOD, our meth_data STACK will contain; - * (i) the handle (shl_t) returned from shl_load(). - * NB: I checked on HPUX11 and shl_t is itself a pointer - * type so the cast is safe. - */ - -static int dl_load(DSO *dso, const char *filename) - { - shl_t ptr; - char translated[DSO_MAX_TRANSLATED_SIZE]; - int len; - - /* The same comment as in dlfcn_load applies here. bleurgh. */ - len = strlen(filename); - if((dso->flags & DSO_FLAG_NAME_TRANSLATION) && - (len + 6 < DSO_MAX_TRANSLATED_SIZE) && - (strstr(filename, "/") == NULL)) - { - sprintf(translated, "lib%s.so", filename); - ptr = shl_load(translated, BIND_IMMEDIATE, NULL); - } - else - ptr = shl_load(filename, BIND_IMMEDIATE, NULL); - if(ptr == NULL) - { - DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED); - return(0); - } - if(!sk_push(dso->meth_data, (char *)ptr)) - { - DSOerr(DSO_F_DL_LOAD,DSO_R_STACK_ERROR); - shl_unload(ptr); - return(0); - } - return(1); - } - -static int dl_unload(DSO *dso) - { - shl_t ptr; - if(dso == NULL) - { - DSOerr(DSO_F_DL_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); - return(0); - } - if(sk_num(dso->meth_data) < 1) - return(1); - /* Is this statement legal? */ - ptr = (shl_t)sk_pop(dso->meth_data); - if(ptr == NULL) - { - DSOerr(DSO_F_DL_UNLOAD,DSO_R_NULL_HANDLE); - /* Should push the value back onto the stack in - * case of a retry. */ - sk_push(dso->meth_data, (char *)ptr); - return(0); - } - shl_unload(ptr); - return(1); - } - -static void *dl_bind_var(DSO *dso, const char *symname) - { - shl_t ptr; - void *sym; - - if((dso == NULL) || (symname == NULL)) - { - DSOerr(DSO_F_DL_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(sk_num(dso->meth_data) < 1) - { - DSOerr(DSO_F_DL_BIND_VAR,DSO_R_STACK_ERROR); - return(NULL); - } - ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); - if(ptr == NULL) - { - DSOerr(DSO_F_DL_BIND_VAR,DSO_R_NULL_HANDLE); - return(NULL); - } - if (shl_findsym(ptr, symname, TYPE_UNDEFINED, &sym) < 0) - { - DSOerr(DSO_F_DL_BIND_VAR,DSO_R_SYM_FAILURE); - return(NULL); - } - return(sym); - } - -static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname) - { - shl_t ptr; - void *sym; - - if((dso == NULL) || (symname == NULL)) - { - DSOerr(DSO_F_DL_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(sk_num(dso->meth_data) < 1) - { - DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_STACK_ERROR); - return(NULL); - } - ptr = (shl_t)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); - if(ptr == NULL) - { - DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_NULL_HANDLE); - return(NULL); - } - if (shl_findsym(ptr, symname, TYPE_UNDEFINED, &sym) < 0) - { - DSOerr(DSO_F_DL_BIND_FUNC,DSO_R_SYM_FAILURE); - return(NULL); - } - return((DSO_FUNC_TYPE)sym); - } - -static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg) - { - if(dso == NULL) - { - DSOerr(DSO_F_DL_CTRL,ERR_R_PASSED_NULL_PARAMETER); - return(-1); - } - switch(cmd) - { - case DSO_CTRL_GET_FLAGS: - return dso->flags; - case DSO_CTRL_SET_FLAGS: - dso->flags = (int)larg; - return(0); - case DSO_CTRL_OR_FLAGS: - dso->flags |= (int)larg; - return(0); - default: - break; - } - DSOerr(DSO_F_DL_CTRL,DSO_R_UNKNOWN_COMMAND); - return(-1); - } - -#endif /* DSO_DL */ diff --git a/crypto/openssl/crypto/dso/dso_dlfcn.c b/crypto/openssl/crypto/dso/dso_dlfcn.c deleted file mode 100644 index e709c721cc348..0000000000000 --- a/crypto/openssl/crypto/dso/dso_dlfcn.c +++ /dev/null @@ -1,276 +0,0 @@ -/* dso_dlfcn.c */ -/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/dso.h> - -#ifndef DSO_DLFCN -DSO_METHOD *DSO_METHOD_dlfcn(void) - { - return NULL; - } -#else - -#ifdef HAVE_DLFCN_H -#include <dlfcn.h> -#endif - -/* Part of the hack in "dlfcn_load" ... */ -#define DSO_MAX_TRANSLATED_SIZE 256 - -static int dlfcn_load(DSO *dso, const char *filename); -static int dlfcn_unload(DSO *dso); -static void *dlfcn_bind_var(DSO *dso, const char *symname); -static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname); -#if 0 -static int dlfcn_unbind(DSO *dso, char *symname, void *symptr); -static int dlfcn_init(DSO *dso); -static int dlfcn_finish(DSO *dso); -#endif -static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg); - -static DSO_METHOD dso_meth_dlfcn = { - "OpenSSL 'dlfcn' shared library method", - dlfcn_load, - dlfcn_unload, - dlfcn_bind_var, - dlfcn_bind_func, -/* For now, "unbind" doesn't exist */ -#if 0 - NULL, /* unbind_var */ - NULL, /* unbind_func */ -#endif - dlfcn_ctrl, - NULL, /* init */ - NULL /* finish */ - }; - -DSO_METHOD *DSO_METHOD_dlfcn(void) - { - return(&dso_meth_dlfcn); - } - -/* Prior to using the dlopen() function, we should decide on the flag - * we send. There's a few different ways of doing this and it's a - * messy venn-diagram to match up which platforms support what. So - * as we don't have autoconf yet, I'm implementing a hack that could - * be hacked further relatively easily to deal with cases as we find - * them. Initially this is to cope with OpenBSD. */ -#ifdef __OpenBSD__ -# ifdef DL_LAZY -# define DLOPEN_FLAG DL_LAZY -# else -# ifdef RTLD_NOW -# define DLOPEN_FLAG RTLD_NOW -# else -# define DLOPEN_FLAG 0 -# endif -# endif -#else -# define DLOPEN_FLAG RTLD_NOW /* Hope this works everywhere else */ -#endif - -/* For this DSO_METHOD, our meth_data STACK will contain; - * (i) the handle (void*) returned from dlopen(). - */ - -static int dlfcn_load(DSO *dso, const char *filename) - { - void *ptr; - char translated[DSO_MAX_TRANSLATED_SIZE]; - int len; - - /* NB: This is a hideous hack, but I'm not yet sure what - * to replace it with. This attempts to convert any filename, - * that looks like it has no path information, into a - * translated form, e. "blah" -> "libblah.so" */ - len = strlen(filename); - if((dso->flags & DSO_FLAG_NAME_TRANSLATION) && - (len + 6 < DSO_MAX_TRANSLATED_SIZE) && - (strstr(filename, "/") == NULL)) - { - sprintf(translated, "lib%s.so", filename); - ptr = dlopen(translated, DLOPEN_FLAG); - } - else - { - ptr = dlopen(filename, DLOPEN_FLAG); - } - if(ptr == NULL) - { - DSOerr(DSO_F_DLFCN_LOAD,DSO_R_LOAD_FAILED); - return(0); - } - if(!sk_push(dso->meth_data, (char *)ptr)) - { - DSOerr(DSO_F_DLFCN_LOAD,DSO_R_STACK_ERROR); - dlclose(ptr); - return(0); - } - return(1); - } - -static int dlfcn_unload(DSO *dso) - { - void *ptr; - if(dso == NULL) - { - DSOerr(DSO_F_DLFCN_UNLOAD,ERR_R_PASSED_NULL_PARAMETER); - return(0); - } - if(sk_num(dso->meth_data) < 1) - return(1); - ptr = (void *)sk_pop(dso->meth_data); - if(ptr == NULL) - { - DSOerr(DSO_F_DLFCN_UNLOAD,DSO_R_NULL_HANDLE); - /* Should push the value back onto the stack in - * case of a retry. */ - sk_push(dso->meth_data, (char *)ptr); - return(0); - } - /* For now I'm not aware of any errors associated with dlclose() */ - dlclose(ptr); - return(1); - } - -static void *dlfcn_bind_var(DSO *dso, const char *symname) - { - void *ptr, *sym; - - if((dso == NULL) || (symname == NULL)) - { - DSOerr(DSO_F_DLFCN_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(sk_num(dso->meth_data) < 1) - { - DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_STACK_ERROR); - return(NULL); - } - ptr = (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); - if(ptr == NULL) - { - DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_NULL_HANDLE); - return(NULL); - } - sym = dlsym(ptr, symname); - if(sym == NULL) - { - DSOerr(DSO_F_DLFCN_BIND_VAR,DSO_R_SYM_FAILURE); - return(NULL); - } - return(sym); - } - -static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) - { - void *ptr; - DSO_FUNC_TYPE sym; - - if((dso == NULL) || (symname == NULL)) - { - DSOerr(DSO_F_DLFCN_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(sk_num(dso->meth_data) < 1) - { - DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_STACK_ERROR); - return(NULL); - } - ptr = (void *)sk_value(dso->meth_data, sk_num(dso->meth_data) - 1); - if(ptr == NULL) - { - DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); - return(NULL); - } - sym = (DSO_FUNC_TYPE)dlsym(ptr, symname); - if(sym == NULL) - { - DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); - return(NULL); - } - return(sym); - } - -static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg) - { - if(dso == NULL) - { - DSOerr(DSO_F_DLFCN_CTRL,ERR_R_PASSED_NULL_PARAMETER); - return(-1); - } - switch(cmd) - { - case DSO_CTRL_GET_FLAGS: - return dso->flags; - case DSO_CTRL_SET_FLAGS: - dso->flags = (int)larg; - return(0); - case DSO_CTRL_OR_FLAGS: - dso->flags |= (int)larg; - return(0); - default: - break; - } - DSOerr(DSO_F_DLFCN_CTRL,DSO_R_UNKNOWN_COMMAND); - return(-1); - } - -#endif /* DSO_DLFCN */ diff --git a/crypto/openssl/crypto/dso/dso_err.c b/crypto/openssl/crypto/dso/dso_err.c deleted file mode 100644 index a3d7321c9b8f8..0000000000000 --- a/crypto/openssl/crypto/dso/dso_err.c +++ /dev/null @@ -1,128 +0,0 @@ -/* crypto/dso/dso_err.c */ -/* ==================================================================== - * Copyright (c) 1999 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* NOTE: this file was auto generated by the mkerr.pl script: any changes - * made to it will be overwritten when the script next updates this file, - * only reason strings will be preserved. - */ - -#include <stdio.h> -#include <openssl/err.h> -#include <openssl/dso.h> - -/* BEGIN ERROR CODES */ -#ifndef NO_ERR -static ERR_STRING_DATA DSO_str_functs[]= - { -{ERR_PACK(0,DSO_F_DLFCN_BIND_FUNC,0), "DLFCN_BIND_FUNC"}, -{ERR_PACK(0,DSO_F_DLFCN_BIND_VAR,0), "DLFCN_BIND_VAR"}, -{ERR_PACK(0,DSO_F_DLFCN_CTRL,0), "DLFCN_CTRL"}, -{ERR_PACK(0,DSO_F_DLFCN_LOAD,0), "DLFCN_LOAD"}, -{ERR_PACK(0,DSO_F_DLFCN_UNLOAD,0), "DLFCN_UNLOAD"}, -{ERR_PACK(0,DSO_F_DL_BIND_FUNC,0), "DL_BIND_FUNC"}, -{ERR_PACK(0,DSO_F_DL_BIND_VAR,0), "DL_BIND_VAR"}, -{ERR_PACK(0,DSO_F_DL_CTRL,0), "DL_CTRL"}, -{ERR_PACK(0,DSO_F_DL_LOAD,0), "DL_LOAD"}, -{ERR_PACK(0,DSO_F_DL_UNLOAD,0), "DL_UNLOAD"}, -{ERR_PACK(0,DSO_F_DSO_BIND_FUNC,0), "DSO_bind_func"}, -{ERR_PACK(0,DSO_F_DSO_BIND_VAR,0), "DSO_bind_var"}, -{ERR_PACK(0,DSO_F_DSO_CTRL,0), "DSO_ctrl"}, -{ERR_PACK(0,DSO_F_DSO_FREE,0), "DSO_free"}, -{ERR_PACK(0,DSO_F_DSO_LOAD,0), "DSO_load"}, -{ERR_PACK(0,DSO_F_DSO_NEW_METHOD,0), "DSO_new_method"}, -{ERR_PACK(0,DSO_F_DSO_UP,0), "DSO_up"}, -{ERR_PACK(0,DSO_F_VMS_BIND_VAR,0), "VMS_BIND_VAR"}, -{ERR_PACK(0,DSO_F_VMS_CTRL,0), "VMS_CTRL"}, -{ERR_PACK(0,DSO_F_VMS_LOAD,0), "VMS_LOAD"}, -{ERR_PACK(0,DSO_F_VMS_UNLOAD,0), "VMS_UNLOAD"}, -{ERR_PACK(0,DSO_F_WIN32_BIND_FUNC,0), "WIN32_BIND_FUNC"}, -{ERR_PACK(0,DSO_F_WIN32_BIND_VAR,0), "WIN32_BIND_VAR"}, -{ERR_PACK(0,DSO_F_WIN32_CTRL,0), "WIN32_CTRL"}, -{ERR_PACK(0,DSO_F_WIN32_LOAD,0), "WIN32_LOAD"}, -{ERR_PACK(0,DSO_F_WIN32_UNLOAD,0), "WIN32_UNLOAD"}, -{0,NULL} - }; - -static ERR_STRING_DATA DSO_str_reasons[]= - { -{DSO_R_CTRL_FAILED ,"control command failed"}, -{DSO_R_FILENAME_TOO_BIG ,"filename too big"}, -{DSO_R_FINISH_FAILED ,"cleanup method function failed"}, -{DSO_R_LOAD_FAILED ,"could not load the shared library"}, -{DSO_R_NULL_HANDLE ,"a null shared library handle was used"}, -{DSO_R_STACK_ERROR ,"the meth_data stack is corrupt"}, -{DSO_R_SYM_FAILURE ,"could not bind to the requested symbol name"}, -{DSO_R_UNKNOWN_COMMAND ,"unknown control command"}, -{DSO_R_UNLOAD_FAILED ,"could not unload the shared library"}, -{DSO_R_UNSUPPORTED ,"functionality not supported"}, -{0,NULL} - }; - -#endif - -void ERR_load_DSO_strings(void) - { - static int init=1; - - if (init) - { - init=0; -#ifndef NO_ERR - ERR_load_strings(ERR_LIB_DSO,DSO_str_functs); - ERR_load_strings(ERR_LIB_DSO,DSO_str_reasons); -#endif - - } - } diff --git a/crypto/openssl/crypto/dso/dso_lib.c b/crypto/openssl/crypto/dso/dso_lib.c deleted file mode 100644 index acd166697eb7b..0000000000000 --- a/crypto/openssl/crypto/dso/dso_lib.c +++ /dev/null @@ -1,306 +0,0 @@ -/* dso_lib.c */ -/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include <openssl/crypto.h> -#include "cryptlib.h" -#include <openssl/dso.h> - -static DSO_METHOD *default_DSO_meth = NULL; - -DSO *DSO_new(void) - { - return(DSO_new_method(NULL)); - } - -void DSO_set_default_method(DSO_METHOD *meth) - { - default_DSO_meth = meth; - } - -DSO_METHOD *DSO_get_default_method(void) - { - return(default_DSO_meth); - } - -DSO_METHOD *DSO_get_method(DSO *dso) - { - return(dso->meth); - } - -DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth) - { - DSO_METHOD *mtmp; - mtmp = dso->meth; - dso->meth = meth; - return(mtmp); - } - -DSO *DSO_new_method(DSO_METHOD *meth) - { - DSO *ret; - - if(default_DSO_meth == NULL) - /* We default to DSO_METH_openssl() which in turn defaults - * to stealing the "best available" method. Will fallback - * to DSO_METH_null() in the worst case. */ - default_DSO_meth = DSO_METHOD_openssl(); - ret = (DSO *)OPENSSL_malloc(sizeof(DSO)); - if(ret == NULL) - { - DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); - return(NULL); - } - memset(ret, 0, sizeof(DSO)); - ret->meth_data = sk_new_null(); - if((ret->meth_data = sk_new_null()) == NULL) - { - /* sk_new doesn't generate any errors so we do */ - DSOerr(DSO_F_DSO_NEW_METHOD,ERR_R_MALLOC_FAILURE); - OPENSSL_free(ret); - return(NULL); - } - if(meth == NULL) - ret->meth = default_DSO_meth; - else - ret->meth = meth; - ret->references = 1; - if((ret->meth->init != NULL) && !ret->meth->init(ret)) - { - OPENSSL_free(ret); - ret=NULL; - } - return(ret); - } - -int DSO_free(DSO *dso) - { - int i; - - if(dso == NULL) - { - DSOerr(DSO_F_DSO_FREE,ERR_R_PASSED_NULL_PARAMETER); - return(0); - } - - i=CRYPTO_add(&dso->references,-1,CRYPTO_LOCK_DSO); -#ifdef REF_PRINT - REF_PRINT("DSO",dso); -#endif - if(i > 0) return(1); -#ifdef REF_CHECK - if(i < 0) - { - fprintf(stderr,"DSO_free, bad reference count\n"); - abort(); - } -#endif - - if((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) - { - DSOerr(DSO_F_DSO_FREE,DSO_R_UNLOAD_FAILED); - return(0); - } - - if((dso->meth->finish != NULL) && !dso->meth->finish(dso)) - { - DSOerr(DSO_F_DSO_FREE,DSO_R_FINISH_FAILED); - return(0); - } - - sk_free(dso->meth_data); - - OPENSSL_free(dso); - return(1); - } - -int DSO_flags(DSO *dso) - { - return((dso == NULL) ? 0 : dso->flags); - } - - -int DSO_up(DSO *dso) - { - if (dso == NULL) - { - DSOerr(DSO_F_DSO_UP,ERR_R_PASSED_NULL_PARAMETER); - return(0); - } - - CRYPTO_add(&dso->references,1,CRYPTO_LOCK_DSO); - return(1); - } - -DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) - { - DSO *ret; - int allocated = 0; - - if(filename == NULL) - { - DSOerr(DSO_F_DSO_LOAD,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(dso == NULL) - { - ret = DSO_new_method(meth); - if(ret == NULL) - { - DSOerr(DSO_F_DSO_LOAD,ERR_R_MALLOC_FAILURE); - return(NULL); - } - allocated = 1; - } - else - ret = dso; - /* Bleurgh ... have to check for negative return values for - * errors. <grimace> */ - if(DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) - { - DSOerr(DSO_F_DSO_LOAD,DSO_R_CTRL_FAILED); - if(allocated) - DSO_free(ret); - return(NULL); - } - if(ret->meth->dso_load == NULL) - { - DSOerr(DSO_F_DSO_LOAD,DSO_R_UNSUPPORTED); - if(allocated) - DSO_free(ret); - return(NULL); - } - if(!ret->meth->dso_load(ret, filename)) - { - DSOerr(DSO_F_DSO_LOAD,DSO_R_LOAD_FAILED); - if(allocated) - DSO_free(ret); - return(NULL); - } - /* Load succeeded */ - return(ret); - } - -void *DSO_bind_var(DSO *dso, const char *symname) - { - void *ret = NULL; - - if((dso == NULL) || (symname == NULL)) - { - DSOerr(DSO_F_DSO_BIND_VAR,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(dso->meth->dso_bind_var == NULL) - { - DSOerr(DSO_F_DSO_BIND_VAR,DSO_R_UNSUPPORTED); - return(NULL); - } - if((ret = dso->meth->dso_bind_var(dso, symname)) == NULL) - { - DSOerr(DSO_F_DSO_BIND_VAR,DSO_R_SYM_FAILURE); - return(NULL); - } - /* Success */ - return(ret); - } - -DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname) - { - DSO_FUNC_TYPE ret = NULL; - - if((dso == NULL) || (symname == NULL)) - { - DSOerr(DSO_F_DSO_BIND_FUNC,ERR_R_PASSED_NULL_PARAMETER); - return(NULL); - } - if(dso->meth->dso_bind_func == NULL) - { - DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_UNSUPPORTED); - return(NULL); - } - if((ret = dso->meth->dso_bind_func(dso, symname)) == NULL) - { - DSOerr(DSO_F_DSO_BIND_FUNC,DSO_R_SYM_FAILURE); - return(NULL); - } - /* Success */ - return(ret); - } - -/* I don't really like these *_ctrl functions very much to be perfectly - * honest. For one thing, I think I have to return a negative value for - * any error because possible DSO_ctrl() commands may return values - * such as "size"s that can legitimately be zero (making the standard - * "if(DSO_cmd(...))" form that works almost everywhere else fail at - * odd times. I'd prefer "output" values to be passed by reference and - * the return value as success/failure like usual ... but we conform - * when we must... :-) */ -long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) - { - if(dso == NULL) - { - DSOerr(DSO_F_DSO_CTRL,ERR_R_PASSED_NULL_PARAMETER); - return(-1); - } - if((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL)) - { - DSOerr(DSO_F_DSO_CTRL,DSO_R_UNSUPPORTED); - return(-1); - } - return(dso->meth->dso_ctrl(dso,cmd,larg,parg)); - } diff --git a/crypto/openssl/crypto/dso/dso_null.c b/crypto/openssl/crypto/dso/dso_null.c deleted file mode 100644 index fa13a7cb0f185..0000000000000 --- a/crypto/openssl/crypto/dso/dso_null.c +++ /dev/null @@ -1,86 +0,0 @@ -/* dso_null.c */ -/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* This "NULL" method is provided as the fallback for systems that have - * no appropriate support for "shared-libraries". */ - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/dso.h> - -static DSO_METHOD dso_meth_null = { - "NULL shared library method", - NULL, /* load */ - NULL, /* unload */ - NULL, /* bind_var */ - NULL, /* bind_func */ -/* For now, "unbind" doesn't exist */ -#if 0 - NULL, /* unbind_var */ - NULL, /* unbind_func */ -#endif - NULL, /* ctrl */ - NULL, /* init */ - NULL /* finish */ - }; - -DSO_METHOD *DSO_METHOD_null(void) - { - return(&dso_meth_null); - } - diff --git a/crypto/openssl/crypto/dso/dso_openssl.c b/crypto/openssl/crypto/dso/dso_openssl.c deleted file mode 100644 index a4395ebffeca2..0000000000000 --- a/crypto/openssl/crypto/dso/dso_openssl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* dso_openssl.c */ -/* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/dso.h> - -/* We just pinch the method from an appropriate "default" method. */ - -DSO_METHOD *DSO_METHOD_openssl(void) - { -#ifdef DEF_DSO_METHOD - return(DEF_DSO_METHOD()); -#elif defined(DSO_DLFCN) - return(DSO_METHOD_dlfcn()); -#elif defined(DSO_DL) - return(DSO_METHOD_dl()); -#elif defined(DSO_WIN32) - return(DSO_METHOD_win32()); -#elif defined(DSO_VMS) - return(DSO_METHOD_vms()); -#else - return(DSO_METHOD_null()); -#endif - } - diff --git a/crypto/openssl/crypto/evp/e_bf.c b/crypto/openssl/crypto/evp/e_bf.c deleted file mode 100644 index 72047f64dabb0..0000000000000 --- a/crypto/openssl/crypto/evp/e_bf.c +++ /dev/null @@ -1,80 +0,0 @@ -/* crypto/evp/e_bf.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_BF -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include "evp_locl.h" -#include <openssl/objects.h> - -static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc); - -IMPLEMENT_BLOCK_CIPHER(bf, bf_ks, BF, bf_ks, NID_bf, 8, 16, 8, - 0, bf_init_key, NULL, - EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) - -static int bf_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - BF_set_key(&(ctx->c.bf_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -#endif diff --git a/crypto/openssl/crypto/evp/e_cast.c b/crypto/openssl/crypto/evp/e_cast.c deleted file mode 100644 index e5af7fb4eddc8..0000000000000 --- a/crypto/openssl/crypto/evp/e_cast.c +++ /dev/null @@ -1,82 +0,0 @@ -/* crypto/evp/e_cast.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_CAST - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include "evp_locl.h" - -static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv,int enc); - -IMPLEMENT_BLOCK_CIPHER(cast5, cast_ks, CAST, cast_ks, - NID_cast5, 8, EVP_CAST5_KEY_SIZE, 8, - EVP_CIPH_VARIABLE_LENGTH, cast_init_key, NULL, - EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) - -static int cast_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - CAST_set_key(&(ctx->c.cast_ks),EVP_CIPHER_CTX_key_length(ctx),key); - return 1; - } - -#endif diff --git a/crypto/openssl/crypto/evp/e_des.c b/crypto/openssl/crypto/evp/e_des.c deleted file mode 100644 index f4e998b81c8a6..0000000000000 --- a/crypto/openssl/crypto/evp/e_des.c +++ /dev/null @@ -1,118 +0,0 @@ -/* crypto/evp/e_des.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include "evp_locl.h" - -static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc); - -/* Because of various casts and different names can't use IMPLEMENT_BLOCK_CIPHER */ - -static int des_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - BLOCK_CIPHER_ecb_loop() - des_ecb_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), ctx->c.des_ks, ctx->encrypt); - return 1; -} - -static int des_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - des_ofb64_encrypt(in, out, (long)inl, ctx->c.des_ks, (des_cblock *)ctx->iv, &ctx->num); - return 1; -} - -static int des_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - des_ncbc_encrypt(in, out, (long)inl, ctx->c.des_ks, - (des_cblock *)ctx->iv, ctx->encrypt); - return 1; -} - -static int des_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - des_cfb64_encrypt(in, out, (long)inl, ctx->c.des_ks, - (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); - return 1; -} - -BLOCK_CIPHER_defs(des, des_ks, NID_des, 8, 8, 8, - 0, des_init_key, NULL, - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL) - - -static int des_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(deskey,ctx->c.des_ks); - return 1; - } - -#endif diff --git a/crypto/openssl/crypto/evp/e_des3.c b/crypto/openssl/crypto/evp/e_des3.c deleted file mode 100644 index a9aba4ae700e2..0000000000000 --- a/crypto/openssl/crypto/evp/e_des3.c +++ /dev/null @@ -1,165 +0,0 @@ -/* crypto/evp/e_des3.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_DES -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include "evp_locl.h" - -static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv,int enc); - -static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv,int enc); - -/* Because of various casts and different args can't use IMPLEMENT_BLOCK_CIPHER */ - -static int des_ede_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - BLOCK_CIPHER_ecb_loop() - des_ecb3_encrypt((des_cblock *)(in + i), (des_cblock *)(out + i), - ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, - ctx->encrypt); - return 1; -} - -static int des_ede_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - des_ede3_ofb64_encrypt(in, out, (long)inl, - ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, - (des_cblock *)ctx->iv, &ctx->num); - return 1; -} - -static int des_ede_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - des_ede3_cbc_encrypt(in, out, (long)inl, - ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, - (des_cblock *)ctx->iv, ctx->encrypt); - return 1; -} - -static int des_ede_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - des_ede3_cfb64_encrypt(in, out, (long)inl, - ctx->c.des_ede.ks1, ctx->c.des_ede.ks2, ctx->c.des_ede.ks3, - (des_cblock *)ctx->iv, &ctx->num, ctx->encrypt); - return 1; -} - -#define NID_des_ede_ecb NID_des_ede - -BLOCK_CIPHER_defs(des_ede, des_ede, NID_des_ede, 8, 16, 8, - 0, des_ede_init_key, NULL, - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL) - -#define NID_des_ede3_ecb NID_des_ede3 -#define des_ede3_cfb_cipher des_ede_cfb_cipher -#define des_ede3_ofb_cipher des_ede_ofb_cipher -#define des_ede3_cbc_cipher des_ede_cbc_cipher -#define des_ede3_ecb_cipher des_ede_ecb_cipher - -BLOCK_CIPHER_defs(des_ede3, des_ede, NID_des_ede3, 8, 24, 8, - 0, des_ede3_init_key, NULL, - EVP_CIPHER_set_asn1_iv, - EVP_CIPHER_get_asn1_iv, - NULL) - -static int des_ede_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - memcpy( (char *)ctx->c.des_ede.ks3, - (char *)ctx->c.des_ede.ks1, - sizeof(ctx->c.des_ede.ks1)); - return 1; - } - -static int des_ede3_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - des_cblock *deskey = (des_cblock *)key; - - des_set_key_unchecked(&deskey[0],ctx->c.des_ede.ks1); - des_set_key_unchecked(&deskey[1],ctx->c.des_ede.ks2); - des_set_key_unchecked(&deskey[2],ctx->c.des_ede.ks3); - - return 1; - } - -EVP_CIPHER *EVP_des_ede(void) -{ - return &des_ede_ecb; -} - -EVP_CIPHER *EVP_des_ede3(void) -{ - return &des_ede3_ecb; -} -#endif diff --git a/crypto/openssl/crypto/evp/e_idea.c b/crypto/openssl/crypto/evp/e_idea.c deleted file mode 100644 index 8d3c88deb710f..0000000000000 --- a/crypto/openssl/crypto/evp/e_idea.c +++ /dev/null @@ -1,112 +0,0 @@ -/* crypto/evp/e_idea.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_IDEA - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include "evp_locl.h" - -static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv,int enc); - -/* NB idea_ecb_encrypt doesn't take an 'encrypt' argument so we treat it as a special - * case - */ - -static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, - const unsigned char *in, unsigned int inl) -{ - BLOCK_CIPHER_ecb_loop() - idea_ecb_encrypt(in + i, out + i, &ctx->c.idea_ks); - return 1; -} - -/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ - -BLOCK_CIPHER_func_cbc(idea, idea, idea_ks) -BLOCK_CIPHER_func_ofb(idea, idea, idea_ks) -BLOCK_CIPHER_func_cfb(idea, idea, idea_ks) - -BLOCK_CIPHER_defs(idea, idea_ks, NID_idea, 8, 16, 8, - 0, idea_init_key, NULL, - EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) - -static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - if(!enc) { - if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1; - else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1; - } - if (enc) idea_set_encrypt_key(key,&(ctx->c.idea_ks)); - else - { - IDEA_KEY_SCHEDULE tmp; - - idea_set_encrypt_key(key,&tmp); - idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); - memset((unsigned char *)&tmp,0, - sizeof(IDEA_KEY_SCHEDULE)); - } - return 1; - } - -#endif diff --git a/crypto/openssl/crypto/evp/e_rc2.c b/crypto/openssl/crypto/evp/e_rc2.c deleted file mode 100644 index 3955c3ef848e8..0000000000000 --- a/crypto/openssl/crypto/evp/e_rc2.c +++ /dev/null @@ -1,222 +0,0 @@ -/* crypto/evp/e_rc2.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC2 - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include "evp_locl.h" - -static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv,int enc); -static int rc2_meth_to_magic(EVP_CIPHER_CTX *ctx); -static int rc2_magic_to_meth(int i); -static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type); -static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); - -IMPLEMENT_BLOCK_CIPHER(rc2, rc2.ks, RC2, rc2, NID_rc2, - 8, - EVP_RC2_KEY_SIZE, 8, - EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, - rc2_init_key, NULL, - rc2_set_asn1_type_and_iv, rc2_get_asn1_type_and_iv, - rc2_ctrl) - -#define RC2_40_MAGIC 0xa0 -#define RC2_64_MAGIC 0x78 -#define RC2_128_MAGIC 0x3a - -static EVP_CIPHER r2_64_cbc_cipher= - { - NID_rc2_64_cbc, - 8,8 /* 64 bit */,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, - rc2_init_key, - rc2_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2)), - rc2_set_asn1_type_and_iv, - rc2_get_asn1_type_and_iv, - rc2_ctrl, - NULL - }; - -static EVP_CIPHER r2_40_cbc_cipher= - { - NID_rc2_40_cbc, - 8,5 /* 40 bit */,8, - EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, - rc2_init_key, - rc2_cbc_cipher, - NULL, - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.rc2)), - rc2_set_asn1_type_and_iv, - rc2_get_asn1_type_and_iv, - rc2_ctrl, - NULL - }; - -EVP_CIPHER *EVP_rc2_64_cbc(void) - { - return(&r2_64_cbc_cipher); - } - -EVP_CIPHER *EVP_rc2_40_cbc(void) - { - return(&r2_40_cbc_cipher); - } - -static int rc2_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - RC2_set_key(&(ctx->c.rc2.ks),EVP_CIPHER_CTX_key_length(ctx), - key,ctx->c.rc2.key_bits); - return 1; - } - -static int rc2_meth_to_magic(EVP_CIPHER_CTX *e) - { - int i; - - EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i); - if (i == 128) return(RC2_128_MAGIC); - else if (i == 64) return(RC2_64_MAGIC); - else if (i == 40) return(RC2_40_MAGIC); - else return(0); - } - -static int rc2_magic_to_meth(int i) - { - if (i == RC2_128_MAGIC) return 128; - else if (i == RC2_64_MAGIC) return 64; - else if (i == RC2_40_MAGIC) return 40; - else - { - EVPerr(EVP_F_RC2_MAGIC_TO_METH,EVP_R_UNSUPPORTED_KEY_SIZE); - return(0); - } - } - -static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) - { - long num=0; - int i=0,l; - int key_bits; - unsigned char iv[EVP_MAX_IV_LENGTH]; - - if (type != NULL) - { - l=EVP_CIPHER_CTX_iv_length(c); - i=ASN1_TYPE_get_int_octetstring(type,&num,iv,l); - if (i != l) - return(-1); - key_bits =rc2_magic_to_meth((int)num); - if (!key_bits) - return(-1); - if(i > 0) EVP_CipherInit(c, NULL, NULL, iv, -1); - EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL); - EVP_CIPHER_CTX_set_key_length(c, key_bits / 8); - } - return(i); - } - -static int rc2_set_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type) - { - long num; - int i=0,j; - - if (type != NULL) - { - num=rc2_meth_to_magic(c); - j=EVP_CIPHER_CTX_iv_length(c); - i=ASN1_TYPE_set_int_octetstring(type,num,c->oiv,j); - } - return(i); - } - -static int rc2_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) - { - switch(type) { - - case EVP_CTRL_INIT: - c->c.rc2.key_bits = EVP_CIPHER_CTX_key_length(c) * 8; - return 1; - - case EVP_CTRL_GET_RC2_KEY_BITS: - *(int *)ptr = c->c.rc2.key_bits; - return 1; - - - case EVP_CTRL_SET_RC2_KEY_BITS: - if(arg > 0) { - c->c.rc2.key_bits = arg; - return 1; - } - return 0; - - default: - return -1; - } - } - -#endif diff --git a/crypto/openssl/crypto/evp/e_rc5.c b/crypto/openssl/crypto/evp/e_rc5.c deleted file mode 100644 index 5885f1826b2a0..0000000000000 --- a/crypto/openssl/crypto/evp/e_rc5.c +++ /dev/null @@ -1,118 +0,0 @@ -/* crypto/evp/e_rc5.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_RC5 - -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include "evp_locl.h" - -static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv,int enc); -static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr); - -IMPLEMENT_BLOCK_CIPHER(rc5_32_12_16, rc5.ks, RC5_32, rc5, NID_rc5, - 8, EVP_RC5_32_12_16_KEY_SIZE, 8, - EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT, - r_32_12_16_init_key, NULL, - NULL, NULL, rc5_ctrl) - - - -static int rc5_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) - { - switch(type) { - - case EVP_CTRL_INIT: - c->c.rc5.rounds = RC5_12_ROUNDS; - return 1; - - case EVP_CTRL_GET_RC5_ROUNDS: - *(int *)ptr = c->c.rc5.rounds; - return 1; - - - case EVP_CTRL_SET_RC5_ROUNDS: - switch(arg) { - case RC5_8_ROUNDS: - case RC5_12_ROUNDS: - case RC5_16_ROUNDS: - c->c.rc5.rounds = arg; - return 1; - - default: - EVPerr(EVP_F_RC5_CTRL, EVP_R_UNSUPORTED_NUMBER_OF_ROUNDS); - return 0; - } - - default: - return -1; - } - } - -static int r_32_12_16_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, - const unsigned char *iv, int enc) - { - RC5_32_set_key(&(ctx->c.rc5.ks),EVP_CIPHER_CTX_key_length(ctx), - key,ctx->c.rc5.rounds); - return 1; - } - -#endif diff --git a/crypto/openssl/crypto/evp/evp_locl.h b/crypto/openssl/crypto/evp/evp_locl.h deleted file mode 100644 index ce49d5b7d814d..0000000000000 --- a/crypto/openssl/crypto/evp/evp_locl.h +++ /dev/null @@ -1,168 +0,0 @@ -/* evp_locl.h */ -/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL - * project 2000. - */ -/* ==================================================================== - * Copyright (c) 1999 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * licensing@OpenSSL.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* Macros to code block cipher wrappers */ - -/* Wrapper functions for each cipher mode */ - -#define BLOCK_CIPHER_ecb_loop() \ - unsigned int i; \ - if(inl < 8) return 1;\ - inl -= 8; \ - for(i=0; i <= inl; i+=8) \ - -#define BLOCK_CIPHER_func_ecb(cname, cprefix, kname) \ -static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ -{\ - BLOCK_CIPHER_ecb_loop() \ - cprefix##_ecb_encrypt(in + i, out + i, &ctx->c.kname, ctx->encrypt);\ - return 1;\ -} - -#define BLOCK_CIPHER_func_ofb(cname, cprefix, kname) \ -static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ -{\ - cprefix##_ofb64_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, &ctx->num);\ - return 1;\ -} - -#define BLOCK_CIPHER_func_cbc(cname, cprefix, kname) \ -static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ -{\ - cprefix##_cbc_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, ctx->encrypt);\ - return 1;\ -} - -#define BLOCK_CIPHER_func_cfb(cname, cprefix, kname) \ -static int cname##_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \ -{\ - cprefix##_cfb64_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, &ctx->num, ctx->encrypt);\ - return 1;\ -} - -#define BLOCK_CIPHER_all_funcs(cname, cprefix, kname) \ - BLOCK_CIPHER_func_cbc(cname, cprefix, kname) \ - BLOCK_CIPHER_func_cfb(cname, cprefix, kname) \ - BLOCK_CIPHER_func_ecb(cname, cprefix, kname) \ - BLOCK_CIPHER_func_ofb(cname, cprefix, kname) - -#define BLOCK_CIPHER_defs(cname, kstruct, \ - nid, block_size, key_len, iv_len, flags,\ - init_key, cleanup, set_asn1, get_asn1, ctrl)\ -static EVP_CIPHER cname##_cbc = {\ - nid##_cbc, block_size, key_len, iv_len, \ - flags | EVP_CIPH_CBC_MODE,\ - init_key,\ - cname##_cbc_cipher,\ - cleanup,\ - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ - set_asn1, get_asn1,\ - ctrl, \ - NULL \ -};\ -EVP_CIPHER *EVP_##cname##_cbc(void) { return &cname##_cbc; }\ -static EVP_CIPHER cname##_cfb = {\ - nid##_cfb64, 1, key_len, iv_len, \ - flags | EVP_CIPH_CFB_MODE,\ - init_key,\ - cname##_cfb_cipher,\ - cleanup,\ - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ - set_asn1, get_asn1,\ - ctrl,\ - NULL \ -};\ -EVP_CIPHER *EVP_##cname##_cfb(void) { return &cname##_cfb; }\ -static EVP_CIPHER cname##_ofb = {\ - nid##_ofb64, 1, key_len, iv_len, \ - flags | EVP_CIPH_OFB_MODE,\ - init_key,\ - cname##_ofb_cipher,\ - cleanup,\ - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ - set_asn1, get_asn1,\ - ctrl,\ - NULL \ -};\ -EVP_CIPHER *EVP_##cname##_ofb(void) { return &cname##_ofb; }\ -static EVP_CIPHER cname##_ecb = {\ - nid##_ecb, block_size, key_len, iv_len, \ - flags | EVP_CIPH_ECB_MODE,\ - init_key,\ - cname##_ecb_cipher,\ - cleanup,\ - sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\ - sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\ - set_asn1, get_asn1,\ - ctrl,\ - NULL \ -};\ -EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; } - - - -#define IMPLEMENT_BLOCK_CIPHER(cname, kname, cprefix, kstruct, \ - nid, block_size, key_len, iv_len, flags, \ - init_key, cleanup, set_asn1, get_asn1, ctrl) \ - BLOCK_CIPHER_all_funcs(cname, cprefix, kname) \ - BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, flags,\ - init_key, cleanup, set_asn1, get_asn1, ctrl) - diff --git a/crypto/openssl/crypto/evp/m_md4.c b/crypto/openssl/crypto/evp/m_md4.c deleted file mode 100644 index 6a24ceb86d6e6..0000000000000 --- a/crypto/openssl/crypto/evp/m_md4.c +++ /dev/null @@ -1,83 +0,0 @@ -/* crypto/evp/m_md4.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef NO_MD4 -#include <stdio.h> -#include "cryptlib.h" -#include <openssl/evp.h> -#include <openssl/objects.h> -#include <openssl/x509.h> - -static EVP_MD md4_md= - { - NID_md4, - 0, - MD4_DIGEST_LENGTH, - MD4_Init, - MD4_Update, - MD4_Final, - EVP_PKEY_RSA_method, - MD4_CBLOCK, - sizeof(EVP_MD *)+sizeof(MD4_CTX), - }; - -EVP_MD *EVP_md4(void) - { - return(&md4_md); - } -#endif diff --git a/crypto/openssl/crypto/md4/Makefile.ssl b/crypto/openssl/crypto/md4/Makefile.ssl deleted file mode 100644 index 5341bf5b4632c..0000000000000 --- a/crypto/openssl/crypto/md4/Makefile.ssl +++ /dev/null @@ -1,84 +0,0 @@ -# -# SSLeay/crypto/md4/Makefile -# - -DIR= md4 -TOP= ../.. -CC= cc -CPP= $(CC) -E -INCLUDES= -CFLAG=-g -INSTALL_PREFIX= -OPENSSLDIR= /usr/local/ssl -INSTALLTOP=/usr/local/ssl -MAKE= make -f Makefile.ssl -MAKEDEPEND= $(TOP)/util/domd $(TOP) -MAKEFILE= Makefile.ssl -AR= ar r - -CFLAGS= $(INCLUDES) $(CFLAG) - -GENERAL=Makefile -TEST=md4test.c -APPS=md4.c - -LIB=$(TOP)/libcrypto.a -LIBSRC=md4_dgst.c md4_one.c -LIBOBJ=md4_dgst.o md4_one.o - -SRC= $(LIBSRC) - -EXHEADER= md4.h -HEADER= md4_locl.h $(EXHEADER) - -ALL= $(GENERAL) $(SRC) $(HEADER) - -top: - (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) - -all: lib - -lib: $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) - $(RANLIB) $(LIB) - @touch lib - -files: - $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO - -links: - @$(TOP)/util/point.sh Makefile.ssl Makefile - @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) - @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) - @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) - -install: - @for i in $(EXHEADER) ; \ - do \ - (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ - chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ - done; - -tags: - ctags $(SRC) - -tests: - -lint: - lint -DLINT $(INCLUDES) $(SRC)>fluff - -depend: - $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC) - -dclean: - $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new - mv -f Makefile.new $(MAKEFILE) - -clean: - rm -f asm/mx86unix.cpp *.o asm/*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -md4_dgst.o: ../../include/openssl/md4.h ../../include/openssl/opensslconf.h -md4_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md4_locl.h -md4_one.o: ../../include/openssl/md4.h diff --git a/crypto/openssl/crypto/md4/md4.c b/crypto/openssl/crypto/md4/md4.c deleted file mode 100644 index e4b0aac01170a..0000000000000 --- a/crypto/openssl/crypto/md4/md4.c +++ /dev/null @@ -1,127 +0,0 @@ -/* crypto/md4/md4.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/md4.h> - -#define BUFSIZE 1024*16 - -void do_fp(FILE *f); -void pt(unsigned char *md); -#ifndef _OSD_POSIX -int read(int, void *, unsigned int); -#endif - -int main(int argc, char **argv) - { - int i,err=0; - FILE *IN; - - if (argc == 1) - { - do_fp(stdin); - } - else - { - for (i=1; i<argc; i++) - { - IN=fopen(argv[i],"r"); - if (IN == NULL) - { - perror(argv[i]); - err++; - continue; - } - printf("MD4(%s)= ",argv[i]); - do_fp(IN); - fclose(IN); - } - } - exit(err); - } - -void do_fp(FILE *f) - { - MD4_CTX c; - unsigned char md[MD4_DIGEST_LENGTH]; - int fd; - int i; - static unsigned char buf[BUFSIZE]; - - fd=fileno(f); - MD4_Init(&c); - for (;;) - { - i=read(fd,buf,BUFSIZE); - if (i <= 0) break; - MD4_Update(&c,buf,(unsigned long)i); - } - MD4_Final(&(md[0]),&c); - pt(md); - } - -void pt(unsigned char *md) - { - int i; - - for (i=0; i<MD4_DIGEST_LENGTH; i++) - printf("%02x",md[i]); - printf("\n"); - } - diff --git a/crypto/openssl/crypto/md4/md4.h b/crypto/openssl/crypto/md4/md4.h deleted file mode 100644 index c794e186dbd3f..0000000000000 --- a/crypto/openssl/crypto/md4/md4.h +++ /dev/null @@ -1,114 +0,0 @@ -/* crypto/md4/md4.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_MD4_H -#define HEADER_MD4_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef NO_MD4 -#error MD4 is disabled. -#endif - -/* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * ! MD4_LONG has to be at least 32 bits wide. If it's wider, then ! - * ! MD4_LONG_LOG2 has to be defined along. ! - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - */ - -#if defined(WIN16) || defined(__LP32__) -#define MD4_LONG unsigned long -#elif defined(_CRAY) || defined(__ILP64__) -#define MD4_LONG unsigned long -#define MD4_LONG_LOG2 3 -/* - * _CRAY note. I could declare short, but I have no idea what impact - * does it have on performance on none-T3E machines. I could declare - * int, but at least on C90 sizeof(int) can be chosen at compile time. - * So I've chosen long... - * <appro@fy.chalmers.se> - */ -#else -#define MD4_LONG unsigned int -#endif - -#define MD4_CBLOCK 64 -#define MD4_LBLOCK (MD4_CBLOCK/4) -#define MD4_DIGEST_LENGTH 16 - -typedef struct MD4state_st - { - MD4_LONG A,B,C,D; - MD4_LONG Nl,Nh; - MD4_LONG data[MD4_LBLOCK]; - int num; - } MD4_CTX; - -void MD4_Init(MD4_CTX *c); -void MD4_Update(MD4_CTX *c, const void *data, unsigned long len); -void MD4_Final(unsigned char *md, MD4_CTX *c); -unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md); -void MD4_Transform(MD4_CTX *c, const unsigned char *b); -#ifdef __cplusplus -} -#endif - -#endif diff --git a/crypto/openssl/crypto/md4/md4_dgst.c b/crypto/openssl/crypto/md4/md4_dgst.c deleted file mode 100644 index 81488ae2e27d9..0000000000000 --- a/crypto/openssl/crypto/md4/md4_dgst.c +++ /dev/null @@ -1,285 +0,0 @@ -/* crypto/md4/md4_dgst.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include "md4_locl.h" -#include <openssl/opensslv.h> - -const char *MD4_version="MD4" OPENSSL_VERSION_PTEXT; - -/* Implemented from RFC1186 The MD4 Message-Digest Algorithm - */ - -#define INIT_DATA_A (unsigned long)0x67452301L -#define INIT_DATA_B (unsigned long)0xefcdab89L -#define INIT_DATA_C (unsigned long)0x98badcfeL -#define INIT_DATA_D (unsigned long)0x10325476L - -void MD4_Init(MD4_CTX *c) - { - c->A=INIT_DATA_A; - c->B=INIT_DATA_B; - c->C=INIT_DATA_C; - c->D=INIT_DATA_D; - c->Nl=0; - c->Nh=0; - c->num=0; - } - -#ifndef md4_block_host_order -void md4_block_host_order (MD4_CTX *c, const void *data, int num) - { - const MD4_LONG *X=data; - register unsigned long A,B,C,D; - /* - * In case you wonder why A-D are declared as long and not - * as MD4_LONG. Doing so results in slight performance - * boost on LP64 architectures. The catch is we don't - * really care if 32 MSBs of a 64-bit register get polluted - * with eventual overflows as we *save* only 32 LSBs in - * *either* case. Now declaring 'em long excuses the compiler - * from keeping 32 MSBs zeroed resulting in 13% performance - * improvement under SPARC Solaris7/64 and 5% under AlphaLinux. - * Well, to be honest it should say that this *prevents* - * performance degradation. - * - * <appro@fy.chalmers.se> - */ - - A=c->A; - B=c->B; - C=c->C; - D=c->D; - - for (;num--;X+=HASH_LBLOCK) - { - /* Round 0 */ - R0(A,B,C,D,X[ 0], 3,0); - R0(D,A,B,C,X[ 1], 7,0); - R0(C,D,A,B,X[ 2],11,0); - R0(B,C,D,A,X[ 3],19,0); - R0(A,B,C,D,X[ 4], 3,0); - R0(D,A,B,C,X[ 5], 7,0); - R0(C,D,A,B,X[ 6],11,0); - R0(B,C,D,A,X[ 7],19,0); - R0(A,B,C,D,X[ 8], 3,0); - R0(D,A,B,C,X[ 9], 7,0); - R0(C,D,A,B,X[10],11,0); - R0(B,C,D,A,X[11],19,0); - R0(A,B,C,D,X[12], 3,0); - R0(D,A,B,C,X[13], 7,0); - R0(C,D,A,B,X[14],11,0); - R0(B,C,D,A,X[15],19,0); - /* Round 1 */ - R1(A,B,C,D,X[ 0], 3,0x5A827999L); - R1(D,A,B,C,X[ 4], 5,0x5A827999L); - R1(C,D,A,B,X[ 8], 9,0x5A827999L); - R1(B,C,D,A,X[12],13,0x5A827999L); - R1(A,B,C,D,X[ 1], 3,0x5A827999L); - R1(D,A,B,C,X[ 5], 5,0x5A827999L); - R1(C,D,A,B,X[ 9], 9,0x5A827999L); - R1(B,C,D,A,X[13],13,0x5A827999L); - R1(A,B,C,D,X[ 2], 3,0x5A827999L); - R1(D,A,B,C,X[ 6], 5,0x5A827999L); - R1(C,D,A,B,X[10], 9,0x5A827999L); - R1(B,C,D,A,X[14],13,0x5A827999L); - R1(A,B,C,D,X[ 3], 3,0x5A827999L); - R1(D,A,B,C,X[ 7], 5,0x5A827999L); - R1(C,D,A,B,X[11], 9,0x5A827999L); - R1(B,C,D,A,X[15],13,0x5A827999L); - /* Round 2 */ - R2(A,B,C,D,X[ 0], 3,0x6ED9EBA1); - R2(D,A,B,C,X[ 8], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 4],11,0x6ED9EBA1); - R2(B,C,D,A,X[12],15,0x6ED9EBA1); - R2(A,B,C,D,X[ 2], 3,0x6ED9EBA1); - R2(D,A,B,C,X[10], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 6],11,0x6ED9EBA1); - R2(B,C,D,A,X[14],15,0x6ED9EBA1); - R2(A,B,C,D,X[ 1], 3,0x6ED9EBA1); - R2(D,A,B,C,X[ 9], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 5],11,0x6ED9EBA1); - R2(B,C,D,A,X[13],15,0x6ED9EBA1); - R2(A,B,C,D,X[ 3], 3,0x6ED9EBA1); - R2(D,A,B,C,X[11], 9,0x6ED9EBA1); - R2(C,D,A,B,X[ 7],11,0x6ED9EBA1); - R2(B,C,D,A,X[15],15,0x6ED9EBA1); - - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } - } -#endif - -#ifndef md4_block_data_order -#ifdef X -#undef X -#endif -void md4_block_data_order (MD4_CTX *c, const void *data_, int num) - { - const unsigned char *data=data_; - register unsigned long A,B,C,D,l; - /* - * In case you wonder why A-D are declared as long and not - * as MD4_LONG. Doing so results in slight performance - * boost on LP64 architectures. The catch is we don't - * really care if 32 MSBs of a 64-bit register get polluted - * with eventual overflows as we *save* only 32 LSBs in - * *either* case. Now declaring 'em long excuses the compiler - * from keeping 32 MSBs zeroed resulting in 13% performance - * improvement under SPARC Solaris7/64 and 5% under AlphaLinux. - * Well, to be honest it should say that this *prevents* - * performance degradation. - * - * <appro@fy.chalmers.se> - */ -#ifndef MD32_XARRAY - /* See comment in crypto/sha/sha_locl.h for details. */ - unsigned long XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7, - XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15; -# define X(i) XX##i -#else - MD4_LONG XX[MD4_LBLOCK]; -# define X(i) XX[i] -#endif - - A=c->A; - B=c->B; - C=c->C; - D=c->D; - - for (;num--;) - { - HOST_c2l(data,l); X( 0)=l; HOST_c2l(data,l); X( 1)=l; - /* Round 0 */ - R0(A,B,C,D,X( 0), 3,0); HOST_c2l(data,l); X( 2)=l; - R0(D,A,B,C,X( 1), 7,0); HOST_c2l(data,l); X( 3)=l; - R0(C,D,A,B,X( 2),11,0); HOST_c2l(data,l); X( 4)=l; - R0(B,C,D,A,X( 3),19,0); HOST_c2l(data,l); X( 5)=l; - R0(A,B,C,D,X( 4), 3,0); HOST_c2l(data,l); X( 6)=l; - R0(D,A,B,C,X( 5), 7,0); HOST_c2l(data,l); X( 7)=l; - R0(C,D,A,B,X( 6),11,0); HOST_c2l(data,l); X( 8)=l; - R0(B,C,D,A,X( 7),19,0); HOST_c2l(data,l); X( 9)=l; - R0(A,B,C,D,X( 8), 3,0); HOST_c2l(data,l); X(10)=l; - R0(D,A,B,C,X( 9), 7,0); HOST_c2l(data,l); X(11)=l; - R0(C,D,A,B,X(10),11,0); HOST_c2l(data,l); X(12)=l; - R0(B,C,D,A,X(11),19,0); HOST_c2l(data,l); X(13)=l; - R0(A,B,C,D,X(12), 3,0); HOST_c2l(data,l); X(14)=l; - R0(D,A,B,C,X(13), 7,0); HOST_c2l(data,l); X(15)=l; - R0(C,D,A,B,X(14),11,0); - R0(B,C,D,A,X(15),19,0); - /* Round 1 */ - R1(A,B,C,D,X( 0), 3,0x5A827999L); - R1(D,A,B,C,X( 4), 5,0x5A827999L); - R1(C,D,A,B,X( 8), 9,0x5A827999L); - R1(B,C,D,A,X(12),13,0x5A827999L); - R1(A,B,C,D,X( 1), 3,0x5A827999L); - R1(D,A,B,C,X( 5), 5,0x5A827999L); - R1(C,D,A,B,X( 9), 9,0x5A827999L); - R1(B,C,D,A,X(13),13,0x5A827999L); - R1(A,B,C,D,X( 2), 3,0x5A827999L); - R1(D,A,B,C,X( 6), 5,0x5A827999L); - R1(C,D,A,B,X(10), 9,0x5A827999L); - R1(B,C,D,A,X(14),13,0x5A827999L); - R1(A,B,C,D,X( 3), 3,0x5A827999L); - R1(D,A,B,C,X( 7), 5,0x5A827999L); - R1(C,D,A,B,X(11), 9,0x5A827999L); - R1(B,C,D,A,X(15),13,0x5A827999L); - /* Round 2 */ - R2(A,B,C,D,X( 0), 3,0x6ED9EBA1L); - R2(D,A,B,C,X( 8), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 4),11,0x6ED9EBA1L); - R2(B,C,D,A,X(12),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 2), 3,0x6ED9EBA1L); - R2(D,A,B,C,X(10), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 6),11,0x6ED9EBA1L); - R2(B,C,D,A,X(14),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 1), 3,0x6ED9EBA1L); - R2(D,A,B,C,X( 9), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 5),11,0x6ED9EBA1L); - R2(B,C,D,A,X(13),15,0x6ED9EBA1L); - R2(A,B,C,D,X( 3), 3,0x6ED9EBA1L); - R2(D,A,B,C,X(11), 9,0x6ED9EBA1L); - R2(C,D,A,B,X( 7),11,0x6ED9EBA1L); - R2(B,C,D,A,X(15),15,0x6ED9EBA1L); - - A = c->A += A; - B = c->B += B; - C = c->C += C; - D = c->D += D; - } - } -#endif - -#ifdef undef -int printit(unsigned long *l) - { - int i,ii; - - for (i=0; i<2; i++) - { - for (ii=0; ii<8; ii++) - { - fprintf(stderr,"%08lx ",l[i*8+ii]); - } - fprintf(stderr,"\n"); - } - } -#endif diff --git a/crypto/openssl/crypto/md4/md4_locl.h b/crypto/openssl/crypto/md4/md4_locl.h deleted file mode 100644 index 0a2b39018da58..0000000000000 --- a/crypto/openssl/crypto/md4/md4_locl.h +++ /dev/null @@ -1,154 +0,0 @@ -/* crypto/md4/md4_locl.h */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdlib.h> -#include <string.h> -#include <openssl/opensslconf.h> -#include <openssl/md4.h> - -#ifndef MD4_LONG_LOG2 -#define MD4_LONG_LOG2 2 /* default to 32 bits */ -#endif - -void md4_block_host_order (MD4_CTX *c, const void *p,int num); -void md4_block_data_order (MD4_CTX *c, const void *p,int num); - -#if defined(__i386) || defined(_M_IX86) || defined(__INTEL__) -/* - * *_block_host_order is expected to handle aligned data while - * *_block_data_order - unaligned. As algorithm and host (x86) - * are in this case of the same "endianness" these two are - * otherwise indistinguishable. But normally you don't want to - * call the same function because unaligned access in places - * where alignment is expected is usually a "Bad Thing". Indeed, - * on RISCs you get punished with BUS ERROR signal or *severe* - * performance degradation. Intel CPUs are in turn perfectly - * capable of loading unaligned data without such drastic side - * effect. Yes, they say it's slower than aligned load, but no - * exception is generated and therefore performance degradation - * is *incomparable* with RISCs. What we should weight here is - * costs of unaligned access against costs of aligning data. - * According to my measurements allowing unaligned access results - * in ~9% performance improvement on Pentium II operating at - * 266MHz. I won't be surprised if the difference will be higher - * on faster systems:-) - * - * <appro@fy.chalmers.se> - */ -#define md4_block_data_order md4_block_host_order -#endif - -#define DATA_ORDER_IS_LITTLE_ENDIAN - -#define HASH_LONG MD4_LONG -#define HASH_LONG_LOG2 MD4_LONG_LOG2 -#define HASH_CTX MD4_CTX -#define HASH_CBLOCK MD4_CBLOCK -#define HASH_LBLOCK MD4_LBLOCK -#define HASH_UPDATE MD4_Update -#define HASH_TRANSFORM MD4_Transform -#define HASH_FINAL MD4_Final -#define HASH_MAKE_STRING(c,s) do { \ - unsigned long ll; \ - ll=(c)->A; HOST_l2c(ll,(s)); \ - ll=(c)->B; HOST_l2c(ll,(s)); \ - ll=(c)->C; HOST_l2c(ll,(s)); \ - ll=(c)->D; HOST_l2c(ll,(s)); \ - } while (0) -#define HASH_BLOCK_HOST_ORDER md4_block_host_order -#if !defined(L_ENDIAN) || defined(md4_block_data_order) -#define HASH_BLOCK_DATA_ORDER md4_block_data_order -/* - * Little-endians (Intel and Alpha) feel better without this. - * It looks like memcpy does better job than generic - * md4_block_data_order on copying-n-aligning input data. - * But frankly speaking I didn't expect such result on Alpha. - * On the other hand I've got this with egcs-1.0.2 and if - * program is compiled with another (better?) compiler it - * might turn out other way around. - * - * <appro@fy.chalmers.se> - */ -#endif - -#include "md32_common.h" - -/* -#define F(x,y,z) (((x) & (y)) | ((~(x)) & (z))) -#define G(x,y,z) (((x) & (y)) | ((x) & ((z))) | ((y) & ((z)))) -*/ - -/* As pointed out by Wei Dai <weidai@eskimo.com>, the above can be - * simplified to the code below. Wei attributes these optimizations - * to Peter Gutmann's SHS code, and he attributes it to Rich Schroeppel. - */ -#define F(b,c,d) ((((c) ^ (d)) & (b)) ^ (d)) -#define G(b,c,d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) -#define H(b,c,d) ((b) ^ (c) ^ (d)) - -#define R0(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+F((b),(c),(d))); \ - a=ROTATE(a,s); }; - -#define R1(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+G((b),(c),(d))); \ - a=ROTATE(a,s); };\ - -#define R2(a,b,c,d,k,s,t) { \ - a+=((k)+(t)+H((b),(c),(d))); \ - a=ROTATE(a,s); }; diff --git a/crypto/openssl/crypto/md4/md4_one.c b/crypto/openssl/crypto/md4/md4_one.c deleted file mode 100644 index 87a995d38d434..0000000000000 --- a/crypto/openssl/crypto/md4/md4_one.c +++ /dev/null @@ -1,95 +0,0 @@ -/* crypto/md4/md4_one.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <string.h> -#include <openssl/md4.h> - -#ifdef CHARSET_EBCDIC -#include <openssl/ebcdic.h> -#endif - -unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md) - { - MD4_CTX c; - static unsigned char m[MD4_DIGEST_LENGTH]; - - if (md == NULL) md=m; - MD4_Init(&c); -#ifndef CHARSET_EBCDIC - MD4_Update(&c,d,n); -#else - { - char temp[1024]; - unsigned long chunk; - - while (n > 0) - { - chunk = (n > sizeof(temp)) ? sizeof(temp) : n; - ebcdic2ascii(temp, d, chunk); - MD4_Update(&c,temp,chunk); - n -= chunk; - d += chunk; - } - } -#endif - MD4_Final(md,&c); - memset(&c,0,sizeof(c)); /* security consideration */ - return(md); - } - diff --git a/crypto/openssl/crypto/md4/md4s.cpp b/crypto/openssl/crypto/md4/md4s.cpp deleted file mode 100644 index c0ec97fc9f9b9..0000000000000 --- a/crypto/openssl/crypto/md4/md4s.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -// gettsc.inl -// -// gives access to the Pentium's (secret) cycle counter -// -// This software was written by Leonard Janke (janke@unixg.ubc.ca) -// in 1996-7 and is entered, by him, into the public domain. - -#if defined(__WATCOMC__) -void GetTSC(unsigned long&); -#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; -#elif defined(__GNUC__) -inline -void GetTSC(unsigned long& tsc) -{ - asm volatile(".byte 15, 49\n\t" - : "=eax" (tsc) - : - : "%edx", "%eax"); -} -#elif defined(_MSC_VER) -inline -void GetTSC(unsigned long& tsc) -{ - unsigned long a; - __asm _emit 0fh - __asm _emit 31h - __asm mov a, eax; - tsc=a; -} -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/md4.h> - -extern "C" { -void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num); -} - -void main(int argc,char *argv[]) - { - unsigned char buffer[64*256]; - MD4_CTX ctx; - unsigned long s1,s2,e1,e2; - unsigned char k[16]; - unsigned long data[2]; - unsigned char iv[8]; - int i,num=0,numm; - int j=0; - - if (argc >= 2) - num=atoi(argv[1]); - - if (num == 0) num=16; - if (num > 250) num=16; - numm=num+2; - num*=64; - numm*=64; - - for (j=0; j<6; j++) - { - for (i=0; i<10; i++) /**/ - { - md4_block_x86(&ctx,buffer,numm); - GetTSC(s1); - md4_block_x86(&ctx,buffer,numm); - GetTSC(e1); - GetTSC(s2); - md4_block_x86(&ctx,buffer,num); - GetTSC(e2); - md4_block_x86(&ctx,buffer,num); - } - printf("md4 (%d bytes) %d %d (%.2f)\n",num, - e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); - } - } - diff --git a/crypto/openssl/crypto/md4/md4test.c b/crypto/openssl/crypto/md4/md4test.c deleted file mode 100644 index 97e6e21efd157..0000000000000 --- a/crypto/openssl/crypto/md4/md4test.c +++ /dev/null @@ -1,131 +0,0 @@ -/* crypto/md4/md4test.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#ifdef NO_MD4 -int main(int argc, char *argv[]) -{ - printf("No MD4 support\n"); - return(0); -} -#else -#include <openssl/md4.h> - -static char *test[]={ - "", - "a", - "abc", - "message digest", - "abcdefghijklmnopqrstuvwxyz", - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "12345678901234567890123456789012345678901234567890123456789012345678901234567890", - NULL, - }; - -static char *ret[]={ -"31d6cfe0d16ae931b73c59d7e0c089c0", -"bde52cb31de33e46245e05fbdbd6fb24", -"a448017aaf21d8525fc10ae87aa6729d", -"d9130a8164549fe818874806e1c7014b", -"d79e1c308aa5bbcdeea8ed63df412da9", -"043f8582f241db351ce627e153e7f0e4", -"e33b4ddc9c38f2199c3e7b164fcc0536", -}; - -static char *pt(unsigned char *md); -int main(int argc, char *argv[]) - { - int i,err=0; - unsigned char **P,**R; - char *p; - - P=(unsigned char **)test; - R=(unsigned char **)ret; - i=1; - while (*P != NULL) - { - p=pt(MD4(&(P[0][0]),(unsigned long)strlen((char *)*P),NULL)); - if (strcmp(p,(char *)*R) != 0) - { - printf("error calculating MD4 on '%s'\n",*P); - printf("got %s instead of %s\n",p,*R); - err++; - } - else - printf("test %d ok\n",i); - i++; - R++; - P++; - } - exit(err); - return(0); - } - -static char *pt(unsigned char *md) - { - int i; - static char buf[80]; - - for (i=0; i<MD4_DIGEST_LENGTH; i++) - sprintf(&(buf[i*2]),"%02x",md[i]); - return(buf); - } -#endif diff --git a/crypto/openssl/crypto/objects/obj_mac.h b/crypto/openssl/crypto/objects/obj_mac.h deleted file mode 100644 index 401b1e5a1bc25..0000000000000 --- a/crypto/openssl/crypto/objects/obj_mac.h +++ /dev/null @@ -1,1798 +0,0 @@ -/* lib/obj/obj_mac.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the - * following command: - * perl objects.pl objects.txt obj_mac.num obj_mac.h - */ - -#define SN_undef "UNDEF" -#define LN_undef "undefined" -#define NID_undef 0 -#define OBJ_undef 0L - -#define SN_iso "ISO" -#define LN_iso "iso" -#define NID_iso 181 -#define OBJ_iso 1L - -#define SN_member_body "member-body" -#define LN_member_body "ISO Member Body" -#define NID_member_body 182 -#define OBJ_member_body OBJ_iso,2L - -#define SN_ISO_US "ISO-US" -#define LN_ISO_US "ISO US Member Body" -#define NID_ISO_US 183 -#define OBJ_ISO_US OBJ_member_body,840L - -#define SN_X9_57 "X9-57" -#define LN_X9_57 "X9.57" -#define NID_X9_57 184 -#define OBJ_X9_57 OBJ_ISO_US,10040L - -#define SN_X9cm "X9cm" -#define LN_X9cm "X9.57 CM ?" -#define NID_X9cm 185 -#define OBJ_X9cm OBJ_X9_57,4L - -#define SN_dsa "DSA" -#define LN_dsa "dsaEncryption" -#define NID_dsa 116 -#define OBJ_dsa OBJ_X9cm,1L - -#define SN_dsaWithSHA1 "DSA-SHA1" -#define LN_dsaWithSHA1 "dsaWithSHA1" -#define NID_dsaWithSHA1 113 -#define OBJ_dsaWithSHA1 OBJ_X9cm,3L - -#define SN_cast5_cbc "CAST5-CBC" -#define LN_cast5_cbc "cast5-cbc" -#define NID_cast5_cbc 108 -#define OBJ_cast5_cbc OBJ_ISO_US,113533L,7L,66L,10L - -#define SN_cast5_ecb "CAST5-ECB" -#define LN_cast5_ecb "cast5-ecb" -#define NID_cast5_ecb 109 - -#define SN_cast5_cfb64 "CAST5-CFB" -#define LN_cast5_cfb64 "cast5-cfb" -#define NID_cast5_cfb64 110 - -#define SN_cast5_ofb64 "CAST5-OFB" -#define LN_cast5_ofb64 "cast5-ofb" -#define NID_cast5_ofb64 111 - -#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC" -#define NID_pbeWithMD5AndCast5_CBC 112 -#define OBJ_pbeWithMD5AndCast5_CBC OBJ_ISO_US,113533L,7L,66L,12L - -#define SN_rsadsi "rsadsi" -#define LN_rsadsi "RSA Data Security, Inc." -#define NID_rsadsi 1 -#define OBJ_rsadsi OBJ_ISO_US,113549L - -#define SN_pkcs "pkcs" -#define LN_pkcs "RSA Data Security, Inc. PKCS" -#define NID_pkcs 2 -#define OBJ_pkcs OBJ_rsadsi,1L - -#define SN_pkcs1 "pkcs1" -#define NID_pkcs1 186 -#define OBJ_pkcs1 OBJ_pkcs,1L - -#define LN_rsaEncryption "rsaEncryption" -#define NID_rsaEncryption 6 -#define OBJ_rsaEncryption OBJ_pkcs1,1L - -#define SN_md2WithRSAEncryption "RSA-MD2" -#define LN_md2WithRSAEncryption "md2WithRSAEncryption" -#define NID_md2WithRSAEncryption 7 -#define OBJ_md2WithRSAEncryption OBJ_pkcs1,2L - -#define SN_md5WithRSAEncryption "RSA-MD5" -#define LN_md5WithRSAEncryption "md5WithRSAEncryption" -#define NID_md5WithRSAEncryption 8 -#define OBJ_md5WithRSAEncryption OBJ_pkcs1,4L - -#define SN_sha1WithRSAEncryption "RSA-SHA1" -#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption" -#define NID_sha1WithRSAEncryption 65 -#define OBJ_sha1WithRSAEncryption OBJ_pkcs1,5L - -#define SN_pkcs3 "pkcs3" -#define NID_pkcs3 27 -#define OBJ_pkcs3 OBJ_pkcs,3L - -#define LN_dhKeyAgreement "dhKeyAgreement" -#define NID_dhKeyAgreement 28 -#define OBJ_dhKeyAgreement OBJ_pkcs3,1L - -#define SN_pkcs5 "pkcs5" -#define NID_pkcs5 187 -#define OBJ_pkcs5 OBJ_pkcs,5L - -#define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" -#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" -#define NID_pbeWithMD2AndDES_CBC 9 -#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs5,1L - -#define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" -#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" -#define NID_pbeWithMD5AndDES_CBC 10 -#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs5,3L - -#define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" -#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" -#define NID_pbeWithMD2AndRC2_CBC 168 -#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs5,4L - -#define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" -#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" -#define NID_pbeWithMD5AndRC2_CBC 169 -#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs5,6L - -#define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" -#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" -#define NID_pbeWithSHA1AndDES_CBC 170 -#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs5,10L - -#define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" -#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" -#define NID_pbeWithSHA1AndRC2_CBC 68 -#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs5,11L - -#define LN_id_pbkdf2 "PBKDF2" -#define NID_id_pbkdf2 69 -#define OBJ_id_pbkdf2 OBJ_pkcs5,12L - -#define LN_pbes2 "PBES2" -#define NID_pbes2 161 -#define OBJ_pbes2 OBJ_pkcs5,13L - -#define LN_pbmac1 "PBMAC1" -#define NID_pbmac1 162 -#define OBJ_pbmac1 OBJ_pkcs5,14L - -#define SN_pkcs7 "pkcs7" -#define NID_pkcs7 20 -#define OBJ_pkcs7 OBJ_pkcs,7L - -#define LN_pkcs7_data "pkcs7-data" -#define NID_pkcs7_data 21 -#define OBJ_pkcs7_data OBJ_pkcs7,1L - -#define LN_pkcs7_signed "pkcs7-signedData" -#define NID_pkcs7_signed 22 -#define OBJ_pkcs7_signed OBJ_pkcs7,2L - -#define LN_pkcs7_enveloped "pkcs7-envelopedData" -#define NID_pkcs7_enveloped 23 -#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L - -#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData" -#define NID_pkcs7_signedAndEnveloped 24 -#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L - -#define LN_pkcs7_digest "pkcs7-digestData" -#define NID_pkcs7_digest 25 -#define OBJ_pkcs7_digest OBJ_pkcs7,5L - -#define LN_pkcs7_encrypted "pkcs7-encryptedData" -#define NID_pkcs7_encrypted 26 -#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L - -#define SN_pkcs9 "pkcs9" -#define NID_pkcs9 47 -#define OBJ_pkcs9 OBJ_pkcs,9L - -#define SN_pkcs9_emailAddress "Email" -#define LN_pkcs9_emailAddress "emailAddress" -#define NID_pkcs9_emailAddress 48 -#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L - -#define LN_pkcs9_unstructuredName "unstructuredName" -#define NID_pkcs9_unstructuredName 49 -#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L - -#define LN_pkcs9_contentType "contentType" -#define NID_pkcs9_contentType 50 -#define OBJ_pkcs9_contentType OBJ_pkcs9,3L - -#define LN_pkcs9_messageDigest "messageDigest" -#define NID_pkcs9_messageDigest 51 -#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L - -#define LN_pkcs9_signingTime "signingTime" -#define NID_pkcs9_signingTime 52 -#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L - -#define LN_pkcs9_countersignature "countersignature" -#define NID_pkcs9_countersignature 53 -#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L - -#define LN_pkcs9_challengePassword "challengePassword" -#define NID_pkcs9_challengePassword 54 -#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L - -#define LN_pkcs9_unstructuredAddress "unstructuredAddress" -#define NID_pkcs9_unstructuredAddress 55 -#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L - -#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes" -#define NID_pkcs9_extCertAttributes 56 -#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L - -#define SN_ext_req "extReq" -#define LN_ext_req "Extension Request" -#define NID_ext_req 172 -#define OBJ_ext_req OBJ_pkcs9,14L - -#define SN_SMIMECapabilities "SMIME-CAPS" -#define LN_SMIMECapabilities "S/MIME Capabilities" -#define NID_SMIMECapabilities 167 -#define OBJ_SMIMECapabilities OBJ_pkcs9,15L - -#define SN_SMIME "SMIME" -#define LN_SMIME "S/MIME" -#define NID_SMIME 188 -#define OBJ_SMIME OBJ_pkcs9,16L - -#define SN_id_smime_mod "id-smime-mod" -#define NID_id_smime_mod 189 -#define OBJ_id_smime_mod OBJ_SMIME,0L - -#define SN_id_smime_ct "id-smime-ct" -#define NID_id_smime_ct 190 -#define OBJ_id_smime_ct OBJ_SMIME,1L - -#define SN_id_smime_aa "id-smime-aa" -#define NID_id_smime_aa 191 -#define OBJ_id_smime_aa OBJ_SMIME,2L - -#define SN_id_smime_alg "id-smime-alg" -#define NID_id_smime_alg 192 -#define OBJ_id_smime_alg OBJ_SMIME,3L - -#define SN_id_smime_cd "id-smime-cd" -#define NID_id_smime_cd 193 -#define OBJ_id_smime_cd OBJ_SMIME,4L - -#define SN_id_smime_spq "id-smime-spq" -#define NID_id_smime_spq 194 -#define OBJ_id_smime_spq OBJ_SMIME,5L - -#define SN_id_smime_cti "id-smime-cti" -#define NID_id_smime_cti 195 -#define OBJ_id_smime_cti OBJ_SMIME,6L - -#define SN_id_smime_mod_cms "id-smime-mod-cms" -#define NID_id_smime_mod_cms 196 -#define OBJ_id_smime_mod_cms OBJ_id_smime_mod,1L - -#define SN_id_smime_mod_ess "id-smime-mod-ess" -#define NID_id_smime_mod_ess 197 -#define OBJ_id_smime_mod_ess OBJ_id_smime_mod,2L - -#define SN_id_smime_mod_oid "id-smime-mod-oid" -#define NID_id_smime_mod_oid 198 -#define OBJ_id_smime_mod_oid OBJ_id_smime_mod,3L - -#define SN_id_smime_mod_msg_v3 "id-smime-mod-msg-v3" -#define NID_id_smime_mod_msg_v3 199 -#define OBJ_id_smime_mod_msg_v3 OBJ_id_smime_mod,4L - -#define SN_id_smime_mod_ets_eSignature_88 "id-smime-mod-ets-eSignature-88" -#define NID_id_smime_mod_ets_eSignature_88 200 -#define OBJ_id_smime_mod_ets_eSignature_88 OBJ_id_smime_mod,5L - -#define SN_id_smime_mod_ets_eSignature_97 "id-smime-mod-ets-eSignature-97" -#define NID_id_smime_mod_ets_eSignature_97 201 -#define OBJ_id_smime_mod_ets_eSignature_97 OBJ_id_smime_mod,6L - -#define SN_id_smime_mod_ets_eSigPolicy_88 "id-smime-mod-ets-eSigPolicy-88" -#define NID_id_smime_mod_ets_eSigPolicy_88 202 -#define OBJ_id_smime_mod_ets_eSigPolicy_88 OBJ_id_smime_mod,7L - -#define SN_id_smime_mod_ets_eSigPolicy_97 "id-smime-mod-ets-eSigPolicy-97" -#define NID_id_smime_mod_ets_eSigPolicy_97 203 -#define OBJ_id_smime_mod_ets_eSigPolicy_97 OBJ_id_smime_mod,8L - -#define SN_id_smime_ct_receipt "id-smime-ct-receipt" -#define NID_id_smime_ct_receipt 204 -#define OBJ_id_smime_ct_receipt OBJ_id_smime_ct,1L - -#define SN_id_smime_ct_authData "id-smime-ct-authData" -#define NID_id_smime_ct_authData 205 -#define OBJ_id_smime_ct_authData OBJ_id_smime_ct,2L - -#define SN_id_smime_ct_publishCert "id-smime-ct-publishCert" -#define NID_id_smime_ct_publishCert 206 -#define OBJ_id_smime_ct_publishCert OBJ_id_smime_ct,3L - -#define SN_id_smime_ct_TSTInfo "id-smime-ct-TSTInfo" -#define NID_id_smime_ct_TSTInfo 207 -#define OBJ_id_smime_ct_TSTInfo OBJ_id_smime_ct,4L - -#define SN_id_smime_ct_TDTInfo "id-smime-ct-TDTInfo" -#define NID_id_smime_ct_TDTInfo 208 -#define OBJ_id_smime_ct_TDTInfo OBJ_id_smime_ct,5L - -#define SN_id_smime_ct_contentInfo "id-smime-ct-contentInfo" -#define NID_id_smime_ct_contentInfo 209 -#define OBJ_id_smime_ct_contentInfo OBJ_id_smime_ct,6L - -#define SN_id_smime_ct_DVCSRequestData "id-smime-ct-DVCSRequestData" -#define NID_id_smime_ct_DVCSRequestData 210 -#define OBJ_id_smime_ct_DVCSRequestData OBJ_id_smime_ct,7L - -#define SN_id_smime_ct_DVCSResponseData "id-smime-ct-DVCSResponseData" -#define NID_id_smime_ct_DVCSResponseData 211 -#define OBJ_id_smime_ct_DVCSResponseData OBJ_id_smime_ct,8L - -#define SN_id_smime_aa_receiptRequest "id-smime-aa-receiptRequest" -#define NID_id_smime_aa_receiptRequest 212 -#define OBJ_id_smime_aa_receiptRequest OBJ_id_smime_aa,1L - -#define SN_id_smime_aa_securityLabel "id-smime-aa-securityLabel" -#define NID_id_smime_aa_securityLabel 213 -#define OBJ_id_smime_aa_securityLabel OBJ_id_smime_aa,2L - -#define SN_id_smime_aa_mlExpandHistory "id-smime-aa-mlExpandHistory" -#define NID_id_smime_aa_mlExpandHistory 214 -#define OBJ_id_smime_aa_mlExpandHistory OBJ_id_smime_aa,3L - -#define SN_id_smime_aa_contentHint "id-smime-aa-contentHint" -#define NID_id_smime_aa_contentHint 215 -#define OBJ_id_smime_aa_contentHint OBJ_id_smime_aa,4L - -#define SN_id_smime_aa_msgSigDigest "id-smime-aa-msgSigDigest" -#define NID_id_smime_aa_msgSigDigest 216 -#define OBJ_id_smime_aa_msgSigDigest OBJ_id_smime_aa,5L - -#define SN_id_smime_aa_encapContentType "id-smime-aa-encapContentType" -#define NID_id_smime_aa_encapContentType 217 -#define OBJ_id_smime_aa_encapContentType OBJ_id_smime_aa,6L - -#define SN_id_smime_aa_contentIdentifier "id-smime-aa-contentIdentifier" -#define NID_id_smime_aa_contentIdentifier 218 -#define OBJ_id_smime_aa_contentIdentifier OBJ_id_smime_aa,7L - -#define SN_id_smime_aa_macValue "id-smime-aa-macValue" -#define NID_id_smime_aa_macValue 219 -#define OBJ_id_smime_aa_macValue OBJ_id_smime_aa,8L - -#define SN_id_smime_aa_equivalentLabels "id-smime-aa-equivalentLabels" -#define NID_id_smime_aa_equivalentLabels 220 -#define OBJ_id_smime_aa_equivalentLabels OBJ_id_smime_aa,9L - -#define SN_id_smime_aa_contentReference "id-smime-aa-contentReference" -#define NID_id_smime_aa_contentReference 221 -#define OBJ_id_smime_aa_contentReference OBJ_id_smime_aa,10L - -#define SN_id_smime_aa_encrypKeyPref "id-smime-aa-encrypKeyPref" -#define NID_id_smime_aa_encrypKeyPref 222 -#define OBJ_id_smime_aa_encrypKeyPref OBJ_id_smime_aa,11L - -#define SN_id_smime_aa_signingCertificate "id-smime-aa-signingCertificate" -#define NID_id_smime_aa_signingCertificate 223 -#define OBJ_id_smime_aa_signingCertificate OBJ_id_smime_aa,12L - -#define SN_id_smime_aa_smimeEncryptCerts "id-smime-aa-smimeEncryptCerts" -#define NID_id_smime_aa_smimeEncryptCerts 224 -#define OBJ_id_smime_aa_smimeEncryptCerts OBJ_id_smime_aa,13L - -#define SN_id_smime_aa_timeStampToken "id-smime-aa-timeStampToken" -#define NID_id_smime_aa_timeStampToken 225 -#define OBJ_id_smime_aa_timeStampToken OBJ_id_smime_aa,14L - -#define SN_id_smime_aa_ets_sigPolicyId "id-smime-aa-ets-sigPolicyId" -#define NID_id_smime_aa_ets_sigPolicyId 226 -#define OBJ_id_smime_aa_ets_sigPolicyId OBJ_id_smime_aa,15L - -#define SN_id_smime_aa_ets_commitmentType "id-smime-aa-ets-commitmentType" -#define NID_id_smime_aa_ets_commitmentType 227 -#define OBJ_id_smime_aa_ets_commitmentType OBJ_id_smime_aa,16L - -#define SN_id_smime_aa_ets_signerLocation "id-smime-aa-ets-signerLocation" -#define NID_id_smime_aa_ets_signerLocation 228 -#define OBJ_id_smime_aa_ets_signerLocation OBJ_id_smime_aa,17L - -#define SN_id_smime_aa_ets_signerAttr "id-smime-aa-ets-signerAttr" -#define NID_id_smime_aa_ets_signerAttr 229 -#define OBJ_id_smime_aa_ets_signerAttr OBJ_id_smime_aa,18L - -#define SN_id_smime_aa_ets_otherSigCert "id-smime-aa-ets-otherSigCert" -#define NID_id_smime_aa_ets_otherSigCert 230 -#define OBJ_id_smime_aa_ets_otherSigCert OBJ_id_smime_aa,19L - -#define SN_id_smime_aa_ets_contentTimestamp "id-smime-aa-ets-contentTimestamp" -#define NID_id_smime_aa_ets_contentTimestamp 231 -#define OBJ_id_smime_aa_ets_contentTimestamp OBJ_id_smime_aa,20L - -#define SN_id_smime_aa_ets_CertificateRefs "id-smime-aa-ets-CertificateRefs" -#define NID_id_smime_aa_ets_CertificateRefs 232 -#define OBJ_id_smime_aa_ets_CertificateRefs OBJ_id_smime_aa,21L - -#define SN_id_smime_aa_ets_RevocationRefs "id-smime-aa-ets-RevocationRefs" -#define NID_id_smime_aa_ets_RevocationRefs 233 -#define OBJ_id_smime_aa_ets_RevocationRefs OBJ_id_smime_aa,22L - -#define SN_id_smime_aa_ets_certValues "id-smime-aa-ets-certValues" -#define NID_id_smime_aa_ets_certValues 234 -#define OBJ_id_smime_aa_ets_certValues OBJ_id_smime_aa,23L - -#define SN_id_smime_aa_ets_revocationValues "id-smime-aa-ets-revocationValues" -#define NID_id_smime_aa_ets_revocationValues 235 -#define OBJ_id_smime_aa_ets_revocationValues OBJ_id_smime_aa,24L - -#define SN_id_smime_aa_ets_escTimeStamp "id-smime-aa-ets-escTimeStamp" -#define NID_id_smime_aa_ets_escTimeStamp 236 -#define OBJ_id_smime_aa_ets_escTimeStamp OBJ_id_smime_aa,25L - -#define SN_id_smime_aa_ets_certCRLTimestamp "id-smime-aa-ets-certCRLTimestamp" -#define NID_id_smime_aa_ets_certCRLTimestamp 237 -#define OBJ_id_smime_aa_ets_certCRLTimestamp OBJ_id_smime_aa,26L - -#define SN_id_smime_aa_ets_archiveTimeStamp "id-smime-aa-ets-archiveTimeStamp" -#define NID_id_smime_aa_ets_archiveTimeStamp 238 -#define OBJ_id_smime_aa_ets_archiveTimeStamp OBJ_id_smime_aa,27L - -#define SN_id_smime_aa_signatureType "id-smime-aa-signatureType" -#define NID_id_smime_aa_signatureType 239 -#define OBJ_id_smime_aa_signatureType OBJ_id_smime_aa,28L - -#define SN_id_smime_aa_dvcs_dvc "id-smime-aa-dvcs-dvc" -#define NID_id_smime_aa_dvcs_dvc 240 -#define OBJ_id_smime_aa_dvcs_dvc OBJ_id_smime_aa,29L - -#define SN_id_smime_alg_ESDHwith3DES "id-smime-alg-ESDHwith3DES" -#define NID_id_smime_alg_ESDHwith3DES 241 -#define OBJ_id_smime_alg_ESDHwith3DES OBJ_id_smime_alg,1L - -#define SN_id_smime_alg_ESDHwithRC2 "id-smime-alg-ESDHwithRC2" -#define NID_id_smime_alg_ESDHwithRC2 242 -#define OBJ_id_smime_alg_ESDHwithRC2 OBJ_id_smime_alg,2L - -#define SN_id_smime_alg_3DESwrap "id-smime-alg-3DESwrap" -#define NID_id_smime_alg_3DESwrap 243 -#define OBJ_id_smime_alg_3DESwrap OBJ_id_smime_alg,3L - -#define SN_id_smime_alg_RC2wrap "id-smime-alg-RC2wrap" -#define NID_id_smime_alg_RC2wrap 244 -#define OBJ_id_smime_alg_RC2wrap OBJ_id_smime_alg,4L - -#define SN_id_smime_alg_ESDH "id-smime-alg-ESDH" -#define NID_id_smime_alg_ESDH 245 -#define OBJ_id_smime_alg_ESDH OBJ_id_smime_alg,5L - -#define SN_id_smime_alg_CMS3DESwrap "id-smime-alg-CMS3DESwrap" -#define NID_id_smime_alg_CMS3DESwrap 246 -#define OBJ_id_smime_alg_CMS3DESwrap OBJ_id_smime_alg,6L - -#define SN_id_smime_alg_CMSRC2wrap "id-smime-alg-CMSRC2wrap" -#define NID_id_smime_alg_CMSRC2wrap 247 -#define OBJ_id_smime_alg_CMSRC2wrap OBJ_id_smime_alg,7L - -#define SN_id_smime_cd_ldap "id-smime-cd-ldap" -#define NID_id_smime_cd_ldap 248 -#define OBJ_id_smime_cd_ldap OBJ_id_smime_cd,1L - -#define SN_id_smime_spq_ets_sqt_uri "id-smime-spq-ets-sqt-uri" -#define NID_id_smime_spq_ets_sqt_uri 249 -#define OBJ_id_smime_spq_ets_sqt_uri OBJ_id_smime_spq,1L - -#define SN_id_smime_spq_ets_sqt_unotice "id-smime-spq-ets-sqt-unotice" -#define NID_id_smime_spq_ets_sqt_unotice 250 -#define OBJ_id_smime_spq_ets_sqt_unotice OBJ_id_smime_spq,2L - -#define SN_id_smime_cti_ets_proofOfOrigin "id-smime-cti-ets-proofOfOrigin" -#define NID_id_smime_cti_ets_proofOfOrigin 251 -#define OBJ_id_smime_cti_ets_proofOfOrigin OBJ_id_smime_cti,1L - -#define SN_id_smime_cti_ets_proofOfReceipt "id-smime-cti-ets-proofOfReceipt" -#define NID_id_smime_cti_ets_proofOfReceipt 252 -#define OBJ_id_smime_cti_ets_proofOfReceipt OBJ_id_smime_cti,2L - -#define SN_id_smime_cti_ets_proofOfDelivery "id-smime-cti-ets-proofOfDelivery" -#define NID_id_smime_cti_ets_proofOfDelivery 253 -#define OBJ_id_smime_cti_ets_proofOfDelivery OBJ_id_smime_cti,3L - -#define SN_id_smime_cti_ets_proofOfSender "id-smime-cti-ets-proofOfSender" -#define NID_id_smime_cti_ets_proofOfSender 254 -#define OBJ_id_smime_cti_ets_proofOfSender OBJ_id_smime_cti,4L - -#define SN_id_smime_cti_ets_proofOfApproval "id-smime-cti-ets-proofOfApproval" -#define NID_id_smime_cti_ets_proofOfApproval 255 -#define OBJ_id_smime_cti_ets_proofOfApproval OBJ_id_smime_cti,5L - -#define SN_id_smime_cti_ets_proofOfCreation "id-smime-cti-ets-proofOfCreation" -#define NID_id_smime_cti_ets_proofOfCreation 256 -#define OBJ_id_smime_cti_ets_proofOfCreation OBJ_id_smime_cti,6L - -#define LN_friendlyName "friendlyName" -#define NID_friendlyName 156 -#define OBJ_friendlyName OBJ_pkcs9,20L - -#define LN_localKeyID "localKeyID" -#define NID_localKeyID 157 -#define OBJ_localKeyID OBJ_pkcs9,21L - -#define OBJ_certTypes OBJ_pkcs9,22L - -#define LN_x509Certificate "x509Certificate" -#define NID_x509Certificate 158 -#define OBJ_x509Certificate OBJ_certTypes,1L - -#define LN_sdsiCertificate "sdsiCertificate" -#define NID_sdsiCertificate 159 -#define OBJ_sdsiCertificate OBJ_certTypes,2L - -#define OBJ_crlTypes OBJ_pkcs9,23L - -#define LN_x509Crl "x509Crl" -#define NID_x509Crl 160 -#define OBJ_x509Crl OBJ_crlTypes,1L - -#define OBJ_pkcs12 OBJ_pkcs,12L - -#define OBJ_pkcs12_pbeids OBJ_pkcs12,1L - -#define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" -#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" -#define NID_pbe_WithSHA1And128BitRC4 144 -#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids,1L - -#define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" -#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" -#define NID_pbe_WithSHA1And40BitRC4 145 -#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids,2L - -#define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" -#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 -#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids,3L - -#define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" -#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" -#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 -#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids,4L - -#define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" -#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" -#define NID_pbe_WithSHA1And128BitRC2_CBC 148 -#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids,5L - -#define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" -#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" -#define NID_pbe_WithSHA1And40BitRC2_CBC 149 -#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids,6L - -#define OBJ_pkcs12_Version1 OBJ_pkcs12,10L - -#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1,1L - -#define LN_keyBag "keyBag" -#define NID_keyBag 150 -#define OBJ_keyBag OBJ_pkcs12_BagIds,1L - -#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag" -#define NID_pkcs8ShroudedKeyBag 151 -#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds,2L - -#define LN_certBag "certBag" -#define NID_certBag 152 -#define OBJ_certBag OBJ_pkcs12_BagIds,3L - -#define LN_crlBag "crlBag" -#define NID_crlBag 153 -#define OBJ_crlBag OBJ_pkcs12_BagIds,4L - -#define LN_secretBag "secretBag" -#define NID_secretBag 154 -#define OBJ_secretBag OBJ_pkcs12_BagIds,5L - -#define LN_safeContentsBag "safeContentsBag" -#define NID_safeContentsBag 155 -#define OBJ_safeContentsBag OBJ_pkcs12_BagIds,6L - -#define SN_md2 "MD2" -#define LN_md2 "md2" -#define NID_md2 3 -#define OBJ_md2 OBJ_rsadsi,2L,2L - -#define SN_md4 "MD4" -#define LN_md4 "md4" -#define NID_md4 257 -#define OBJ_md4 OBJ_rsadsi,2L,4L - -#define SN_md5 "MD5" -#define LN_md5 "md5" -#define NID_md5 4 -#define OBJ_md5 OBJ_rsadsi,2L,5L - -#define SN_md5_sha1 "MD5-SHA1" -#define LN_md5_sha1 "md5-sha1" -#define NID_md5_sha1 114 - -#define LN_hmacWithSHA1 "hmacWithSHA1" -#define NID_hmacWithSHA1 163 -#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L - -#define SN_rc2_cbc "RC2-CBC" -#define LN_rc2_cbc "rc2-cbc" -#define NID_rc2_cbc 37 -#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L - -#define SN_rc2_ecb "RC2-ECB" -#define LN_rc2_ecb "rc2-ecb" -#define NID_rc2_ecb 38 - -#define SN_rc2_cfb64 "RC2-CFB" -#define LN_rc2_cfb64 "rc2-cfb" -#define NID_rc2_cfb64 39 - -#define SN_rc2_ofb64 "RC2-OFB" -#define LN_rc2_ofb64 "rc2-ofb" -#define NID_rc2_ofb64 40 - -#define SN_rc2_40_cbc "RC2-40-CBC" -#define LN_rc2_40_cbc "rc2-40-cbc" -#define NID_rc2_40_cbc 98 - -#define SN_rc2_64_cbc "RC2-64-CBC" -#define LN_rc2_64_cbc "rc2-64-cbc" -#define NID_rc2_64_cbc 166 - -#define SN_rc4 "RC4" -#define LN_rc4 "rc4" -#define NID_rc4 5 -#define OBJ_rc4 OBJ_rsadsi,3L,4L - -#define SN_rc4_40 "RC4-40" -#define LN_rc4_40 "rc4-40" -#define NID_rc4_40 97 - -#define SN_des_ede3_cbc "DES-EDE3-CBC" -#define LN_des_ede3_cbc "des-ede3-cbc" -#define NID_des_ede3_cbc 44 -#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L - -#define SN_rc5_cbc "RC5-CBC" -#define LN_rc5_cbc "rc5-cbc" -#define NID_rc5_cbc 120 -#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L - -#define SN_rc5_ecb "RC5-ECB" -#define LN_rc5_ecb "rc5-ecb" -#define NID_rc5_ecb 121 - -#define SN_rc5_cfb64 "RC5-CFB" -#define LN_rc5_cfb64 "rc5-cfb" -#define NID_rc5_cfb64 122 - -#define SN_rc5_ofb64 "RC5-OFB" -#define LN_rc5_ofb64 "rc5-ofb" -#define NID_rc5_ofb64 123 - -#define SN_ms_ext_req "msExtReq" -#define LN_ms_ext_req "Microsoft Extension Request" -#define NID_ms_ext_req 171 -#define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L - -#define SN_ms_code_ind "msCodeInd" -#define LN_ms_code_ind "Microsoft Individual Code Signing" -#define NID_ms_code_ind 134 -#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L - -#define SN_ms_code_com "msCodeCom" -#define LN_ms_code_com "Microsoft Commercial Code Signing" -#define NID_ms_code_com 135 -#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L - -#define SN_ms_ctl_sign "msCTLSign" -#define LN_ms_ctl_sign "Microsoft Trust List Signing" -#define NID_ms_ctl_sign 136 -#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L - -#define SN_ms_sgc "msSGC" -#define LN_ms_sgc "Microsoft Server Gated Crypto" -#define NID_ms_sgc 137 -#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L - -#define SN_ms_efs "msEFS" -#define LN_ms_efs "Microsoft Encrypted File System" -#define NID_ms_efs 138 -#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L - -#define SN_idea_cbc "IDEA-CBC" -#define LN_idea_cbc "idea-cbc" -#define NID_idea_cbc 34 -#define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L - -#define SN_idea_ecb "IDEA-ECB" -#define LN_idea_ecb "idea-ecb" -#define NID_idea_ecb 36 - -#define SN_idea_cfb64 "IDEA-CFB" -#define LN_idea_cfb64 "idea-cfb" -#define NID_idea_cfb64 35 - -#define SN_idea_ofb64 "IDEA-OFB" -#define LN_idea_ofb64 "idea-ofb" -#define NID_idea_ofb64 46 - -#define SN_bf_cbc "BF-CBC" -#define LN_bf_cbc "bf-cbc" -#define NID_bf_cbc 91 -#define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L - -#define SN_bf_ecb "BF-ECB" -#define LN_bf_ecb "bf-ecb" -#define NID_bf_ecb 92 - -#define SN_bf_cfb64 "BF-CFB" -#define LN_bf_cfb64 "bf-cfb" -#define NID_bf_cfb64 93 - -#define SN_bf_ofb64 "BF-OFB" -#define LN_bf_ofb64 "bf-ofb" -#define NID_bf_ofb64 94 - -#define SN_id_pkix "PKIX" -#define NID_id_pkix 127 -#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L - -#define SN_id_pkix_mod "id-pkix-mod" -#define NID_id_pkix_mod 258 -#define OBJ_id_pkix_mod OBJ_id_pkix,0L - -#define SN_id_pe "id-pe" -#define NID_id_pe 175 -#define OBJ_id_pe OBJ_id_pkix,1L - -#define SN_id_qt "id-qt" -#define NID_id_qt 259 -#define OBJ_id_qt OBJ_id_pkix,2L - -#define SN_id_kp "id-kp" -#define NID_id_kp 128 -#define OBJ_id_kp OBJ_id_pkix,3L - -#define SN_id_it "id-it" -#define NID_id_it 260 -#define OBJ_id_it OBJ_id_pkix,4L - -#define SN_id_pkip "id-pkip" -#define NID_id_pkip 261 -#define OBJ_id_pkip OBJ_id_pkix,5L - -#define SN_id_alg "id-alg" -#define NID_id_alg 262 -#define OBJ_id_alg OBJ_id_pkix,6L - -#define SN_id_cmc "id-cmc" -#define NID_id_cmc 263 -#define OBJ_id_cmc OBJ_id_pkix,7L - -#define SN_id_on "id-on" -#define NID_id_on 264 -#define OBJ_id_on OBJ_id_pkix,8L - -#define SN_id_pda "id-pda" -#define NID_id_pda 265 -#define OBJ_id_pda OBJ_id_pkix,9L - -#define SN_id_aca "id-aca" -#define NID_id_aca 266 -#define OBJ_id_aca OBJ_id_pkix,10L - -#define SN_id_qcs "id-qcs" -#define NID_id_qcs 267 -#define OBJ_id_qcs OBJ_id_pkix,11L - -#define SN_id_cct "id-cct" -#define NID_id_cct 268 -#define OBJ_id_cct OBJ_id_pkix,12L - -#define SN_id_ad "id-ad" -#define NID_id_ad 176 -#define OBJ_id_ad OBJ_id_pkix,48L - -#define SN_id_pkix1_explicit_88 "id-pkix1-explicit-88" -#define NID_id_pkix1_explicit_88 269 -#define OBJ_id_pkix1_explicit_88 OBJ_id_pkix_mod,1L - -#define SN_id_pkix1_implicit_88 "id-pkix1-implicit-88" -#define NID_id_pkix1_implicit_88 270 -#define OBJ_id_pkix1_implicit_88 OBJ_id_pkix_mod,2L - -#define SN_id_pkix1_explicit_93 "id-pkix1-explicit-93" -#define NID_id_pkix1_explicit_93 271 -#define OBJ_id_pkix1_explicit_93 OBJ_id_pkix_mod,3L - -#define SN_id_pkix1_implicit_93 "id-pkix1-implicit-93" -#define NID_id_pkix1_implicit_93 272 -#define OBJ_id_pkix1_implicit_93 OBJ_id_pkix_mod,4L - -#define SN_id_mod_crmf "id-mod-crmf" -#define NID_id_mod_crmf 273 -#define OBJ_id_mod_crmf OBJ_id_pkix_mod,5L - -#define SN_id_mod_cmc "id-mod-cmc" -#define NID_id_mod_cmc 274 -#define OBJ_id_mod_cmc OBJ_id_pkix_mod,6L - -#define SN_id_mod_kea_profile_88 "id-mod-kea-profile-88" -#define NID_id_mod_kea_profile_88 275 -#define OBJ_id_mod_kea_profile_88 OBJ_id_pkix_mod,7L - -#define SN_id_mod_kea_profile_93 "id-mod-kea-profile-93" -#define NID_id_mod_kea_profile_93 276 -#define OBJ_id_mod_kea_profile_93 OBJ_id_pkix_mod,8L - -#define SN_id_mod_cmp "id-mod-cmp" -#define NID_id_mod_cmp 277 -#define OBJ_id_mod_cmp OBJ_id_pkix_mod,9L - -#define SN_id_mod_qualified_cert_88 "id-mod-qualified-cert-88" -#define NID_id_mod_qualified_cert_88 278 -#define OBJ_id_mod_qualified_cert_88 OBJ_id_pkix_mod,10L - -#define SN_id_mod_qualified_cert_93 "id-mod-qualified-cert-93" -#define NID_id_mod_qualified_cert_93 279 -#define OBJ_id_mod_qualified_cert_93 OBJ_id_pkix_mod,11L - -#define SN_id_mod_attribute_cert "id-mod-attribute-cert" -#define NID_id_mod_attribute_cert 280 -#define OBJ_id_mod_attribute_cert OBJ_id_pkix_mod,12L - -#define SN_id_mod_timestamp_protocol "id-mod-timestamp-protocol" -#define NID_id_mod_timestamp_protocol 281 -#define OBJ_id_mod_timestamp_protocol OBJ_id_pkix_mod,13L - -#define SN_id_mod_ocsp "id-mod-ocsp" -#define NID_id_mod_ocsp 282 -#define OBJ_id_mod_ocsp OBJ_id_pkix_mod,14L - -#define SN_id_mod_dvcs "id-mod-dvcs" -#define NID_id_mod_dvcs 283 -#define OBJ_id_mod_dvcs OBJ_id_pkix_mod,15L - -#define SN_id_mod_cmp2000 "id-mod-cmp2000" -#define NID_id_mod_cmp2000 284 -#define OBJ_id_mod_cmp2000 OBJ_id_pkix_mod,16L - -#define SN_info_access "authorityInfoAccess" -#define LN_info_access "Authority Information Access" -#define NID_info_access 177 -#define OBJ_info_access OBJ_id_pe,1L - -#define SN_biometricInfo "biometricInfo" -#define LN_biometricInfo "Biometric Info" -#define NID_biometricInfo 285 -#define OBJ_biometricInfo OBJ_id_pe,2L - -#define SN_qcStatements "qcStatements" -#define NID_qcStatements 286 -#define OBJ_qcStatements OBJ_id_pe,3L - -#define SN_ac_auditEntity "ac-auditEntity" -#define NID_ac_auditEntity 287 -#define OBJ_ac_auditEntity OBJ_id_pe,4L - -#define SN_ac_targeting "ac-targeting" -#define NID_ac_targeting 288 -#define OBJ_ac_targeting OBJ_id_pe,5L - -#define SN_aaControls "aaControls" -#define NID_aaControls 289 -#define OBJ_aaControls OBJ_id_pe,6L - -#define SN_sbqp_ipAddrBlock "sbqp-ipAddrBlock" -#define NID_sbqp_ipAddrBlock 290 -#define OBJ_sbqp_ipAddrBlock OBJ_id_pe,7L - -#define SN_sbqp_autonomousSysNum "sbqp-autonomousSysNum" -#define NID_sbqp_autonomousSysNum 291 -#define OBJ_sbqp_autonomousSysNum OBJ_id_pe,8L - -#define SN_sbqp_routerIdentifier "sbqp-routerIdentifier" -#define NID_sbqp_routerIdentifier 292 -#define OBJ_sbqp_routerIdentifier OBJ_id_pe,9L - -#define SN_id_qt_cps "id-qt-cps" -#define LN_id_qt_cps "Policy Qualifier CPS" -#define NID_id_qt_cps 164 -#define OBJ_id_qt_cps OBJ_id_qt,1L - -#define SN_id_qt_unotice "id-qt-unotice" -#define LN_id_qt_unotice "Policy Qualifier User Notice" -#define NID_id_qt_unotice 165 -#define OBJ_id_qt_unotice OBJ_id_qt,2L - -#define SN_textNotice "textNotice" -#define NID_textNotice 293 -#define OBJ_textNotice OBJ_id_qt,3L - -#define SN_server_auth "serverAuth" -#define LN_server_auth "TLS Web Server Authentication" -#define NID_server_auth 129 -#define OBJ_server_auth OBJ_id_kp,1L - -#define SN_client_auth "clientAuth" -#define LN_client_auth "TLS Web Client Authentication" -#define NID_client_auth 130 -#define OBJ_client_auth OBJ_id_kp,2L - -#define SN_code_sign "codeSigning" -#define LN_code_sign "Code Signing" -#define NID_code_sign 131 -#define OBJ_code_sign OBJ_id_kp,3L - -#define SN_email_protect "emailProtection" -#define LN_email_protect "E-mail Protection" -#define NID_email_protect 132 -#define OBJ_email_protect OBJ_id_kp,4L - -#define SN_ipsecEndSystem "ipsecEndSystem" -#define LN_ipsecEndSystem "IPSec End System" -#define NID_ipsecEndSystem 294 -#define OBJ_ipsecEndSystem OBJ_id_kp,5L - -#define SN_ipsecTunnel "ipsecTunnel" -#define LN_ipsecTunnel "IPSec Tunnel" -#define NID_ipsecTunnel 295 -#define OBJ_ipsecTunnel OBJ_id_kp,6L - -#define SN_ipsecUser "ipsecUser" -#define LN_ipsecUser "IPSec User" -#define NID_ipsecUser 296 -#define OBJ_ipsecUser OBJ_id_kp,7L - -#define SN_time_stamp "timeStamping" -#define LN_time_stamp "Time Stamping" -#define NID_time_stamp 133 -#define OBJ_time_stamp OBJ_id_kp,8L - -#define SN_OCSP_sign "OCSPSigning" -#define LN_OCSP_sign "OCSP Signing" -#define NID_OCSP_sign 180 -#define OBJ_OCSP_sign OBJ_id_kp,9L - -#define SN_dvcs "DVCS" -#define LN_dvcs "dvcs" -#define NID_dvcs 297 -#define OBJ_dvcs OBJ_id_kp,10L - -#define SN_id_it_caProtEncCert "id-it-caProtEncCert" -#define NID_id_it_caProtEncCert 298 -#define OBJ_id_it_caProtEncCert OBJ_id_it,1L - -#define SN_id_it_signKeyPairTypes "id-it-signKeyPairTypes" -#define NID_id_it_signKeyPairTypes 299 -#define OBJ_id_it_signKeyPairTypes OBJ_id_it,2L - -#define SN_id_it_encKeyPairTypes "id-it-encKeyPairTypes" -#define NID_id_it_encKeyPairTypes 300 -#define OBJ_id_it_encKeyPairTypes OBJ_id_it,3L - -#define SN_id_it_preferredSymmAlg "id-it-preferredSymmAlg" -#define NID_id_it_preferredSymmAlg 301 -#define OBJ_id_it_preferredSymmAlg OBJ_id_it,4L - -#define SN_id_it_caKeyUpdateInfo "id-it-caKeyUpdateInfo" -#define NID_id_it_caKeyUpdateInfo 302 -#define OBJ_id_it_caKeyUpdateInfo OBJ_id_it,5L - -#define SN_id_it_currentCRL "id-it-currentCRL" -#define NID_id_it_currentCRL 303 -#define OBJ_id_it_currentCRL OBJ_id_it,6L - -#define SN_id_it_unsupportedOIDs "id-it-unsupportedOIDs" -#define NID_id_it_unsupportedOIDs 304 -#define OBJ_id_it_unsupportedOIDs OBJ_id_it,7L - -#define SN_id_it_subscriptionRequest "id-it-subscriptionRequest" -#define NID_id_it_subscriptionRequest 305 -#define OBJ_id_it_subscriptionRequest OBJ_id_it,8L - -#define SN_id_it_subscriptionResponse "id-it-subscriptionResponse" -#define NID_id_it_subscriptionResponse 306 -#define OBJ_id_it_subscriptionResponse OBJ_id_it,9L - -#define SN_id_it_keyPairParamReq "id-it-keyPairParamReq" -#define NID_id_it_keyPairParamReq 307 -#define OBJ_id_it_keyPairParamReq OBJ_id_it,10L - -#define SN_id_it_keyPairParamRep "id-it-keyPairParamRep" -#define NID_id_it_keyPairParamRep 308 -#define OBJ_id_it_keyPairParamRep OBJ_id_it,11L - -#define SN_id_it_revPassphrase "id-it-revPassphrase" -#define NID_id_it_revPassphrase 309 -#define OBJ_id_it_revPassphrase OBJ_id_it,12L - -#define SN_id_it_implicitConfirm "id-it-implicitConfirm" -#define NID_id_it_implicitConfirm 310 -#define OBJ_id_it_implicitConfirm OBJ_id_it,13L - -#define SN_id_it_confirmWaitTime "id-it-confirmWaitTime" -#define NID_id_it_confirmWaitTime 311 -#define OBJ_id_it_confirmWaitTime OBJ_id_it,14L - -#define SN_id_it_origPKIMessage "id-it-origPKIMessage" -#define NID_id_it_origPKIMessage 312 -#define OBJ_id_it_origPKIMessage OBJ_id_it,15L - -#define SN_id_regCtrl "id-regCtrl" -#define NID_id_regCtrl 313 -#define OBJ_id_regCtrl OBJ_id_pkip,1L - -#define SN_id_regInfo "id-regInfo" -#define NID_id_regInfo 314 -#define OBJ_id_regInfo OBJ_id_pkip,2L - -#define SN_id_regCtrl_regToken "id-regCtrl-regToken" -#define NID_id_regCtrl_regToken 315 -#define OBJ_id_regCtrl_regToken OBJ_id_regCtrl,1L - -#define SN_id_regCtrl_authenticator "id-regCtrl-authenticator" -#define NID_id_regCtrl_authenticator 316 -#define OBJ_id_regCtrl_authenticator OBJ_id_regCtrl,2L - -#define SN_id_regCtrl_pkiPublicationInfo "id-regCtrl-pkiPublicationInfo" -#define NID_id_regCtrl_pkiPublicationInfo 317 -#define OBJ_id_regCtrl_pkiPublicationInfo OBJ_id_regCtrl,3L - -#define SN_id_regCtrl_pkiArchiveOptions "id-regCtrl-pkiArchiveOptions" -#define NID_id_regCtrl_pkiArchiveOptions 318 -#define OBJ_id_regCtrl_pkiArchiveOptions OBJ_id_regCtrl,4L - -#define SN_id_regCtrl_oldCertID "id-regCtrl-oldCertID" -#define NID_id_regCtrl_oldCertID 319 -#define OBJ_id_regCtrl_oldCertID OBJ_id_regCtrl,5L - -#define SN_id_regCtrl_protocolEncrKey "id-regCtrl-protocolEncrKey" -#define NID_id_regCtrl_protocolEncrKey 320 -#define OBJ_id_regCtrl_protocolEncrKey OBJ_id_regCtrl,6L - -#define SN_id_regInfo_utf8Pairs "id-regInfo-utf8Pairs" -#define NID_id_regInfo_utf8Pairs 321 -#define OBJ_id_regInfo_utf8Pairs OBJ_id_regInfo,1L - -#define SN_id_regInfo_certReq "id-regInfo-certReq" -#define NID_id_regInfo_certReq 322 -#define OBJ_id_regInfo_certReq OBJ_id_regInfo,2L - -#define SN_id_alg_des40 "id-alg-des40" -#define NID_id_alg_des40 323 -#define OBJ_id_alg_des40 OBJ_id_alg,1L - -#define SN_id_alg_noSignature "id-alg-noSignature" -#define NID_id_alg_noSignature 324 -#define OBJ_id_alg_noSignature OBJ_id_alg,2L - -#define SN_id_alg_dh_sig_hmac_sha1 "id-alg-dh-sig-hmac-sha1" -#define NID_id_alg_dh_sig_hmac_sha1 325 -#define OBJ_id_alg_dh_sig_hmac_sha1 OBJ_id_alg,3L - -#define SN_id_alg_dh_pop "id-alg-dh-pop" -#define NID_id_alg_dh_pop 326 -#define OBJ_id_alg_dh_pop OBJ_id_alg,4L - -#define SN_id_cmc_statusInfo "id-cmc-statusInfo" -#define NID_id_cmc_statusInfo 327 -#define OBJ_id_cmc_statusInfo OBJ_id_cmc,1L - -#define SN_id_cmc_identification "id-cmc-identification" -#define NID_id_cmc_identification 328 -#define OBJ_id_cmc_identification OBJ_id_cmc,2L - -#define SN_id_cmc_identityProof "id-cmc-identityProof" -#define NID_id_cmc_identityProof 329 -#define OBJ_id_cmc_identityProof OBJ_id_cmc,3L - -#define SN_id_cmc_dataReturn "id-cmc-dataReturn" -#define NID_id_cmc_dataReturn 330 -#define OBJ_id_cmc_dataReturn OBJ_id_cmc,4L - -#define SN_id_cmc_transactionId "id-cmc-transactionId" -#define NID_id_cmc_transactionId 331 -#define OBJ_id_cmc_transactionId OBJ_id_cmc,5L - -#define SN_id_cmc_senderNonce "id-cmc-senderNonce" -#define NID_id_cmc_senderNonce 332 -#define OBJ_id_cmc_senderNonce OBJ_id_cmc,6L - -#define SN_id_cmc_recipientNonce "id-cmc-recipientNonce" -#define NID_id_cmc_recipientNonce 333 -#define OBJ_id_cmc_recipientNonce OBJ_id_cmc,7L - -#define SN_id_cmc_addExtensions "id-cmc-addExtensions" -#define NID_id_cmc_addExtensions 334 -#define OBJ_id_cmc_addExtensions OBJ_id_cmc,8L - -#define SN_id_cmc_encryptedPOP "id-cmc-encryptedPOP" -#define NID_id_cmc_encryptedPOP 335 -#define OBJ_id_cmc_encryptedPOP OBJ_id_cmc,9L - -#define SN_id_cmc_decryptedPOP "id-cmc-decryptedPOP" -#define NID_id_cmc_decryptedPOP 336 -#define OBJ_id_cmc_decryptedPOP OBJ_id_cmc,10L - -#define SN_id_cmc_lraPOPWitness "id-cmc-lraPOPWitness" -#define NID_id_cmc_lraPOPWitness 337 -#define OBJ_id_cmc_lraPOPWitness OBJ_id_cmc,11L - -#define SN_id_cmc_getCert "id-cmc-getCert" -#define NID_id_cmc_getCert 338 -#define OBJ_id_cmc_getCert OBJ_id_cmc,15L - -#define SN_id_cmc_getCRL "id-cmc-getCRL" -#define NID_id_cmc_getCRL 339 -#define OBJ_id_cmc_getCRL OBJ_id_cmc,16L - -#define SN_id_cmc_revokeRequest "id-cmc-revokeRequest" -#define NID_id_cmc_revokeRequest 340 -#define OBJ_id_cmc_revokeRequest OBJ_id_cmc,17L - -#define SN_id_cmc_regInfo "id-cmc-regInfo" -#define NID_id_cmc_regInfo 341 -#define OBJ_id_cmc_regInfo OBJ_id_cmc,18L - -#define SN_id_cmc_responseInfo "id-cmc-responseInfo" -#define NID_id_cmc_responseInfo 342 -#define OBJ_id_cmc_responseInfo OBJ_id_cmc,19L - -#define SN_id_cmc_queryPending "id-cmc-queryPending" -#define NID_id_cmc_queryPending 343 -#define OBJ_id_cmc_queryPending OBJ_id_cmc,21L - -#define SN_id_cmc_popLinkRandom "id-cmc-popLinkRandom" -#define NID_id_cmc_popLinkRandom 344 -#define OBJ_id_cmc_popLinkRandom OBJ_id_cmc,22L - -#define SN_id_cmc_popLinkWitness "id-cmc-popLinkWitness" -#define NID_id_cmc_popLinkWitness 345 -#define OBJ_id_cmc_popLinkWitness OBJ_id_cmc,23L - -#define SN_id_cmc_confirmCertAcceptance "id-cmc-confirmCertAcceptance" -#define NID_id_cmc_confirmCertAcceptance 346 -#define OBJ_id_cmc_confirmCertAcceptance OBJ_id_cmc,24L - -#define SN_id_on_personalData "id-on-personalData" -#define NID_id_on_personalData 347 -#define OBJ_id_on_personalData OBJ_id_on,1L - -#define SN_id_pda_dateOfBirth "id-pda-dateOfBirth" -#define NID_id_pda_dateOfBirth 348 -#define OBJ_id_pda_dateOfBirth OBJ_id_pda,1L - -#define SN_id_pda_placeOfBirth "id-pda-placeOfBirth" -#define NID_id_pda_placeOfBirth 349 -#define OBJ_id_pda_placeOfBirth OBJ_id_pda,2L - -#define SN_id_pda_pseudonym "id-pda-pseudonym" -#define NID_id_pda_pseudonym 350 -#define OBJ_id_pda_pseudonym OBJ_id_pda,3L - -#define SN_id_pda_gender "id-pda-gender" -#define NID_id_pda_gender 351 -#define OBJ_id_pda_gender OBJ_id_pda,4L - -#define SN_id_pda_countryOfCitizenship "id-pda-countryOfCitizenship" -#define NID_id_pda_countryOfCitizenship 352 -#define OBJ_id_pda_countryOfCitizenship OBJ_id_pda,5L - -#define SN_id_pda_countryOfResidence "id-pda-countryOfResidence" -#define NID_id_pda_countryOfResidence 353 -#define OBJ_id_pda_countryOfResidence OBJ_id_pda,6L - -#define SN_id_aca_authenticationInfo "id-aca-authenticationInfo" -#define NID_id_aca_authenticationInfo 354 -#define OBJ_id_aca_authenticationInfo OBJ_id_aca,1L - -#define SN_id_aca_accessIdentity "id-aca-accessIdentity" -#define NID_id_aca_accessIdentity 355 -#define OBJ_id_aca_accessIdentity OBJ_id_aca,2L - -#define SN_id_aca_chargingIdentity "id-aca-chargingIdentity" -#define NID_id_aca_chargingIdentity 356 -#define OBJ_id_aca_chargingIdentity OBJ_id_aca,3L - -#define SN_id_aca_group "id-aca-group" -#define NID_id_aca_group 357 -#define OBJ_id_aca_group OBJ_id_aca,4L - -#define SN_id_aca_role "id-aca-role" -#define NID_id_aca_role 358 -#define OBJ_id_aca_role OBJ_id_aca,5L - -#define SN_id_qcs_pkixQCSyntax_v1 "id-qcs-pkixQCSyntax-v1" -#define NID_id_qcs_pkixQCSyntax_v1 359 -#define OBJ_id_qcs_pkixQCSyntax_v1 OBJ_id_qcs,1L - -#define SN_id_cct_crs "id-cct-crs" -#define NID_id_cct_crs 360 -#define OBJ_id_cct_crs OBJ_id_cct,1L - -#define SN_id_cct_PKIData "id-cct-PKIData" -#define NID_id_cct_PKIData 361 -#define OBJ_id_cct_PKIData OBJ_id_cct,2L - -#define SN_id_cct_PKIResponse "id-cct-PKIResponse" -#define NID_id_cct_PKIResponse 362 -#define OBJ_id_cct_PKIResponse OBJ_id_cct,3L - -#define SN_ad_OCSP "OCSP" -#define LN_ad_OCSP "OCSP" -#define NID_ad_OCSP 178 -#define OBJ_ad_OCSP OBJ_id_ad,1L - -#define SN_ad_ca_issuers "caIssuers" -#define LN_ad_ca_issuers "CA Issuers" -#define NID_ad_ca_issuers 179 -#define OBJ_ad_ca_issuers OBJ_id_ad,2L - -#define SN_ad_timeStamping "ad_timestamping" -#define LN_ad_timeStamping "AD Time Stamping" -#define NID_ad_timeStamping 363 -#define OBJ_ad_timeStamping OBJ_id_ad,3L - -#define SN_ad_dvcs "AD_DVCS" -#define LN_ad_dvcs "ad dvcs" -#define NID_ad_dvcs 364 -#define OBJ_ad_dvcs OBJ_id_ad,4L - -#define OBJ_id_pkix_OCSP OBJ_ad_OCSP - -#define SN_id_pkix_OCSP_basic "basicOCSPResponse" -#define LN_id_pkix_OCSP_basic "Basic OCSP Response" -#define NID_id_pkix_OCSP_basic 365 -#define OBJ_id_pkix_OCSP_basic OBJ_id_pkix_OCSP,1L - -#define SN_id_pkix_OCSP_Nonce "Nonce" -#define LN_id_pkix_OCSP_Nonce "OCSP Nonce" -#define NID_id_pkix_OCSP_Nonce 366 -#define OBJ_id_pkix_OCSP_Nonce OBJ_id_pkix_OCSP,2L - -#define SN_id_pkix_OCSP_CrlID "CrlID" -#define LN_id_pkix_OCSP_CrlID "OCSP CRL ID" -#define NID_id_pkix_OCSP_CrlID 367 -#define OBJ_id_pkix_OCSP_CrlID OBJ_id_pkix_OCSP,3L - -#define SN_id_pkix_OCSP_acceptableResponses "acceptableResponses" -#define LN_id_pkix_OCSP_acceptableResponses "Acceptable OCSP Responses" -#define NID_id_pkix_OCSP_acceptableResponses 368 -#define OBJ_id_pkix_OCSP_acceptableResponses OBJ_id_pkix_OCSP,4L - -#define SN_id_pkix_OCSP_noCheck "noCheck" -#define NID_id_pkix_OCSP_noCheck 369 -#define OBJ_id_pkix_OCSP_noCheck OBJ_id_pkix_OCSP,5L - -#define SN_id_pkix_OCSP_archiveCutoff "archiveCutoff" -#define LN_id_pkix_OCSP_archiveCutoff "OCSP Archive Cutoff" -#define NID_id_pkix_OCSP_archiveCutoff 370 -#define OBJ_id_pkix_OCSP_archiveCutoff OBJ_id_pkix_OCSP,6L - -#define SN_id_pkix_OCSP_serviceLocator "serviceLocator" -#define LN_id_pkix_OCSP_serviceLocator "OCSP Service Locator" -#define NID_id_pkix_OCSP_serviceLocator 371 -#define OBJ_id_pkix_OCSP_serviceLocator OBJ_id_pkix_OCSP,7L - -#define SN_id_pkix_OCSP_extendedStatus "extendedStatus" -#define LN_id_pkix_OCSP_extendedStatus "Extended OCSP Status" -#define NID_id_pkix_OCSP_extendedStatus 372 -#define OBJ_id_pkix_OCSP_extendedStatus OBJ_id_pkix_OCSP,8L - -#define SN_id_pkix_OCSP_valid "valid" -#define NID_id_pkix_OCSP_valid 373 -#define OBJ_id_pkix_OCSP_valid OBJ_id_pkix_OCSP,9L - -#define SN_id_pkix_OCSP_path "path" -#define NID_id_pkix_OCSP_path 374 -#define OBJ_id_pkix_OCSP_path OBJ_id_pkix_OCSP,10L - -#define SN_id_pkix_OCSP_trustRoot "trustRoot" -#define LN_id_pkix_OCSP_trustRoot "Trust Root" -#define NID_id_pkix_OCSP_trustRoot 375 -#define OBJ_id_pkix_OCSP_trustRoot OBJ_id_pkix_OCSP,11L - -#define SN_algorithm "algorithm" -#define LN_algorithm "algorithm" -#define NID_algorithm 376 -#define OBJ_algorithm 1L,3L,14L,3L,2L - -#define SN_md5WithRSA "RSA-NP-MD5" -#define LN_md5WithRSA "md5WithRSA" -#define NID_md5WithRSA 104 -#define OBJ_md5WithRSA OBJ_algorithm,3L - -#define SN_des_ecb "DES-ECB" -#define LN_des_ecb "des-ecb" -#define NID_des_ecb 29 -#define OBJ_des_ecb OBJ_algorithm,6L - -#define SN_des_cbc "DES-CBC" -#define LN_des_cbc "des-cbc" -#define NID_des_cbc 31 -#define OBJ_des_cbc OBJ_algorithm,7L - -#define SN_des_ofb64 "DES-OFB" -#define LN_des_ofb64 "des-ofb" -#define NID_des_ofb64 45 -#define OBJ_des_ofb64 OBJ_algorithm,8L - -#define SN_des_cfb64 "DES-CFB" -#define LN_des_cfb64 "des-cfb" -#define NID_des_cfb64 30 -#define OBJ_des_cfb64 OBJ_algorithm,9L - -#define SN_rsaSignature "rsaSignature" -#define NID_rsaSignature 377 -#define OBJ_rsaSignature OBJ_algorithm,11L - -#define SN_dsa_2 "DSA-old" -#define LN_dsa_2 "dsaEncryption-old" -#define NID_dsa_2 67 -#define OBJ_dsa_2 OBJ_algorithm,12L - -#define SN_dsaWithSHA "DSA-SHA" -#define LN_dsaWithSHA "dsaWithSHA" -#define NID_dsaWithSHA 66 -#define OBJ_dsaWithSHA OBJ_algorithm,13L - -#define SN_shaWithRSAEncryption "RSA-SHA" -#define LN_shaWithRSAEncryption "shaWithRSAEncryption" -#define NID_shaWithRSAEncryption 42 -#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L - -#define SN_des_ede "DES-EDE" -#define LN_des_ede "des-ede" -#define NID_des_ede 32 -#define OBJ_des_ede OBJ_algorithm,17L - -#define SN_des_ede3 "DES-EDE3" -#define LN_des_ede3 "des-ede3" -#define NID_des_ede3 33 - -#define SN_des_ede_cbc "DES-EDE-CBC" -#define LN_des_ede_cbc "des-ede-cbc" -#define NID_des_ede_cbc 43 - -#define SN_des_ede_cfb64 "DES-EDE-CFB" -#define LN_des_ede_cfb64 "des-ede-cfb" -#define NID_des_ede_cfb64 60 - -#define SN_des_ede3_cfb64 "DES-EDE3-CFB" -#define LN_des_ede3_cfb64 "des-ede3-cfb" -#define NID_des_ede3_cfb64 61 - -#define SN_des_ede_ofb64 "DES-EDE-OFB" -#define LN_des_ede_ofb64 "des-ede-ofb" -#define NID_des_ede_ofb64 62 - -#define SN_des_ede3_ofb64 "DES-EDE3-OFB" -#define LN_des_ede3_ofb64 "des-ede3-ofb" -#define NID_des_ede3_ofb64 63 - -#define SN_desx_cbc "DESX-CBC" -#define LN_desx_cbc "desx-cbc" -#define NID_desx_cbc 80 - -#define SN_sha "SHA" -#define LN_sha "sha" -#define NID_sha 41 -#define OBJ_sha OBJ_algorithm,18L - -#define SN_sha1 "SHA1" -#define LN_sha1 "sha1" -#define NID_sha1 64 -#define OBJ_sha1 OBJ_algorithm,26L - -#define SN_dsaWithSHA1_2 "DSA-SHA1-old" -#define LN_dsaWithSHA1_2 "dsaWithSHA1-old" -#define NID_dsaWithSHA1_2 70 -#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L - -#define SN_sha1WithRSA "RSA-SHA1-2" -#define LN_sha1WithRSA "sha1WithRSA" -#define NID_sha1WithRSA 115 -#define OBJ_sha1WithRSA OBJ_algorithm,29L - -#define SN_ripemd160 "RIPEMD160" -#define LN_ripemd160 "ripemd160" -#define NID_ripemd160 117 -#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L - -#define SN_ripemd160WithRSA "RSA-RIPEMD160" -#define LN_ripemd160WithRSA "ripemd160WithRSA" -#define NID_ripemd160WithRSA 119 -#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L - -#define SN_sxnet "SXNetID" -#define LN_sxnet "Strong Extranet ID" -#define NID_sxnet 143 -#define OBJ_sxnet 1L,3L,101L,1L,4L,1L - -#define SN_X500 "X500" -#define LN_X500 "directory services (X.500)" -#define NID_X500 11 -#define OBJ_X500 2L,5L - -#define SN_X509 "X509" -#define NID_X509 12 -#define OBJ_X509 OBJ_X500,4L - -#define SN_commonName "CN" -#define LN_commonName "commonName" -#define NID_commonName 13 -#define OBJ_commonName OBJ_X509,3L - -#define SN_surname "S" -#define LN_surname "surname" -#define NID_surname 100 -#define OBJ_surname OBJ_X509,4L - -#define SN_serialNumber "SN" -#define LN_serialNumber "serialNumber" -#define NID_serialNumber 105 -#define OBJ_serialNumber OBJ_X509,5L - -#define SN_countryName "C" -#define LN_countryName "countryName" -#define NID_countryName 14 -#define OBJ_countryName OBJ_X509,6L - -#define SN_localityName "L" -#define LN_localityName "localityName" -#define NID_localityName 15 -#define OBJ_localityName OBJ_X509,7L - -#define SN_stateOrProvinceName "ST" -#define LN_stateOrProvinceName "stateOrProvinceName" -#define NID_stateOrProvinceName 16 -#define OBJ_stateOrProvinceName OBJ_X509,8L - -#define SN_organizationName "O" -#define LN_organizationName "organizationName" -#define NID_organizationName 17 -#define OBJ_organizationName OBJ_X509,10L - -#define SN_organizationalUnitName "OU" -#define LN_organizationalUnitName "organizationalUnitName" -#define NID_organizationalUnitName 18 -#define OBJ_organizationalUnitName OBJ_X509,11L - -#define SN_title "T" -#define LN_title "title" -#define NID_title 106 -#define OBJ_title OBJ_X509,12L - -#define SN_description "D" -#define LN_description "description" -#define NID_description 107 -#define OBJ_description OBJ_X509,13L - -#define SN_name "name" -#define LN_name "name" -#define NID_name 173 -#define OBJ_name OBJ_X509,41L - -#define SN_givenName "G" -#define LN_givenName "givenName" -#define NID_givenName 99 -#define OBJ_givenName OBJ_X509,42L - -#define SN_initials "I" -#define LN_initials "initials" -#define NID_initials 101 -#define OBJ_initials OBJ_X509,43L - -#define SN_uniqueIdentifier "UID" -#define LN_uniqueIdentifier "uniqueIdentifier" -#define NID_uniqueIdentifier 102 -#define OBJ_uniqueIdentifier OBJ_X509,45L - -#define SN_dnQualifier "dnQualifier" -#define LN_dnQualifier "dnQualifier" -#define NID_dnQualifier 174 -#define OBJ_dnQualifier OBJ_X509,46L - -#define SN_X500algorithms "X500algorithms" -#define LN_X500algorithms "directory services - algorithms" -#define NID_X500algorithms 378 -#define OBJ_X500algorithms OBJ_X500,8L - -#define SN_rsa "RSA" -#define LN_rsa "rsa" -#define NID_rsa 19 -#define OBJ_rsa OBJ_X500algorithms,1L,1L - -#define SN_mdc2WithRSA "RSA-MDC2" -#define LN_mdc2WithRSA "mdc2WithRSA" -#define NID_mdc2WithRSA 96 -#define OBJ_mdc2WithRSA OBJ_X500algorithms,3L,100L - -#define SN_mdc2 "MDC2" -#define LN_mdc2 "mdc2" -#define NID_mdc2 95 -#define OBJ_mdc2 OBJ_X500algorithms,3L,101L - -#define SN_id_ce "id-ce" -#define NID_id_ce 81 -#define OBJ_id_ce OBJ_X500,29L - -#define SN_subject_key_identifier "subjectKeyIdentifier" -#define LN_subject_key_identifier "X509v3 Subject Key Identifier" -#define NID_subject_key_identifier 82 -#define OBJ_subject_key_identifier OBJ_id_ce,14L - -#define SN_key_usage "keyUsage" -#define LN_key_usage "X509v3 Key Usage" -#define NID_key_usage 83 -#define OBJ_key_usage OBJ_id_ce,15L - -#define SN_private_key_usage_period "privateKeyUsagePeriod" -#define LN_private_key_usage_period "X509v3 Private Key Usage Period" -#define NID_private_key_usage_period 84 -#define OBJ_private_key_usage_period OBJ_id_ce,16L - -#define SN_subject_alt_name "subjectAltName" -#define LN_subject_alt_name "X509v3 Subject Alternative Name" -#define NID_subject_alt_name 85 -#define OBJ_subject_alt_name OBJ_id_ce,17L - -#define SN_issuer_alt_name "issuerAltName" -#define LN_issuer_alt_name "X509v3 Issuer Alternative Name" -#define NID_issuer_alt_name 86 -#define OBJ_issuer_alt_name OBJ_id_ce,18L - -#define SN_basic_constraints "basicConstraints" -#define LN_basic_constraints "X509v3 Basic Constraints" -#define NID_basic_constraints 87 -#define OBJ_basic_constraints OBJ_id_ce,19L - -#define SN_crl_number "crlNumber" -#define LN_crl_number "X509v3 CRL Number" -#define NID_crl_number 88 -#define OBJ_crl_number OBJ_id_ce,20L - -#define SN_crl_reason "CRLReason" -#define LN_crl_reason "X509v3 CRL Reason Code" -#define NID_crl_reason 141 -#define OBJ_crl_reason OBJ_id_ce,21L - -#define SN_invalidity_date "invalidityDate" -#define LN_invalidity_date "Invalidity Date" -#define NID_invalidity_date 142 -#define OBJ_invalidity_date OBJ_id_ce,24L - -#define SN_delta_crl "deltaCRL" -#define LN_delta_crl "X509v3 Delta CRL Indicator" -#define NID_delta_crl 140 -#define OBJ_delta_crl OBJ_id_ce,27L - -#define SN_crl_distribution_points "crlDistributionPoints" -#define LN_crl_distribution_points "X509v3 CRL Distribution Points" -#define NID_crl_distribution_points 103 -#define OBJ_crl_distribution_points OBJ_id_ce,31L - -#define SN_certificate_policies "certificatePolicies" -#define LN_certificate_policies "X509v3 Certificate Policies" -#define NID_certificate_policies 89 -#define OBJ_certificate_policies OBJ_id_ce,32L - -#define SN_authority_key_identifier "authorityKeyIdentifier" -#define LN_authority_key_identifier "X509v3 Authority Key Identifier" -#define NID_authority_key_identifier 90 -#define OBJ_authority_key_identifier OBJ_id_ce,35L - -#define SN_ext_key_usage "extendedKeyUsage" -#define LN_ext_key_usage "X509v3 Extended Key Usage" -#define NID_ext_key_usage 126 -#define OBJ_ext_key_usage OBJ_id_ce,37L - -#define SN_netscape "Netscape" -#define LN_netscape "Netscape Communications Corp." -#define NID_netscape 57 -#define OBJ_netscape 2L,16L,840L,1L,113730L - -#define SN_netscape_cert_extension "nsCertExt" -#define LN_netscape_cert_extension "Netscape Certificate Extension" -#define NID_netscape_cert_extension 58 -#define OBJ_netscape_cert_extension OBJ_netscape,1L - -#define SN_netscape_data_type "nsDataType" -#define LN_netscape_data_type "Netscape Data Type" -#define NID_netscape_data_type 59 -#define OBJ_netscape_data_type OBJ_netscape,2L - -#define SN_netscape_cert_type "nsCertType" -#define LN_netscape_cert_type "Netscape Cert Type" -#define NID_netscape_cert_type 71 -#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L - -#define SN_netscape_base_url "nsBaseUrl" -#define LN_netscape_base_url "Netscape Base Url" -#define NID_netscape_base_url 72 -#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L - -#define SN_netscape_revocation_url "nsRevocationUrl" -#define LN_netscape_revocation_url "Netscape Revocation Url" -#define NID_netscape_revocation_url 73 -#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L - -#define SN_netscape_ca_revocation_url "nsCaRevocationUrl" -#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url" -#define NID_netscape_ca_revocation_url 74 -#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L - -#define SN_netscape_renewal_url "nsRenewalUrl" -#define LN_netscape_renewal_url "Netscape Renewal Url" -#define NID_netscape_renewal_url 75 -#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L - -#define SN_netscape_ca_policy_url "nsCaPolicyUrl" -#define LN_netscape_ca_policy_url "Netscape CA Policy Url" -#define NID_netscape_ca_policy_url 76 -#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L - -#define SN_netscape_ssl_server_name "nsSslServerName" -#define LN_netscape_ssl_server_name "Netscape SSL Server Name" -#define NID_netscape_ssl_server_name 77 -#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L - -#define SN_netscape_comment "nsComment" -#define LN_netscape_comment "Netscape Comment" -#define NID_netscape_comment 78 -#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L - -#define SN_netscape_cert_sequence "nsCertSequence" -#define LN_netscape_cert_sequence "Netscape Certificate Sequence" -#define NID_netscape_cert_sequence 79 -#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L - -#define SN_ns_sgc "nsSGC" -#define LN_ns_sgc "Netscape Server Gated Crypto" -#define NID_ns_sgc 139 -#define OBJ_ns_sgc OBJ_netscape,4L,1L - -#define SN_org "ORG" -#define LN_org "org" -#define NID_org 379 -#define OBJ_org OBJ_iso,3L - -#define SN_dod "DOD" -#define LN_dod "dod" -#define NID_dod 380 -#define OBJ_dod OBJ_org,6L - -#define SN_iana "IANA" -#define LN_iana "iana" -#define NID_iana 381 -#define OBJ_iana OBJ_dod,1L - -#define OBJ_internet OBJ_iana - -#define SN_Directory "directory" -#define LN_Directory "Directory" -#define NID_Directory 382 -#define OBJ_Directory OBJ_internet,1L - -#define SN_Management "mgmt" -#define LN_Management "Management" -#define NID_Management 383 -#define OBJ_Management OBJ_internet,2L - -#define SN_Experimental "experimental" -#define LN_Experimental "Experimental" -#define NID_Experimental 384 -#define OBJ_Experimental OBJ_internet,3L - -#define SN_Private "private" -#define LN_Private "Private" -#define NID_Private 385 -#define OBJ_Private OBJ_internet,4L - -#define SN_Security "security" -#define LN_Security "Security" -#define NID_Security 386 -#define OBJ_Security OBJ_internet,5L - -#define SN_SNMPv2 "snmpv2" -#define LN_SNMPv2 "SNMPv2" -#define NID_SNMPv2 387 -#define OBJ_SNMPv2 OBJ_internet,6L - -#define SN_Mail "mail" -#define LN_Mail "Mail" -#define NID_Mail 388 -#define OBJ_Mail OBJ_internet,7L - -#define SN_Enterprises "enterprises" -#define LN_Enterprises "Enterprises" -#define NID_Enterprises 389 -#define OBJ_Enterprises OBJ_private,1L - -#define SN_dcObject "dcobject" -#define LN_dcObject "dcObject" -#define NID_dcObject 390 -#define OBJ_dcObject OBJ_enterprises,1466L,344L - -#define SN_domainComponent "DC" -#define LN_domainComponent "domainComponent" -#define NID_domainComponent 391 -#define OBJ_domainComponent 0L,9L,2342L,19200300L,100L,1L,25L - -#define SN_Domain "domain" -#define LN_Domain "Domain" -#define NID_Domain 392 -#define OBJ_Domain 0L,9L,2342L,19200300L,100L,4L,13L - -#define SN_rle_compression "RLE" -#define LN_rle_compression "run length compression" -#define NID_rle_compression 124 -#define OBJ_rle_compression 1L,1L,1L,1L,666L,1L - -#define SN_zlib_compression "ZLIB" -#define LN_zlib_compression "zlib compression" -#define NID_zlib_compression 125 -#define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L - diff --git a/crypto/openssl/crypto/objects/obj_mac.num b/crypto/openssl/crypto/objects/obj_mac.num deleted file mode 100644 index d73a51370f76f..0000000000000 --- a/crypto/openssl/crypto/objects/obj_mac.num +++ /dev/null @@ -1,392 +0,0 @@ -undef 0 -rsadsi 1 -pkcs 2 -md2 3 -md5 4 -rc4 5 -rsaEncryption 6 -md2WithRSAEncryption 7 -md5WithRSAEncryption 8 -pbeWithMD2AndDES_CBC 9 -pbeWithMD5AndDES_CBC 10 -X500 11 -X509 12 -commonName 13 -countryName 14 -localityName 15 -stateOrProvinceName 16 -organizationName 17 -organizationalUnitName 18 -rsa 19 -pkcs7 20 -pkcs7_data 21 -pkcs7_signed 22 -pkcs7_enveloped 23 -pkcs7_signedAndEnveloped 24 -pkcs7_digest 25 -pkcs7_encrypted 26 -pkcs3 27 -dhKeyAgreement 28 -des_ecb 29 -des_cfb64 30 -des_cbc 31 -des_ede 32 -des_ede3 33 -idea_cbc 34 -idea_cfb64 35 -idea_ecb 36 -rc2_cbc 37 -rc2_ecb 38 -rc2_cfb64 39 -rc2_ofb64 40 -sha 41 -shaWithRSAEncryption 42 -des_ede_cbc 43 -des_ede3_cbc 44 -des_ofb64 45 -idea_ofb64 46 -pkcs9 47 -pkcs9_emailAddress 48 -pkcs9_unstructuredName 49 -pkcs9_contentType 50 -pkcs9_messageDigest 51 -pkcs9_signingTime 52 -pkcs9_countersignature 53 -pkcs9_challengePassword 54 -pkcs9_unstructuredAddress 55 -pkcs9_extCertAttributes 56 -netscape 57 -netscape_cert_extension 58 -netscape_data_type 59 -des_ede_cfb64 60 -des_ede3_cfb64 61 -des_ede_ofb64 62 -des_ede3_ofb64 63 -sha1 64 -sha1WithRSAEncryption 65 -dsaWithSHA 66 -dsa_2 67 -pbeWithSHA1AndRC2_CBC 68 -id_pbkdf2 69 -dsaWithSHA1_2 70 -netscape_cert_type 71 -netscape_base_url 72 -netscape_revocation_url 73 -netscape_ca_revocation_url 74 -netscape_renewal_url 75 -netscape_ca_policy_url 76 -netscape_ssl_server_name 77 -netscape_comment 78 -netscape_cert_sequence 79 -desx_cbc 80 -id_ce 81 -subject_key_identifier 82 -key_usage 83 -private_key_usage_period 84 -subject_alt_name 85 -issuer_alt_name 86 -basic_constraints 87 -crl_number 88 -certificate_policies 89 -authority_key_identifier 90 -bf_cbc 91 -bf_ecb 92 -bf_cfb64 93 -bf_ofb64 94 -mdc2 95 -mdc2WithRSA 96 -rc4_40 97 -rc2_40_cbc 98 -givenName 99 -surname 100 -initials 101 -uniqueIdentifier 102 -crl_distribution_points 103 -md5WithRSA 104 -serialNumber 105 -title 106 -description 107 -cast5_cbc 108 -cast5_ecb 109 -cast5_cfb64 110 -cast5_ofb64 111 -pbeWithMD5AndCast5_CBC 112 -dsaWithSHA1 113 -md5_sha1 114 -sha1WithRSA 115 -dsa 116 -ripemd160 117 -ripemd160WithRSA 119 -rc5_cbc 120 -rc5_ecb 121 -rc5_cfb64 122 -rc5_ofb64 123 -rle_compression 124 -zlib_compression 125 -ext_key_usage 126 -id_pkix 127 -id_kp 128 -server_auth 129 -client_auth 130 -code_sign 131 -email_protect 132 -time_stamp 133 -ms_code_ind 134 -ms_code_com 135 -ms_ctl_sign 136 -ms_sgc 137 -ms_efs 138 -ns_sgc 139 -delta_crl 140 -crl_reason 141 -invalidity_date 142 -sxnet 143 -pbe_WithSHA1And128BitRC4 144 -pbe_WithSHA1And40BitRC4 145 -pbe_WithSHA1And3_Key_TripleDES_CBC 146 -pbe_WithSHA1And2_Key_TripleDES_CBC 147 -pbe_WithSHA1And128BitRC2_CBC 148 -pbe_WithSHA1And40BitRC2_CBC 149 -keyBag 150 -pkcs8ShroudedKeyBag 151 -certBag 152 -crlBag 153 -secretBag 154 -safeContentsBag 155 -friendlyName 156 -localKeyID 157 -x509Certificate 158 -sdsiCertificate 159 -x509Crl 160 -pbes2 161 -pbmac1 162 -hmacWithSHA1 163 -id_qt_cps 164 -id_qt_unotice 165 -rc2_64_cbc 166 -SMIMECapabilities 167 -pbeWithMD2AndRC2_CBC 168 -pbeWithMD5AndRC2_CBC 169 -pbeWithSHA1AndDES_CBC 170 -ms_ext_req 171 -ext_req 172 -name 173 -dnQualifier 174 -id_pe 175 -id_ad 176 -info_access 177 -ad_OCSP 178 -ad_ca_issuers 179 -OCSP_sign 180 -iso 181 -member_body 182 -ISO_US 183 -X9_57 184 -X9cm 185 -pkcs1 186 -pkcs5 187 -SMIME 188 -id_smime_mod 189 -id_smime_ct 190 -id_smime_aa 191 -id_smime_alg 192 -id_smime_cd 193 -id_smime_spq 194 -id_smime_cti 195 -id_smime_mod_cms 196 -id_smime_mod_ess 197 -id_smime_mod_oid 198 -id_smime_mod_msg_v3 199 -id_smime_mod_ets_eSignature_88 200 -id_smime_mod_ets_eSignature_97 201 -id_smime_mod_ets_eSigPolicy_88 202 -id_smime_mod_ets_eSigPolicy_97 203 -id_smime_ct_receipt 204 -id_smime_ct_authData 205 -id_smime_ct_publishCert 206 -id_smime_ct_TSTInfo 207 -id_smime_ct_TDTInfo 208 -id_smime_ct_contentInfo 209 -id_smime_ct_DVCSRequestData 210 -id_smime_ct_DVCSResponseData 211 -id_smime_aa_receiptRequest 212 -id_smime_aa_securityLabel 213 -id_smime_aa_mlExpandHistory 214 -id_smime_aa_contentHint 215 -id_smime_aa_msgSigDigest 216 -id_smime_aa_encapContentType 217 -id_smime_aa_contentIdentifier 218 -id_smime_aa_macValue 219 -id_smime_aa_equivalentLabels 220 -id_smime_aa_contentReference 221 -id_smime_aa_encrypKeyPref 222 -id_smime_aa_signingCertificate 223 -id_smime_aa_smimeEncryptCerts 224 -id_smime_aa_timeStampToken 225 -id_smime_aa_ets_sigPolicyId 226 -id_smime_aa_ets_commitmentType 227 -id_smime_aa_ets_signerLocation 228 -id_smime_aa_ets_signerAttr 229 -id_smime_aa_ets_otherSigCert 230 -id_smime_aa_ets_contentTimestamp 231 -id_smime_aa_ets_CertificateRefs 232 -id_smime_aa_ets_RevocationRefs 233 -id_smime_aa_ets_certValues 234 -id_smime_aa_ets_revocationValues 235 -id_smime_aa_ets_escTimeStamp 236 -id_smime_aa_ets_certCRLTimestamp 237 -id_smime_aa_ets_archiveTimeStamp 238 -id_smime_aa_signatureType 239 -id_smime_aa_dvcs_dvc 240 -id_smime_alg_ESDHwith3DES 241 -id_smime_alg_ESDHwithRC2 242 -id_smime_alg_3DESwrap 243 -id_smime_alg_RC2wrap 244 -id_smime_alg_ESDH 245 -id_smime_alg_CMS3DESwrap 246 -id_smime_alg_CMSRC2wrap 247 -id_smime_cd_ldap 248 -id_smime_spq_ets_sqt_uri 249 -id_smime_spq_ets_sqt_unotice 250 -id_smime_cti_ets_proofOfOrigin 251 -id_smime_cti_ets_proofOfReceipt 252 -id_smime_cti_ets_proofOfDelivery 253 -id_smime_cti_ets_proofOfSender 254 -id_smime_cti_ets_proofOfApproval 255 -id_smime_cti_ets_proofOfCreation 256 -md4 257 -id_pkix_mod 258 -id_qt 259 -id_it 260 -id_pkip 261 -id_alg 262 -id_cmc 263 -id_on 264 -id_pda 265 -id_aca 266 -id_qcs 267 -id_cct 268 -id_pkix1_explicit_88 269 -id_pkix1_implicit_88 270 -id_pkix1_explicit_93 271 -id_pkix1_implicit_93 272 -id_mod_crmf 273 -id_mod_cmc 274 -id_mod_kea_profile_88 275 -id_mod_kea_profile_93 276 -id_mod_cmp 277 -id_mod_qualified_cert_88 278 -id_mod_qualified_cert_93 279 -id_mod_attribute_cert 280 -id_mod_timestamp_protocol 281 -id_mod_ocsp 282 -id_mod_dvcs 283 -id_mod_cmp2000 284 -biometricInfo 285 -qcStatements 286 -ac_auditEntity 287 -ac_targeting 288 -aaControls 289 -sbqp_ipAddrBlock 290 -sbqp_autonomousSysNum 291 -sbqp_routerIdentifier 292 -textNotice 293 -ipsecEndSystem 294 -ipsecTunnel 295 -ipsecUser 296 -dvcs 297 -id_it_caProtEncCert 298 -id_it_signKeyPairTypes 299 -id_it_encKeyPairTypes 300 -id_it_preferredSymmAlg 301 -id_it_caKeyUpdateInfo 302 -id_it_currentCRL 303 -id_it_unsupportedOIDs 304 -id_it_subscriptionRequest 305 -id_it_subscriptionResponse 306 -id_it_keyPairParamReq 307 -id_it_keyPairParamRep 308 -id_it_revPassphrase 309 -id_it_implicitConfirm 310 -id_it_confirmWaitTime 311 -id_it_origPKIMessage 312 -id_regCtrl 313 -id_regInfo 314 -id_regCtrl_regToken 315 -id_regCtrl_authenticator 316 -id_regCtrl_pkiPublicationInfo 317 -id_regCtrl_pkiArchiveOptions 318 -id_regCtrl_oldCertID 319 -id_regCtrl_protocolEncrKey 320 -id_regInfo_utf8Pairs 321 -id_regInfo_certReq 322 -id_alg_des40 323 -id_alg_noSignature 324 -id_alg_dh_sig_hmac_sha1 325 -id_alg_dh_pop 326 -id_cmc_statusInfo 327 -id_cmc_identification 328 -id_cmc_identityProof 329 -id_cmc_dataReturn 330 -id_cmc_transactionId 331 -id_cmc_senderNonce 332 -id_cmc_recipientNonce 333 -id_cmc_addExtensions 334 -id_cmc_encryptedPOP 335 -id_cmc_decryptedPOP 336 -id_cmc_lraPOPWitness 337 -id_cmc_getCert 338 -id_cmc_getCRL 339 -id_cmc_revokeRequest 340 -id_cmc_regInfo 341 -id_cmc_responseInfo 342 -id_cmc_queryPending 343 -id_cmc_popLinkRandom 344 -id_cmc_popLinkWitness 345 -id_cmc_confirmCertAcceptance 346 -id_on_personalData 347 -id_pda_dateOfBirth 348 -id_pda_placeOfBirth 349 -id_pda_pseudonym 350 -id_pda_gender 351 -id_pda_countryOfCitizenship 352 -id_pda_countryOfResidence 353 -id_aca_authenticationInfo 354 -id_aca_accessIdentity 355 -id_aca_chargingIdentity 356 -id_aca_group 357 -id_aca_role 358 -id_qcs_pkixQCSyntax_v1 359 -id_cct_crs 360 -id_cct_PKIData 361 -id_cct_PKIResponse 362 -ad_timeStamping 363 -ad_dvcs 364 -id_pkix_OCSP_basic 365 -id_pkix_OCSP_Nonce 366 -id_pkix_OCSP_CrlID 367 -id_pkix_OCSP_acceptableResponses 368 -id_pkix_OCSP_noCheck 369 -id_pkix_OCSP_archiveCutoff 370 -id_pkix_OCSP_serviceLocator 371 -id_pkix_OCSP_extendedStatus 372 -id_pkix_OCSP_valid 373 -id_pkix_OCSP_path 374 -id_pkix_OCSP_trustRoot 375 -algorithm 376 -rsaSignature 377 -X500algorithms 378 -org 379 -dod 380 -iana 381 -Directory 382 -Management 383 -Experimental 384 -Private 385 -Security 386 -SNMPv2 387 -Mail 388 -Enterprises 389 -dcObject 390 -domainComponent 391 -Domain 392 diff --git a/crypto/openssl/crypto/objects/objects.README b/crypto/openssl/crypto/objects/objects.README deleted file mode 100644 index 4d745508d830d..0000000000000 --- a/crypto/openssl/crypto/objects/objects.README +++ /dev/null @@ -1,44 +0,0 @@ -objects.txt syntax ------------------- - -To cover all the naming hacks that were previously in objects.h needed some -kind of hacks in objects.txt. - -The basic syntax for adding an object is as follows: - - 1 2 3 4 : shortName : Long Name - - If the long name doesn't contain spaces, or no short name - exists, the long name is used as basis for the base name - in C. Otherwise, the short name is used. - - The base name (let's call it 'base') will then be used to - create the C macros SN_base, LN_base, NID_base and OBJ_base. - - Note that if the base name contains spaces, dashes or periods, - those will be converte to underscore. - -Then there are some extra commands: - - !Alias foo 1 2 3 4 - - This juts makes a name foo for an OID. The C macro - OBJ_foo will be created as a result. - - !Cname foo - - This makes sure that the name foo will be used as base name - in C. - - !module foo - 1 2 3 4 : shortName : Long Name - !global - - The !module command was meant to define a kind of modularity. - What it does is to make sure the module name is prepended - to the base name. !global turns this off. This construction - is not recursive. - -Lines starting with # are treated as comments, as well as any line starting -with ! and not matching the commands above. - diff --git a/crypto/openssl/crypto/objects/objects.pl b/crypto/openssl/crypto/objects/objects.pl deleted file mode 100644 index c956bbb841e0f..0000000000000 --- a/crypto/openssl/crypto/objects/objects.pl +++ /dev/null @@ -1,224 +0,0 @@ -#!/usr/local/bin/perl - -open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]"; -$max_nid=0; -$o=0; -while(<NUMIN>) - { - chop; - $o++; - s/#.*$//; - next if /^\s*$/; - ($Cname,$mynum) = split; - if (defined($nidn{$mynum})) - { die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; } - $nid{$Cname} = $mynum; - $nidn{$mynum} = $Cname; - $order{$mynum} = $o; - $max_nid = $mynum if $mynum > $max_nid; - } -close NUMIN; - -open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]"; -$Cname=""; -$o=0; -while (<IN>) - { - chop; - $o++; - if (/^!module\s+(.*)$/) - { - $module = $1."-"; - $module =~ s/\./_/g; - $module =~ s/-/_/g; - } - if (/^!global$/) - { $module = ""; } - if (/^!Cname\s+(.*)$/) - { $Cname = $1; } - if (/^!Alias\s+(.+?)\s+(.*)$/) - { - $Cname = $module.$1; - $myoid = $2; - $myoid = &process_oid($myoid); - $Cname =~ s/-/_/g; - $ordern{$o} = $Cname; - $order{$Cname} = $o; - $obj{$Cname} = $myoid; - $_ = ""; - $Cname = ""; - } - s/!.*$//; - s/#.*$//; - next if /^\s*$/; - ($myoid,$mysn,$myln) = split ':'; - $mysn =~ s/^\s*//; - $mysn =~ s/\s*$//; - $myln =~ s/^\s*//; - $myln =~ s/\s*$//; - $myoid =~ s/^\s*//; - $myoid =~ s/\s*$//; - if ($myoid ne "") - { - $myoid = &process_oid($myoid); - } - - if ($Cname eq "" && !($myln =~ / /)) - { - $Cname = $myln; - $Cname =~ s/\./_/g; - $Cname =~ s/-/_/g; - if ($Cname ne "" && defined($ln{$module.$Cname})) - { die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; } - } - if ($Cname eq "") - { - $Cname = $mysn; - $Cname =~ s/-/_/g; - if ($Cname ne "" && defined($sn{$module.$Cname})) - { die "objects.txt:$o:There's already an object with short name ",$sn{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; } - } - if ($Cname eq "") - { - $Cname = $myln; - $Cname =~ s/-/_/g; - $Cname =~ s/\./_/g; - $Cname =~ s/ /_/g; - if ($Cname ne "" && defined($ln{$module.$Cname})) - { die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; } - } - $Cname =~ s/\./_/g; - $Cname =~ s/-/_/g; - $Cname = $module.$Cname; - $ordern{$o} = $Cname; - $order{$Cname} = $o; - $sn{$Cname} = $mysn; - $ln{$Cname} = $myln; - $obj{$Cname} = $myoid; - if (!defined($nid{$Cname})) - { - $max_nid++; - $nid{$Cname} = $max_nid; - $nidn{$max_nid} = $Cname; - } - $Cname=""; - } -close IN; - -open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; -foreach (sort { $a <=> $b } keys %nidn) - { - print NUMOUT $nidn{$_},"\t\t",$_,"\n"; - } -close NUMOUT; - -open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]"; -print OUT <<'EOF'; -/* lib/obj/obj_mac.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the - * following command: - * perl objects.pl objects.txt obj_mac.num obj_mac.h - */ - -#define SN_undef "UNDEF" -#define LN_undef "undefined" -#define NID_undef 0 -#define OBJ_undef 0L - -EOF - -foreach (sort { $a <=> $b } keys %ordern) - { - $Cname=$ordern{$_}; - print OUT "#define SN_",$Cname,"\t\t\"",$sn{$Cname},"\"\n" if $sn{$Cname} ne ""; - print OUT "#define LN_",$Cname,"\t\t\"",$ln{$Cname},"\"\n" if $ln{$Cname} ne ""; - print OUT "#define NID_",$Cname,"\t\t",$nid{$Cname},"\n" if $nid{$Cname} ne ""; - print OUT "#define OBJ_",$Cname,"\t\t",$obj{$Cname},"\n" if $obj{$Cname} ne ""; - print OUT "\n"; - } - -close OUT; - -sub process_oid - { - local($oid)=@_; - local(@a,$oid_pref); - - @a = split(/\s+/,$myoid); - $pref_oid = ""; - $pref_sep = ""; - if (!($a[0] =~ /^[0-9]+$/)) - { - $a[0] =~ s/-/_/g; - $pref_oid = "OBJ_" . $a[0]; - $pref_sep = ","; - shift @a; - } - $oids = join('L,',@a) . "L"; - if ($oids ne "L") - { - $oids = $pref_oid . $pref_sep . $oids; - } - else - { - $oids = $pref_oid; - } - return($oids); - } diff --git a/crypto/openssl/crypto/rand/rand_lcl.h b/crypto/openssl/crypto/rand/rand_lcl.h deleted file mode 100755 index 120e9366d2e16..0000000000000 --- a/crypto/openssl/crypto/rand/rand_lcl.h +++ /dev/null @@ -1,184 +0,0 @@ -/* crypto/rand/md_rand.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ -/* ==================================================================== - * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#ifndef HEADER_RAND_LCL_H -#define HEADER_RAND_LCL_H - -#define ENTROPY_NEEDED 20 /* require 160 bits = 20 bytes of randomness */ - - -#if !defined(USE_MD5_RAND) && !defined(USE_SHA1_RAND) && !defined(USE_MDC2_RAND) && !defined(USE_MD2_RAND) -#if !defined(NO_SHA) && !defined(NO_SHA1) -#define USE_SHA1_RAND -#elif !defined(NO_MD5) -#define USE_MD5_RAND -#elif !defined(NO_MDC2) && !defined(NO_DES) -#define USE_MDC2_RAND -#elif !defined(NO_MD2) -#define USE_MD2_RAND -#else -#error No message digest algorithm available -#endif -#endif - -#if defined(USE_MD5_RAND) -#include <openssl/md5.h> -#define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH -#define MD(a,b,c) MD5(a,b,c) -#elif defined(USE_SHA1_RAND) -#include <openssl/sha.h> -#define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH -#define MD(a,b,c) SHA1(a,b,c) -#elif defined(USE_MDC2_RAND) -#include <openssl/mdc2.h> -#define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH -#define MD(a,b,c) MDC2(a,b,c) -#elif defined(USE_MD2_RAND) -#include <openssl/md2.h> -#define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH -#define MD(a,b,c) MD2(a,b,c) -#endif -#if defined(USE_MD5_RAND) -#include <openssl/md5.h> -#define MD_DIGEST_LENGTH MD5_DIGEST_LENGTH -#define MD_CTX MD5_CTX -#define MD_Init(a) MD5_Init(a) -#define MD_Update(a,b,c) MD5_Update(a,b,c) -#define MD_Final(a,b) MD5_Final(a,b) -#define MD(a,b,c) MD5(a,b,c) -#elif defined(USE_SHA1_RAND) -#include <openssl/sha.h> -#define MD_DIGEST_LENGTH SHA_DIGEST_LENGTH -#define MD_CTX SHA_CTX -#define MD_Init(a) SHA1_Init(a) -#define MD_Update(a,b,c) SHA1_Update(a,b,c) -#define MD_Final(a,b) SHA1_Final(a,b) -#define MD(a,b,c) SHA1(a,b,c) -#elif defined(USE_MDC2_RAND) -#include <openssl/mdc2.h> -#define MD_DIGEST_LENGTH MDC2_DIGEST_LENGTH -#define MD_CTX MDC2_CTX -#define MD_Init(a) MDC2_Init(a) -#define MD_Update(a,b,c) MDC2_Update(a,b,c) -#define MD_Final(a,b) MDC2_Final(a,b) -#define MD(a,b,c) MDC2(a,b,c) -#elif defined(USE_MD2_RAND) -#include <openssl/md2.h> -#define MD_DIGEST_LENGTH MD2_DIGEST_LENGTH -#define MD_CTX MD2_CTX -#define MD_Init(a) MD2_Init(a) -#define MD_Update(a,b,c) MD2_Update(a,b,c) -#define MD_Final(a,b) MD2_Final(a,b) -#define MD(a,b,c) MD2(a,b,c) -#endif - - -#endif diff --git a/crypto/openssl/crypto/rand/rand_win.c b/crypto/openssl/crypto/rand/rand_win.c deleted file mode 100644 index 9f2dcff9a92bf..0000000000000 --- a/crypto/openssl/crypto/rand/rand_win.c +++ /dev/null @@ -1,732 +0,0 @@ -/* crypto/rand/rand_win.c */ -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ -/* ==================================================================== - * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#include "cryptlib.h" -#include <openssl/rand.h> -#include "rand_lcl.h" - -#if defined(WINDOWS) || defined(WIN32) -#include <windows.h> -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0400 -#endif -#include <wincrypt.h> -#include <tlhelp32.h> - -/* Intel hardware RNG CSP -- available from - * http://developer.intel.com/design/security/rng/redist_license.htm - */ -#define PROV_INTEL_SEC 22 -#define INTEL_DEF_PROV "Intel Hardware Cryptographic Service Provider" - -static void readtimer(void); -static void readscreen(void); - -/* It appears like CURSORINFO, PCURSORINFO and LPCURSORINFO are only defined - when WINVER is 0x0500 and up, which currently only happens on Win2000. - Unfortunately, those are typedefs, so they're a little bit difficult to - detect properly. On the other hand, the macro CURSOR_SHOWING is defined - within the same conditional, so it can be use to detect the absence of said - typedefs. */ - -#ifndef CURSOR_SHOWING -/* - * Information about the global cursor. - */ -typedef struct tagCURSORINFO -{ - DWORD cbSize; - DWORD flags; - HCURSOR hCursor; - POINT ptScreenPos; -} CURSORINFO, *PCURSORINFO, *LPCURSORINFO; - -#define CURSOR_SHOWING 0x00000001 -#endif /* CURSOR_SHOWING */ - -typedef BOOL (WINAPI *CRYPTACQUIRECONTEXT)(HCRYPTPROV *, LPCTSTR, LPCTSTR, - DWORD, DWORD); -typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV, DWORD, BYTE *); -typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV, DWORD); - -typedef HWND (WINAPI *GETFOREGROUNDWINDOW)(VOID); -typedef BOOL (WINAPI *GETCURSORINFO)(PCURSORINFO); -typedef DWORD (WINAPI *GETQUEUESTATUS)(UINT); - -typedef HANDLE (WINAPI *CREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); -typedef BOOL (WINAPI *HEAP32FIRST)(LPHEAPENTRY32, DWORD, DWORD); -typedef BOOL (WINAPI *HEAP32NEXT)(LPHEAPENTRY32); -typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32); -typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32); -typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32); -typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32); - -#include <lmcons.h> -#include <lmstats.h> -#if 1 /* The NET API is Unicode only. It requires the use of the UNICODE - * macro. When UNICODE is defined LPTSTR becomes LPWSTR. LMSTR was - * was added to the Platform SDK to allow the NET API to be used in - * non-Unicode applications provided that Unicode strings were still - * used for input. LMSTR is defined as LPWSTR. - */ -typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET) - (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*); -typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE); -#endif /* 1 */ - -int RAND_poll(void) -{ - MEMORYSTATUS m; - HCRYPTPROV hProvider = 0; - BYTE buf[64]; - DWORD w; - HWND h; - - HMODULE advapi, kernel, user, netapi; - CRYPTACQUIRECONTEXT acquire = 0; - CRYPTGENRANDOM gen = 0; - CRYPTRELEASECONTEXT release = 0; -#if 1 /* There was previously a problem with NETSTATGET. Currently, this - * section is still experimental, but if all goes well, this conditional - * will be removed - */ - NETSTATGET netstatget = 0; - NETFREE netfree = 0; -#endif /* 1 */ - - /* Determine the OS version we are on so we can turn off things - * that do not work properly. - */ - OSVERSIONINFO osverinfo ; - osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ; - GetVersionEx( &osverinfo ) ; - - /* load functions dynamically - not available on all systems */ - advapi = LoadLibrary("ADVAPI32.DLL"); - kernel = LoadLibrary("KERNEL32.DLL"); - user = LoadLibrary("USER32.DLL"); - netapi = LoadLibrary("NETAPI32.DLL"); - -#if 1 /* There was previously a problem with NETSTATGET. Currently, this - * section is still experimental, but if all goes well, this conditional - * will be removed - */ - if (netapi) - { - netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet"); - netfree = (NETFREE) GetProcAddress(netapi,"NetApiBufferFree"); - } - - if (netstatget && netfree) - { - LPBYTE outbuf; - /* NetStatisticsGet() is a Unicode only function - * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0 - * contains 17 fields. We treat each field as a source of - * one byte of entropy. - */ - - if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) == 0) - { - RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45); - netfree(outbuf); - } - if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) == 0) - { - RAND_add(outbuf, sizeof(STAT_SERVER_0), 17); - netfree(outbuf); - } - } - - if (netapi) - FreeLibrary(netapi); -#endif /* 1 */ - - /* It appears like this can cause an exception deep within ADVAPI32.DLL - * at random times on Windows 2000. Reported by Jeffrey Altman. - * Only use it on NT. - */ - if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && - osverinfo.dwMajorVersion < 5) - { - /* Read Performance Statistics from NT/2000 registry - * The size of the performance data can vary from call - * to call so we must guess the size of the buffer to use - * and increase its size if we get an ERROR_MORE_DATA - * return instead of ERROR_SUCCESS. - */ - LONG rc=ERROR_MORE_DATA; - char * buf=NULL; - DWORD bufsz=0; - DWORD length; - - while (rc == ERROR_MORE_DATA) - { - buf = realloc(buf,bufsz+8192); - if (!buf) - break; - bufsz += 8192; - - length = bufsz; - rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global", - NULL, NULL, buf, &length); - } - if (rc == ERROR_SUCCESS) - { - /* For entropy count assume only least significant - * byte of each DWORD is random. - */ - RAND_add(&length, sizeof(length), 0); - RAND_add(buf, length, length / 4.0); - } - if (buf) - free(buf); - } - - if (advapi) - { - acquire = (CRYPTACQUIRECONTEXT) GetProcAddress(advapi, - "CryptAcquireContextA"); - gen = (CRYPTGENRANDOM) GetProcAddress(advapi, - "CryptGenRandom"); - release = (CRYPTRELEASECONTEXT) GetProcAddress(advapi, - "CryptReleaseContext"); - } - - if (acquire && gen && release) - { - /* poll the CryptoAPI PRNG */ - /* The CryptoAPI returns sizeof(buf) bytes of randomness */ - if (acquire(&hProvider, 0, 0, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT)) - { - if (gen(hProvider, sizeof(buf), buf) != 0) - { - RAND_add(buf, sizeof(buf), sizeof(buf)); -#ifdef DEBUG - printf("randomness from PROV_RSA_FULL\n"); -#endif - } - release(hProvider, 0); - } - - /* poll the Pentium PRG with CryptoAPI */ - if (acquire(&hProvider, 0, INTEL_DEF_PROV, PROV_INTEL_SEC, 0)) - { - if (gen(hProvider, sizeof(buf), buf) != 0) - { - RAND_add(buf, sizeof(buf), sizeof(buf)); -#ifdef DEBUG - printf("randomness from PROV_INTEL_SEC\n"); -#endif - } - release(hProvider, 0); - } - } - - if (advapi) - FreeLibrary(advapi); - - /* timer data */ - readtimer(); - - /* memory usage statistics */ - GlobalMemoryStatus(&m); - RAND_add(&m, sizeof(m), 1); - - /* process ID */ - w = GetCurrentProcessId(); - RAND_add(&w, sizeof(w), 1); - - if (user) - { - GETCURSORINFO cursor; - GETFOREGROUNDWINDOW win; - GETQUEUESTATUS queue; - - win = (GETFOREGROUNDWINDOW) GetProcAddress(user, "GetForegroundWindow"); - cursor = (GETCURSORINFO) GetProcAddress(user, "GetCursorInfo"); - queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus"); - - if (win) - { - /* window handle */ - h = win(); - RAND_add(&h, sizeof(h), 0); - } - if (cursor) - { - /* unfortunately, its not safe to call GetCursorInfo() - * on NT4 even though it exists in SP3 (or SP6) and - * higher. - */ - if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT && - osverinfo.dwMajorVersion < 5) - cursor = 0; - } - if (cursor) - { - /* cursor position */ - /* assume 2 bytes of entropy */ - CURSORINFO ci; - ci.cbSize = sizeof(CURSORINFO); - if (cursor(&ci)) - RAND_add(&ci, ci.cbSize, 2); - } - - if (queue) - { - /* message queue status */ - /* assume 1 byte of entropy */ - w = queue(QS_ALLEVENTS); - RAND_add(&w, sizeof(w), 1); - } - - FreeLibrary(user); - } - - /* Toolhelp32 snapshot: enumerate processes, threads, modules and heap - * http://msdn.microsoft.com/library/psdk/winbase/toolhelp_5pfd.htm - * (Win 9x and 2000 only, not available on NT) - * - * This seeding method was proposed in Peter Gutmann, Software - * Generation of Practically Strong Random Numbers, - * http://www.usenix.org/publications/library/proceedings/sec98/gutmann.html - * revised version at http://www.cryptoengines.com/~peter/06_random.pdf - * (The assignment of entropy estimates below is arbitrary, but based - * on Peter's analysis the full poll appears to be safe. Additional - * interactive seeding is encouraged.) - */ - - if (kernel) - { - CREATETOOLHELP32SNAPSHOT snap; - HANDLE handle; - - HEAP32FIRST heap_first; - HEAP32NEXT heap_next; - HEAP32LIST heaplist_first, heaplist_next; - PROCESS32 process_first, process_next; - THREAD32 thread_first, thread_next; - MODULE32 module_first, module_next; - - HEAPLIST32 hlist; - HEAPENTRY32 hentry; - PROCESSENTRY32 p; - THREADENTRY32 t; - MODULEENTRY32 m; - - snap = (CREATETOOLHELP32SNAPSHOT) - GetProcAddress(kernel, "CreateToolhelp32Snapshot"); - heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First"); - heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next"); - heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst"); - heaplist_next = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListNext"); - process_first = (PROCESS32) GetProcAddress(kernel, "Process32First"); - process_next = (PROCESS32) GetProcAddress(kernel, "Process32Next"); - thread_first = (THREAD32) GetProcAddress(kernel, "Thread32First"); - thread_next = (THREAD32) GetProcAddress(kernel, "Thread32Next"); - module_first = (MODULE32) GetProcAddress(kernel, "Module32First"); - module_next = (MODULE32) GetProcAddress(kernel, "Module32Next"); - - if (snap && heap_first && heap_next && heaplist_first && - heaplist_next && process_first && process_next && - thread_first && thread_next && module_first && - module_next && (handle = snap(TH32CS_SNAPALL,0)) - != NULL) - { - /* heap list and heap walking */ - /* HEAPLIST32 contains 3 fields that will change with - * each entry. Consider each field a source of 1 byte - * of entropy. - * HEAPENTRY32 contains 5 fields that will change with - * each entry. Consider each field a source of 1 byte - * of entropy. - */ - hlist.dwSize = sizeof(HEAPLIST32); - if (heaplist_first(handle, &hlist)) - do - { - RAND_add(&hlist, hlist.dwSize, 3); - hentry.dwSize = sizeof(HEAPENTRY32); - if (heap_first(&hentry, - hlist.th32ProcessID, - hlist.th32HeapID)) - { - int entrycnt = 50; - do - RAND_add(&hentry, - hentry.dwSize, 5); - while (heap_next(&hentry) - && --entrycnt > 0); - } - } while (heaplist_next(handle, - &hlist)); - - /* process walking */ - /* PROCESSENTRY32 contains 9 fields that will change - * with each entry. Consider each field a source of - * 1 byte of entropy. - */ - p.dwSize = sizeof(PROCESSENTRY32); - if (process_first(handle, &p)) - do - RAND_add(&p, p.dwSize, 9); - while (process_next(handle, &p)); - - /* thread walking */ - /* THREADENTRY32 contains 6 fields that will change - * with each entry. Consider each field a source of - * 1 byte of entropy. - */ - t.dwSize = sizeof(THREADENTRY32); - if (thread_first(handle, &t)) - do - RAND_add(&t, t.dwSize, 6); - while (thread_next(handle, &t)); - - /* module walking */ - /* MODULEENTRY32 contains 9 fields that will change - * with each entry. Consider each field a source of - * 1 byte of entropy. - */ - m.dwSize = sizeof(MODULEENTRY32); - if (module_first(handle, &m)) - do - RAND_add(&m, m.dwSize, 9); - while (module_next(handle, &m)); - - CloseHandle(handle); - } - - FreeLibrary(kernel); - } - -#ifdef DEBUG - printf("Exiting RAND_poll\n"); -#endif - - return(1); -} - -int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam) - { - double add_entropy=0; - - switch (iMsg) - { - case WM_KEYDOWN: - { - static WPARAM key; - if (key != wParam) - add_entropy = 0.05; - key = wParam; - } - break; - case WM_MOUSEMOVE: - { - static int lastx,lasty,lastdx,lastdy; - int x,y,dx,dy; - - x=LOWORD(lParam); - y=HIWORD(lParam); - dx=lastx-x; - dy=lasty-y; - if (dx != 0 && dy != 0 && dx-lastdx != 0 && dy-lastdy != 0) - add_entropy=.2; - lastx=x, lasty=y; - lastdx=dx, lastdy=dy; - } - break; - } - - readtimer(); - RAND_add(&iMsg, sizeof(iMsg), add_entropy); - RAND_add(&wParam, sizeof(wParam), 0); - RAND_add(&lParam, sizeof(lParam), 0); - - return (RAND_status()); - } - - -void RAND_screen(void) /* function available for backward compatibility */ -{ - RAND_poll(); - readscreen(); -} - - -/* feed timing information to the PRNG */ -static void readtimer(void) -{ - DWORD w; - LARGE_INTEGER l; - static int have_perfc = 1; -#ifndef __GNUC__ - static int have_tsc = 1; - DWORD cyclecount; - - if (have_tsc) { - __try { - __asm { - rdtsc - mov cyclecount, eax - } - RAND_add(&cyclecount, sizeof(cyclecount), 1); - } __except(EXCEPTION_EXECUTE_HANDLER) { - have_tsc = 0; - } - } -#else -# define have_tsc 0 -#endif - - if (have_perfc) { - if (QueryPerformanceCounter(&l) == 0) - have_perfc = 0; - else - RAND_add(&l, sizeof(l), 0); - } - - if (!have_tsc && !have_perfc) { - w = GetTickCount(); - RAND_add(&w, sizeof(w), 0); - } -} - -/* feed screen contents to PRNG */ -/***************************************************************************** - * - * Created 960901 by Gertjan van Oosten, gertjan@West.NL, West Consulting B.V. - * - * Code adapted from - * <URL:http://www.microsoft.com/kb/developr/win_dk/q97193.htm>; - * the original copyright message is: - * - * (C) Copyright Microsoft Corp. 1993. All rights reserved. - * - * You have a royalty-free right to use, modify, reproduce and - * distribute the Sample Files (and/or any modified version) in - * any way you find useful, provided that you agree that - * Microsoft has no warranty obligations or liability for any - * Sample Application Files which are modified. - */ - -static void readscreen(void) -{ - HDC hScrDC; /* screen DC */ - HDC hMemDC; /* memory DC */ - HBITMAP hBitmap; /* handle for our bitmap */ - HBITMAP hOldBitmap; /* handle for previous bitmap */ - BITMAP bm; /* bitmap properties */ - unsigned int size; /* size of bitmap */ - char *bmbits; /* contents of bitmap */ - int w; /* screen width */ - int h; /* screen height */ - int y; /* y-coordinate of screen lines to grab */ - int n = 16; /* number of screen lines to grab at a time */ - - /* Create a screen DC and a memory DC compatible to screen DC */ - hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL); - hMemDC = CreateCompatibleDC(hScrDC); - - /* Get screen resolution */ - w = GetDeviceCaps(hScrDC, HORZRES); - h = GetDeviceCaps(hScrDC, VERTRES); - - /* Create a bitmap compatible with the screen DC */ - hBitmap = CreateCompatibleBitmap(hScrDC, w, n); - - /* Select new bitmap into memory DC */ - hOldBitmap = SelectObject(hMemDC, hBitmap); - - /* Get bitmap properties */ - GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); - size = (unsigned int)bm.bmWidthBytes * bm.bmHeight * bm.bmPlanes; - - bmbits = OPENSSL_malloc(size); - if (bmbits) { - /* Now go through the whole screen, repeatedly grabbing n lines */ - for (y = 0; y < h-n; y += n) - { - unsigned char md[MD_DIGEST_LENGTH]; - - /* Bitblt screen DC to memory DC */ - BitBlt(hMemDC, 0, 0, w, n, hScrDC, 0, y, SRCCOPY); - - /* Copy bitmap bits from memory DC to bmbits */ - GetBitmapBits(hBitmap, size, bmbits); - - /* Get the hash of the bitmap */ - MD(bmbits,size,md); - - /* Seed the random generator with the hash value */ - RAND_add(md, MD_DIGEST_LENGTH, 0); - } - - OPENSSL_free(bmbits); - } - - /* Select old bitmap back into memory DC */ - hBitmap = SelectObject(hMemDC, hOldBitmap); - - /* Clean up */ - DeleteObject(hBitmap); - DeleteDC(hMemDC); - DeleteDC(hScrDC); -} - -#else /* Unix version */ - -#include <time.h> - -int RAND_poll(void) -{ - unsigned long l; - pid_t curr_pid = getpid(); -#ifdef DEVRANDOM - FILE *fh; -#endif - -#ifdef DEVRANDOM - /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD - * have this. Use /dev/urandom if you can as /dev/random may block - * if it runs out of random entries. */ - - if ((fh = fopen(DEVRANDOM, "r")) != NULL) - { - unsigned char tmpbuf[ENTROPY_NEEDED]; - int n; - - setvbuf(fh, NULL, _IONBF, 0); - n=fread((unsigned char *)tmpbuf,1,ENTROPY_NEEDED,fh); - fclose(fh); - RAND_add(tmpbuf,sizeof tmpbuf,n); - memset(tmpbuf,0,n); - } -#endif - - /* put in some default random data, we need more than just this */ - l=curr_pid; - RAND_add(&l,sizeof(l),0); - l=getuid(); - RAND_add(&l,sizeof(l),0); - - l=time(NULL); - RAND_add(&l,sizeof(l),0); - -#ifdef DEVRANDOM - return 1; -#endif - return 0; -} - -#endif diff --git a/crypto/openssl/crypto/symhacks.h b/crypto/openssl/crypto/symhacks.h deleted file mode 100644 index 6b472b2f4cafd..0000000000000 --- a/crypto/openssl/crypto/symhacks.h +++ /dev/null @@ -1,154 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -#ifndef HEADER_SYMHACKS_H -#define HEADER_SYMHACKS_H - -/* Hacks to solve the problem with linkers incapable of handling very long - symbol names. In the case of VMS, the limit is 31 characters on VMS for - VAX. */ -#ifdef VMS - -/* Hack a long name in crypto/asn1/a_mbstr.c */ -#undef ASN1_STRING_set_default_mask_asc -#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc - -#if 0 /* No longer needed, since safestack macro magic does the job */ -/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */ -#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO -#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF -#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO -#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF -#endif - -#if 0 /* No longer needed, since safestack macro magic does the job */ -/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */ -#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO -#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF -#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO -#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF -#endif - -#if 0 /* No longer needed, since safestack macro magic does the job */ -/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */ -#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION -#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC -#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION -#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC -#endif - -/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */ -#undef PEM_read_NETSCAPE_CERT_SEQUENCE -#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ -#undef PEM_write_NETSCAPE_CERT_SEQUENCE -#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ -#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE -#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ -#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE -#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ -#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE -#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ - -/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */ -#undef PEM_read_PKCS8_PRIV_KEY_INFO -#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO -#undef PEM_write_PKCS8_PRIV_KEY_INFO -#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO -#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO -#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO -#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO -#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO -#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO -#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO - -/* Hack other PEM names */ -#undef PEM_write_bio_PKCS8PrivateKey_nid -#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid - -/* Hack some long X509 names */ -#undef X509_REVOKED_get_ext_by_critical -#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic - -/* Hack some long CRYPTO names */ -#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb -#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb -#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb -#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb -#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb -#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb - -/* Hack some long SSL names */ -#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths -#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx -#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk -#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk -#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file -#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb -#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud - -/* Hack some long ENGINE names */ -#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt -#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt - -#endif /* defined VMS */ - - -/* Case insensiteve linking causes problems.... */ -#if defined(WIN16) || defined(VMS) -#undef ERR_load_CRYPTO_strings -#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings -#endif - - -#endif /* ! defined HEADER_VMS_IDHACKS_H */ diff --git a/crypto/openssl/demos/pkcs12/README b/crypto/openssl/demos/pkcs12/README deleted file mode 100644 index c87434b04f6fd..0000000000000 --- a/crypto/openssl/demos/pkcs12/README +++ /dev/null @@ -1,3 +0,0 @@ -PKCS#12 demo applications - -Written by Steve Henson. diff --git a/crypto/openssl/demos/pkcs12/pkread.c b/crypto/openssl/demos/pkcs12/pkread.c deleted file mode 100644 index 8e1b68631216e..0000000000000 --- a/crypto/openssl/demos/pkcs12/pkread.c +++ /dev/null @@ -1,61 +0,0 @@ -/* pkread.c */ - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/pem.h> -#include <openssl/err.h> -#include <openssl/pkcs12.h> - -/* Simple PKCS#12 file reader */ - -int main(int argc, char **argv) -{ - FILE *fp; - EVP_PKEY *pkey; - X509 *cert; - STACK_OF(X509) *ca = NULL; - PKCS12 *p12; - int i; - if (argc != 4) { - fprintf(stderr, "Usage: pkread p12file password opfile\n"); - exit (1); - } - SSLeay_add_all_algorithms(); - ERR_load_crypto_strings(); - if (!(fp = fopen(argv[1], "rb"))) { - fprintf(stderr, "Error opening file %s\n", argv[1]); - exit(1); - } - p12 = d2i_PKCS12_fp(fp, NULL); - fclose (fp); - if (!p12) { - fprintf(stderr, "Error reading PKCS#12 file\n"); - ERR_print_errors_fp(stderr); - exit (1); - } - if (!PKCS12_parse(p12, argv[2], &pkey, &cert, &ca)) { - fprintf(stderr, "Error parsing PKCS#12 file\n"); - ERR_print_errors_fp(stderr); - exit (1); - } - PKCS12_free(p12); - if (!(fp = fopen(argv[3], "w"))) { - fprintf(stderr, "Error opening file %s\n", argv[1]); - exit(1); - } - if (pkey) { - fprintf(fp, "***Private Key***\n"); - PEM_write_PrivateKey(fp, pkey, NULL, NULL, 0, NULL, NULL); - } - if (cert) { - fprintf(fp, "***User Certificate***\n"); - PEM_write_X509_AUX(fp, cert); - } - if (ca && sk_num(ca)) { - fprintf(fp, "***Other Certificates***\n"); - for (i = 0; i < sk_X509_num(ca); i++) - PEM_write_X509_AUX(fp, sk_X509_value(ca, i)); - } - fclose(fp); - return 0; -} diff --git a/crypto/openssl/demos/pkcs12/pkwrite.c b/crypto/openssl/demos/pkcs12/pkwrite.c deleted file mode 100644 index 15f839d1ebaea..0000000000000 --- a/crypto/openssl/demos/pkcs12/pkwrite.c +++ /dev/null @@ -1,46 +0,0 @@ -/* pkwrite.c */ - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/pem.h> -#include <openssl/err.h> -#include <openssl/pkcs12.h> - -/* Simple PKCS#12 file creator */ - -int main(int argc, char **argv) -{ - FILE *fp; - EVP_PKEY *pkey; - X509 *cert; - PKCS12 *p12; - if (argc != 5) { - fprintf(stderr, "Usage: pkwrite infile password name p12file\n"); - exit(1); - } - SSLeay_add_all_algorithms(); - ERR_load_crypto_strings(); - if (!(fp = fopen(argv[1], "r"))) { - fprintf(stderr, "Error opening file %s\n", argv[1]); - exit(1); - } - cert = PEM_read_X509(fp, NULL, NULL, NULL); - rewind(fp); - pkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL); - fclose(fp); - p12 = PKCS12_create(argv[2], argv[3], pkey, cert, NULL, 0,0,0,0,0); - if(!p12) { - fprintf(stderr, "Error creating PKCS#12 structure\n"); - ERR_print_errors_fp(stderr); - exit(1); - } - if (!(fp = fopen(argv[4], "wb"))) { - fprintf(stderr, "Error opening file %s\n", argv[1]); - ERR_print_errors_fp(stderr); - exit(1); - } - i2d_PKCS12_fp(fp, p12); - PKCS12_free(p12); - fclose(fp); - return 0; -} diff --git a/crypto/openssl/demos/state_machine/Makefile b/crypto/openssl/demos/state_machine/Makefile deleted file mode 100644 index c7a114540de91..0000000000000 --- a/crypto/openssl/demos/state_machine/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -CFLAGS=-I../../include -Wall -Werror -g - -all: state_machine - -state_machine: state_machine.o - $(CC) -o state_machine state_machine.o -L../.. -lssl -lcrypto - -test: state_machine - ./state_machine 10000 ../../apps/server.pem ../../apps/server.pem diff --git a/crypto/openssl/demos/state_machine/state_machine.c b/crypto/openssl/demos/state_machine/state_machine.c deleted file mode 100644 index 0140fbca70460..0000000000000 --- a/crypto/openssl/demos/state_machine/state_machine.c +++ /dev/null @@ -1,395 +0,0 @@ -/* ==================================================================== - * Copyright (c) 2000 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - -/* - * Nuron, a leader in hardware encryption technology, generously - * sponsored the development of this demo by Ben Laurie. - * - * See http://www.nuron.com/. - */ - -/* - * the aim of this demo is to provide a fully working state-machine - * style SSL implementation, i.e. one where the main loop acquires - * some data, then converts it from or to SSL by feeding it into the - * SSL state machine. It then does any I/O required by the state machine - * and loops. - * - * In order to keep things as simple as possible, this implementation - * listens on a TCP socket, which it expects to get an SSL connection - * on (for example, from s_client) and from then on writes decrypted - * data to stdout and encrypts anything arriving on stdin. Verbose - * commentary is written to stderr. - * - * This implementation acts as a server, but it can also be done for a client. */ - -#include <openssl/ssl.h> -#include <assert.h> -#include <unistd.h> -#include <string.h> -#include <openssl/err.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -/* die_unless is intended to work like assert, except that it happens - always, even if NDEBUG is defined. Use assert as a stopgap. */ - -#define die_unless(x) assert(x) - -typedef struct - { - SSL_CTX *pCtx; - BIO *pbioRead; - BIO *pbioWrite; - SSL *pSSL; - } SSLStateMachine; - -void SSLStateMachine_print_error(SSLStateMachine *pMachine,const char *szErr) - { - unsigned long l; - - fprintf(stderr,"%s\n",szErr); - while((l=ERR_get_error())) - { - char buf[1024]; - - ERR_error_string_n(l,buf,sizeof buf); - fprintf(stderr,"Error %lx: %s\n",l,buf); - } - } - -SSLStateMachine *SSLStateMachine_new(const char *szCertificateFile, - const char *szKeyFile) - { - SSLStateMachine *pMachine=malloc(sizeof *pMachine); - int n; - - die_unless(pMachine); - - pMachine->pCtx=SSL_CTX_new(SSLv23_server_method()); - die_unless(pMachine->pCtx); - - n=SSL_CTX_use_certificate_file(pMachine->pCtx,szCertificateFile, - SSL_FILETYPE_PEM); - die_unless(n > 0); - - n=SSL_CTX_use_PrivateKey_file(pMachine->pCtx,szKeyFile,SSL_FILETYPE_PEM); - die_unless(n > 0); - - pMachine->pSSL=SSL_new(pMachine->pCtx); - die_unless(pMachine->pSSL); - - pMachine->pbioRead=BIO_new(BIO_s_mem()); - - pMachine->pbioWrite=BIO_new(BIO_s_mem()); - - SSL_set_bio(pMachine->pSSL,pMachine->pbioRead,pMachine->pbioWrite); - - SSL_set_accept_state(pMachine->pSSL); - - return pMachine; - } - -void SSLStateMachine_read_inject(SSLStateMachine *pMachine, - const unsigned char *aucBuf,int nBuf) - { - int n=BIO_write(pMachine->pbioRead,aucBuf,nBuf); - /* If it turns out this assert fails, then buffer the data here - * and just feed it in in churn instead. Seems to me that it - * should be guaranteed to succeed, though. - */ - assert(n == nBuf); - fprintf(stderr,"%d bytes of encrypted data fed to state machine\n",n); - } - -int SSLStateMachine_read_extract(SSLStateMachine *pMachine, - unsigned char *aucBuf,int nBuf) - { - int n; - - if(!SSL_is_init_finished(pMachine->pSSL)) - { - fprintf(stderr,"Doing SSL_accept\n"); - n=SSL_accept(pMachine->pSSL); - if(n == 0) - fprintf(stderr,"SSL_accept returned zero\n"); - if(n < 0) - { - int err; - - if((err=SSL_get_error(pMachine->pSSL,n)) == SSL_ERROR_WANT_READ) - { - fprintf(stderr,"SSL_accept wants more data\n"); - return 0; - } - - SSLStateMachine_print_error(pMachine,"SSL_accept error"); - exit(7); - } - return 0; - } - - n=SSL_read(pMachine->pSSL,aucBuf,nBuf); - if(n < 0) - { - int err=SSL_get_error(pMachine->pSSL,n); - - if(err == SSL_ERROR_WANT_READ) - { - fprintf(stderr,"SSL_read wants more data\n"); - return 0; - } - } - - fprintf(stderr,"%d bytes of decrypted data read from state machine\n",n); - return n; - } - -int SSLStateMachine_write_can_extract(SSLStateMachine *pMachine) - { - int n=BIO_pending(pMachine->pbioWrite); - if(n) - fprintf(stderr,"There is encrypted data available to write\n"); - else - fprintf(stderr,"There is no encrypted data available to write\n"); - - return n; - } - -int SSLStateMachine_write_extract(SSLStateMachine *pMachine, - unsigned char *aucBuf,int nBuf) - { - int n; - - n=BIO_read(pMachine->pbioWrite,aucBuf,nBuf); - fprintf(stderr,"%d bytes of encrypted data read from state machine\n",n); - return n; - } - -void SSLStateMachine_write_inject(SSLStateMachine *pMachine, - const unsigned char *aucBuf,int nBuf) - { - int n=SSL_write(pMachine->pSSL,aucBuf,nBuf); - /* If it turns out this assert fails, then buffer the data here - * and just feed it in in churn instead. Seems to me that it - * should be guaranteed to succeed, though. - */ - assert(n == nBuf); - fprintf(stderr,"%d bytes of unencrypted data fed to state machine\n",n); - } - -int OpenSocket(int nPort) - { - int nSocket; - struct sockaddr_in saServer; - struct sockaddr_in saClient; - int one=1; - int nSize; - int nFD; - int nLen; - - nSocket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP); - if(nSocket < 0) - { - perror("socket"); - exit(1); - } - - if(setsockopt(nSocket,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof one) < 0) - { - perror("setsockopt"); - exit(2); - } - - memset(&saServer,0,sizeof saServer); - saServer.sin_family=AF_INET; - saServer.sin_port=htons(nPort); - nSize=sizeof saServer; - if(bind(nSocket,(struct sockaddr *)&saServer,nSize) < 0) - { - perror("bind"); - exit(3); - } - - if(listen(nSocket,512) < 0) - { - perror("listen"); - exit(4); - } - - nLen=sizeof saClient; - nFD=accept(nSocket,(struct sockaddr *)&saClient,&nLen); - if(nFD < 0) - { - perror("accept"); - exit(5); - } - - fprintf(stderr,"Incoming accepted on port %d\n",nPort); - - return nFD; - } - -int main(int argc,char **argv) - { - SSLStateMachine *pMachine; - int nPort; - int nFD; - const char *szCertificateFile; - const char *szKeyFile; - - if(argc != 4) - { - fprintf(stderr,"%s <port> <certificate file> <key file>\n",argv[0]); - exit(6); - } - - nPort=atoi(argv[1]); - szCertificateFile=argv[2]; - szKeyFile=argv[3]; - - SSL_library_init(); - OpenSSL_add_ssl_algorithms(); - SSL_load_error_strings(); - ERR_load_crypto_strings(); - - nFD=OpenSocket(nPort); - - pMachine=SSLStateMachine_new(szCertificateFile,szKeyFile); - - for( ; ; ) - { - fd_set rfds,wfds; - unsigned char buf[1024]; - int n; - - FD_ZERO(&rfds); - FD_ZERO(&wfds); - - /* Select socket for input */ - FD_SET(nFD,&rfds); - - /* Select socket for output */ - if(SSLStateMachine_write_can_extract(pMachine)) - FD_SET(nFD,&wfds); - - /* Select stdin for input */ - FD_SET(0,&rfds); - - /* Wait for something to do something */ - n=select(nFD+1,&rfds,&wfds,NULL,NULL); - assert(n > 0); - - /* Socket is ready for input */ - if(FD_ISSET(nFD,&rfds)) - { - n=read(nFD,buf,sizeof buf); - if(n == 0) - { - fprintf(stderr,"Got EOF on socket\n"); - exit(0); - } - assert(n > 0); - - SSLStateMachine_read_inject(pMachine,buf,n); - } - - /* FIXME: we should only extract if stdout is ready */ - n=SSLStateMachine_read_extract(pMachine,buf,n); - if(n < 0) - { - SSLStateMachine_print_error(pMachine,"read extract failed"); - break; - } - assert(n >= 0); - if(n > 0) - { - int w; - - w=write(1,buf,n); - /* FIXME: we should push back any unwritten data */ - assert(w == n); - } - - /* Socket is ready for output (and therefore we have output to send) */ - if(FD_ISSET(nFD,&wfds)) - { - int w; - - n=SSLStateMachine_write_extract(pMachine,buf,sizeof buf); - assert(n > 0); - - w=write(nFD,buf,n); - /* FIXME: we should push back any unwritten data */ - assert(w == n); - } - - /* Stdin is ready for input */ - if(FD_ISSET(0,&rfds)) - { - n=read(0,buf,sizeof buf); - if(n == 0) - { - fprintf(stderr,"Got EOF on stdin\n"); - exit(0); - } - assert(n > 0); - - SSLStateMachine_write_inject(pMachine,buf,n); - } - } - /* not reached */ - return 0; - } diff --git a/crypto/openssl/doc/apps/rsautl.pod b/crypto/openssl/doc/apps/rsautl.pod deleted file mode 100644 index 7a334bc8d6a39..0000000000000 --- a/crypto/openssl/doc/apps/rsautl.pod +++ /dev/null @@ -1,183 +0,0 @@ -=pod - -=head1 NAME - -rsautl - RSA utility - -=head1 SYNOPSIS - -B<openssl> B<rsautl> -[B<-in file>] -[B<-out file>] -[B<-inkey file>] -[B<-pubin>] -[B<-certin>] -[B<-sign>] -[B<-verify>] -[B<-encrypt>] -[B<-decrypt>] -[B<-pkcs>] -[B<-ssl>] -[B<-raw>] -[B<-hexdump>] -[B<-asn1parse>] - -=head1 DESCRIPTION - -The B<rsautl> command can be used to sign, verify, encrypt and decrypt -data using the RSA algorithm. - -=head1 COMMAND OPTIONS - -=over 4 - -=item B<-in filename> - -This specifies the input filename to read data from or standard input -if this option is not specified. - -=item B<-out filename> - -specifies the output filename to write to or standard output by -default. - -=item B<-inkey file> - -the input key file, by default it should be an RSA private key. - -=item B<-pubin> - -the input file is an RSA public key. - -=item B<-certin> - -the input is a certificate containing an RSA public key. - -=item B<-sign> - -sign the input data and output the signed result. This requires -and RSA private key. - -=item B<-verify> - -verify the input data and output the recovered data. - -=item B<-encrypt> - -encrypt the input data using an RSA public key. - -=item B<-decrypt> - -decrypt the input data using an RSA private key. - -=item B<-pkcs, -oaep, -ssl, -raw> - -the padding to use: PKCS#1 v1.5 (the default), PKCS#1 OAEP, -special padding used in SSL v2 backwards compatible handshakes, -or no padding, respectively. -For signatures, only B<-pkcs> and B<-raw> can be used. - -=item B<-hexdump> - -hex dump the output data. - -=item B<-asn1parse> - -asn1parse the output data, this is useful when combined with the -B<-verify> option. - -=back - -=head1 NOTES - -B<rsautl> because it uses the RSA algorithm directly can only be -used to sign or verify small pieces of data. - -=head1 EXAMPLES - -Sign some data using a private key: - - openssl rsautl -sign -in file -inkey key.pem -out sig - -Recover the signed data - - openssl rsautl -sign -in sig -inkey key.pem - -Examine the raw signed data: - - openssl rsautl -sign -in file -inkey key.pem -raw -hexdump - - 0000 - 00 01 ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0010 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0020 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0030 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0040 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0050 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0060 - ff ff ff ff ff ff ff ff-ff ff ff ff ff ff ff ff ................ - 0070 - ff ff ff ff 00 68 65 6c-6c 6f 20 77 6f 72 6c 64 .....hello world - -The PKCS#1 block formatting is evident from this. If this was done using -encrypt and decrypt the block would have been of type 2 (the second byte) -and random padding data visible instead of the 0xff bytes. - -It is possible to analyse the signature of certificates using this -utility in conjunction with B<asn1parse>. Consider the self signed -example in certs/pca-cert.pem . Running B<asn1parse> as follows yields: - - openssl asn1parse -in pca-cert.pem - - 0:d=0 hl=4 l= 742 cons: SEQUENCE - 4:d=1 hl=4 l= 591 cons: SEQUENCE - 8:d=2 hl=2 l= 3 cons: cont [ 0 ] - 10:d=3 hl=2 l= 1 prim: INTEGER :02 - 13:d=2 hl=2 l= 1 prim: INTEGER :00 - 16:d=2 hl=2 l= 13 cons: SEQUENCE - 18:d=3 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption - 29:d=3 hl=2 l= 0 prim: NULL - 31:d=2 hl=2 l= 92 cons: SEQUENCE - 33:d=3 hl=2 l= 11 cons: SET - 35:d=4 hl=2 l= 9 cons: SEQUENCE - 37:d=5 hl=2 l= 3 prim: OBJECT :countryName - 42:d=5 hl=2 l= 2 prim: PRINTABLESTRING :AU - .... - 599:d=1 hl=2 l= 13 cons: SEQUENCE - 601:d=2 hl=2 l= 9 prim: OBJECT :md5WithRSAEncryption - 612:d=2 hl=2 l= 0 prim: NULL - 614:d=1 hl=3 l= 129 prim: BIT STRING - - -The final BIT STRING contains the actual signature. It can be extracted with: - - openssl asn1parse -in pca-cert.pem -out sig -noout -strparse 614 - -The certificate public key can be extracted with: - - openssl x509 -in test/testx509.pem -pubout -noout >pubkey.pem - -The signature can be analysed with: - - openssl rsautl -in sig -verify -asn1parse -inkey pubkey.pem -pubin - - 0:d=0 hl=2 l= 32 cons: SEQUENCE - 2:d=1 hl=2 l= 12 cons: SEQUENCE - 4:d=2 hl=2 l= 8 prim: OBJECT :md5 - 14:d=2 hl=2 l= 0 prim: NULL - 16:d=1 hl=2 l= 16 prim: OCTET STRING - 0000 - f3 46 9e aa 1a 4a 73 c9-37 ea 93 00 48 25 08 b5 .F...Js.7...H%.. - -This is the parsed version of an ASN1 DigestInfo structure. It can be seen that -the digest used was md5. The actual part of the certificate that was signed can -be extracted with: - - openssl asn1parse -in pca-cert.pem -out tbs -noout -strparse 4 - -and its digest computed with: - - openssl md5 -c tbs - MD5(tbs)= f3:46:9e:aa:1a:4a:73:c9:37:ea:93:00:48:25:08:b5 - -which it can be seen agrees with the recovered value above. - -=head1 SEE ALSO - -L<dgst(1)|dgst(1)>, L<rsa(1)|rsa(1)>, L<genrsa(1)|genrsa(1)> diff --git a/crypto/openssl/doc/crypto/BIO_ctrl.pod b/crypto/openssl/doc/crypto/BIO_ctrl.pod deleted file mode 100644 index 722e8b8f46c9c..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_ctrl.pod +++ /dev/null @@ -1,128 +0,0 @@ -=pod - -=head1 NAME - -BIO_ctrl, BIO_callback_ctrl, BIO_ptr_ctrl, BIO_int_ctrl, BIO_reset, -BIO_seek, BIO_tell, BIO_flush, BIO_eof, BIO_set_close, BIO_get_close, -BIO_pending, BIO_wpending, BIO_ctrl_pending, BIO_ctrl_wpending, -BIO_get_info_callback, BIO_set_info_callback - BIO control operations - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg); - long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long)); - char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg); - long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg); - - int BIO_reset(BIO *b); - int BIO_seek(BIO *b, int ofs); - int BIO_tell(BIO *b); - int BIO_flush(BIO *b); - int BIO_eof(BIO *b); - int BIO_set_close(BIO *b,long flag); - int BIO_get_close(BIO *b); - int BIO_pending(BIO *b); - int BIO_wpending(BIO *b); - size_t BIO_ctrl_pending(BIO *b); - size_t BIO_ctrl_wpending(BIO *b); - - int BIO_get_info_callback(BIO *b,bio_info_cb **cbp); - int BIO_set_info_callback(BIO *b,bio_info_cb *cb); - - typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3); - -=head1 DESCRIPTION - -BIO_ctrl(), BIO_callback_ctrl(), BIO_ptr_ctrl() and BIO_int_ctrl() -are BIO "control" operations taking arguments of various types. -These functions are not normally called directly, various macros -are used instead. The standard macros are described below, macros -specific to a particular type of BIO are described in the specific -BIOs manual page as well as any special features of the standard -calls. - -BIO_reset() typically resets a BIO to some initial state, in the case -of file related BIOs for example it rewinds the file pointer to the -start of the file. - -BIO_seek() resets a file related BIO's (that is file descriptor and -FILE BIOs) file position pointer to B<ofs> bytes from start of file. - -BIO_tell() returns the current file position of a file related BIO. - -BIO_flush() normally writes out any internally buffered data, in some -cases it is used to signal EOF and that no more data will be written. - -BIO_eof() returns 1 if the BIO has read EOF, the precise meaning of -"EOF" varies according to the BIO type. - -BIO_set_close() sets the BIO B<b> close flag to B<flag>. B<flag> can -take the value BIO_CLOSE or BIO_NOCLOSE. Typically BIO_CLOSE is used -in a source/sink BIO to indicate that the underlying I/O stream should -be closed when the BIO is freed. - -BIO_get_close() returns the BIOs close flag. - -BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() -return the number of pending characters in the BIOs read and write buffers. -Not all BIOs support these calls. BIO_ctrl_pending() and BIO_ctrl_wpending() -return a size_t type and are functions, BIO_pending() and BIO_wpending() are -macros which call BIO_ctrl(). - -=head1 RETURN VALUES - -BIO_reset() normally returns 1 for success and 0 or -1 for failure. File -BIOs are an exception, they return 0 for success and -1 for failure. - -BIO_seek() and BIO_tell() both return the current file position on success -and -1 for failure, except file BIOs which for BIO_seek() always return 0 -for success and -1 for failure. - -BIO_flush() returns 1 for success and 0 or -1 for failure. - -BIO_eof() returns 1 if EOF has been reached 0 otherwise. - -BIO_set_close() always returns 1. - -BIO_get_close() returns the close flag value: BIO_CLOSE or BIO_NOCLOSE. - -BIO_pending(), BIO_ctrl_pending(), BIO_wpending() and BIO_ctrl_wpending() -return the amount of pending data. - -=head1 NOTES - -BIO_flush(), because it can write data may return 0 or -1 indicating -that the call should be retried later in a similar manner to BIO_write(). -The BIO_should_retry() call should be used and appropriate action taken -is the call fails. - -The return values of BIO_pending() and BIO_wpending() may not reliably -determine the amount of pending data in all cases. For example in the -case of a file BIO some data may be available in the FILE structures -internal buffers but it is not possible to determine this in a -portably way. For other types of BIO they may not be supported. - -Filter BIOs if they do not internally handle a particular BIO_ctrl() -operation usually pass the operation to the next BIO in the chain. -This often means there is no need to locate the required BIO for -a particular operation, it can be called on a chain and it will -be automatically passed to the relevant BIO. However this can cause -unexpected results: for example no current filter BIOs implement -BIO_seek(), but this may still succeed if the chain ends in a FILE -or file descriptor BIO. - -Source/sink BIOs return an 0 if they do not recognize the BIO_ctrl() -operation. - -=head1 BUGS - -Some of the return values are ambiguous and care should be taken. In -particular a return value of 0 can be returned if an operation is not -supported, if an error occurred, if EOF has not been reached and in -the case of BIO_seek() on a file BIO for a successful operation. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_f_base64.pod b/crypto/openssl/doc/crypto/BIO_f_base64.pod deleted file mode 100644 index fdb603b38e305..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_f_base64.pod +++ /dev/null @@ -1,82 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_base64 - base64 BIO filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/evp.h> - - BIO_METHOD * BIO_f_base64(void); - -=head1 DESCRIPTION - -BIO_f_base64() returns the base64 BIO method. This is a filter -BIO that base64 encodes any data written through it and decodes -any data read through it. - -Base64 BIOs do not support BIO_gets() or BIO_puts(). - -BIO_flush() on a base64 BIO that is being written through is -used to signal that no more data is to be encoded: this is used -to flush the final block through the BIO. - -The flag BIO_FLAGS_BASE64_NO_NL can be set with BIO_set_flags() -to encode the data all on one line or expect the data to be all -on one line. - -=head1 NOTES - -Because of the format of base64 encoding the end of the encoded -block cannot always be reliably determined. - -=head1 RETURN VALUES - -BIO_f_base64() returns the base64 BIO method. - -=head1 EXAMPLES - -Base64 encode the string "Hello World\n" and write the result -to standard output: - - BIO *bio, *b64; - char message[] = "Hello World \n"; - - b64 = BIO_new(BIO_f_base64()); - bio = BIO_new_fp(stdout, BIO_NOCLOSE); - bio = BIO_push(b64, bio); - BIO_write(bio, message, strlen(message)); - BIO_flush(bio); - - BIO_free_all(bio); - -Read Base64 encoded data from standard input and write the decoded -data to standard output: - - BIO *bio, *b64, bio_out; - char inbuf[512]; - int inlen; - char message[] = "Hello World \n"; - - b64 = BIO_new(BIO_f_base64()); - bio = BIO_new_fp(stdin, BIO_NOCLOSE); - bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); - bio = BIO_push(b64, bio); - while((inlen = BIO_read(bio, inbuf, strlen(message))) > 0) - BIO_write(bio_out, inbuf, inlen); - - BIO_free_all(bio); - -=head1 BUGS - -The ambiguity of EOF in base64 encoded data can cause additional -data following the base64 encoded block to be misinterpreted. - -There should be some way of specifying a test that the BIO can perform -to reliably determine EOF (for example a MIME boundary). - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_f_buffer.pod b/crypto/openssl/doc/crypto/BIO_f_buffer.pod deleted file mode 100644 index c9093c6a576c9..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_f_buffer.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_buffer - buffering BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_f_buffer(void); - - #define BIO_get_buffer_num_lines(b) BIO_ctrl(b,BIO_C_GET_BUFF_NUM_LINES,0,NULL) - #define BIO_set_read_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,0) - #define BIO_set_write_buffer_size(b,size) BIO_int_ctrl(b,BIO_C_SET_BUFF_SIZE,size,1) - #define BIO_set_buffer_size(b,size) BIO_ctrl(b,BIO_C_SET_BUFF_SIZE,size,NULL) - #define BIO_set_buffer_read_data(b,buf,num) BIO_ctrl(b,BIO_C_SET_BUFF_READ_DATA,num,buf) - -=head1 DESCRIPTION - -BIO_f_buffer() returns the buffering BIO method. - -Data written to a buffering BIO is buffered and periodically written -to the next BIO in the chain. Data read from a buffering BIO comes from -an internal buffer which is filled from the next BIO in the chain. -Both BIO_gets() and BIO_puts() are supported. - -Calling BIO_reset() on a buffering BIO clears any buffered data. - -BIO_get_buffer_num_lines() returns the number of lines currently buffered. - -BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() -set the read, write or both read and write buffer sizes to B<size>. The initial -buffer size is DEFAULT_BUFFER_SIZE, currently 1024. Any attempt to reduce the -buffer size below DEFAULT_BUFFER_SIZE is ignored. Any buffered data is cleared -when the buffer is resized. - -BIO_set_buffer_read_data() clears the read buffer and fills it with B<num> -bytes of B<buf>. If B<num> is larger than the current buffer size the buffer -is expanded. - -=head1 NOTES - -Buffering BIOs implement BIO_gets() by using BIO_read() operations on the -next BIO in the chain. By prepending a buffering BIO to a chain it is therefore -possible to provide BIO_gets() functionality if the following BIOs do not -support it (for example SSL BIOs). - -Data is only written to the next BIO in the chain when the write buffer fills -or when BIO_flush() is called. It is therefore important to call BIO_flush() -whenever any pending data should be written such as when removing a buffering -BIO using BIO_pop(). BIO_flush() may need to be retried if the ultimate -source/sink BIO is non blocking. - -=head1 RETURN VALUES - -BIO_f_buffer() returns the buffering BIO method. - -BIO_get_buffer_num_lines() returns the number of lines buffered (may be 0). - -BIO_set_read_buffer_size(), BIO_set_write_buffer_size() and BIO_set_buffer_size() -return 1 if the buffer was successfully resized or 0 for failure. - -BIO_set_buffer_read_data() returns 1 if the data was set correctly or 0 if -there was an error. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_f_cipher.pod b/crypto/openssl/doc/crypto/BIO_f_cipher.pod deleted file mode 100644 index 4182f2c309031..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_f_cipher.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_cipher, BIO_set_cipher, BIO_get_cipher_status, BIO_get_cipher_ctx - cipher BIO filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/evp.h> - - BIO_METHOD * BIO_f_cipher(void); - void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher, - unsigned char *key, unsigned char *iv, int enc); - int BIO_get_cipher_status(BIO *b) - int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx) - -=head1 DESCRIPTION - -BIO_f_cipher() returns the cipher BIO method. This is a filter -BIO that encrypts any data written through it, and decrypts any data -read from it. It is a BIO wrapper for the cipher routines -EVP_CipherInit(), EVP_CipherUpdate() and EVP_CipherFinal(). - -Cipher BIOs do not support BIO_gets() or BIO_puts(). - -BIO_flush() on an encryption BIO that is being written through is -used to signal that no more data is to be encrypted: this is used -to flush and possibly pad the final block through the BIO. - -BIO_set_cipher() sets the cipher of BIO <b> to B<cipher> using key B<key> -and IV B<iv>. B<enc> should be set to 1 for encryption and zero for -decryption. - -When reading from an encryption BIO the final block is automatically -decrypted and checked when EOF is detected. BIO_get_cipher_status() -is a BIO_ctrl() macro which can be called to determine whether the -decryption operation was successful. - -BIO_get_cipher_ctx() is a BIO_ctrl() macro which retrieves the internal -BIO cipher context. The retrieved context can be used in conjunction -with the standard cipher routines to set it up. This is useful when -BIO_set_cipher() is not flexible enough for the applications needs. - -=head1 NOTES - -When encrypting BIO_flush() B<must> be called to flush the final block -through the BIO. If it is not then the final block will fail a subsequent -decrypt. - -When decrypting an error on the final block is signalled by a zero -return value from the read operation. A successful decrypt followed -by EOF will also return zero for the final read. BIO_get_cipher_status() -should be called to determine if the decrypt was successful. - -As always, if BIO_gets() or BIO_puts() support is needed then it can -be achieved by preceding the cipher BIO with a buffering BIO. - -=head1 RETURN VALUES - -BIO_f_cipher() returns the cipher BIO method. - -BIO_set_cipher() does not return a value. - -BIO_get_cipher_status() returns 1 for a successful decrypt and 0 -for failure. - -BIO_get_cipher_ctx() currently always returns 1. - -=head1 EXAMPLES - -TBA - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_f_md.pod b/crypto/openssl/doc/crypto/BIO_f_md.pod deleted file mode 100644 index c32504dfb186f..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_f_md.pod +++ /dev/null @@ -1,138 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_md, BIO_set_md, BIO_get_md, BIO_get_md_ctx - message digest BIO filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/evp.h> - - BIO_METHOD * BIO_f_md(void); - int BIO_set_md(BIO *b,EVP_MD *md); - int BIO_get_md(BIO *b,EVP_MD **mdp); - int BIO_get_md_ctx(BIO *b,EVP_MD_CTX **mdcp); - -=head1 DESCRIPTION - -BIO_f_md() returns the message digest BIO method. This is a filter -BIO that digests any data passed through it, it is a BIO wrapper -for the digest routines EVP_DigestInit(), EVP_DigestUpdate() -and EVP_DigestFinal(). - -Any data written or read through a digest BIO using BIO_read() and -BIO_write() is digested. - -BIO_gets(), if its B<size> parameter is large enough finishes the -digest calculation and returns the digest value. BIO_puts() is -not supported. - -BIO_reset() reinitializes a digest BIO. - -BIO_set_md() sets the message digest of BIO B<b> to B<md>: this -must be called to initialize a digest BIO before any data is -passed through it. It is a BIO_ctrl() macro. - -BIO_get_md() places the a pointer to the digest BIOs digest method -in B<mdp>, it is a BIO_ctrl() macro. - -BIO_get_md_ctx() returns the digest BIOs context into B<mdcp>. - -=head1 NOTES - -The context returned by BIO_get_md_ctx() can be used in calls -to EVP_DigestFinal() and also the signature routines EVP_SignFinal() -and EVP_VerifyFinal(). - -The context returned by BIO_get_md_ctx() is an internal context -structure. Changes made to this context will affect the digest -BIO itself and the context pointer will become invalid when the digest -BIO is freed. - -After the digest has been retrieved from a digest BIO it must be -reinitialized by calling BIO_reset(), or BIO_set_md() before any more -data is passed through it. - -If an application needs to call BIO_gets() or BIO_puts() through -a chain containing digest BIOs then this can be done by prepending -a buffering BIO. - -=head1 RETURN VALUES - -BIO_f_md() returns the digest BIO method. - -BIO_set_md(), BIO_get_md() and BIO_md_ctx() return 1 for success and -0 for failure. - -=head1 EXAMPLES - -The following example creates a BIO chain containing an SHA1 and MD5 -digest BIO and passes the string "Hello World" through it. Error -checking has been omitted for clarity. - - BIO *bio, *mdtmp; - char message[] = "Hello World"; - bio = BIO_new(BIO_s_null()); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_sha1()); - /* For BIO_push() we want to append the sink BIO and keep a note of - * the start of the chain. - */ - bio = BIO_push(mdtmp, bio); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_md5()); - bio = BIO_push(mdtmp, bio); - /* Note: mdtmp can now be discarded */ - BIO_write(bio, message, strlen(message)); - -The next example digests data by reading through a chain instead: - - BIO *bio, *mdtmp; - char buf[1024]; - int rdlen; - bio = BIO_new_file(file, "rb"); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_sha1()); - bio = BIO_push(mdtmp, bio); - mdtmp = BIO_new(BIO_f_md()); - BIO_set_md(mdtmp, EVP_md5()); - bio = BIO_push(mdtmp, bio); - do { - rdlen = BIO_read(bio, buf, sizeof(buf)); - /* Might want to do something with the data here */ - } while(rdlen > 0); - -This next example retrieves the message digests from a BIO chain and -outputs them. This could be used with the examples above. - - BIO *mdtmp; - unsigned char mdbuf[EVP_MAX_MD_SIZE]; - int mdlen; - int i; - mdtmp = bio; /* Assume bio has previously been set up */ - do { - EVP_MD *md; - mdtmp = BIO_find_type(mdtmp, BIO_TYPE_MD); - if(!mdtmp) break; - BIO_get_md(mdtmp, &md); - printf("%s digest", OBJ_nid2sn(EVP_MD_type(md))); - mdlen = BIO_gets(mdtmp, mdbuf, EVP_MAX_MD_SIZE); - for(i = 0; i < mdlen; i++) printf(":%02X", mdbuf[i]); - printf("\n"); - mdtmp = BIO_next(mdtmp); - } while(mdtmp); - - BIO_free_all(bio); - -=head1 BUGS - -The lack of support for BIO_puts() and the non standard behaviour of -BIO_gets() could be regarded as anomalous. It could be argued that BIO_gets() -and BIO_puts() should be passed to the next BIO in the chain and digest -the data passed through and that digests should be retrieved using a -separate BIO_ctrl() call. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_f_null.pod b/crypto/openssl/doc/crypto/BIO_f_null.pod deleted file mode 100644 index b057c1840832f..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_f_null.pod +++ /dev/null @@ -1,32 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_null - null filter - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_f_null(void); - -=head1 DESCRIPTION - -BIO_f_null() returns the null filter BIO method. This is a filter BIO -that does nothing. - -All requests to a null filter BIO are passed through to the next BIO in -the chain: this means that a BIO chain containing a null filter BIO -behaves just as though the BIO was not there. - -=head1 NOTES - -As may be apparent a null filter BIO is not particularly useful. - -=head1 RETURN VALUES - -BIO_f_null() returns the null filter BIO method. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_f_ssl.pod b/crypto/openssl/doc/crypto/BIO_f_ssl.pod deleted file mode 100644 index a56ee2b92f2ba..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_f_ssl.pod +++ /dev/null @@ -1,313 +0,0 @@ -=pod - -=head1 NAME - -BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, BIO_set_ssl_renegotiate_bytes, -BIO_get_num_renegotiates, BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, -BIO_new_ssl_connect, BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, -BIO_ssl_shutdown - SSL BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - #include <openssl/ssl.h> - - BIO_METHOD *BIO_f_ssl(void); - - #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) - #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) - #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) - #define BIO_set_ssl_renegotiate_bytes(b,num) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); - #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ - BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); - #define BIO_get_num_renegotiates(b) \ - BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL); - - BIO *BIO_new_ssl(SSL_CTX *ctx,int client); - BIO *BIO_new_ssl_connect(SSL_CTX *ctx); - BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); - int BIO_ssl_copy_session_id(BIO *to,BIO *from); - void BIO_ssl_shutdown(BIO *bio); - - #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) - -=head1 DESCRIPTION - -BIO_f_ssl() returns the SSL BIO method. This is a filter BIO which -is a wrapper round the OpenSSL SSL routines adding a BIO "flavour" to -SSL I/O. - -I/O performed on an SSL BIO communicates using the SSL protocol with -the SSLs read and write BIOs. If an SSL connection is not established -then an attempt is made to establish one on the first I/O call. - -If a BIO is appended to an SSL BIO using BIO_push() it is automatically -used as the SSL BIOs read and write BIOs. - -Calling BIO_reset() on an SSL BIO closes down any current SSL connection -by calling SSL_shutdown(). BIO_reset() is then sent to the next BIO in -the chain: this will typically disconnect the underlying transport. -The SSL BIO is then reset to the initial accept or connect state. - -If the close flag is set when an SSL BIO is freed then the internal -SSL structure is also freed using SSL_free(). - -BIO_set_ssl() sets the internal SSL pointer of BIO B<b> to B<ssl> using -the close flag B<c>. - -BIO_get_ssl() retrieves the SSL pointer of BIO B<b>, it can then be -manipulated using the standard SSL library functions. - -BIO_set_ssl_mode() sets the SSL BIO mode to B<client>. If B<client> -is 1 client mode is set. If B<client> is 0 server mode is set. - -BIO_set_ssl_renegotiate_bytes() sets the renegotiate byte count -to B<num>. When set after every B<num> bytes of I/O (read and write) -the SSL session is automatically renegotiated. B<num> must be at -least 512 bytes. - -BIO_set_ssl_renegotiate_timeout() sets the renegotiate timeout to -B<seconds>. When the renegotiate timeout elapses the session is -automatically renegotiated. - -BIO_get_num_renegotiates() returns the total number of session -renegotiations due to I/O or timeout. - -BIO_new_ssl() allocates an SSL BIO using SSL_CTX B<ctx> and using -client mode if B<client> is non zero. - -BIO_new_ssl_connect() creates a new BIO chain consisting of an -SSL BIO (using B<ctx>) followed by a connect BIO. - -BIO_new_buffer_ssl_connect() creates a new BIO chain consisting -of a buffering BIO, an SSL BIO (using B<ctx>) and a connect -BIO. - -BIO_ssl_copy_session_id() copies an SSL session id between -BIO chains B<from> and B<to>. It does this by locating the -SSL BIOs in each chain and calling SSL_copy_session_id() on -the internal SSL pointer. - -BIO_ssl_shutdown() closes down an SSL connection on BIO -chain B<bio>. It does this by locating the SSL BIO in the -chain and calling SSL_shutdown() on its internal SSL -pointer. - -BIO_do_handshake() attempts to complete an SSL handshake on the -supplied BIO and establish the SSL connection. It returns 1 -if the connection was established successfully. A zero or negative -value is returned if the connection could not be established, the -call BIO_should_retry() should be used for non blocking connect BIOs -to determine if the call should be retried. If an SSL connection has -already been established this call has no effect. - -=head1 NOTES - -SSL BIOs are exceptional in that if the underlying transport -is non blocking they can still request a retry in exceptional -circumstances. Specifically this will happen if a session -renegotiation takes place during a BIO_read() operation, one -case where this happens is when SGC or step up occurs. - -In OpenSSL 0.9.6 and later the SSL flag SSL_AUTO_RETRY can be -set to disable this behaviour. That is when this flag is set -an SSL BIO using a blocking transport will never request a -retry. - -Since unknown BIO_ctrl() operations are sent through filter -BIOs the servers name and port can be set using BIO_set_host() -on the BIO returned by BIO_new_ssl_connect() without having -to locate the connect BIO first. - -Applications do not have to call BIO_do_handshake() but may wish -to do so to separate the handshake process from other I/O -processing. - -=head1 RETURN VALUES - -TBA - -=head1 EXAMPLE - -This SSL/TLS client example, attempts to retrieve a page from an -SSL/TLS web server. The I/O routines are identical to those of the -unencrypted example in L<BIO_s_connect(3)|BIO_s_connect(3)>. - - BIO *sbio, *out; - int len; - char tmpbuf[1024]; - SSL_CTX *ctx; - SSL *ssl; - - ERR_load_crypto_strings(); - ERR_load_SSL_strings(); - OpenSSL_add_all_algorithms(); - - /* We would seed the PRNG here if the platform didn't - * do it automatically - */ - - ctx = SSL_CTX_new(SSLv23_client_method()); - - /* We'd normally set some stuff like the verify paths and - * mode here because as things stand this will connect to - * any server whose certificate is signed by any CA. - */ - - sbio = BIO_new_ssl_connect(ctx); - - BIO_get_ssl(sbio, &ssl); - - if(!ssl) { - fprintf(stderr, "Can't locate SSL pointer\n"); - /* whatever ... */ - } - - /* Don't want any retries */ - SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); - - /* We might want to do other things with ssl here */ - - BIO_set_conn_hostname(sbio, "localhost:https"); - - out = BIO_new_fp(stdout, BIO_NOCLOSE); - if(BIO_do_connect(sbio) <= 0) { - fprintf(stderr, "Error connecting to server\n"); - ERR_print_errors_fp(stderr); - /* whatever ... */ - } - - if(BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error establishing SSL connection\n"); - ERR_print_errors_fp(stderr); - /* whatever ... */ - } - - /* Could examine ssl here to get connection info */ - - BIO_puts(sbio, "GET / HTTP/1.0\n\n"); - for(;;) { - len = BIO_read(sbio, tmpbuf, 1024); - if(len <= 0) break; - BIO_write(out, tmpbuf, len); - } - BIO_free_all(sbio); - BIO_free(out); - -Here is a simple server example. It makes use of a buffering -BIO to allow lines to be read from the SSL BIO using BIO_gets. -It creates a pseudo web page containing the actual request from -a client and also echoes the request to standard output. - - BIO *sbio, *bbio, *acpt, *out; - int len; - char tmpbuf[1024]; - SSL_CTX *ctx; - SSL *ssl; - - ERR_load_crypto_strings(); - ERR_load_SSL_strings(); - OpenSSL_add_all_algorithms(); - - /* Might seed PRNG here */ - - ctx = SSL_CTX_new(SSLv23_server_method()); - - if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) - || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) - || !SSL_CTX_check_private_key(ctx)) { - - fprintf(stderr, "Error setting up SSL_CTX\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - /* Might do other things here like setting verify locations and - * DH and/or RSA temporary key callbacks - */ - - /* New SSL BIO setup as server */ - sbio=BIO_new_ssl(ctx,0); - - BIO_get_ssl(sbio, &ssl); - - if(!ssl) { - fprintf(stderr, "Can't locate SSL pointer\n"); - /* whatever ... */ - } - - /* Don't want any retries */ - SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); - - /* Create the buffering BIO */ - - bbio = BIO_new(BIO_f_buffer()); - - /* Add to chain */ - sbio = BIO_push(bbio, sbio); - - acpt=BIO_new_accept("4433"); - - /* By doing this when a new connection is established - * we automatically have sbio inserted into it. The - * BIO chain is now 'swallowed' by the accept BIO and - * will be freed when the accept BIO is freed. - */ - - BIO_set_accept_bios(acpt,sbio); - - out = BIO_new_fp(stdout, BIO_NOCLOSE); - - /* Setup accept BIO */ - if(BIO_do_accept(acpt) <= 0) { - fprintf(stderr, "Error setting up accept BIO\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - /* Now wait for incoming connection */ - if(BIO_do_accept(acpt) <= 0) { - fprintf(stderr, "Error in connection\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - /* We only want one connection so remove and free - * accept BIO - */ - - sbio = BIO_pop(acpt); - - BIO_free_all(acpt); - - if(BIO_do_handshake(sbio) <= 0) { - fprintf(stderr, "Error in SSL handshake\n"); - ERR_print_errors_fp(stderr); - return 0; - } - - BIO_puts(sbio, "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"); - BIO_puts(sbio, "<pre>\r\nConnection Established\r\nRequest headers:\r\n"); - BIO_puts(sbio, "--------------------------------------------------\r\n"); - - for(;;) { - len = BIO_gets(sbio, tmpbuf, 1024); - if(len <= 0) break; - BIO_write(sbio, tmpbuf, len); - BIO_write(out, tmpbuf, len); - /* Look for blank line signifying end of headers*/ - if((tmpbuf[0] == '\r') || (tmpbuf[0] == '\n')) break; - } - - BIO_puts(sbio, "--------------------------------------------------\r\n"); - BIO_puts(sbio, "</pre>\r\n"); - - /* Since there is a buffering BIO present we had better flush it */ - BIO_flush(sbio); - - BIO_free_all(sbio); - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_find_type.pod b/crypto/openssl/doc/crypto/BIO_find_type.pod deleted file mode 100644 index bd3b25619617e..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_find_type.pod +++ /dev/null @@ -1,98 +0,0 @@ -=pod - -=head1 NAME - -BIO_find_type, BIO_next - BIO chain traversal - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO * BIO_find_type(BIO *b,int bio_type); - BIO * BIO_next(BIO *b); - - #define BIO_method_type(b) ((b)->method->type) - - #define BIO_TYPE_NONE 0 - #define BIO_TYPE_MEM (1|0x0400) - #define BIO_TYPE_FILE (2|0x0400) - - #define BIO_TYPE_FD (4|0x0400|0x0100) - #define BIO_TYPE_SOCKET (5|0x0400|0x0100) - #define BIO_TYPE_NULL (6|0x0400) - #define BIO_TYPE_SSL (7|0x0200) - #define BIO_TYPE_MD (8|0x0200) - #define BIO_TYPE_BUFFER (9|0x0200) - #define BIO_TYPE_CIPHER (10|0x0200) - #define BIO_TYPE_BASE64 (11|0x0200) - #define BIO_TYPE_CONNECT (12|0x0400|0x0100) - #define BIO_TYPE_ACCEPT (13|0x0400|0x0100) - #define BIO_TYPE_PROXY_CLIENT (14|0x0200) - #define BIO_TYPE_PROXY_SERVER (15|0x0200) - #define BIO_TYPE_NBIO_TEST (16|0x0200) - #define BIO_TYPE_NULL_FILTER (17|0x0200) - #define BIO_TYPE_BER (18|0x0200) - #define BIO_TYPE_BIO (19|0x0400) - - #define BIO_TYPE_DESCRIPTOR 0x0100 - #define BIO_TYPE_FILTER 0x0200 - #define BIO_TYPE_SOURCE_SINK 0x0400 - -=head1 DESCRIPTION - -The BIO_find_type() searches for a BIO of a given type in a chain, starting -at BIO B<b>. If B<type> is a specific type (such as BIO_TYPE_MEM) then a search -is made for a BIO of that type. If B<type> is a general type (such as -B<BIO_TYPE_SOURCE_SINK>) then the next matching BIO of the given general type is -searched for. BIO_find_type() returns the next matching BIO or NULL if none is -found. - -Note: not all the B<BIO_TYPE_*> types above have corresponding BIO implementations. - -BIO_next() returns the next BIO in a chain. It can be used to traverse all BIOs -in a chain or used in conjunction with BIO_find_type() to find all BIOs of a -certain type. - -BIO_method_type() returns the type of a BIO. - -=head1 RETURN VALUES - -BIO_find_type() returns a matching BIO or NULL for no match. - -BIO_next() returns the next BIO in a chain. - -BIO_method_type() returns the type of the BIO B<b>. - -=head1 NOTES - -BIO_next() was added to OpenSSL 0.9.6 to provide a 'clean' way to traverse a BIO -chain or find multiple matches using BIO_find_type(). Previous versions had to -use: - - next = bio->next_bio; - -=head1 BUGS - -BIO_find_type() in OpenSSL 0.9.5a and earlier could not be safely passed a -NULL pointer for the B<b> argument. - -=head1 EXAMPLE - -Traverse a chain looking for digest BIOs: - - BIO *btmp; - btmp = in_bio; /* in_bio is chain to search through */ - - do { - btmp = BIO_find_type(btmp, BIO_TYPE_MD); - if(btmp == NULL) break; /* Not found */ - /* btmp is a digest BIO, do something with it ...*/ - ... - - btmp = BIO_next(btmp); - } while(btmp); - - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_new.pod b/crypto/openssl/doc/crypto/BIO_new.pod deleted file mode 100644 index 2a245fc8de83e..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_new.pod +++ /dev/null @@ -1,65 +0,0 @@ -=pod - -=head1 NAME - -BIO_new, BIO_set, BIO_free, BIO_vfree, BIO_free_all - BIO allocation and freeing functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO * BIO_new(BIO_METHOD *type); - int BIO_set(BIO *a,BIO_METHOD *type); - int BIO_free(BIO *a); - void BIO_vfree(BIO *a); - void BIO_free_all(BIO *a); - -=head1 DESCRIPTION - -The BIO_new() function returns a new BIO using method B<type>. - -BIO_set() sets the method of an already existing BIO. - -BIO_free() frees up a single BIO, BIO_vfree() also frees up a single BIO -but it does not return a value. Calling BIO_free() may also have some effect -on the underlying I/O structure, for example it may close the file being -referred to under certain circumstances. For more details see the individual -BIO_METHOD descriptions. - -BIO_free_all() frees up an entire BIO chain, it does not halt if an error -occurs freeing up an individual BIO in the chain. - -=head1 RETURN VALUES - -BIO_new() returns a newly created BIO or NULL if the call fails. - -BIO_set(), BIO_free() return 1 for success and 0 for failure. - -BIO_free_all() and BIO_vfree() do not return values. - -=head1 NOTES - -Some BIOs (such as memory BIOs) can be used immediately after calling -BIO_new(). Others (such as file BIOs) need some additional initialization, -and frequently a utility function exists to create and initialize such BIOs. - -If BIO_free() is called on a BIO chain it will only free one BIO resulting -in a memory leak. - -Calling BIO_free_all() a single BIO has the same effect as calling BIO_free() -on it other than the discarded return value. - -Normally the B<type> argument is supplied by a function which returns a -pointer to a BIO_METHOD. There is a naming convention for such functions: -a source/sink BIO is normally called BIO_s_*() and a filter BIO -BIO_f_*(); - -=head1 EXAMPLE - -Create a memory BIO: - - BIO *mem = BIO_new(BIO_s_mem()); - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_new_bio_pair.pod b/crypto/openssl/doc/crypto/BIO_new_bio_pair.pod deleted file mode 100644 index 2256ba9d34107..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_new_bio_pair.pod +++ /dev/null @@ -1,102 +0,0 @@ -=pod - -=head1 NAME - -BIO_new_bio_pair - create a new BIO pair - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2); - -=head1 DESCRIPTION - -BIO_new_bio_pair() creates a buffering BIO pair. It has two endpoints between -data can be buffered. Its typical use is to connect one endpoint as underlying -input/output BIO to an SSL and access the other one controlled by the program -instead of accessing the network connection directly. - -The two new BIOs B<bio1> and B<bio2> are symmetric with respect to their -functionality. The size of their buffers is determined by B<writebuf1> and -B<writebuf2>. If the size give is 0, the default size is used. - -BIO_new_bio_pair() does not check whether B<bio1> or B<bio2> do point to -some other BIO, the values are overwritten, BIO_free() is not called. - -The two BIOs, even though forming a BIO pair and must be BIO_free()'ed -separately. This can be of importance, as some SSL-functions like SSL_set_bio() -or SSL_free() call BIO_free() implicitly, so that the peer-BIO is left -untouched and must also be BIO_free()'ed. - -=head1 EXAMPLE - -The BIO pair can be used to have full control over the network access of an -application. The application can call select() on the socket as required -without having to go through the SSL-interface. - - BIO *internal_bio, *network_bio; - ... - BIO_new_bio_pair(internal_bio, 0, network_bio, 0); - SSL_set_bio(ssl, internal_bio); - SSL_operations(); - ... - - application | TLS-engine - | | - +----------> SSL_operations() - | /\ || - | || \/ - | BIO-pair (internal_bio) - +----------< BIO-pair (network_bio) - | | - socket | - - ... - SSL_free(ssl); /* implicitly frees internal_bio */ - BIO_free(network_bio); - ... - -As the BIO pair will only buffer the data and never directly access the -connection, it behaves non-blocking and will return as soon as the write -buffer is full or the read buffer is drained. Then the application has to -flush the write buffer and/or fill the read buffer. - -Use the BIO_ctrl_pending(), to find out whether data is buffered in the BIO -and must be transfered to the network. Use BIO_ctrl_get_read_request() to -find out, how many bytes must be written into the buffer before the -SSL_operation() can successfully be continued. - -=head1 IMPORTANT - -As the data is buffered, SSL_operation() may return with a ERROR_SSL_WANT_READ -condition, but there is still data in the write buffer. An application must -not rely on the error value of SSL_operation() but must assure that the -write buffer is always flushed first. Otherwise a deadlock may occur as -the peer might be waiting for the data before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The BIO pair was created successfully. The new BIOs are available in -B<bio1> and B<bio2>. - -=item 0 - -The operation failed. The NULL pointer is stored into the locations for -B<bio1> and B<bio2>. Check the error stack for more information. - -=back - -=head1 SEE ALSO - -L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, -L<BIO_ctrl_pending(3)|BIO_ctrl_pending(3)>, -L<BIO_ctrl_get_read_request(3)|BIO_ctrl_get_read_request(3)> - -=cut diff --git a/crypto/openssl/doc/crypto/BIO_push.pod b/crypto/openssl/doc/crypto/BIO_push.pod deleted file mode 100644 index 8af1d3c09751b..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_push.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -BIO_push, BIO_pop - add and remove BIOs from a chain. - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO * BIO_push(BIO *b,BIO *append); - BIO * BIO_pop(BIO *b); - -=head1 DESCRIPTION - -The BIO_push() function appends the BIO B<append> to B<b>, it returns -B<b>. - -BIO_pop() removes the BIO B<b> from a chain and returns the next BIO -in the chain, or NULL if there is no next BIO. The removed BIO then -becomes a single BIO with no association with the original chain, -it can thus be freed or attached to a different chain. - -=head1 NOTES - -The names of these functions are perhaps a little misleading. BIO_push() -joins two BIO chains whereas BIO_pop() deletes a single BIO from a chain, -the deleted BIO does not need to be at the end of a chain. - -The process of calling BIO_push() and BIO_pop() on a BIO may have additional -consequences (a control call is made to the affected BIOs) any effects will -be noted in the descriptions of individual BIOs. - -=head1 EXAMPLES - -For these examples suppose B<md1> and B<md2> are digest BIOs, B<b64> is -a base64 BIO and B<f> is a file BIO. - -If the call: - - BIO_push(b64, f); - -is made then the new chain will be B<b64-chain>. After making the calls - - BIO_push(md2, b64); - BIO_push(md1, md2); - -the new chain is B<md1-md2-b64-f>. Data written to B<md1> will be digested -by B<md1> and B<md2>, B<base64> encoded and written to B<f>. - -It should be noted that reading causes data to pass in the reverse -direction, that is data is read from B<f>, base64 B<decoded> and digested -by B<md1> and B<md2>. If the call: - - BIO_pop(md2); - -The call will return B<b64> and the new chain will be B<md1-b64-f> data can -be written to B<md1> as before. - -=head1 RETURN VALUES - -BIO_push() returns the end of the chain, B<b>. - -BIO_pop() returns the next BIO in the chain, or NULL if there is no next -BIO. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_read.pod b/crypto/openssl/doc/crypto/BIO_read.pod deleted file mode 100644 index b34528104ddf2..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_read.pod +++ /dev/null @@ -1,66 +0,0 @@ -=pod - -=head1 NAME - -BIO_read, BIO_write, BIO_gets, BIO_puts - BIO I/O functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - int BIO_read(BIO *b, void *buf, int len); - int BIO_gets(BIO *b,char *buf, int size); - int BIO_write(BIO *b, const void *buf, int len); - int BIO_puts(BIO *b,const char *buf); - -=head1 DESCRIPTION - -BIO_read() attempts to read B<len> bytes from BIO B<b> and places -the data in B<buf>. - -BIO_gets() performs the BIOs "gets" operation and places the data -in B<buf>. Usually this operation will attempt to read a line of data -from the BIO of maximum length B<len>. There are exceptions to this -however, for example BIO_gets() on a digest BIO will calculate and -return the digest and other BIOs may not support BIO_gets() at all. - -BIO_write() attempts to write B<len> bytes from B<buf> to BIO B<b>. - -BIO_puts() attempts to write a null terminated string B<buf> to BIO B<b> - -=head1 RETURN VALUES - -All these functions return either the amount of data successfully read or -written (if the return value is positive) or that no data was successfully -read or written if the result is 0 or -1. If the return value is -2 then -the operation is not implemented in the specific BIO type. - -=head1 NOTES - -A 0 or -1 return is not necessarily an indication of an error. In -particular when the source/sink is non-blocking or of a certain type -it may merely be an indication that no data is currently available and that -the application should retry the operation later. - -One technique sometimes used with blocking sockets is to use a system call -(such as select(), poll() or equivalent) to determine when data is available -and then call read() to read the data. The equivalent with BIOs (that is call -select() on the underlying I/O structure and then call BIO_read() to -read the data) should B<not> be used because a single call to BIO_read() -can cause several reads (and writes in the case of SSL BIOs) on the underlying -I/O structure and may block as a result. Instead select() (or equivalent) -should be combined with non blocking I/O so successive reads will request -a retry instead of blocking. - -See L<BIO_should_retry(3)|BIO_should_retry(3)> for details of how to -determine the cause of a retry and other I/O issues. - -If the BIO_gets() function is not supported by a BIO then it possible to -work around this by adding a buffering BIO L<BIO_f_buffer(3)|BIO_f_buffer(3)> -to the chain. - -=head1 SEE ALSO - -L<BIO_should_retry(3)|BIO_should_retry(3)> - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_s_accept.pod b/crypto/openssl/doc/crypto/BIO_s_accept.pod deleted file mode 100644 index c49da7fb02c0d..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_accept.pod +++ /dev/null @@ -1,184 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_accept, BIO_set_nbio, BIO_set_accept_port, BIO_get_accept_port, -BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode, -BIO_get_bind_mode, BIO_do_accept - accept BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_accept(void); - - #define BIO_set_accept_port(b,name) BIO_ctrl(b,BIO_C_SET_ACCEPT,0,(char *)name) - #define BIO_get_accept_port(b) BIO_ptr_ctrl(b,BIO_C_GET_ACCEPT,0) - - BIO *BIO_new_accept(char *host_port); - - #define BIO_set_nbio_accept(b,n) BIO_ctrl(b,BIO_C_SET_ACCEPT,1,(n)?"a":NULL) - #define BIO_set_accept_bios(b,bio) BIO_ctrl(b,BIO_C_SET_ACCEPT,2,(char *)bio) - - #define BIO_set_bind_mode(b,mode) BIO_ctrl(b,BIO_C_SET_BIND_MODE,mode,NULL) - #define BIO_get_bind_mode(b,mode) BIO_ctrl(b,BIO_C_GET_BIND_MODE,0,NULL) - - #define BIO_BIND_NORMAL 0 - #define BIO_BIND_REUSEADDR_IF_UNUSED 1 - #define BIO_BIND_REUSEADDR 2 - - #define BIO_do_accept(b) BIO_do_handshake(b) - -=head1 DESCRIPTION - -BIO_s_accept() returns the accept BIO method. This is a wrapper -round the platform's TCP/IP socket accept routines. - -Using accept BIOs TCP/IP connections can be accepted and data -transferred using only BIO routines. In this way any platform -specific operations are hidden by the BIO abstraction. - -Read and write operations on an accept BIO will perform I/O -on the underlying connection. If no connection is established -and the port (see below) is set up properly then the BIO -waits for an incoming connection. - -Accept BIOs support BIO_puts() but not BIO_gets(). - -If the close flag is set on an accept BIO then any active -connection on that chain is shutdown and the socket closed when -the BIO is freed. - -Calling BIO_reset() on a accept BIO will close any active -connection and reset the BIO into a state where it awaits another -incoming connection. - -BIO_get_fd() and BIO_set_fd() can be called to retrieve or set -the accept socket. See L<BIO_s_fd(3)|BIO_s_fd(3)> - -BIO_set_accept_port() uses the string B<name> to set the accept -port. The port is represented as a string of the form "host:port", -where "host" is the interface to use and "port" is the port. -Either or both values can be "*" which is interpreted as meaning -any interface or port respectively. "port" has the same syntax -as the port specified in BIO_set_conn_port() for connect BIOs, -that is it can be a numerical port string or a string to lookup -using getservbyname() and a string table. - -BIO_new_accept() combines BIO_new() and BIO_set_accept_port() into -a single call: that is it creates a new accept BIO with port -B<host_port>. - -BIO_set_nbio_accept() sets the accept socket to blocking mode -(the default) if B<n> is 0 or non blocking mode if B<n> is 1. - -BIO_set_accept_bios() can be used to set a chain of BIOs which -will be duplicated and prepended to the chain when an incoming -connection is received. This is useful if, for example, a -buffering or SSL BIO is required for each connection. The -chain of BIOs must not be freed after this call, they will -be automatically freed when the accept BIO is freed. - -BIO_set_bind_mode() and BIO_get_bind_mode() set and retrieve -the current bind mode. If BIO_BIND_NORMAL (the default) is set -then another socket cannot be bound to the same port. If -BIO_BIND_REUSEADDR is set then other sockets can bind to the -same port. If BIO_BIND_REUSEADDR_IF_UNUSED is set then and -attempt is first made to use BIO_BIN_NORMAL, if this fails -and the port is not in use then a second attempt is made -using BIO_BIND_REUSEADDR. - -BIO_do_accept() serves two functions. When it is first -called, after the accept BIO has been setup, it will attempt -to create the accept socket and bind an address to it. Second -and subsequent calls to BIO_do_accept() will await an incoming -connection. - -=head1 NOTES - -When an accept BIO is at the end of a chain it will await an -incoming connection before processing I/O calls. When an accept -BIO is not at then end of a chain it passes I/O calls to the next -BIO in the chain. - -When a connection is established a new socket BIO is created for -the connection and appended to the chain. That is the chain is now -accept->socket. This effectively means that attempting I/O on -an initial accept socket will await an incoming connection then -perform I/O on it. - -If any additional BIOs have been set using BIO_set_accept_bios() -then they are placed between the socket and the accept BIO, -that is the chain will be accept->otherbios->socket. - -If a server wishes to process multiple connections (as is normally -the case) then the accept BIO must be made available for further -incoming connections. This can be done by waiting for a connection and -then calling: - - connection = BIO_pop(accept); - -After this call B<connection> will contain a BIO for the recently -established connection and B<accept> will now be a single BIO -again which can be used to await further incoming connections. -If no further connections will be accepted the B<accept> can -be freed using BIO_free(). - -If only a single connection will be processed it is possible to -perform I/O using the accept BIO itself. This is often undesirable -however because the accept BIO will still accept additional incoming -connections. This can be resolved by using BIO_pop() (see above) -and freeing up the accept BIO after the initial connection. - -=head1 RETURN VALUES - -TBA - -=head1 EXAMPLE - -This example accepts two connections on port 4444, sends messages -down each and finally closes both down. - - BIO *abio, *cbio, *cbio2; - ERR_load_crypto_strings(); - abio = BIO_new_accept("4444"); - - /* First call to BIO_accept() sets up accept BIO */ - if(BIO_do_accept(abio) <= 0) { - fprintf(stderr, "Error setting up accept\n"); - ERR_print_errors_fp(stderr); - exit(0); - } - - /* Wait for incoming connection */ - if(BIO_do_accept(abio) <= 0) { - fprintf(stderr, "Error accepting connection\n"); - ERR_print_errors_fp(stderr); - exit(0); - } - fprintf(stderr, "Connection 1 established\n"); - /* Retrieve BIO for connection */ - cbio = BIO_pop(abio); - BIO_puts(cbio, "Connection 1: Sending out Data on initial connection\n"); - fprintf(stderr, "Sent out data on connection 1\n"); - /* Wait for another connection */ - if(BIO_do_accept(abio) <= 0) { - fprintf(stderr, "Error accepting connection\n"); - ERR_print_errors_fp(stderr); - exit(0); - } - fprintf(stderr, "Connection 2 established\n"); - /* Close accept BIO to refuse further connections */ - cbio2 = BIO_pop(abio); - BIO_free(abio); - BIO_puts(cbio2, "Connection 2: Sending out Data on second\n"); - fprintf(stderr, "Sent out data on connection 2\n"); - - BIO_puts(cbio, "Connection 1: Second connection established\n"); - /* Close the two established connections */ - BIO_free(cbio); - BIO_free(cbio2); - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_s_bio.pod b/crypto/openssl/doc/crypto/BIO_s_bio.pod deleted file mode 100644 index 95ae802e4724c..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_bio.pod +++ /dev/null @@ -1,130 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_bio, BIO_make_bio_pair, BIO_destroy_bio_pair, BIO_shutdown_wr, -BIO_set_write_buf_size, BIO_get_write_buf_size, BIO_new_bio_pair, -BIO_get_write_guarantee, BIO_ctrl_get_write_guarantee, BIO_get_read_request, -BIO_ctrl_get_read_request, BIO_ctrl_reset_read_request - BIO pair BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD *BIO_s_bio(void); - - #define BIO_make_bio_pair(b1,b2) (int)BIO_ctrl(b1,BIO_C_MAKE_BIO_PAIR,0,b2) - #define BIO_destroy_bio_pair(b) (int)BIO_ctrl(b,BIO_C_DESTROY_BIO_PAIR,0,NULL) - - #define BIO_shutdown_wr(b) (int)BIO_ctrl(b, BIO_C_SHUTDOWN_WR, 0, NULL) - - #define BIO_set_write_buf_size(b,size) (int)BIO_ctrl(b,BIO_C_SET_WRITE_BUF_SIZE,size,NULL) - #define BIO_get_write_buf_size(b,size) (size_t)BIO_ctrl(b,BIO_C_GET_WRITE_BUF_SIZE,size,NULL) - - int BIO_new_bio_pair(BIO **bio1, size_t writebuf1, BIO **bio2, size_t writebuf2); - - #define BIO_get_write_guarantee(b) (int)BIO_ctrl(b,BIO_C_GET_WRITE_GUARANTEE,0,NULL) - size_t BIO_ctrl_get_write_guarantee(BIO *b); - - #define BIO_get_read_request(b) (int)BIO_ctrl(b,BIO_C_GET_READ_REQUEST,0,NULL) - size_t BIO_ctrl_get_read_request(BIO *b); - - int BIO_ctrl_reset_read_request(BIO *b); - -=head1 DESCRIPTION - -BIO_s_bio() returns the method for a BIO pair. A BIO pair is a pair of source/sink -BIOs where data written to either half of the pair is buffered and can be read from -the other half. Both halves must usually by handled by the same application thread -since no locking is done on the internal data structures. - -Since BIO chains typically end in a source/sink BIO it is possible to make this -one half of a BIO pair and have all the data processed by the chain under application -control. - -One typical use of BIO pairs is to place TLS/SSL I/O under application control, this -can be used when the application wishes to use a non standard transport for -TLS/SSL or the normal socket routines are inappropriate. - -Calls to BIO_read() will read data from the buffer or request a retry if no -data is available. - -Calls to BIO_write() will place data in the buffer or request a retry if the -buffer is full. - -The standard calls BIO_ctrl_pending() and BIO_ctrl_wpending() can be used to -determine the amount of pending data in the read or write buffer. - -BIO_reset() clears any data in the write buffer. - -BIO_make_bio_pair() joins two separate BIOs into a connected pair. - -BIO_destroy_pair() destroys the association between two connected BIOs. Freeing -up any half of the pair will automatically destroy the association. - -BIO_shutdown_wr() is used to close down a BIO B<b>. After this call no further -writes on BIO B<b> are allowed (they will return an error). Reads on the other -half of the pair will return any pending data or EOF when all pending data has -been read. - -BIO_set_write_buf_size() sets the write buffer size of BIO B<b> to B<size>. -If the size is not initialized a default value is used. This is currently -17K, sufficient for a maximum size TLS record. - -BIO_get_write_buf_size() returns the size of the write buffer. - -BIO_new_bio_pair() combines the calls to BIO_new(), BIO_make_bio_pair() and -BIO_set_write_buf_size() to create a connected pair of BIOs B<bio1>, B<bio2> -with write buffer sizes B<writebuf1> and B<writebuf2>. If either size is -zero then the default size is used. - -BIO_get_write_guarantee() and BIO_ctrl_get_write_guarantee() return the maximum -length of data that can be currently written to the BIO. Writes larger than this -value will return a value from BIO_write() less than the amount requested or if the -buffer is full request a retry. BIO_ctrl_get_write_guarantee() is a function -whereas BIO_get_write_guarantee() is a macro. - -BIO_get_read_request() and BIO_ctrl_get_read_request() return the -amount of data requested, or the buffer size if it is less, if the -last read attempt at the other half of the BIO pair failed due to an -empty buffer. This can be used to determine how much data should be -written to the BIO so the next read will succeed: this is most useful -in TLS/SSL applications where the amount of data read is usually -meaningful rather than just a buffer size. After a successful read -this call will return zero. It also will return zero once new data -has been written satisfying the read request or part of it. -Note that BIO_get_read_request() never returns an amount larger -than that returned by BIO_get_write_guarantee(). - -BIO_ctrl_reset_read_request() can also be used to reset the value returned by -BIO_get_read_request() to zero. - -=head1 NOTES - -Both halves of a BIO pair should be freed. That is even if one half is implicit -freed due to a BIO_free_all() or SSL_free() call the other half needs to be freed. - -When used in bidirectional applications (such as TLS/SSL) care should be taken to -flush any data in the write buffer. This can be done by calling BIO_pending() -on the other half of the pair and, if any data is pending, reading it and sending -it to the underlying transport. This must be done before any normal processing -(such as calling select() ) due to a request and BIO_should_read() being true. - -To see why this is important consider a case where a request is sent using -BIO_write() and a response read with BIO_read(), this can occur during an -TLS/SSL handshake for example. BIO_write() will succeed and place data in the write -buffer. BIO_read() will initially fail and BIO_should_read() will be true. If -the application then waits for data to be available on the underlying transport -before flushing the write buffer it will never succeed because the request was -never sent! - -=head1 EXAMPLE - -TBA - -=head1 SEE ALSO - -L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, -L<BIO_should_retry(3)|BIO_should_retry(3)>, L<BIO_read(3)|BIO_read(3)> - -=cut diff --git a/crypto/openssl/doc/crypto/BIO_s_connect.pod b/crypto/openssl/doc/crypto/BIO_s_connect.pod deleted file mode 100644 index fe1aa679d441b..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_connect.pod +++ /dev/null @@ -1,182 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_connect, BIO_set_conn_hostname, BIO_set_conn_port, -BIO_set_conn_ip, BIO_set_conn_int_port, BIO_get_conn_hostname, -BIO_get_conn_port, BIO_get_conn_ip, BIO_get_conn_int_port, -BIO_set_nbio, BIO_do_connect - connect BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_connect(void); - - #define BIO_set_conn_hostname(b,name) BIO_ctrl(b,BIO_C_SET_CONNECT,0,(char *)name) - #define BIO_set_conn_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,1,(char *)port) - #define BIO_set_conn_ip(b,ip) BIO_ctrl(b,BIO_C_SET_CONNECT,2,(char *)ip) - #define BIO_set_conn_int_port(b,port) BIO_ctrl(b,BIO_C_SET_CONNECT,3,(char *)port) - #define BIO_get_conn_hostname(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,0) - #define BIO_get_conn_port(b) BIO_ptr_ctrl(b,BIO_C_GET_CONNECT,1) - #define BIO_get_conn_ip(b,ip) BIO_ptr_ctrl(b,BIO_C_SET_CONNECT,2) - #define BIO_get_conn_int_port(b,port) BIO_int_ctrl(b,BIO_C_SET_CONNECT,3,port) - - #define BIO_set_nbio(b,n) BIO_ctrl(b,BIO_C_SET_NBIO,(n),NULL) - - #define BIO_do_connect(b) BIO_do_handshake(b) - -=head1 DESCRIPTION - -BIO_s_connect() returns the connect BIO method. This is a wrapper -round the platform's TCP/IP socket connection routines. - -Using connect BIOs TCP/IP connections can be made and data -transferred using only BIO routines. In this way any platform -specific operations are hidden by the BIO abstraction. - -Read and write operations on a connect BIO will perform I/O -on the underlying connection. If no connection is established -and the port and hostname (see below) is set up properly then -a connection is established first. - -Connect BIOs support BIO_puts() but not BIO_gets(). - -If the close flag is set on a connect BIO then any active -connection is shutdown and the socket closed when the BIO -is freed. - -Calling BIO_reset() on a connect BIO will close any active -connection and reset the BIO into a state where it can connect -to the same host again. - -BIO_get_fd() places the underlying socket in B<c> if it is not NULL, -it also returns the socket . If B<c> is not NULL it should be of -type (int *). - -BIO_set_conn_hostname() uses the string B<name> to set the hostname -The hostname can be an IP address. The hostname can also include the -port in the form hostname:port . It is also acceptable to use the -form "hostname/any/other/path" or "hostname:port/any/other/path". - -BIO_set_conn_port() sets the port to B<port>. B<port> can be the -numerical form or a string such as "http". A string will be looked -up first using getservbyname() on the host platform but if that -fails a standard table of port names will be used. Currently the -list is http, telnet, socks, https, ssl, ftp, gopher and wais. - -BIO_set_conn_ip() sets the IP address to B<ip> using binary form, -that is four bytes specifying the IP address in big-endian form. - -BIO_set_conn_int_port() sets the port using B<port>. B<port> should -be of type (int *). - -BIO_get_conn_hostname() returns the hostname of the connect BIO or -NULL if the BIO is initialized but no hostname is set. -This return value is an internal pointer which should not be modified. - -BIO_get_conn_port() returns the port as a string. - -BIO_get_conn_ip() returns the IP address in binary form. - -BIO_get_conn_int_port() returns the port as an int. - -BIO_set_nbio() sets the non blocking I/O flag to B<n>. If B<n> is -zero then blocking I/O is set. If B<n> is 1 then non blocking I/O -is set. Blocking I/O is the default. The call to BIO_set_nbio() -should be made before the connection is established because -non blocking I/O is set during the connect process. - -BIO_do_connect() attempts to connect the supplied BIO. It returns 1 -if the connection was established successfully. A zero or negative -value is returned if the connection could not be established, the -call BIO_should_retry() should be used for non blocking connect BIOs -to determine if the call should be retried. - -=head1 NOTES - -If blocking I/O is set then a non positive return value from any -I/O call is caused by an error condition, although a zero return -will normally mean that the connection was closed. - -If the port name is supplied as part of the host name then this will -override any value set with BIO_set_conn_port(). This may be undesirable -if the application does not wish to allow connection to arbitrary -ports. This can be avoided by checking for the presence of the ':' -character in the passed hostname and either indicating an error or -truncating the string at that point. - -The values returned by BIO_get_conn_hostname(), BIO_get_conn_port(), -BIO_get_conn_ip() and BIO_get_conn_int_port() are updated when a -connection attempt is made. Before any connection attempt the values -returned are those set by the application itself. - -Applications do not have to call BIO_do_connect() but may wish to do -so to separate the connection process from other I/O processing. - -If non blocking I/O is set then retries will be requested as appropriate. - -It addition to BIO_should_read() and BIO_should_write() it is also -possible for BIO_should_io_special() to be true during the initial -connection process with the reason BIO_RR_CONNECT. If this is returned -then this is an indication that a connection attempt would block, -the application should then take appropriate action to wait until -the underlying socket has connected and retry the call. - -=head1 RETURN VALUES - -BIO_s_connect() returns the connect BIO method. - -BIO_get_fd() returns the socket or -1 if the BIO has not -been initialized. - -BIO_set_conn_hostname(), BIO_set_conn_port(), BIO_set_conn_ip() and -BIO_set_conn_int_port() always return 1. - -BIO_get_conn_hostname() returns the connected hostname or NULL is -none was set. - -BIO_get_conn_port() returns a string representing the connected -port or NULL if not set. - -BIO_get_conn_ip() returns a pointer to the connected IP address in -binary form or all zeros if not set. - -BIO_get_conn_int_port() returns the connected port or 0 if none was -set. - -BIO_set_nbio() always returns 1. - -BIO_do_connect() returns 1 if the connection was successfully -established and 0 or -1 if the connection failed. - -=head1 EXAMPLE - -This is example connects to a webserver on the local host and attempts -to retrieve a page and copy the result to standard output. - - - BIO *cbio, *out; - int len; - char tmpbuf[1024]; - ERR_load_crypto_strings(); - cbio = BIO_new_connect("localhost:http"); - out = BIO_new_fp(stdout, BIO_NOCLOSE); - if(BIO_do_connect(cbio) <= 0) { - fprintf(stderr, "Error connecting to server\n"); - ERR_print_errors_fp(stderr); - /* whatever ... */ - } - BIO_puts(cbio, "GET / HTTP/1.0\n\n"); - for(;;) { - len = BIO_read(cbio, tmpbuf, 1024); - if(len <= 0) break; - BIO_write(out, tmpbuf, len); - } - BIO_free(cbio); - BIO_free(out); - - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_s_fd.pod b/crypto/openssl/doc/crypto/BIO_s_fd.pod deleted file mode 100644 index b1de1d1015496..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_fd.pod +++ /dev/null @@ -1,89 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_fd, BIO_set_fd, BIO_get_fd, BIO_new_fd - file descriptor BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_fd(void); - - #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) - #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) - - BIO *BIO_new_fd(int fd, int close_flag); - -=head1 DESCRIPTION - -BIO_s_fd() returns the file descriptor BIO method. This is a wrapper -round the platforms file descriptor routines such as read() and write(). - -BIO_read() and BIO_write() read or write the underlying descriptor. -BIO_puts() is supported but BIO_gets() is not. - -If the close flag is set then then close() is called on the underlying -file descriptor when the BIO is freed. - -BIO_reset() attempts to change the file pointer to the start of file -using lseek(fd, 0, 0). - -BIO_seek() sets the file pointer to position B<ofs> from start of file -using lseek(fd, ofs, 0). - -BIO_tell() returns the current file position by calling lseek(fd, 0, 1). - -BIO_set_fd() sets the file descriptor of BIO B<b> to B<fd> and the close -flag to B<c>. - -BIO_get_fd() places the file descriptor in B<c> if it is not NULL, it also -returns the file descriptor. If B<c> is not NULL it should be of type -(int *). - -BIO_new_fd() returns a file descriptor BIO using B<fd> and B<close_flag>. - -=head1 NOTES - -The behaviour of BIO_read() and BIO_write() depends on the behavior of the -platforms read() and write() calls on the descriptor. If the underlying -file descriptor is in a non blocking mode then the BIO will behave in the -manner described in the L<BIO_read(3)|BIO_read(3)> and L<BIO_should_retry(3)|BIO_should_retry(3)> -manual pages. - -File descriptor BIOs should not be used for socket I/O. Use socket BIOs -instead. - -=head1 RETURN VALUES - -BIO_s_fd() returns the file descriptor BIO method. - -BIO_reset() returns zero for success and -1 if an error occurred. -BIO_seek() and BIO_tell() return the current file position or -1 -is an error occurred. These values reflect the underlying lseek() -behaviour. - -BIO_set_fd() always returns 1. - -BIO_get_fd() returns the file descriptor or -1 if the BIO has not -been initialized. - -BIO_new_fd() returns the newly allocated BIO or NULL is an error -occurred. - -=head1 EXAMPLE - -This is a file descriptor BIO version of "Hello World": - - BIO *out; - out = BIO_new_fd(fileno(stdout), BIO_NOCLOSE); - BIO_printf(out, "Hello World\n"); - BIO_free(out); - -=head1 SEE ALSO - -L<BIO_seek(3)|BIO_seek(3)>, L<BIO_tell(3)|BIO_tell(3)>, -L<BIO_reset(3)|BIO_reset(3)>, L<BIO_read(3)|BIO_read(3)>, -L<BIO_write(3)|BIO_write(3)>, L<BIO_puts(3)|BIO_puts(3)>, -L<BIO_gets(3)|BIO_gets(3)>, L<BIO_printf(3)|BIO_printf(3)>, -L<BIO_set_close(3)|BIO_set_close(3)>, L<BIO_get_close(3)|BIO_get_close(3)> diff --git a/crypto/openssl/doc/crypto/BIO_s_file.pod b/crypto/openssl/doc/crypto/BIO_s_file.pod deleted file mode 100644 index b2a29263f4cd4..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_file.pod +++ /dev/null @@ -1,144 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_file, BIO_new_file, BIO_new_fp, BIO_set_fp, BIO_get_fp, -BIO_read_filename, BIO_write_filename, BIO_append_filename, -BIO_rw_filename - FILE bio - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_file(void); - BIO *BIO_new_file(const char *filename, const char *mode); - BIO *BIO_new_fp(FILE *stream, int flags); - - BIO_set_fp(BIO *b,FILE *fp, int flags); - BIO_get_fp(BIO *b,FILE **fpp); - - int BIO_read_filename(BIO *b, char *name) - int BIO_write_filename(BIO *b, char *name) - int BIO_append_filename(BIO *b, char *name) - int BIO_rw_filename(BIO *b, char *name) - -=head1 DESCRIPTION - -BIO_s_file() returns the BIO file method. As its name implies it -is a wrapper round the stdio FILE structure and it is a -source/sink BIO. - -Calls to BIO_read() and BIO_write() read and write data to the -underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs. - -BIO_flush() on a file BIO calls the fflush() function on the wrapped -stream. - -BIO_reset() attempts to change the file pointer to the start of file -using fseek(stream, 0, 0). - -BIO_seek() sets the file pointer to position B<ofs> from start of file -using fseek(stream, ofs, 0). - -BIO_eof() calls feof(). - -Setting the BIO_CLOSE flag calls fclose() on the stream when the BIO -is freed. - -BIO_new_file() creates a new file BIO with mode B<mode> the meaning -of B<mode> is the same as the stdio function fopen(). The BIO_CLOSE -flag is set on the returned BIO. - -BIO_new_fp() creates a file BIO wrapping B<stream>. Flags can be: -BIO_CLOSE, BIO_NOCLOSE (the close flag) BIO_FP_TEXT (sets the underlying -stream to text mode, default is binary: this only has any effect under -Win32). - -BIO_set_fp() set the fp of a file BIO to B<fp>. B<flags> has the same -meaning as in BIO_new_fp(), it is a macro. - -BIO_get_fp() retrieves the fp of a file BIO, it is a macro. - -BIO_seek() is a macro that sets the position pointer to B<offset> bytes -from the start of file. - -BIO_tell() returns the value of the position pointer. - -BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and -BIO_rw_filename() set the file BIO B<b> to use file B<name> for -reading, writing, append or read write respectively. - -=head1 NOTES - -When wrapping stdout, stdin or stderr the underlying stream should not -normally be closed so the BIO_NOCLOSE flag should be set. - -Because the file BIO calls the underlying stdio functions any quirks -in stdio behaviour will be mirrored by the corresponding BIO. - -=head1 EXAMPLES - -File BIO "hello world": - - BIO *bio_out; - bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); - BIO_printf(bio_out, "Hello World\n"); - -Alternative technique: - - BIO *bio_out; - bio_out = BIO_new(BIO_s_file()); - if(bio_out == NULL) /* Error ... */ - if(!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */ - BIO_printf(bio_out, "Hello World\n"); - -Write to a file: - - BIO *out; - out = BIO_new_file("filename.txt", "w"); - if(!out) /* Error occurred */ - BIO_printf(out, "Hello World\n"); - BIO_free(out); - -Alternative technique: - - BIO *out; - out = BIO_new(BIO_s_file()); - if(out == NULL) /* Error ... */ - if(!BIO_write_filename(out, "filename.txt")) /* Error ... */ - BIO_printf(out, "Hello World\n"); - BIO_free(out); - -=head1 RETURN VALUES - -BIO_s_file() returns the file BIO method. - -BIO_new_file() and BIO_new_fp() return a file BIO or NULL if an error -occurred. - -BIO_set_fp() and BIO_get_fp() return 1 for success or 0 for failure -(although the current implementation never return 0). - -BIO_seek() returns the same value as the underlying fseek() function: -0 for success or -1 for failure. - -BIO_tell() returns the current file position. - -BIO_read_filename(), BIO_write_filename(), BIO_append_filename() and -BIO_rw_filename() return 1 for success or 0 for failure. - -=head1 BUGS - -BIO_reset() and BIO_seek() are implemented using fseek() on the underlying -stream. The return value for fseek() is 0 for success or -1 if an error -occurred this differs from other types of BIO which will typically return -1 for success and a non positive value if an error occurred. - -=head1 SEE ALSO - -L<BIO_seek(3)|BIO_seek(3)>, L<BIO_tell(3)|BIO_tell(3)>, -L<BIO_reset(3)|BIO_reset(3)>, L<BIO_flush(3)|BIO_flush(3)>, -L<BIO_read(3)|BIO_read(3)>, -L<BIO_write(3)|BIO_write(3)>, L<BIO_puts(3)|BIO_puts(3)>, -L<BIO_gets(3)|BIO_gets(3)>, L<BIO_printf(3)|BIO_printf(3)>, -L<BIO_set_close(3)|BIO_set_close(3)>, L<BIO_get_close(3)|BIO_get_close(3)> diff --git a/crypto/openssl/doc/crypto/BIO_s_mem.pod b/crypto/openssl/doc/crypto/BIO_s_mem.pod deleted file mode 100644 index 19648acfae0f2..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_mem.pod +++ /dev/null @@ -1,115 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_mem, BIO_set_mem_eof_return, BIO_get_mem_data, BIO_set_mem_buf, -BIO_get_mem_ptr, BIO_new_mem_buf - memory BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_mem(void); - - BIO_set_mem_eof_return(BIO *b,int v) - long BIO_get_mem_data(BIO *b, char **pp) - BIO_set_mem_buf(BIO *b,BUF_MEM *bm,int c) - BIO_get_mem_ptr(BIO *b,BUF_MEM **pp) - - BIO *BIO_new_mem_buf(void *buf, int len); - -=head1 DESCRIPTION - -BIO_s_mem() return the memory BIO method function. - -A memory BIO is a source/sink BIO which uses memory for its I/O. Data -written to a memory BIO is stored in a BUF_MEM structure which is extended -as appropriate to accommodate the stored data. - -Any data written to a memory BIO can be recalled by reading from it. -Unless the memory BIO is read only any data read from it is deleted from -the BIO. - -Memory BIOs support BIO_gets() and BIO_puts(). - -If the BIO_CLOSE flag is set when a memory BIO is freed then the underlying -BUF_MEM structure is also freed. - -Calling BIO_reset() on a read write memory BIO clears any data in it. On a -read only BIO it restores the BIO to its original state and the read only -data can be read again. - -BIO_eof() is true if no data is in the BIO. - -BIO_ctrl_pending() returns the number of bytes currently stored. - -BIO_set_mem_eof_return() sets the behaviour of memory BIO B<b> when it is -empty. If the B<v> is zero then an empty memory BIO will return EOF (that is -it will return zero and BIO_should_retry(b) will be false. If B<v> is non -zero then it will return B<v> when it is empty and it will set the read retry -flag (that is BIO_read_retry(b) is true). To avoid ambiguity with a normal -positive return value B<v> should be set to a negative value, typically -1. - -BIO_get_mem_data() sets B<pp> to a pointer to the start of the memory BIOs data -and returns the total amount of data available. It is implemented as a macro. - -BIO_set_mem_buf() sets the internal BUF_MEM structure to B<bm> and sets the -close flag to B<c>, that is B<c> should be either BIO_CLOSE or BIO_NOCLOSE. -It is a macro. - -BIO_get_mem_ptr() places the underlying BUF_MEM structure in B<pp>. It is -a macro. - -BIO_new_mem_buf() creates a memory BIO using B<len> bytes of data at B<buf>, -if B<len> is -1 then the B<buf> is assumed to be null terminated and its -length is determined by B<strlen>. The BIO is set to a read only state and -as a result cannot be written to. This is useful when some data needs to be -made available from a static area of memory in the form of a BIO. The -supplied data is read directly from the supplied buffer: it is B<not> copied -first, so the supplied area of memory must be unchanged until the BIO is freed. - -=head1 NOTES - -Writes to memory BIOs will always succeed if memory is available: that is -their size can grow indefinitely. - -Every read from a read write memory BIO will remove the data just read with -an internal copy operation, if a BIO contains a lots of data and it is -read in small chunks the operation can be very slow. The use of a read only -memory BIO avoids this problem. If the BIO must be read write then adding -a buffering BIO to the chain will speed up the process. - -=head1 BUGS - -There should be an option to set the maximum size of a memory BIO. - -There should be a way to "rewind" a read write BIO without destroying -its contents. - -The copying operation should not occur after every small read of a large BIO -to improve efficiency. - -=head1 EXAMPLE - -Create a memory BIO and write some data to it: - - BIO *mem = BIO_new(BIO_s_mem()); - BIO_puts(mem, "Hello World\n"); - -Create a read only memory BIO: - - char data[] = "Hello World"; - BIO *mem; - mem = BIO_new_mem_buf(data, -1); - -Extract the BUF_MEM structure from a memory BIO and then free up the BIO: - - BUF_MEM *bptr; - BIO_get_mem_ptr(mem, &bptr); - BIO_set_close(mem, BIO_NOCLOSE); /* So BIO_free() leaves BUF_MEM alone */ - BIO_free(mem); - - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_s_null.pod b/crypto/openssl/doc/crypto/BIO_s_null.pod deleted file mode 100644 index e5514f723898c..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_null.pod +++ /dev/null @@ -1,37 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_null - null data sink - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_null(void); - -=head1 DESCRIPTION - -BIO_s_null() returns the null sink BIO method. Data written to -the null sink is discarded, reads return EOF. - -=head1 NOTES - -A null sink BIO behaves in a similar manner to the Unix /dev/null -device. - -A null bio can be placed on the end of a chain to discard any data -passed through it. - -A null sink is useful if, for example, an application wishes to digest some -data by writing through a digest bio but not send the digested data anywhere. -Since a BIO chain must normally include a source/sink BIO this can be achieved -by adding a null sink BIO to the end of the chain - -=head1 RETURN VALUES - -BIO_s_null() returns the null sink BIO method. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_s_socket.pod b/crypto/openssl/doc/crypto/BIO_s_socket.pod deleted file mode 100644 index 253185185c7f1..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_s_socket.pod +++ /dev/null @@ -1,61 +0,0 @@ -=pod - -=head1 NAME - -BIO_s_socket, BIO_new_socket - socket BIO - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - BIO_METHOD * BIO_s_socket(void); - - #define BIO_set_fd(b,fd,c) BIO_int_ctrl(b,BIO_C_SET_FD,c,fd) - #define BIO_get_fd(b,c) BIO_ctrl(b,BIO_C_GET_FD,0,(char *)c) - - BIO *BIO_new_socket(int sock, int close_flag); - -=head1 DESCRIPTION - -BIO_s_socket() returns the socket BIO method. This is a wrapper -round the platform's socket routines. - -BIO_read() and BIO_write() read or write the underlying socket. -BIO_puts() is supported but BIO_gets() is not. - -If the close flag is set then the socket is shut down and closed -when the BIO is freed. - -BIO_set_fd() sets the socket of BIO B<b> to B<fd> and the close -flag to B<c>. - -BIO_get_fd() places the socket in B<c> if it is not NULL, it also -returns the socket . If B<c> is not NULL it should be of type (int *). - -BIO_new_socket() returns a socket BIO using B<sock> and B<close_flag>. - -=head1 NOTES - -Socket BIOs also support any relevant functionality of file descriptor -BIOs. - -The reason for having separate file descriptor and socket BIOs is that on some -platforms sockets are not file descriptors and use distinct I/O routines, -Windows is one such platform. Any code mixing the two will not work on -all platforms. - -=head1 RETURN VALUES - -BIO_s_socket() returns the socket BIO method. - -BIO_set_fd() always returns 1. - -BIO_get_fd() returns the socket or -1 if the BIO has not been -initialized. - -BIO_new_socket() returns the newly allocated BIO or NULL is an error -occurred. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_set_callback.pod b/crypto/openssl/doc/crypto/BIO_set_callback.pod deleted file mode 100644 index 9b6961ca8d4a8..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_set_callback.pod +++ /dev/null @@ -1,108 +0,0 @@ -=pod - -=head1 NAME - -BIO_set_callback, BIO_get_callback, BIO_set_callback_arg, BIO_get_callback_arg, -BIO_debug_callback - BIO callback functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - #define BIO_set_callback(b,cb) ((b)->callback=(cb)) - #define BIO_get_callback(b) ((b)->callback) - #define BIO_set_callback_arg(b,arg) ((b)->cb_arg=(char *)(arg)) - #define BIO_get_callback_arg(b) ((b)->cb_arg) - - long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi, - long argl,long ret); - - typedef long callback(BIO *b, int oper, const char *argp, - int argi, long argl, long retvalue); - -=head1 DESCRIPTION - -BIO_set_callback() and BIO_get_callback() set and retrieve the BIO callback, -they are both macros. The callback is called during most high level BIO -operations. It can be used for debugging purposes to trace operations on -a BIO or to modify its operation. - -BIO_set_callback_arg() and BIO_get_callback_arg() are macros which can be -used to set and retrieve an argument for use in the callback. - -BIO_debug_callback() is a standard debugging callback which prints -out information relating to each BIO operation. If the callback -argument is set if is interpreted as a BIO to send the information -to, otherwise stderr is used. - -callback() is the callback function itself. The meaning of each -argument is described below. - -The BIO the callback is attached to is passed in B<b>. - -B<oper> is set to the operation being performed. For some operations -the callback is called twice, once before and once after the actual -operation, the latter case has B<oper> or'ed with BIO_CB_RETURN. - -The meaning of the arguments B<argp>, B<argi> and B<argl> depends on -the value of B<oper>, that is the operation being performed. - -B<retvalue> is the return value that would be returned to the -application if no callback were present. The actual value returned -is the return value of the callback itself. In the case of callbacks -called before the actual BIO operation 1 is placed in retvalue, if -the return value is not positive it will be immediately returned to -the application and the BIO operation will not be performed. - -The callback should normally simply return B<retvalue> when it has -finished processing, unless if specifically wishes to modify the -value returned to the application. - -=head1 CALLBACK OPERATIONS - -=over 4 - -=item B<BIO_free(b)> - -callback(b, BIO_CB_FREE, NULL, 0L, 0L, 1L) is called before the -free operation. - -=item B<BIO_read(b, out, outl)> - -callback(b, BIO_CB_READ, out, outl, 0L, 1L) is called before -the read and callback(b, BIO_CB_READ|BIO_CB_RETURN, out, outl, 0L, retvalue) -after. - -=item B<BIO_write(b, in, inl)> - -callback(b, BIO_CB_WRITE, in, inl, 0L, 1L) is called before -the write and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, inl, 0L, retvalue) -after. - -=item B<BIO_gets(b, out, outl)> - -callback(b, BIO_CB_GETS, out, outl, 0L, 1L) is called before -the operation and callback(b, BIO_CB_GETS|BIO_CB_RETURN, out, outl, 0L, retvalue) -after. - -=item B<BIO_puts(b, in)> - -callback(b, BIO_CB_WRITE, in, 0, 0L, 1L) is called before -the operation and callback(b, BIO_CB_WRITE|BIO_CB_RETURN, in, 0, 0L, retvalue) -after. - -=item B<BIO_ctrl(BIO *b, int cmd, long larg, void *parg)> - -callback(b,BIO_CB_CTRL,parg,cmd,larg,1L) is called before the call and -callback(b,BIO_CB_CTRL|BIO_CB_RETURN,parg,cmd, larg,ret) after. - -=back - -=head1 EXAMPLE - -The BIO_debug_callback() function is a good example, its source is -in crypto/bio/bio_cb.c - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/BIO_should_retry.pod b/crypto/openssl/doc/crypto/BIO_should_retry.pod deleted file mode 100644 index 539c3912728ca..0000000000000 --- a/crypto/openssl/doc/crypto/BIO_should_retry.pod +++ /dev/null @@ -1,114 +0,0 @@ -=pod - -=head1 NAME - -BIO_should_retry, BIO_should_read, BIO_should_write, -BIO_should_io_special, BIO_retry_type, BIO_should_retry, -BIO_get_retry_BIO, BIO_get_retry_reason - BIO retry functions - -=head1 SYNOPSIS - - #include <openssl/bio.h> - - #define BIO_should_read(a) ((a)->flags & BIO_FLAGS_READ) - #define BIO_should_write(a) ((a)->flags & BIO_FLAGS_WRITE) - #define BIO_should_io_special(a) ((a)->flags & BIO_FLAGS_IO_SPECIAL) - #define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS) - #define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY) - - #define BIO_FLAGS_READ 0x01 - #define BIO_FLAGS_WRITE 0x02 - #define BIO_FLAGS_IO_SPECIAL 0x04 - #define BIO_FLAGS_RWS (BIO_FLAGS_READ|BIO_FLAGS_WRITE|BIO_FLAGS_IO_SPECIAL) - #define BIO_FLAGS_SHOULD_RETRY 0x08 - - BIO * BIO_get_retry_BIO(BIO *bio, int *reason); - int BIO_get_retry_reason(BIO *bio); - -=head1 DESCRIPTION - -These functions determine why a BIO is not able to read or write data. -They will typically be called after a failed BIO_read() or BIO_write() -call. - -BIO_should_retry() is true if the call that produced this condition -should then be retried at a later time. - -If BIO_should_retry() is false then the cause is an error condition. - -BIO_should_read() is true if the cause of the condition is that a BIO -needs to read data. - -BIO_should_write() is true if the cause of the condition is that a BIO -needs to read data. - -BIO_should_io_special() is true if some "special" condition, that is a -reason other than reading or writing is the cause of the condition. - -BIO_get_retry_reason() returns a mask of the cause of a retry condition -consisting of the values B<BIO_FLAGS_READ>, B<BIO_FLAGS_WRITE>, -B<BIO_FLAGS_IO_SPECIAL> though current BIO types will only set one of -these. - -BIO_get_retry_BIO() determines the precise reason for the special -condition, it returns the BIO that caused this condition and if -B<reason> is not NULL it contains the reason code. The meaning of -the reason code and the action that should be taken depends on -the type of BIO that resulted in this condition. - -BIO_get_retry_reason() returns the reason for a special condition if -passed the relevant BIO, for example as returned by BIO_get_retry_BIO(). - -=head1 NOTES - -If BIO_should_retry() returns false then the precise "error condition" -depends on the BIO type that caused it and the return code of the BIO -operation. For example if a call to BIO_read() on a socket BIO returns -0 and BIO_should_retry() is false then the cause will be that the -connection closed. A similar condition on a file BIO will mean that it -has reached EOF. Some BIO types may place additional information on -the error queue. For more details see the individual BIO type manual -pages. - -If the underlying I/O structure is in a blocking mode almost all current -BIO types will not request a retry, because the underlying I/O -calls will not. If the application knows that the BIO type will never -signal a retry then it need not call BIO_should_retry() after a failed -BIO I/O call. This is typically done with file BIOs. - -SSL BIOs are the only current exception to this rule: they can request a -retry even if the underlying I/O structure is blocking, if a handshake -occurs during a call to BIO_read(). An application can retry the failed -call immediately or avoid this situation by setting SSL_MODE_AUTO_RETRY -on the underlying SSL structure. - -While an application may retry a failed non blocking call immediately -this is likely to be very inefficient because the call will fail -repeatedly until data can be processed or is available. An application -will normally wait until the necessary condition is satisfied. How -this is done depends on the underlying I/O structure. - -For example if the cause is ultimately a socket and BIO_should_read() -is true then a call to select() may be made to wait until data is -available and then retry the BIO operation. By combining the retry -conditions of several non blocking BIOs in a single select() call -it is possible to service several BIOs in a single thread, though -the performance may be poor if SSL BIOs are present because long delays -can occur during the initial handshake process. - -It is possible for a BIO to block indefinitely if the underlying I/O -structure cannot process or return any data. This depends on the behaviour of -the platforms I/O functions. This is often not desirable: one solution -is to use non blocking I/O and use a timeout on the select() (or -equivalent) call. - -=head1 BUGS - -The OpenSSL ASN1 functions cannot gracefully deal with non blocking I/O: -that is they cannot retry after a partial read or write. This is usually -worked around by only passing the relevant data to ASN1 functions when -the entire structure can be read or written. - -=head1 SEE ALSO - -TBA diff --git a/crypto/openssl/doc/crypto/bio.pod b/crypto/openssl/doc/crypto/bio.pod deleted file mode 100644 index 24f61dfb5626e..0000000000000 --- a/crypto/openssl/doc/crypto/bio.pod +++ /dev/null @@ -1,54 +0,0 @@ -=pod - -=head1 NAME - -bio - I/O abstraction - -=head1 SYNOPSIS - - #include <openssl/bio.h> - -TBA - - -=head1 DESCRIPTION - -A BIO is an I/O abstraction, it hides many of the underlying I/O -details from an application. If an application uses a BIO for its -I/O it can transparently handle SSL connections, unencrypted network -connections and file I/O. - -There are two type of BIO, a source/sink BIO and a filter BIO. - -As its name implies a source/sink BIO is a source and/or sink of data, -examples include a socket BIO and a file BIO. - -A filter BIO takes data from one BIO and passes it through to -another, or the application. The data may be left unmodified (for -example a message digest BIO) or translated (for example an -encryption BIO). The effect of a filter BIO may change according -to the I/O operation it is performing: for example an encryption -BIO will encrypt data if it is being written to and decrypt data -if it is being read from. - -BIOs can be joined together to form a chain (a single BIO is a chain -with one component). A chain normally consist of one source/sink -BIO and one or more filter BIOs. Data read from or written to the -first BIO then traverses the chain to the end (normally a source/sink -BIO). - -=head1 SEE ALSO - -L<BIO_ctrl(3)|BIO_ctrl(3)>, -L<BIO_f_base64(3)|BIO_f_base64(3)>, -L<BIO_f_cipher(3)|BIO_f_cipher(3)>, L<BIO_f_md(3)|BIO_f_md(3)>, -L<BIO_f_null(3)|BIO_f_null(3)>, L<BIO_f_ssl(3)|BIO_f_ssl(3)>, -L<BIO_find_type(3)|BIO_find_type(3)>, L<BIO_new(3)|BIO_new(3)>, -L<BIO_new_bio_pair(3)|BIO_new_bio_pair(3)>, -L<BIO_push(3)|BIO_push(3)>, L<BIO_read(3)|BIO_read(3)>, -L<BIO_s_accept(3)|BIO_s_accept(3)>, L<BIO_s_bio(3)|BIO_s_bio(3)>, -L<BIO_s_connect(3)|BIO_s_connect(3)>, L<BIO_s_fd(3)|BIO_s_fd(3)>, -L<BIO_s_file(3)|BIO_s_file(3)>, L<BIO_s_mem(3)|BIO_s_mem(3)>, -L<BIO_s_null(3)|BIO_s_null(3)>, L<BIO_s_socket(3)|BIO_s_socket(3)>, -L<BIO_set_callback(3)|BIO_set_callback(3)>, -L<BIO_should_retry(3)|BIO_should_retry(3)> diff --git a/crypto/openssl/doc/crypto/evp.pod b/crypto/openssl/doc/crypto/evp.pod deleted file mode 100644 index f089dd49a219b..0000000000000 --- a/crypto/openssl/doc/crypto/evp.pod +++ /dev/null @@ -1,37 +0,0 @@ -=pod - -=head1 NAME - -evp - high-level cryptographic functions - -=head1 SYNOPSIS - - #include <openssl/evp.h> - -=head1 DESCRIPTION - -The EVP library provided a high-level interface to cryptographic -functions. - -B<EVP_Seal>I<...> and B<EVP_Open>I<...> provide public key encryption -and decryption to implement digital "envelopes". - -The B<EVP_Sign>I<...> and B<EVP_Verify>I<...> functions implement -digital signatures. - -Symmetric encryption is available with the B<EVP_Encrypt>I<...> -functions. The B<EVP_Digest>I<...> functions provide message digests. - -Algorithms are loaded with OpenSSL_add_all_algorithms(3). - -=head1 SEE ALSO - -L<EVP_DigestInit(3)|EVP_DigestInit(3)>, -L<EVP_EncryptInit(3)|EVP_EncryptInit(3)>, -L<EVP_OpenInit(3)|EVP_OpenInit(3)>, -L<EVP_SealInit(3)|EVP_SealInit(3)>, -L<EVP_SignInit(3)|EVP_SignInit(3)>, -L<EVP_VerifyInit(3)|EVP_VerifyInit(3)>, -L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_CIPHER_get_name.pod b/crypto/openssl/doc/ssl/SSL_CIPHER_get_name.pod deleted file mode 100644 index 7fea14ee68675..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_CIPHER_get_name.pod +++ /dev/null @@ -1,57 +0,0 @@ -=pod - -=head1 NAME - -SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, -SSL_CIPHER_description - get SSL_CIPHER properties - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - const char *SSL_CIPHER_get_name(SSL_CIPHER *cipher); - int SSL_CIPHER_get_bits(SSL_CIPHER *cipher, int *alg_bits); - char *SSL_CIPHER_get_version(SSL_CIPHER *cipher); - char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int size); - -=head1 DESCRIPTION - -SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the -argument is the NULL pointer, a pointer to the constant value "NONE" is -returned. - -SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>. If -B<alg_bits> is not NULL, it contains the number of bits processed by the -chosen algorithm. If B<cipher> is NULL, 0 is returned. - -SSL_CIPHER_get_version() returns the protocol version for B<cipher>, currently -"SSLv2", "SSLv3", or "TLSv1". If B<cipher> is NULL, "(NONE)" is returned. - -SSL_CIPHER_description() returns a textual description of the cipher used -into the buffer B<buf> of length B<len> provided. B<len> must be at least -128 bytes, otherwise the string "Buffer too small" is returned. If B<buf> -is NULL, a buffer of 128 bytes is allocated using OPENSSL_malloc(). If the -allocation fails, the string "OPENSSL_malloc Error" is returned. - -=head1 NOTES - -The number of bits processed can be different from the secret bits. An -export cipher like e.g. EXP-RC4-MD5 has only 40 secret bits. The algorithm -does use the full 128 bits (which would be returned for B<alg_bits>), of -which however 88bits are fixed. The search space is hence only 40 bits. - -=head1 BUGS - -If SSL_CIPHER_description() is called with B<cipher> being NULL, the -library crashes. - -=head1 RETURN VALUES - -See DESCRIPTION - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_current_cipher(3)|SSL_get_current_cipher(3)>, -L<SSL_get_ciphers(3)|SSL_get_ciphers(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_CTX_free.pod b/crypto/openssl/doc/ssl/SSL_CTX_free.pod deleted file mode 100644 index de6967242220a..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_CTX_free.pod +++ /dev/null @@ -1,29 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_free - free an allocated SSL_CTX object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_CTX_free(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_CTX_free() decrements the reference count of B<ctx>, and removes the -SSL_CTX object pointed to by B<ctx> and frees up the allocated memory if the -the reference count has reached 0. - -It also calls the free()ing procedures for indirectly affected items, if -applicable: the session cacahe, the list of ciphers, the list of Client CAs, -the certificates and keys. - -=head1 RETURN VALUES - -SSL_CTX_free() does not provide diagnostic information. - -L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_CTX_new.pod b/crypto/openssl/doc/ssl/SSL_CTX_new.pod deleted file mode 100644 index e166c692c3559..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_CTX_new.pod +++ /dev/null @@ -1,93 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_new - create a new SSL_CTX object as framework for TLS/SSL enabled functions - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_CTX *SSL_CTX_new(SSL_METHOD *method); - -=head1 DESCRIPTION - -SSL_CTX_new() creates a new B<SSL_CTX> object as framework to establish -TLS/SSL enabled connections. - -=head1 NOTES - -The SSL_CTX object uses B<method> as connection method. The methods exist -in a generic type (for client and server use), a server only type, and a -client only type. B<method> can be of the following types: - -=over 4 - -=item SSLv2_method(void), SSLv2_server_method(void), SSLv2_client_method(void) - -A TLS/SSL connection established with these methods will only understand -the SSLv2 protocol. A client will send out SSLv2 client hello messages -and will also indicate that it only understand SSLv2. A server will only -understand SSLv2 client hello messages. - -=item SSLv3_method(void), SSLv3_server_method(void), SSLv3_client_method(void) - -A TLS/SSL connection established with these methods will only understand the -SSLv3 and TLSv1 protocol. A client will send out SSLv3 client hello messages -and will indicate that it also understands TLSv1. A server will only understand -SSLv3 and TLSv1 client hello messages. This especially means, that it will -not understand SSLv2 client hello messages which are widely used for -compatibility reasons, see SSLv23_*_method(). - -=item TLSv1_method(void), TLSv1_server_method(void), TLSv1_client_method(void) - -A TLS/SSL connection established with these methods will only understand the -TLSv1 protocol. A client will send out TLSv1 client hello messages -and will indicate that it only understands TLSv1. A server will only understand -TLSv1 client hello messages. This especially means, that it will -not understand SSLv2 client hello messages which are widely used for -compatibility reasons, see SSLv23_*_method(). - -=item SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void) - -A TLS/SSL connection established with these methods will understand the SSLv2, -SSLv3, and TLSv1 protocol. A client will send out SSLv2 client hello messages -and will indicate that it also understands SSLv3 and TLSv1. A server will -understand SSLv2, SSLv3, and TLSv1 client hello messages. This is the best -choice when compatibility is a concern. - -=back - -The list of protocols available can later be limited using the SSL_OP_NO_SSLv2, -SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1 options of the B<SSL_CTX_set_options()> or -B<SSL_set_options()> functions. Using these options it is possible to choose -e.g. SSLv23_server_method() and be able to negotiate with all possible -clients, but to only allow newer protocols like SSLv3 or TLSv1. - -SSL_CTX_new() initializes the list of ciphers, the session cache setting, -the callbacks, the keys and certificates, and the options to its default -values. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -The creation of a new SSL_CTX object failed. Check the error stack to -find out the reason. - -=item Pointer to an SSL_CTX object - -The return value points to an allocated SSL_CTX object. - -=back - -=head1 SEE ALSO - -L<SSL_CTX_free(3)|SSL_CTX_free(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_CTX_set_cipher_list.pod b/crypto/openssl/doc/ssl/SSL_CTX_set_cipher_list.pod deleted file mode 100644 index 272d6b3de282e..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_CTX_set_cipher_list.pod +++ /dev/null @@ -1,52 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_cipher_list, SSL_set_cipher_list -- choose list of available SSL_CIPHERs - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str); - int SSL_set_cipher_list(SSL *ssl, const char *str); - -=head1 DESCRIPTION - -SSL_CTX_set_cipher_list() sets the list of available ciphers for B<ctx> -using the control string B<str>. The format of the string is described -in L<ciphers(1)|ciphers(1)>. The list of ciphers is inherited by all -B<ssl> objects created from B<ctx>. - -SSL_set_cipher_list() sets the list of ciphers only for B<ssl>. - -=head1 NOTES - -The control string B<str> should be universally usable and not depend -on details of the library configuration (ciphers compiled in). Thus no -syntax checking takes place. Items that are not recognized, because the -corresponding ciphers are not compiled in or because they are mistyped, -are simply ignored. Failure is only flagged if no ciphers could be collected -at all. - -It should be noted, that inclusion of a cipher to be used into the list is -a necessary condition. On the client side, the inclusion into the list is -also sufficient. On the server side, additional restrictions apply. All ciphers -have additional requirements. ADH ciphers don't need a certificate, but -DH-parameters must have been set. All other ciphers need a corresponding -certificate and key. A RSA cipher can only be chosen, when a RSA certificate is -available, the respective is valid for DSA ciphers. Ciphers using EDH need -a certificate and key and DH-parameters. - -=head1 RETURN VALUES - -SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher -could be selected and 0 on complete failure. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, -L<ciphers(1)|ciphers(1)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod b/crypto/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod deleted file mode 100644 index 3091bd6895f8c..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_CTX_set_ssl_version.pod +++ /dev/null @@ -1,60 +0,0 @@ -=pod - -=head1 NAME - -SSL_CTX_set_ssl_version, SSL_set_ssl_method, SSL_get_ssl_method -- choose a new TLS/SSL method - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_CTX_set_ssl_version(SSL_CTX *ctx, SSL_METHOD *method); - int SSL_set_ssl_method(SSL *s, SSL_METHOD *method); - SSL_METHOD *SSL_get_ssl_method(SSL *ssl); - -=head1 DESCRIPTION - -SSL_CTX_set_ssl_version() sets a new default TLS/SSL B<method> for SSL objects -newly created from this B<ctx>. SSL objects already created with -L<SSL_new(3)|SSL_new(3)> are not affected, except when SSL_clear() is -being called. - -SSL_set_ssl_method() sets a new TLS/SSL B<method> for a particular B<ssl> -object. It may be reset, when SSL_clear() is called. - -SSL_get_ssl_method() returns a function pointer to the TLS/SSL method -set in B<ssl>. - -=head1 NOTES - -The available B<method> choices are described in -L<SSL_CTX_new(3)|SSL_CTX_new(3)>. - -When SSL_clear() is called and no session is connected to an SSL object, -the method of the SSL object is reset to the method currently set in -the corresponding SSL_CTX object. - -=head1 RETURN VALUES - -The following return values can occur for SSL_CTX_set_ssl_version() -and SSL_set_ssl_method(): - -=over 4 - -=item 0 - -The new choice failed, check the error stack to find out the reason. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<SSL_new(3)|SSL_new(3)>, -L<SSL_clear(3)|SSL_clear(3)>, L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_SESSION_free.pod b/crypto/openssl/doc/ssl/SSL_SESSION_free.pod deleted file mode 100644 index df30ccbb320f9..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_SESSION_free.pod +++ /dev/null @@ -1,25 +0,0 @@ -=pod - -=head1 NAME - -SSL_SESSION_free - free an allocated SSL_SESSION structure - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_SESSION_free(SSL_SESSION *session); - -=head1 DESCRIPTION - -SSL_SESSION_free() decrements the reference count of B<session> and removes -the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated -memory, if the the reference count has reached 0. - -=head1 RETURN VALUES - -SSL_SESSION_free() does not provide diagnostic information. - -L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_accept.pod b/crypto/openssl/doc/ssl/SSL_accept.pod deleted file mode 100644 index 0c79ac515e1d4..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_accept.pod +++ /dev/null @@ -1,72 +0,0 @@ -=pod - -=head1 NAME - -SSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_accept(SSL *ssl); - -=head1 DESCRIPTION - -SSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. -The communication channel must already have been set and assigned to the -B<ssl> by setting an underlying B<BIO>. - -=head1 NOTES - -The behaviour of SSL_accept() depends on the underlying BIO. - -If the underlying BIO is B<blocking>, SSL_accept() will only return once the -handshake has been finished or an error occurred, except for SGC (Server -Gated Cryptography). For SGC, SSL_accept() may return with -1, but -SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and SSL_accept() -should be called again. - -If the underlying BIO is B<non-blocking>, SSL_accept() will also return -when the underlying BIO could not satisfy the needs of SSL_accept() -to continue the handshake. In this case a call to SSL_get_error() with the -return value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_accept(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been -established. - -=item 0 - -The TLS/SSL handshake was not successful but was shut down controlled and -by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=item -1 - -The TLS/SSL handshake was not successful because a fatal error occurred either -at the protocol level or a connection failure occurred. The shutdown was -not clean. It can also occur of action is need to continue the operation -for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> -to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_clear.pod b/crypto/openssl/doc/ssl/SSL_clear.pod deleted file mode 100644 index 862fd8291df18..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_clear.pod +++ /dev/null @@ -1,39 +0,0 @@ -=pod - -=head1 NAME - -SSL_clear - reset SSL object to allow another connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_clear(SSL *ssl); - -=head1 DESCRIPTION - -Reset B<ssl> to allow another connection. All settings (method, ciphers, -BIOs) are kept. A completely negotiated B<SSL_SESSION> is not freed but left -untouched for the underlying B<SSL_CTX>. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The SSL_clear() operation could not be performed. Check the error stack to -find out the reason. - -=item 1 - -The SSL_clear() operation was successful. - -=back - -L<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>, -L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_connect.pod b/crypto/openssl/doc/ssl/SSL_connect.pod deleted file mode 100644 index debe41744f0a9..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_connect.pod +++ /dev/null @@ -1,69 +0,0 @@ -=pod - -=head1 NAME - -SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_connect(SSL *ssl); - -=head1 DESCRIPTION - -SSL_connect() initiates the TLS/SSL handshake with a server. The communication -channel must already have been set and assigned to the B<ssl> by setting an -underlying B<BIO>. - -=head1 NOTES - -The behaviour of SSL_connect() depends on the underlying BIO. - -If the underlying BIO is B<blocking>, SSL_connect() will only return once the -handshake has been finished or an error occurred. - -If the underlying BIO is B<non-blocking>, SSL_connect() will also return -when the underlying BIO could not satisfy the needs of SSL_connect() -to continue the handshake. In this case a call to SSL_get_error() with the -return value of SSL_connect() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_connect(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been -established. - -=item 0 - -The TLS/SSL handshake was not successful but was shut down controlled and -by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=item -1 - -The TLS/SSL handshake was not successful, because a fatal error occurred either -at the protocol level or a connection failure occurred. The shutdown was -not clean. It can also occur of action is need to continue the operation -for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> -to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_free.pod b/crypto/openssl/doc/ssl/SSL_free.pod deleted file mode 100644 index f3f0c345f8a1f..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_free.pod +++ /dev/null @@ -1,33 +0,0 @@ -=pod - -=head1 NAME - -SSL_free - free an allocated SSL structure - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_free(SSL *ssl); - -=head1 DESCRIPTION - -SSL_free() decrements the reference count of B<ssl>, and removes the SSL -structure pointed to by B<ssl> and frees up the allocated memory if the -the reference count has reached 0. - -It also calls the free()ing procedures for indirectly affected items, if -applicable: the buffering BIO, the read and write BIOs, -cipher lists specially created for this B<ssl>, the B<SSL_SESSION>. -Do not explicitly free these indirectly freed up items before or after -calling SSL_free(), as trying to free things twice may lead to program -failure. - -=head1 RETURN VALUES - -SSL_free() does not provide diagnostic information. - -L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_ciphers.pod b/crypto/openssl/doc/ssl/SSL_get_ciphers.pod deleted file mode 100644 index 2a57455c235d2..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_ciphers.pod +++ /dev/null @@ -1,42 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_ciphers, SSL_get_cipher_list - get list of available SSL_CIPHERs - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - STACK_OF(SSL_CIPHER) *SSL_get_ciphers(SSL *ssl); - const char *SSL_get_cipher_list(SSL *ssl, int priority); - -=head1 DESCRIPTION - -SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>, -sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL -is returned. - -SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER -listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are -available, or there are less ciphers than B<priority> available, NULL -is returned. - -=head1 NOTES - -The details of the ciphers obtained by SSL_get_ciphers() can be obtained using -the L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> family of functions. - -Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the -sorted list of available ciphers, until NULL is returned. - -=head1 RETURN VALUES - -See DESCRIPTION - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, -L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_current_cipher.pod b/crypto/openssl/doc/ssl/SSL_get_current_cipher.pod deleted file mode 100644 index 2dd7261d89dcd..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_current_cipher.pod +++ /dev/null @@ -1,43 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_current_cipher, SSL_get_cipher, SSL_get_cipher_name, -SSL_get_cipher_bits, SSL_get_cipher_version - get SSL_CIPHER of a connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_CIPHER *SSL_get_current_cipher(SSL *ssl); - #define SSL_get_cipher(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) - #define SSL_get_cipher_name(s) \ - SSL_CIPHER_get_name(SSL_get_current_cipher(s)) - #define SSL_get_cipher_bits(s,np) \ - SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) - #define SSL_get_cipher_version(s) \ - SSL_CIPHER_get_version(SSL_get_current_cipher(s)) - -=head1 DESCRIPTION - -SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing -the description of the actually used cipher of a connection established with -the B<ssl> object. - -SSL_get_cipher() and SSL_get_cipher_name() are identical macros to obtain the -name of the currently used cipher. SSL_get_cipher_bits() is a -macro to obtain the number of secret/algorithm bits used and -SSL_get_cipher_version() returns the protocol name. -See L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> for more details. - -=head1 RETURN VALUES - -SSL_get_current_cipher() returns the cipher actually used or NULL, when -no session has been established. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_fd.pod b/crypto/openssl/doc/ssl/SSL_get_fd.pod deleted file mode 100644 index a3f76259316f5..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_fd.pod +++ /dev/null @@ -1,44 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_fd - get file descriptor linked to an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_get_fd(SSL *ssl); - int SSL_get_rfd(SSL *ssl); - int SSL_get_wfd(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_fd() returns the file descriptor which is linked to B<ssl>. -SSL_get_rfd() and SSL_get_wfd() return the file descriptors for the -read or the write channel, which can be different. If the read and the -write channel are different, SSL_get_fd() will return the file descriptor -of the read channel. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item -1 - -The operation failed, because the underlying BIO is not of the correct type -(suitable for file descriptors). - -=item E<gt>=0 - -The file descriptor linked to B<ssl>. - -=back - -=head1 SEE ALSO - -L<SSL_set_fd(3)|SSL_set_fd(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod b/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod deleted file mode 100644 index e93e8206faf52..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_peer_cert_chain.pod +++ /dev/null @@ -1,52 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_peer_cert_chain - get the X509 certificate chain of the peer - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - STACKOF(X509) *SSL_get_peer_cert_chain(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_peer_cert_chain() returns a pointer to STACKOF(X509) certificates -forming the certificate chain of the peer. If called on the client side, -the stack also contains the peer's certificate; if called on the server -side, the peer's certificate must be obtained seperately using -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. -If the peer did not present a certificate, NULL is returned. - -=head1 NOTES - -The peer certificate chain is not necessarily available after reusing -a session, in which case a NULL pointer is returned. - -The reference count of the STACKOF(X509) object is not incremented. -If the corresponding session is freed, the pointer must not be used -any longer. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -No certificate was presented by the peer or no connection was established -or the certificate chain is no longer available when a session is reused. - -=item Pointer to a STACKOF(X509) - -The return value points to the certificate chain presented by the peer. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_peer_certificate.pod b/crypto/openssl/doc/ssl/SSL_get_peer_certificate.pod deleted file mode 100644 index 79c089aa5172a..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_peer_certificate.pod +++ /dev/null @@ -1,48 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_peer_certificate - get the X509 certificate of the peer - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - X509 *SSL_get_peer_certificate(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_peer_certificate() returns a pointer to the X509 certificate the -peer presented. If the peer did not present a certificate, NULL is returned. - -=head1 NOTES - -That a certificate is returned does not indicate information about the -verification state, use L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> -to check the verification state. - -The reference count of the X509 object is incremented by one, so that it -will not be destroyed when the session containing the peer certificate is -freed. The X509 object must be explicitely freed using X509_free(). - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -No certificate was presented by the peer or no connection was established. - -=item Pointer to an X509 certificate - -The return value points to the certificate presented by the peer. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_rbio.pod b/crypto/openssl/doc/ssl/SSL_get_rbio.pod deleted file mode 100644 index 3d98233cacee7..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_rbio.pod +++ /dev/null @@ -1,40 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_rbio - get BIO linked to an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - BIO *SSL_get_rbio(SSL *ssl); - BIO *SSL_get_wbio(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_rbio() and SSL_get_wbio() return pointers to the BIOs for the -read or the write channel, which can be different. The reference count -of the BIO is not incremented. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -No BIO was connected to the SSL object - -=item Any other pointer - -The BIO linked to B<ssl>. - -=back - -=head1 SEE ALSO - -L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_session.pod b/crypto/openssl/doc/ssl/SSL_get_session.pod deleted file mode 100644 index aff41fb9cf624..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_session.pod +++ /dev/null @@ -1,48 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_session - retrieve TLS/SSL session data - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL_SESSION *SSL_get_session(SSL *ssl); - SSL_SESSION *SSL_get0_session(SSL *ssl); - SSL_SESSION *SSL_get1_session(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_session() returns a pointer to the B<SSL_SESSION> actually used in -B<ssl>. The reference count of the B<SSL_SESSION> is not incremented, so -that the pointer can become invalid when the B<ssl> is freed and -SSL_SESSION_free() is implicitly called. - -SSL_get0_session() is the same as SSL_get_session(). - -SSL_get1_session() is the same as SSL_get_session(), but the reference -count of the B<SSL_SESSION> is incremented by one. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -There is no session available in B<ssl>. - -=item Pointer to an SSL - -The return value points to the data of an SSL session. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_free(3)|SSL_free(3)>, -L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_get_verify_result.pod b/crypto/openssl/doc/ssl/SSL_get_verify_result.pod deleted file mode 100644 index 4d66236a05ea7..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_get_verify_result.pod +++ /dev/null @@ -1,57 +0,0 @@ -=pod - -=head1 NAME - -SSL_get_verify_result - get result of peer certificate verification - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - long SSL_get_verify_result(SSL *ssl); - -=head1 DESCRIPTION - -SSL_get_verify_result() returns the result of the verification of the -X509 certificate presented by the peer, if any. - -=head1 NOTES - -SSL_get_verify_result() can only return one error code while the verification -of a certificate can fail because of many reasons at the same time. Only -the last verification error that occured during the processing is available -from SSL_get_verify_result(). - -The verification result is part of the established session and is restored -when a session is reused. - -=head1 BUGS - -If no peer certificate was presented, the returned result code is -X509_V_OK. This is because no verification error occured, it does however -not indicate success. SSL_get_verify_result() is only useful in connection -with L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. - -=head1 RETURN VALUES - -The following return values can currently occur: - -=over 4 - -=item X509_V_OK - -The verification succeeded or no peer certificate was presented. - -=item Any other value - -Documented in L<verify(1)|verify(1)>. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_set_verify_result(3)|SSL_set_verify_result(3)>, -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, -L<verify(1)|verify(1)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_library_init.pod b/crypto/openssl/doc/ssl/SSL_library_init.pod deleted file mode 100644 index ecf3c4858e528..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_library_init.pod +++ /dev/null @@ -1,52 +0,0 @@ -=pod - -=head1 NAME - -SSL_library_init, OpenSSL_add_ssl_algorithms, SSLeay_add_ssl_algorithms -- initialize SSL library by registering algorithms - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_library_init(void); - #define OpenSSL_add_ssl_algorithms() SSL_library_init() - #define SSLeay_add_ssl_algorithms() SSL_library_init() - -=head1 DESCRIPTION - -SSL_library_init() registers the available ciphers and digests. - -OpenSSL_add_ssl_algorithms() and SSLeay_add_ssl_algorithms() are synonyms -for SSL_library_init(). - -=head1 NOTES - -SSL_library_init() must be called before any other action takes place. - -=head1 WARNING - -SSL_library_init() only registers ciphers. Another important initialization -is the seeding of the PRNG (Pseudo Random Number Generator), which has to -be performed separately. - -=head1 EXAMPLES - -A typical TLS/SSL application will start with the library initialization, -will provide readable error messages and will seed the PRNG. - - SSL_load_error_strings(); /* readable error messages */ - SSL_library_init(); /* initialize library */ - actions_to_seed_PRNG(); - -=head1 RETURN VALUES - -SSL_library_init() always returns "1", so it is safe to discard the return -value. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>, -L<RAND_add(3)|RAND_add(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_new.pod b/crypto/openssl/doc/ssl/SSL_new.pod deleted file mode 100644 index 8e8638fa95610..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_new.pod +++ /dev/null @@ -1,42 +0,0 @@ -=pod - -=head1 NAME - -SSL_new - create a new SSL structure for a connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - SSL *SSL_new(SSL_CTX *ctx); - -=head1 DESCRIPTION - -SSL_new() creates a new B<SSL> structure which is needed to hold the -data for a TLS/SSL connection. The new structure inherits the settings -of the underlying context B<ctx>: connection method (SSLv2/v3/TLSv1), -options, verification settings, timeout settings. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item NULL - -The creation of a new SSL structure failed. Check the error stack to -find out the reason. - -=item Pointer to an SSL structure - -The return value points to an allocated SSL structure. - -=back - -=head1 SEE ALSO - -L<SSL_free(3)|SSL_free(3)>, L<SSL_clear(3)|SSL_clear(3)>, -L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_pending.pod b/crypto/openssl/doc/ssl/SSL_pending.pod deleted file mode 100644 index 744e1855e151c..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_pending.pod +++ /dev/null @@ -1,30 +0,0 @@ -=pod - -=head1 NAME - -SSL_pending - obtain number of readable bytes buffered in an SSL object - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_pending(SSL *ssl); - -=head1 DESCRIPTION - -SSL_pending() returns the number of bytes which are available inside -B<ssl> for immediate read. - -=head1 NOTES - -Data are received in blocks from the peer. Therefore data can be buffered -inside B<ssl> and are ready for immediate retrieval with -L<SSL_read(3)|SSL_read(3)>. - -=head1 RETURN VALUES - -The number of bytes pending is returned. - -L<SSL_read(3)|SSL_read(3)>, L<ssl(3)|ssl(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_read.pod b/crypto/openssl/doc/ssl/SSL_read.pod deleted file mode 100644 index 072dc26cf2843..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_read.pod +++ /dev/null @@ -1,77 +0,0 @@ -=pod - -=head1 NAME - -SSL_read - read bytes from a TLS/SSL connection. - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_read(SSL *ssl, char *buf, int num); - -=head1 DESCRIPTION - -SSL_read() tries to read B<num> bytes from the specified B<ssl> into the -buffer B<buf>. - -=head1 NOTES - -If necessary, SSL_read() will negotiate a TLS/SSL session, if -not already explicitly performed by SSL_connect() or SSL_accept(). If the -peer requests a re-negotiation, it will be performed transparently during -the SSL_read() operation. The behaviour of SSL_read() depends on the -underlying BIO. - -If the underlying BIO is B<blocking>, SSL_read() will only return, once the -read operation has been finished or an error occurred. - -If the underlying BIO is B<non-blocking>, SSL_read() will also return -when the underlying BIO could not satisfy the needs of SSL_read() -to continue the operation. In this case a call to SSL_get_error() with the -return value of SSL_read() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a -call to SSL_read() can also cause write operations! The calling process -then must repeat the call after taking appropriate action to satisfy the -needs of SSL_read(). The action depends on the underlying BIO. When using a -non-blocking socket, nothing is to be done, but select() can be used to check -for the required condition. When using a buffering BIO, like a BIO pair, data -must be written into or retrieved out of the BIO before being able to continue. - -=head1 WARNING - -When an SSL_read() operation has to be repeated because of -B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated -with the same arguments. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item E<gt>0 - -The read operation was successful; the return value is the number of -bytes actually read from the TLS/SSL connection. - -=item 0 - -The read operation was not successful, probably because no data was -available. Call SSL_get_error() with the return value B<ret> to find out, -whether an error occurred. - -=item -1 - -The read operation was not successful, because either an error occurred -or action must be taken by the calling process. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_write(3)|SSL_write(3)>, -L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_set_bio.pod b/crypto/openssl/doc/ssl/SSL_set_bio.pod deleted file mode 100644 index 67c9756d3fe5e..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_set_bio.pod +++ /dev/null @@ -1,34 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_bio - connect the SSL object with a BIO - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio); - -=head1 DESCRIPTION - -SSL_set_bio() connects the BIOs B<rbio> and B<wbio> for the read and write -operations of the TLS/SSL (encrypted) side of B<ssl>. - -The SSL engine inherits the behaviour of B<rbio> and B<wbio>, respectively. -If a BIO is non-blocking, the B<ssl> will also have non-blocking behaviour. - -If there was already a BIO connected to B<ssl>, BIO_free() will be called -(for both the reading and writing side, if different). - -=head1 RETURN VALUES - -SSL_set_bio() cannot fail. - -=head1 SEE ALSO - -L<SSL_get_rbio(3)|SSL_get_rbio(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_set_fd.pod b/crypto/openssl/doc/ssl/SSL_set_fd.pod deleted file mode 100644 index 70291128fcec0..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_set_fd.pod +++ /dev/null @@ -1,54 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_fd - connect the SSL object with a file descriptor - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_set_fd(SSL *ssl, int fd); - int SSL_set_rfd(SSL *ssl, int fd); - int SSL_set_wfd(SSL *ssl, int fd); - -=head1 DESCRIPTION - -SSL_set_fd() sets the file descriptor B<fd> as the input/output facility -for the TLS/SSL (encrypted) side of B<ssl>. B<fd> will typically be the -socket file descriptor of a network connection. - -When performing the operation, a B<socket BIO> is automatically created to -interface between the B<ssl> and B<fd>. The BIO and hence the SSL engine -inherit the behaviour of B<fd>. If B<fd> is non-blocking, the B<ssl> will -also have non-blocking behaviour. - -If there was already a BIO connected to B<ssl>, BIO_free() will be called -(for both the reading and writing side, if different). - -SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only -for the read channel or the write channel, which can be set independently. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The operation failed. Check the error stack to find out why. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<SSL_get_fd(3)|SSL_get_fd(3)>, L<SSL_set_bio(3)|SSL_set_bio(3)>, -L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, -L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_set_session.pod b/crypto/openssl/doc/ssl/SSL_set_session.pod deleted file mode 100644 index 9f78d9e434ae5..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_set_session.pod +++ /dev/null @@ -1,45 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_set_session(SSL *ssl, SSL_SESSION *session); - -=head1 DESCRIPTION - -SSL_set_session() sets B<session> to be used when the TLS/SSL connection -is to be established. SSL_set_session() is only useful for TLS/SSL clients. -When the session is set, the reference count of B<session> is incremented -by 1. If the session is not reused, the reference count is decremented -again during SSL_connect(). - -If there is already a session set inside B<ssl> (because it was set with -SSL_set_session() before or because the same B<ssl> was already used for -a connection), SSL_SESSION_free() will be called for that session. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 0 - -The operation failed; check the error stack to find out the reason. - -=item 1 - -The operation succeeded. - -=back - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_set_verify_result.pod b/crypto/openssl/doc/ssl/SSL_set_verify_result.pod deleted file mode 100644 index 04ab101aad2e5..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_set_verify_result.pod +++ /dev/null @@ -1,38 +0,0 @@ -=pod - -=head1 NAME - -SSL_set_verify_result - override result of peer certificate verification - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - void SSL_set_verify_result(SSL *ssl, long verify_result); - -=head1 DESCRIPTION - -SSL_set_verify_result() sets B<verify_result> of the object B<ssl> to be the -result of the verification of the X509 certificate presented by the peer, -if any. - -=head1 NOTES - -SSL_set_verify_result() overrides the verification result. It only changes -the verification result of the B<ssl> object. It does not become part of the -established session, so if the session is to be reused later, the original -value will reappear. - -The valid codes for B<verify_result> are documented in L<verify(1)|verify(1)>. - -=head1 RETURN VALUES - -SSL_set_verify_result() does not provide a return value. - -=head1 SEE ALSO - -L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, -L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, -L<verify(1)|verify(1)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_shutdown.pod b/crypto/openssl/doc/ssl/SSL_shutdown.pod deleted file mode 100644 index 20e273bd4d58d..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_shutdown.pod +++ /dev/null @@ -1,62 +0,0 @@ -=pod - -=head1 NAME - -SSL_shutdown - shut down a TLS/SSL connection - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_shutdown(SSL *ssl); - -=head1 DESCRIPTION - -SSL_shutdown() shuts down an active TLS/SSL connection. It sends the shutdown -alert to the peer. The behaviour of SSL_shutdown() depends on the underlying -BIO. - -If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the -handshake has been finished or an error occurred. - -If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return -when the underlying BIO could not satisfy the needs of SSL_shutdown() -to continue the handshake. In this case a call to SSL_get_error() with the -return value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after -taking appropriate action to satisfy the needs of SSL_shutdown(). -The action depends on the underlying BIO. When using a non-blocking socket, -nothing is to be done, but select() can be used to check for the required -condition. When using a buffering BIO, like a BIO pair, data must be written -into or retrieved out of the BIO before being able to continue. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item 1 - -The shutdown was successfully completed. - -=item 0 - -The shutdown was not successful. Call SSL_get_error() with the return -value B<ret> to find out the reason. - -=item -1 - -The shutdown was not successful because a fatal error occurred either -at the protocol level or a connection failure occurred. It can also occur of -action is need to continue the operation for non-blocking BIOs. -Call SSL_get_error() with the return value B<ret> to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, -L<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/ssl/SSL_write.pod b/crypto/openssl/doc/ssl/SSL_write.pod deleted file mode 100644 index db67c187e0ee9..0000000000000 --- a/crypto/openssl/doc/ssl/SSL_write.pod +++ /dev/null @@ -1,76 +0,0 @@ -=pod - -=head1 NAME - -SSL_read - write bytes to a TLS/SSL connection. - -=head1 SYNOPSIS - - #include <openssl/ssl.h> - - int SSL_write(SSL *ssl, char *buf, int num); - -=head1 DESCRIPTION - -SSL_write() writes B<num> bytes from the buffer B<buf> into the specified -B<ssl> connection. - -=head1 NOTES - -If necessary, SSL_write() will negotiate a TLS/SSL session, if -not already explicitly performed by SSL_connect() or SSL_accept(). If the -peer requests a re-negotiation, it will be performed transparently during -the SSL_write() operation. The behaviour of SSL_write() depends on the -underlying BIO. - -If the underlying BIO is B<blocking>, SSL_write() will only return, once the -write operation has been finished or an error occurred. - -If the underlying BIO is B<non-blocking>, SSL_write() will also return, -when the underlying BIO could not satisfy the needs of SSL_write() -to continue the operation. In this case a call to SSL_get_error() with the -return value of SSL_write() will yield B<SSL_ERROR_WANT_READ> or -B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a -call to SSL_write() can also cause write operations! The calling process -then must repeat the call after taking appropriate action to satisfy the -needs of SSL_write(). The action depends on the underlying BIO. When using a -non-blocking socket, nothing is to be done, but select() can be used to check -for the required condition. When using a buffering BIO, like a BIO pair, data -must be written into or retrieved out of the BIO before being able to continue. - -=head1 WARNING - -When an SSL_write() operation has to be repeated because of -B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated -with the same arguments. - -=head1 RETURN VALUES - -The following return values can occur: - -=over 4 - -=item E<gt>0 - -The write operation was successful, the return value is the number of -bytes actually written to the TLS/SSL connection. - -=item 0 - -The write operation was not successful. Call SSL_get_error() with the return -value B<ret> to find out, whether an error occurred. - -=item -1 - -The read operation was not successful, because either an error occurred -or action must be taken by the calling process. Call SSL_get_error() with the -return value B<ret> to find out the reason. - -=back - -=head1 SEE ALSO - -L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_read(3)|SSL_read(3)>, -L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> - -=cut diff --git a/crypto/openssl/doc/standards.txt b/crypto/openssl/doc/standards.txt deleted file mode 100644 index 61ccc5d7e0afb..0000000000000 --- a/crypto/openssl/doc/standards.txt +++ /dev/null @@ -1,121 +0,0 @@ -Standards related to OpenSSL -============================ - -[Please, this is currently a draft. I made a first try at finding - documents that describe parts of what OpenSSL implements. There are - big gaps, and I've most certainly done something wrong. Please - correct whatever is... Also, this note should be removed when this - file is reaching a somewhat correct state. -- Richard Levitte] - - -All pointers in here will be either URL's or blobs of text borrowed -from miscellaneous indexes, like rfc-index.txt (index of RFCs), -1id-index.txt (index of Internet drafts) and the like. - -To find the latest possible RFCs, it's recommended to either browse -ftp://ftp.isi.edu/in-notes/ or go to http://www.rfc-editor.org/ and -use the search mechanism found there. -To find the latest possible Internet drafts, it's recommended to -browse ftp://ftp.isi.edu/internet-drafts/. -To find the latest possible PKCS, it's recommended to browse -http://www.rsasecurity.com/rsalabs/pkcs/. - - -Implemented: ------------- - -These are documents that describe things that are implemented in OpenSSL. - -1319 The MD2 Message-Digest Algorithm. B. Kaliski. April 1992. - (Format: TXT=25661 bytes) (Status: INFORMATIONAL) - -1320 The MD4 Message-Digest Algorithm. R. Rivest. April 1992. (Format: - TXT=32407 bytes) (Status: INFORMATIONAL) - -1321 The MD5 Message-Digest Algorithm. R. Rivest. April 1992. (Format: - TXT=35222 bytes) (Status: INFORMATIONAL) - -2246 The TLS Protocol Version 1.0. T. Dierks, C. Allen. January 1999. - (Format: TXT=170401 bytes) (Status: PROPOSED STANDARD) - -2268 A Description of the RC2(r) Encryption Algorithm. R. Rivest. - January 1998. (Format: TXT=19048 bytes) (Status: INFORMATIONAL) - -2314 PKCS 10: Certification Request Syntax Version 1.5. B. Kaliski. - March 1998. (Format: TXT=15814 bytes) (Status: INFORMATIONAL) - -2315 PKCS 7: Cryptographic Message Syntax Version 1.5. B. Kaliski. - March 1998. (Format: TXT=69679 bytes) (Status: INFORMATIONAL) - -2437 PKCS #1: RSA Cryptography Specifications Version 2.0. B. Kaliski, - J. Staddon. October 1998. (Format: TXT=73529 bytes) (Obsoletes - RFC2313) (Status: INFORMATIONAL) - -2459 Internet X.509 Public Key Infrastructure Certificate and CRL - Profile. R. Housley, W. Ford, W. Polk, D. Solo. January 1999. - (Format: TXT=278438 bytes) (Status: PROPOSED STANDARD) - -PKCS#8: Private-Key Information Syntax Standard - -PKCS#12: Personal Information Exchange Syntax Standard, version 1.0. - - -Related: --------- - -These are documents that are close to OpenSSL, for example the -STARTTLS documents. - -1421 Privacy Enhancement for Internet Electronic Mail: Part I: Message - Encryption and Authentication Procedures. J. Linn. February 1993. - (Format: TXT=103894 bytes) (Obsoletes RFC1113) (Status: PROPOSED - STANDARD) - -1422 Privacy Enhancement for Internet Electronic Mail: Part II: - Certificate-Based Key Management. S. Kent. February 1993. (Format: - TXT=86085 bytes) (Obsoletes RFC1114) (Status: PROPOSED STANDARD) - -1423 Privacy Enhancement for Internet Electronic Mail: Part III: - Algorithms, Modes, and Identifiers. D. Balenson. February 1993. - (Format: TXT=33277 bytes) (Obsoletes RFC1115) (Status: PROPOSED - STANDARD) - -1424 Privacy Enhancement for Internet Electronic Mail: Part IV: Key - Certification and Related Services. B. Kaliski. February 1993. - (Format: TXT=17537 bytes) (Status: PROPOSED STANDARD) - -2487 SMTP Service Extension for Secure SMTP over TLS. P. Hoffman. - January 1999. (Format: TXT=15120 bytes) (Status: PROPOSED STANDARD) - -2585 Internet X.509 Public Key Infrastructure Operational Protocols: - FTP and HTTP. R. Housley, P. Hoffman. May 1999. (Format: TXT=14813 - bytes) (Status: PROPOSED STANDARD) - -2595 Using TLS with IMAP, POP3 and ACAP. C. Newman. June 1999. - (Format: TXT=32440 bytes) (Status: PROPOSED STANDARD) - -2712 Addition of Kerberos Cipher Suites to Transport Layer Security - (TLS). A. Medvinsky, M. Hur. October 1999. (Format: TXT=13763 bytes) - (Status: PROPOSED STANDARD) - -2817 Upgrading to TLS Within HTTP/1.1. R. Khare, S. Lawrence. May - 2000. (Format: TXT=27598 bytes) (Updates RFC2616) (Status: PROPOSED - STANDARD) - -2818 HTTP Over TLS. E. Rescorla. May 2000. (Format: TXT=15170 bytes) - (Status: INFORMATIONAL) - - "Securing FTP with TLS", 01/27/2000, <draft-murray-auth-ftp-ssl-05.txt> - - -To be implemented: ------------------- - -These are documents that describe things that are planed to be -implemented in the hopefully short future. - -2560 X.509 Internet Public Key Infrastructure Online Certificate - Status Protocol - OCSP. M. Myers, R. Ankney, A. Malpani, S. Galperin, - C. Adams. June 1999. (Format: TXT=43243 bytes) (Status: PROPOSED - STANDARD) - diff --git a/crypto/openssl/openssl.spec b/crypto/openssl/openssl.spec deleted file mode 100644 index 18ae94e54cb7c..0000000000000 --- a/crypto/openssl/openssl.spec +++ /dev/null @@ -1,210 +0,0 @@ -%define libmaj 0 -%define libmin 9 -%define librel 6 -#%define librev -Release: 1 - -%define openssldir /var/ssl - -Summary: Secure Sockets Layer and cryptography libraries and tools -Name: openssl -Version: %{libmaj}.%{libmin}.%{librel} -#Version: %{libmaj}.%{libmin}.%{librel}%{librev} -Source0: ftp://ftp.openssl.org/source/%{name}-%{version}.tar.gz -Copyright: Freely distributable -Group: System Environment/Libraries -Provides: SSL -URL: http://www.openssl.org/ -Packager: Damien Miller <djm@mindrot.org> -BuildRoot: /var/tmp/%{name}-%{version}-root - -%description -The OpenSSL Project is a collaborative effort to develop a robust, -commercial-grade, fully featured, and Open Source toolkit implementing the -Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) -protocols as well as a full-strength general purpose cryptography library. -The project is managed by a worldwide community of volunteers that use the -Internet to communicate, plan, and develop the OpenSSL tookit and its related -documentation. - -OpenSSL is based on the excellent SSLeay library developed from Eric A. -Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an -Apache-style licence, which basically means that you are free to get and -use it for commercial and non-commercial purposes. - -This package contains the base OpenSSL cryptography and SSL/TLS -libraries and tools. - -%package devel -Summary: Secure Sockets Layer and cryptography static libraries and headers -Group: Development/Libraries -Requires: openssl -%description devel -The OpenSSL Project is a collaborative effort to develop a robust, -commercial-grade, fully featured, and Open Source toolkit implementing the -Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) -protocols as well as a full-strength general purpose cryptography library. -The project is managed by a worldwide community of volunteers that use the -Internet to communicate, plan, and develop the OpenSSL tookit and its related -documentation. - -OpenSSL is based on the excellent SSLeay library developed from Eric A. -Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an -Apache-style licence, which basically means that you are free to get and -use it for commercial and non-commercial purposes. - -This package contains the the OpenSSL cryptography and SSL/TLS -static libraries and header files required when developing applications. - -%package doc -Summary: OpenSSL miscellaneous files -Group: Documentation -Requires: openssl -%description doc -The OpenSSL Project is a collaborative effort to develop a robust, -commercial-grade, fully featured, and Open Source toolkit implementing the -Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) -protocols as well as a full-strength general purpose cryptography library. -The project is managed by a worldwide community of volunteers that use the -Internet to communicate, plan, and develop the OpenSSL tookit and its related -documentation. - -OpenSSL is based on the excellent SSLeay library developed from Eric A. -Young and Tim J. Hudson. The OpenSSL toolkit is licensed under an -Apache-style licence, which basically means that you are free to get and -use it for commercial and non-commercial purposes. - -This package contains the the OpenSSL cryptography and SSL/TLS extra -documentation and POD files from which the man pages were produced. - -%prep - -%setup -q - -%build - -%define CONFIG_FLAGS -DSSL_ALLOW_ADH --prefix=/usr - -perl util/perlpath.pl /usr/bin/perl - -%ifarch i386 i486 i586 i686 -./Configure %{CONFIG_FLAGS} --openssldir=%{openssldir} linux-elf shared -%endif -%ifarch ppc -./Configure %{CONFIG_FLAGS} --openssldir=%{openssldir} linux-ppc shared -%endif -%ifarch alpha -./Configure %{CONFIG_FLAGS} --openssldir=%{openssldir} linux-alpha shared -%endif -LD_LIBRARY_PATH=`pwd` make -LD_LIBRARY_PATH=`pwd` make rehash -LD_LIBRARY_PATH=`pwd` make test - -%install -rm -rf $RPM_BUILD_ROOT -make install MANDIR=/usr/man INSTALL_PREFIX="$RPM_BUILD_ROOT" - -# Rename manpages -for x in $RPM_BUILD_ROOT/usr/man/man*/* - do mv ${x} ${x}ssl -done - -# Install RSAref stuff -install -m644 rsaref/rsaref.h $RPM_BUILD_ROOT/usr/include/openssl -install -m644 libRSAglue.a $RPM_BUILD_ROOT/usr/lib - -# Make backwards-compatibility symlink to ssleay -ln -s /usr/bin/openssl $RPM_BUILD_ROOT/usr/bin/ssleay - -# Install shared libs -install -m644 libcrypto.a $RPM_BUILD_ROOT/usr/lib -install -m755 libcrypto.so.%{libmaj}.%{libmin}.%{librel} $RPM_BUILD_ROOT/usr/lib -install -m644 libssl.a $RPM_BUILD_ROOT/usr/lib -install -m755 libssl.so.%{libmaj}.%{libmin}.%{librel} $RPM_BUILD_ROOT/usr/lib -( - cd $RPM_BUILD_ROOT/usr/lib - ln -s libcrypto.so.%{libmaj}.%{libmin}.%{librel} libcrypto.so.%{libmaj} - ln -s libcrypto.so.%{libmaj}.%{libmin}.%{librel} libcrypto.so - ln -s libssl.so.%{libmaj}.%{libmin}.%{librel} libssl.so.%{libmaj} - ln -s libssl.so.%{libmaj}.%{libmin}.%{librel} libssl.so -) - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(0644,root,root,0755) -%doc CHANGES CHANGES.SSLeay LICENSE NEWS README - -%attr(0755,root,root) /usr/bin/* -%attr(0755,root,root) /usr/lib/*.so* -%attr(0755,root,root) %{openssldir}/misc/* -%attr(0644,root,root) /usr/man/man[157]/* - -%config %attr(0644,root,root) %{openssldir}/openssl.cnf -%dir %attr(0755,root,root) %{openssldir}/certs -%dir %attr(0755,root,root) %{openssldir}/lib -%dir %attr(0755,root,root) %{openssldir}/misc -%dir %attr(0750,root,root) %{openssldir}/private - -%files devel -%doc CHANGES CHANGES.SSLeay LICENSE NEWS README - -%defattr(0644,root,root,0755) -%attr(0644,root,root) /usr/lib/*.a -%attr(0644,root,root) /usr/include/openssl/* -%attr(0644,root,root) /usr/man/man[3]/* - -%files doc -%doc CHANGES CHANGES.SSLeay LICENSE NEWS README -%doc doc - -%post -ldconfig - -%postun -ldconfig - -%changelog -* Thu Sep 14 2000 Richard Levitte <richard@levitte.org> -- Changed to adapt to the new (supported) way of making shared libraries -- Installs all static libraries, not just libRSAglue.a -- Extra documents now end up in a separate document package -* Sun Feb 27 2000 Damien Miller <djm@mindrot.org> -- Merged patches to spec -- Updated to 0.9.5beta2 (now with manpages) -* Sat Feb 5 2000 Michal Jaegermann <michal@harddata.com> -- added 'linux-alpha' to configuration -- fixed nasty absolute links -* Tue Jan 25 2000 Bennett Todd <bet@rahul.net> -- Added -DSSL_ALLOW_ADH, bumped Release to 4 -* Thu Oct 14 1999 Damien Miller <djm@mindrot.org> -- Set default permissions -- Removed documentation from devel sub-package -* Thu Sep 30 1999 Damien Miller <djm@mindrot.org> -- Added "make test" stage -- GPG signed -* Tue Sep 10 1999 Damien Miller <damien@ibs.com.au> -- Updated to version 0.9.4 -* Tue May 25 1999 Damien Miller <damien@ibs.com.au> -- Updated to version 0.9.3 -- Added attributes for all files -- Paramatised openssl directory -* Sat Mar 20 1999 Carlo M. Arenas Belon <carenas@jmconsultores.com.pe> -- Added "official" bnrec patch and taking other out -- making a link from ssleay to openssl binary -- putting all changelog together on SPEC file -* Fri Mar 5 1999 Henri Gomez <gomez@slib.fr> -- Added bnrec patch -* Tue Dec 29 1998 Jonathan Ruano <kobalt@james.encomix.es> -- minimum spec and patches changes for openssl -- modified for openssl sources -* Sat Aug 8 1998 Khimenko Victor <khim@sch57.msk.ru> -- shared library creating process honours $RPM_OPT_FLAGS -- shared libarry supports threads (as well as static library) -* Wed Jul 22 1998 Khimenko Victor <khim@sch57.msk.ru> -- building of shared library completely reworked -* Tue Jul 21 1998 Khimenko Victor <khim@sch57.msk.ru> -- RPM is BuildRoot'ed -* Tue Feb 10 1998 Khimenko Victor <khim@sch57.msk.ru> -- all stuff is moved out of /usr/local diff --git a/crypto/openssl/times/x86/md4s.cpp b/crypto/openssl/times/x86/md4s.cpp deleted file mode 100644 index c0ec97fc9f9b9..0000000000000 --- a/crypto/openssl/times/x86/md4s.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -// gettsc.inl -// -// gives access to the Pentium's (secret) cycle counter -// -// This software was written by Leonard Janke (janke@unixg.ubc.ca) -// in 1996-7 and is entered, by him, into the public domain. - -#if defined(__WATCOMC__) -void GetTSC(unsigned long&); -#pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax]; -#elif defined(__GNUC__) -inline -void GetTSC(unsigned long& tsc) -{ - asm volatile(".byte 15, 49\n\t" - : "=eax" (tsc) - : - : "%edx", "%eax"); -} -#elif defined(_MSC_VER) -inline -void GetTSC(unsigned long& tsc) -{ - unsigned long a; - __asm _emit 0fh - __asm _emit 31h - __asm mov a, eax; - tsc=a; -} -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <openssl/md4.h> - -extern "C" { -void md4_block_x86(MD4_CTX *ctx, unsigned char *buffer,int num); -} - -void main(int argc,char *argv[]) - { - unsigned char buffer[64*256]; - MD4_CTX ctx; - unsigned long s1,s2,e1,e2; - unsigned char k[16]; - unsigned long data[2]; - unsigned char iv[8]; - int i,num=0,numm; - int j=0; - - if (argc >= 2) - num=atoi(argv[1]); - - if (num == 0) num=16; - if (num > 250) num=16; - numm=num+2; - num*=64; - numm*=64; - - for (j=0; j<6; j++) - { - for (i=0; i<10; i++) /**/ - { - md4_block_x86(&ctx,buffer,numm); - GetTSC(s1); - md4_block_x86(&ctx,buffer,numm); - GetTSC(e1); - GetTSC(s2); - md4_block_x86(&ctx,buffer,num); - GetTSC(e2); - md4_block_x86(&ctx,buffer,num); - } - printf("md4 (%d bytes) %d %d (%.2f)\n",num, - e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); - } - } - diff --git a/crypto/openssl/util/mkstack.pl b/crypto/openssl/util/mkstack.pl deleted file mode 100755 index 3ee13fe7c9da5..0000000000000 --- a/crypto/openssl/util/mkstack.pl +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/local/bin/perl -w - -# This is a utility that searches out "DECLARE_STACK_OF()" -# declarations in .h and .c files, and updates/creates/replaces -# the corresponding macro declarations in crypto/stack/safestack.h. -# As it's not generally possible to have macros that generate macros, -# we need to control this from the "outside", here in this script. -# -# Geoff Thorpe, June, 2000 (with massive Perl-hacking -# help from Steve Robb) - -my $safestack = "crypto/stack/safestack"; - -my $do_write; -while (@ARGV) { - my $arg = $ARGV[0]; - if($arg eq "-write") { - $do_write = 1; - } - shift @ARGV; -} - - -@source = (<crypto/*.[ch]>, <crypto/*/*.[ch]>, <rsaref/*.[ch]>, <ssl/*.[ch]>); -foreach $file (@source) { - next if -l $file; - - # Open the .c/.h file for reading - open(IN, "< $file") || die "Can't open $file for reading: $!"; - - while(<IN>) { - if (/^DECLARE_STACK_OF\(([^)]+)\)/) { - push @stacklst, $1; - } if (/^DECLARE_ASN1_SET_OF\(([^)]+)\)/) { - push @asn1setlst, $1; - } if (/^DECLARE_PKCS12_STACK_OF\(([^)]+)\)/) { - push @p12stklst, $1; - } - } - close(IN); -} - - - -my $old_stackfile = ""; -my $new_stackfile = ""; -my $inside_block = 0; -my $type_thing; - -open(IN, "< $safestack.h") || die "Can't open input file: $!"; -while(<IN>) { - $old_stackfile .= $_; - - if (m|^/\* This block of defines is updated by util/mkstack.pl, please do not touch! \*/|) { - $inside_block = 1; - } - if (m|^/\* End of util/mkstack.pl block, you may now edit :-\) \*/|) { - $inside_block = 0; - } elsif ($inside_block == 0) { - $new_stackfile .= $_; - } - next if($inside_block != 1); - $new_stackfile .= "/* This block of defines is updated by util/mkstack.pl, please do not touch! */"; - - foreach $type_thing (sort @stacklst) { - $new_stackfile .= <<EOF; - -#define sk_${type_thing}_new(st) SKM_sk_new($type_thing, (st)) -#define sk_${type_thing}_new_null() SKM_sk_new_null($type_thing) -#define sk_${type_thing}_free(st) SKM_sk_free($type_thing, (st)) -#define sk_${type_thing}_num(st) SKM_sk_num($type_thing, (st)) -#define sk_${type_thing}_value(st, i) SKM_sk_value($type_thing, (st), (i)) -#define sk_${type_thing}_set(st, i, val) SKM_sk_set($type_thing, (st), (i), (val)) -#define sk_${type_thing}_zero(st) SKM_sk_zero($type_thing, (st)) -#define sk_${type_thing}_push(st, val) SKM_sk_push($type_thing, (st), (val)) -#define sk_${type_thing}_unshift(st, val) SKM_sk_unshift($type_thing, (st), (val)) -#define sk_${type_thing}_find(st, val) SKM_sk_find($type_thing, (st), (val)) -#define sk_${type_thing}_delete(st, i) SKM_sk_delete($type_thing, (st), (i)) -#define sk_${type_thing}_delete_ptr(st, ptr) SKM_sk_delete_ptr($type_thing, (st), (ptr)) -#define sk_${type_thing}_insert(st, val, i) SKM_sk_insert($type_thing, (st), (val), (i)) -#define sk_${type_thing}_set_cmp_func(st, cmp) SKM_sk_set_cmp_func($type_thing, (st), (cmp)) -#define sk_${type_thing}_dup(st) SKM_sk_dup($type_thing, st) -#define sk_${type_thing}_pop_free(st, free_func) SKM_sk_pop_free($type_thing, (st), (free_func)) -#define sk_${type_thing}_shift(st) SKM_sk_shift($type_thing, (st)) -#define sk_${type_thing}_pop(st) SKM_sk_pop($type_thing, (st)) -#define sk_${type_thing}_sort(st) SKM_sk_sort($type_thing, (st)) -EOF - } - foreach $type_thing (sort @asn1setlst) { - $new_stackfile .= <<EOF; - -#define d2i_ASN1_SET_OF_${type_thing}(st, pp, length, d2i_func, free_func, ex_tag, ex_class) \\ - SKM_ASN1_SET_OF_d2i($type_thing, (st), (pp), (length), (d2i_func), (free_func), (ex_tag), (ex_class)) -#define i2d_ASN1_SET_OF_${type_thing}(st, pp, i2d_func, ex_tag, ex_class, is_set) \\ - SKM_ASN1_SET_OF_i2d($type_thing, (st), (pp), (i2d_func), (ex_tag), (ex_class), (is_set)) -#define ASN1_seq_pack_${type_thing}(st, i2d_func, buf, len) \\ - SKM_ASN1_seq_pack($type_thing, (st), (i2d_func), (buf), (len)) -#define ASN1_seq_unpack_${type_thing}(buf, len, d2i_func, free_func) \\ - SKM_ASN1_seq_unpack($type_thing, (buf), (len), (d2i_func), (free_func)) -EOF - } - foreach $type_thing (sort @p12stklst) { - $new_stackfile .= <<EOF; - -#define PKCS12_decrypt_d2i_${type_thing}(algor, d2i_func, free_func, pass, passlen, oct, seq) \\ - SKM_PKCS12_decrypt_d2i($type_thing, (algor), (d2i_func), (free_func), (pass), (passlen), (oct), (seq)) -EOF - } - $new_stackfile .= "/* End of util/mkstack.pl block, you may now edit :-) */\n"; - $inside_block = 2; -} - - -if ($new_stackfile eq $old_stackfile) { - print "No changes to $safestack.h.\n"; - exit 0; # avoid unnecessary rebuild -} - -if ($do_write) { - print "Writing new $safestack.h.\n"; - open OUT, ">$safestack.h" || die "Can't open output file"; - print OUT $new_stackfile; - close OUT; -} diff --git a/gnu/usr.bin/awk/config.h b/gnu/usr.bin/awk/config.h deleted file mode 100644 index df6c5f0578917..0000000000000 --- a/gnu/usr.bin/awk/config.h +++ /dev/null @@ -1,230 +0,0 @@ -/* config.h. Generated automatically by configure. */ -/* configh.in. Generated automatically from configure.in by autoheader. */ -/* - * acconfig.h -- configuration definitions for gawk. - */ - -/* - * $FreeBSD$ - */ - -/* - * 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'. */ -#define GETGROUPS_T gid_t - -/* Define if the `getpgrp' function takes no argument. */ -#define GETPGRP_VOID 1 - -/* Define to `int' if <sys/types.h> doesn't define. */ -/* #undef gid_t */ - -/* Define if you have alloca, as a function or macro. */ -#define HAVE_ALLOCA 1 - -/* 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. */ -#define HAVE_MMAP 1 - -/* Define if your struct stat has st_blksize. */ -#define HAVE_ST_BLKSIZE 1 - -/* Define if you have the ANSI # stringizing operator in cpp. */ -#define HAVE_STRINGIZE 1 - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if your struct tm has tm_zone. */ -#define HAVE_TM_ZONE 1 - -/* 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. */ -#define HAVE_VPRINTF 1 - -/* 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). */ -#define RETSIGTYPE void - -/* 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. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 - -/* 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 */ - -#define HAVE_STRINGIZE 1 /* can use ANSI # operator in cpp */ -#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */ -#define SPRINTF_RET int /* 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. */ -#define HAVE_FMOD 1 - -/* Define if you have the getpagesize function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define if you have the madvise function. */ -#define HAVE_MADVISE 1 - -/* Define if you have the memcmp function. */ -#define HAVE_MEMCMP 1 - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the memset function. */ -#define HAVE_MEMSET 1 - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the strchr function. */ -#define HAVE_STRCHR 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - -/* Define if you have the strncasecmp function. */ -#define HAVE_STRNCASECMP 1 - -/* Define if you have the strtod function. */ -#define HAVE_STRTOD 1 - -/* Define if you have the system function. */ -#define HAVE_SYSTEM 1 - -/* Define if you have the tzset function. */ -#define HAVE_TZSET 1 - -/* Define if you have the <limits.h> header file. */ -#define HAVE_LIMITS_H 1 - -/* Define if you have the <locale.h> header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define if you have the <signum.h> header file. */ -/* #undef HAVE_SIGNUM_H */ - -/* Define if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the <strings.h> header file. */ -/* #undef HAVE_STRINGS_H */ - -/* Define if you have the <sys/param.h> header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the m library (-lm). */ -#define HAVE_LIBM 1 - -/* 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 */ diff --git a/gnu/usr.bin/binutils/readelf/Makefile b/gnu/usr.bin/binutils/readelf/Makefile deleted file mode 100644 index 450e60468c360..0000000000000 --- a/gnu/usr.bin/binutils/readelf/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc0" - -.PATH: ${SRCDIR}/binutils - -# No a.out vs. ELF version so don't install in /usr/libexec/elf -BINDIR=/usr/bin - -PROG= readelf -NOMAN= yes -SRCS= ${PROG}.c -CFLAGS+= -I${.CURDIR}/${RELTOP}/libbinutils -I${SRCDIR}/binutils - -DPADD= ${RELTOP}/libbinutils/libbinutils.a -DPADD+= ${RELTOP}/libbfd/libbfd.a -DPADD+= ${RELTOP}/libiberty/libiberty.a -LDADD= ${DPADD} - -.include <bsd.prog.mk> diff --git a/gnu/usr.bin/gperf/config.h b/gnu/usr.bin/gperf/config.h deleted file mode 100644 index 464005e3fa589..0000000000000 --- a/gnu/usr.bin/gperf/config.h +++ /dev/null @@ -1,21 +0,0 @@ -/* $FreeBSD$ */ -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if the C++ compiler supports "throw ()" declarations. */ -#define HAVE_THROW_DECL 1 - -/* Define if you have the getrlimit function. */ -#define HAVE_GETRLIMIT 1 - -/* Define if you have the setrlimit function. */ -#define HAVE_SETRLIMIT 1 - -/* Define if you have the <sys/resource.h> header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 diff --git a/gnu/usr.bin/groff/font/devkoi8-r/DESC.proto b/gnu/usr.bin/groff/font/devkoi8-r/DESC.proto deleted file mode 100644 index 041cebabfcf46..0000000000000 --- a/gnu/usr.bin/groff/font/devkoi8-r/DESC.proto +++ /dev/null @@ -1,8 +0,0 @@ -res 240 -hor 24 -vert 40 -unitwidth 10 -sizes 10 0 -fonts 6 R I B BI S L -tcommand -postpro grotty diff --git a/gnu/usr.bin/groff/src/roff/psroff/psroff.sh b/gnu/usr.bin/groff/src/roff/psroff/psroff.sh deleted file mode 100644 index 8a9008234b434..0000000000000 --- a/gnu/usr.bin/groff/src/roff/psroff/psroff.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh - -exec groff -Tps -l -C ${1+"$@"} diff --git a/gnu/usr.bin/groff/tmac/hyphen.us-ru b/gnu/usr.bin/groff/tmac/hyphen.us-ru deleted file mode 100644 index 3ccef48465fef..0000000000000 --- a/gnu/usr.bin/groff/tmac/hyphen.us-ru +++ /dev/null @@ -1,4833 +0,0 @@ -% Hyphenation patterns for US English and Russian (koi8-r). -% These are the standard Plain TeX hyphenation patterns (in hyphen.tex). -.ach4 -.ad4der -.af1t -.al3t -.am5at -.an5c -.ang4 -.ani5m -.ant4 -.an3te -.anti5s -.ar5s -.ar4tie -.ar4ty -.as3c -.as1p -.as1s -.aster5 -.atom5 -.au1d -.av4i -.awn4 -.ba4g -.ba5na -.bas4e -.ber4 -.be5ra -.be3sm -.be5sto -.bri2 -.but4ti -.cam4pe -.can5c -.capa5b -.car5ol -.ca4t -.ce4la -.ch4 -.chill5i -.ci2 -.cit5r -.co3e -.co4r -.cor5ner -.de4moi -.de3o -.de3ra -.de3ri -.des4c -.dictio5 -.do4t -.du4c -.dumb5 -.earth5 -.eas3i -.eb4 -.eer4 -.eg2 -.el5d -.el3em -.enam3 -.en3g -.en3s -.eq5ui5t -.er4ri -.es3 -.eu3 -.eye5 -.fes3 -.for5mer -.ga2 -.ge2 -.gen3t4 -.ge5og -.gi5a -.gi4b -.go4r -.hand5i -.han5k -.he2 -.hero5i -.hes3 -.het3 -.hi3b -.hi3er -.hon5ey -.hon3o -.hov5 -.id4l -.idol3 -.im3m -.im5pin -.in1 -.in3ci -.ine2 -.in2k -.in3s -.ir5r -.is4i -.ju3r -.la4cy -.la4m -.lat5er -.lath5 -.le2 -.leg5e -.len4 -.lep5 -.lev1 -.li4g -.lig5a -.li2n -.li3o -.li4t -.mag5a5 -.mal5o -.man5a -.mar5ti -.me2 -.mer3c -.me5ter -.mis1 -.mist5i -.mon3e -.mo3ro -.mu5ta -.muta5b -.ni4c -.od2 -.odd5 -.of5te -.or5ato -.or3c -.or1d -.or3t -.os3 -.os4tl -.oth3 -.out3 -.ped5al -.pe5te -.pe5tit -.pi4e -.pio5n -.pi2t -.pre3m -.ra4c -.ran4t -.ratio5na -.ree2 -.re5mit -.res2 -.re5stat -.ri4g -.rit5u -.ro4q -.ros5t -.row5d -.ru4d -.sci3e -.self5 -.sell5 -.se2n -.se5rie -.sh2 -.si2 -.sing4 -.st4 -.sta5bl -.sy2 -.ta4 -.te4 -.ten5an -.th2 -.ti2 -.til4 -.tim5o5 -.ting4 -.tin5k -.ton4a -.to4p -.top5i -.tou5s -.trib5ut -.un1a -.un3ce -.under5 -.un1e -.un5k -.un5o -.un3u -.up3 -.ure3 -.us5a -.ven4de -.ve5ra -.wil5i -.ye4 -4ab. -a5bal -a5ban -abe2 -ab5erd -abi5a -ab5it5ab -ab5lat -ab5o5liz -4abr -ab5rog -ab3ul -a4car -ac5ard -ac5aro -a5ceou -ac1er -a5chet -4a2ci -a3cie -ac1in -a3cio -ac5rob -act5if -ac3ul -ac4um -a2d -ad4din -ad5er. -2adi -a3dia -ad3ica -adi4er -a3dio -a3dit -a5diu -ad4le -ad3ow -ad5ran -ad4su -4adu -a3duc -ad5um -ae4r -aeri4e -a2f -aff4 -a4gab -aga4n -ag5ell -age4o -4ageu -ag1i -4ag4l -ag1n -a2go -3agog -ag3oni -a5guer -ag5ul -a4gy -a3ha -a3he -ah4l -a3ho -ai2 -a5ia -a3ic. -ai5ly -a4i4n -ain5in -ain5o -ait5en -a1j -ak1en -al5ab -al3ad -a4lar -4aldi -2ale -al3end -a4lenti -a5le5o -al1i -al4ia. -ali4e -al5lev -4allic -4alm -a5log. -a4ly. -4alys -5a5lyst -5alyt -3alyz -4ama -am5ab -am3ag -ama5ra -am5asc -a4matis -a4m5ato -am5era -am3ic -am5if -am5ily -am1in -ami4no -a2mo -a5mon -amor5i -amp5en -a2n -an3age -3analy -a3nar -an3arc -anar4i -a3nati -4and -ande4s -an3dis -an1dl -an4dow -a5nee -a3nen -an5est. -a3neu -2ang -ang5ie -an1gl -a4n1ic -a3nies -an3i3f -an4ime -a5nimi -a5nine -an3io -a3nip -an3ish -an3it -a3niu -an4kli -5anniz -ano4 -an5ot -anoth5 -an2sa -an4sco -an4sn -an2sp -ans3po -an4st -an4sur -antal4 -an4tie -4anto -an2tr -an4tw -an3ua -an3ul -a5nur -4ao -apar4 -ap5at -ap5ero -a3pher -4aphi -a4pilla -ap5illar -ap3in -ap3ita -a3pitu -a2pl -apoc5 -ap5ola -apor5i -apos3t -aps5es -a3pu -aque5 -2a2r -ar3act -a5rade -ar5adis -ar3al -a5ramete -aran4g -ara3p -ar4at -a5ratio -ar5ativ -a5rau -ar5av4 -araw4 -arbal4 -ar4chan -ar5dine -ar4dr -ar5eas -a3ree -ar3ent -a5ress -ar4fi -ar4fl -ar1i -ar5ial -ar3ian -a3riet -ar4im -ar5inat -ar3io -ar2iz -ar2mi -ar5o5d -a5roni -a3roo -ar2p -ar3q -arre4 -ar4sa -ar2sh -4as. -as4ab -as3ant -ashi4 -a5sia. -a3sib -a3sic -5a5si4t -ask3i -as4l -a4soc -as5ph -as4sh -as3ten -as1tr -asur5a -a2ta -at3abl -at5ac -at3alo -at5ap -ate5c -at5ech -at3ego -at3en. -at3era -ater5n -a5terna -at3est -at5ev -4ath -ath5em -a5then -at4ho -ath5om -4ati. -a5tia -at5i5b -at1ic -at3if -ation5ar -at3itu -a4tog -a2tom -at5omiz -a4top -a4tos -a1tr -at5rop -at4sk -at4tag -at5te -at4th -a2tu -at5ua -at5ue -at3ul -at3ura -a2ty -au4b -augh3 -au3gu -au4l2 -aun5d -au3r -au5sib -aut5en -au1th -a2va -av3ag -a5van -ave4no -av3era -av5ern -av5ery -av1i -avi4er -av3ig -av5oc -a1vor -3away -aw3i -aw4ly -aws4 -ax4ic -ax4id -ay5al -aye4 -ays4 -azi4er -azz5i -5ba. -bad5ger -ba4ge -bal1a -ban5dag -ban4e -ban3i -barbi5 -bari4a -bas4si -1bat -ba4z -2b1b -b2be -b3ber -bbi4na -4b1d -4be. -beak4 -beat3 -4be2d -be3da -be3de -be3di -be3gi -be5gu -1bel -be1li -be3lo -4be5m -be5nig -be5nu -4bes4 -be3sp -be5str -3bet -bet5iz -be5tr -be3tw -be3w -be5yo -2bf -4b3h -bi2b -bi4d -3bie -bi5en -bi4er -2b3if -1bil -bi3liz -bina5r4 -bin4d -bi5net -bi3ogr -bi5ou -bi2t -3bi3tio -bi3tr -3bit5ua -b5itz -b1j -bk4 -b2l2 -blath5 -b4le. -blen4 -5blesp -b3lis -b4lo -blun4t -4b1m -4b3n -bne5g -3bod -bod3i -bo4e -bol3ic -bom4bi -bon4a -bon5at -3boo -5bor. -4b1ora -bor5d -5bore -5bori -5bos4 -b5ota -both5 -bo4to -bound3 -4bp -4brit -broth3 -2b5s2 -bsor4 -2bt -bt4l -b4to -b3tr -buf4fer -bu4ga -bu3li -bumi4 -bu4n -bunt4i -bu3re -bus5ie -buss4e -5bust -4buta -3butio -b5uto -b1v -4b5w -5by. -bys4 -1ca -cab3in -ca1bl -cach4 -ca5den -4cag4 -2c5ah -ca3lat -cal4la -call5in -4calo -can5d -can4e -can4ic -can5is -can3iz -can4ty -cany4 -ca5per -car5om -cast5er -cas5tig -4casy -ca4th -4cativ -cav5al -c3c -ccha5 -cci4a -ccompa5 -ccon4 -ccou3t -2ce. -4ced. -4ceden -3cei -5cel. -3cell -1cen -3cenc -2cen4e -4ceni -3cent -3cep -ce5ram -4cesa -3cessi -ces5si5b -ces5t -cet4 -c5e4ta -cew4 -2ch -4ch. -4ch3ab -5chanic -ch5a5nis -che2 -cheap3 -4ched -che5lo -3chemi -ch5ene -ch3er. -ch3ers -4ch1in -5chine. -ch5iness -5chini -5chio -3chit -chi2z -3cho2 -ch4ti -1ci -3cia -ci2a5b -cia5r -ci5c -4cier -5cific. -4cii -ci4la -3cili -2cim -2cin -c4ina -3cinat -cin3em -c1ing -c5ing. -5cino -cion4 -4cipe -ci3ph -4cipic -4cista -4cisti -2c1it -cit3iz -5ciz -ck1 -ck3i -1c4l4 -4clar -c5laratio -5clare -cle4m -4clic -clim4 -cly4 -c5n -1co -co5ag -coe2 -2cog -co4gr -coi4 -co3inc -col5i -5colo -col3or -com5er -con4a -c4one -con3g -con5t -co3pa -cop3ic -co4pl -4corb -coro3n -cos4e -cov1 -cove4 -cow5a -coz5e -co5zi -c1q -cras5t -5crat. -5cratic -cre3at -5cred -4c3reta -cre4v -cri2 -cri5f -c4rin -cris4 -5criti -cro4pl -crop5o -cros4e -cru4d -4c3s2 -2c1t -cta4b -ct5ang -c5tant -c2te -c3ter -c4ticu -ctim3i -ctu4r -c4tw -cud5 -c4uf -c4ui -cu5ity -5culi -cul4tis -3cultu -cu2ma -c3ume -cu4mi -3cun -cu3pi -cu5py -cur5a4b -cu5ria -1cus -cuss4i -3c4ut -cu4tie -4c5utiv -4cutr -1cy -cze4 -1d2a -5da. -2d3a4b -dach4 -4daf -2dag -da2m2 -dan3g -dard5 -dark5 -4dary -3dat -4dativ -4dato -5dav4 -dav5e -5day -d1b -d5c -d1d4 -2de. -deaf5 -deb5it -de4bon -decan4 -de4cil -de5com -2d1ed -4dee. -de5if -deli4e -del5i5q -de5lo -d4em -5dem. -3demic -dem5ic. -de5mil -de4mons -demor5 -1den -de4nar -de3no -denti5f -de3nu -de1p -de3pa -depi4 -de2pu -d3eq -d4erh -5derm -dern5iz -der5s -des2 -d2es. -de1sc -de2s5o -des3ti -de3str -de4su -de1t -de2to -de1v -dev3il -4dey -4d1f -d4ga -d3ge4t -dg1i -d2gy -d1h2 -5di. -1d4i3a -dia5b -di4cam -d4ice -3dict -3did -5di3en -d1if -di3ge -di4lato -d1in -1dina -3dine. -5dini -di5niz -1dio -dio5g -di4pl -dir2 -di1re -dirt5i -dis1 -5disi -d4is3t -d2iti -1di1v -d1j -d5k2 -4d5la -3dle. -3dled -3dles. -4dless -2d3lo -4d5lu -2dly -d1m -4d1n4 -1do -3do. -do5de -5doe -2d5of -d4og -do4la -doli4 -do5lor -dom5iz -do3nat -doni4 -doo3d -dop4p -d4or -3dos -4d5out -do4v -3dox -d1p -1dr -drag5on -4drai -dre4 -drea5r -5dren -dri4b -dril4 -dro4p -4drow -5drupli -4dry -2d1s2 -ds4p -d4sw -d4sy -d2th -1du -d1u1a -du2c -d1uca -duc5er -4duct. -4ducts -du5el -du4g -d3ule -dum4be -du4n -4dup -du4pe -d1v -d1w -d2y -5dyn -dy4se -dys5p -e1a4b -e3act -ead1 -ead5ie -ea4ge -ea5ger -ea4l -eal5er -eal3ou -eam3er -e5and -ear3a -ear4c -ear5es -ear4ic -ear4il -ear5k -ear2t -eart3e -ea5sp -e3ass -east3 -ea2t -eat5en -eath3i -e5atif -e4a3tu -ea2v -eav3en -eav5i -eav5o -2e1b -e4bel. -e4bels -e4ben -e4bit -e3br -e4cad -ecan5c -ecca5 -e1ce -ec5essa -ec2i -e4cib -ec5ificat -ec5ifie -ec5ify -ec3im -eci4t -e5cite -e4clam -e4clus -e2col -e4comm -e4compe -e4conc -e2cor -ec3ora -eco5ro -e1cr -e4crem -ec4tan -ec4te -e1cu -e4cul -ec3ula -2e2da -4ed3d -e4d1er -ede4s -4edi -e3dia -ed3ib -ed3ica -ed3im -ed1it -edi5z -4edo -e4dol -edon2 -e4dri -e4dul -ed5ulo -ee2c -eed3i -ee2f -eel3i -ee4ly -ee2m -ee4na -ee4p1 -ee2s4 -eest4 -ee4ty -e5ex -e1f -e4f3ere -1eff -e4fic -5efici -efil4 -e3fine -ef5i5nite -3efit -efor5es -e4fuse. -4egal -eger4 -eg5ib -eg4ic -eg5ing -e5git5 -eg5n -e4go. -e4gos -eg1ul -e5gur -5egy -e1h4 -eher4 -ei2 -e5ic -ei5d -eig2 -ei5gl -e3imb -e3inf -e1ing -e5inst -eir4d -eit3e -ei3th -e5ity -e1j -e4jud -ej5udi -eki4n -ek4la -e1la -e4la. -e4lac -elan4d -el5ativ -e4law -elaxa4 -e3lea -el5ebra -5elec -e4led -el3ega -e5len -e4l1er -e1les -el2f -el2i -e3libe -e4l5ic. -el3ica -e3lier -el5igib -e5lim -e4l3ing -e3lio -e2lis -el5ish -e3liv3 -4ella -el4lab -ello4 -e5loc -el5og -el3op. -el2sh -el4ta -e5lud -el5ug -e4mac -e4mag -e5man -em5ana -em5b -e1me -e2mel -e4met -em3ica -emi4e -em5igra -em1in2 -em5ine -em3i3ni -e4mis -em5ish -e5miss -em3iz -5emniz -emo4g -emoni5o -em3pi -e4mul -em5ula -emu3n -e3my -en5amo -e4nant -ench4er -en3dic -e5nea -e5nee -en3em -en5ero -en5esi -en5est -en3etr -e3new -en5ics -e5nie -e5nil -e3nio -en3ish -en3it -e5niu -5eniz -4enn -4eno -eno4g -e4nos -en3ov -en4sw -ent5age -4enthes -en3ua -en5uf -e3ny. -4en3z -e5of -eo2g -e4oi4 -e3ol -eop3ar -e1or -eo3re -eo5rol -eos4 -e4ot -eo4to -e5out -e5ow -e2pa -e3pai -ep5anc -e5pel -e3pent -ep5etitio -ephe4 -e4pli -e1po -e4prec -ep5reca -e4pred -ep3reh -e3pro -e4prob -ep4sh -ep5ti5b -e4put -ep5uta -e1q -equi3l -e4q3ui3s -er1a -era4b -4erand -er3ar -4erati. -2erb -er4bl -er3ch -er4che -2ere. -e3real -ere5co -ere3in -er5el. -er3emo -er5ena -er5ence -4erene -er3ent -ere4q -er5ess -er3est -eret4 -er1h -er1i -e1ria4 -5erick -e3rien -eri4er -er3ine -e1rio -4erit -er4iu -eri4v -e4riva -er3m4 -er4nis -4ernit -5erniz -er3no -2ero -er5ob -e5roc -ero4r -er1ou -er1s -er3set -ert3er -4ertl -er3tw -4eru -eru4t -5erwau -e1s4a -e4sage. -e4sages -es2c -e2sca -es5can -e3scr -es5cu -e1s2e -e2sec -es5ecr -es5enc -e4sert. -e4serts -e4serva -4esh -e3sha -esh5en -e1si -e2sic -e2sid -es5iden -es5igna -e2s5im -es4i4n -esis4te -esi4u -e5skin -es4mi -e2sol -es3olu -e2son -es5ona -e1sp -es3per -es5pira -es4pre -2ess -es4si4b -estan4 -es3tig -es5tim -4es2to -e3ston -2estr -e5stro -estruc5 -e2sur -es5urr -es4w -eta4b -eten4d -e3teo -ethod3 -et1ic -e5tide -etin4 -eti4no -e5tir -e5titio -et5itiv -4etn -et5ona -e3tra -e3tre -et3ric -et5rif -et3rog -et5ros -et3ua -et5ym -et5z -4eu -e5un -e3up -eu3ro -eus4 -eute4 -euti5l -eu5tr -eva2p5 -e2vas -ev5ast -e5vea -ev3ell -evel3o -e5veng -even4i -ev1er -e5verb -e1vi -ev3id -evi4l -e4vin -evi4v -e5voc -e5vu -e1wa -e4wag -e5wee -e3wh -ewil5 -ew3ing -e3wit -1exp -5eyc -5eye. -eys4 -1fa -fa3bl -fab3r -fa4ce -4fag -fain4 -fall5e -4fa4ma -fam5is -5far -far5th -fa3ta -fa3the -4fato -fault5 -4f5b -4fd -4fe. -feas4 -feath3 -fe4b -4feca -5fect -2fed -fe3li -fe4mo -fen2d -fend5e -fer1 -5ferr -fev4 -4f1f -f4fes -f4fie -f5fin. -f2f5is -f4fly -f2fy -4fh -1fi -fi3a -2f3ic. -4f3ical -f3ican -4ficate -f3icen -fi3cer -fic4i -5ficia -5ficie -4fics -fi3cu -fi5del -fight5 -fil5i -fill5in -4fily -2fin -5fina -fin2d5 -fi2ne -f1in3g -fin4n -fis4ti -f4l2 -f5less -flin4 -flo3re -f2ly5 -4fm -4fn -1fo -5fon -fon4de -fon4t -fo2r -fo5rat -for5ay -fore5t -for4i -fort5a -fos5 -4f5p -fra4t -f5rea -fres5c -fri2 -fril4 -frol5 -2f3s -2ft -f4to -f2ty -3fu -fu5el -4fug -fu4min -fu5ne -fu3ri -fusi4 -fus4s -4futa -1fy -1ga -gaf4 -5gal. -3gali -ga3lo -2gam -ga5met -g5amo -gan5is -ga3niz -gani5za -4gano -gar5n4 -gass4 -gath3 -4gativ -4gaz -g3b -gd4 -2ge. -2ged -geez4 -gel4in -ge5lis -ge5liz -4gely -1gen -ge4nat -ge5niz -4geno -4geny -1geo -ge3om -g4ery -5gesi -geth5 -4geto -ge4ty -ge4v -4g1g2 -g2ge -g3ger -gglu5 -ggo4 -gh3in -gh5out -gh4to -5gi. -1gi4a -gia5r -g1ic -5gicia -g4ico -gien5 -5gies. -gil4 -g3imen -3g4in. -gin5ge -5g4ins -5gio -3gir -gir4l -g3isl -gi4u -5giv -3giz -gl2 -gla4 -glad5i -5glas -1gle -gli4b -g3lig -3glo -glo3r -g1m -g4my -gn4a -g4na. -gnet4t -g1ni -g2nin -g4nio -g1no -g4non -1go -3go. -gob5 -5goe -3g4o4g -go3is -gon2 -4g3o3na -gondo5 -go3ni -5goo -go5riz -gor5ou -5gos. -gov1 -g3p -1gr -4grada -g4rai -gran2 -5graph. -g5rapher -5graphic -4graphy -4gray -gre4n -4gress. -4grit -g4ro -gruf4 -gs2 -g5ste -gth3 -gu4a -3guard -2gue -5gui5t -3gun -3gus -4gu4t -g3w -1gy -2g5y3n -gy5ra -h3ab4l -hach4 -hae4m -hae4t -h5agu -ha3la -hala3m -ha4m -han4ci -han4cy -5hand. -han4g -hang5er -hang5o -h5a5niz -han4k -han4te -hap3l -hap5t -ha3ran -ha5ras -har2d -hard3e -har4le -harp5en -har5ter -has5s -haun4 -5haz -haz3a -h1b -1head -3hear -he4can -h5ecat -h4ed -he5do5 -he3l4i -hel4lis -hel4ly -h5elo -hem4p -he2n -hena4 -hen5at -heo5r -hep5 -h4era -hera3p -her4ba -here5a -h3ern -h5erou -h3ery -h1es -he2s5p -he4t -het4ed -heu4 -h1f -h1h -hi5an -hi4co -high5 -h4il2 -himer4 -h4ina -hion4e -hi4p -hir4l -hi3ro -hir4p -hir4r -his3el -his4s -hith5er -hi2v -4hk -4h1l4 -hlan4 -h2lo -hlo3ri -4h1m -hmet4 -2h1n -h5odiz -h5ods -ho4g -hoge4 -hol5ar -3hol4e -ho4ma -home3 -hon4a -ho5ny -3hood -hoon4 -hor5at -ho5ris -hort3e -ho5ru -hos4e -ho5sen -hos1p -1hous -house3 -hov5el -4h5p -4hr4 -hree5 -hro5niz -hro3po -4h1s2 -h4sh -h4tar -ht1en -ht5es -h4ty -hu4g -hu4min -hun5ke -hun4t -hus3t4 -hu4t -h1w -h4wart -hy3pe -hy3ph -hy2s -2i1a -i2al -iam4 -iam5ete -i2an -4ianc -ian3i -4ian4t -ia5pe -iass4 -i4ativ -ia4tric -i4atu -ibe4 -ib3era -ib5ert -ib5ia -ib3in -ib5it. -ib5ite -i1bl -ib3li -i5bo -i1br -i2b5ri -i5bun -4icam -5icap -4icar -i4car. -i4cara -icas5 -i4cay -iccu4 -4iceo -4ich -2ici -i5cid -ic5ina -i2cip -ic3ipa -i4cly -i2c5oc -4i1cr -5icra -i4cry -ic4te -ictu2 -ic4t3ua -ic3ula -ic4um -ic5uo -i3cur -2id -i4dai -id5anc -id5d -ide3al -ide4s -i2di -id5ian -idi4ar -i5die -id3io -idi5ou -id1it -id5iu -i3dle -i4dom -id3ow -i4dr -i2du -id5uo -2ie4 -ied4e -5ie5ga -ield3 -ien5a4 -ien4e -i5enn -i3enti -i1er. -i3esc -i1est -i3et -4if. -if5ero -iff5en -if4fr -4ific. -i3fie -i3fl -4ift -2ig -iga5b -ig3era -ight3i -4igi -i3gib -ig3il -ig3in -ig3it -i4g4l -i2go -ig3or -ig5ot -i5gre -igu5i -ig1ur -i3h -4i5i4 -i3j -4ik -i1la -il3a4b -i4lade -i2l5am -ila5ra -i3leg -il1er -ilev4 -il5f -il1i -il3ia -il2ib -il3io -il4ist -2ilit -il2iz -ill5ab -4iln -il3oq -il4ty -il5ur -il3v -i4mag -im3age -ima5ry -imenta5r -4imet -im1i -im5ida -imi5le -i5mini -4imit -im4ni -i3mon -i2mu -im3ula -2in. -i4n3au -4inav -incel4 -in3cer -4ind -in5dling -2ine -i3nee -iner4ar -i5ness -4inga -4inge -in5gen -4ingi -in5gling -4ingo -4ingu -2ini -i5ni. -i4nia -in3io -in1is -i5nite. -5initio -in3ity -4ink -4inl -2inn -2i1no -i4no4c -ino4s -i4not -2ins -in3se -insur5a -2int. -2in4th -in1u -i5nus -4iny -2io -4io. -ioge4 -io2gr -i1ol -io4m -ion3at -ion4ery -ion3i -io5ph -ior3i -i4os -io5th -i5oti -io4to -i4our -2ip -ipe4 -iphras4 -ip3i -ip4ic -ip4re4 -ip3ul -i3qua -iq5uef -iq3uid -iq3ui3t -4ir -i1ra -ira4b -i4rac -ird5e -ire4de -i4ref -i4rel4 -i4res -ir5gi -ir1i -iri5de -ir4is -iri3tu -5i5r2iz -ir4min -iro4g -5iron. -ir5ul -2is. -is5ag -is3ar -isas5 -2is1c -is3ch -4ise -is3er -3isf -is5han -is3hon -ish5op -is3ib -isi4d -i5sis -is5itiv -4is4k -islan4 -4isms -i2so -iso5mer -is1p -is2pi -is4py -4is1s -is4sal -issen4 -is4ses -is4ta. -is1te -is1ti -ist4ly -4istral -i2su -is5us -4ita. -ita4bi -i4tag -4ita5m -i3tan -i3tat -2ite -it3era -i5teri -it4es -2ith -i1ti -4itia -4i2tic -it3ica -5i5tick -it3ig -it5ill -i2tim -2itio -4itis -i4tism -i2t5o5m -4iton -i4tram -it5ry -4itt -it3uat -i5tud -it3ul -4itz. -i1u -2iv -iv3ell -iv3en. -i4v3er. -i4vers. -iv5il. -iv5io -iv1it -i5vore -iv3o3ro -i4v3ot -4i5w -ix4o -4iy -4izar -izi4 -5izont -5ja -jac4q -ja4p -1je -jer5s -4jestie -4jesty -jew3 -jo4p -5judg -3ka. -k3ab -k5ag -kais4 -kal4 -k1b -k2ed -1kee -ke4g -ke5li -k3en4d -k1er -kes4 -k3est. -ke4ty -k3f -kh4 -k1i -5ki. -5k2ic -k4ill -kilo5 -k4im -k4in. -kin4de -k5iness -kin4g -ki4p -kis4 -k5ish -kk4 -k1l -4kley -4kly -k1m -k5nes -1k2no -ko5r -kosh4 -k3ou -kro5n -4k1s2 -k4sc -ks4l -k4sy -k5t -k1w -lab3ic -l4abo -laci4 -l4ade -la3dy -lag4n -lam3o -3land -lan4dl -lan5et -lan4te -lar4g -lar3i -las4e -la5tan -4lateli -4lativ -4lav -la4v4a -2l1b -lbin4 -4l1c2 -lce4 -l3ci -2ld -l2de -ld4ere -ld4eri -ldi4 -ld5is -l3dr -l4dri -le2a -le4bi -left5 -5leg. -5legg -le4mat -lem5atic -4len. -3lenc -5lene. -1lent -le3ph -le4pr -lera5b -ler4e -3lerg -3l4eri -l4ero -les2 -le5sco -5lesq -3less -5less. -l3eva -lev4er. -lev4era -lev4ers -3ley -4leye -2lf -l5fr -4l1g4 -l5ga -lgar3 -l4ges -lgo3 -2l3h -li4ag -li2am -liar5iz -li4as -li4ato -li5bi -5licio -li4cor -4lics -4lict. -l4icu -l3icy -l3ida -lid5er -3lidi -lif3er -l4iff -li4fl -5ligate -3ligh -li4gra -3lik -4l4i4l -lim4bl -lim3i -li4mo -l4im4p -l4ina -1l4ine -lin3ea -lin3i -link5er -li5og -4l4iq -lis4p -l1it -l2it. -5litica -l5i5tics -liv3er -l1iz -4lj -lka3 -l3kal -lka4t -l1l -l4law -l2le -l5lea -l3lec -l3leg -l3lel -l3le4n -l3le4t -ll2i -l2lin4 -l5lina -ll4o -lloqui5 -ll5out -l5low -2lm -l5met -lm3ing -l4mod -lmon4 -2l1n2 -3lo. -lob5al -lo4ci -4lof -3logic -l5ogo -3logu -lom3er -5long -lon4i -l3o3niz -lood5 -5lope. -lop3i -l3opm -lora4 -lo4rato -lo5rie -lor5ou -5los. -los5et -5losophiz -5losophy -los4t -lo4ta -loun5d -2lout -4lov -2lp -lpa5b -l3pha -l5phi -lp5ing -l3pit -l4pl -l5pr -4l1r -2l1s2 -l4sc -l2se -l4sie -4lt -lt5ag -ltane5 -l1te -lten4 -ltera4 -lth3i -l5ties. -ltis4 -l1tr -ltu2 -ltur3a -lu5a -lu3br -luch4 -lu3ci -lu3en -luf4 -lu5id -lu4ma -5lumi -l5umn. -5lumnia -lu3o -luo3r -4lup -luss4 -lus3te -1lut -l5ven -l5vet4 -2l1w -1ly -4lya -4lyb -ly5me -ly3no -2lys4 -l5yse -1ma -2mab -ma2ca -ma5chine -ma4cl -mag5in -5magn -2mah -maid5 -4mald -ma3lig -ma5lin -mal4li -mal4ty -5mania -man5is -man3iz -4map -ma5rine. -ma5riz -mar4ly -mar3v -ma5sce -mas4e -mas1t -5mate -math3 -ma3tis -4matiza -4m1b -mba4t5 -m5bil -m4b3ing -mbi4v -4m5c -4me. -2med -4med. -5media -me3die -m5e5dy -me2g -mel5on -mel4t -me2m -mem1o3 -1men -men4a -men5ac -men4de -4mene -men4i -mens4 -mensu5 -3ment -men4te -me5on -m5ersa -2mes -3mesti -me4ta -met3al -me1te -me5thi -m4etr -5metric -me5trie -me3try -me4v -4m1f -2mh -5mi. -mi3a -mid4a -mid4g -mig4 -3milia -m5i5lie -m4ill -min4a -3mind -m5inee -m4ingl -min5gli -m5ingly -min4t -m4inu -miot4 -m2is -mis4er. -mis5l -mis4ti -m5istry -4mith -m2iz -4mk -4m1l -m1m -mma5ry -4m1n -mn4a -m4nin -mn4o -1mo -4mocr -5mocratiz -mo2d1 -mo4go -mois2 -moi5se -4mok -mo5lest -mo3me -mon5et -mon5ge -moni3a -mon4ism -mon4ist -mo3niz -monol4 -mo3ny. -mo2r -4mora. -mos2 -mo5sey -mo3sp -moth3 -m5ouf -3mous -mo2v -4m1p -mpara5 -mpa5rab -mpar5i -m3pet -mphas4 -m2pi -mpi4a -mp5ies -m4p1in -m5pir -mp5is -mpo3ri -mpos5ite -m4pous -mpov5 -mp4tr -m2py -4m3r -4m1s2 -m4sh -m5si -4mt -1mu -mula5r4 -5mult -multi3 -3mum -mun2 -4mup -mu4u -4mw -1na -2n1a2b -n4abu -4nac. -na4ca -n5act -nag5er. -nak4 -na4li -na5lia -4nalt -na5mit -n2an -nanci4 -nan4it -nank4 -nar3c -4nare -nar3i -nar4l -n5arm -n4as -nas4c -nas5ti -n2at -na3tal -nato5miz -n2au -nau3se -3naut -nav4e -4n1b4 -ncar5 -n4ces. -n3cha -n5cheo -n5chil -n3chis -nc1in -nc4it -ncour5a -n1cr -n1cu -n4dai -n5dan -n1de -nd5est. -ndi4b -n5d2if -n1dit -n3diz -n5duc -ndu4r -nd2we -2ne. -n3ear -ne2b -neb3u -ne2c -5neck -2ned -ne4gat -neg5ativ -5nege -ne4la -nel5iz -ne5mi -ne4mo -1nen -4nene -3neo -ne4po -ne2q -n1er -nera5b -n4erar -n2ere -n4er5i -ner4r -1nes -2nes. -4nesp -2nest -4nesw -3netic -ne4v -n5eve -ne4w -n3f -n4gab -n3gel -nge4n4e -n5gere -n3geri -ng5ha -n3gib -ng1in -n5git -n4gla -ngov4 -ng5sh -n1gu -n4gum -n2gy -4n1h4 -nha4 -nhab3 -nhe4 -3n4ia -ni3an -ni4ap -ni3ba -ni4bl -ni4d -ni5di -ni4er -ni2fi -ni5ficat -n5igr -nik4 -n1im -ni3miz -n1in -5nine. -nin4g -ni4o -5nis. -nis4ta -n2it -n4ith -3nitio -n3itor -ni3tr -n1j -4nk2 -n5kero -n3ket -nk3in -n1kl -4n1l -n5m -nme4 -nmet4 -4n1n2 -nne4 -nni3al -nni4v -nob4l -no3ble -n5ocl -4n3o2d -3noe -4nog -noge4 -nois5i -no5l4i -5nologis -3nomic -n5o5miz -no4mo -no3my -no4n -non4ag -non5i -n5oniz -4nop -5nop5o5li -nor5ab -no4rary -4nosc -nos4e -nos5t -no5ta -1nou -3noun -nov3el3 -nowl3 -n1p4 -npi4 -npre4c -n1q -n1r -nru4 -2n1s2 -ns5ab -nsati4 -ns4c -n2se -n4s3es -nsid1 -nsig4 -n2sl -ns3m -n4soc -ns4pe -n5spi -nsta5bl -n1t -nta4b -nter3s -nt2i -n5tib -nti4er -nti2f -n3tine -n4t3ing -nti4p -ntrol5li -nt4s -ntu3me -nu1a -nu4d -nu5en -nuf4fe -n3uin -3nu3it -n4um -nu1me -n5umi -3nu4n -n3uo -nu3tr -n1v2 -n1w4 -nym4 -nyp4 -4nz -n3za -4oa -oad3 -o5a5les -oard3 -oas4e -oast5e -oat5i -ob3a3b -o5bar -obe4l -o1bi -o2bin -ob5ing -o3br -ob3ul -o1ce -och4 -o3chet -ocif3 -o4cil -o4clam -o4cod -oc3rac -oc5ratiz -ocre3 -5ocrit -octor5a -oc3ula -o5cure -od5ded -od3ic -odi3o -o2do4 -odor3 -od5uct. -od5ucts -o4el -o5eng -o3er -oe4ta -o3ev -o2fi -of5ite -ofit4t -o2g5a5r -og5ativ -o4gato -o1ge -o5gene -o5geo -o4ger -o3gie -1o1gis -og3it -o4gl -o5g2ly -3ogniz -o4gro -ogu5i -1ogy -2ogyn -o1h2 -ohab5 -oi2 -oic3es -oi3der -oiff4 -oig4 -oi5let -o3ing -oint5er -o5ism -oi5son -oist5en -oi3ter -o5j -2ok -o3ken -ok5ie -o1la -o4lan -olass4 -ol2d -old1e -ol3er -o3lesc -o3let -ol4fi -ol2i -o3lia -o3lice -ol5id. -o3li4f -o5lil -ol3ing -o5lio -o5lis. -ol3ish -o5lite -o5litio -o5liv -olli4e -ol5ogiz -olo4r -ol5pl -ol2t -ol3ub -ol3ume -ol3un -o5lus -ol2v -o2ly -om5ah -oma5l -om5atiz -om2be -om4bl -o2me -om3ena -om5erse -o4met -om5etry -o3mia -om3ic. -om3ica -o5mid -om1in -o5mini -5ommend -omo4ge -o4mon -om3pi -ompro5 -o2n -on1a -on4ac -o3nan -on1c -3oncil -2ond -on5do -o3nen -on5est -on4gu -on1ic -o3nio -on1is -o5niu -on3key -on4odi -on3omy -on3s -onspi4 -onspir5a -onsu4 -onten4 -on3t4i -ontif5 -on5um -onva5 -oo2 -ood5e -ood5i -oo4k -oop3i -o3ord -oost5 -o2pa -ope5d -op1er -3opera -4operag -2oph -o5phan -o5pher -op3ing -o3pit -o5pon -o4posi -o1pr -op1u -opy5 -o1q -o1ra -o5ra. -o4r3ag -or5aliz -or5ange -ore5a -o5real -or3ei -ore5sh -or5est. -orew4 -or4gu -4o5ria -or3ica -o5ril -or1in -o1rio -or3ity -o3riu -or2mi -orn2e -o5rof -or3oug -or5pe -3orrh -or4se -ors5en -orst4 -or3thi -or3thy -or4ty -o5rum -o1ry -os3al -os2c -os4ce -o3scop -4oscopi -o5scr -os4i4e -os5itiv -os3ito -os3ity -osi4u -os4l -o2so -os4pa -os4po -os2ta -o5stati -os5til -os5tit -o4tan -otele4g -ot3er. -ot5ers -o4tes -4oth -oth5esi -oth3i4 -ot3ic. -ot5ica -o3tice -o3tif -o3tis -oto5s -ou2 -ou3bl -ouch5i -ou5et -ou4l -ounc5er -oun2d -ou5v -ov4en -over4ne -over3s -ov4ert -o3vis -oviti4 -o5v4ol -ow3der -ow3el -ow5est -ow1i -own5i -o4wo -oy1a -1pa -pa4ca -pa4ce -pac4t -p4ad -5pagan -p3agat -p4ai -pain4 -p4al -pan4a -pan3el -pan4ty -pa3ny -pa1p -pa4pu -para5bl -par5age -par5di -3pare -par5el -p4a4ri -par4is -pa2te -pa5ter -5pathic -pa5thy -pa4tric -pav4 -3pay -4p1b -pd4 -4pe. -3pe4a -pear4l -pe2c -2p2ed -3pede -3pedi -pedia4 -ped4ic -p4ee -pee4d -pek4 -pe4la -peli4e -pe4nan -p4enc -pen4th -pe5on -p4era. -pera5bl -p4erag -p4eri -peri5st -per4mal -perme5 -p4ern -per3o -per3ti -pe5ru -per1v -pe2t -pe5ten -pe5tiz -4pf -4pg -4ph. -phar5i -phe3no -ph4er -ph4es. -ph1ic -5phie -ph5ing -5phisti -3phiz -ph2l -3phob -3phone -5phoni -pho4r -4phs -ph3t -5phu -1phy -pi3a -pian4 -pi4cie -pi4cy -p4id -p5ida -pi3de -5pidi -3piec -pi3en -pi4grap -pi3lo -pi2n -p4in. -pind4 -p4ino -3pi1o -pion4 -p3ith -pi5tha -pi2tu -2p3k2 -1p2l2 -3plan -plas5t -pli3a -pli5er -4plig -pli4n -ploi4 -plu4m -plum4b -4p1m -2p3n -po4c -5pod. -po5em -po3et5 -5po4g -poin2 -5point -poly5t -po4ni -po4p -1p4or -po4ry -1pos -pos1s -p4ot -po4ta -5poun -4p1p -ppa5ra -p2pe -p4ped -p5pel -p3pen -p3per -p3pet -ppo5site -pr2 -pray4e -5preci -pre5co -pre3em -pref5ac -pre4la -pre3r -p3rese -3press -pre5ten -pre3v -5pri4e -prin4t3 -pri4s -pris3o -p3roca -prof5it -pro3l -pros3e -pro1t -2p1s2 -p2se -ps4h -p4sib -2p1t -pt5a4b -p2te -p2th -pti3m -ptu4r -p4tw -pub3 -pue4 -puf4 -pul3c -pu4m -pu2n -pur4r -5pus -pu2t -5pute -put3er -pu3tr -put4ted -put4tin -p3w -qu2 -qua5v -2que. -3quer -3quet -2rab -ra3bi -rach4e -r5acl -raf5fi -raf4t -r2ai -ra4lo -ram3et -r2ami -rane5o -ran4ge -r4ani -ra5no -rap3er -3raphy -rar5c -rare4 -rar5ef -4raril -r2as -ration4 -rau4t -ra5vai -rav3el -ra5zie -r1b -r4bab -r4bag -rbi2 -rbi4f -r2bin -r5bine -rb5ing. -rb4o -r1c -r2ce -rcen4 -r3cha -rch4er -r4ci4b -rc4it -rcum3 -r4dal -rd2i -rdi4a -rdi4er -rdin4 -rd3ing -2re. -re1al -re3an -re5arr -5reav -re4aw -r5ebrat -rec5oll -rec5ompe -re4cre -2r2ed -re1de -re3dis -red5it -re4fac -re2fe -re5fer. -re3fi -re4fy -reg3is -re5it -re1li -re5lu -r4en4ta -ren4te -re1o -re5pin -re4posi -re1pu -r1er4 -r4eri -rero4 -re5ru -r4es. -re4spi -ress5ib -res2t -re5stal -re3str -re4ter -re4ti4z -re3tri -reu2 -re5uti -rev2 -re4val -rev3el -r5ev5er. -re5vers -re5vert -re5vil -rev5olu -re4wh -r1f -rfu4 -r4fy -rg2 -rg3er -r3get -r3gic -rgi4n -rg3ing -r5gis -r5git -r1gl -rgo4n -r3gu -rh4 -4rh. -4rhal -ri3a -ria4b -ri4ag -r4ib -rib3a -ric5as -r4ice -4rici -5ricid -ri4cie -r4ico -rid5er -ri3enc -ri3ent -ri1er -ri5et -rig5an -5rigi -ril3iz -5riman -rim5i -3rimo -rim4pe -r2ina -5rina. -rin4d -rin4e -rin4g -ri1o -5riph -riph5e -ri2pl -rip5lic -r4iq -r2is -r4is. -ris4c -r3ish -ris4p -ri3ta3b -r5ited. -rit5er. -rit5ers -rit3ic -ri2tu -rit5ur -riv5el -riv3et -riv3i -r3j -r3ket -rk4le -rk4lin -r1l -rle4 -r2led -r4lig -r4lis -rl5ish -r3lo4 -r1m -rma5c -r2me -r3men -rm5ers -rm3ing -r4ming. -r4mio -r3mit -r4my -r4nar -r3nel -r4ner -r5net -r3ney -r5nic -r1nis4 -r3nit -r3niv -rno4 -r4nou -r3nu -rob3l -r2oc -ro3cr -ro4e -ro1fe -ro5fil -rok2 -ro5ker -5role. -rom5ete -rom4i -rom4p -ron4al -ron4e -ro5n4is -ron4ta -1room -5root -ro3pel -rop3ic -ror3i -ro5ro -ros5per -ros4s -ro4the -ro4ty -ro4va -rov5el -rox5 -r1p -r4pea -r5pent -rp5er. -r3pet -rp4h4 -rp3ing -r3po -r1r4 -rre4c -rre4f -r4reo -rre4st -rri4o -rri4v -rron4 -rros4 -rrys4 -4rs2 -r1sa -rsa5ti -rs4c -r2se -r3sec -rse4cr -rs5er. -rs3es -rse5v2 -r1sh -r5sha -r1si -r4si4b -rson3 -r1sp -r5sw -rtach4 -r4tag -r3teb -rten4d -rte5o -r1ti -rt5ib -rti4d -r4tier -r3tig -rtil3i -rtil4l -r4tily -r4tist -r4tiv -r3tri -rtroph4 -rt4sh -ru3a -ru3e4l -ru3en -ru4gl -ru3in -rum3pl -ru2n -runk5 -run4ty -r5usc -ruti5n -rv4e -rvel4i -r3ven -rv5er. -r5vest -r3vey -r3vic -rvi4v -r3vo -r1w -ry4c -5rynge -ry3t -sa2 -2s1ab -5sack -sac3ri -s3act -5sai -salar4 -sal4m -sa5lo -sal4t -3sanc -san4de -s1ap -sa5ta -5sa3tio -sat3u -sau4 -sa5vor -5saw -4s5b -scan4t5 -sca4p -scav5 -s4ced -4scei -s4ces -sch2 -s4cho -3s4cie -5scin4d -scle5 -s4cli -scof4 -4scopy -scour5a -s1cu -4s5d -4se. -se4a -seas4 -sea5w -se2c3o -3sect -4s4ed -se4d4e -s5edl -se2g -seg3r -5sei -se1le -5self -5selv -4seme -se4mol -sen5at -4senc -sen4d -s5ened -sen5g -s5enin -4sentd -4sentl -sep3a3 -4s1er. -s4erl -ser4o -4servo -s1e4s -se5sh -ses5t -5se5um -5sev -sev3en -sew4i -5sex -4s3f -2s3g -s2h -2sh. -sh1er -5shev -sh1in -sh3io -3ship -shiv5 -sho4 -sh5old -shon3 -shor4 -short5 -4shw -si1b -s5icc -3side. -5sides -5sidi -si5diz -4signa -sil4e -4sily -2s1in -s2ina -5sine. -s3ing -1sio -5sion -sion5a -si2r -sir5a -1sis -3sitio -5siu -1siv -5siz -sk2 -4ske -s3ket -sk5ine -sk5ing -s1l2 -s3lat -s2le -slith5 -2s1m -s3ma -small3 -sman3 -smel4 -s5men -5smith -smol5d4 -s1n4 -1so -so4ce -soft3 -so4lab -sol3d2 -so3lic -5solv -3som -3s4on. -sona4 -son4g -s4op -5sophic -s5ophiz -s5ophy -sor5c -sor5d -4sov -so5vi -2spa -5spai -spa4n -spen4d -2s5peo -2sper -s2phe -3spher -spho5 -spil4 -sp5ing -4spio -s4ply -s4pon -spor4 -4spot -squal4l -s1r -2ss -s1sa -ssas3 -s2s5c -s3sel -s5seng -s4ses. -s5set -s1si -s4sie -ssi4er -ss5ily -s4sl -ss4li -s4sn -sspend4 -ss2t -ssur5a -ss5w -2st. -s2tag -s2tal -stam4i -5stand -s4ta4p -5stat. -s4ted -stern5i -s5tero -ste2w -stew5a -s3the -st2i -s4ti. -s5tia -s1tic -5stick -s4tie -s3tif -st3ing -5stir -s1tle -5stock -stom3a -5stone -s4top -3store -st4r -s4trad -5stratu -s4tray -s4trid -4stry -4st3w -s2ty -1su -su1al -su4b3 -su2g3 -su5is -suit3 -s4ul -su2m -sum3i -su2n -su2r -4sv -sw2 -4swo -s4y -4syc -3syl -syn5o -sy5rin -1ta -3ta. -2tab -ta5bles -5taboliz -4taci -ta5do -4taf4 -tai5lo -ta2l -ta5la -tal5en -tal3i -4talk -tal4lis -ta5log -ta5mo -tan4de -tanta3 -ta5per -ta5pl -tar4a -4tarc -4tare -ta3riz -tas4e -ta5sy -4tatic -ta4tur -taun4 -tav4 -2taw -tax4is -2t1b -4tc -t4ch -tch5et -4t1d -4te. -tead4i -4teat -tece4 -5tect -2t1ed -te5di -1tee -teg4 -te5ger -te5gi -3tel. -teli4 -5tels -te2ma2 -tem3at -3tenan -3tenc -3tend -4tenes -1tent -ten4tag -1teo -te4p -te5pe -ter3c -5ter3d -1teri -ter5ies -ter3is -teri5za -5ternit -ter5v -4tes. -4tess -t3ess. -teth5e -3teu -3tex -4tey -2t1f -4t1g -2th. -than4 -th2e -4thea -th3eas -the5at -the3is -3thet -th5ic. -th5ica -4thil -5think -4thl -th5ode -5thodic -4thoo -thor5it -tho5riz -2ths -1tia -ti4ab -ti4ato -2ti2b -4tick -t4ico -t4ic1u -5tidi -3tien -tif2 -ti5fy -2tig -5tigu -till5in -1tim -4timp -tim5ul -2t1in -t2ina -3tine. -3tini -1tio -ti5oc -tion5ee -5tiq -ti3sa -3tise -tis4m -ti5so -tis4p -5tistica -ti3tl -ti4u -1tiv -tiv4a -1tiz -ti3za -ti3zen -2tl -t5la -tlan4 -3tle. -3tled -3tles. -t5let. -t5lo -4t1m -tme4 -2t1n2 -1to -to3b -to5crat -4todo -2tof -to2gr -to5ic -to2ma -tom4b -to3my -ton4ali -to3nat -4tono -4tony -to2ra -to3rie -tor5iz -tos2 -5tour -4tout -to3war -4t1p -1tra -tra3b -tra5ch -traci4 -trac4it -trac4te -tras4 -tra5ven -trav5es5 -tre5f -tre4m -trem5i -5tria -tri5ces -5tricia -4trics -2trim -tri4v -tro5mi -tron5i -4trony -tro5phe -tro3sp -tro3v -tru5i -trus4 -4t1s2 -t4sc -tsh4 -t4sw -4t3t2 -t4tes -t5to -ttu4 -1tu -tu1a -tu3ar -tu4bi -tud2 -4tue -4tuf4 -5tu3i -3tum -tu4nis -2t3up. -3ture -5turi -tur3is -tur5o -tu5ry -3tus -4tv -tw4 -4t1wa -twis4 -4two -1ty -4tya -2tyl -type3 -ty5ph -4tz -tz4e -4uab -uac4 -ua5na -uan4i -uar5ant -uar2d -uar3i -uar3t -u1at -uav4 -ub4e -u4bel -u3ber -u4bero -u1b4i -u4b5ing -u3ble. -u3ca -uci4b -uc4it -ucle3 -u3cr -u3cu -u4cy -ud5d -ud3er -ud5est -udev4 -u1dic -ud3ied -ud3ies -ud5is -u5dit -u4don -ud4si -u4du -u4ene -uens4 -uen4te -uer4il -3ufa -u3fl -ugh3en -ug5in -2ui2 -uil5iz -ui4n -u1ing -uir4m -uita4 -uiv3 -uiv4er. -u5j -4uk -u1la -ula5b -u5lati -ulch4 -5ulche -ul3der -ul4e -u1len -ul4gi -ul2i -u5lia -ul3ing -ul5ish -ul4lar -ul4li4b -ul4lis -4ul3m -u1l4o -4uls -uls5es -ul1ti -ultra3 -4ultu -u3lu -ul5ul -ul5v -um5ab -um4bi -um4bly -u1mi -u4m3ing -umor5o -um2p -unat4 -u2ne -un4er -u1ni -un4im -u2nin -un5ish -uni3v -un3s4 -un4sw -unt3ab -un4ter. -un4tes -unu4 -un5y -un5z -u4ors -u5os -u1ou -u1pe -uper5s -u5pia -up3ing -u3pl -up3p -upport5 -upt5ib -uptu4 -u1ra -4ura. -u4rag -u4ras -ur4be -urc4 -ur1d -ure5at -ur4fer -ur4fr -u3rif -uri4fic -ur1in -u3rio -u1rit -ur3iz -ur2l -url5ing. -ur4no -uros4 -ur4pe -ur4pi -urs5er -ur5tes -ur3the -urti4 -ur4tie -u3ru -2us -u5sad -u5san -us4ap -usc2 -us3ci -use5a -u5sia -u3sic -us4lin -us1p -us5sl -us5tere -us1tr -u2su -usur4 -uta4b -u3tat -4ute. -4utel -4uten -uten4i -4u1t2i -uti5liz -u3tine -ut3ing -ution5a -u4tis -5u5tiz -u4t1l -ut5of -uto5g -uto5matic -u5ton -u4tou -uts4 -u3u -uu4m -u1v2 -uxu3 -uz4e -1va -5va. -2v1a4b -vac5il -vac3u -vag4 -va4ge -va5lie -val5o -val1u -va5mo -va5niz -va5pi -var5ied -3vat -4ve. -4ved -veg3 -v3el. -vel3li -ve4lo -v4ely -ven3om -v5enue -v4erd -5vere. -v4erel -v3eren -ver5enc -v4eres -ver3ie -vermi4n -3verse -ver3th -v4e2s -4ves. -ves4te -ve4te -vet3er -ve4ty -vi5ali -5vian -5vide. -5vided -4v3iden -5vides -5vidi -v3if -vi5gn -vik4 -2vil -5vilit -v3i3liz -v1in -4vi4na -v2inc -vin5d -4ving -vio3l -v3io4r -vi1ou -vi4p -vi5ro -vis3it -vi3so -vi3su -4viti -vit3r -4vity -3viv -5vo. -voi4 -3vok -vo4la -v5ole -5volt -3volv -vom5i -vor5ab -vori4 -vo4ry -vo4ta -4votee -4vv4 -v4y -w5abl -2wac -wa5ger -wag5o -wait5 -w5al. -wam4 -war4t -was4t -wa1te -wa5ver -w1b -wea5rie -weath3 -wed4n -weet3 -wee5v -wel4l -w1er -west3 -w3ev -whi4 -wi2 -wil2 -will5in -win4de -win4g -wir4 -3wise -with3 -wiz5 -w4k -wl4es -wl3in -w4no -1wo2 -wom1 -wo5ven -w5p -wra4 -wri4 -writa4 -w3sh -ws4l -ws4pe -w5s4t -4wt -wy4 -x1a -xac5e -x4ago -xam3 -x4ap -xas5 -x3c2 -x1e -xe4cuto -x2ed -xer4i -xe5ro -x1h -xhi2 -xhil5 -xhu4 -x3i -xi5a -xi5c -xi5di -x4ime -xi5miz -x3o -x4ob -x3p -xpan4d -xpecto5 -xpe3d -x1t2 -x3ti -x1u -xu3a -xx4 -y5ac -3yar4 -y5at -y1b -y1c -y2ce -yc5er -y3ch -ych4e -ycom4 -ycot4 -y1d -y5ee -y1er -y4erf -yes4 -ye4t -y5gi -4y3h -y1i -y3la -ylla5bl -y3lo -y5lu -ymbol5 -yme4 -ympa3 -yn3chr -yn5d -yn5g -yn5ic -5ynx -y1o4 -yo5d -y4o5g -yom4 -yo5net -y4ons -y4os -y4ped -yper5 -yp3i -y3po -y4poc -yp2ta -y5pu -yra5m -yr5ia -y3ro -yr4r -ys4c -y3s2e -ys3ica -ys3io -3ysis -y4so -yss4 -ys1t -ys3ta -ysur4 -y3thin -yt3ic -y1w -za1 -z5a2b -zar2 -4zb -2ze -ze4n -ze4p -z1er -ze3ro -zet4 -2z1i -z4il -z4is -5zl -4zm -1zo -zo4m -zo5ol -zte4 -4z1z2 -z4zy -Á1Á -Á1Å -Á1É -Á1Ï -Á1Õ -Á1Ù -Á1Ü -Á1À -Á1Ñ -Å1Á -Å1Å -Å1É -Å1Ï -Å1Õ -Å1Ù -Å1Ü -Å1À -Å1Ñ -É1Á -É1Å -É1É -É1Ï -É1Õ -É1Ù -É1Ü -É1À -É1Ñ -Ï1Á -Ï1Å -Ï1É -Ï1Ï -Ï1Õ -Ï1Ù -Ï1Ü -Ï1À -Ï1Ñ -Õ1Á -Õ1Å -Õ1É -Õ1Ï -Õ1Õ -Õ1Ù -Õ1Ü -Õ1À -Õ1Ñ -Ù1Á -Ù1Å -Ù1É -Ù1Ï -Ù1Õ -Ù1Ù -Ù1Ü -Ù1À -Ù1Ñ -Ü1Á -Ü1Å -Ü1É -Ü1Ï -Ü1Õ -Ü1Ù -Ü1Ü -Ü1À -Ü1Ñ -À1Á -À1Å -À1É -À1Ï -À1Õ -À1Ù -À1Ü -À1À -À1Ñ -Ñ1Á -Ñ1Å -Ñ1É -Ñ1Ï -Ñ1Õ -Ñ1Ù -Ñ1Ü -Ñ1À -Ñ1Ñ -.ÂÄ2 -.ÂÌ2 -.ÂÒ2 -.ÂØ2 -.×Â2 -.×ÂÌ2 -.×ÂÒ2 -.××2 -.××Ò2 -.×ÇÌ2 -.×Ä2 -.×Ä×2 -.×ÄÒ2 -.×Ú2 -.×ÚÂ2 -.×Ú×2 -.×ÚÇ2 -.×ÚÇÌ2 -.×ÚÇÒ2 -.×ÚÄ2 -.×ÚÄÒ2 -.×ÚÌ2 -.×ÚÍ2 -.×ÚÒ2 -.×Úß2 -.×Ë2 -.×ËÌ2 -.×ËÒ2 -.×Ì2 -.×Í2 -.×Î2 -.×Ð2 -.×ÐÌ2 -.×ÐÒ2 -.×Ò2 -.×Ó2 -.×ÓË2 -.×ÓËÒ2 -.×ÓÌ2 -.×ÓÍ2 -.×ÓÐ2 -.×ÓÐÌ2 -.×ÓÐÒ2 -.×ÓÔ2 -.×ÓÔÒ2 -.×ÓÈ2 -.×ÓÈÌ2 -.×Ô2 -.×ÔÒ2 -.×È2 -.×Ã2 -.×Þ2 -.ר2 -.Ç×2 -.ÇÄ2 -.ÇÌ2 -.ÇÎ2 -.ÇÒ2 -.Ä×2 -.ÄÌ2 -.ÄÎ2 -.ÄÒ2 -.ÄØ2 -.Ö×2 -.ÖÇ2 -.ÖÇÌ2 -.ÖÄ2 -.ÖÖ2 -.ÖÒ2 -.Ú×2 -.ÚÄ2 -.ÚÄÒ2 -.ÚÌ2 -.ÚÍ2 -.ÚÎ2 -.ÚÒ2 -.Ë×2 -.ËÌ2 -.ËÎ2 -.ËÒ2 -.ËÓÔ2 -.ËÔ2 -.ÌÂ2 -.ÌÇ2 -.ÌÖ2 -.ÌØ2 -.ÌØ×2 -.ÍÇÌ2 -.ÍÇÎ2 -.ÍÌ2 -.ÍÎ2 -.ÍÒ2 -.ÍÓÔ2 -.ÍÈ2 -.ÍÞ2 -.ÍÝ2 -.ÎÒ2 -.ÐÌ2 -.ÐÎ2 -.ÐÒ2 -.ÐÓ2 -.ÐÔ2 -.ÐÈ2 -.ÐÞ2 -.ÐÛ2 -.ÐØ2 -.Ò×2 -.ÒÖ2 -.ÒÔ2 -.ÓÂ2 -.ÓÂÌ2 -.ÓÂÒ2 -.Ó×2 -.Ó×ÓÔ2 -.ÓÇ2 -.ÓÇÎ2 -.ÓÇÒ2 -.ÓÄ2 -.ÓÄ×2 -.ÓÄÒ2 -.ÓÖ2 -.ÓÚ2 -.ÓË2 -.ÓË×2 -.ÓËÌ2 -.ÓËÒ2 -.ÓÌ2 -.ÓÍ2 -.ÓÎ2 -.ÓÐ2 -.ÓÐÌ2 -.ÓÐÒ2 -.ÓÒ2 -.ÓÓ2 -.ÓÔ2 -.ÓÔ×2 -.ÓÔÌ2 -.ÓÔÒ2 -.ÓÆ2 -.ÓÈ2 -.ÓÈ×2 -.ÓÈÌ2 -.ÓÞ2 -.ÓÛ2 -.Óß2 -.Ô×2 -.ÔË2 -.ÔËÎ2 -.ÔÌ2 -.ÔÒ2 -.ÔÝ2 -.ÔØÍ2 -.ÔØÆ2 -.ÆÌ2 -.ÆÒ2 -.È×2 -.ÈÌ2 -.ÈÍ2 -.ÈÎ2 -.ÈÒ2 -.Ã×2 -.ÞÌ2 -.ÞÒ2 -.ÞÔ2 -.ÞØ2 -.Û×2 -.ÛË2 -.ÛË×2 -.ÛÌ2 -.ÛÎ2 -.ÛÐ2 -.ÛÒ2 -.ÛÔ2 -.ÛÔÒ2 -1ÂÁ -1ÂÅ -1ÂÉ -1ÂÏ -1ÂÕ -1ÂÙ -1ÂÑ -1×Á -1×Å -1×É -1×Ï -1×Õ -1×Ù -1×Ñ -1ÇÁ -1ÇÅ -1ÇÉ -1ÇÏ -1ÇÕ -1ÄÁ -1ÄÅ -1ÄÉ -1ÄÏ -1ÄÕ -1ÄÙ -1ÄÀ -1ÄÑ -1ÖÁ -1ÖÅ -1ÖÉ -1ÖÏ -1ÖÕ -1ÖÙ -1ÚÁ -1ÚÅ -1ÚÉ -1ÚÏ -1ÚÕ -1ÚÙ -1ÚÑ -1ËÁ -1ËÅ -1ËÉ -1ËÏ -1ËÕ -1ÌÁ -1ÌÅ -1ÌÉ -1ÌÏ -1ÌÕ -1ÌÙ -1ÌÀ -1ÌÑ -1ÍÁ -1ÍÅ -1ÍÉ -1ÍÏ -1ÍÕ -1ÍÙ -1ÍÑ -1ÎÁ -1ÎÅ -1ÎÉ -1ÎÏ -1ÎÕ -1ÎÙ -1ÎÀ -1ÎÑ -1ÐÁ -1ÐÅ -1ÐÉ -1ÐÏ -1ÐÕ -1ÐÙ -1ÐÑ -1ÒÁ -1ÒÅ -1ÒÉ -1ÒÏ -1ÒÕ -1ÒÙ -1ÒÀ -1ÒÑ -1ÓÁ -1ÓÅ -1ÓÉ -1ÓÏ -1ÓÕ -1ÓÙ -1ÓÑ -1ÔÁ -1ÔÅ -1ÔÉ -1ÔÏ -1ÔÕ -1ÔÙ -1ÔÀ -1ÔÑ -1ÆÁ -1ÆÅ -1ÆÉ -1ÆÏ -1ÆÕ -1ÆÙ -1ÈÁ -1ÈÅ -1ÈÉ -1ÈÏ -1ÈÕ -1ÃÁ -1ÃÅ -1ÃÉ -1ÃÏ -1ÃÕ -1ÃÙ -1ÞÁ -1ÞÅ -1ÞÉ -1ÞÏ -1ÞÕ -1ÛÁ -1ÛÅ -1ÛÉ -1ÛÏ -1ÛÕ -1ÝÁ -1ÝÅ -1ÝÉ -1ÝÏ diff --git a/lib/libc/alpha/gen/rfork_thread.S b/lib/libc/alpha/gen/rfork_thread.S deleted file mode 100644 index ff0ed2c5acc2e..0000000000000 --- a/lib/libc/alpha/gen/rfork_thread.S +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "SYS.h" -#include <sys/syscall.h> -/* #include <machine/pal.h> */ - -/* - * This is pretty evil and based mostly on examples from other syscall - * stubs and code that gcc generated. Correctness is uncertain, but it - * seems to work quite happily. - */ -LEAF(rfork_thread, 1) - br gp,L1 /* XXX profiling */ -L1: - LDGP(pv) - lda sp,-16(sp) - stq ra,0(sp) - mov a3,a5 - CALLSYS_ERROR(rfork) - beq v0,$child - addl v0,zero,v0 - ldq ra,0(sp) - lda sp,16(sp) - RET -$child: - mov a1,sp - lda sp,-16(sp) - stq zero,0(sp) - mov a5,a0 - mov a2,t12 - jsr ra,(t12),0 - ldgp gp,0(ra) - mov v0,a0 -#ifdef SYS_exit - CALLSYS_NOERROR(exit) -#else - CALLSYS_NOERROR(sys_exit) -#endif -END(rfork_thread) diff --git a/lib/libc/i386/gen/rfork_thread.S b/lib/libc/i386/gen/rfork_thread.S deleted file mode 100644 index 2d63b67c7d0ca..0000000000000 --- a/lib/libc/i386/gen/rfork_thread.S +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * With thanks to John Dyson for the original version of this. - */ - -#include <SYS.h> - -/* - * 8 12 16 20 - * rfork_thread(flags, stack_addr, start_fnc, start_arg); - * - * flags: Flags to rfork system call. See rfork(2). - * stack_addr: Top of stack for thread. - * start_fnc: Address of thread function to call in child. - * start_arg: Argument to pass to the thread function in child. - */ - -ENTRY(rfork_thread) - pushl %ebp - movl %esp, %ebp - pushl %esi - - /* - * Push thread info onto the new thread's stack - */ - movl 12(%ebp), %esi # get stack addr - - subl $4, %esi - movl 20(%ebp), %eax # get start argument - movl %eax, (%esi) - - subl $4, %esi - movl 16(%ebp), %eax # get start thread address - movl %eax, (%esi) - - /* - * Prepare and execute the thread creation syscall - */ - pushl 8(%ebp) - pushl $0 - leal SYS_rfork, %eax - KERNCALL - jb 2f - - /* - * Check to see if we are in the parent or child - */ - cmpl $0, %edx - jnz 1f - addl $8, %esp - popl %esi - movl %ebp, %esp - popl %ebp - ret - .p2align 2 - - /* - * If we are in the child (new thread), then - * set-up the call to the internal subroutine. If it - * returns, then call __exit. - */ -1: - movl %esi,%esp - popl %eax - call *%eax - addl $4, %esp - - /* - * Exit system call - */ - pushl %eax - pushl $0 -#ifdef SYS_exit - leal SYS_exit, %eax -#else - leal SYS_sys_exit, %eax -#endif - KERNCALL - - /* - * Branch here if the thread creation fails: - */ -2: - PIC_PROLOGUE - jmp PIC_PLT(HIDENAME(cerror)) diff --git a/release/picobsd/mfs_tree/etc/login.conf b/release/picobsd/mfs_tree/etc/login.conf deleted file mode 100644 index 60e50f4c03bf2..0000000000000 --- a/release/picobsd/mfs_tree/etc/login.conf +++ /dev/null @@ -1,62 +0,0 @@ -# $FreeBSD$ - -# Authentication methods - -auth-defaults:\ - :auth=krb_skey_or_passwd,passwd,kerberos,skey: - -auth-root-defaults:\ - :auth-login=krb_skey_or_passwd,passwd,kerberos,skey:\ - :auth-rlogin=krb_or_skey,kerberos,skey: -auth-ftp-defaults:\ - :auth=skey_or_pwd,passwd,skey: -# Example defaults -default:\ - :cputime=infinity:\ - :datasize-cur=22M:\ - :stacksize-cur=8M:\ - :memorylocked-cur=10M:\ - :memoryuse-cur=30M:\ - :filesize=infinity:\ - :coredumpsize=0:\ - :maxproc-cur=64:\ - :openfiles-cur=64:\ - :priority=0:\ - :requirehome@:\ - :umask=022:\ - :tc=auth-defaults: - -# root - fallback for root logins -root:\ - :path=~/bin /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin:\ - :cputime=infinity:\ - :datasize=infinity:\ - :stacksize=infinity:\ - :memorylocked=infinity:\ - :memoryuse=infinity:\ - :filesize=infinity:\ - :coredumpsize=0:\ - :openfiles=infinity:\ - :maxproc=infinity:\ - :memoryuse-cur=32M:\ - :maxproc-cur=64:\ - :openfiles-cur=1024:\ - :priority=0:\ - :requirehome@:\ - :umask=022:\ - :tc=auth-root-defaults: -# Settings used by /etc/rc -daemon:\ - :coredumpsize@:\ - :coredumpsize-cur=0:\ - :datasize=infinity:\ - :datasize-cur@:\ - :maxproc=512:\ - :maxproc-cur@:\ - :memoryuse-cur=64M:\ - :memorylocked-cur=64M:\ - :openfiles=1024:\ - :openfiles-cur@:\ - :stacksize=16M:\ - :stacksize-cur@:\ - :tc=default: diff --git a/release/picobsd/mfs_tree/etc/rc b/release/picobsd/mfs_tree/etc/rc deleted file mode 100644 index c5838cce4d4f3..0000000000000 --- a/release/picobsd/mfs_tree/etc/rc +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# $FreeBSD$ -# WARNING !!! We overwrite this file during execution with a new rc file. -# Awful things happen if this file's size is > 1024B - -stty status '^T' -trap : 2 -trap : 3 - -HOME=/; export HOME -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin -export PATH - -trap "echo 'Reboot interrupted'; exit 1" 3 - -### Special setup for one floppy PICOBSD ### -set `df /` ; dev="/dev/$8" -echo "Reading /etc from ${dev}..." -mount -o rdonly ${dev} /mnt -cd /mnt/etc ; cp -Rp . /etc/ -cp -Rp /mnt/root / -cd /etc -#rm files to stop overwrite warning -rm rc login.conf -gzip -d *.gz -pwd_mkdb -p ./master.passwd -umount /mnt -echo "Ok. (Now you can remove ${dev} if you like)" -echo "" -. rc -exit 0 diff --git a/release/picobsd/mfs_tree/stand/update b/release/picobsd/mfs_tree/stand/update deleted file mode 100755 index 16cdfda49543f..0000000000000 --- a/release/picobsd/mfs_tree/stand/update +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# $FreeBSD$ -# script to edit and save some config file(s) -thefiles=$* -pwd=`pwd` -set `df /` ; dev="/dev/$8" -echo "Updating content on ${dev}: " -mount ${dev} /mnt -if [ "X$?" != "X0" ] ; then - echo "" - echo "Cannot mount ${dev} read-write!" - exit 1 -fi -if [ "$thefiles" = "" ] ; then - srcs=`ls /etc` - for i in $srcs ; do - if [ -f /mnt/etc/$i.gz ] ; then - echo -n "$i ..." - gzip < /etc/$i > /mnt/etc/$i.gz - fi - done -elif [ "$thefiles" = "passwd" ] ; then - ee /etc/master.passwd - pwd_mkdb master.passwd - gzip < /etc/master.passwd /mnt/etc/master.passwd.gz -else - for i in $thefiles; do - if [ -f $i ] ; then - ee $i - gzip < $i > /mnt/$i.gz - fi - done -fi -echo " Done." -echo -n "Updating kernel parameters... " -kget /mnt/boot/kernel.conf -umount /mnt -cd ${pwd} -echo " Done." diff --git a/release/scripts/driver-copy2.pl b/release/scripts/driver-copy2.pl deleted file mode 100644 index 541e3e093f32f..0000000000000 --- a/release/scripts/driver-copy2.pl +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -if ($#ARGV != 2) { - print STDERR "Usage: driver-copy.pl config_file src_ko_dir dst_ko_dir\n"; - exit 1; -} - -$config = $ARGV[0]; -$srcdir = $ARGV[1]; -$dstdir = $ARGV[2]; - -open CONFIG, "< $config" or die "Cannot open $config.\n"; -while (<CONFIG>) { - s/#.*$//; - if (/^(\w+)\s+(\w+)\s+(\d+)\s+(\w+)\s+\"(.*)\"\s*$/) { - $flp{$2} = $3; - $dsc{$2} = $5; - } -} -close CONFIG; - --d $srcdir or die "Cannot find $srcdir directory.\n"; --d $dstdir or die "Cannot find $dstdir directory.\n"; - -undef $/; - -foreach $f (sort keys %flp) { - if ($flp{$f} == 1) { - print STDERR "$f: There's nothing to do with driver on first floppy.\n"; - } - elsif ($flp{$f} == 2) { - $srcfile = $srcdir . '/' . $f . '.ko'; - $dstfile = $dstdir . '/' . $f . '.ko'; - $dscfile = $dstdir . '/' . $f . '.dsc'; - print STDERR "Copying $f.ko to $dstdir\n"; - open SRC, "< $srcfile" or die "Cannot open $srcfile\n"; - $file = <SRC>; - close SRC; - open DST, "> $dstfile" or die "Cannot open $dstfile\n"; - print DST $file; - close DST; - open DSC, "> $dscfile" or die "Cannot open $dscfile\n"; - print DSC $dsc{$f}; - close DSC; - } - elsif ($flp{$f} == 3) { - # third driver floppy (currently not implemnted yet...) - print STDERR "3rd driver floppy support has not implemented yet\n"; - exit 1; - } -} diff --git a/release/scripts/driver-remove.pl b/release/scripts/driver-remove.pl deleted file mode 100644 index 2ff5a8886d655..0000000000000 --- a/release/scripts/driver-remove.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) 2000 "HOSOKAWA, Tatsumi" <hosokawa@FreeBSD.org> -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -if ($#ARGV != 1) { - print STDERR "Usage: driver-remove.pl config_file BOOTMFS\n"; - exit 1; -} - -$config = $ARGV[0]; -$bootmfs = $ARGV[1]; - -open CONFIG, "< $config" or die "Cannot open $config.\n"; -while (<CONFIG>) { - s/#.*$//; - if (/^(\w+)\s+(\w+)\s+(\d+)\s+(\w+)\s+\"(.*)\"\s*$/) { - $drivers{$1} = 1; - } -} -close CONFIG; - -open BOOTMFS, "< $bootmfs" or die "Cannot open $bootmfs.\n"; -while (<BOOTMFS>) { - next if (/^device\s+(\w+)/ && $drivers{$1}); - push @bootmfs, $_; -} -close BOOTMFS; - -open BOOTMFS, "> $bootmfs" or die "Cannot open $bootmfs.\n"; -foreach (@bootmfs) { - print BOOTMFS; -} -close BOOTMFS; diff --git a/release/texts/README.TXT b/release/texts/README.TXT index b7588fbdc0d5e..644980b564cff 100644 --- a/release/texts/README.TXT +++ b/release/texts/README.TXT @@ -1,10 +1,10 @@ ----------------------------------------- - FreeBSD 4.1 --- SNAPSHOT Version , , + FreeBSD 4.2 --- RELEASE version , , ----------------------------------------- /( )` \ \___ / | -This is a snapshot release of the 4.1.1-stable /- _ `-/ ' +This is a full release of FreeBSD from the 4-stable /- _ `-/ ' (RELENG_4) branch which is currently moving (/\/ \ \ /\ -towards the release of 4.2. / / | ` \ +towards the release of 4.3. / / | ` \ O O ) / | `-^--'`< ' (_.) _ ) / @@ -19,22 +19,6 @@ ABOUT.TXT file for more information. \ / /\ ,' ,-----' | `--{__________) -TARGET AUDIENCE: ----------------- -This release is aimed primarily at early-adopters and the various -other folks who want to get involved with the ongoing development -of FreeBSD and are willing to deal with a few bumps in the road. -We do our best to ensure that each snapshot works as advertised, -but tracking -stable is a process which sometimes has its off -days. - -If you're both technically proficient and know exactly what you're -getting into here (e.g. you've been following -stable) then this -snapshot is probably for you. If you're more interested in doing -business with FreeBSD than in playing with the cutting edge of -technology, however, then 3.5 or one of the 4.x releases is almost -certainly your best bet. - Most information here is also available from the Documentation menu during installation. diff --git a/release/texts/alpha/RELNOTES.TXT b/release/texts/alpha/RELNOTES.TXT index 4cf41f504f682..5b095267ed16a 100644 --- a/release/texts/alpha/RELNOTES.TXT +++ b/release/texts/alpha/RELNOTES.TXT @@ -1,15 +1,15 @@ RELEASE NOTES - FreeBSD 4.2-BETA snapshot + FreeBSD 4.2-RELEASE Any installation failures or crashes should be reported by using the send-pr command (those preferring a Web-based interface can also see http://www.freebsd.org/send-pr.html). -For information about FreeBSD and the layout of the 4.2-BETA directory +For information about FreeBSD and the layout of the 4.2-RELEASE directory (especially if you're installing from floppies!), see ABOUT.TXT. For installation instructions, see the INSTALL.TXT and HARDWARE.TXT files. -For the latest of these 4-stable snapshots, you should always see: +For the latest 4-stable snapshot, you should always see: ftp://releng4.freebsd.org/pub/FreeBSD diff --git a/release/texts/i386/RELNOTES.TXT b/release/texts/i386/RELNOTES.TXT index 692c5265f66c6..0df0a82255d64 100644 --- a/release/texts/i386/RELNOTES.TXT +++ b/release/texts/i386/RELNOTES.TXT @@ -1,15 +1,15 @@ RELEASE NOTES - FreeBSD 4.2-BETA snapshot + FreeBSD 4.2-RELEASE Any installation failures or crashes should be reported by using the send-pr command (those preferring a Web-based interface can also see http://www.freebsd.org/send-pr.html). -For information about FreeBSD and the layout of the 4.2-BETA directory +For information about FreeBSD and the layout of the 4.2-RELEASE directory (especially if you're installing from floppies!), see ABOUT.TXT. For installation instructions, see the INSTALL.TXT and HARDWARE.TXT files. -For the latest of these 4-stable snapshots, you should always see: +For the latest 4-stable snapshots, you should always see: ftp://releng4.freebsd.org/pub/FreeBSD diff --git a/share/colldef/la_LN.US-ASCII.src b/share/colldef/la_LN.US-ASCII.src deleted file mode 100644 index df3c340887648..0000000000000 --- a/share/colldef/la_LN.US-ASCII.src +++ /dev/null @@ -1,6 +0,0 @@ -# ASCII -# -# $FreeBSD$ -# -order \ - \x00;...;\xff diff --git a/share/colldef/map.ISO8859-1 b/share/colldef/map.ISO8859-1 deleted file mode 100644 index ee5a557ca6278..0000000000000 --- a/share/colldef/map.ISO8859-1 +++ /dev/null @@ -1,174 +0,0 @@ -NU \x00 -SH \x01 -SX \x02 -EX \x03 -ET \x04 -EQ \x05 -AK \x06 -BL \x07 -BS \x08 -HT \x09 -LF \x0a -VT \x0b -FF \x0c -CR \x0d -SO \x0e -SI \x0f -DL \x10 -D1 \x11 -D2 \x12 -D3 \x13 -D4 \x14 -NK \x15 -SY \x16 -EB \x17 -CN \x18 -EM \x19 -SB \x1a -EC \x1b -FS \x1c -GS \x1d -RS \x1e -US \x1f -SP \x20 -Nb \x23 -DO \x24 -At \x40 -<( \x5b -// \x5c -)> \x5d -'> \x5e -'! \x60 -(! \x7b -!! \x7c -!) \x7d -'? \x7e -DT \x7f -PA \x80 -HO \x81 -BH \x82 -NH \x83 -IN \x84 -NL \x85 -SA \x86 -ES \x87 -HS \x88 -HJ \x89 -VS \x8a -PD \x8b -PU \x8c -RI \x8d -S2 \x8e -S3 \x8f -DC \x90 -P1 \x91 -P2 \x92 -TS \x93 -CC \x94 -MW \x95 -SG \x96 -EG \x97 -SS \x98 -GC \x99 -SC \x9a -CI \x9b -ST \x9c -OC \x9d -PM \x9e -AC \x9f -NS \xa0 -!I \xa1 -Ct \xa2 -Pd \xa3 -Cu \xa4 -Ye \xa5 -BB \xa6 -SE \xa7 -': \xa8 -Co \xa9 --a \xaa -<< \xab -NO \xac --- \xad -Rg \xae -'m \xaf -DG \xb0 -+- \xb1 -2S \xb2 -3S \xb3 -'' \xb4 -My \xb5 -PI \xb6 -.M \xb7 -', \xb8 -1S \xb9 --o \xba ->> \xbb -14 \xbc -12 \xbd -34 \xbe -?I \xbf -A! \xc0 -A' \xc1 -A> \xc2 -A? \xc3 -A: \xc4 -AA \xc5 -AE \xc6 -C, \xc7 -E! \xc8 -E' \xc9 -E> \xca -E: \xcb -I! \xcc -I' \xcd -I> \xce -I: \xcf -D- \xd0 -N? \xd1 -O! \xd2 -O' \xd3 -O> \xd4 -O? \xd5 -O: \xd6 -*X \xd7 -O/ \xd8 -U! \xd9 -U' \xda -U> \xdb -U: \xdc -Y' \xdd -TH \xde -ss \xdf -a! \xe0 -a' \xe1 -a> \xe2 -a? \xe3 -a: \xe4 -aa \xe5 -ae \xe6 -c, \xe7 -e! \xe8 -e' \xe9 -e> \xea -e: \xeb -i! \xec -i' \xed -i> \xee -i: \xef -d- \xf0 -n? \xf1 -o! \xf2 -o' \xf3 -o> \xf4 -o? \xf5 -o: \xf6 --: \xf7 -o/ \xf8 -u! \xf9 -u' \xfa -u> \xfb -u: \xfc -y' \xfd -th \xfe -y: \xff diff --git a/share/colldef/map.ISO8859-15 b/share/colldef/map.ISO8859-15 deleted file mode 100644 index 041dd5a1311b6..0000000000000 --- a/share/colldef/map.ISO8859-15 +++ /dev/null @@ -1,174 +0,0 @@ -NU \x00 -SH \x01 -SX \x02 -EX \x03 -ET \x04 -EQ \x05 -AK \x06 -BL \x07 -BS \x08 -HT \x09 -LF \x0a -VT \x0b -FF \x0c -CR \x0d -SO \x0e -SI \x0f -DL \x10 -D1 \x11 -D2 \x12 -D3 \x13 -D4 \x14 -NK \x15 -SY \x16 -EB \x17 -CN \x18 -EM \x19 -SB \x1a -EC \x1b -FS \x1c -GS \x1d -RS \x1e -US \x1f -SP \x20 -Nb \x23 -DO \x24 -At \x40 -<( \x5b -// \x5c -)> \x5d -'> \x5e -'! \x60 -(! \x7b -!! \x7c -!) \x7d -'? \x7e -DT \x7f -PA \x80 -HO \x81 -BH \x82 -NH \x83 -IN \x84 -NL \x85 -SA \x86 -ES \x87 -HS \x88 -HJ \x89 -VS \x8a -PD \x8b -PU \x8c -RI \x8d -S2 \x8e -S3 \x8f -DC \x90 -P1 \x91 -P2 \x92 -TS \x93 -CC \x94 -MW \x95 -SG \x96 -EG \x97 -SS \x98 -GC \x99 -SC \x9a -CI \x9b -ST \x9c -OC \x9d -PM \x9e -AC \x9f -NS \xa0 -!I \xa1 -Ct \xa2 -Pd \xa3 -Eu \xa4 -Ye \xa5 -S< \xa6 -SE \xa7 -s< \xa8 -Co \xa9 --a \xaa -<< \xab -NO \xac --- \xad -Rg \xae -'m \xaf -DG \xb0 -+- \xb1 -2S \xb2 -3S \xb3 -Z< \xb4 -My \xb5 -PI \xb6 -.M \xb7 -z< \xb8 -1S \xb9 --o \xba ->> \xbb -OE \xbc -oe \xbd -Y: \xbe -?I \xbf -A! \xc0 -A' \xc1 -A> \xc2 -A? \xc3 -A: \xc4 -AA \xc5 -AE \xc6 -C, \xc7 -E! \xc8 -E' \xc9 -E> \xca -E: \xcb -I! \xcc -I' \xcd -I> \xce -I: \xcf -D- \xd0 -N? \xd1 -O! \xd2 -O' \xd3 -O> \xd4 -O? \xd5 -O: \xd6 -*X \xd7 -O/ \xd8 -U! \xd9 -U' \xda -U> \xdb -U: \xdc -Y' \xdd -TH \xde -ss \xdf -a! \xe0 -a' \xe1 -a> \xe2 -a? \xe3 -a: \xe4 -aa \xe5 -ae \xe6 -c, \xe7 -e! \xe8 -e' \xe9 -e> \xea -e: \xeb -i! \xec -i' \xed -i> \xee -i: \xef -d- \xf0 -n? \xf1 -o! \xf2 -o' \xf3 -o> \xf4 -o? \xf5 -o: \xf6 --: \xf7 -o/ \xf8 -u! \xf9 -u' \xfa -u> \xfb -u: \xfc -y' \xfd -th \xfe -y: \xff diff --git a/share/colldef/map.ISO8859-2 b/share/colldef/map.ISO8859-2 deleted file mode 100644 index 75f2013571725..0000000000000 --- a/share/colldef/map.ISO8859-2 +++ /dev/null @@ -1,174 +0,0 @@ -NU \x00 -SH \x01 -SX \x02 -EX \x03 -ET \x04 -EQ \x05 -AK \x06 -BL \x07 -BS \x08 -HT \x09 -LF \x0a -VT \x0b -FF \x0c -CR \x0d -SO \x0e -SI \x0f -DL \x10 -D1 \x11 -D2 \x12 -D3 \x13 -D4 \x14 -NK \x15 -SY \x16 -EB \x17 -CN \x18 -EM \x19 -SB \x1a -EC \x1b -FS \x1c -GS \x1d -RS \x1e -US \x1f -SP \x20 -Nb \x23 -DO \x24 -At \x40 -<( \x5b -// \x5c -)> \x5d -'> \x5e -'! \x60 -(! \x7b -!! \x7c -!) \x7d -'? \x7e -DT \x7f -PA \x80 -HO \x81 -BH \x82 -NH \x83 -IN \x84 -NL \x85 -SA \x86 -ES \x87 -HS \x88 -HJ \x89 -VS \x8a -PD \x8b -PU \x8c -RI \x8d -S2 \x8e -S3 \x8f -DC \x90 -P1 \x91 -P2 \x92 -TS \x93 -CC \x94 -MW \x95 -SG \x96 -EG \x97 -SS \x98 -GC \x99 -SC \x9a -CI \x9b -ST \x9c -OC \x9d -PM \x9e -AC \x9f -NS \xa0 -A; \xa1 -'( \xa2 -L/ \xa3 -Cu \xa4 -L< \xa5 -S' \xa6 -SE \xa7 -': \xa8 -S< \xa9 -S, \xaa -T< \xab -Z' \xac --- \xad -Z< \xae -Z. \xaf -DG \xb0 -a; \xb1 -'; \xb2 -l/ \xb3 -'' \xb4 -l< \xb5 -s' \xb6 -'< \xb7 -', \xb8 -s< \xb9 -s, \xba -t< \xbb -z' \xbc -'" \xbd -z< \xbe -z. \xbf -R' \xc0 -A' \xc1 -A> \xc2 -A( \xc3 -A: \xc4 -L' \xc5 -C' \xc6 -C, \xc7 -C< \xc8 -E' \xc9 -E; \xca -E: \xcb -E< \xcc -I' \xcd -I> \xce -D< \xcf -D/ \xd0 -N' \xd1 -N< \xd2 -O' \xd3 -O> \xd4 -O" \xd5 -O: \xd6 -*X \xd7 -R< \xd8 -U0 \xd9 -U' \xda -U" \xdb -U: \xdc -Y' \xdd -T, \xde -ss \xdf -r' \xe0 -a' \xe1 -a> \xe2 -a( \xe3 -a: \xe4 -l' \xe5 -c' \xe6 -c, \xe7 -c< \xe8 -e' \xe9 -e; \xea -e: \xeb -e< \xec -i' \xed -i> \xee -d< \xef -d/ \xf0 -n' \xf1 -n< \xf2 -o' \xf3 -o> \xf4 -o" \xf5 -o: \xf6 --: \xf7 -r< \xf8 -u0 \xf9 -u' \xfa -u" \xfb -u: \xfc -y' \xfd -t, \xfe -'. \xff diff --git a/share/colldef/map.ISO8859-4 b/share/colldef/map.ISO8859-4 deleted file mode 100644 index 8bbeb57ea1dc2..0000000000000 --- a/share/colldef/map.ISO8859-4 +++ /dev/null @@ -1,175 +0,0 @@ -# $FreeBSD$ -NU \x00 -SH \x01 -SX \x02 -EX \x03 -ET \x04 -EQ \x05 -AK \x06 -BL \x07 -BS \x08 -HT \x09 -LF \x0a -VT \x0b -FF \x0c -CR \x0d -SO \x0e -SI \x0f -DL \x10 -D1 \x11 -D2 \x12 -D3 \x13 -D4 \x14 -NK \x15 -SY \x16 -EB \x17 -CN \x18 -EM \x19 -SB \x1a -EC \x1b -FS \x1c -GS \x1d -RS \x1e -US \x1f -SP \x20 -Nb \x23 -DO \x24 -At \x40 -<( \x5b -// \x5c -)> \x5d -'> \x5e -'! \x60 -(! \x7b -!! \x7c -!) \x7d -'? \x7e -DT \x7f -PA \x80 -HO \x81 -BH \x82 -NH \x83 -IN \x84 -NL \x85 -SA \x86 -ES \x87 -HS \x88 -HJ \x89 -VS \x8a -PD \x8b -PU \x8c -RI \x8d -S2 \x8e -S3 \x8f -DC \x90 -P1 \x91 -P2 \x92 -TS \x93 -CC \x94 -MW \x95 -SG \x96 -EG \x97 -SS \x98 -GC \x99 -SC \x9a -CI \x9b -ST \x9c -OC \x9d -PM \x9e -AC \x9f -NS \xa0 -A; \xa1 -kk \xa2 -R, \xa3 -Cu \xa4 -I? \xa5 -L, \xa6 -SE \xa7 -': \xa8 -S< \xa9 -E- \xaa -G, \xab -T/ \xac --- \xad -Z< \xae -'m \xaf -DG \xb0 -a; \xb1 -'; \xb2 -r, \xb3 -'' \xb4 -i? \xb5 -l, \xb6 -'< \xb7 -', \xb8 -s< \xb9 -e- \xba -g, \xbb -t/ \xbc -NG \xbd -z< \xbe -ng \xbf -A- \xc0 -A' \xc1 -A> \xc2 -A? \xc3 -A: \xc4 -AA \xc5 -AE \xc6 -I; \xc7 -C< \xc8 -E' \xc9 -E; \xca -E: \xcb -E. \xcc -I' \xcd -I> \xce -I- \xcf -D/ \xd0 -N, \xd1 -O- \xd2 -K, \xd3 -O> \xd4 -O? \xd5 -O: \xd6 -*X \xd7 -O/ \xd8 -U; \xd9 -U' \xda -U> \xdb -U: \xdc -U? \xdd -U- \xde -ss \xdf -a- \xe0 -a' \xe1 -a> \xe2 -a? \xe3 -a: \xe4 -aa \xe5 -ae \xe6 -i; \xe7 -c< \xe8 -e' \xe9 -e; \xea -e: \xeb -e. \xec -i' \xed -i> \xee -i- \xef -d/ \xf0 -n, \xf1 -o- \xf2 -k, \xf3 -o> \xf4 -o? \xf5 -o: \xf6 --: \xf7 -o/ \xf8 -u; \xf9 -u' \xfa -u> \xfb -u: \xfc -u? \xfd -u- \xfe -'. \xff diff --git a/share/colldef/map.ISO8859-5 b/share/colldef/map.ISO8859-5 deleted file mode 100644 index 230b559c659bb..0000000000000 --- a/share/colldef/map.ISO8859-5 +++ /dev/null @@ -1,175 +0,0 @@ -# $FreeBSD$ -NU \x00 -SH \x01 -SX \x02 -EX \x03 -ET \x04 -EQ \x05 -AK \x06 -BL \x07 -BS \x08 -HT \x09 -LF \x0a -VT \x0b -FF \x0c -CR \x0d -SO \x0e -SI \x0f -DL \x10 -D1 \x11 -D2 \x12 -D3 \x13 -D4 \x14 -NK \x15 -SY \x16 -EB \x17 -CN \x18 -EM \x19 -SB \x1a -EC \x1b -FS \x1c -GS \x1d -RS \x1e -US \x1f -SP \x20 -Nb \x23 -DO \x24 -At \x40 -<( \x5b -// \x5c -)> \x5d -'> \x5e -'! \x60 -(! \x7b -!! \x7c -!) \x7d -'? \x7e -DT \x7f -PA \x80 -HO \x81 -BH \x82 -NH \x83 -IN \x84 -NL \x85 -SA \x86 -ES \x87 -HS \x88 -HJ \x89 -VS \x8a -PD \x8b -PU \x8c -RI \x8d -S2 \x8e -S3 \x8f -DC \x90 -P1 \x91 -P2 \x92 -TS \x93 -CC \x94 -MW \x95 -SG \x96 -EG \x97 -SS \x98 -GC \x99 -SC \x9a -CI \x9b -ST \x9c -OC \x9d -PM \x9e -AC \x9f -NS \xa0 -IO \xa1 -D% \xa2 -G% \xa3 -IE \xa4 -DS \xa5 -II \xa6 -YI \xa7 -J% \xa8 -LJ \xa9 -NJ \xaa -Ts \xab -KJ \xac --- \xad -V% \xae -DZ \xaf -A= \xb0 -B= \xb1 -V= \xb2 -G= \xb3 -D= \xb4 -E= \xb5 -Z% \xb6 -Z= \xb7 -I= \xb8 -J= \xb9 -K= \xba -L= \xbb -M= \xbc -N= \xbd -O= \xbe -P= \xbf -R= \xc0 -S= \xc1 -T= \xc2 -U= \xc3 -F= \xc4 -H= \xc5 -C= \xc6 -C% \xc7 -S% \xc8 -Sc \xc9 -=" \xca -Y= \xcb -%" \xcc -JE \xcd -JU \xce -JA \xcf -a= \xd0 -b= \xd1 -v= \xd2 -g= \xd3 -d= \xd4 -e= \xd5 -z% \xd6 -z= \xd7 -i= \xd8 -j= \xd9 -k= \xda -l= \xdb -m= \xdc -n= \xdd -o= \xde -p= \xdf -r= \xe0 -s= \xe1 -t= \xe2 -u= \xe3 -f= \xe4 -h= \xe5 -c= \xe6 -c% \xe7 -s% \xe8 -sc \xe9 -=' \xea -y= \xeb -%' \xec -je \xed -ju \xee -ja \xef -N0 \xf0 -io \xf1 -d% \xf2 -g% \xf3 -ie \xf4 -ds \xf5 -ii \xf6 -yi \xf7 -j% \xf8 -lj \xf9 -nj \xfa -ts \xfb -kj \xfc -SE \xfd -v% \xfe -dz \xff diff --git a/share/colldef/ru_RU.CP866.src b/share/colldef/ru_RU.CP866.src deleted file mode 100644 index 2fc2d20835c30..0000000000000 --- a/share/colldef/ru_RU.CP866.src +++ /dev/null @@ -1,39 +0,0 @@ -# CP866 (backward compatible with ASCII) -# -# $FreeBSD$ -# -charmap map.CP866 -order \ -# controls - <NU>;...;<US>;\ -# - <NS>;<SP>;!;\";<Nb>;<DO>;\ - %;&;';\(;\);*;+;<-:>;\,;-;.;/;\ -# digits - 0;1;(2,<2S>);3;...;9;\ -# - :;\;;\<;<=<>;=;</>=>;>;?;<Co>;<At>;\ -# capital - A;...;Z;\ - <A=>;<B=>;<V=>;<G=>;<D=>;<E=>;<IO>;<Z%>;<Z=>;\ - <I=>;<J=>;<K=>;<L=>;<M=>;<N=>;<O=>;<P=>;<R=>;\ - <S=>;<T=>;<U=>;<F=>;<H=>;<C=>;<C%>;<S%>;<Sc>;\ - <=">;<Y=>;<%">;<JE>;<JU>;<JA>;\ -# - [;\\;];^;_;`;\ -# small - a;...;z;\ - <a=>;<b=>;<v=>;<g=>;<d=>;<e=>;<io>;<z%>;<z=>;\ - <i=>;<j=>;<k=>;<l=>;<m=>;<n=>;<o=>;<p=>;<r=>;\ - <s=>;<t=>;<u=>;<f=>;<h=>;<c=>;<c%>;<s%>;<sc>;\ - <='>;<y=>;<%'>;<je>;<ju>;<ja>;\ -# - \{;|;\};~;<.M>;<DG>;<DT>;\ -# - <sb>;<RT>;<?2>;<Iu>;<Il>;\ - <hh>;<HH>;<vv>;<VV>;<dr>;<dR>;<Dr>;<DR>;\ - <dl>;<dL>;<Dl>;<LD>;<ur>;<uR>;<Ur>;<UR>;\ - <ul>;<uL>;<Ul>;<UL>;<vr>;<vR>;<Vr>;<VR>;\ - <vl>;<vL>;<Vl>;<VL>;<dh>;<dH>;<Dh>;<DH>;\ - <uh>;<uH>;<Uh>;<UH>;<vh>;<vH>;<Vh>;<VH>;\ - <TB>;<LB>;<FB>;<lB>;<RB>;<.S>;<:S>;<?S>;<fS> diff --git a/share/colldef/ru_RU.KOI8-R.src b/share/colldef/ru_RU.KOI8-R.src deleted file mode 100644 index 3a67bc4e39fb1..0000000000000 --- a/share/colldef/ru_RU.KOI8-R.src +++ /dev/null @@ -1,39 +0,0 @@ -# koi8-r (backward compatible with ASCII) -# -# $FreeBSD$ -# -charmap map.KOI8-R -order \ -# controls - <NU>;...;<US>;\ -# - <NS>;<SP>;!;\";<Nb>;<DO>;\ - %;&;';\(;\);*;+;<-:>;\,;-;.;/;\ -# digits - 0;1;(2,<2S>);3;...;9;\ -# - :;\;;\<;<=<>;=;</>=>;>;?;<Co>;<At>;\ -# capital - A;...;Z;\ - <A=>;<B=>;<V=>;<G=>;<D=>;<E=>;<IO>;<Z%>;<Z=>;\ - <I=>;<J=>;<K=>;<L=>;<M=>;<N=>;<O=>;<P=>;<R=>;\ - <S=>;<T=>;<U=>;<F=>;<H=>;<C=>;<C%>;<S%>;<Sc>;\ - <=">;<Y=>;<%">;<JE>;<JU>;<JA>;\ -# - [;\\;];^;_;`;\ -# small - a;...;z;\ - <a=>;<b=>;<v=>;<g=>;<d=>;<e=>;<io>;<z%>;<z=>;\ - <i=>;<j=>;<k=>;<l=>;<m=>;<n=>;<o=>;<p=>;<r=>;\ - <s=>;<t=>;<u=>;<f=>;<h=>;<c=>;<c%>;<s%>;<sc>;\ - <='>;<y=>;<%'>;<je>;<ju>;<ja>;\ -# - \{;|;\};~;<.M>;<DG>;<DT>;\ -# - <sb>;<RT>;<?2>;<Iu>;<Il>;\ - <hh>;<HH>;<vv>;<VV>;<dr>;<dR>;<Dr>;<DR>;\ - <dl>;<dL>;<Dl>;<LD>;<ur>;<uR>;<Ur>;<UR>;\ - <ul>;<uL>;<Ul>;<UL>;<vr>;<vR>;<Vr>;<VR>;\ - <vl>;<vL>;<Vl>;<VL>;<dh>;<dH>;<Dh>;<DH>;\ - <uh>;<uH>;<Uh>;<UH>;<vh>;<vH>;<Vh>;<VH>;\ - <TB>;<LB>;<FB>;<lB>;<RB>;<.S>;<:S>;<?S>;<fS> diff --git a/sys/contrib/ipfilter/netinet/ip_auth.h b/sys/contrib/ipfilter/netinet/ip_auth.h deleted file mode 100644 index 2851c3dd8c36c..0000000000000 --- a/sys/contrib/ipfilter/netinet/ip_auth.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 1997-2000 by Darren Reed & Guido Van Rooij. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - * - * $Id: ip_auth.h,v 2.1 1999/08/04 17:29:54 darrenr Exp $ - * $FreeBSD$ - * - */ -#ifndef __IP_AUTH_H__ -#define __IP_AUTH_H__ - -#define FR_NUMAUTH 32 - -typedef struct frauth { - int fra_age; - int fra_index; - u_32_t fra_pass; - fr_info_t fra_info; -#if SOLARIS - queue_t *fra_q; -#endif -} frauth_t; - -typedef struct frauthent { - struct frentry fae_fr; - struct frauthent *fae_next; - u_long fae_age; -} frauthent_t; - -typedef struct fr_authstat { - U_QUAD_T fas_hits; - U_QUAD_T fas_miss; - u_long fas_nospace; - u_long fas_added; - u_long fas_sendfail; - u_long fas_sendok; - u_long fas_queok; - u_long fas_quefail; - u_long fas_expire; - frauthent_t *fas_faelist; -} fr_authstat_t; - - -extern frentry_t *ipauth; -extern struct fr_authstat fr_authstats; -extern int fr_defaultauthage; -extern int fr_authsize; -extern int fr_authused; -extern int fr_auth_lock; -extern u_32_t fr_checkauth __P((ip_t *, fr_info_t *)); -extern void fr_authexpire __P((void)); -extern void fr_authunload __P((void)); -extern mb_t *fr_authpkts[]; -extern int fr_newauth __P((mb_t *, fr_info_t *, ip_t *)); -#if defined(__NetBSD__) || defined(__OpenBSD__) -extern int fr_auth_ioctl __P((caddr_t, u_long, frentry_t *, frentry_t **)); -#else -extern int fr_auth_ioctl __P((caddr_t, int, frentry_t *, frentry_t **)); -#endif -#endif /* __IP_AUTH_H__ */ diff --git a/sys/contrib/ipfilter/netinet/ip_fil.c b/sys/contrib/ipfilter/netinet/ip_fil.c deleted file mode 100644 index ff80058e206c3..0000000000000 --- a/sys/contrib/ipfilter/netinet/ip_fil.c +++ /dev/null @@ -1,1763 +0,0 @@ -/* - * Copyright (C) 1993-2000 by Darren Reed. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - */ -#if !defined(lint) -static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-1995 Darren Reed"; -/*static const char rcsid[] = "@(#)$Id: ip_fil.c,v 2.42.2.14 2000/07/18 13:57:55 darrenr Exp $";*/ -static const char rcsid[] = "@(#)$FreeBSD$"; -#endif - -#ifndef SOLARIS -#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) -#endif - -#if defined(KERNEL) && !defined(_KERNEL) -# define _KERNEL -#endif -#if defined(_KERNEL) && defined(__FreeBSD_version) && \ - (__FreeBSD_version >= 400000) && !defined(KLD_MODULE) -#include "opt_inet6.h" -#endif -#include <sys/param.h> -#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) && \ - defined(_KERNEL) -# include "opt_ipfilter_log.h" -#endif -#if defined(__FreeBSD__) && !defined(__FreeBSD_version) -# if !defined(_KERNEL) || defined(IPFILTER_LKM) -# include <osreldate.h> -# endif -#endif -#ifndef _KERNEL -# include <stdio.h> -# include <string.h> -# include <stdlib.h> -# include <ctype.h> -# include <fcntl.h> -#endif -#include <sys/errno.h> -#include <sys/types.h> -#include <sys/file.h> -#if __FreeBSD_version >= 220000 && defined(_KERNEL) -# include <sys/fcntl.h> -# include <sys/filio.h> -#else -# include <sys/ioctl.h> -#endif -#include <sys/time.h> -#ifdef _KERNEL -# include <sys/systm.h> -#endif -#include <sys/uio.h> -#if !SOLARIS -# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000) -# include <sys/dirent.h> -# else -# include <sys/dir.h> -# endif -# include <sys/mbuf.h> -#else -# include <sys/filio.h> -#endif -#include <sys/protosw.h> -#include <sys/socket.h> - -#include <net/if.h> -#ifdef sun -# include <net/af.h> -#endif -#if __FreeBSD_version >= 300000 -# include <net/if_var.h> -# if defined(_KERNEL) && !defined(IPFILTER_LKM) -# include "opt_ipfilter.h" -# endif -#endif -#ifdef __sgi -#include <sys/debug.h> -# ifdef IFF_DRVRLOCK /* IRIX6 */ -#include <sys/hashing.h> -# endif -#endif -#include <net/route.h> -#include <netinet/in.h> -#if !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /* IRIX < 6 */ -# include <netinet/in_var.h> -#endif -#include <netinet/in_systm.h> -#include <netinet/ip.h> -#include <netinet/ip_var.h> -#include <netinet/tcp.h> -#include <netinet/udp.h> -#include <netinet/tcpip.h> -#include <netinet/ip_icmp.h> -#ifndef _KERNEL -# include <unistd.h> -# include <syslog.h> -#endif -#include "netinet/ip_compat.h" -#ifdef USE_INET6 -# include <netinet/icmp6.h> -#endif -#include "netinet/ip_fil.h" -#include "netinet/ip_proxy.h" -#include "netinet/ip_nat.h" -#include "netinet/ip_frag.h" -#include "netinet/ip_state.h" -#include "netinet/ip_auth.h" -#if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000) -# include <sys/malloc.h> -#endif -#ifndef MIN -# define MIN(a,b) (((a)<(b))?(a):(b)) -#endif -#if !SOLARIS && defined(_KERNEL) && !defined(__sgi) -# include <sys/kernel.h> -extern int ip_optcopy __P((struct ip *, struct ip *)); -#endif - -#include <machine/in_cksum.h> - -extern struct protosw inetsw[]; - -#ifndef _KERNEL -# include "ipt.h" -static struct ifnet **ifneta = NULL; -static int nifs = 0; -#else -# if (BSD < 199306) || defined(__sgi) -extern int tcp_ttl; -# endif -#endif - -int ipl_unreach = ICMP_UNREACH_FILTER; -u_long ipl_frouteok[2] = {0, 0}; - -static int frzerostats __P((caddr_t)); -#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003) -static int frrequest __P((int, u_long, caddr_t, int)); -#else -static int frrequest __P((int, int, caddr_t, int)); -#endif -#ifdef _KERNEL -static int (*fr_savep) __P((ip_t *, int, void *, int, struct mbuf **)); -static int send_ip __P((ip_t *, fr_info_t *, struct mbuf *)); -# ifdef __sgi -extern kmutex_t ipf_rw; -extern KRWLOCK_T ipf_mutex; -# endif -#else -int ipllog __P((void)); -void init_ifp __P((void)); -# ifdef __sgi -static int no_output __P((struct ifnet *, struct mbuf *, - struct sockaddr *)); -static int write_output __P((struct ifnet *, struct mbuf *, - struct sockaddr *)); -# else -static int no_output __P((struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *)); -static int write_output __P((struct ifnet *, struct mbuf *, - struct sockaddr *, struct rtentry *)); -# endif -#endif -int fr_running = 0; - -#if (__FreeBSD_version >= 300000) && defined(_KERNEL) -struct callout_handle ipfr_slowtimer_ch; -#endif -#if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000) -# include <sys/callout.h> -struct callout ipfr_slowtimer_ch; -#endif -#if defined(__sgi) && defined(_KERNEL) -toid_t ipfr_slowtimer_ch; -#endif - -#if (_BSDI_VERSION >= 199510) && defined(_KERNEL) -# include <sys/device.h> -# include <sys/conf.h> - -struct cfdriver iplcd = { - NULL, "ipl", NULL, NULL, DV_DULL, 0 -}; - -struct devsw iplsw = { - &iplcd, - iplopen, iplclose, iplread, nowrite, iplioctl, noselect, nommap, - nostrat, nodump, nopsize, 0, - nostop -}; -#endif /* _BSDI_VERSION >= 199510 && _KERNEL */ - -#if defined(__NetBSD__) || defined(__OpenBSD__) || \ - (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 500011) -# include <sys/conf.h> -# if defined(NETBSD_PF) -# include <net/pfil.h> -/* - * We provide the fr_checkp name just to minimize changes later. - */ -int (*fr_checkp) __P((ip_t *ip, int hlen, void *ifp, int out, mb_t **mp)); -# endif /* NETBSD_PF */ -#endif /* __NetBSD__ */ - -#ifdef _KERNEL -# if defined(IPFILTER_LKM) && !defined(__sgi) -int iplidentify(s) -char *s; -{ - if (strcmp(s, "ipl") == 0) - return 1; - return 0; -} -# endif /* IPFILTER_LKM */ - - -/* - * Try to detect the case when compiling for NetBSD with pseudo-device - */ -# if defined(__NetBSD__) && defined(PFIL_HOOKS) -void -ipfilterattach(count) -int count; -{ - if (iplattach() != 0) - printf("IP Filter failed to attach\n"); -} -# endif - - -int iplattach() -{ - char *defpass; - int s; -# if defined(__sgi) || (defined(NETBSD_PF) && \ - ((__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011))) - int error = 0; -# endif - - SPL_NET(s); - if (fr_running || (fr_checkp == fr_check)) { - printf("IP Filter: already initialized\n"); - SPL_X(s); - return EBUSY; - } - -# ifdef IPFILTER_LOG - ipflog_init(); -# endif - if (nat_init() == -1) - return -1; - if (fr_stateinit() == -1) - return -1; - if (appr_init() == -1) - return -1; - -# ifdef NETBSD_PF -# if (__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011) - error = pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT, - &inetsw[ip_protox[IPPROTO_IP]].pr_pfh); - if (error) { -# ifdef USE_INET6 - goto pfil_error; -# else - appr_unload(); - ip_natunload(); - fr_stateunload(); - return error; -# endif - } -# else - pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT); -# endif -# ifdef USE_INET6 - error = pfil_add_hook((void *)fr_check, PFIL_IN|PFIL_OUT, - &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh); - if (error) { - pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT, - &inetsw[ip_protox[IPPROTO_IP]].pr_pfh); -pfil_error: - appr_unload(); - ip_natunload(); - fr_stateunload(); - return error; - } -# endif -# endif - -# ifdef __sgi - error = ipfilter_sgi_attach(); - if (error) { - SPL_X(s); - appr_unload(); - ip_natunload(); - fr_stateunload(); - return error; - } -# endif - - bzero((char *)frcache, sizeof(frcache)); - fr_savep = fr_checkp; - fr_checkp = fr_check; - fr_running = 1; - - SPL_X(s); - if (fr_pass & FR_PASS) - defpass = "pass"; - else if (fr_pass & FR_BLOCK) - defpass = "block"; - else - defpass = "no-match -> block"; - - printf("%s initialized. Default = %s all, Logging = %s\n", - ipfilter_version, defpass, -# ifdef IPFILTER_LOG - "enabled"); -# else - "disabled"); -# endif -#ifdef _KERNEL -# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000) - callout_init(&ipfr_slowtimer_ch); - callout_reset(&ipfr_slowtimer_ch, hz / 2, ipfr_slowtimer, NULL); -# else -# if (__FreeBSD_version >= 300000) || defined(__sgi) - ipfr_slowtimer_ch = timeout(ipfr_slowtimer, NULL, hz/2); -# else - timeout(ipfr_slowtimer, NULL, hz/2); -# endif -# endif -#endif - return 0; -} - - -/* - * Disable the filter by removing the hooks from the IP input/output - * stream. - */ -int ipldetach() -{ - int s, i = FR_INQUE|FR_OUTQUE; -#if defined(NETBSD_PF) && \ - ((__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011)) - int error = 0; -#endif - -#ifdef _KERNEL -# if defined(__NetBSD__) && (__NetBSD_Version__ >= 104230000) - callout_stop(&ipfr_slowtimer_ch); -# else -# if (__FreeBSD_version >= 300000) - untimeout(ipfr_slowtimer, NULL, ipfr_slowtimer_ch); -# else -# ifdef __sgi - untimeout(ipfr_slowtimer_ch); -# else - untimeout(ipfr_slowtimer, NULL); -# endif -# endif /* FreeBSD */ -# endif /* NetBSD */ -#endif - SPL_NET(s); - if (!fr_running) - { - printf("IP Filter: not initialized\n"); - SPL_X(s); - return 0; - } - - printf("%s unloaded\n", ipfilter_version); - - fr_checkp = fr_savep; - i = frflush(IPL_LOGIPF, i); - fr_running = 0; - -# ifdef NETBSD_PF -# if ((__NetBSD_Version__ >= 104200000) || (__FreeBSD_version >= 500011)) - error = pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT, - &inetsw[ip_protox[IPPROTO_IP]].pr_pfh); - if (error) - return error; -# else - pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT); -# endif -# ifdef USE_INET6 - error = pfil_remove_hook((void *)fr_check, PFIL_IN|PFIL_OUT, - &inetsw[ip_protox[IPPROTO_IPV6]].pr_pfh); - if (error) - return error; -# endif -# endif - -# ifdef __sgi - ipfilter_sgi_detach(); -# endif - - appr_unload(); - ipfr_unload(); - ip_natunload(); - fr_stateunload(); - fr_authunload(); - - SPL_X(s); - return 0; -} -#endif /* _KERNEL */ - - -static int frzerostats(data) -caddr_t data; -{ - friostat_t fio; - int error; - - fr_getstat(&fio); - error = IWCOPYPTR((caddr_t)&fio, data, sizeof(fio)); - if (error) - return EFAULT; - - bzero((char *)frstats, sizeof(*frstats) * 2); - - return 0; -} - - -/* - * Filter ioctl interface. - */ -#ifdef __sgi -int IPL_EXTERN(ioctl)(dev_t dev, int cmd, caddr_t data, int mode -# ifdef _KERNEL - , cred_t *cp, int *rp -# endif -) -#else -int IPL_EXTERN(ioctl)(dev, cmd, data, mode -# if (defined(_KERNEL) && ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || \ - (NetBSD >= 199511) || (__FreeBSD_version >= 220000) || \ - defined(__OpenBSD__))) -, p) -struct proc *p; -# else -) -# endif -dev_t dev; -# if defined(__NetBSD__) || defined(__OpenBSD__) || \ - (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000) -u_long cmd; -# else -int cmd; -# endif -caddr_t data; -int mode; -#endif /* __sgi */ -{ -#if defined(_KERNEL) && !SOLARIS - int s; -#endif - int error = 0, unit = 0, tmp; - -#if (BSD >= 199306) && defined(_KERNEL) - if ((securelevel >= 2) && (mode & FWRITE)) - return EPERM; -#endif -#ifdef _KERNEL - unit = GET_MINOR(dev); - if ((IPL_LOGMAX < unit) || (unit < 0)) - return ENXIO; -#else - unit = dev; -#endif - - SPL_NET(s); - - if (unit == IPL_LOGNAT) { - if (fr_running) - error = nat_ioctl(data, cmd, mode); - else - error = EIO; - SPL_X(s); - return error; - } - if (unit == IPL_LOGSTATE) { - if (fr_running) - error = fr_state_ioctl(data, cmd, mode); - else - error = EIO; - SPL_X(s); - return error; - } - if (unit == IPL_LOGAUTH) { - if (!fr_running) - return EIO; - error = fr_auth_ioctl(data, cmd, NULL, NULL); - SPL_X(s); - return error; - } - - switch (cmd) { - case FIONREAD : -#ifdef IPFILTER_LOG - error = IWCOPY((caddr_t)&iplused[IPL_LOGIPF], (caddr_t)data, - sizeof(iplused[IPL_LOGIPF])); -#endif - break; -#if !defined(IPFILTER_LKM) && defined(_KERNEL) - case SIOCFRENB : - { - u_int enable; - - if (!(mode & FWRITE)) - error = EPERM; - else { - error = IRCOPY(data, (caddr_t)&enable, sizeof(enable)); - if (error) - break; - if (enable) - error = iplattach(); - else - error = ipldetach(); - } - break; - } -#endif - case SIOCSETFF : - if (!(mode & FWRITE)) - error = EPERM; - else - error = IRCOPY(data, (caddr_t)&fr_flags, - sizeof(fr_flags)); - break; - case SIOCGETFF : - error = IWCOPY((caddr_t)&fr_flags, data, sizeof(fr_flags)); - break; - case SIOCINAFR : - case SIOCRMAFR : - case SIOCADAFR : - case SIOCZRLST : - if (!(mode & FWRITE)) - error = EPERM; - else - error = frrequest(unit, cmd, data, fr_active); - break; - case SIOCINIFR : - case SIOCRMIFR : - case SIOCADIFR : - if (!(mode & FWRITE)) - error = EPERM; - else - error = frrequest(unit, cmd, data, 1 - fr_active); - break; - case SIOCSWAPA : - if (!(mode & FWRITE)) - error = EPERM; - else { - bzero((char *)frcache, sizeof(frcache[0]) * 2); - *(u_int *)data = fr_active; - fr_active = 1 - fr_active; - } - break; - case SIOCGETFS : - { - friostat_t fio; - - fr_getstat(&fio); - error = IWCOPYPTR((caddr_t)&fio, data, sizeof(fio)); - if (error) - return EFAULT; - break; - } - case SIOCFRZST : - if (!(mode & FWRITE)) - error = EPERM; - else - error = frzerostats(data); - break; - case SIOCIPFFL : - if (!(mode & FWRITE)) - error = EPERM; - else { - error = IRCOPY(data, (caddr_t)&tmp, sizeof(tmp)); - if (!error) { - tmp = frflush(unit, tmp); - error = IWCOPY((caddr_t)&tmp, data, - sizeof(tmp)); - } - } - break; - case SIOCSTLCK : - error = IRCOPY(data, (caddr_t)&tmp, sizeof(tmp)); - if (!error) { - fr_state_lock = tmp; - fr_nat_lock = tmp; - fr_frag_lock = tmp; - fr_auth_lock = tmp; - } else - error = EFAULT; - break; -#ifdef IPFILTER_LOG - case SIOCIPFFB : - if (!(mode & FWRITE)) - error = EPERM; - else - *(int *)data = ipflog_clear(unit); - break; -#endif /* IPFILTER_LOG */ - case SIOCGFRST : - error = IWCOPYPTR((caddr_t)ipfr_fragstats(), data, - sizeof(ipfrstat_t)); - if (error) - return EFAULT; - break; - case SIOCAUTHW : - case SIOCAUTHR : - if (!(mode & FWRITE)) { - error = EPERM; - break; - } - case SIOCFRSYN : - if (!(mode & FWRITE)) - error = EPERM; - else { -#if defined(_KERNEL) && defined(__sgi) - ipfsync(); -#endif - frsync(); - } - break; - default : - error = EINVAL; - break; - } - SPL_X(s); - return error; -} - - -void fr_forgetifp(ifp) -void *ifp; -{ - register frentry_t *f; - - WRITE_ENTER(&ipf_mutex); - for (f = ipacct[0][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; - for (f = ipacct[1][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; - for (f = ipfilter[0][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; - for (f = ipfilter[1][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; -#ifdef USE_INET6 - for (f = ipacct6[0][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; - for (f = ipacct6[1][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; - for (f = ipfilter6[0][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; - for (f = ipfilter6[1][fr_active]; (f != NULL); f = f->fr_next) - if (f->fr_ifa == ifp) - f->fr_ifa = (void *)-1; -#endif - RWLOCK_EXIT(&ipf_mutex); - ip_natsync(ifp); -} - - -static int frrequest(unit, req, data, set) -int unit; -#if defined(__NetBSD__) || defined(__OpenBSD__) || (__FreeBSD_version >= 300003) -u_long req; -#else -int req; -#endif -int set; -caddr_t data; -{ - register frentry_t *fp, *f, **fprev; - register frentry_t **ftail; - frentry_t frd; - frdest_t *fdp; - frgroup_t *fg = NULL; - u_int *p, *pp; - int error = 0, in; - u_int group; - - fp = &frd; - error = IRCOPYPTR(data, (caddr_t)fp, sizeof(*fp)); - if (error) - return EFAULT; - fp->fr_ref = 0; -#if (BSD >= 199306) && defined(_KERNEL) - if ((securelevel > 0) && (fp->fr_func != NULL)) - return EPERM; -#endif - - /* - * Check that the group number does exist and that if a head group - * has been specified, doesn't exist. - */ - if ((req != SIOCZRLST) && fp->fr_grhead && - fr_findgroup((u_int)fp->fr_grhead, fp->fr_flags, unit, set, NULL)) - return EEXIST; - if ((req != SIOCZRLST) && fp->fr_group && - !fr_findgroup((u_int)fp->fr_group, fp->fr_flags, unit, set, NULL)) - return ESRCH; - - in = (fp->fr_flags & FR_INQUE) ? 0 : 1; - - if (unit == IPL_LOGAUTH) - ftail = fprev = &ipauth; - else if ((fp->fr_flags & FR_ACCOUNT) && (fp->fr_v == 4)) - ftail = fprev = &ipacct[in][set]; - else if ((fp->fr_flags & (FR_OUTQUE|FR_INQUE)) && (fp->fr_v == 4)) - ftail = fprev = &ipfilter[in][set]; -#ifdef USE_INET6 - else if ((fp->fr_flags & FR_ACCOUNT) && (fp->fr_v == 6)) - ftail = fprev = &ipacct6[in][set]; - else if ((fp->fr_flags & (FR_OUTQUE|FR_INQUE)) && (fp->fr_v == 6)) - ftail = fprev = &ipfilter6[in][set]; -#endif - else - return ESRCH; - - if ((group = fp->fr_group)) { - if (!(fg = fr_findgroup(group, fp->fr_flags, unit, set, NULL))) - return ESRCH; - ftail = fprev = fg->fg_start; - } - - bzero((char *)frcache, sizeof(frcache[0]) * 2); - - if (*fp->fr_ifname) { - fp->fr_ifa = GETUNIT(fp->fr_ifname, fp->fr_v); - if (!fp->fr_ifa) - fp->fr_ifa = (void *)-1; - } -#if BSD >= 199306 - if (*fp->fr_oifname) { - fp->fr_oifa = GETUNIT(fp->fr_oifname, fp->fr_v); - if (!fp->fr_oifa) - fp->fr_oifa = (void *)-1; - } -#endif - - fdp = &fp->fr_dif; - fp->fr_flags &= ~FR_DUP; - if (*fdp->fd_ifname) { - fdp->fd_ifp = GETUNIT(fdp->fd_ifname, fp->fr_v); - if (!fdp->fd_ifp) - fdp->fd_ifp = (struct ifnet *)-1; - else - fp->fr_flags |= FR_DUP; - } - - fdp = &fp->fr_tif; - if (*fdp->fd_ifname) { - fdp->fd_ifp = GETUNIT(fdp->fd_ifname, fp->fr_v); - if (!fdp->fd_ifp) - fdp->fd_ifp = (struct ifnet *)-1; - } - - /* - * Look for a matching filter rule, but don't include the next or - * interface pointer in the comparison (fr_next, fr_ifa). - */ - for (fp->fr_cksum = 0, p = (u_int *)&fp->fr_ip, pp = &fp->fr_cksum; - p < pp; p++) - fp->fr_cksum += *p; - - for (; (f = *ftail); ftail = &f->fr_next) - if ((fp->fr_cksum == f->fr_cksum) && - !bcmp((char *)&f->fr_ip, (char *)&fp->fr_ip, FR_CMPSIZ)) - break; - - /* - * If zero'ing statistics, copy current to caller and zero. - */ - if (req == SIOCZRLST) { - if (!f) - return ESRCH; - error = IWCOPYPTR((caddr_t)f, data, sizeof(*f)); - if (error) - return EFAULT; - f->fr_hits = 0; - f->fr_bytes = 0; - return 0; - } - - if (!f) { - if (req != SIOCINAFR && req != SIOCINIFR) - while ((f = *ftail)) - ftail = &f->fr_next; - else { - if (fp->fr_hits) { - ftail = fprev; - while (--fp->fr_hits && (f = *ftail)) - ftail = &f->fr_next; - } - f = NULL; - } - } - - if (req == SIOCRMAFR || req == SIOCRMIFR) { - if (!f) - error = ESRCH; - else { - /* - * Only return EBUSY if there is a group list, else - * it's probably just state information referencing - * the rule. - */ - if ((f->fr_ref > 1) && f->fr_grp) - return EBUSY; - if (fg && fg->fg_head) - fg->fg_head->fr_ref--; - if (unit == IPL_LOGAUTH) - return fr_auth_ioctl(data, req, f, ftail); - if (f->fr_grhead) - fr_delgroup((u_int)f->fr_grhead, fp->fr_flags, - unit, set); - fixskip(fprev, f, -1); - *ftail = f->fr_next; - f->fr_next = NULL; - if (f->fr_ref == 0) - KFREE(f); - } - } else { - if (f) - error = EEXIST; - else { - if (unit == IPL_LOGAUTH) - return fr_auth_ioctl(data, req, fp, ftail); - KMALLOC(f, frentry_t *); - if (f != NULL) { - if (fg && fg->fg_head) - fg->fg_head->fr_ref++; - bcopy((char *)fp, (char *)f, sizeof(*f)); - f->fr_ref = 1; - f->fr_hits = 0; - f->fr_next = *ftail; - *ftail = f; - if (req == SIOCINIFR || req == SIOCINAFR) - fixskip(fprev, f, 1); - f->fr_grp = NULL; - if ((group = f->fr_grhead)) - fg = fr_addgroup(group, f, unit, set); - } else - error = ENOMEM; - } - } - return (error); -} - - -#ifdef _KERNEL -/* - * routines below for saving IP headers to buffer - */ -# ifdef __sgi -# ifdef _KERNEL -int IPL_EXTERN(open)(dev_t *pdev, int flags, int devtype, cred_t *cp) -# else -int IPL_EXTERN(open)(dev_t dev, int flags) -# endif -# else -int IPL_EXTERN(open)(dev, flags -# if ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \ - (__FreeBSD_version >= 220000) || defined(__OpenBSD__)) && defined(_KERNEL) -, devtype, p) -int devtype; -struct proc *p; -# else -) -# endif -dev_t dev; -int flags; -# endif /* __sgi */ -{ -# if defined(__sgi) && defined(_KERNEL) - u_int min = geteminor(*pdev); -# else - u_int min = GET_MINOR(dev); -# endif - - if (IPL_LOGMAX < min) - min = ENXIO; - else - min = 0; - return min; -} - - -# ifdef __sgi -int IPL_EXTERN(close)(dev_t dev, int flags, int devtype, cred_t *cp) -#else -int IPL_EXTERN(close)(dev, flags -# if ((_BSDI_VERSION >= 199510) || (BSD >= 199506) || (NetBSD >= 199511) || \ - (__FreeBSD_version >= 220000) || defined(__OpenBSD__)) && defined(_KERNEL) -, devtype, p) -int devtype; -struct proc *p; -# else -) -# endif -dev_t dev; -int flags; -# endif /* __sgi */ -{ - u_int min = GET_MINOR(dev); - - if (IPL_LOGMAX < min) - min = ENXIO; - else - min = 0; - return min; -} - -/* - * iplread/ipllog - * both of these must operate with at least splnet() lest they be - * called during packet processing and cause an inconsistancy to appear in - * the filter lists. - */ -# ifdef __sgi -int IPL_EXTERN(read)(dev_t dev, uio_t *uio, cred_t *crp) -# else -# if BSD >= 199306 -int IPL_EXTERN(read)(dev, uio, ioflag) -int ioflag; -# else -int IPL_EXTERN(read)(dev, uio) -# endif -dev_t dev; -register struct uio *uio; -# endif /* __sgi */ -{ -# ifdef IPFILTER_LOG - return ipflog_read(GET_MINOR(dev), uio); -# else - return ENXIO; -# endif -} - - -/* - * send_reset - this could conceivably be a call to tcp_respond(), but that - * requires a large amount of setting up and isn't any more efficient. - */ -int send_reset(oip, fin) -struct ip *oip; -fr_info_t *fin; -{ - struct tcphdr *tcp, *tcp2; - int tlen = 0, hlen; - struct mbuf *m; -#ifdef USE_INET6 - ip6_t *ip6, *oip6 = (ip6_t *)oip; -#endif - ip_t *ip; - - tcp = (struct tcphdr *)fin->fin_dp; - if (tcp->th_flags & TH_RST) - return -1; /* feedback loop */ -# if (BSD < 199306) || defined(__sgi) - m = m_get(M_DONTWAIT, MT_HEADER); -# else - m = m_gethdr(M_DONTWAIT, MT_HEADER); -# endif - if (m == NULL) - return ENOBUFS; - if (m == NULL) - return -1; - - tlen = oip->ip_len - fin->fin_hlen - (tcp->th_off << 2) + - ((tcp->th_flags & TH_SYN) ? 1 : 0) + - ((tcp->th_flags & TH_FIN) ? 1 : 0); - -#ifdef USE_INET6 - hlen = (fin->fin_v == 6) ? sizeof(ip6_t) : sizeof(ip_t); -#else - hlen = sizeof(ip_t); -#endif - m->m_len = sizeof(*tcp2) + hlen; -# if BSD >= 199306 - m->m_data += max_linkhdr; - m->m_pkthdr.len = m->m_len; - m->m_pkthdr.rcvif = (struct ifnet *)0; -# endif - ip = mtod(m, struct ip *); -# ifdef USE_INET6 - ip6 = (ip6_t *)ip; -# endif - bzero((char *)ip, sizeof(*tcp2) + hlen); - tcp2 = (struct tcphdr *)((char *)ip + hlen); - - tcp2->th_sport = tcp->th_dport; - tcp2->th_dport = tcp->th_sport; - if (tcp->th_flags & TH_ACK) { - tcp2->th_seq = tcp->th_ack; - tcp2->th_flags = TH_RST; - } else { - tcp2->th_ack = ntohl(tcp->th_seq); - tcp2->th_ack += tlen; - tcp2->th_ack = htonl(tcp2->th_ack); - tcp2->th_flags = TH_RST|TH_ACK; - } - tcp2->th_off = sizeof(*tcp2) >> 2; -# ifdef USE_INET6 - if (fin->fin_v == 6) { - ip6->ip6_plen = htons(sizeof(struct tcphdr)); - ip6->ip6_nxt = IPPROTO_TCP; - ip6->ip6_src = oip6->ip6_dst; - ip6->ip6_dst = oip6->ip6_src; - tcp2->th_sum = in6_cksum(m, IPPROTO_TCP, - sizeof(*ip6), sizeof(*tcp2)); - return send_ip(oip, fin, m); - } -# endif - ip->ip_p = IPPROTO_TCP; - ip->ip_len = htons(sizeof(struct tcphdr)); - ip->ip_src.s_addr = oip->ip_dst.s_addr; - ip->ip_dst.s_addr = oip->ip_src.s_addr; - tcp2->th_sum = in_cksum(m, hlen + sizeof(*tcp2)); - ip->ip_len = hlen + sizeof(*tcp2); - return send_ip(oip, fin, m); -} - - -static int send_ip(oip, fin, m) -ip_t *oip; -fr_info_t *fin; -struct mbuf *m; -{ - ip_t *ip; - - ip = mtod(m, ip_t *); - - ip->ip_v = fin->fin_v; - if (ip->ip_v == 4) { - ip->ip_hl = (sizeof(*oip) >> 2); - ip->ip_v = IPVERSION; - ip->ip_tos = oip->ip_tos; - ip->ip_id = oip->ip_id; - ip->ip_off = 0; -# if (BSD < 199306) || defined(__sgi) - ip->ip_ttl = tcp_ttl; -# else - ip->ip_ttl = ip_defttl; -# endif - ip->ip_sum = 0; - } -# ifdef USE_INET6 - else if (ip->ip_v == 6) { - ip6_t *ip6 = (ip6_t *)ip; - - ip6->ip6_hlim = 127; - - return ip6_output(m, NULL, NULL, 0, NULL, NULL); - } -# endif -# ifdef IPSEC - m->m_pkthdr.rcvif = NULL; -# endif - return ipfr_fastroute(m, fin, NULL); -} - - -int send_icmp_err(oip, type, fin, dst) -ip_t *oip; -int type; -fr_info_t *fin; -int dst; -{ - int err, hlen = 0, xtra = 0, iclen, ohlen = 0, avail, code; - struct in_addr dst4; - struct icmp *icmp; - struct mbuf *m; - void *ifp; -#ifdef USE_INET6 - ip6_t *ip6, *oip6 = (ip6_t *)oip; - struct in6_addr dst6; -#endif - ip_t *ip; - - if ((type < 0) || (type > ICMP_MAXTYPE)) - return -1; - - code = fin->fin_icode; -#ifdef USE_INET6 - if ((code < 0) || (code > sizeof(icmptoicmp6unreach)/sizeof(int))) - return -1; -#endif - - avail = 0; - m = NULL; - ifp = fin->fin_ifp; - if (fin->fin_v == 4) { - if ((oip->ip_p == IPPROTO_ICMP) && - !(fin->fin_fi.fi_fl & FI_SHORT)) - switch (ntohs(fin->fin_data[0]) >> 8) - { - case ICMP_ECHO : - case ICMP_TSTAMP : - case ICMP_IREQ : - case ICMP_MASKREQ : - break; - default : - return 0; - } - -# if (BSD < 199306) || defined(__sgi) - avail = MLEN; - m = m_get(M_DONTWAIT, MT_HEADER); -# else - avail = MHLEN; - m = m_gethdr(M_DONTWAIT, MT_HEADER); -# endif - if (m == NULL) - return ENOBUFS; - - if (dst == 0) { - if (fr_ifpaddr(4, ifp, &dst4) == -1) - return -1; - } else - dst4.s_addr = oip->ip_dst.s_addr; - - hlen = sizeof(ip_t); - ohlen = oip->ip_hl << 2; - xtra = 8; - } - -#ifdef USE_INET6 - else if (fin->fin_v == 6) { - hlen = sizeof(ip6_t); - ohlen = sizeof(ip6_t); - type = icmptoicmp6types[type]; - if (type == ICMP6_DST_UNREACH) - code = icmptoicmp6unreach[code]; - - MGETHDR(m, M_DONTWAIT, MT_HEADER); - if (!m) - return ENOBUFS; - - MCLGET(m, M_DONTWAIT); - if ((m->m_flags & M_EXT) == 0) { - m_freem(m); - return ENOBUFS; - } -# ifdef M_TRAILINGSPACE - m->m_len = 0; - avail = M_TRAILINGSPACE(m); -# else - avail = MCLBYTES; -# endif - xtra = MIN(ntohs(oip6->ip6_plen) + sizeof(ip6_t), - avail - hlen - sizeof(*icmp) - max_linkhdr); - if (dst == 0) { - if (fr_ifpaddr(6, ifp, (struct in_addr *)&dst6) == -1) - return -1; - } else - dst6 = oip6->ip6_dst; - } -#endif - - iclen = hlen + sizeof(*icmp); -# if BSD >= 199306 - avail -= (max_linkhdr + iclen); - m->m_data += max_linkhdr; - m->m_pkthdr.rcvif = (struct ifnet *)0; - if (xtra > avail) - xtra = avail; - iclen += xtra; - m->m_pkthdr.len = iclen; -#else - avail -= (m->m_off + iclen); - if (xtra > avail) - xtra = avail; - iclen += xtra; -#endif - m->m_len = iclen; - ip = mtod(m, ip_t *); - icmp = (struct icmp *)((char *)ip + hlen); - bzero((char *)ip, iclen); - - icmp->icmp_type = type; - icmp->icmp_code = fin->fin_icode; - icmp->icmp_cksum = 0; -#ifdef icmp_nextmtu - if (type == ICMP_UNREACH && - fin->fin_icode == ICMP_UNREACH_NEEDFRAG && ifp) - icmp->icmp_nextmtu = htons(((struct ifnet *) ifp)->if_mtu); -#endif - - if (avail) { - bcopy((char *)oip, (char *)&icmp->icmp_ip, MIN(ohlen, avail)); - avail -= MIN(ohlen, avail); - } - -#ifdef USE_INET6 - ip6 = (ip6_t *)ip; - if (fin->fin_v == 6) { - ip6->ip6_flow = 0; - ip6->ip6_plen = htons(iclen - hlen); - ip6->ip6_nxt = IPPROTO_ICMPV6; - ip6->ip6_hlim = 0; - ip6->ip6_src = dst6; - ip6->ip6_dst = oip6->ip6_src; - if (avail) - bcopy((char *)oip + ohlen, - (char *)&icmp->icmp_ip + ohlen, avail); - icmp->icmp_cksum = in6_cksum(m, IPPROTO_ICMPV6, - sizeof(*ip6), iclen - hlen); - } else -#endif - { - ip->ip_src.s_addr = dst4.s_addr; - ip->ip_dst.s_addr = oip->ip_src.s_addr; - - if (avail > 8) - avail = 8; - if (avail) - bcopy((char *)oip + ohlen, - (char *)&icmp->icmp_ip + ohlen, avail); - icmp->icmp_cksum = ipf_cksum((u_short *)icmp, - sizeof(*icmp) + 8); - ip->ip_len = iclen; - ip->ip_p = IPPROTO_ICMP; - } - err = send_ip(oip, fin, m); - return err; -} - - -# if !defined(IPFILTER_LKM) && (__FreeBSD_version < 300000) && !defined(__sgi) -# if (BSD < 199306) -int iplinit __P((void)); - -int -# else -void iplinit __P((void)); - -void -# endif -iplinit() -{ - if (iplattach() != 0) - printf("IP Filter failed to attach\n"); - ip_init(); -} -# endif /* ! __NetBSD__ */ - - -size_t mbufchainlen(m0) -register struct mbuf *m0; -{ - register size_t len = 0; - - for (; m0; m0 = m0->m_next) - len += m0->m_len; - return len; -} - - -int ipfr_fastroute(m0, fin, fdp) -struct mbuf *m0; -fr_info_t *fin; -frdest_t *fdp; -{ - register struct ip *ip, *mhip; - register struct mbuf *m = m0; - register struct route *ro; - int len, off, error = 0, hlen, code; - struct ifnet *ifp, *sifp; - struct sockaddr_in *dst; - struct route iproute; - frentry_t *fr; - - hlen = fin->fin_hlen; - ip = mtod(m0, struct ip *); - -#ifdef USE_INET6 - if (ip->ip_v == 6) { - /* - * currently "to <if>" and "to <if>:ip#" are not supported - * for IPv6 - */ - return ip6_output(m0, NULL, NULL, 0, NULL, NULL); - } -#endif - /* - * Route packet. - */ - ro = &iproute; - bzero((caddr_t)ro, sizeof (*ro)); - dst = (struct sockaddr_in *)&ro->ro_dst; - dst->sin_family = AF_INET; - - fr = fin->fin_fr; - if (fdp) - ifp = fdp->fd_ifp; - else { - ifp = fin->fin_ifp; - dst->sin_addr = ip->ip_dst; - } - - /* - * In case we're here due to "to <if>" being used with "keep state", - * check that we're going in the correct direction. - */ - if ((fr != NULL) && (fin->fin_rev != 0)) { - if ((ifp != NULL) && (fdp == &fr->fr_tif)) - return -1; - dst->sin_addr = ip->ip_dst; - } else if (fdp) - dst->sin_addr = fdp->fd_ip.s_addr ? fdp->fd_ip : ip->ip_dst; - -# if BSD >= 199306 - dst->sin_len = sizeof(*dst); -# endif -# if (BSD >= 199306) && !defined(__NetBSD__) && !defined(__bsdi__) && \ - !defined(__OpenBSD__) -# ifdef RTF_CLONING - rtalloc_ign(ro, RTF_CLONING); -# else - rtalloc_ign(ro, RTF_PRCLONING); -# endif -# else - rtalloc(ro); -# endif - if (!ifp) { - if (!fr || !(fr->fr_flags & FR_FASTROUTE)) { - error = -2; - goto bad; - } - if (ro->ro_rt == 0 || (ifp = ro->ro_rt->rt_ifp) == 0) { - if (in_localaddr(ip->ip_dst)) - error = EHOSTUNREACH; - else - error = ENETUNREACH; - goto bad; - } - if (ro->ro_rt->rt_flags & RTF_GATEWAY) - dst = (struct sockaddr_in *)&ro->ro_rt->rt_gateway; - } - if (ro->ro_rt) - ro->ro_rt->rt_use++; - - /* - * For input packets which are being "fastrouted", they won't - * go back through output filtering and miss their chance to get - * NAT'd and counted. - */ - fin->fin_ifp = ifp; - if (fin->fin_out == 0) { - fin->fin_out = 1; - if ((fin->fin_fr = ipacct[1][fr_active]) && - (fr_scanlist(FR_NOMATCH, ip, fin, m) & FR_ACCOUNT)) { - ATOMIC_INCL(frstats[1].fr_acct); - } - fin->fin_fr = NULL; - if (!fr || !(fr->fr_flags & FR_RETMASK)) - (void) fr_checkstate(ip, fin); - (void) ip_natout(ip, fin); - } else - ip->ip_sum = 0; - /* - * If small enough for interface, can just send directly. - */ - if (ip->ip_len <= ifp->if_mtu) { -# if BSD >= 199306 - int i = 0; - - if ((m->m_flags & M_EXT) && MEXT_IS_REF(m)) - i = 1; -# endif -# ifndef sparc -# ifndef __FreeBSD__ - ip->ip_id = htons(ip->ip_id); -# endif - ip->ip_len = htons(ip->ip_len); - ip->ip_off = htons(ip->ip_off); -# endif - if (!ip->ip_sum) - ip->ip_sum = in_cksum(m, hlen); -# if BSD >= 199306 - error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst, - ro->ro_rt); - if (i) { -# ifndef __FreeBSD__ - ip->ip_id = ntohs(ip->ip_id); -# endif - ip->ip_len = ntohs(ip->ip_len); - ip->ip_off = ntohs(ip->ip_off); - } -# else - error = (*ifp->if_output)(ifp, m, (struct sockaddr *)dst); -# endif - goto done; - } - /* - * Too large for interface; fragment if possible. - * Must be able to put at least 8 bytes per fragment. - */ - if (ip->ip_off & IP_DF) { - error = EMSGSIZE; - goto bad; - } - len = (ifp->if_mtu - hlen) &~ 7; - if (len < 8) { - error = EMSGSIZE; - goto bad; - } - - { - int mhlen, firstlen = len; - struct mbuf **mnext = &m->m_act; - - /* - * Loop through length of segment after first fragment, - * make new header and copy data of each part and link onto chain. - */ - m0 = m; - mhlen = sizeof (struct ip); - for (off = hlen + len; off < ip->ip_len; off += len) { -# ifdef MGETHDR - MGETHDR(m, M_DONTWAIT, MT_HEADER); -# else - MGET(m, M_DONTWAIT, MT_HEADER); -# endif - if (m == 0) { - error = ENOBUFS; - goto bad; - } -# if BSD >= 199306 - m->m_data += max_linkhdr; -# else - m->m_off = MMAXOFF - hlen; -# endif - mhip = mtod(m, struct ip *); - bcopy((char *)ip, (char *)mhip, sizeof(*ip)); - if (hlen > sizeof (struct ip)) { - mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip); - mhip->ip_hl = mhlen >> 2; - } - m->m_len = mhlen; - mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF); - if (ip->ip_off & IP_MF) - mhip->ip_off |= IP_MF; - if (off + len >= ip->ip_len) - len = ip->ip_len - off; - else - mhip->ip_off |= IP_MF; - mhip->ip_len = htons((u_short)(len + mhlen)); - m->m_next = m_copy(m0, off, len); - if (m->m_next == 0) { - error = ENOBUFS; /* ??? */ - goto sendorfree; - } -# if BSD >= 199306 - m->m_pkthdr.len = mhlen + len; - m->m_pkthdr.rcvif = NULL; -# endif -# ifndef sparc - mhip->ip_off = htons((u_short)mhip->ip_off); -# endif - mhip->ip_sum = 0; - mhip->ip_sum = in_cksum(m, mhlen); - *mnext = m; - mnext = &m->m_act; - } - /* - * Update first fragment by trimming what's been copied out - * and updating header, then send each fragment (in order). - */ - m_adj(m0, hlen + firstlen - ip->ip_len); - ip->ip_len = htons((u_short)(hlen + firstlen)); - ip->ip_off = htons((u_short)(ip->ip_off | IP_MF)); - ip->ip_sum = 0; - ip->ip_sum = in_cksum(m0, hlen); -sendorfree: - for (m = m0; m; m = m0) { - m0 = m->m_act; - m->m_act = 0; - if (error == 0) -# if BSD >= 199306 - error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro->ro_rt); -# else - error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst); -# endif - else - m_freem(m); - } - } -done: - if (!error) - ipl_frouteok[0]++; - else - ipl_frouteok[1]++; - - if (ro->ro_rt) - RTFREE(ro->ro_rt); - return 0; -bad: - if (error == EMSGSIZE) { - sifp = fin->fin_ifp; - code = fin->fin_icode; - fin->fin_icode = ICMP_UNREACH_NEEDFRAG; - fin->fin_ifp = ifp; - (void) send_icmp_err(ip, ICMP_UNREACH, fin, 1); - fin->fin_ifp = sifp; - fin->fin_icode = code; - } - m_freem(m); - goto done; -} - - -int fr_verifysrc(ipa, ifp) -struct in_addr ipa; -void *ifp; -{ - struct sockaddr_in *dst; - struct route iproute; - - bzero((char *)&iproute, sizeof(iproute)); - dst = (struct sockaddr_in *)&iproute.ro_dst; - dst->sin_family = AF_INET; - dst->sin_addr = ipa; -# if (BSD >= 199306) && !defined(__NetBSD__) && !defined(__bsdi__) && \ - !defined(__OpenBSD__) -# ifdef RTF_CLONING - rtalloc_ign(&iproute, RTF_CLONING); -# else - rtalloc_ign(&iproute, RTF_PRCLONING); -# endif -# else - rtalloc(&iproute); -# endif - if (iproute.ro_rt == NULL) - return 0; - return (ifp == iproute.ro_rt->rt_ifp); -} - -#else /* #ifdef _KERNEL */ - - -# ifdef __sgi -static int no_output __P((struct ifnet *ifp, struct mbuf *m, - struct sockaddr *s)) -# else -static int no_output __P((struct ifnet *ifp, struct mbuf *m, - struct sockaddr *s, struct rtentry *rt)) -# endif -{ - return 0; -} - - -# ifdef __STDC__ -# ifdef __sgi -static int write_output __P((struct ifnet *ifp, struct mbuf *m, - struct sockaddr *s)) -# else -static int write_output __P((struct ifnet *ifp, struct mbuf *m, - struct sockaddr *s, struct rtentry *rt)) -# endif -{ - ip_t *ip = (ip_t *)m; -# else -static int write_output(ifp, ip) -struct ifnet *ifp; -ip_t *ip; -{ -# endif - char fname[32]; - int fd; - -# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) - sprintf(fname, "/tmp/%s", ifp->if_xname); -# else - sprintf(fname, "/tmp/%s%d", ifp->if_name, ifp->if_unit); -# endif - fd = open(fname, O_WRONLY|O_APPEND); - if (fd == -1) { - perror("open"); - return -1; - } - write(fd, (char *)ip, ntohs(ip->ip_len)); - close(fd); - return 0; -} - - -struct ifnet *get_unit(name, v) -char *name; -int v; -{ - struct ifnet *ifp, **ifa; -# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) - for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) { - if (!strcmp(name, ifp->if_xname)) - return ifp; - } -# else - char ifname[32], *s; - - for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) { - (void) sprintf(ifname, "%s%d", ifp->if_name, ifp->if_unit); - if (!strcmp(name, ifname)) - return ifp; - } -# endif - - if (!ifneta) { - ifneta = (struct ifnet **)malloc(sizeof(ifp) * 2); - if (!ifneta) - return NULL; - ifneta[1] = NULL; - ifneta[0] = (struct ifnet *)calloc(1, sizeof(*ifp)); - if (!ifneta[0]) { - free(ifneta); - return NULL; - } - nifs = 1; - } else { - nifs++; - ifneta = (struct ifnet **)realloc(ifneta, - (nifs + 1) * sizeof(*ifa)); - if (!ifneta) { - nifs = 0; - return NULL; - } - ifneta[nifs] = NULL; - ifneta[nifs - 1] = (struct ifnet *)malloc(sizeof(*ifp)); - if (!ifneta[nifs - 1]) { - nifs--; - return NULL; - } - } - ifp = ifneta[nifs - 1]; - -# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) - strncpy(ifp->if_xname, name, sizeof(ifp->if_xname)); -# else - for (s = name; *s && !isdigit(*s); s++) - ; - if (*s && isdigit(*s)) { - ifp->if_unit = atoi(s); - ifp->if_name = (char *)malloc(s - name + 1); - strncpy(ifp->if_name, name, s - name); - ifp->if_name[s - name] = '\0'; - } else { - ifp->if_name = strdup(name); - ifp->if_unit = -1; - } -# endif - ifp->if_output = no_output; - return ifp; -} - - - -void init_ifp() -{ - struct ifnet *ifp, **ifa; - char fname[32]; - int fd; - -# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199606)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) - for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) { - ifp->if_output = write_output; - sprintf(fname, "/tmp/%s", ifp->if_xname); - fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600); - if (fd == -1) - perror("open"); - else - close(fd); - } -# else - - for (ifa = ifneta; ifa && (ifp = *ifa); ifa++) { - ifp->if_output = write_output; - sprintf(fname, "/tmp/%s%d", ifp->if_name, ifp->if_unit); - fd = open(fname, O_WRONLY|O_CREAT|O_EXCL|O_TRUNC, 0600); - if (fd == -1) - perror("open"); - else - close(fd); - } -# endif -} - - -int ipfr_fastroute(ip, fin, fdp) -ip_t *ip; -fr_info_t *fin; -frdest_t *fdp; -{ - struct ifnet *ifp = fdp->fd_ifp; - - if (!ifp) - return 0; /* no routing table out here */ - - ip->ip_len = htons((u_short)ip->ip_len); - ip->ip_off = htons((u_short)(ip->ip_off | IP_MF)); - ip->ip_sum = 0; -#ifdef __sgi - (*ifp->if_output)(ifp, (void *)ip, NULL); -#else - (*ifp->if_output)(ifp, (void *)ip, NULL, 0); -#endif - return 0; -} - - -int ipllog __P((void)) -{ - verbose("l"); - return 0; -} - - -int send_reset(ip, ifp) -ip_t *ip; -struct ifnet *ifp; -{ - verbose("- TCP RST sent\n"); - return 0; -} - - -int icmp_error(ip, ifp) -ip_t *ip; -struct ifnet *ifp; -{ - verbose("- TCP RST sent\n"); - return 0; -} - - -void frsync() -{ - return; -} -#endif /* _KERNEL */ diff --git a/sys/contrib/ipfilter/netinet/ip_log.c b/sys/contrib/ipfilter/netinet/ip_log.c deleted file mode 100644 index 082a0a3cf8328..0000000000000 --- a/sys/contrib/ipfilter/netinet/ip_log.c +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (C) 1997-2000 by Darren Reed. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - * - * $Id: ip_log.c,v 2.5.2.1 2000/07/19 13:11:47 darrenr Exp $ - * $FreeBSD$ - */ -#include <sys/param.h> -#if defined(KERNEL) && !defined(_KERNEL) -# define _KERNEL -#endif -#if defined(__NetBSD__) && (NetBSD >= 199905) && !defined(IPFILTER_LKM) -# include "opt_ipfilter_log.h" -#endif -#ifdef __FreeBSD__ -# if defined(IPFILTER_LKM) || defined(_KERNEL) -# if !defined(__FreeBSD_version) -# include <sys/osreldate.h> -# endif -# if !defined(IPFILTER_LKM) -# if defined(__FreeBSD_version) && (__FreeBSD_version >= 300000) -# include "opt_ipfilter.h" -# endif -# endif -# else -# ifdef KLD_MODULE -# include <osreldate.h> -# endif -# endif -#endif -#ifdef IPFILTER_LOG -# ifndef SOLARIS -# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4))) -# endif -# ifndef _KERNEL -# include <stdio.h> -# include <string.h> -# include <stdlib.h> -# include <ctype.h> -# endif -# include <sys/errno.h> -# include <sys/types.h> -# include <sys/file.h> -# if __FreeBSD_version >= 220000 && defined(_KERNEL) -# include <sys/fcntl.h> -# include <sys/filio.h> -# else -# include <sys/ioctl.h> -# endif -# include <sys/time.h> -# if defined(_KERNEL) && !defined(linux) -# include <sys/systm.h> -# endif -# include <sys/uio.h> -# if !SOLARIS -# if (NetBSD > 199609) || (OpenBSD > 199603) || (__FreeBSD_version >= 300000) -# include <sys/dirent.h> -# else -# include <sys/dir.h> -# endif -# ifndef linux -# include <sys/mbuf.h> -# endif -# else -# include <sys/filio.h> -# include <sys/cred.h> -# include <sys/ddi.h> -# include <sys/sunddi.h> -# include <sys/ksynch.h> -# include <sys/kmem.h> -# include <sys/mkdev.h> -# include <sys/dditypes.h> -# include <sys/cmn_err.h> -# endif -# ifndef linux -# include <sys/protosw.h> -# endif -# include <sys/socket.h> - -# include <net/if.h> -# ifdef sun -# include <net/af.h> -# endif -# if __FreeBSD_version >= 300000 -# include <net/if_var.h> -# endif -# include <net/route.h> -# include <netinet/in.h> -# ifdef __sgi -# include <sys/ddi.h> -# ifdef IFF_DRVRLOCK /* IRIX6 */ -# include <sys/hashing.h> -# endif -# endif -# if !defined(linux) && !(defined(__sgi) && !defined(IFF_DRVRLOCK)) /*IRIX<6*/ -# include <netinet/in_var.h> -# endif -# include <netinet/in_systm.h> -# include <netinet/ip.h> -# include <netinet/tcp.h> -# include <netinet/udp.h> -# include <netinet/ip_icmp.h> -# ifndef linux -# include <netinet/ip_var.h> -# endif -# ifndef _KERNEL -# include <syslog.h> -# endif -# include "netinet/ip_compat.h" -# include <netinet/tcpip.h> -# include "netinet/ip_fil.h" -# include "netinet/ip_proxy.h" -# include "netinet/ip_nat.h" -# include "netinet/ip_frag.h" -# include "netinet/ip_state.h" -# include "netinet/ip_auth.h" -# if (__FreeBSD_version >= 300000) -# include <sys/malloc.h> -# endif - -# ifndef MIN -# define MIN(a,b) (((a)<(b))?(a):(b)) -# endif - - -# if SOLARIS || defined(__sgi) -extern kmutex_t ipl_mutex; -# if SOLARIS -extern kcondvar_t iplwait; -# endif -# endif - -iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1], *ipll[IPL_LOGMAX+1]; -size_t iplused[IPL_LOGMAX+1]; -static fr_info_t iplcrc[IPL_LOGMAX+1]; -# ifdef linux -static struct wait_queue *iplwait[IPL_LOGMAX+1]; -# endif - - -/* - * Initialise log buffers & pointers. Also iniialised the CRC to a local - * secret for use in calculating the "last log checksum". - */ -void ipflog_init() -{ - int i; - - for (i = IPL_LOGMAX; i >= 0; i--) { - iplt[i] = NULL; - ipll[i] = NULL; - iplh[i] = &iplt[i]; - iplused[i] = 0; - bzero((char *)&iplcrc[i], sizeof(iplcrc[i])); - } -} - - -/* - * ipflog - * Create a log record for a packet given that it has been triggered by a - * rule (or the default setting). Calculate the transport protocol header - * size using predetermined size of a couple of popular protocols and thus - * how much data to copy into the log, including part of the data body if - * requested. - */ -int ipflog(flags, ip, fin, m) -u_int flags; -ip_t *ip; -fr_info_t *fin; -mb_t *m; -{ - ipflog_t ipfl; - register size_t mlen, hlen; - size_t sizes[2]; - void *ptrs[2]; - int types[2]; - u_char p; -# if SOLARIS - ill_t *ifp = fin->fin_ifp; -# else - struct ifnet *ifp = fin->fin_ifp; -# endif - - /* - * calculate header size. - */ - hlen = fin->fin_hlen; - if (fin->fin_off == 0) { - p = fin->fin_fi.fi_p; - if (p == IPPROTO_TCP) - hlen += MIN(sizeof(tcphdr_t), fin->fin_dlen); - else if (p == IPPROTO_UDP) - hlen += MIN(sizeof(udphdr_t), fin->fin_dlen); - else if (p == IPPROTO_ICMP) { - struct icmp *icmp; - - icmp = (struct icmp *)fin->fin_dp; - - /* - * For ICMP, if the packet is an error packet, also - * include the information about the packet which - * caused the error. - */ - switch (icmp->icmp_type) - { - case ICMP_UNREACH : - case ICMP_SOURCEQUENCH : - case ICMP_REDIRECT : - case ICMP_TIMXCEED : - case ICMP_PARAMPROB : - hlen += MIN(sizeof(struct icmp) + 8, - fin->fin_dlen); - break; - default : - hlen += MIN(sizeof(struct icmp), - fin->fin_dlen); - break; - } - } - } - /* - * Get the interface number and name to which this packet is - * currently associated. - */ -# if SOLARIS - ipfl.fl_unit = (u_char)ifp->ill_ppa; - bcopy(ifp->ill_name, ipfl.fl_ifname, MIN(ifp->ill_name_length, 4)); - mlen = (flags & FR_LOGBODY) ? MIN(msgdsize(m) - hlen, 128) : 0; -# else -# if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \ - (defined(OpenBSD) && (OpenBSD >= 199603)) - strncpy(ipfl.fl_ifname, ifp->if_xname, IFNAMSIZ); -# else -# ifndef linux - ipfl.fl_unit = (u_char)ifp->if_unit; -# endif - if ((ipfl.fl_ifname[0] = ifp->if_name[0])) - if ((ipfl.fl_ifname[1] = ifp->if_name[1])) - if ((ipfl.fl_ifname[2] = ifp->if_name[2])) - ipfl.fl_ifname[3] = ifp->if_name[3]; -# endif - mlen = (flags & FR_LOGBODY) ? MIN(fin->fin_plen - hlen, 128) : 0; -# endif - ipfl.fl_plen = (u_char)mlen; - ipfl.fl_hlen = (u_char)hlen; - ipfl.fl_rule = fin->fin_rule; - ipfl.fl_group = fin->fin_group; - if (fin->fin_fr != NULL) - ipfl.fl_loglevel = fin->fin_fr->fr_loglevel; - else - ipfl.fl_loglevel = 0xffff; - ipfl.fl_flags = flags; - ptrs[0] = (void *)&ipfl; - sizes[0] = sizeof(ipfl); - types[0] = 0; -# if SOLARIS - /* - * Are we copied from the mblk or an aligned array ? - */ - if (ip == (ip_t *)m->b_rptr) { - ptrs[1] = m; - sizes[1] = hlen + mlen; - types[1] = 1; - } else { - ptrs[1] = ip; - sizes[1] = hlen + mlen; - types[1] = 0; - } -# else - ptrs[1] = m; - sizes[1] = hlen + mlen; - types[1] = 1; -# endif - return ipllog(IPL_LOGIPF, fin, ptrs, sizes, types, 2); -} - - -/* - * ipllog - */ -int ipllog(dev, fin, items, itemsz, types, cnt) -int dev; -fr_info_t *fin; -void **items; -size_t *itemsz; -int *types, cnt; -{ - caddr_t buf, s; - iplog_t *ipl; - size_t len; - int i; - - /* - * Check to see if this log record has a CRC which matches the last - * record logged. If it does, just up the count on the previous one - * rather than create a new one. - */ - MUTEX_ENTER(&ipl_mutex); - if (fin != NULL) { - if ((ipll[dev] != NULL) && - bcmp((char *)fin, (char *)&iplcrc[dev], FI_CSIZE) == 0) { - ipll[dev]->ipl_count++; - MUTEX_EXIT(&ipl_mutex); - return 1; - } - bcopy((char *)fin, (char *)&iplcrc[dev], FI_CSIZE); - } else - bzero((char *)&iplcrc[dev], FI_CSIZE); - MUTEX_EXIT(&ipl_mutex); - - /* - * Get the total amount of data to be logged. - */ - for (i = 0, len = sizeof(iplog_t); i < cnt; i++) - len += itemsz[i]; - - /* - * check that we have space to record this information and can - * allocate that much. - */ - KMALLOCS(buf, caddr_t, len); - if (!buf) - return 0; - MUTEX_ENTER(&ipl_mutex); - if ((iplused[dev] + len) > IPLLOGSIZE) { - MUTEX_EXIT(&ipl_mutex); - KFREES(buf, len); - return 0; - } - iplused[dev] += len; - MUTEX_EXIT(&ipl_mutex); - - /* - * advance the log pointer to the next empty record and deduct the - * amount of space we're going to use. - */ - ipl = (iplog_t *)buf; - ipl->ipl_magic = IPL_MAGIC; - ipl->ipl_count = 1; - ipl->ipl_next = NULL; - ipl->ipl_dsize = len; -# if SOLARIS || defined(sun) || defined(linux) - uniqtime((struct timeval *)&ipl->ipl_sec); -# else -# if BSD >= 199306 || defined(__FreeBSD__) || defined(__sgi) - microtime((struct timeval *)&ipl->ipl_sec); -# endif -# endif - - /* - * Loop through all the items to be logged, copying each one to the - * buffer. Use bcopy for normal data or the mb_t copyout routine. - */ - for (i = 0, s = buf + sizeof(*ipl); i < cnt; i++) { - if (types[i] == 0) - bcopy(items[i], s, itemsz[i]); - else if (types[i] == 1) { -# if SOLARIS - copyout_mblk(items[i], 0, itemsz[i], s); -# else - m_copydata(items[i], 0, itemsz[i], s); -# endif - } - s += itemsz[i]; - } - MUTEX_ENTER(&ipl_mutex); - ipll[dev] = ipl; - *iplh[dev] = ipl; - iplh[dev] = &ipl->ipl_next; -# if SOLARIS - cv_signal(&iplwait); - mutex_exit(&ipl_mutex); -# else - MUTEX_EXIT(&ipl_mutex); -# ifdef linux - wake_up_interruptible(&iplwait[dev]); -# else - wakeup(&iplh[dev]); -# endif -# endif - return 1; -} - - -int ipflog_read(unit, uio) -minor_t unit; -struct uio *uio; -{ - size_t dlen, copied; - int error = 0; - iplog_t *ipl; -# if defined(_KERNEL) && !SOLARIS - int s; -# endif - - /* - * Sanity checks. Make sure the minor # is valid and we're copying - * a valid chunk of data. - */ - if (IPL_LOGMAX < unit) - return ENXIO; - if (!uio->uio_resid) - return 0; - if ((uio->uio_resid < sizeof(iplog_t)) || - (uio->uio_resid > IPLLOGSIZE)) - return EINVAL; - - /* - * Lock the log so we can snapshot the variables. Wait for a signal - * if the log is empty. - */ - SPL_NET(s); - MUTEX_ENTER(&ipl_mutex); - - while (!iplused[unit] || !iplt[unit]) { -# if SOLARIS && defined(_KERNEL) - if (!cv_wait_sig(&iplwait, &ipl_mutex)) { - MUTEX_EXIT(&ipl_mutex); - return EINTR; - } -# else -# ifdef linux - interruptible_sleep_on(&iplwait[unit]); - if (current->signal & ~current->blocked) - return -EINTR; -# else - MUTEX_EXIT(&ipl_mutex); - SPL_X(s); - error = SLEEP(&iplh[unit], "ipl sleep"); - if (error) - return error; - SPL_NET(s); - MUTEX_ENTER(&ipl_mutex); -# endif /* linux */ -# endif /* SOLARIS */ - } - -# if BSD >= 199306 || defined(__FreeBSD__) - uio->uio_rw = UIO_READ; -# endif - - for (copied = 0; (ipl = iplt[unit]); copied += dlen) { - dlen = ipl->ipl_dsize; - if (dlen > uio->uio_resid) - break; - /* - * Don't hold the mutex over the uiomove call. - */ - iplt[unit] = ipl->ipl_next; - iplused[unit] -= dlen; - MUTEX_EXIT(&ipl_mutex); - SPL_X(s); - error = UIOMOVE((caddr_t)ipl, dlen, UIO_READ, uio); - if (error) { - SPL_NET(s); - MUTEX_ENTER(&ipl_mutex); - ipl->ipl_next = iplt[unit]; - iplt[unit] = ipl; - iplused[unit] += dlen; - break; - } - KFREES((caddr_t)ipl, dlen); - SPL_NET(s); - MUTEX_ENTER(&ipl_mutex); - } - if (!iplt[unit]) { - iplused[unit] = 0; - iplh[unit] = &iplt[unit]; - ipll[unit] = NULL; - } - - MUTEX_EXIT(&ipl_mutex); - SPL_X(s); -# ifdef linux - if (!error) - return (int)copied; - return -error; -# else - return error; -# endif -} - - -int ipflog_clear(unit) -minor_t unit; -{ - iplog_t *ipl; - int used; - - MUTEX_ENTER(&ipl_mutex); - while ((ipl = iplt[unit])) { - iplt[unit] = ipl->ipl_next; - KFREES((caddr_t)ipl, ipl->ipl_dsize); - } - iplh[unit] = &iplt[unit]; - ipll[unit] = NULL; - used = iplused[unit]; - iplused[unit] = 0; - bzero((char *)&iplcrc[unit], FI_CSIZE); - MUTEX_EXIT(&ipl_mutex); - return used; -} -#endif /* IPFILTER_LOG */ diff --git a/sys/contrib/ipfilter/netinet/ip_proxy.c b/sys/contrib/ipfilter/netinet/ip_proxy.c deleted file mode 100644 index 47d0e5ea0de3b..0000000000000 --- a/sys/contrib/ipfilter/netinet/ip_proxy.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright (C) 1997-2000 by Darren Reed. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - */ -#if !defined(lint) -/*static const char rcsid[] = "@(#)$Id: ip_proxy.c,v 2.2.2.1 1999/09/19 12:18:19 darrenr Exp $";*/ -static const char rcsid[] = "@(#)$FreeBSD$"; -#endif - -#if defined(__FreeBSD__) && defined(KERNEL) && !defined(_KERNEL) -# define _KERNEL -#endif - -#include <sys/errno.h> -#include <sys/types.h> -#include <sys/param.h> -#include <sys/time.h> -#include <sys/file.h> -#if !defined(__FreeBSD_version) -# include <sys/ioctl.h> -#endif -#include <sys/fcntl.h> -#include <sys/uio.h> -#if !defined(_KERNEL) && !defined(KERNEL) -# include <stdio.h> -# include <string.h> -# include <stdlib.h> -#endif -#ifndef linux -# include <sys/protosw.h> -#endif -#include <sys/socket.h> -#if defined(_KERNEL) -# if !defined(linux) -# include <sys/systm.h> -# else -# include <linux/string.h> -# endif -#endif -#if !defined(__SVR4) && !defined(__svr4__) -# ifndef linux -# include <sys/mbuf.h> -# endif -#else -# include <sys/byteorder.h> -# ifdef _KERNEL -# include <sys/dditypes.h> -# endif -# include <sys/stream.h> -# include <sys/kmem.h> -#endif -#if __FreeBSD__ > 2 -# include <sys/queue.h> -#endif -#include <net/if.h> -#ifdef sun -# include <net/af.h> -#endif -#include <net/route.h> -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/ip.h> -#ifndef linux -# include <netinet/ip_var.h> -#endif -#include <netinet/tcp.h> -#include <netinet/udp.h> -#include <netinet/ip_icmp.h> -#include "netinet/ip_compat.h" -#include <netinet/tcpip.h> -#include "netinet/ip_fil.h" -#include "netinet/ip_proxy.h" -#include "netinet/ip_nat.h" -#include "netinet/ip_state.h" -#if (__FreeBSD_version >= 300000) -# include <sys/malloc.h> -#endif - - -#ifndef MIN -#define MIN(a,b) (((a)<(b))?(a):(b)) -#endif - -static ap_session_t *appr_new_session __P((aproxy_t *, ip_t *, - fr_info_t *, nat_t *)); -static int appr_fixseqack __P((fr_info_t *, ip_t *, ap_session_t *, int )); - - -#define AP_SESS_SIZE 53 - -#if defined(_KERNEL) && !defined(linux) -#include "netinet/ip_ftp_pxy.c" -#include "netinet/ip_rcmd_pxy.c" -#include "netinet/ip_raudio_pxy.c" -#endif - -ap_session_t *ap_sess_tab[AP_SESS_SIZE]; -ap_session_t *ap_sess_list = NULL; -aproxy_t *ap_proxylist = NULL; -aproxy_t ap_proxies[] = { -#ifdef IPF_FTP_PROXY - { NULL, "ftp", (char)IPPROTO_TCP, 0, 0, ippr_ftp_init, NULL, - ippr_ftp_new, ippr_ftp_in, ippr_ftp_out }, -#endif -#ifdef IPF_RCMD_PROXY - { NULL, "rcmd", (char)IPPROTO_TCP, 0, 0, ippr_rcmd_init, NULL, - ippr_rcmd_new, NULL, ippr_rcmd_out }, -#endif -#ifdef IPF_RAUDIO_PROXY - { NULL, "raudio", (char)IPPROTO_TCP, 0, 0, ippr_raudio_init, NULL, - ippr_raudio_new, ippr_raudio_in, ippr_raudio_out }, -#endif - { NULL, "", '\0', 0, 0, NULL, NULL } -}; - - -int appr_add(ap) -aproxy_t *ap; -{ - aproxy_t *a; - - for (a = ap_proxies; a->apr_p; a++) - if ((a->apr_p == ap->apr_p) && - !strncmp(a->apr_label, ap->apr_label, - sizeof(ap->apr_label))) - return -1; - - for (a = ap_proxylist; a->apr_p; a = a->apr_next) - if ((a->apr_p == ap->apr_p) && - !strncmp(a->apr_label, ap->apr_label, - sizeof(ap->apr_label))) - return -1; - ap->apr_next = ap_proxylist; - ap_proxylist = ap; - return (*ap->apr_init)(); -} - - -int appr_del(ap) -aproxy_t *ap; -{ - aproxy_t *a, **app; - - for (app = &ap_proxylist; (a = *app); app = &a->apr_next) - if (a == ap) { - if (ap->apr_ref != 0) - return 1; - *app = a->apr_next; - return 0; - } - return -1; -} - - -int appr_ok(ip, tcp, nat) -ip_t *ip; -tcphdr_t *tcp; -ipnat_t *nat; -{ - aproxy_t *apr = nat->in_apr; - u_short dport = nat->in_dport; - - if (!apr || (apr->apr_flags & APR_DELETE) || - (ip->ip_p != apr->apr_p)) - return 0; - if ((tcp && (tcp->th_dport != dport)) || (!tcp && dport)) - return 0; - return 1; -} - - -/* - * Allocate a new application proxy structure and fill it in with the - * relevant details. call the init function once complete, prior to - * returning. - */ -static ap_session_t *appr_new_session(apr, ip, fin, nat) -aproxy_t *apr; -ip_t *ip; -fr_info_t *fin; -nat_t *nat; -{ - register ap_session_t *aps; - - if (!apr || (apr->apr_flags & APR_DELETE) || (ip->ip_p != apr->apr_p)) - return NULL; - - KMALLOC(aps, ap_session_t *); - if (!aps) - return NULL; - bzero((char *)aps, sizeof(*aps)); - aps->aps_p = ip->ip_p; - aps->aps_data = NULL; - aps->aps_apr = apr; - aps->aps_psiz = 0; - if (apr->apr_new != NULL) - if ((*apr->apr_new)(fin, ip, aps, nat) == -1) { - KFREE(aps); - return NULL; - } - aps->aps_nat = nat; - aps->aps_next = ap_sess_list; - ap_sess_list = aps; - return aps; -} - - -/* - * check to see if a packet should be passed through an active proxy routine - * if one has been setup for it. - */ -int appr_check(ip, fin, nat) -ip_t *ip; -fr_info_t *fin; -nat_t *nat; -{ - ap_session_t *aps; - aproxy_t *apr; - tcphdr_t *tcp = NULL; - u_32_t sum; - short rv; - int err; - - if (nat->nat_aps == NULL) - nat->nat_aps = appr_new_session(nat->nat_ptr->in_apr, ip, - fin, nat); - aps = nat->nat_aps; - if ((aps != NULL) && (aps->aps_p == ip->ip_p)) { - if (ip->ip_p == IPPROTO_TCP) { - tcp = (tcphdr_t *)fin->fin_dp; - /* - * verify that the checksum is correct. If not, then - * don't do anything with this packet. - */ -#if SOLARIS && defined(_KERNEL) - sum = fr_tcpsum(fin->fin_qfm, ip, tcp); -#else - sum = fr_tcpsum(*(mb_t **)fin->fin_mp, ip, tcp); -#endif - if (sum != tcp->th_sum) { - frstats[fin->fin_out].fr_tcpbad++; - return -1; - } - } - - apr = aps->aps_apr; - err = 0; - if (fin->fin_out != 0) { - if (apr->apr_outpkt != NULL) - err = (*apr->apr_outpkt)(fin, ip, aps, nat); - } else { - if (apr->apr_inpkt != NULL) - err = (*apr->apr_inpkt)(fin, ip, aps, nat); - } - - rv = APR_EXIT(err); - if (rv == -1) - return rv; - - if (tcp != NULL) { - err = appr_fixseqack(fin, ip, aps, APR_INC(err)); -#if SOLARIS && defined(_KERNEL) - tcp->th_sum = fr_tcpsum(fin->fin_qfm, ip, tcp); -#else - tcp->th_sum = fr_tcpsum(*(mb_t **)fin->fin_mp, ip, tcp); -#endif - } - aps->aps_bytes += ip->ip_len; - aps->aps_pkts++; - return 1; - } - return 0; -} - - -aproxy_t *appr_match(pr, name) -u_int pr; -char *name; -{ - aproxy_t *ap; - - for (ap = ap_proxies; ap->apr_p; ap++) - if ((ap->apr_p == pr) && - !strncmp(name, ap->apr_label, sizeof(ap->apr_label))) { - ap->apr_ref++; - return ap; - } - - for (ap = ap_proxylist; ap; ap = ap->apr_next) - if ((ap->apr_p == pr) && - !strncmp(name, ap->apr_label, sizeof(ap->apr_label))) { - ap->apr_ref++; - return ap; - } - return NULL; -} - - -void appr_free(ap) -aproxy_t *ap; -{ - ap->apr_ref--; -} - - -void aps_free(aps) -ap_session_t *aps; -{ - ap_session_t *a, **ap; - - if (!aps) - return; - - for (ap = &ap_sess_list; (a = *ap); ap = &a->aps_next) - if (a == aps) { - *ap = a->aps_next; - break; - } - - if ((aps->aps_data != NULL) && (aps->aps_psiz != 0)) - KFREES(aps->aps_data, aps->aps_psiz); - KFREE(aps); -} - - -static int appr_fixseqack(fin, ip, aps, inc) -fr_info_t *fin; -ip_t *ip; -ap_session_t *aps; -int inc; -{ - int sel, ch = 0, out, nlen; - u_32_t seq1, seq2; - tcphdr_t *tcp; - - tcp = (tcphdr_t *)fin->fin_dp; - out = fin->fin_out; - nlen = ip->ip_len; - nlen -= (ip->ip_hl << 2) + (tcp->th_off << 2); - - if (out != 0) { - seq1 = (u_32_t)ntohl(tcp->th_seq); - sel = aps->aps_sel[out]; - - /* switch to other set ? */ - if ((aps->aps_seqmin[!sel] > aps->aps_seqmin[sel]) && - (seq1 > aps->aps_seqmin[!sel])) - sel = aps->aps_sel[out] = !sel; - - if (aps->aps_seqoff[sel]) { - seq2 = aps->aps_seqmin[sel] - aps->aps_seqoff[sel]; - if (seq1 > seq2) { - seq2 = aps->aps_seqoff[sel]; - seq1 += seq2; - tcp->th_seq = htonl(seq1); - ch = 1; - } - } - - if (inc && (seq1 > aps->aps_seqmin[!sel])) { - aps->aps_seqmin[!sel] = seq1 + nlen - 1; - aps->aps_seqoff[!sel] = aps->aps_seqoff[sel] + inc; - } - - /***/ - - seq1 = ntohl(tcp->th_ack); - sel = aps->aps_sel[1 - out]; - - /* switch to other set ? */ - if ((aps->aps_ackmin[!sel] > aps->aps_ackmin[sel]) && - (seq1 > aps->aps_ackmin[!sel])) - sel = aps->aps_sel[1 - out] = !sel; - - if (aps->aps_ackoff[sel] && (seq1 > aps->aps_ackmin[sel])) { - seq2 = aps->aps_ackoff[sel]; - tcp->th_ack = htonl(seq1 - seq2); - ch = 1; - } - } else { - seq1 = ntohl(tcp->th_seq); - sel = aps->aps_sel[out]; - - /* switch to other set ? */ - if ((aps->aps_ackmin[!sel] > aps->aps_ackmin[sel]) && - (seq1 > aps->aps_ackmin[!sel])) - sel = aps->aps_sel[out] = !sel; - - if (aps->aps_ackoff[sel]) { - seq2 = aps->aps_ackmin[sel] - - aps->aps_ackoff[sel]; - if (seq1 > seq2) { - seq2 = aps->aps_ackoff[sel]; - seq1 += seq2; - tcp->th_seq = htonl(seq1); - ch = 1; - } - } - - if (inc && (seq1 > aps->aps_ackmin[!sel])) { - aps->aps_ackmin[!sel] = seq1 + nlen - 1; - aps->aps_ackoff[!sel] = aps->aps_ackoff[sel] + inc; - } - - /***/ - - seq1 = ntohl(tcp->th_ack); - sel = aps->aps_sel[1 - out]; - - /* switch to other set ? */ - if ((aps->aps_seqmin[!sel] > aps->aps_seqmin[sel]) && - (seq1 > aps->aps_seqmin[!sel])) - sel = aps->aps_sel[1 - out] = !sel; - - if (aps->aps_seqoff[sel] && (seq1 > aps->aps_seqmin[sel])) { - seq2 = aps->aps_seqoff[sel]; - tcp->th_ack = htonl(seq1 - seq2); - ch = 1; - } - } - return ch ? 2 : 0; -} - - -int appr_init() -{ - aproxy_t *ap; - int err = 0; - - for (ap = ap_proxies; ap->apr_p; ap++) { - err = (*ap->apr_init)(); - if (err != 0) - break; - } - return err; -} - - -void appr_unload() -{ - aproxy_t *ap; - - for (ap = ap_proxies; ap->apr_p; ap++) - if (ap->apr_fini) - (*ap->apr_fini)(); - for (ap = ap_proxylist; ap; ap = ap->apr_next) - if (ap->apr_fini) - (*ap->apr_fini)(); -} diff --git a/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c b/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c deleted file mode 100644 index 8b2c23162bc8f..0000000000000 --- a/sys/contrib/ipfilter/netinet/ip_raudio_pxy.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * $FreeBSD$ - */ -#if SOLARIS && defined(_KERNEL) -extern kmutex_t ipf_rw; -#endif - -#define IPF_RAUDIO_PROXY - - -int ippr_raudio_init __P((void)); -int ippr_raudio_new __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *)); -int ippr_raudio_in __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *)); -int ippr_raudio_out __P((fr_info_t *, ip_t *, ap_session_t *, nat_t *)); - -static frentry_t raudiofr; - - -/* - * Real Audio application proxy initialization. - */ -int ippr_raudio_init() -{ - bzero((char *)&raudiofr, sizeof(raudiofr)); - raudiofr.fr_ref = 1; - raudiofr.fr_flags = FR_INQUE|FR_PASS|FR_QUICK|FR_KEEPSTATE; - return 0; -} - - -/* - * Setup for a new proxy to handle Real Audio. - */ -int ippr_raudio_new(fin, ip, aps, nat) -fr_info_t *fin; -ip_t *ip; -ap_session_t *aps; -nat_t *nat; -{ - raudio_t *rap; - - - KMALLOCS(aps->aps_data, void *, sizeof(raudio_t)); - if (aps->aps_data == NULL) - return -1; - - bzero(aps->aps_data, sizeof(raudio_t)); - rap = aps->aps_data; - aps->aps_psiz = sizeof(raudio_t); - rap->rap_mode = RAP_M_TCP; /* default is for TCP */ - return 0; -} - - - -int ippr_raudio_out(fin, ip, aps, nat) -fr_info_t *fin; -ip_t *ip; -ap_session_t *aps; -nat_t *nat; -{ - raudio_t *rap = aps->aps_data; - unsigned char membuf[512 + 1], *s; - u_short id = 0; - tcphdr_t *tcp; - int off, dlen; - int len = 0; - mb_t *m; -#if SOLARIS - mb_t *m1; -#endif - - /* - * If we've already processed the start messages, then nothing left - * for the proxy to do. - */ - if (rap->rap_eos == 1) - return 0; - - tcp = (tcphdr_t *)fin->fin_dp; - off = (ip->ip_hl << 2) + (tcp->th_off << 2); - bzero(membuf, sizeof(membuf)); -#if SOLARIS - m = fin->fin_qfm; - - dlen = msgdsize(m) - off; - if (dlen <= 0) - return 0; - copyout_mblk(m, off, MIN(sizeof(membuf), dlen), (char *)membuf); -#else - m = *(mb_t **)fin->fin_mp; - - dlen = mbufchainlen(m) - off; - if (dlen <= 0) - return 0; - m_copydata(m, off, MIN(sizeof(membuf), dlen), (char *)membuf); -#endif - /* - * In all the startup parsing, ensure that we don't go outside - * the packet buffer boundary. - */ - /* - * Look for the start of connection "PNA" string if not seen yet. - */ - if (rap->rap_seenpna == 0) { - s = (u_char *)memstr("PNA", (char *)membuf, 3, dlen); - if (s == NULL) - return 0; - s += 3; - rap->rap_seenpna = 1; - } else - s = membuf; - - /* - * Directly after the PNA will be the version number of this - * connection. - */ - if (rap->rap_seenpna == 1 && rap->rap_seenver == 0) { - if ((s + 1) - membuf < dlen) { - rap->rap_version = (*s << 8) | *(s + 1); - s += 2; - rap->rap_seenver = 1; - } else - return 0; - } - - /* - * Now that we've been past the PNA and version number, we're into the - * startup messages block. This ends when a message with an ID of 0. - */ - while ((rap->rap_eos == 0) && ((s + 1) - membuf < dlen)) { - if (rap->rap_gotid == 0) { - id = (*s << 8) | *(s + 1); - s += 2; - rap->rap_gotid = 1; - if (id == RA_ID_END) { - rap->rap_eos = 1; - break; - } - } else if (rap->rap_gotlen == 0) { - len = (*s << 8) | *(s + 1); - s += 2; - rap->rap_gotlen = 1; - } - - if (rap->rap_gotid == 1 && rap->rap_gotlen == 1) { - if (id == RA_ID_UDP) { - rap->rap_mode &= ~RAP_M_TCP; - rap->rap_mode |= RAP_M_UDP; - rap->rap_plport = (*s << 8) | *(s + 1); - } else if (id == RA_ID_ROBUST) { - rap->rap_mode |= RAP_M_ROBUST; - rap->rap_prport = (*s << 8) | *(s + 1); - } - s += len; - rap->rap_gotlen = 0; - rap->rap_gotid = 0; - } - } - return 0; -} - - -int ippr_raudio_in(fin, ip, aps, nat) -fr_info_t *fin; -ip_t *ip; -ap_session_t *aps; -nat_t *nat; -{ - unsigned char membuf[IPF_MAXPORTLEN + 1], *s; - tcphdr_t *tcp, tcph, *tcp2 = &tcph; - raudio_t *rap = aps->aps_data; - struct in_addr swa, swb; - int off, dlen, slen; - int a1, a2, a3, a4; - u_short sp, dp; - fr_info_t fi; - tcp_seq seq; - nat_t *ipn; - u_char swp; - mb_t *m; -#if SOLARIS - mb_t *m1; -#endif - - /* - * Wait until we've seen the end of the start messages and even then - * only proceed further if we're using UDP. If they want to use TCP - * then data is sent back on the same channel that is already open. - */ - if (rap->rap_sdone != 0) - return 0; - - tcp = (tcphdr_t *)fin->fin_dp; - off = (ip->ip_hl << 2) + (tcp->th_off << 2); - m = *(mb_t **)fin->fin_mp; - -#if SOLARIS - m = fin->fin_qfm; - - dlen = msgdsize(m) - off; - if (dlen <= 0) - return 0; - bzero(membuf, sizeof(membuf)); - copyout_mblk(m, off, MIN(sizeof(membuf), dlen), (char *)membuf); -#else - dlen = mbufchainlen(m) - off; - if (dlen <= 0) - return 0; - bzero(membuf, sizeof(membuf)); - m_copydata(m, off, MIN(sizeof(membuf), dlen), (char *)membuf); -#endif - - seq = ntohl(tcp->th_seq); - /* - * Check to see if the data in this packet is of interest to us. - * We only care for the first 19 bytes coming back from the server. - */ - if (rap->rap_sseq == 0) { - s = (u_char *)memstr("PNA", (char *)membuf, 3, dlen); - if (s == NULL) - return 0; - a1 = s - membuf; - dlen -= a1; - a1 = 0; - rap->rap_sseq = seq; - a2 = MIN(dlen, sizeof(rap->rap_svr)); - } else if (seq <= rap->rap_sseq + sizeof(rap->rap_svr)) { - /* - * seq # which is the start of data and from that the offset - * into the buffer array. - */ - a1 = seq - rap->rap_sseq; - a2 = MIN(dlen, sizeof(rap->rap_svr)); - a2 -= a1; - s = membuf; - } else - return 0; - - for (a3 = a1, a4 = a2; (a4 > 0) && (a3 < 19) && (a3 >= 0); a4--,a3++) { - rap->rap_sbf |= (1 << a3); - rap->rap_svr[a3] = *s++; - } - - if ((rap->rap_sbf != 0x7ffff) || (!rap->rap_eos)) /* 19 bits */ - return 0; - rap->rap_sdone = 1; - - s = (u_char *)rap->rap_svr + 11; - if (((*s << 8) | *(s + 1)) == RA_ID_ROBUST) { - s += 2; - rap->rap_srport = (*s << 8) | *(s + 1); - } - - swp = ip->ip_p; - swa = ip->ip_src; - swb = ip->ip_dst; - - ip->ip_p = IPPROTO_UDP; - ip->ip_src = nat->nat_inip; - ip->ip_dst = nat->nat_oip; - - bcopy((char *)fin, (char *)&fi, sizeof(fi)); - bzero((char *)tcp2, sizeof(*tcp2)); - tcp2->th_off = 5; - fi.fin_dp = (char *)tcp2; - fi.fin_fr = &raudiofr; - fi.fin_dlen = sizeof(*tcp2); - tcp2->th_win = htons(8192); - slen = ip->ip_len; - ip->ip_len = fin->fin_hlen + sizeof(*tcp); - - if (((rap->rap_mode & RAP_M_UDP_ROBUST) == RAP_M_UDP_ROBUST) && - (rap->rap_srport != 0)) { - dp = rap->rap_srport; - sp = rap->rap_prport; - tcp2->th_sport = htons(sp); - tcp2->th_dport = htons(dp); - fi.fin_data[0] = dp; - fi.fin_data[1] = sp; - ipn = nat_new(nat->nat_ptr, ip, &fi, - IPN_UDP | (sp ? 0 : FI_W_SPORT), NAT_OUTBOUND); - if (ipn != NULL) { - ipn->nat_age = fr_defnatage; - (void) fr_addstate(ip, &fi, sp ? 0 : FI_W_SPORT); - } - } - - if ((rap->rap_mode & RAP_M_UDP) == RAP_M_UDP) { - sp = rap->rap_plport; - tcp2->th_sport = htons(sp); - tcp2->th_dport = 0; /* XXX - don't specify remote port */ - fi.fin_data[0] = sp; - fi.fin_data[1] = 0; - ipn = nat_new(nat->nat_ptr, ip, &fi, IPN_UDP|FI_W_DPORT, - NAT_OUTBOUND); - if (ipn != NULL) { - ipn->nat_age = fr_defnatage; - (void) fr_addstate(ip, &fi, FI_W_DPORT); - } - } - - ip->ip_p = swp; - ip->ip_len = slen; - ip->ip_src = swa; - ip->ip_dst = swb; - return 0; -} diff --git a/sys/contrib/ipfilter/netinet/ip_state.h b/sys/contrib/ipfilter/netinet/ip_state.h deleted file mode 100644 index 765709c047c4a..0000000000000 --- a/sys/contrib/ipfilter/netinet/ip_state.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (C) 1995-2000 by Darren Reed. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and due credit is given - * to the original author and the contributors. - * - * @(#)ip_state.h 1.3 1/12/96 (C) 1995 Darren Reed - * $Id: ip_state.h,v 2.13.2.1 2000/07/08 02:15:35 darrenr Exp $ - * $FreeBSD$ - */ -#ifndef __IP_STATE_H__ -#define __IP_STATE_H__ - -#if defined(__STDC__) || defined(__GNUC__) -# define SIOCDELST _IOW('r', 61, struct ipstate *) -#else -# define SIOCDELST _IOW(r, 61, struct ipstate *) -#endif - -#define IPSTATE_SIZE 5737 -#define IPSTATE_MAX 4013 /* Maximum number of states held */ - -#define PAIRS(s1,d1,s2,d2) ((((s1) == (s2)) && ((d1) == (d2))) ||\ - (((s1) == (d2)) && ((d1) == (s2)))) -#define IPPAIR(s1,d1,s2,d2) PAIRS((s1).s_addr, (d1).s_addr, \ - (s2).s_addr, (d2).s_addr) - - -typedef struct udpstate { - u_short us_sport; - u_short us_dport; -} udpstate_t; - -typedef struct icmpstate { - u_short ics_id; - u_short ics_seq; - u_char ics_type; -} icmpstate_t; - -typedef struct tcpdata { - u_32_t td_end; - u_32_t td_maxend; - u_short td_maxwin; -} tcpdata_t; - -typedef struct tcpstate { - u_short ts_sport; - u_short ts_dport; - tcpdata_t ts_data[2]; - u_char ts_state[2]; -} tcpstate_t; - -typedef struct ipstate { - struct ipstate *is_next; - struct ipstate **is_pnext; - struct ipstate *is_hnext; - struct ipstate **is_phnext; - u_long is_age; - u_int is_pass; - U_QUAD_T is_pkts; - U_QUAD_T is_bytes; - void *is_ifp[2]; - frentry_t *is_rule; - union i6addr is_src; - union i6addr is_dst; - u_char is_p; /* Protocol */ - u_char is_v; - u_int is_hv; - u_32_t is_flags; - u_32_t is_opt; /* packet options set */ - u_32_t is_optmsk; /* " " mask */ - u_short is_sec; /* security options set */ - u_short is_secmsk; /* " " mask */ - u_short is_auth; /* authentication options set */ - u_short is_authmsk; /* " " mask */ - union { - icmpstate_t is_ics; - tcpstate_t is_ts; - udpstate_t is_us; - } is_ps; - char is_ifname[2][IFNAMSIZ]; -#if SOLARIS || defined(__sgi) - kmutex_t is_lock; -#endif -} ipstate_t; - -#define is_saddr is_src.in4.s_addr -#define is_daddr is_dst.in4.s_addr -#define is_icmp is_ps.is_ics -#define is_type is_icmp.ics_type -#define is_code is_icmp.ics_code -#define is_tcp is_ps.is_ts -#define is_udp is_ps.is_us -#define is_send is_tcp.ts_data[0].td_end -#define is_dend is_tcp.ts_data[1].td_end -#define is_maxswin is_tcp.ts_data[0].td_maxwin -#define is_maxdwin is_tcp.ts_data[1].td_maxwin -#define is_maxsend is_tcp.ts_data[0].td_maxend -#define is_maxdend is_tcp.ts_data[1].td_maxend -#define is_sport is_tcp.ts_sport -#define is_dport is_tcp.ts_dport -#define is_state is_tcp.ts_state -#define is_ifpin is_ifp[0] -#define is_ifpout is_ifp[1] - -#define TH_OPENING (TH_SYN|TH_ACK) -/* - * is_flags: - * Bits 0 - 3 are use as a mask with the current packet's bits to check for - * whether it is short, tcp/udp, a fragment or the presence of IP options. - * Bits 4 - 7 are set from the initial packet and contain what the packet - * anded with bits 0-3 must match. - * Bits 8,9 are used to indicate wildcard source/destination port matching. - */ - -typedef struct ipstate_save { - void *ips_next; - struct ipstate ips_is; - struct frentry ips_fr; -} ipstate_save_t; - -#define ips_rule ips_is.is_rule - - -typedef struct ipslog { - U_QUAD_T isl_pkts; - U_QUAD_T isl_bytes; - union i6addr isl_src; - union i6addr isl_dst; - u_short isl_type; - union { - u_short isl_filler[2]; - u_short isl_ports[2]; - u_short isl_icmp; - } isl_ps; - u_char isl_v; - u_char isl_p; - u_char isl_flags; - u_char isl_state[2]; -} ipslog_t; - -#define isl_sport isl_ps.isl_ports[0] -#define isl_dport isl_ps.isl_ports[1] -#define isl_itype isl_ps.isl_icmp - -#define ISL_NEW 0 -#define ISL_EXPIRE 0xffff -#define ISL_FLUSH 0xfffe -#define ISL_REMOVE 0xfffd - - -typedef struct ips_stat { - u_long iss_hits; - u_long iss_miss; - u_long iss_max; - u_long iss_tcp; - u_long iss_udp; - u_long iss_icmp; - u_long iss_nomem; - u_long iss_expire; - u_long iss_fin; - u_long iss_active; - u_long iss_logged; - u_long iss_logfail; - u_long iss_inuse; - ipstate_t **iss_table; - ipstate_t *iss_list; -} ips_stat_t; - - -extern u_long fr_tcpidletimeout; -extern u_long fr_tcpclosewait; -extern u_long fr_tcplastack; -extern u_long fr_tcptimeout; -extern u_long fr_tcpclosed; -extern u_long fr_tcphalfclosed; -extern u_long fr_udptimeout; -extern u_long fr_icmptimeout; -extern int fr_state_lock; -extern int fr_stateinit __P((void)); -extern int fr_tcpstate __P((ipstate_t *, fr_info_t *, ip_t *, tcphdr_t *)); -extern ipstate_t *fr_addstate __P((ip_t *, fr_info_t *, u_int)); -extern frentry_t *fr_checkstate __P((ip_t *, fr_info_t *)); -extern void ip_statesync __P((void *)); -extern void fr_timeoutstate __P((void)); -extern void fr_tcp_age __P((u_long *, u_char *, fr_info_t *, int)); -extern void fr_stateunload __P((void)); -extern void ipstate_log __P((struct ipstate *, u_int)); -#if defined(__NetBSD__) || defined(__OpenBSD__) -extern int fr_state_ioctl __P((caddr_t, u_long, int)); -#else -extern int fr_state_ioctl __P((caddr_t, int, int)); -#endif - -#endif /* __IP_STATE_H__ */ diff --git a/sys/crypto/rijndael/rijndael.h b/sys/crypto/rijndael/rijndael.h deleted file mode 100644 index 8f2cc895b4336..0000000000000 --- a/sys/crypto/rijndael/rijndael.h +++ /dev/null @@ -1,3 +0,0 @@ -/* $KAME: rijndael.h,v 1.2 2000/10/02 17:14:27 itojun Exp $ */ - -#include <crypto/rijndael/rijndael-api-fst.h> diff --git a/sys/dev/aac/aac_tables.h b/sys/dev/aac/aac_tables.h deleted file mode 100644 index d994ae622181d..0000000000000 --- a/sys/dev/aac/aac_tables.h +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * Copyright (c) 2000 Michael Smith - * Copyright (c) 2000 BSDi - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Status codes for block read/write commands, etc. - * - * XXX many of these would not normally be returned, as they are - * relevant only to FSA operations. - */ -static struct aac_code_lookup aac_command_status_table[] = { - {"OK", 0}, - {"operation not permitted", 1}, - {"not found", 2}, - {"I/O error", 5}, - {"device not configured", 6}, - {"too big", 7}, - {"permission denoed", 13}, - {"file exists", 17}, - {"cross-device link", 18}, - {"operation not supported by device", 19}, - {"not a directory", 20}, - {"is a directory", 21}, - {"invalid argument", 22}, - {"file too large", 27}, - {"no space on device", 28}, - {"readonly filesystem", 30}, - {"too many links", 31}, - {"operation would block", 35}, - {"file name too long", 63}, - {"directory not empty", 66}, - {"quota exceeded", 69}, - {"stale file handle", 70}, - {"too many levels of remote in path", 71}, - {"bad file handle", 10001}, - {"not sync", 10002}, - {"bad cookie", 10003}, - {"operation not supported", 10004}, - {"too small", 10005}, - {"server fault", 10006}, - {"bad type", 10007}, - {"jukebox", 10008}, - {"not mounted", 10009}, - {"in maintenace mode", 10010}, - {"stale ACL", 10011}, - {NULL, 0}, - {"unknown command status", 0} -}; - -#define AAC_COMMAND_STATUS(x) aac_describe_code(aac_command_status_table, x) - -static struct aac_code_lookup aac_cpu_variant[] = { - {"i960JX", CPUI960_JX}, - {"i960CX", CPUI960_CX}, - {"i960HX", CPUI960_HX}, - {"i960RX", CPUI960_RX}, - {"StrongARM SA110", CPUARM_SA110}, - {"PowerPC 603e", CPUPPC_603e}, - {"Unknown StrongARM", CPUARM_xxx}, - {"Unknown PowerPC", CPUPPC_xxx}, - {NULL, 0}, - {"Unknown processor", 0} -}; - -static struct aac_code_lookup aac_battery_platform[] = { - {"required battery present", PLATFORM_BAT_REQ_PRESENT}, - {"REQUIRED BATTERY NOT PRESENT", PLATFORM_BAT_REQ_NOTPRESENT}, - {"optional battery present", PLATFORM_BAT_OPT_PRESENT}, - {"optional battery not installed", PLATFORM_BAT_OPT_NOTPRESENT}, - {"no battery support", PLATFORM_BAT_NOT_SUPPORTED}, - {NULL, 0}, - {"unknown battery platform", 0} -}; - -static struct aac_code_lookup aac_container_types[] = { - {"Volume", CT_VOLUME}, - {"RAID 1 (Mirror)", CT_MIRROR}, - {"RAID 0 (Stripe)", CT_STRIPE}, - {"RAID 5", CT_RAID5}, - {"SSRW", CT_SSRW}, - {"SSRO", CT_SSRO}, - {"Morph", CT_MORPH}, - {"Passthrough", CT_PASSTHRU}, - {"RAID 4", CT_RAID4}, - {"RAID 10", CT_RAID10}, - {"RAID 00", CT_RAID00}, - {"Volume of Mirrors", CT_VOLUME_OF_MIRRORS}, - {"Pseudo RAID 3", CT_PSEUDO_RAID3}, - {NULL, 0}, - {"unknown", 0} -}; - diff --git a/sys/dev/awi/README b/sys/dev/awi/README deleted file mode 100644 index 38aaec59de927..0000000000000 --- a/sys/dev/awi/README +++ /dev/null @@ -1,60 +0,0 @@ -# $Id: README,v 1.19 2000/03/24 08:13:24 onoe Exp $ -# $FreeBSD$ - -===== Configuration - ifconfig awi0 link0 - changes to encapsulation from 802.2 LLC/SNAP (default) to - ether encapsulation. MELCO access point and PAO's ux driver - use this. - -===== Supported Cards - Any IEEE 802.11 cards use AMD Am79C930 and Harris (Intersil) Chipset - with PCnetMobile firmware by AMD. - BayStack 650 1Mbps Frequency Hopping PCCARD adapter - BayStack 660 2Mbps Direct Sequence PCCARD adapter - Icom SL-200 2Mbps Direct Sequence PCCARD adapter - Melco WLI-PCM 2Mbps Direct Sequence PCCARD adapter - NEL SSMagic 2Mbps Direct Sequence PCCARD adapter - Netwave AirSurfer Plus - 1Mbps Frequency Hopping PCCARD adapter - Netwave AirSurfer Pro - 2Mbps Direct Sequence PCCARD adapter - -===== Known Problems - WEP is not supported. - Does not create IBSS itself. - - Cannot configure at all on FreeBSD: - selection of infrastructure/adhoc mode - ESSID - ... - -===== How to add - -*** NetBSD current - already merged into current source tree. - - pcmcia: update the awi driver, which now supports AMD 79c930-based - 802.11DS cards as well as 802.11FH cards, and can operate - in infrastructure mode, adhoc mode, and wi(4) compatible - adhoc mode. [onoe 20000322] - -*** FreeBSD-current - make directory /sys/dev/awi and put all files there. - move if_ieee80211.h to /sys/net - add following lines to /sys/conf/files - dev/awi/am79c930.c optional awi - dev/awi/awi.c optional awi - dev/awi/if_awi_pccard.c optional awi card - add following line to config file - device awi0 - config and make kernel - - add description of your card to /etc/pccard.conf - ex. - card "AMD" "Am79C930" - config 0x1 "awi0" ? - card "Icom" "SL-200" - config 0x1 "awi0" ? - card "Bay Networks" "BayStack 650 Wireless LAN" - config 0x1 "awi0" ? diff --git a/sys/dev/awi/am79c930.c b/sys/dev/awi/am79c930.c deleted file mode 100644 index aa9c97f5a538a..0000000000000 --- a/sys/dev/awi/am79c930.c +++ /dev/null @@ -1,450 +0,0 @@ -/* $NetBSD: am79c930.c,v 1.5 2000/03/23 13:57:58 onoe Exp $ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Bill Sommerfeld - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Am79c930 chip driver. - * - * This is used by the awi driver to use the shared - * memory attached to the 79c930 to communicate with the firmware running - * in the 930's on-board 80188 core. - * - * The 79c930 can be mapped into just I/O space, or also have a - * memory mapping; the mapping must be set up by the bus front-end - * before am79c930_init is called. - */ - -/* - * operations: - * - * read_8, read_16, read_32, read_64, read_bytes - * write_8, write_16, write_32, write_64, write_bytes - * (two versions, depending on whether memory-space or i/o space is in use). - * - * interrupt E.C. - * start isr - * end isr - */ - -#include <sys/param.h> -#include <sys/systm.h> -#ifndef __FreeBSD__ -#include <sys/device.h> -#endif - -#include <machine/cpu.h> -#ifdef __FreeBSD__ -#include <machine/bus_pio.h> -#include <machine/bus_memio.h> -#endif -#include <machine/bus.h> -#ifdef __NetBSD__ -#include <machine/intr.h> -#endif - -#ifdef __NetBSD__ -#include <dev/ic/am79c930reg.h> -#include <dev/ic/am79c930var.h> -#endif -#ifdef __FreeBSD__ -#include <dev/awi/am79c930reg.h> -#include <dev/awi/am79c930var.h> -#endif - -#define AM930_DELAY(x) /*nothing*/ - -void am79c930_regdump __P((struct am79c930_softc *sc)); - -static void io_write_1 __P((struct am79c930_softc *, u_int32_t, u_int8_t)); -static void io_write_2 __P((struct am79c930_softc *, u_int32_t, u_int16_t)); -static void io_write_4 __P((struct am79c930_softc *, u_int32_t, u_int32_t)); -static void io_write_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t)); - -static u_int8_t io_read_1 __P((struct am79c930_softc *, u_int32_t)); -static u_int16_t io_read_2 __P((struct am79c930_softc *, u_int32_t)); -static u_int32_t io_read_4 __P((struct am79c930_softc *, u_int32_t)); -static void io_read_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t)); - -static void mem_write_1 __P((struct am79c930_softc *, u_int32_t, u_int8_t)); -static void mem_write_2 __P((struct am79c930_softc *, u_int32_t, u_int16_t)); -static void mem_write_4 __P((struct am79c930_softc *, u_int32_t, u_int32_t)); -static void mem_write_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t)); - -static u_int8_t mem_read_1 __P((struct am79c930_softc *, u_int32_t)); -static u_int16_t mem_read_2 __P((struct am79c930_softc *, u_int32_t)); -static u_int32_t mem_read_4 __P((struct am79c930_softc *, u_int32_t)); -static void mem_read_bytes __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t)); - -static struct am79c930_ops iospace_ops = { - io_write_1, - io_write_2, - io_write_4, - io_write_bytes, - io_read_1, - io_read_2, - io_read_4, - io_read_bytes -}; - -struct am79c930_ops memspace_ops = { - mem_write_1, - mem_write_2, - mem_write_4, - mem_write_bytes, - mem_read_1, - mem_read_2, - mem_read_4, - mem_read_bytes -}; - -static void io_write_1 (sc, off, val) - struct am79c930_softc *sc; - u_int32_t off; - u_int8_t val; -{ - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA, val); - AM930_DELAY(1); -} - -static void io_write_2 (sc, off, val) - struct am79c930_softc *sc; - u_int32_t off; - u_int16_t val; -{ - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA, val & 0xff); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA, (val>>8)&0xff); - AM930_DELAY(1); -} - -static void io_write_4 (sc, off, val) - struct am79c930_softc *sc; - u_int32_t off; - u_int32_t val; -{ - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA,val & 0xff); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA,(val>>8)&0xff); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA,(val>>16)&0xff); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA,(val>>24)&0xff); - AM930_DELAY(1); -} - -static void io_write_bytes (sc, off, ptr, len) - struct am79c930_softc *sc; - u_int32_t off; - u_int8_t *ptr; - size_t len; -{ - int i; - - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - for (i=0; i<len; i++) - bus_space_write_1(sc->sc_iot,sc->sc_ioh,AM79C930_IODPA,ptr[i]); -} - -static u_int8_t io_read_1 (sc, off) - struct am79c930_softc *sc; - u_int32_t off; -{ - u_int8_t val; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - val = bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA); - AM930_DELAY(1); - return val; -} - -static u_int16_t io_read_2 (sc, off) - struct am79c930_softc *sc; - u_int32_t off; -{ - u_int16_t val; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - val = bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA); - AM930_DELAY(1); - val |= bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA) << 8; - AM930_DELAY(1); - return val; -} - -static u_int32_t io_read_4 (sc, off) - struct am79c930_softc *sc; - u_int32_t off; -{ - u_int32_t val; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - val = bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA); - AM930_DELAY(1); - val |= bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA) << 8; - AM930_DELAY(1); - val |= bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA) << 16; - AM930_DELAY(1); - val |= bus_space_read_1(sc->sc_iot, sc->sc_ioh, AM79C930_IODPA) << 24; - AM930_DELAY(1); - return val; -} - -static void io_read_bytes (sc, off, ptr, len) - struct am79c930_softc *sc; - u_int32_t off; - u_int8_t *ptr; - size_t len; -{ - int i; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_HI, - ((off>>8)& 0x7f)); - AM930_DELAY(1); - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_LMA_LO, (off&0xff)); - AM930_DELAY(1); - for (i=0; i<len; i++) - ptr[i] = bus_space_read_1(sc->sc_iot, sc->sc_ioh, - AM79C930_IODPA); -} - -static void mem_write_1 (sc, off, val) - struct am79c930_softc *sc; - u_int32_t off; - u_int8_t val; -{ - bus_space_write_1(sc->sc_memt, sc->sc_memh, off, val); -} - -static void mem_write_2 (sc, off, val) - struct am79c930_softc *sc; - u_int32_t off; - u_int16_t val; -{ - bus_space_tag_t t = sc->sc_memt; - bus_space_handle_t h = sc->sc_memh; - - /* could be unaligned */ - if ((off & 0x1) == 0) - bus_space_write_2(t, h, off, val); - else { - bus_space_write_1(t, h, off, val & 0xff); - bus_space_write_1(t, h, off+1, (val >> 8) & 0xff); - } -} - -static void mem_write_4 (sc, off, val) - struct am79c930_softc *sc; - u_int32_t off; - u_int32_t val; -{ - bus_space_tag_t t = sc->sc_memt; - bus_space_handle_t h = sc->sc_memh; - - /* could be unaligned */ - if ((off & 0x3) == 0) - bus_space_write_4(t, h, off, val); - else { - bus_space_write_1(t, h, off, val & 0xff); - bus_space_write_1(t, h, off+1, (val >> 8) & 0xff); - bus_space_write_1(t, h, off+2, (val >> 16) & 0xff); - bus_space_write_1(t, h, off+3, (val >> 24) & 0xff); - } -} - -static void mem_write_bytes (sc, off, ptr, len) - struct am79c930_softc *sc; - u_int32_t off; - u_int8_t *ptr; - size_t len; -{ - bus_space_write_region_1 (sc->sc_memt, sc->sc_memh, off, ptr, len); -} - - -static u_int8_t mem_read_1 (sc, off) - struct am79c930_softc *sc; - u_int32_t off; -{ - return bus_space_read_1(sc->sc_memt, sc->sc_memh, off); -} - -static u_int16_t mem_read_2 (sc, off) - struct am79c930_softc *sc; - u_int32_t off; -{ - /* could be unaligned */ - if ((off & 0x1) == 0) - return bus_space_read_2(sc->sc_memt, sc->sc_memh, off); - else - return - bus_space_read_1(sc->sc_memt, sc->sc_memh, off ) | - (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+1) << 8); -} - -static u_int32_t mem_read_4 (sc, off) - struct am79c930_softc *sc; - u_int32_t off; -{ - /* could be unaligned */ - if ((off & 0x3) == 0) - return bus_space_read_4(sc->sc_memt, sc->sc_memh, off); - else - return - bus_space_read_1(sc->sc_memt, sc->sc_memh, off ) | - (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+1) << 8) | - (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+2) <<16) | - (bus_space_read_1(sc->sc_memt, sc->sc_memh, off+3) <<24); -} - - - -static void mem_read_bytes (sc, off, ptr, len) - struct am79c930_softc *sc; - u_int32_t off; - u_int8_t *ptr; - size_t len; -{ - bus_space_read_region_1 (sc->sc_memt, sc->sc_memh, off, ptr, len); -} - - - - -/* - * Set bits in GCR. - */ - -void am79c930_gcr_setbits (sc, bits) - struct am79c930_softc *sc; - u_int8_t bits; -{ - u_int8_t gcr = bus_space_read_1 (sc->sc_iot, sc->sc_ioh, AM79C930_GCR); - - gcr |= bits; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_GCR, gcr); -} - -/* - * Clear bits in GCR. - */ - -void am79c930_gcr_clearbits (sc, bits) - struct am79c930_softc *sc; - u_int8_t bits; -{ - u_int8_t gcr = bus_space_read_1 (sc->sc_iot, sc->sc_ioh, AM79C930_GCR); - - gcr &= ~bits; - - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_GCR, gcr); -} - -u_int8_t am79c930_gcr_read (sc) - struct am79c930_softc *sc; -{ - return bus_space_read_1 (sc->sc_iot, sc->sc_ioh, AM79C930_GCR); -} - -#if 0 -void am79c930_regdump (sc) - struct am79c930_softc *sc; -{ - u_int8_t buf[8]; - int i; - - AM930_DELAY(5); - for (i=0; i<8; i++) { - buf[i] = bus_space_read_1 (sc->sc_iot, sc->sc_ioh, i); - AM930_DELAY(5); - } - printf("am79c930: regdump:"); - for (i=0; i<8; i++) { - printf(" %02x", buf[i]); - } - printf("\n"); -} -#endif - -void am79c930_chip_init (sc, how) - struct am79c930_softc *sc; -{ - /* zero the bank select register, and leave it that way.. */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, AM79C930_BSS, 0); - if (how) - sc->sc_ops = &memspace_ops; - else - sc->sc_ops = &iospace_ops; -} - - diff --git a/sys/dev/awi/am79c930reg.h b/sys/dev/awi/am79c930reg.h deleted file mode 100644 index 64b3e239fab1d..0000000000000 --- a/sys/dev/awi/am79c930reg.h +++ /dev/null @@ -1,126 +0,0 @@ -/* $NetBSD: am79c930reg.h,v 1.3 2000/03/22 11:22:22 onoe Exp $ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Bill Sommerfeld - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Device register definitions gleaned from from the AMD "Am79C930 - * PCnet(tm)-Mobile Single Chip Wireless LAN Media Access Controller" - * data sheet, AMD Pub #20183, Rev B, amendment/0, issue date August 1997. - * - * As of 1999/10/23, this was available from AMD's web site in PDF - * form. - */ - - -/* - * The 79c930 contains a bus interface unit, a media access - * controller, and a tranceiver attachment interface. - * The MAC contains an 80188 CPU core. - * typical devices built around this chip typically add 32k or 64k of - * memory for buffers. - * - * The 80188 runs firmware which handles most of the 802.11 gorp, and - * communicates with the host using shared data structures in this - * memory; the specifics of the shared memory layout are not covered - * in this source file; see <dev/ic/am80211fw.h> for details of that layer. - */ - -/* - * Device Registers - */ - -#define AM79C930_IO_BASE 0 -#define AM79C930_IO_SIZE 16 -#define AM79C930_IO_SIZE_BIG 40 -#define AM79C930_IO_ALIGN 0x40 /* am79c930 decodes lower 6bits */ - - -#define AM79C930_GCR 0 /* General Config Register */ - -#define AM79C930_GCR_SWRESET 0x80 /* software reset */ -#define AM79C930_GCR_CORESET 0x40 /* core reset */ -#define AM79C930_GCR_DISPWDN 0x20 /* disable powerdown */ -#define AM79C930_GCR_ECWAIT 0x10 /* embedded controller wait */ -#define AM79C930_GCR_ECINT 0x08 /* interrupt from embedded ctrlr */ -#define AM79C930_GCR_INT2EC 0x04 /* interrupt to embedded ctrlr */ -#define AM79C930_GCR_ENECINT 0x02 /* enable interrupts from e.c. */ -#define AM79C930_GCR_DAM 0x01 /* direct access mode (read only) */ - -#define AM79C930_GCR_BITS "\020\1DAM\2ENECINT\3INT2EC\4ECINT\5ECWAIT\6DISPWDN\7CORESET\010SWRESET" - -#define AM79C930_BSS 1 /* Bank Switching Select register */ - -#define AM79C930_BSS_ECATR 0x80 /* E.C. ALE test read */ -#define AM79C930_BSS_FS 0x20 /* Flash Select */ -#define AM79C930_BSS_MBS 0x18 /* Memory Bank Select */ -#define AM79C930_BSS_EIOW 0x04 /* Expand I/O Window */ -#define AM79C930_BSS_TBS 0x03 /* TAI Bank Select */ - -#define AM79C930_LMA_LO 2 /* Local Memory Address register (low byte) */ - -#define AM79C930_LMA_HI 3 /* Local Memory Address register (high byte) */ - - /* set this bit to turn off ISAPnP version */ -#define AM79C930_LMA_HI_ISAPWRDWN 0x80 - -/* - * mmm, inconsistancy in chip documentation: - * According to page 79--80, all four of the following are equivalent - * and address the single byte pointed at by BSS_{FS,MBS} | LMA_{HI,LO} - * According to tables on p63 and p67, they're the LSB through MSB - * of a 32-bit word. - */ - -#define AM79C930_IODPA 4 /* I/O Data port A */ -#define AM79C930_IODPB 5 /* I/O Data port B */ -#define AM79C930_IODPC 6 /* I/O Data port C */ -#define AM79C930_IODPD 7 /* I/O Data port D */ - - -/* - * Tranceiver Attachment Interface Registers (TIR space) - * (omitted for now, since host access to them is for diagnostic - * purposes only). - */ - -/* - * memory space goo. - */ - -#define AM79C930_MEM_SIZE 0x8000 /* 32k */ -#define AM79C930_MEM_BASE 0x0 /* starting at 0 */ diff --git a/sys/dev/awi/am79c930var.h b/sys/dev/awi/am79c930var.h deleted file mode 100644 index 1e45c6817a9dd..0000000000000 --- a/sys/dev/awi/am79c930var.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $NetBSD$ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Bill Sommerfeld - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define AM79C930_BUS_PCMCIA 1 -#define AM79C930_BUS_ISAPNP 2 /* not implemented */ - -struct am79c930_softc -{ - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; - - bus_space_tag_t sc_memt; - bus_space_handle_t sc_memh; - - struct am79c930_ops *sc_ops; - - int sc_bustype; -}; - -struct am79c930_ops -{ - void (*write_1) __P((struct am79c930_softc *, u_int32_t, u_int8_t)); - void (*write_2) __P((struct am79c930_softc *, u_int32_t, u_int16_t)); - void (*write_4) __P((struct am79c930_softc *, u_int32_t, u_int32_t)); - void (*write_bytes) __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t)); - - u_int8_t (*read_1) __P((struct am79c930_softc *, u_int32_t)); - u_int16_t (*read_2) __P((struct am79c930_softc *, u_int32_t)); - u_int32_t (*read_4) __P((struct am79c930_softc *, u_int32_t)); - void (*read_bytes) __P((struct am79c930_softc *, u_int32_t, u_int8_t *, size_t)); -}; - -void am79c930_chip_init __P((struct am79c930_softc *sc, int)); - -void am79c930_gcr_setbits __P((struct am79c930_softc *sc, u_int8_t bits)); -void am79c930_gcr_clearbits __P((struct am79c930_softc *sc, u_int8_t bits)); - -u_int8_t am79c930_gcr_read __P((struct am79c930_softc *sc)); - -#define am79c930_hard_reset(sc) am79c930_gcr_setbits(sc, AM79C930_GCR_CORESET) -#define am79c930_hard_reset_off(sc) am79c930_gcr_clearbits(sc, AM79C930_GCR_CORESET) - - diff --git a/sys/dev/awi/awi_wep.c b/sys/dev/awi/awi_wep.c deleted file mode 100644 index a8f76ec793e05..0000000000000 --- a/sys/dev/awi/awi_wep.c +++ /dev/null @@ -1,528 +0,0 @@ -/* $NetBSD: awi_wep.c,v 1.4 2000/08/14 11:28:03 onoe Exp $ */ -/* $FreeBSD$ */ - -/* - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Atsushi Onoe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * WEP support framework for the awi driver. - * - * No actual encryption capability is provided here, but any can be added - * to awi_wep_algo table below. - * - * Note that IEEE802.11 specification states WEP uses RC4 with 40bit key, - * which is a proprietary encryption algorithm available under license - * from RSA Data Security Inc. Using another algorithm, includes null - * encryption provided here, the awi driver cannot be able to communicate - * with other stations. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/mbuf.h> -#include <sys/malloc.h> -#include <sys/socket.h> -#include <sys/errno.h> -#include <sys/sockio.h> -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 -#include <sys/bus.h> -#else -#include <sys/device.h> -#endif - -#include <net/if.h> -#include <net/if_dl.h> -#ifdef __FreeBSD__ -#include <net/ethernet.h> -#include <net/if_arp.h> -#else -#include <net/if_ether.h> -#endif -#include <net/if_media.h> -#include <net/if_ieee80211.h> - -#include <machine/cpu.h> -#include <machine/bus.h> -#ifdef __FreeBSD__ -#endif - -#ifdef __NetBSD__ -#include <dev/ic/am79c930reg.h> -#include <dev/ic/am79c930var.h> -#include <dev/ic/awireg.h> -#include <dev/ic/awivar.h> - -#include <crypto/arc4/arc4.h> -#endif - -#ifdef __FreeBSD__ -#include <dev/awi/am79c930reg.h> -#include <dev/awi/am79c930var.h> -#include <dev/awi/awireg.h> -#include <dev/awi/awivar.h> - -#include <crypto/rc4/rc4.h> -static __inline int -arc4_ctxlen(void) -{ - return sizeof(struct rc4_state); -} - -static __inline void -arc4_setkey(void *ctx, u_int8_t *key, int keylen) -{ - rc4_init(ctx, key, keylen); -} - -static __inline void -arc4_encrypt(void *ctx, u_int8_t *dst, u_int8_t *src, int len) -{ - rc4_crypt(ctx, src, dst, len); -} -#endif - -static void awi_crc_init __P((void)); -static u_int32_t awi_crc_update __P((u_int32_t crc, u_int8_t *buf, int len)); - -static int awi_null_ctxlen __P((void)); -static void awi_null_setkey __P((void *ctx, u_int8_t *key, int keylen)); -static void awi_null_copy __P((void *ctx, u_int8_t *dst, u_int8_t *src, int len)); - -/* XXX: the order should be known to wiconfig/user */ - -static struct awi_wep_algo awi_wep_algo[] = { -/* 0: no wep */ - { "no" }, /* dummy for no wep */ - -/* 1: normal wep (arc4) */ - { "arc4", arc4_ctxlen, arc4_setkey, - arc4_encrypt, arc4_encrypt }, - -/* 2: debug wep (null) */ - { "null", awi_null_ctxlen, awi_null_setkey, - awi_null_copy, awi_null_copy }, - /* dummy for wep without encryption */ -}; - -int -awi_wep_setnwkey(sc, nwkey) - struct awi_softc *sc; - struct ieee80211_nwkey *nwkey; -{ - int i, len, error; - u_int8_t keybuf[AWI_MAX_KEYLEN]; - - if (nwkey->i_defkid <= 0 || - nwkey->i_defkid > IEEE80211_WEP_NKID) - return EINVAL; - error = 0; - for (i = 0; i < IEEE80211_WEP_NKID; i++) { - if (nwkey->i_key[i].i_keydat == NULL) - continue; - len = nwkey->i_key[i].i_keylen; - if (len > sizeof(keybuf)) { - error = EINVAL; - break; - } - error = copyin(nwkey->i_key[i].i_keydat, keybuf, len); - if (error) - break; - error = awi_wep_setkey(sc, i, keybuf, len); - if (error) - break; - } - if (error == 0) { - sc->sc_wep_defkid = nwkey->i_defkid - 1; - error = awi_wep_setalgo(sc, nwkey->i_wepon); - if (error == 0 && sc->sc_enabled) { - awi_stop(sc); - error = awi_init(sc); - } - } - return error; -} - -int -awi_wep_getnwkey(sc, nwkey) - struct awi_softc *sc; - struct ieee80211_nwkey *nwkey; -{ - int i, len, error, suerr; - u_int8_t keybuf[AWI_MAX_KEYLEN]; - - nwkey->i_wepon = awi_wep_getalgo(sc); - nwkey->i_defkid = sc->sc_wep_defkid + 1; - /* do not show any keys to non-root user */ -#ifdef __FreeBSD__ - suerr = suser(curproc); -#else - suerr = suser(curproc->p_ucred, &curproc->p_acflag); -#endif - error = 0; - for (i = 0; i < IEEE80211_WEP_NKID; i++) { - if (nwkey->i_key[i].i_keydat == NULL) - continue; - if (suerr) { - error = suerr; - break; - } - len = sizeof(keybuf); - error = awi_wep_getkey(sc, i, keybuf, &len); - if (error) - break; - if (nwkey->i_key[i].i_keylen < len) { - error = ENOSPC; - break; - } - nwkey->i_key[i].i_keylen = len; - error = copyout(keybuf, nwkey->i_key[i].i_keydat, len); - if (error) - break; - } - return error; -} - -int -awi_wep_getalgo(sc) - struct awi_softc *sc; -{ - - if (sc->sc_wep_algo == NULL) - return 0; - return sc->sc_wep_algo - awi_wep_algo; -} - -int -awi_wep_setalgo(sc, algo) - struct awi_softc *sc; - int algo; -{ - struct awi_wep_algo *awa; - int ctxlen; - - awi_crc_init(); /* XXX: not belongs here */ - if (algo < 0 || algo > sizeof(awi_wep_algo)/sizeof(awi_wep_algo[0])) - return EINVAL; - awa = &awi_wep_algo[algo]; - if (awa->awa_name == NULL) - return EINVAL; - if (awa->awa_ctxlen == NULL) { - awa = NULL; - ctxlen = 0; - } else - ctxlen = awa->awa_ctxlen(); - if (sc->sc_wep_ctx != NULL) { - free(sc->sc_wep_ctx, M_DEVBUF); - sc->sc_wep_ctx = NULL; - } - if (ctxlen) { - sc->sc_wep_ctx = malloc(ctxlen, M_DEVBUF, M_NOWAIT); - if (sc->sc_wep_ctx == NULL) - return ENOMEM; - } - sc->sc_wep_algo = awa; - return 0; -} - -int -awi_wep_setkey(sc, kid, key, keylen) - struct awi_softc *sc; - int kid; - unsigned char *key; - int keylen; -{ - - if (kid < 0 || kid >= IEEE80211_WEP_NKID) - return EINVAL; - if (keylen < 0 || keylen + IEEE80211_WEP_IVLEN > AWI_MAX_KEYLEN) - return EINVAL; - sc->sc_wep_keylen[kid] = keylen; - if (keylen > 0) - memcpy(sc->sc_wep_key[kid] + IEEE80211_WEP_IVLEN, key, keylen); - return 0; -} - -int -awi_wep_getkey(sc, kid, key, keylen) - struct awi_softc *sc; - int kid; - unsigned char *key; - int *keylen; -{ - - if (kid < 0 || kid >= IEEE80211_WEP_NKID) - return EINVAL; - if (*keylen < sc->sc_wep_keylen[kid]) - return ENOSPC; - *keylen = sc->sc_wep_keylen[kid]; - if (*keylen > 0) - memcpy(key, sc->sc_wep_key[kid] + IEEE80211_WEP_IVLEN, *keylen); - return 0; -} - -struct mbuf * -awi_wep_encrypt(sc, m0, txflag) - struct awi_softc *sc; - struct mbuf *m0; - int txflag; -{ - struct mbuf *m, *n, *n0; - struct ieee80211_frame *wh; - struct awi_wep_algo *awa; - int left, len, moff, noff, keylen, kid; - u_int32_t iv, crc; - u_int8_t *key, *ivp; - void *ctx; - u_int8_t crcbuf[IEEE80211_WEP_CRCLEN]; - - n0 = NULL; - awa = sc->sc_wep_algo; - if (awa == NULL) - goto fail; - ctx = sc->sc_wep_ctx; - m = m0; - left = m->m_pkthdr.len; - MGET(n, M_DONTWAIT, m->m_type); - n0 = n; - if (n == NULL) - goto fail; - M_COPY_PKTHDR(n, m); - len = IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN; - if (txflag) { - n->m_pkthdr.len += len; - } else { - n->m_pkthdr.len -= len; - left -= len; - } - n->m_len = MHLEN; - if (n->m_pkthdr.len >= MINCLSIZE) { - MCLGET(n, M_DONTWAIT); - if (n->m_flags & M_EXT) - n->m_len = n->m_ext.ext_size; - } - len = sizeof(struct ieee80211_frame); - memcpy(mtod(n, caddr_t), mtod(m, caddr_t), len); - left -= len; - moff = len; - noff = len; - if (txflag) { - kid = sc->sc_wep_defkid; - wh = mtod(n, struct ieee80211_frame *); - wh->i_fc[1] |= IEEE80211_FC1_WEP; - iv = random(); - /* - * store IV, byte order is not the matter since it's random. - * assuming IEEE80211_WEP_IVLEN is 3 - */ - ivp = mtod(n, u_int8_t *) + noff; - ivp[0] = (iv >> 16) & 0xff; - ivp[1] = (iv >> 8) & 0xff; - ivp[2] = iv & 0xff; - ivp[3] = kid & 0x03; /* clear pad and keyid */ - noff += IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN; - } else { - ivp = mtod(m, u_int8_t *) + moff; - moff += IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN; - kid = ivp[IEEE80211_WEP_IVLEN] & 0x03; - } - key = sc->sc_wep_key[kid]; - keylen = sc->sc_wep_keylen[kid]; - /* assuming IEEE80211_WEP_IVLEN is 3 */ - key[0] = ivp[0]; - key[1] = ivp[1]; - key[2] = ivp[2]; - awa->awa_setkey(ctx, key, IEEE80211_WEP_IVLEN + keylen); - - /* encrypt with calculating CRC */ - crc = ~0; - while (left > 0) { - len = m->m_len - moff; - if (len == 0) { - m = m->m_next; - moff = 0; - continue; - } - if (len > n->m_len - noff) { - len = n->m_len - noff; - if (len == 0) { - MGET(n->m_next, M_DONTWAIT, n->m_type); - if (n->m_next == NULL) - goto fail; - n = n->m_next; - n->m_len = MLEN; - if (left >= MINCLSIZE) { - MCLGET(n, M_DONTWAIT); - if (n->m_flags & M_EXT) - n->m_len = n->m_ext.ext_size; - } - noff = 0; - continue; - } - } - if (len > left) - len = left; - if (txflag) { - awa->awa_encrypt(ctx, mtod(n, caddr_t) + noff, - mtod(m, caddr_t) + moff, len); - crc = awi_crc_update(crc, mtod(m, caddr_t) + moff, len); - } else { - awa->awa_decrypt(ctx, mtod(n, caddr_t) + noff, - mtod(m, caddr_t) + moff, len); - crc = awi_crc_update(crc, mtod(n, caddr_t) + noff, len); - } - left -= len; - moff += len; - noff += len; - } - crc = ~crc; - if (txflag) { - LE_WRITE_4(crcbuf, crc); - if (n->m_len >= noff + sizeof(crcbuf)) - n->m_len = noff + sizeof(crcbuf); - else { - n->m_len = noff; - MGET(n->m_next, M_DONTWAIT, n->m_type); - if (n->m_next == NULL) - goto fail; - n = n->m_next; - n->m_len = sizeof(crcbuf); - noff = 0; - } - awa->awa_encrypt(ctx, mtod(n, caddr_t) + noff, crcbuf, - sizeof(crcbuf)); - } else { - n->m_len = noff; - for (noff = 0; noff < sizeof(crcbuf); noff += len) { - len = sizeof(crcbuf) - noff; - if (len > m->m_len - moff) - len = m->m_len - moff; - if (len > 0) - awa->awa_decrypt(ctx, crcbuf + noff, - mtod(m, caddr_t) + moff, len); - m = m->m_next; - moff = 0; - } - if (crc != LE_READ_4(crcbuf)) - goto fail; - } - m_freem(m0); - return n0; - - fail: - m_freem(m0); - m_freem(n0); - return NULL; -} - -/* - * CRC 32 -- routine from RFC 2083 - */ - -/* Table of CRCs of all 8-bit messages */ -static u_int32_t awi_crc_table[256]; -static int awi_crc_table_computed = 0; - -/* Make the table for a fast CRC. */ -static void -awi_crc_init() -{ - u_int32_t c; - int n, k; - - if (awi_crc_table_computed) - return; - for (n = 0; n < 256; n++) { - c = (u_int32_t)n; - for (k = 0; k < 8; k++) { - if (c & 1) - c = 0xedb88320UL ^ (c >> 1); - else - c = c >> 1; - } - awi_crc_table[n] = c; - } - awi_crc_table_computed = 1; -} - -/* - * Update a running CRC with the bytes buf[0..len-1]--the CRC - * should be initialized to all 1's, and the transmitted value - * is the 1's complement of the final running CRC - */ - -static u_int32_t -awi_crc_update(crc, buf, len) - u_int32_t crc; - u_int8_t *buf; - int len; -{ - u_int8_t *endbuf; - - for (endbuf = buf + len; buf < endbuf; buf++) - crc = awi_crc_table[(crc ^ *buf) & 0xff] ^ (crc >> 8); - return crc; -} - -/* - * Null -- do nothing but copy. - */ - -static int -awi_null_ctxlen() -{ - - return 0; -} - -static void -awi_null_setkey(ctx, key, keylen) - void *ctx; - u_char *key; - int keylen; -{ -} - -static void -awi_null_copy(ctx, dst, src, len) - void *ctx; - u_char *dst; - u_char *src; - int len; -{ - - memcpy(dst, src, len); -} diff --git a/sys/dev/awi/awi_wicfg.c b/sys/dev/awi/awi_wicfg.c deleted file mode 100644 index 80882ba3035a5..0000000000000 --- a/sys/dev/awi/awi_wicfg.c +++ /dev/null @@ -1,625 +0,0 @@ -/* $NetBSD: awi_wicfg.c,v 1.3 2000/07/06 17:22:25 onoe Exp $ */ -/* $FreeBSD$ */ - -/* - * Copyright (c) 2000 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Atsushi Onoe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * WaveLAN compatible configuration support routines for the awi driver. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/mbuf.h> -#include <sys/malloc.h> -#include <sys/socket.h> -#include <sys/errno.h> -#include <sys/sockio.h> -#if defined(__FreeBSD__) && __FreeBSD__ >= 4 -#include <sys/bus.h> -#else -#include <sys/device.h> -#endif - -#include <net/if.h> -#include <net/if_dl.h> -#ifdef __FreeBSD__ -#include <net/ethernet.h> -#include <net/if_arp.h> -#else -#include <net/if_ether.h> -#endif -#include <net/if_media.h> -#include <net/if_ieee80211.h> - -#include <machine/cpu.h> -#include <machine/bus.h> -#ifdef __FreeBSD__ -#endif - -#ifdef __NetBSD__ -#include <dev/ic/am79c930reg.h> -#include <dev/ic/am79c930var.h> -#include <dev/ic/awireg.h> -#include <dev/ic/awivar.h> - -#include <dev/pcmcia/if_wi_ieee.h> /* XXX */ -#endif -#ifdef __FreeBSD__ -#include <dev/awi/am79c930reg.h> -#include <dev/awi/am79c930var.h> - -#undef _KERNEL /* XXX */ -#include <i386/include/if_wavelan_ieee.h> /* XXX */ -#define _KERNEL /* XXX */ -#include <dev/awi/awireg.h> -#include <dev/awi/awivar.h> -#endif - -static int awi_cfgget __P((struct ifnet *ifp, u_long cmd, caddr_t data)); -static int awi_cfgset __P((struct ifnet *ifp, u_long cmd, caddr_t data)); - -int -awi_wicfg(ifp, cmd, data) - struct ifnet *ifp; - u_long cmd; - caddr_t data; -{ - int error; - - switch (cmd) { - case SIOCGWAVELAN: - error = awi_cfgget(ifp, cmd, data); - break; - case SIOCSWAVELAN: -#ifdef __FreeBSD__ - error = suser(curproc); -#else - error = suser(curproc->p_ucred, &curproc->p_acflag); -#endif - if (error) - break; - error = awi_cfgset(ifp, cmd, data); - break; - default: - error = EINVAL; - break; - } - return error; -} - -static int -awi_cfgget(ifp, cmd, data) - struct ifnet *ifp; - u_long cmd; - caddr_t data; -{ - int i, error, keylen; - char *p; - struct awi_softc *sc = (struct awi_softc *)ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct wi_ltv_keys *keys; - struct wi_key *k; - struct wi_req wreq; -#ifdef WICACHE - struct wi_sigcache wsc; - struct awi_bss *bp; -#endif /* WICACHE */ - - error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); - if (error) - return error; - switch (wreq.wi_type) { - case WI_RID_SERIALNO: - memcpy(wreq.wi_val, sc->sc_banner, AWI_BANNER_LEN); - wreq.wi_len = (AWI_BANNER_LEN + 1) / 2; - break; - case WI_RID_NODENAME: - strcpy((char *)&wreq.wi_val[1], hostname); - wreq.wi_val[0] = strlen(hostname); - wreq.wi_len = (1 + wreq.wi_val[0] + 1) / 2; - break; - case WI_RID_OWN_SSID: - p = sc->sc_ownssid; - wreq.wi_val[0] = p[1]; - memcpy(&wreq.wi_val[1], p + 2, p[1]); - wreq.wi_len = (1 + wreq.wi_val[0] + 1) / 2; - break; - case WI_RID_CURRENT_SSID: - if (ifp->if_flags & IFF_RUNNING) { - p = sc->sc_bss.essid; - wreq.wi_val[0] = p[1]; - memcpy(&wreq.wi_val[1], p + 2, p[1]); - } else { - wreq.wi_val[0] = 0; - wreq.wi_val[1] = '\0'; - } - wreq.wi_len = (1 + wreq.wi_val[0] + 1) / 2; - break; - case WI_RID_DESIRED_SSID: - p = sc->sc_mib_mac.aDesired_ESS_ID; - wreq.wi_val[0] = p[1]; - memcpy(&wreq.wi_val[1], p + 2, p[1]); - wreq.wi_len = (1 + wreq.wi_val[0] + 1) / 2; - break; - case WI_RID_CURRENT_BSSID: - if (ifp->if_flags & IFF_RUNNING) - memcpy(wreq.wi_val, sc->sc_bss.bssid, ETHER_ADDR_LEN); - else - memset(wreq.wi_val, 0, ETHER_ADDR_LEN); - wreq.wi_len = ETHER_ADDR_LEN / 2; - break; - case WI_RID_CHANNEL_LIST: - if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) { - wreq.wi_val[0] = sc->sc_scan_min; - wreq.wi_val[1] = sc->sc_scan_max; - wreq.wi_len = 2; - } else { - wreq.wi_val[0] = 0; - for (i = sc->sc_scan_min; i <= sc->sc_scan_max; i++) - wreq.wi_val[0] |= 1 << (i - 1); - wreq.wi_len = 1; - } - break; - case WI_RID_OWN_CHNL: - wreq.wi_val[0] = sc->sc_ownch; - wreq.wi_len = 1; - break; - case WI_RID_CURRENT_CHAN: - if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) - wreq.wi_val[0] = sc->sc_bss.pattern; - else - wreq.wi_val[0] = sc->sc_bss.chanset; - wreq.wi_len = 1; - break; - case WI_RID_COMMS_QUALITY: - wreq.wi_val[0] = 0; /* quality */ - wreq.wi_val[1] = sc->sc_bss.rssi; /* signal */ - wreq.wi_val[2] = 0; /* noise */ - wreq.wi_len = 3; - break; - case WI_RID_PROMISC: - wreq.wi_val[0] = sc->sc_mib_mac.aPromiscuous_Enable; - wreq.wi_len = 1; - break; - case WI_RID_PORTTYPE: - if (sc->sc_mib_local.Network_Mode) - wreq.wi_val[0] = 1; - else if (!sc->sc_no_bssid) - wreq.wi_val[0] = 2; - else - wreq.wi_val[0] = 3; - wreq.wi_len = 1; - break; - case WI_RID_MAC_NODE: - memcpy(wreq.wi_val, sc->sc_mib_addr.aMAC_Address, - ETHER_ADDR_LEN); - wreq.wi_len = ETHER_ADDR_LEN / 2; - break; - case WI_RID_TX_RATE: - case WI_RID_CUR_TX_RATE: - wreq.wi_val[0] = sc->sc_tx_rate / 10; - wreq.wi_len = 1; - break; - case WI_RID_RTS_THRESH: - wreq.wi_val[0] = LE_READ_2(&sc->sc_mib_mac.aRTS_Threshold); - wreq.wi_len = 1; - break; - case WI_RID_CREATE_IBSS: - wreq.wi_val[0] = sc->sc_start_bss; - wreq.wi_len = 1; - break; - case WI_RID_SYSTEM_SCALE: - wreq.wi_val[0] = 1; /* low density ... not supported */ - wreq.wi_len = 1; - break; - case WI_RID_PM_ENABLED: - wreq.wi_val[0] = sc->sc_mib_local.Power_Saving_Mode_Dis ? 0 : 1; - wreq.wi_len = 1; - break; - case WI_RID_MAX_SLEEP: - wreq.wi_val[0] = 0; /* not implemented */ - wreq.wi_len = 1; - break; - case WI_RID_WEP_AVAIL: - wreq.wi_val[0] = 1; - wreq.wi_len = 1; - break; - case WI_RID_ENCRYPTION: - wreq.wi_val[0] = awi_wep_getalgo(sc); - wreq.wi_len = 1; - break; - case WI_RID_TX_CRYPT_KEY: - wreq.wi_val[0] = sc->sc_wep_defkid; - wreq.wi_len = 1; - break; - case WI_RID_DEFLT_CRYPT_KEYS: - keys = (struct wi_ltv_keys *)&wreq; - /* do not show keys to non-root user */ -#ifdef __FreeBSD__ - error = suser(curproc); -#else - error = suser(curproc->p_ucred, &curproc->p_acflag); -#endif - if (error) { - memset(keys, 0, sizeof(*keys)); - error = 0; - break; - } - for (i = 0; i < IEEE80211_WEP_NKID; i++) { - k = &keys->wi_keys[i]; - keylen = sizeof(k->wi_keydat); - error = awi_wep_getkey(sc, i, k->wi_keydat, &keylen); - if (error) - break; - k->wi_keylen = keylen; - } - wreq.wi_len = sizeof(*keys) / 2; - break; - case WI_RID_MAX_DATALEN: - wreq.wi_val[0] = LE_READ_2(&sc->sc_mib_mac.aMax_Frame_Length); - wreq.wi_len = 1; - break; - case WI_RID_IFACE_STATS: - /* not implemented yet */ - wreq.wi_len = 0; - break; -#ifdef WICACHE - case WI_RID_READ_CACHE: - for (bp = TAILQ_FIRST(&sc->sc_scan), i = 0; - bp != NULL && i < MAXWICACHE; - bp = TAILQ_NEXT(bp, list), i++) { - memcpy(wsc.macsrc, bp->esrc, ETHER_ADDR_LEN); - /*XXX*/ - memcpy(&wsc.ipsrc, bp->bssid, sizeof(wsc.ipsrc)); - wsc.signal = bp->rssi; - wsc.noise = 0; - wsc.quality = 0; - memcpy((caddr_t)wreq.wi_val + sizeof(wsc) * i, - &wsc, sizeof(wsc)); - } - wreq.wi_len = sizeof(wsc) * i / 2; - break; -#endif /* WICACHE */ - default: - error = EINVAL; - break; - } - if (error == 0) { - wreq.wi_len++; - error = copyout(&wreq, ifr->ifr_data, sizeof(wreq)); - } - return error; -} - -static int -awi_cfgset(ifp, cmd, data) - struct ifnet *ifp; - u_long cmd; - caddr_t data; -{ - int i, error, rate, oregion; - u_int8_t *phy_rates; - struct awi_softc *sc = (struct awi_softc *)ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct wi_ltv_keys *keys; - struct wi_key *k; - struct wi_req wreq; - - error = copyin(ifr->ifr_data, &wreq, sizeof(wreq)); - if (error) - return error; - if (wreq.wi_len-- < 1) - return EINVAL; - switch (wreq.wi_type) { - case WI_RID_SERIALNO: - case WI_RID_NODENAME: - error = EPERM; - break; - case WI_RID_OWN_SSID: - if (wreq.wi_len < (1 + wreq.wi_val[0] + 1) / 2) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] > IEEE80211_NWID_LEN) { - error = EINVAL; - break; - } - memset(sc->sc_ownssid, 0, AWI_ESS_ID_SIZE); - sc->sc_ownssid[0] = IEEE80211_ELEMID_SSID; - sc->sc_ownssid[1] = wreq.wi_val[0]; - memcpy(&sc->sc_ownssid[2], &wreq.wi_val[1], wreq.wi_val[0]); - if (!sc->sc_mib_local.Network_Mode && - !sc->sc_no_bssid && sc->sc_start_bss) - error = ENETRESET; - break; - case WI_RID_CURRENT_SSID: - error = EPERM; - break; - case WI_RID_DESIRED_SSID: - if (wreq.wi_len < (1 + wreq.wi_val[0] + 1) / 2) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] > IEEE80211_NWID_LEN) { - error = EINVAL; - break; - } - memset(sc->sc_mib_mac.aDesired_ESS_ID, 0, AWI_ESS_ID_SIZE); - sc->sc_mib_mac.aDesired_ESS_ID[0] = IEEE80211_ELEMID_SSID; - sc->sc_mib_mac.aDesired_ESS_ID[1] = wreq.wi_val[0]; - memcpy(&sc->sc_mib_mac.aDesired_ESS_ID[2], &wreq.wi_val[1], - wreq.wi_val[0]); - if (sc->sc_mib_local.Network_Mode || !sc->sc_no_bssid) - error = ENETRESET; - break; - case WI_RID_CURRENT_BSSID: - error = EPERM; - break; - case WI_RID_CHANNEL_LIST: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - oregion = sc->sc_mib_phy.aCurrent_Reg_Domain; - if (wreq.wi_val[0] == oregion) - break; - sc->sc_mib_phy.aCurrent_Reg_Domain = wreq.wi_val[0]; - error = awi_init_region(sc); - if (error) { - sc->sc_mib_phy.aCurrent_Reg_Domain = oregion; - break; - } - error = ENETRESET; - break; - case WI_RID_OWN_CHNL: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] < sc->sc_scan_min || - wreq.wi_val[0] > sc->sc_scan_max) { - error = EINVAL; - break; - } - sc->sc_ownch = wreq.wi_val[0]; - if (!sc->sc_mib_local.Network_Mode) - error = ENETRESET; - break; - case WI_RID_CURRENT_CHAN: - error = EPERM; - break; - case WI_RID_COMMS_QUALITY: - error = EPERM; - break; - case WI_RID_PROMISC: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - if (ifp->if_flags & IFF_PROMISC) { - if (wreq.wi_val[0] == 0) { - ifp->if_flags &= ~IFF_PROMISC; - error = ENETRESET; - } - } else { - if (wreq.wi_val[0] != 0) { - ifp->if_flags |= IFF_PROMISC; - error = ENETRESET; - } - } - break; - case WI_RID_PORTTYPE: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - switch (wreq.wi_val[0]) { - case 1: - sc->sc_mib_local.Network_Mode = 1; - sc->sc_no_bssid = 0; - error = ENETRESET; - break; - case 2: - sc->sc_mib_local.Network_Mode = 0; - sc->sc_no_bssid = 0; - error = ENETRESET; - break; - case 3: - if (sc->sc_mib_phy.IEEE_PHY_Type == AWI_PHY_TYPE_FH) { - error = EINVAL; - break; - } - sc->sc_mib_local.Network_Mode = 0; - sc->sc_no_bssid = 1; - error = ENETRESET; - break; - default: - error = EINVAL; - break; - } - break; - case WI_RID_MAC_NODE: - /* XXX: should be implemented? */ - error = EPERM; - break; - case WI_RID_TX_RATE: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - phy_rates = sc->sc_mib_phy.aSuprt_Data_Rates; - switch (wreq.wi_val[0]) { - case 1: - case 2: - case 5: - case 11: - rate = wreq.wi_val[0] * 10; - if (rate == 50) - rate += 5; /*XXX*/ - break; - case 3: - case 6: - case 7: - /* auto rate */ - phy_rates = sc->sc_mib_phy.aSuprt_Data_Rates; - rate = AWI_RATE_1MBIT; - for (i = 0; i < phy_rates[1]; i++) { - if (AWI_80211_RATE(phy_rates[2 + i]) > rate) - rate = AWI_80211_RATE(phy_rates[2 + i]); - } - break; - default: - rate = 0; - error = EINVAL; - break; - } - if (error) - break; - for (i = 0; i < phy_rates[1]; i++) { - if (rate == AWI_80211_RATE(phy_rates[2 + i])) - break; - } - if (i == phy_rates[1]) { - error = EINVAL; - break; - } - sc->sc_tx_rate = rate; - break; - case WI_RID_CUR_TX_RATE: - error = EPERM; - break; - case WI_RID_RTS_THRESH: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - LE_WRITE_2(&sc->sc_mib_mac.aRTS_Threshold, wreq.wi_val[0]); - error = ENETRESET; - break; - case WI_RID_CREATE_IBSS: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - sc->sc_start_bss = wreq.wi_val[0] ? 1 : 0; - error = ENETRESET; - break; - case WI_RID_SYSTEM_SCALE: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] != 1) - error = EINVAL; /* not supported */ - break; - case WI_RID_PM_ENABLED: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] != 0) - error = EINVAL; /* not implemented */ - break; - case WI_RID_MAX_SLEEP: - error = EINVAL; /* not implemented */ - break; - case WI_RID_WEP_AVAIL: - error = EPERM; - break; - case WI_RID_ENCRYPTION: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - error = awi_wep_setalgo(sc, wreq.wi_val[0]); - if (error) - break; - error = ENETRESET; - break; - case WI_RID_TX_CRYPT_KEY: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] >= IEEE80211_WEP_NKID) { - error = EINVAL; - break; - } - sc->sc_wep_defkid = wreq.wi_val[1]; - break; - case WI_RID_DEFLT_CRYPT_KEYS: - if (wreq.wi_len != sizeof(*keys) / 2) { - error = EINVAL; - break; - } - keys = (struct wi_ltv_keys *)&wreq; - for (i = 0; i < IEEE80211_WEP_NKID; i++) { - k = &keys->wi_keys[i]; - error = awi_wep_setkey(sc, i, k->wi_keydat, - k->wi_keylen); - if (error) - break; - } - break; - case WI_RID_MAX_DATALEN: - if (wreq.wi_len != 1) { - error = EINVAL; - break; - } - if (wreq.wi_val[0] < 350 || wreq.wi_val[0] > 2304) { - error = EINVAL; - break; - } - LE_WRITE_2(&sc->sc_mib_mac.aMax_Frame_Length, wreq.wi_val[0]); - break; - case WI_RID_IFACE_STATS: - error = EPERM; - break; - default: - error = EINVAL; - break; - } - if (error == ENETRESET) { - if (sc->sc_enabled) { - awi_stop(sc); - error = awi_init(sc); - } else - error = 0; - } - return error; -} diff --git a/sys/dev/awi/awireg.h b/sys/dev/awi/awireg.h deleted file mode 100644 index dc936eb730ec3..0000000000000 --- a/sys/dev/awi/awireg.h +++ /dev/null @@ -1,460 +0,0 @@ -/* $NetBSD: awireg.h,v 1.3 2000/03/22 11:22:22 onoe Exp $ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Bill Sommerfeld - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * The firmware typically loaded onto Am79C930-based 802.11 interfaces - * uses a 32k or larger shared memory buffer to communicate with the - * host. - * - * Depending on the exact configuration of the device, this buffer may - * either be mapped into PCMCIA memory space, or accessible a byte at - * a type through PCMCIA I/O space. - * - * This header defines offsets into this shared memory. - */ - - -/* - * LAST_TXD block. 5 32-bit words. - * - * There are five different output queues; this defines pointers to - * the last completed descriptor for each one. - */ -#define AWI_LAST_TXD 0x3ec /* last completed Tx Descr */ - -#define AWI_LAST_BCAST_TXD AWI_LAST_TXD+0 -#define AWI_LAST_MGT_TXD AWI_LAST_TXD+4 -#define AWI_LAST_DATA_TXD AWI_LAST_TXD+8 -#define AWI_LAST_PS_POLL_TXD AWI_LAST_TXD+12 -#define AWI_LAST_CF_POLL_TXD AWI_LAST_TXD+16 - -/* - * Banner block; null-terminated string. - * - * The doc says it contains - * "PCnetMobile:v2.00 mmddyy APIx.x\0" - */ - -#define AWI_BANNER 0x480 /* Version string */ -#define AWI_BANNER_LEN 0x20 - -/* - * Command block protocol: - * write command byte to a zero value. - * write command status to a zero value. - * write arguments to AWI_COMMAND_PARAMS - * write command byte to a non-zero value. - * wait for command status to be non-zero. - * write command byte to a zero value. - * write command status to a zero value. - */ - -#define AWI_CMD 0x4a0 /* Command opcode byte */ - -#define AWI_CMD_IDLE 0x0 -#define AWI_CMD_NOP 0x1 - -#define AWI_CMD_SET_MIB 0x2 -#define AWI_CMD_GET_MIB 0x9 - -#define AWI_CA_MIB_TYPE 0x0 -#define AWI_CA_MIB_SIZE 0x1 -#define AWI_CA_MIB_INDEX 0x2 -#define AWI_CA_MIB_DATA 0x4 - -#define AWI_MIB_LOCAL 0x0 -#define AWI_MIB_ADDR 0x2 -#define AWI_MIB_MAC 0x3 -#define AWI_MIB_STAT 0x4 -#define AWI_MIB_MGT 0x5 -#define AWI_MIB_DRVR 0x6 -#define AWI_MIB_PHY 0x7 - - -#define AWI_CMD_INIT_TX 0x3 - -#define AWI_CA_TX_LEN 0x14 -#define AWI_CA_TX_DATA 0x0 -#define AWI_CA_TX_MGT 0x4 -#define AWI_CA_TX_BCAST 0x8 -#define AWI_CA_TX_PS 0xc -#define AWI_CA_TX_CF 0x10 - -#define AWI_CMD_FLUSH_TX 0x4 - -#define AWI_CA_FTX_LEN 0x5 -#define AWI_CA_FTX_DATA 0x0 -#define AWI_CA_FTX_MGT 0x1 -#define AWI_CA_FTX_BCAST 0x2 -#define AWI_CA_FTX_PS 0x3 -#define AWI_CA_FTX_CF 0x4 - -#define AWI_CMD_INIT_RX 0x5 -#define AWI_CA_IRX_LEN 0x8 -#define AWI_CA_IRX_DATA_DESC 0x0 /* return */ -#define AWI_CA_IRX_PS_DESC 0x4 /* return */ - -#define AWI_CMD_KILL_RX 0x6 - -#define AWI_CMD_SLEEP 0x7 -#define AWI_CA_SLEEP_LEN 0x8 -#define AWI_CA_WAKEUP 0x0 /* uint64 */ - -#define AWI_CMD_WAKE 0x8 - -#define AWI_CMD_SCAN 0xa -#define AWI_CA_SCAN_LEN 0x6 -#define AWI_CA_SCAN_DURATION 0x0 -#define AWI_CA_SCAN_SET 0x2 -#define AWI_CA_SCAN_PATTERN 0x3 -#define AWI_CA_SCAN_IDX 0x4 -#define AWI_CA_SCAN_SUSP 0x5 - -#define AWI_CMD_SYNC 0xb -#define AWI_CA_SYNC_LEN 0x14 -#define AWI_CA_SYNC_SET 0x0 -#define AWI_CA_SYNC_PATTERN 0x1 -#define AWI_CA_SYNC_IDX 0x2 -#define AWI_CA_SYNC_STARTBSS 0x3 -#define AWI_CA_SYNC_DWELL 0x4 -#define AWI_CA_SYNC_MBZ 0x6 -#define AWI_CA_SYNC_TIMESTAMP 0x8 -#define AWI_CA_SYNC_REFTIME 0x10 - -#define AWI_CMD_RESUME 0xc - -#define AWI_CMD_STATUS 0x4a1 /* Command status */ - -#define AWI_STAT_IDLE 0x0 -#define AWI_STAT_OK 0x1 -#define AWI_STAT_BADCMD 0x2 -#define AWI_STAT_BADPARM 0x3 -#define AWI_STAT_NOTIMP 0x4 -#define AWI_STAT_BADRES 0x5 -#define AWI_STAT_BADMODE 0x6 - -#define AWI_ERROR_OFFSET 0x4a2 /* Offset to erroneous parameter */ -#define AWI_CMD_PARAMS 0x4a4 /* Command parameters */ - -#define AWI_CSB 0x4f0 /* Control/Status block */ - -#define AWI_SELFTEST 0x4f0 - -#define AWI_SELFTEST_INIT 0x00 /* initial */ -#define AWI_SELFTEST_FIRMCKSUM 0x01 /* firmware cksum running */ -#define AWI_SELFTEST_HARDWARE 0x02 /* hardware tests running */ -#define AWI_SELFTEST_MIB 0x03 /* mib initializing */ - -#define AWI_SELFTEST_MIB_FAIL 0xfa -#define AWI_SELFTEST_RADIO_FAIL 0xfb -#define AWI_SELFTEST_MAC_FAIL 0xfc -#define AWI_SELFTEST_FLASH_FAIL 0xfd -#define AWI_SELFTEST_RAM_FAIL 0xfe -#define AWI_SELFTEST_PASSED 0xff - -#define AWI_STA_STATE 0x4f1 - -#define AWI_STA_AP 0x20 /* acting as AP */ -#define AWI_STA_NOPSP 0x10 /* Power Saving disabled */ -#define AWI_STA_DOZE 0x08 /* about to go to sleep */ -#define AWI_STA_PSP 0x04 /* enable PSP */ -#define AWI_STA_RXEN 0x02 /* enable RX */ -#define AWI_STA_TXEN 0x01 /* enable TX */ - -#define AWI_INTSTAT 0x4f3 -#define AWI_INTMASK 0x4f4 - -/* Bits in AWI_INTSTAT/AWI_INTMASK */ - -#define AWI_INT_GROGGY 0x80 /* about to wake up */ -#define AWI_INT_CFP_ENDING 0x40 /* cont. free period ending */ -#define AWI_INT_DTIM 0x20 /* beacon outgoing */ -#define AWI_INT_CFP_START 0x10 /* cont. free period starting */ -#define AWI_INT_SCAN_CMPLT 0x08 /* scan complete */ -#define AWI_INT_TX 0x04 /* tx done */ -#define AWI_INT_RX 0x02 /* rx done */ -#define AWI_INT_CMD 0x01 /* cmd done */ - -/* - * The following are used to implement a locking protocol between host - * and MAC to protect the interrupt status and mask fields. - * - * driver: read lockout_host byte; if zero, set lockout_mac to non-zero, - * then reread lockout_host byte; if still zero, host has lock. - * if non-zero, clear lockout_mac, loop. - */ - -#define AWI_LOCKOUT_MAC 0x4f5 -#define AWI_LOCKOUT_HOST 0x4f6 - - -#define AWI_INTSTAT2 0x4f7 -#define AWI_INTMASK2 0x4fd - -/* Bits in AWI_INTSTAT2/INTMASK2 */ -#define AWI_INT2_RXMGT 0x80 /* mgt/ps recieved */ -#define AWI_INT2_RXDATA 0x40 /* data received */ -#define AWI_INT2_TXMGT 0x10 /* mgt tx done */ -#define AWI_INT2_TXCF 0x08 /* CF tx done */ -#define AWI_INT2_TXPS 0x04 /* PS tx done */ -#define AWI_INT2_TXBCAST 0x02 /* Broadcast tx done */ -#define AWI_INT2_TXDATA 0x01 /* data tx done */ - -#define AWI_DIS_PWRDN 0x4fc /* disable powerdown if set */ - -#define AWI_DRIVERSTATE 0x4fe /* driver state */ - -#define AWI_DRV_STATEMASK 0x0f - -#define AWI_DRV_RESET 0x0 -#define AWI_DRV_INFSY 0x1 /* inf synced */ -#define AWI_DRV_ADHSC 0x2 /* adhoc scan */ -#define AWI_DRV_ADHSY 0x3 /* adhoc synced */ -#define AWI_DRV_INFSC 0x4 /* inf scanning */ -#define AWI_DRV_INFAUTH 0x5 /* inf authed */ -#define AWI_DRV_INFASSOC 0x6 /* inf associated */ -#define AWI_DRV_INFTOSS 0x7 /* inf handoff */ -#define AWI_DRV_APNONE 0x8 /* AP activity: no assoc */ -#define AWI_DRV_APQUIET 0xc /* AP: >=one assoc, no traffic */ -#define AWI_DRV_APLO 0xd /* AP: >=one assoc, light tfc */ -#define AWI_DRV_APMED 0xe /* AP: >=one assoc, mod tfc */ -#define AWI_DRV_APHIGH 0xf /* AP: >=one assoc, heavy tfc */ - -#define AWI_DRV_AUTORXLED 0x10 -#define AWI_DRV_AUTOTXLED 0x20 -#define AWI_DRV_RXLED 0x40 -#define AWI_DRV_TXLED 0x80 - -#define AWI_VBM 0x500 /* Virtual Bit Map */ - -#define AWI_BUFFERS 0x600 /* Buffers */ -#define AWI_BUFFERS_END 0x6000 - -/* - * Receive descriptors; there are a linked list of these chained - * through the "NEXT" fields, starting from XXX - */ - -#define AWI_RXD_SIZE 0x18 - -#define AWI_RXD_NEXT 0x4 -#define AWI_RXD_NEXT_LAST 0x80000000 - - -#define AWI_RXD_HOST_DESC_STATE 0x9 - -#define AWI_RXD_ST_OWN 0x80 /* host owns this */ -#define AWI_RXD_ST_CONSUMED 0x40 /* host is done */ -#define AWI_RXD_ST_LF 0x20 /* last frag */ -#define AWI_RXD_ST_CRC 0x08 /* CRC error */ -#define AWI_RXD_ST_OFLO 0x02 /* possible buffer overrun */ -#define AWI_RXD_ST_RXERROR 0x01 /* this frame is borked; discard me */ - -#define AWI_RXD_RSSI 0xa /* 1 byte: radio strength indicator */ -#define AWI_RXD_INDEX 0xb /* 1 byte: FH hop index or DS channel */ -#define AWI_RXD_LOCALTIME 0xc /* 4 bytes: local time of RX */ -#define AWI_RXD_START_FRAME 0x10 /* 4 bytes: ptr to first received byte */ -#define AWI_RXD_LEN 0x14 /* 2 bytes: rx len in bytes */ -#define AWI_RXD_RATE 0x16 /* 1 byte: rx rate in 1e5 bps */ - -/* - * Transmit descriptors. - */ - -#define AWI_TXD_SIZE 0x18 - -#define AWI_TXD_START 0x00 /* pointer to start of frame */ -#define AWI_TXD_NEXT 0x04 /* pointer to next TXD */ -#define AWI_TXD_LENGTH 0x08 /* length of frame */ -#define AWI_TXD_STATE 0x0a /* state */ - -#define AWI_TXD_ST_OWN 0x80 /* MAC owns this */ -#define AWI_TXD_ST_DONE 0x40 /* MAC is done */ -#define AWI_TXD_ST_REJ 0x20 /* MAC doesn't like */ -#define AWI_TXD_ST_MSDU 0x10 /* MSDU timeout */ -#define AWI_TXD_ST_ABRT 0x08 /* TX aborted */ -#define AWI_TXD_ST_RETURNED 0x04 /* TX returned */ -#define AWI_TXD_ST_RETRY 0x02 /* TX retries exceeded */ -#define AWI_TXD_ST_ERROR 0x01 /* TX error */ - -#define AWI_TXD_RATE 0x0b /* rate */ - -#define AWI_RATE_1MBIT 10 -#define AWI_RATE_2MBIT 20 - -#define AWI_TXD_NDA 0x0c /* num DIFS attempts */ -#define AWI_TXD_NDF 0x0d /* num DIFS failures */ -#define AWI_TXD_NSA 0x0e /* num SIFS attempts */ -#define AWI_TXD_NSF 0x0f /* num SIFS failures */ - -#define AWI_TXD_NRA 0x14 /* num RTS attempts */ -#define AWI_TXD_NDTA 0x15 /* num data attempts */ -#define AWI_TXD_CTL 0x16 /* control */ - -#define AWI_TXD_CTL_PSN 0x80 /* preserve sequence in MAC frame */ -#define AWI_TXD_CTL_BURST 0x02 /* host is doing 802.11 fragmt. */ -#define AWI_TXD_CTL_FRAGS 0x01 /* override normal fragmentation */ - -/* - * MIB structures. - */ - -#define AWI_ESS_ID_SIZE (IEEE80211_NWID_LEN+2) -struct awi_mib_local { - u_int8_t Fragmentation_Dis; - u_int8_t Add_PLCP_Dis; - u_int8_t MAC_Hdr_Prsv; - u_int8_t Rx_Mgmt_Que_En; - u_int8_t Re_Assembly_Dis; - u_int8_t Strip_PLCP_Dis; - u_int8_t Rx_Error_Dis; - u_int8_t Power_Saving_Mode_Dis; - u_int8_t Accept_All_Multicast_Dis; - u_int8_t Check_Seq_Cntl_Dis; - u_int8_t Flush_CFP_Queue_On_CF_End; - u_int8_t Network_Mode; - u_int8_t PWD_Lvl; - u_int8_t CFP_Mode; - u_int8_t Tx_Buffer_Offset[4]; - u_int8_t Tx_Buffer_Size[4]; - u_int8_t Rx_Buffer_Offset[4]; - u_int8_t Rx_Buffer_Size[4]; - u_int8_t Acting_as_AP; - u_int8_t Fill_CFP; -}; - -struct awi_mib_mac { - u_int8_t _Reserved1[2]; - u_int8_t _Reserved2[2]; - u_int8_t aRTS_Threshold[2]; - u_int8_t aCW_max[2]; - u_int8_t aCW_min[2]; - u_int8_t aPromiscuous_Enable; - u_int8_t _Reserved3; - u_int8_t _Reserved4[4]; - u_int8_t aShort_Retry_Limit; - u_int8_t aLong_Retry_Limit; - u_int8_t aMax_Frame_Length[2]; - u_int8_t aFragmentation_Threshold[2]; - u_int8_t aProbe_Delay[2]; - u_int8_t aMin_Probe_Response_Time[2]; - u_int8_t aMax_Probe_Response_Time[2]; - u_int8_t aMax_Transmit_MSDU_Lifetime[4]; - u_int8_t aMax_Receive_MSDU_Lifetime[4]; - u_int8_t aStation_Basic_Rate[2]; - u_int8_t aDesired_ESS_ID[AWI_ESS_ID_SIZE]; -}; - -struct awi_mib_stat { - u_int8_t aTransmitted_MPDU_Count[4]; - u_int8_t aTransmitted_MSDU_Count[4]; - u_int8_t aOctets_Transmitted_Cnt[4]; - u_int8_t aMulticast_Transmitted_Frame_Count[2]; - u_int8_t aBroadcast_Transmitted_Frame_Count[2]; - u_int8_t aFailed_Count[4]; - u_int8_t aRetry_Count[4]; - u_int8_t aMultiple_Retry_Count[4]; - u_int8_t aFrame_Duplicate_Count[4]; - u_int8_t aRTS_Success_Count[4]; - u_int8_t aRTS_Failure_Count[4]; - u_int8_t aACK_Failure_Count[4]; - u_int8_t aReceived_Frame_Count [4]; - u_int8_t aOctets_Received_Count[4]; - u_int8_t aMulticast_Received_Count[2]; - u_int8_t aBroadcast_Received_Count[2]; - u_int8_t aFCS_Error_Count[4]; - u_int8_t aError_Count[4]; - u_int8_t aWEP_Undecryptable_Count[4]; -}; - -struct awi_mib_mgt { - u_int8_t aPower_Mgt_Mode; - u_int8_t aScan_Mode; -#define AWI_SCAN_PASSIVE 0x00 -#define AWI_SCAN_ACTIVE 0x01 -#define AWI_SCAN_BACKGROUND 0x02 - u_int8_t aScan_State; - u_int8_t aDTIM_Period; - u_int8_t aATIM_Window[2]; - u_int8_t Wep_Required; - u_int8_t _Reserved1; - u_int8_t aBeacon_Period[2]; - u_int8_t aPassive_Scan_Duration[2]; - u_int8_t aListen_Interval[2]; - u_int8_t aMedium_Occupancy_Limit[2]; - u_int8_t aMax_MPDU_Time[2]; - u_int8_t aCFP_Max_Duration[2]; - u_int8_t aCFP_Rate; - u_int8_t Do_Not_Receive_DTIMs; - u_int8_t aStation_ID[2]; - u_int8_t aCurrent_BSS_ID[ETHER_ADDR_LEN]; - u_int8_t aCurrent_ESS_ID[AWI_ESS_ID_SIZE]; -}; - -#define AWI_GROUP_ADDR_SIZE 4 -struct awi_mib_addr { - u_int8_t aMAC_Address[ETHER_ADDR_LEN]; - u_int8_t aGroup_Addresses[AWI_GROUP_ADDR_SIZE][ETHER_ADDR_LEN]; - u_int8_t aTransmit_Enable_Status; - u_int8_t _Reserved1; -}; - -#define AWI_PWR_LEVEL_SIZE 4 -struct awi_mib_phy { - u_int8_t aSlot_Time[2]; - u_int8_t aSIFS[2]; - u_int8_t aMPDU_Maximum[2]; - u_int8_t aHop_Time[2]; - u_int8_t aSuprt_Data_Rates[4]; - u_int8_t aCurrent_Reg_Domain; -#define AWI_REG_DOMAIN_US 0x10 -#define AWI_REG_DOMAIN_CA 0x20 -#define AWI_REG_DOMAIN_EU 0x30 -#define AWI_REG_DOMAIN_ES 0x31 -#define AWI_REG_DOMAIN_FR 0x32 -#define AWI_REG_DOMAIN_JP 0x40 - u_int8_t aPreamble_Lngth; - u_int8_t aPLCP_Hdr_Lngth; - u_int8_t Pwr_Up_Time[AWI_PWR_LEVEL_SIZE][2]; - u_int8_t IEEE_PHY_Type; -#define AWI_PHY_TYPE_FH 1 -#define AWI_PHY_TYPE_DS 2 -#define AWI_PHY_TYPE_IR 3 - u_int8_t RCR_33A_Bits[8]; -}; diff --git a/sys/dev/awi/awivar.h b/sys/dev/awi/awivar.h deleted file mode 100644 index 8e86f841a0065..0000000000000 --- a/sys/dev/awi/awivar.h +++ /dev/null @@ -1,222 +0,0 @@ -/* $NetBSD: awivar.h,v 1.12 2000/07/21 04:48:56 onoe Exp $ */ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Bill Sommerfeld - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* timer values in msec */ -#define AWI_SELFTEST_TIMEOUT 5000 -#define AWI_CMD_TIMEOUT 2000 -#define AWI_LOCKOUT_TIMEOUT 50 -#define AWI_ASCAN_DURATION 100 -#define AWI_ASCAN_WAIT 3000 -#define AWI_PSCAN_DURATION 200 -#define AWI_PSCAN_WAIT 5000 -#define AWI_TRANS_TIMEOUT 2000 - -#define AWI_NTXBUFS 4 -#define AWI_MAX_KEYLEN 16 - -enum awi_status { - AWI_ST_INIT, - AWI_ST_SCAN, - AWI_ST_SETSS, - AWI_ST_SYNC, - AWI_ST_AUTH, - AWI_ST_ASSOC, - AWI_ST_RUNNING -}; - -struct awi_bss -{ - TAILQ_ENTRY(awi_bss) list; - u_int8_t esrc[ETHER_ADDR_LEN]; - u_int8_t chanset; /* channel set to use */ - u_int8_t pattern; /* hop pattern to use */ - u_int8_t index; /* index to use */ - u_int8_t rssi; /* strength of this beacon */ - u_int16_t dwell_time; /* dwell time */ - u_int8_t timestamp[8]; /* timestamp of this bss */ - u_int8_t bssid[ETHER_ADDR_LEN]; - u_int16_t capinfo; - u_int32_t rxtime; /* unit's local time */ - u_int16_t interval; /* beacon interval */ - u_int8_t txrate; - u_int8_t fails; - u_int8_t essid[IEEE80211_NWID_LEN + 2]; -}; - -struct awi_wep_algo { - char *awa_name; - int (*awa_ctxlen) __P((void)); - void (*awa_setkey) __P((void *, u_char *, int)); - void (*awa_encrypt) __P((void *, u_char *, u_char *, int)); - void (*awa_decrypt) __P((void *, u_char *, u_char *, int)); -}; - -struct awi_softc -{ -#ifdef __NetBSD__ - struct device sc_dev; - struct ethercom sc_ec; - void *sc_ih; /* interrupt handler */ -#endif -#ifdef __FreeBSD__ -#if __FreeBSD__ >= 4 - struct { - char dv_xname[64]; /*XXX*/ - } sc_dev; -#else - struct device sc_dev; -#endif - struct arpcom sc_ec; -#endif - struct am79c930_softc sc_chip; - struct ifnet *sc_ifp; - int (*sc_enable) __P((struct awi_softc *)); - void (*sc_disable) __P((struct awi_softc *)); - - struct ifmedia sc_media; - enum awi_status sc_status; - unsigned int sc_enabled:1, - sc_busy:1, - sc_cansleep:1, - sc_invalid:1, - sc_enab_intr:1, - sc_format_llc:1, - sc_start_bss:1, - sc_rawbpf:1, - sc_no_bssid:1, - sc_active_scan:1, - sc_attached:1; /* attach has succeeded */ - u_int8_t sc_cmd_inprog; - int sc_sleep_cnt; - - int sc_mgt_timer; - - TAILQ_HEAD(, awi_bss) sc_scan; - u_int8_t sc_scan_cur; - u_int8_t sc_scan_min; - u_int8_t sc_scan_max; - u_int8_t sc_scan_set; - struct awi_bss sc_bss; - u_int8_t sc_ownssid[IEEE80211_NWID_LEN + 2]; - u_int8_t sc_ownch; - - int sc_rx_timer; - u_int32_t sc_rxdoff; - u_int32_t sc_rxmoff; - struct mbuf *sc_rxpend; - - int sc_tx_timer; - u_int8_t sc_tx_rate; - struct ifqueue sc_mgtq; - u_int32_t sc_txbase; - u_int32_t sc_txend; - u_int32_t sc_txnext; - u_int32_t sc_txdone; - - int sc_wep_keylen[IEEE80211_WEP_NKID]; /* keylen */ - u_int8_t sc_wep_key[IEEE80211_WEP_NKID][AWI_MAX_KEYLEN]; - int sc_wep_defkid; - void *sc_wep_ctx; /* work area */ - struct awi_wep_algo *sc_wep_algo; - - u_char sc_banner[AWI_BANNER_LEN]; - struct awi_mib_local sc_mib_local; - struct awi_mib_addr sc_mib_addr; - struct awi_mib_mac sc_mib_mac; - struct awi_mib_stat sc_mib_stat; - struct awi_mib_mgt sc_mib_mgt; - struct awi_mib_phy sc_mib_phy; -}; - -#define awi_read_1(sc, off) ((sc)->sc_chip.sc_ops->read_1)(&sc->sc_chip, off) -#define awi_read_2(sc, off) ((sc)->sc_chip.sc_ops->read_2)(&sc->sc_chip, off) -#define awi_read_4(sc, off) ((sc)->sc_chip.sc_ops->read_4)(&sc->sc_chip, off) -#define awi_read_bytes(sc, off, ptr, len) ((sc)->sc_chip.sc_ops->read_bytes)(&sc->sc_chip, off, ptr, len) - -#define awi_write_1(sc, off, val) \ - ((sc)->sc_chip.sc_ops->write_1)(&sc->sc_chip, off, val) -#define awi_write_2(sc, off, val) \ - ((sc)->sc_chip.sc_ops->write_2)(&sc->sc_chip, off, val) -#define awi_write_4(sc, off, val) \ - ((sc)->sc_chip.sc_ops->write_4)(&sc->sc_chip, off, val) -#define awi_write_bytes(sc, off, ptr, len) \ - ((sc)->sc_chip.sc_ops->write_bytes)(&sc->sc_chip, off, ptr, len) - -#define awi_drvstate(sc, state) \ - awi_write_1(sc, AWI_DRIVERSTATE, \ - ((state) | AWI_DRV_AUTORXLED|AWI_DRV_AUTOTXLED)) - -/* unalligned little endian access */ -#define LE_READ_2(p) \ - (((u_int8_t *)(p))[0] | (((u_int8_t *)(p))[1] << 8)) -#define LE_READ_4(p) \ - (((u_int8_t *)(p))[0] | (((u_int8_t *)(p))[1] << 8) | \ - (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24)) -#define LE_WRITE_2(p, v) \ - ((((u_int8_t *)(p))[0] = ((u_int32_t)(v) & 0xff)), \ - (((u_int8_t *)(p))[1] = (((u_int32_t)(v) >> 8) & 0xff))) -#define LE_WRITE_4(p, v) \ - ((((u_int8_t *)(p))[0] = ((u_int32_t)(v) & 0xff)), \ - (((u_int8_t *)(p))[1] = (((u_int32_t)(v) >> 8) & 0xff)), \ - (((u_int8_t *)(p))[2] = (((u_int32_t)(v) >> 16) & 0xff)), \ - (((u_int8_t *)(p))[3] = (((u_int32_t)(v) >> 24) & 0xff))) - -#define AWI_80211_RATE(rate) (((rate) & 0x7f) * 5) - -int awi_attach __P((struct awi_softc *)); -int awi_intr __P((void *)); -void awi_reset __P((struct awi_softc *)); -#ifdef __NetBSD__ -int awi_activate __P((struct device *, enum devact)); -int awi_detach __P((struct awi_softc *)); -void awi_power __P((struct awi_softc *, int)); -#endif - -void awi_stop __P((struct awi_softc *sc)); -int awi_init __P((struct awi_softc *sc)); -int awi_init_region __P((struct awi_softc *)); -int awi_wicfg __P((struct ifnet *, u_long, caddr_t)); - -int awi_wep_setnwkey __P((struct awi_softc *, struct ieee80211_nwkey *)); -int awi_wep_getnwkey __P((struct awi_softc *, struct ieee80211_nwkey *)); -int awi_wep_getalgo __P((struct awi_softc *)); -int awi_wep_setalgo __P((struct awi_softc *, int)); -int awi_wep_setkey __P((struct awi_softc *, int, unsigned char *, int)); -int awi_wep_getkey __P((struct awi_softc *, int, unsigned char *, int *)); -struct mbuf *awi_wep_encrypt __P((struct awi_softc *, struct mbuf *, int)); diff --git a/sys/dev/awi/if_awi_pccard.c b/sys/dev/awi/if_awi_pccard.c deleted file mode 100644 index be55de57cccf0..0000000000000 --- a/sys/dev/awi/if_awi_pccard.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * Copyright (c) 2000 Atsushi Onoe <onoe@sm.sony.co.jp> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/socket.h> - -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_media.h> -#include <net/ethernet.h> -#include <net/if_ieee80211.h> - - -#include <dev/awi/am79c930reg.h> -#include <dev/awi/am79c930var.h> -#include <dev/awi/awireg.h> -#include <dev/awi/awivar.h> - -struct awi_pccard_softc { - struct awi_softc sc_awi; - - u_int8_t sc_version[AWI_BANNER_LEN]; - int sc_intr_mask; - void *sc_intrhand; - struct resource *sc_irq_res; - int sc_irq_rid; - struct resource *sc_port_res; - int sc_port_rid; - struct resource *sc_mem_res; - int sc_mem_rid; -}; - -/* - * Initialize the device - called from Slot manager. - */ -static int -awi_pccard_probe(device_t dev) -{ - struct awi_pccard_softc *psc = device_get_softc(dev); - struct awi_softc *sc = &psc->sc_awi; - int error = 0; - - psc->sc_port_rid = 0; - psc->sc_port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &psc->sc_port_rid, 0, ~0, 16, RF_ACTIVE); - if (!psc->sc_port_res) - return ENOMEM; - - sc->sc_chip.sc_iot = rman_get_bustag(psc->sc_port_res); - sc->sc_chip.sc_ioh = rman_get_bushandle(psc->sc_port_res); - am79c930_chip_init(&sc->sc_chip, 0); - DELAY(1000); - - awi_read_bytes(sc, AWI_BANNER, psc->sc_version, AWI_BANNER_LEN); - if (memcmp(psc->sc_version, "PCnetMobile:", 12) != 0) { - device_printf(dev, "awi_pccard_probe: bad banner: %12D\n", - psc->sc_version, " "); - error = ENXIO; - } else - device_set_desc(dev, psc->sc_version); - bus_release_resource(dev, SYS_RES_IOPORT, psc->sc_port_rid, - psc->sc_port_res); - - return error; -} - -static int -awi_pccard_attach(device_t dev) -{ - struct awi_pccard_softc *psc = device_get_softc(dev); - struct awi_softc *sc = &psc->sc_awi; - struct ifnet *ifp = &sc->sc_ec.ac_if; - int error = 0; - - psc->sc_port_res = 0; - psc->sc_irq_res = 0; - psc->sc_mem_res = 0; - psc->sc_intrhand = 0; - - ifp->if_name = device_get_name(dev); - ifp->if_unit = device_get_unit(dev); - if (ifp->if_name == NULL) { - printf("awi%d: awi_pccard_attach: cannot get device name\n", - device_get_unit(dev)); - goto fail; - } - snprintf(sc->sc_dev.dv_xname, sizeof(sc->sc_dev.dv_xname), - "%s%d", ifp->if_name, ifp->if_unit); - - psc->sc_port_rid = 0; - psc->sc_port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, - &psc->sc_port_rid, 0, ~0, 16, RF_ACTIVE); - if (!psc->sc_port_res) { - device_printf(dev, "awi_pccard_attach: port alloc failed\n"); - goto fail; - } - sc->sc_chip.sc_iot = rman_get_bustag(psc->sc_port_res); - sc->sc_chip.sc_ioh = rman_get_bushandle(psc->sc_port_res); - - psc->sc_irq_rid = 0; - psc->sc_irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, - &psc->sc_irq_rid, 0, ~0, 1, RF_ACTIVE); - if (!psc->sc_irq_res) { - device_printf(dev, "awi_pccard_attach: irq alloc failed\n"); - goto fail; - } - - psc->sc_mem_rid = 0; -#if 1 - /* - * XXX: awi needs to access memory with 8bit, - * but pccardd apparently maps memory with MDF_16BITS flag. - * So memory mapped access is disabled and use IO port instead. - */ - psc->sc_mem_res = 0; -#else - psc->sc_mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, - &psc->sc_mem_rid, 0, ~0, 0x8000, RF_ACTIVE); -#endif - if (psc->sc_mem_res) { - sc->sc_chip.sc_memt = rman_get_bustag(psc->sc_mem_res); - sc->sc_chip.sc_memh = rman_get_bushandle(psc->sc_mem_res); - am79c930_chip_init(&sc->sc_chip, 1); - } else - am79c930_chip_init(&sc->sc_chip, 0); - - error = bus_setup_intr(dev, psc->sc_irq_res, INTR_TYPE_NET, - (void (*)(void *))awi_intr, sc, &psc->sc_intrhand); - if (error) { - device_printf(dev, "awi_pccard_attach: intr setup failed\n"); - goto fail; - } - - sc->sc_cansleep = 1; - sc->sc_enabled = 1; - sc->sc_ifp = &sc->sc_ec.ac_if; - - error = awi_attach(sc); - sc->sc_enabled = 0; /*XXX*/ - if (error == 0) - return 0; - device_printf(dev, "awi_pccard_attach: awi_attach failed\n"); - - fail: - if (psc->sc_intrhand) { - bus_teardown_intr(dev, psc->sc_irq_res, psc->sc_intrhand); - psc->sc_intrhand = 0; - } - if (psc->sc_port_res) { - bus_release_resource(dev, SYS_RES_IOPORT, psc->sc_port_rid, - psc->sc_port_res); - psc->sc_port_res = 0; - } - if (psc->sc_irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, psc->sc_irq_rid, - psc->sc_irq_res); - psc->sc_irq_res = 0; - } - if (psc->sc_mem_res) { - bus_release_resource(dev, SYS_RES_MEMORY, psc->sc_mem_rid, - psc->sc_mem_res); - psc->sc_mem_res = 0; - } - if (error == 0) - error = ENXIO; - return error; -} - -static int -awi_pccard_detach(device_t dev) -{ - struct awi_pccard_softc *psc = device_get_softc(dev); - struct awi_softc *sc = &psc->sc_awi; - struct ifnet *ifp = &sc->sc_ec.ac_if; - - ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); - ifp->if_flags &= ~IFF_RUNNING; - if (psc->sc_intrhand) { - bus_teardown_intr(dev, psc->sc_irq_res, psc->sc_intrhand); - psc->sc_intrhand = 0; - } - if (psc->sc_port_res) { - bus_release_resource(dev, SYS_RES_IOPORT, psc->sc_port_rid, - psc->sc_port_res); - psc->sc_port_res = 0; - } - if (psc->sc_irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, psc->sc_irq_rid, - psc->sc_irq_res); - psc->sc_irq_res = 0; - } - if (psc->sc_mem_res) { - bus_release_resource(dev, SYS_RES_MEMORY, psc->sc_mem_rid, - psc->sc_mem_res); - psc->sc_mem_res = 0; - } - return 0; -} - -static device_method_t awi_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, awi_pccard_probe), - DEVMETHOD(device_attach, awi_pccard_attach), - DEVMETHOD(device_detach, awi_pccard_detach), - - { 0, 0 } -}; - -static driver_t awi_pccard_driver = { - "awi", - awi_pccard_methods, - sizeof(struct awi_pccard_softc), -}; - -extern devclass_t awi_devclass; - -DRIVER_MODULE(awi, pccard, awi_pccard_driver, awi_devclass, 0, 0); diff --git a/sys/dev/cs/if_csreg.h b/sys/dev/cs/if_csreg.h deleted file mode 100644 index e771156fe1f30..0000000000000 --- a/sys/dev/cs/if_csreg.h +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (c) 1997,1998 Maxim Bolotin and Oleg Sharoiko. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * $FreeBSD$ - */ - -#define CS_89x0_IO_PORTS 0x0020 - -#define PP_ChipID 0x0000 /* offset 0h -> Corp -ID */ - /* offset 2h -> Model/Product Number */ - /* offset 3h -> Chip Revision Number */ - -#define PP_ISAIOB 0x0020 /* IO base address */ -#define PP_CS8900_ISAINT 0x0022 /* ISA interrupt select */ -#define PP_CS8900_ISADMA 0x0024 /* ISA Rec DMA channel */ -#define PP_CS8920_ISAINT 0x0370 /* ISA interrupt select */ -#define PP_CS8920_ISADMA 0x0374 /* ISA Rec DMA channel */ -#define PP_ISASOF 0x0026 /* ISA DMA offset */ -#define PP_DmaFrameCnt 0x0028 /* ISA DMA Frame count */ -#define PP_DmaByteCnt 0x002A /* ISA DMA Byte count */ -#define PP_CS8920_ISAMemB 0x0348 /* Memory base */ - -/* EEPROM data and command registers */ -#define PP_EECMD 0x0040 /* NVR Interface Command register */ -#define PP_EEData 0x0042 /* NVR Interface Data Register */ -#define PP_DebugReg 0x0044 /* Debug Register */ - -#define PP_RxCFG 0x0102 /* Rx Bus config */ -#define PP_RxCTL 0x0104 /* Receive Control Register */ -#define PP_TxCFG 0x0106 /* Transmit Config Register */ -#define PP_TxCMD 0x0108 /* Transmit Command Register */ -#define PP_BufCFG 0x010A /* Bus configuration Register */ -#define PP_LineCTL 0x0112 /* Line Config Register */ -#define PP_SelfCTL 0x0114 /* Self Command Register */ -#define PP_BusCTL 0x0116 /* ISA bus control Register */ -#define PP_TestCTL 0x0118 /* Test Register */ -#define PP_AutoNegCTL 0x011C /* Auto Negotiation Ctrl */ - -#define PP_ISQ 0x0120 /* Interrupt Status */ -#define PP_RxEvent 0x0124 /* Rx Event Register */ -#define PP_TxEvent 0x0128 /* Tx Event Register */ -#define PP_BufEvent 0x012C /* Bus Event Register */ -#define PP_RxMiss 0x0130 /* Receive Miss Count */ -#define PP_TxCol 0x0132 /* Transmit Collision Count */ -#define PP_LineST 0x0134 /* Line State Register */ -#define PP_SelfST 0x0136 /* Self State register */ -#define PP_BusST 0x0138 /* Bus Status */ -#define PP_TDR 0x013C /* Time Domain Reflectometry */ -#define PP_AutoNegST 0x013E /* Auto Neg Status */ -#define PP_TxCommand 0x0144 /* Tx Command */ -#define PP_TxLength 0x0146 /* Tx Length */ -#define PP_LAF 0x0150 /* Hash Table */ -#define PP_IA 0x0158 /* Physical Address Register */ - -#define PP_RxStatus 0x0400 /* Receive start of frame */ -#define PP_RxLength 0x0402 /* Receive Length of frame */ -#define PP_RxFrame 0x0404 /* Receive frame pointer */ -#define PP_TxFrame 0x0A00 /* Transmit frame pointer */ - -/* - * Primary I/O Base Address. If no I/O base is supplied by the user, then this - * can be used as the default I/O base to access the PacketPage Area. - */ -#define DEFAULTIOBASE 0x0300 -#define FIRST_IO 0x020C /* First I/O port to check */ -#define LAST_IO 0x037C /* Last I/O port to check (+10h) */ -#define ADD_MASK 0x3000 /* Mask it use of the ADD_PORT register */ -#define ADD_SIG 0x3000 /* Expected ID signature */ - -#define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */ - -#define PRODUCT_ID_ADD 0x0002 /* Address of product ID */ - -/* Mask to find out the types of registers */ -#define REG_TYPE_MASK 0x001F - -/* Eeprom Commands */ -#define ERSE_WR_ENBL 0x00F0 -#define ERSE_WR_DISABLE 0x0000 - -/* Defines Control/Config register quintuplet numbers */ -#define RX_BUF_CFG 0x0003 -#define RX_CONTROL 0x0005 -#define TX_CFG 0x0007 -#define TX_COMMAND 0x0009 -#define BUF_CFG 0x000B -#define LINE_CONTROL 0x0013 -#define SELF_CONTROL 0x0015 -#define BUS_CONTROL 0x0017 -#define TEST_CONTROL 0x0019 - -/* Defines Status/Count registers quintuplet numbers */ -#define RX_EVENT 0x0004 -#define TX_EVENT 0x0008 -#define BUF_EVENT 0x000C -#define RX_MISS_COUNT 0x0010 -#define TX_COL_COUNT 0x0012 -#define LINE_STATUS 0x0014 -#define SELF_STATUS 0x0016 -#define BUS_STATUS 0x0018 -#define TDR 0x001C - -/* - * PP_RxCFG - Receive Configuration and Interrupt Mask - * bit definition - Read/write - */ -#define SKIP_1 0x0040 -#define RX_STREAM_ENBL 0x0080 -#define RX_OK_ENBL 0x0100 -#define RX_DMA_ONLY 0x0200 -#define AUTO_RX_DMA 0x0400 -#define BUFFER_CRC 0x0800 -#define RX_CRC_ERROR_ENBL 0x1000 -#define RX_RUNT_ENBL 0x2000 -#define RX_EXTRA_DATA_ENBL 0x4000 - -/* PP_RxCTL - Receive Control bit definition - Read/write */ -#define RX_IA_HASH_ACCEPT 0x0040 -#define RX_PROM_ACCEPT 0x0080 -#define RX_OK_ACCEPT 0x0100 -#define RX_MULTCAST_ACCEPT 0x0200 -#define RX_IA_ACCEPT 0x0400 -#define RX_BROADCAST_ACCEPT 0x0800 -#define RX_BAD_CRC_ACCEPT 0x1000 -#define RX_RUNT_ACCEPT 0x2000 -#define RX_EXTRA_DATA_ACCEPT 0x4000 -#define RX_ALL_ACCEPT (RX_PROM_ACCEPT | RX_BAD_CRC_ACCEPT | \ - RX_RUNT_ACCEPT | RX_EXTRA_DATA_ACCEPT) -/* - * Default receive mode - individually addressed, broadcast, and error free - */ -#define RX_DEF_ACCEPT (RX_IA_ACCEPT | RX_BROADCAST_ACCEPT | RX_OK_ACCEPT) - -/* - * PP_TxCFG - Transmit Configuration Interrupt Mask - * bit definition - Read/write - */ -#define TX_LOST_CRS_ENBL 0x0040 -#define TX_SQE_ERROR_ENBL 0x0080 -#define TX_OK_ENBL 0x0100 -#define TX_LATE_COL_ENBL 0x0200 -#define TX_JBR_ENBL 0x0400 -#define TX_ANY_COL_ENBL 0x0800 -#define TX_16_COL_ENBL 0x8000 - -/* - * PP_TxCMD - Transmit Command bit definition - Read-only - */ -#define TX_START_4_BYTES 0x0000 -#define TX_START_64_BYTES 0x0040 -#define TX_START_128_BYTES 0x0080 -#define TX_START_ALL_BYTES 0x00C0 -#define TX_FORCE 0x0100 -#define TX_ONE_COL 0x0200 -#define TX_TWO_PART_DEFF_DISABLE 0x0400 -#define TX_NO_CRC 0x1000 -#define TX_RUNT 0x2000 - -/* - * PP_BufCFG - Buffer Configuration Interrupt Mask - * bit definition - Read/write - */ -#define GENERATE_SW_INTERRUPT 0x0040 -#define RX_DMA_ENBL 0x0080 -#define READY_FOR_TX_ENBL 0x0100 -#define TX_UNDERRUN_ENBL 0x0200 -#define RX_MISS_ENBL 0x0400 -#define RX_128_BYTE_ENBL 0x0800 -#define TX_COL_COUNT_OVRFLOW_ENBL 0x1000 -#define RX_MISS_COUNT_OVRFLOW_ENBL 0x2000 -#define RX_DEST_MATCH_ENBL 0x8000 - -/* - * PP_LineCTL - Line Control bit definition - Read/write - */ -#define SERIAL_RX_ON 0x0040 -#define SERIAL_TX_ON 0x0080 -#define AUI_ONLY 0x0100 -#define AUTO_AUI_10BASET 0x0200 -#define MODIFIED_BACKOFF 0x0800 -#define NO_AUTO_POLARITY 0x1000 -#define TWO_PART_DEFDIS 0x2000 -#define LOW_RX_SQUELCH 0x4000 - -/* - * PP_SelfCTL - Software Self Control bit definition - Read/write - */ -#define POWER_ON_RESET 0x0040 -#define SW_STOP 0x0100 -#define SLEEP_ON 0x0200 -#define AUTO_WAKEUP 0x0400 -#define HCB0_ENBL 0x1000 -#define HCB1_ENBL 0x2000 -#define HCB0 0x4000 -#define HCB1 0x8000 - -/* - * PP_BusCTL - ISA Bus Control bit definition - Read/write - */ -#define RESET_RX_DMA 0x0040 -#define MEMORY_ON 0x0400 -#define DMA_BURST_MODE 0x0800 -#define IO_CHANNEL_READY_ON 0x1000 -#define RX_DMA_SIZE_64Ks 0x2000 -#define ENABLE_IRQ 0x8000 - -/* - * PP_TestCTL - Test Control bit definition - Read/write - */ -#define LINK_OFF 0x0080 -#define ENDEC_LOOPBACK 0x0200 -#define AUI_LOOPBACK 0x0400 -#define BACKOFF_OFF 0x0800 -#define FAST_TEST 0x8000 - -/* - * PP_RxEvent - Receive Event Bit definition - Read-only - */ -#define RX_IA_HASHED 0x0040 -#define RX_DRIBBLE 0x0080 -#define RX_OK 0x0100 -#define RX_HASHED 0x0200 -#define RX_IA 0x0400 -#define RX_BROADCAST 0x0800 -#define RX_CRC_ERROR 0x1000 -#define RX_RUNT 0x2000 -#define RX_EXTRA_DATA 0x4000 - -#define HASH_INDEX_MASK 0x0FC00 - -/* - * PP_TxEvent - Transmit Event Bit definition - Read-only - */ -#define TX_LOST_CRS 0x0040 -#define TX_SQE_ERROR 0x0080 -#define TX_OK 0x0100 -#define TX_LATE_COL 0x0200 -#define TX_JBR 0x0400 -#define TX_16_COL 0x8000 -#define TX_SEND_OK_BITS (TX_OK | TX_LOST_CRS) -#define TX_COL_COUNT_MASK 0x7800 - -/* - * PP_BufEvent - Buffer Event Bit definition - Read-only - */ -#define SW_INTERRUPT 0x0040 -#define RX_DMA 0x0080 -#define READY_FOR_TX 0x0100 -#define TX_UNDERRUN 0x0200 -#define RX_MISS 0x0400 -#define RX_128_BYTE 0x0800 -#define TX_COL_OVRFLW 0x1000 -#define RX_MISS_OVRFLW 0x2000 -#define RX_DEST_MATCH 0x8000 - -/* - * PP_LineST - Ethernet Line Status bit definition - Read-only - */ -#define LINK_OK 0x0080 -#define AUI_ON 0x0100 -#define TENBASET_ON 0x0200 -#define POLARITY_OK 0x1000 -#define CRS_OK 0x4000 - -/* - * PP_SelfST - Chip Software Status bit definition - */ -#define ACTIVE_33V 0x0040 -#define INIT_DONE 0x0080 -#define SI_BUSY 0x0100 -#define EEPROM_PRESENT 0x0200 -#define EEPROM_OK 0x0400 -#define EL_PRESENT 0x0800 -#define EE_SIZE_64 0x1000 - -/* - * PP_BusST - ISA Bus Status bit definition - */ -#define TX_BID_ERROR 0x0080 -#define READY_FOR_TX_NOW 0x0100 - -/* - * PP_AutoNegCTL - Auto Negotiation Control bit definition - */ -#define RE_NEG_NOW 0x0040 -#define ALLOW_FDX 0x0080 -#define AUTO_NEG_ENABLE 0x0100 -#define NLP_ENABLE 0x0200 -#define FORCE_FDX 0x8000 -#define AUTO_NEG_BITS (FORCE_FDX | NLP_ENABLE | AUTO_NEG_ENABLE) -#define AUTO_NEG_MASK (FORCE_FDX | NLP_ENABLE | AUTO_NEG_ENABLE | \ - ALLOW_FDX | RE_NEG_NOW) - -/* - * PP_AutoNegST - Auto Negotiation Status bit definition - */ -#define AUTO_NEG_BUSY 0x0080 -#define FLP_LINK 0x0100 -#define FLP_LINK_GOOD 0x0800 -#define LINK_FAULT 0x1000 -#define HDX_ACTIVE 0x4000 -#define FDX_ACTIVE 0x8000 - -/* - * The following block defines the ISQ event types - */ -#define ISQ_RECEIVER_EVENT 0x04 -#define ISQ_TRANSMITTER_EVENT 0x08 -#define ISQ_BUFFER_EVENT 0x0c -#define ISQ_RX_MISS_EVENT 0x10 -#define ISQ_TX_COL_EVENT 0x12 - -#define ISQ_EVENT_MASK 0x003F /* ISQ mask to find out type of event */ -#define ISQ_HIST 16 /* small history buffer */ -#define AUTOINCREMENT 0x8000 /* Bit mask to set bit-15 for autoincrement */ - -#define TXRXBUFSIZE 0x0600 -#define RXDMABUFSIZE 0x8000 -#define RXDMASIZE 0x4000 -#define TXRX_LENGTH_MASK 0x07FF - -/* rx options bits */ -#define RCV_WITH_RXON 1 /* Set SerRx ON */ -#define RCV_COUNTS 2 /* Use Framecnt1 */ -#define RCV_PONG 4 /* Pong respondent */ -#define RCV_DONG 8 /* Dong operation */ -#define RCV_POLLING 0x10 /* Poll RxEvent */ -#define RCV_ISQ 0x20 /* Use ISQ, int */ -#define RCV_AUTO_DMA 0x100 /* Set AutoRxDMAE */ -#define RCV_DMA 0x200 /* Set RxDMA only */ -#define RCV_DMA_ALL 0x400 /* Copy all DMA'ed */ -#define RCV_FIXED_DATA 0x800 /* Every frame same */ -#define RCV_IO 0x1000 /* Use ISA IO only */ -#define RCV_MEMORY 0x2000 /* Use ISA Memory */ - -#define RAM_SIZE 0x1000 /* The card has 4k bytes or RAM */ -#define PKT_START PP_TxFrame /* Start of packet RAM */ - -#define RX_FRAME_PORT 0x0000 -#define TX_FRAME_PORT RX_FRAME_PORT -#define TX_CMD_PORT 0x0004 -#define TX_CS8900_NOW 0x0000 /* Tx packet after 5 bytes copied */ -#define TX_CS8900_AFTER_381 0x0020 /* Tx packet after 381 bytes copied */ -#define TX_CS8900_AFTER_ALL 0x0060 /* Tx packet after all bytes copied */ -#define TX_CS8920_NOW 0x0000 /* Tx packet after 5 bytes copied */ -#define TX_CS8920_AFTER_381 0x0040 /* Tx packet after 381 bytes copied */ -#define TX_CS8920_AFTER_1021 0x0080 /* Tx packet after1021 bytes copied */ -#define TX_CS8920_AFTER_ALL 0x00C0 /* Tx packet after all bytes copied */ -#define TX_LEN_PORT 0x0006 -#define ISQ_PORT 0x0008 -#define ADD_PORT 0x000A -#define DATA_PORT 0x000C - -#define EEPROM_WRITE_EN 0x00F0 -#define EEPROM_WRITE_DIS 0x0000 -#define EEPROM_WRITE_CMD 0x0100 -#define EEPROM_READ_CMD 0x0200 - -/* Receive Header - * Description of header of each packet in receive area of memory - */ -#define RBUF_EVENT_LOW 0 /* Low byte of RxEvent - status of received frame */ -#define RBUF_EVENT_HIGH 1 /* High byte of RxEvent - status of received frame */ -#define RBUF_LEN_LOW 2 /* Length of received data - low byte */ -#define RBUF_LEN_HI 3 /* Length of received data - high byte */ -#define RBUF_HEAD_LEN 4 /* Length of this header */ - -#define CHIP_READ 0x1 /* Used to mark state of the repins code (chip or dma) */ -#define DMA_READ 0x2 /* Used to mark state of the repins code (chip or dma) */ - -/* for bios scan */ -/* */ -#ifdef CSDEBUG -/* use these values for debugging bios scan */ -#define BIOS_START_SEG 0x00000 -#define BIOS_OFFSET_INC 0x0010 -#else -#define BIOS_START_SEG 0x0c000 -#define BIOS_OFFSET_INC 0x0200 -#endif - -#define BIOS_LAST_OFFSET 0x0fc00 - -/* - * Byte offsets into the EEPROM configuration buffer - */ -#define ISA_CNF_OFFSET 0x6 -#define TX_CTL_OFFSET (ISA_CNF_OFFSET + 8) /* 8900 eeprom */ -#define AUTO_NEG_CNF_OFFSET (ISA_CNF_OFFSET + 8) /* 8920 eeprom */ - -/* - * the assumption here is that the bits in the eeprom are generally - * in the same position as those in the autonegctl register. - * Of course the IMM bit is not in that register so it must be - * masked out - */ -#define EE_FORCE_FDX 0x8000 -#define EE_NLP_ENABLE 0x0200 -#define EE_AUTO_NEG_ENABLE 0x0100 -#define EE_ALLOW_FDX 0x0080 -#define EE_AUTO_NEG_CNF_MASK (EE_FORCE_FDX | EE_NLP_ENABLE | \ - EE_AUTO_NEG_ENABLE | EE_ALLOW_FDX) - -#define IMM_BIT 0x0040 /* ignore missing media */ - -#define ADAPTER_CNF_OFFSET (AUTO_NEG_CNF_OFFSET + 2) -#define A_CNF_MEDIA 0x0007 -#define A_CNF_10B_T 0x0001 -#define A_CNF_AUI 0x0002 -#define A_CNF_10B_2 0x0004 -#define A_CNF_MEDIA_TYPE 0x0060 -#define A_CNF_MEDIA_AUTO 0x0000 -#define A_CNF_MEDIA_10B_T 0x0020 -#define A_CNF_MEDIA_AUI 0x0040 -#define A_CNF_MEDIA_10B_2 0x0060 -#define A_CNF_DC_DC_POLARITY 0x0080 -#define A_CNF_NO_AUTO_POLARITY 0x2000 -#define A_CNF_LOW_RX_SQUELCH 0x4000 -#define A_CNF_EXTND_10B_2 0x8000 - -#define PACKET_PAGE_OFFSET 0x8 - -/* - * Bit definitions for the ISA configuration word from the EEPROM - */ -#define INT_NO_MASK 0x000F -#define DMA_NO_MASK 0x0070 -#define ISA_DMA_SIZE 0x0200 -#define ISA_AUTO_RxDMA 0x0400 -#define ISA_RxDMA 0x0800 -#define DMA_BURST 0x1000 -#define STREAM_TRANSFER 0x2000 -#define ANY_ISA_DMA (ISA_AUTO_RxDMA | ISA_RxDMA) - -/* DMA controller registers */ -#define DMA_BASE 0x00 /* DMA controller base */ -#define DMA_BASE_2 0x0C0 /* DMA controller base */ - -#define DMA_STAT 0x0D0 /* DMA controller status register */ -#define DMA_MASK 0x0D4 /* DMA controller mask register */ -#define DMA_MODE 0x0D6 /* DMA controller mode register */ -#define DMA_RESETFF 0x0D8 /* DMA controller first/last flip flop */ - -/* DMA data */ -#define DMA_DISABLE 0x04 /* Disable channel n */ -#define DMA_ENABLE 0x00 /* Enable channel n */ -/* Demand transfers, incr. address, auto init, writes, ch. n */ -#define DMA_RX_MODE 0x14 -/* Demand transfers, incr. address, auto init, reads, ch. n */ -#define DMA_TX_MODE 0x18 - -#define DMA_SIZE (16*1024) /* Size of dma buffer - 16k */ - -#define CS8900 0x0000 -#define CS8920 0x4000 -#define CS8920M 0x6000 -#define REVISON_BITS 0x1F00 -#define EEVER_NUMBER 0x12 -#define CHKSUM_LEN 0x14 -#define CHKSUM_VAL 0x0000 -#define START_EEPROM_DATA 0x001c /* Offset into eeprom for start of data */ -#define IRQ_MAP_EEPROM_DATA 0x0046 /* Offset into eeprom for the IRQ map */ -#define IRQ_MAP_LEN 0x0004 /* No of bytes to read for the IRQ map */ -#define PNP_IRQ_FRMT 0x0022 /* PNP small item IRQ format */ -#define CS8900_IRQ_MAP 0x1c20 /* This IRQ map is fixed */ - -#define CS8920_NO_INTS 0x0F /* Max CS8920 interrupt select # */ - -#define PNP_ADD_PORT 0x0279 -#define PNP_WRITE_PORT 0x0A79 - -#define GET_PNP_ISA_STRUCT 0x40 -#define PNP_ISA_STRUCT_LEN 0x06 -#define PNP_CSN_CNT_OFF 0x01 -#define PNP_RD_PORT_OFF 0x02 -#define PNP_FUNCTION_OK 0x00 -#define PNP_WAKE 0x03 -#define PNP_RSRC_DATA 0x04 -#define PNP_RSRC_READY 0x01 -#define PNP_STATUS 0x05 -#define PNP_ACTIVATE 0x30 -#define PNP_CNF_IO_H 0x60 -#define PNP_CNF_IO_L 0x61 -#define PNP_CNF_INT 0x70 -#define PNP_CNF_DMA 0x74 -#define PNP_CNF_MEM 0x48 - -#define BIT0 1 -#define BIT15 0x8000 - -#define CS_DUPLEX_AUTO 0 -#define CS_DUPLEX_FULL 1 -#define CS_DUPLEX_HALF 2 - -/* Device name */ -#define CS_NAME "cs" - -#define cs_readreg(iobase, portno) \ - (outw((iobase) + ADD_PORT, (portno)), \ - inw((iobase) + DATA_PORT)) -#define cs_writereg(iobase, portno, value) \ - (outw((iobase) + ADD_PORT, (portno)), \ - outw((iobase) + DATA_PORT, (value))) -#define cs_readword(iobase, portno) \ - (inw((iobase) + (portno))) -#define cs_writeword(iobase, portno, value) \ - (outw((iobase) + (portno), (value))) - -#define reset_chip(nic_addr) \ - cs_writereg(nic_addr, PP_SelfCTL, cs_readreg(ioaddr, PP_SelfCTL) | POWER_ON_RESET), \ - DELAY(30000) - -#define cs_duplex_full(sc) \ - (cs_writereg(sc->nic_addr, PP_AutoNegCTL, FORCE_FDX)) - -#define cs_duplex_half(sc) \ - (cs_writereg(sc->nic_addr, PP_AutoNegCTL, NLP_ENABLE)) - diff --git a/sys/dev/ex/if_ex_isa.c b/sys/dev/ex/if_ex_isa.c deleted file mode 100644 index 993e4eafc29dd..0000000000000 --- a/sys/dev/ex/if_ex_isa.c +++ /dev/null @@ -1,312 +0,0 @@ -/*- - * Copyright (c) 2000 Matthew N. Dodd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/socket.h> - -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_media.h> - - -#include <isa/isavar.h> -#include <isa/pnpvar.h> - -#include <dev/ex/if_exreg.h> -#include <dev/ex/if_exvar.h> - -/* Bus Front End Functions */ -static void ex_isa_identify __P((driver_t *, device_t)); -static int ex_isa_probe __P((device_t)); -static int ex_isa_attach __P((device_t)); - -#if 0 -static void ex_pnp_wakeup (void *); - -SYSINIT(ex_pnpwakeup, SI_SUB_CPU, SI_ORDER_ANY, ex_pnp_wakeup, NULL); -#endif - -static device_method_t ex_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, ex_isa_identify), - DEVMETHOD(device_probe, ex_isa_probe), - DEVMETHOD(device_attach, ex_isa_attach), - - { 0, 0 } -}; - -static driver_t ex_driver = { - "ex", - ex_methods, - sizeof(struct ex_softc), -}; - -devclass_t ex_devclass; - -DRIVER_MODULE(ex, isa, ex_driver, ex_devclass, 0, 0); - -static struct isa_pnp_id ex_ids[] = { - { 0x3110d425, NULL }, /* INT1031 */ - { 0x3010d425, NULL }, /* INT1030 */ - { 0, NULL }, -}; - -#if 0 -#define EX_PNP_WAKE 0x279 - -static u_int8_t ex_pnp_wake_seq[] = - { 0x6A, 0xB5, 0xDA, 0xED, 0xF6, 0xFB, 0x7D, 0xBE, - 0xDF, 0x6F, 0x37, 0x1B, 0x0D, 0x86, 0xC3, 0x61, - 0xB0, 0x58, 0x2C, 0x16, 0x8B, 0x45, 0xA2, 0xD1, - 0xE8, 0x74, 0x3A, 0x9D, 0xCE, 0xE7, 0x73, 0x43 }; - -static void -ex_pnp_wakeup (void * dummy) -{ - int tmp; - - if (bootverbose) - printf("ex_pnp_wakeup()\n"); - - outb(EX_PNP_WAKE, 0); - outb(EX_PNP_WAKE, 0); - for (tmp = 0; tmp < 32; tmp++) { - outb(EX_PNP_WAKE, ex_pnp_wake_seq[tmp]); - } -} -#endif - -/* - * Non-destructive identify. - */ -static void -ex_isa_identify (driver_t *driver, device_t parent) -{ - device_t child; - u_int32_t ioport; - u_char enaddr[6]; - u_int irq; - int tmp; - const char * desc; - - if (bootverbose) - printf("ex_isa_identify()\n"); - - for (ioport = 0x200; ioport < 0x3a0; ioport += 0x10) { - - /* No board found at address */ - if (!look_for_card(ioport)) { - continue; - } - - if (bootverbose) - printf("ex: Found card at 0x%03x!\n", ioport); - - /* Board in PnP mode */ - if (eeprom_read(ioport, EE_W0) & EE_W0_PNP) { - /* Reset the card. */ - outb(ioport + CMD_REG, Reset_CMD); - DELAY(500); - if (bootverbose) - printf("ex: card at 0x%03x in PnP mode!\n", ioport); - continue; - } - - bzero(enaddr, sizeof(enaddr)); - - /* Reset the card. */ - outb(ioport + CMD_REG, Reset_CMD); - DELAY(400); - - ex_get_address(ioport, enaddr); - tmp = eeprom_read(ioport, EE_W1) & EE_W1_INT_SEL; - - /* work out which set of irq <-> internal tables to use */ - if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) { - irq = plus_ee2irqmap[tmp]; - desc = "Intel Pro/10+"; - } else { - irq = ee2irqmap[tmp]; - desc = "Intel Pro/10"; - } - - child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ex", -1); - device_set_desc_copy(child, desc); - device_set_driver(child, driver); - bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1); - bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EX_IOSIZE); - - if (bootverbose) - printf("ex: Adding board at 0x%03x, irq %d\n", ioport, irq); - } - - return; -} - -static int -ex_isa_probe(device_t dev) -{ - u_int iobase; - u_int irq; - char * irq2ee; - u_char * ee2irq; - u_char enaddr[6]; - int tmp; - int error; - - /* Check isapnp ids */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, ex_ids); - - /* If the card had a PnP ID that didn't match any we know about */ - if (error == ENXIO) { - return(error); - } - - /* If we had some other problem. */ - if (!(error == 0 || error == ENOENT)) { - return(error); - } - - iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0); - if (!iobase) { - printf("ex: no iobase?\n"); - return(ENXIO); - } - - if (!look_for_card(iobase)) { - printf("ex: no card found at 0x%03x\n", iobase); - return(ENXIO); - } - - if (bootverbose) - printf("ex: ex_isa_probe() found card at 0x%03x\n", iobase); - - /* - * Reset the card. - */ - outb(iobase + CMD_REG, Reset_CMD); - DELAY(800); - - ex_get_address(iobase, enaddr); - - /* work out which set of irq <-> internal tables to use */ - if (ex_card_type(enaddr) == CARD_TYPE_EX_10_PLUS) { - irq2ee = plus_irq2eemap; - ee2irq = plus_ee2irqmap; - } else { - irq2ee = irq2eemap; - ee2irq = ee2irqmap; - } - - tmp = eeprom_read(iobase, EE_W1) & EE_W1_INT_SEL; - irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0); - - if (irq > 0) { - /* This will happen if board is in PnP mode. */ - if (ee2irq[tmp] != irq) { - printf("ex: WARNING: board's EEPROM is configured" - " for IRQ %d, using %d\n", - ee2irq[tmp], irq); - } - } else { - irq = ee2irq[tmp]; - bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); - } - - if (irq == 0) { - printf("ex: invalid IRQ.\n"); - return(ENXIO); - } - - return(0); -} - -static int -ex_isa_attach(device_t dev) -{ - struct ex_softc * sc = device_get_softc(dev); - int error = 0; - u_int16_t temp; - - sc->dev = dev; - sc->ioport_rid = 0; - sc->irq_rid = 0; - - if ((error = ex_alloc_resources(dev)) != 0) { - device_printf(dev, "ex_alloc_resources() failed!\n"); - goto bad; - } - - /* - * Fill in several fields of the softc structure: - * - I/O base address. - * - Hardware Ethernet address. - * - IRQ number (if not supplied in config file, read it from EEPROM). - * - Connector type. - */ - sc->iobase = rman_get_start(sc->ioport); - sc->irq_no = rman_get_start(sc->irq); - - ex_get_address(sc->iobase, sc->arpcom.ac_enaddr); - - temp = eeprom_read(sc->iobase, EE_W0); - device_printf(sc->dev, "%s config, %s bus, ", - (temp & EE_W0_PNP) ? "PnP" : "Manual", - (temp & EE_W0_BUS16) ? "16-bit" : "8-bit"); - - temp = eeprom_read(sc->iobase, EE_W6); - printf("board id 0x%03x, stepping 0x%01x\n", - (temp & EE_W6_BOARD_MASK) >> EE_W6_BOARD_SHIFT, - temp & EE_W6_STEP_MASK); - - if ((error = ex_attach(dev)) != 0) { - device_printf(dev, "ex_attach() failed!\n"); - goto bad; - } - - error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, - ex_intr, (void *)sc, &sc->ih); - if (error) { - device_printf(dev, "bus_setup_intr() failed!\n"); - goto bad; - } - - return(0); -bad: - ex_release_resources(dev); - return (error); -} diff --git a/sys/dev/ex/if_ex_pccard.c b/sys/dev/ex/if_ex_pccard.c deleted file mode 100644 index 5b7f6ff318e5a..0000000000000 --- a/sys/dev/ex/if_ex_pccard.c +++ /dev/null @@ -1,162 +0,0 @@ -/*- - * Copyright (c) 2000 Mitsuru IWASAKI - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/socket.h> - -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - -#include <net/if.h> -#include <net/if_arp.h> -#include <net/if_media.h> - - -#include <dev/ex/if_exreg.h> -#include <dev/ex/if_exvar.h> - -#include <dev/pccard/pccardvar.h> - -/* Bus Front End Functions */ -static int ex_pccard_probe __P((device_t)); -static int ex_pccard_attach __P((device_t)); -static int ex_pccard_detach __P((device_t)); - -static device_method_t ex_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ex_pccard_probe), - DEVMETHOD(device_attach, ex_pccard_attach), - DEVMETHOD(device_detach, ex_pccard_detach), - - { 0, 0 } -}; - -static driver_t ex_pccard_driver = { - "ex", - ex_pccard_methods, - sizeof(struct ex_softc), -}; - -extern devclass_t ex_devclass; - -DRIVER_MODULE(ex, pccard, ex_pccard_driver, ex_devclass, 0, 0); - -static int -ex_pccard_probe(device_t dev) -{ - u_int iobase; - u_int irq; - - iobase = bus_get_resource_start(dev, SYS_RES_IOPORT, 0); - if (!iobase) { - printf("ex: no iobase?\n"); - return(ENXIO); - } - - if (bootverbose) - printf("ex: ex_pccard_probe() found card at 0x%03x\n", iobase); - - irq = bus_get_resource_start(dev, SYS_RES_IRQ, 0); - - if (irq == 0) { - printf("ex: invalid IRQ.\n"); - return(ENXIO); - } - - return(0); -} - -static int -ex_pccard_attach(device_t dev) -{ - struct ex_softc * sc = device_get_softc(dev); - int error = 0; - int i; - u_char sum; - u_char ether_addr[ETHER_ADDR_LEN]; - - sc->dev = dev; - sc->ioport_rid = 0; - sc->irq_rid = 0; - - if ((error = ex_alloc_resources(dev)) != 0) { - device_printf(dev, "ex_alloc_resources() failed!\n"); - goto bad; - } - - /* - * Fill in several fields of the softc structure: - * - I/O base address. - * - Hardware Ethernet address. - * - IRQ number. - */ - sc->iobase = rman_get_start(sc->ioport); - sc->irq_no = rman_get_start(sc->irq); - - pccard_get_ether(dev, ether_addr); - for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++) - sum |= ether_addr[i]; - if (sum) - bcopy(ether_addr, sc->arpcom.ac_enaddr, ETHER_ADDR_LEN); - - if ((error = ex_attach(dev)) != 0) { - device_printf(dev, "ex_attach() failed!\n"); - goto bad; - } - - error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, - ex_intr, (void *)sc, &sc->ih); - if (error) { - device_printf(dev, "bus_setup_intr() failed!\n"); - goto bad; - } - - return(0); -bad: - ex_release_resources(dev); - return (error); -} - -static int -ex_pccard_detach(device_t dev) -{ - struct ex_softc *sc = device_get_softc(dev); - struct ifnet *ifp = &sc->arpcom.ac_if; - - ex_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; - if_detach(ifp); - ex_release_resources(dev); - return (0); -} diff --git a/sys/dev/ic/hd64570.h b/sys/dev/ic/hd64570.h deleted file mode 100644 index b676e25a9cd5c..0000000000000 --- a/sys/dev/ic/hd64570.h +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 1995 John Hay. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by [your name] - * and [any other names deserving credit ] - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY [your name] AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ -#ifndef _HD64570_H_ -#define _HD64570_H_ - -typedef struct msci_channel - { - union - { - unsigned short us_trb; /* rw */ - struct - { - unsigned char uc_trbl; - unsigned char uc_trbh; - }uc_trb; - }u_trb; - unsigned char st0; /* ro */ - unsigned char st1; /* rw */ - unsigned char st2; /* rw */ - unsigned char st3; /* ro */ - unsigned char fst; /* rw */ - unsigned char unused0; - unsigned char ie0; /* rw */ - unsigned char ie1; /* rw */ - unsigned char ie2; /* rw */ - unsigned char fie; /* rw */ - unsigned char cmd; /* wo */ - unsigned char unused1; - unsigned char md0; /* rw */ - unsigned char md1; /* rw */ - unsigned char md2; /* rw */ - unsigned char ctl; /* rw */ - unsigned char sa0; /* rw */ - unsigned char sa1; /* rw */ - unsigned char idl; /* rw */ - unsigned char tmc; /* rw */ - unsigned char rxs; /* rw */ - unsigned char txs; /* rw */ - unsigned char trc0; /* rw */ - unsigned char trc1; /* rw */ - unsigned char rrc; /* rw */ - unsigned char unused2; - unsigned char cst0; /* rw */ - unsigned char cst1; /* rw */ - unsigned char unused3[2]; - }msci_channel; - -#define trb u_trb.us_trb -#define trbl u_trb.uc_trb.uc_trbl -#define trbh u_trb.uc_trb.uc_trbh - -typedef struct timer_channel - { - unsigned short tcnt; /* rw */ - unsigned short tconr; /* wo */ - unsigned char tcsr; /* rw */ - unsigned char tepr; /* rw */ - unsigned char unused[2]; - }timer_channel; - -typedef struct dmac_channel - { - unsigned short dar; /* rw */ - unsigned char darb; /* rw */ - unsigned char unused0; - unsigned short sar; /* rw On odd numbered dmacs (tx) only */ - unsigned char sarb; /* rw */ -#define cpb sarb - unsigned char unused1; - unsigned short cda; /* rw */ - unsigned short eda; /* rw */ - unsigned short bfl; /* rw On even numbered dmacs (rx) only */ - unsigned short bcr; /* rw */ - unsigned char dsr; /* rw */ - unsigned char dmr; /* rw */ - unsigned char unused2; - unsigned char fct; /* rw */ - unsigned char dir; /* rw */ - unsigned char dcr; /* rw */ - unsigned char unused3[10]; - }dmac_channel; - -/* x is the channel number. rx channels are even numbered and tx, odd. */ -#define DMAC_RXCH(x) ((x*2) + 0) -#define DMAC_TXCH(x) ((x*2) + 1) - -typedef struct sca_regs - { - unsigned char lpr; /* rw */ - unsigned char unused0; /* -- */ - /* Wait system */ - unsigned char pabr0; /* rw */ - unsigned char pabr1; /* rw */ - unsigned char wcrl; /* rw */ - unsigned char wcrm; /* rw */ - unsigned char wcrh; /* rw */ - unsigned char unused1; - /* DMAC */ - unsigned char pcr; /* rw */ - unsigned char dmer; /* rw */ - unsigned char unused2[6]; - /* Interrupt */ - unsigned char isr0; /* ro */ - unsigned char isr1; /* ro */ - unsigned char isr2; /* ro */ - unsigned char unused3; - unsigned char ier0; /* rw */ - unsigned char ier1; /* rw */ - unsigned char ier2; /* rw */ - unsigned char unused4; - unsigned char itcr; /* rw */ - unsigned char unused5; - unsigned char ivr; /* rw */ - unsigned char unused6; - unsigned char imvr; /* rw */ - unsigned char unused7[3]; - /* MSCI Channel 0 */ - msci_channel msci[2]; - timer_channel timer[4]; - dmac_channel dmac[4]; - }sca_regs; - -#define SCA_CMD_TXRESET 0x01 -#define SCA_CMD_TXENABLE 0x02 -#define SCA_CMD_TXDISABLE 0x03 -#define SCA_CMD_TXCRCINIT 0x04 -#define SCA_CMD_TXCRCEXCL 0x05 -#define SCA_CMS_TXEOM 0x06 -#define SCA_CMD_TXABORT 0x07 -#define SCA_CMD_MPON 0x08 -#define SCA_CMD_TXBCLEAR 0x09 - -#define SCA_CMD_RXRESET 0x11 -#define SCA_CMD_RXENABLE 0x12 -#define SCA_CMD_RXDISABLE 0x13 -#define SCA_CMD_RXCRCINIT 0x14 -#define SCA_CMD_RXMSGREJ 0x15 -#define SCA_CMD_MPSEARCH 0x16 -#define SCA_CMD_RXCRCEXCL 0x17 -#define SCA_CMD_RXCRCCALC 0x18 - -#define SCA_CMD_NOP 0x00 -#define SCA_CMD_RESET 0x21 -#define SCA_CMD_SEARCH 0x31 - -#define SCA_MD0_CRC_1 0x01 -#define SCA_MD0_CRC_CCITT 0x02 -#define SCA_MD0_CRC_ENABLE 0x04 -#define SCA_MD0_AUTO_ENABLE 0x10 -#define SCA_MD0_MODE_ASYNC 0x00 -#define SCA_MD0_MODE_BYTESYNC1 0x20 -#define SCA_MD0_MODE_BISYNC 0x40 -#define SCA_MD0_MODE_BYTESYNC2 0x60 -#define SCA_MD0_MODE_HDLC 0x80 - -#define SCA_MD1_NOADDRCHK 0x00 -#define SCA_MD1_SNGLADDR1 0x40 -#define SCA_MD1_SNGLADDR2 0x80 -#define SCA_MD1_DUALADDR 0xC0 - -#define SCA_MD2_DUPLEX 0x00 -#define SCA_MD2_ECHO 0x01 -#define SCA_MD2_LOOPBACK 0x03 -#define SCA_MD2_ADPLLx8 0x00 -#define SCA_MD2_ADPLLx16 0x08 -#define SCA_MD2_ADPLLx32 0x10 -#define SCA_MD2_NRZ 0x00 -#define SCA_MD2_NRZI 0x20 -#define SCA_MD2_MANCHESTER 0x80 -#define SCA_MD2_FM0 0xC0 -#define SCA_MD2_FM1 0xA0 - -#define SCA_CTL_RTS 0x01 -#define SCA_CTL_IDLPAT 0x10 -#define SCA_CTL_UDRNC 0x20 - -#define SCA_RXS_DIV_MASK 0x0F -#define SCA_RXS_DIV1 0x00 -#define SCA_RXS_DIV2 0x01 -#define SCA_RXS_DIV4 0x02 -#define SCA_RXS_DIV8 0x03 -#define SCA_RXS_DIV16 0x04 -#define SCA_RXS_DIV32 0x05 -#define SCA_RXS_DIV64 0x06 -#define SCA_RXS_DIV128 0x07 -#define SCA_RXS_DIV256 0x08 -#define SCA_RXS_DIV512 0x09 -#define SCA_RXS_CLK_RXC0 0x00 -#define SCA_RXS_CLK_RXC1 0x20 -#define SCA_RXS_CLK_INT 0x40 -#define SCA_RXS_CLK_ADPLL_OUT 0x60 -#define SCA_RXS_CLK_ADPLL_IN 0x70 - -#define SCA_TXS_DIV_MASK 0x0F -#define SCA_TXS_DIV1 0x00 -#define SCA_TXS_DIV2 0x01 -#define SCA_TXS_DIV4 0x02 -#define SCA_TXS_DIV8 0x03 -#define SCA_TXS_DIV16 0x04 -#define SCA_TXS_DIV32 0x05 -#define SCA_TXS_DIV64 0x06 -#define SCA_TXS_DIV128 0x07 -#define SCA_TXS_DIV256 0x08 -#define SCA_TXS_DIV512 0x09 -#define SCA_TXS_CLK_TXC 0x00 -#define SCA_TXS_CLK_INT 0x40 -#define SCA_TXS_CLK_RX 0x60 - -#define SCA_ST0_RXRDY 0x01 -#define SCA_ST0_TXRDY 0x02 -#define SCA_ST0_RXINT 0x40 -#define SCA_ST0_TXINT 0x80 - -#define SCA_ST1_IDLST 0x01 -#define SCA_ST1_ABTST 0x02 -#define SCA_ST1_DCDCHG 0x04 -#define SCA_ST1_CTSCHG 0x08 -#define SCA_ST1_FLAG 0x10 -#define SCA_ST1_TXIDL 0x40 -#define SCA_ST1_UDRN 0x80 - -/* ST2 and FST look the same */ -#define SCA_FST_CRCERR 0x04 -#define SCA_FST_OVRN 0x08 -#define SCA_FST_RESFRM 0x10 -#define SCA_FST_ABRT 0x20 -#define SCA_FST_SHRT 0x40 -#define SCA_FST_EOM 0x80 - -#define SCA_ST3_RXENA 0x01 -#define SCA_ST3_TXENA 0x02 -#define SCA_ST3_DCD 0x04 -#define SCA_ST3_CTS 0x08 -#define SCA_ST3_ADPLLSRCH 0x10 -#define SCA_ST3_TXDATA 0x20 - -#define SCA_FIE_EOMFE 0x80 - -#define SCA_IE0_RXRDY 0x01 -#define SCA_IE0_TXRDY 0x02 -#define SCA_IE0_RXINT 0x40 -#define SCA_IE0_TXINT 0x80 - -#define SCA_IE1_IDLDE 0x01 -#define SCA_IE1_ABTDE 0x02 -#define SCA_IE1_DCD 0x04 -#define SCA_IE1_CTS 0x08 -#define SCA_IE1_FLAG 0x10 -#define SCA_IE1_IDL 0x40 -#define SCA_IE1_UDRN 0x80 - -#define SCA_IE2_CRCERR 0x04 -#define SCA_IE2_OVRN 0x08 -#define SCA_IE2_RESFRM 0x10 -#define SCA_IE2_ABRT 0x20 -#define SCA_IE2_SHRT 0x40 -#define SCA_IE2_EOM 0x80 - -/* This is for RRC, TRC0 and TRC1. */ -#define SCA_RCR_MASK 0x1F - -#define SCA_IE1_ - -#define SCA_IV_CHAN0 0x00 -#define SCA_IV_CHAN1 0x20 - -#define SCA_IV_RXRDY 0x04 -#define SCA_IV_TXRDY 0x06 -#define SCA_IV_RXINT 0x08 -#define SCA_IV_TXINT 0x0A - -#define SCA_IV_DMACH0 0x00 -#define SCA_IV_DMACH1 0x08 -#define SCA_IV_DMACH2 0x20 -#define SCA_IV_DMACH3 0x28 - -#define SCA_IV_DMIA 0x14 -#define SCA_IV_DMIB 0x16 - -#define SCA_IV_TIMER0 0x1C -#define SCA_IV_TIMER1 0x1E -#define SCA_IV_TIMER2 0x3C -#define SCA_IV_TIMER3 0x3E - -/* - * DMA registers - */ -#define SCA_DSR_EOT 0x80 -#define SCA_DSR_EOM 0x40 -#define SCA_DSR_BOF 0x20 -#define SCA_DSR_COF 0x10 -#define SCA_DSR_DE 0x02 -#define SCA_DSR_DWE 0x01 - -#define SCA_DMR_TMOD 0x10 -#define SCA_DMR_NF 0x04 -#define SCA_DMR_CNTE 0x02 - -#define SCA_DMER_EN 0x80 - -#define SCA_DCR_ABRT 0x01 -#define SCA_DCR_FCCLR 0x02 /* Clear frame end intr counter */ - -#define SCA_DIR_EOT 0x80 -#define SCA_DIR_EOM 0x40 -#define SCA_DIR_BOF 0x20 -#define SCA_DIR_COF 0x10 - -#define SCA_PCR_BRC 0x10 -#define SCA_PCR_CCC 0x08 -#define SCA_PCR_PR2 0x04 -#define SCA_PCR_PR1 0x02 -#define SCA_PCR_PR0 0x01 - -typedef struct sca_descriptor - { - unsigned short cp; - unsigned short bp; - unsigned char bpb; - unsigned char unused0; - unsigned short len; - unsigned char stat; - unsigned char unused1; - }sca_descriptor; - -#define SCA_DESC_EOT 0x01 -#define SCA_DESC_CRC 0x04 -#define SCA_DESC_OVRN 0x08 -#define SCA_DESC_RESD 0x10 -#define SCA_DESC_ABORT 0x20 -#define SCA_DESC_SHRTFRM 0x40 -#define SCA_DESC_EOM 0x80 -#define SCA_DESC_ERRORS 0x7C - -/* -*************************************************************************** -** END -*************************************************************************** -**/ -#endif /* _HD64570_H_ */ - diff --git a/sys/dev/mii/tdkphyreg.h b/sys/dev/mii/tdkphyreg.h deleted file mode 100644 index 1f106251b607a..0000000000000 --- a/sys/dev/mii/tdkphyreg.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2000,2001 Jonathan Chen. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Register definitions for TDK 78Q2120 - */ - -#ifndef _DEV_MII_TDKPHYREG_H_ -#define _DEV_MII_TDKPHYREG_H_ - -#define MII_VENDOR 16 -#define VENDOR_RXCC 0x0001 -#define VENDOR_PCSBP 0x0002 -#define VENDOR_RVSPOL 0x0010 -#define VENDOR_NOAPOL 0x0020 -#define VENDOR_GPIO0DIR 0x0040 -#define VENDOR_GPIO0DAT 0x0080 -#define VENDOR_GPIO1DIR 0x0100 -#define VENDOR_GPIO1DAT 0x0200 -#define VENDOR_10BTLOOP 0x0400 -#define VENDOR_NOSQE 0x0800 -#define VENDOR_TXHIM 0x1000 -#define VENDOR_INTLVL 0x4000 -#define VENDOR_RPTR 0x8000 - -#define MII_INT 17 -#define INT_STAT_MASK 0x00ff -#define INT_STAT_ACOMP 0x0001 -#define INT_STAT_RFAULT 0x0002 -#define INT_STAT_LSCHG 0x0004 -#define INT_STAT_LPACK 0x0008 -#define INT_STAT_PDF 0x0010 -#define INT_STAT_PRX 0x0020 -#define INT_STAT_RXERR 0x0040 -#define INT_STAT_JABBER 0x0080 -#define INT_CTRL_MASK 0xff00 -#define INT_CTRL_ACOMP 0x0100 -#define INT_CTRL_RFAULT 0x0200 -#define INT_CTRL_LSCHG 0x0400 -#define INT_CTRL_LPACK 0x0800 -#define INT_CTRL_PDF 0x1000 -#define INT_CTRL_PRX 0x2000 -#define INT_CTRL_RXERR 0x4000 -#define INT_CTRL_JABBER 0x8000 - - -#define MII_DIAG 18 -#define DIAG_RLOCK 0x0100 -#define DIAG_RPASS 0x0200 -#define DIAG_RATE_100 0x0400 -#define DIAG_DUPLEX 0x0800 -#define DIAG_NEGFAIL 0x1000 - - -#endif diff --git a/sys/dev/ray/if_raydbg.h b/sys/dev/ray/if_raydbg.h deleted file mode 100644 index 7dc255d49604a..0000000000000 --- a/sys/dev/ray/if_raydbg.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2000 - * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * - */ - -/* - * Debugging odds and odds - */ - -/* - * RAY_DEBUG settings - * - * RECERR Recoverable error's, deprecated use RAY_RECERR macro - * SUBR Subroutine entry - * BOOTPARAM Startup CM dump - * STARTJOIN State transitions for start/join - * CCS CCS info - * IOCTL IOCTL calls - * MBUF MBUFs dumped - needs one of TX, RX, MGT, or CTL - * RX packet types reported - * CM common memory re-mapping - * COM new command sleep/wakeup - * STOP driver detaching - * CTL CTL packets - * MGT MGT packets - * TX TX routine info - * DCOM dump comq entries - */ -#define RAY_DBG_RECERR 0x0001 -#define RAY_DBG_SUBR 0x0002 -#define RAY_DBG_BOOTPARAM 0x0004 -#define RAY_DBG_STARTJOIN 0x0008 -#define RAY_DBG_CCS 0x0010 -#define RAY_DBG_IOCTL 0x0020 -#define RAY_DBG_MBUF 0x0080 -#define RAY_DBG_RX 0x0100 -#define RAY_DBG_CM 0x0200 -#define RAY_DBG_COM 0x0400 -#define RAY_DBG_STOP 0x0800 -#define RAY_DBG_CTL 0x1000 -#define RAY_DBG_MGT 0x2000 -#define RAY_DBG_TX 0x4000 -#define RAY_DBG_DCOM 0x8000 -/* Cut and paste this into a kernel configuration file */ -#if 0 -#define RAY_DEBUG ( \ - /* RAY_DBG_SUBR | */ \ - /* RAY_DBG_BOOTPARAM | */ \ - /* RAY_DBG_STARTJOIN | */ \ - /* RAY_DBG_CCS | */ \ - /* RAY_DBG_IOCTL | */ \ - /* RAY_DBG_MBUF | */ \ - /* RAY_DBG_RX | */ \ - /* RAY_DBG_CM | */ \ - /* RAY_DBG_COM | */ \ - /* RAY_DBG_STOP | */ \ - /* RAY_DBG_CTL | */ \ - /* RAY_DBG_MGT | */ \ - /* RAY_DBG_TX | */ \ - /* RAY_DBG_DCOM | */ \ - 0 \ - ) -#endif - -#if RAY_DEBUG - -#define RAY_DPRINTF(sc, mask, fmt, args...) do {if (RAY_DEBUG & (mask)) {\ - device_printf((sc)->dev, "%s(%d) " fmt "\n", \ - __FUNCTION__ , __LINE__ , ##args); \ -} } while (0) - -/* This macro assumes that common memory is mapped into kernel space */ -#define RAY_DHEX8(sc, mask, off, len, s) do { if (RAY_DEBUG & (mask)) { \ - int i, j; \ - device_printf((sc)->dev, "%s(%d) %s\n", \ - __FUNCTION__ , __LINE__ , (s)); \ - for (i = (off); i < (off)+(len); i += 8) { \ - printf(". 0x%04x ", i); \ - for (j = 0; j < 8; j++) \ - printf("%02x ", SRAM_READ_1((sc), i+j)); \ - printf("\n"); \ - } \ -} } while (0) - -#define RAY_DCOM(sc, mask, com, s) do { if (RAY_DEBUG & (mask)) { \ - device_printf((sc)->dev, "%s(%d) %s com entry 0x%p\n", \ - __FUNCTION__ , __LINE__ , (s) , (com)); \ - printf(". c_mesg %s\n", (com)->c_mesg); \ - printf(". c_flags 0x%b\n", (com)->c_flags, RAY_COM_FLAGS_PRINTFB); \ - printf(". c_retval 0x%x\n", (com)->c_retval); \ - printf(". c_ccs 0x%0x index 0x%02x\n", \ - (com)->c_ccs, RAY_CCS_INDEX((com)->c_ccs)); \ -} } while (0) - -#else -#define RAY_DPRINTF(sc, mask, fmt, args...) -#define RAY_DHEX8(sc, mask, off, len, s) -#define RAY_DCOM(sc, mask, com, s) -#endif /* RAY_DEBUG > 0 */ - -/* - * These override macros defined in if_ray.c to turn them into - * debugging ones. - */ -#if RAY_DEBUG & RAY_DBG_COM - -#define RAY_COM_CHECK(sc, com) do { if (RAY_DEBUG & RAY_DBG_COM) { \ - ray_com_ecf_check((sc), (com), __FUNCTION__ ); \ -} } while (0) - -#endif /* RAY_DEBUG & RAY_DBG_COM */ - -#if RAY_DEBUG & RAY_DBG_MBUF -#define RAY_MBUF_DUMP(sc, mask, m, s) do { if (RAY_DEBUG & (mask)) { \ - ray_dump_mbuf((sc), (m), (s)); \ -} } while (0) -#endif /* RAY_DEBUG & RAY_DBG_MBUF */ diff --git a/sys/dev/ray/if_raymib.h b/sys/dev/ray/if_raymib.h deleted file mode 100644 index 77297869b9e27..0000000000000 --- a/sys/dev/ray/if_raymib.h +++ /dev/null @@ -1,1100 +0,0 @@ -/* - * Copyright (C) 2000 - * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * - */ - -/* - * Bit mask definitions for firmware versioning - */ -#define RAY_V4 0x1 -#define RAY_V5 0x2 - -/* - * MIB stuctures - */ -struct ray_mib_common_head { /*Offset*/ /*Size*/ - u_int8_t mib_net_type; /*00*/ - u_int8_t mib_ap_status; /*01*/ - u_int8_t mib_ssid[IEEE80211_NWID_LEN]; /*02*/ /*20*/ - u_int8_t mib_scan_mode; /*22*/ - u_int8_t mib_apm_mode; /*23*/ - u_int8_t mib_mac_addr[ETHER_ADDR_LEN]; /*24*/ /*06*/ - u_int8_t mib_frag_thresh[2]; /*2a*/ /*02*/ - u_int8_t mib_dwell_time[2]; /*2c*/ /*02*/ - u_int8_t mib_beacon_period[2]; /*2e*/ /*02*/ - u_int8_t mib_dtim_interval; /*30*/ - u_int8_t mib_max_retry; /*31*/ - u_int8_t mib_ack_timo; /*32*/ - u_int8_t mib_sifs; /*33*/ - u_int8_t mib_difs; /*34*/ - u_int8_t mib_pifs; /*35*/ - u_int8_t mib_rts_thresh[2]; /*36*/ /*02*/ - u_int8_t mib_scan_dwell[2]; /*38*/ /*02*/ - u_int8_t mib_scan_max_dwell[2]; /*3a*/ /*02*/ - u_int8_t mib_assoc_timo; /*3c*/ - u_int8_t mib_adhoc_scan_cycle; /*3d*/ - u_int8_t mib_infra_scan_cycle; /*3e*/ - u_int8_t mib_infra_super_scan_cycle; /*3f*/ - u_int8_t mib_promisc; /*40*/ - u_int8_t mib_uniq_word[2]; /*41*/ /*02*/ - u_int8_t mib_slot_time; /*43*/ - u_int8_t mib_roam_low_snr_thresh; /*44*/ - u_int8_t mib_low_snr_count; /*45*/ - u_int8_t mib_infra_missed_beacon_count; /*46*/ - u_int8_t mib_adhoc_missed_beacon_count; /*47*/ - u_int8_t mib_country_code; /*48*/ - u_int8_t mib_hop_seq; /*49*/ - u_int8_t mib_hop_seq_len; /*4a*/ -} __attribute__((__packed__)); - -struct ray_mib_common_tail { - u_int8_t mib_noise_filter_gain; /*00*/ - u_int8_t mib_noise_limit_offset; /*01*/ - u_int8_t mib_rssi_thresh_offset; /*02*/ - u_int8_t mib_busy_thresh_offset; /*03*/ - u_int8_t mib_sync_thresh; /*04*/ - u_int8_t mib_test_mode; /*05*/ - u_int8_t mib_test_min_chan; /*06*/ - u_int8_t mib_test_max_chan; /*07*/ -} __attribute__((__packed__)); - -struct ray_mib_4 { - struct ray_mib_common_head mib_head; /*00*/ - u_int8_t mib_cw_max; /*4b*/ - u_int8_t mib_cw_min; /*4c*/ - struct ray_mib_common_tail mib_tail; /*4d*/ -} __attribute__((__packed__)); - -struct ray_mib_5 { - struct ray_mib_common_head mib_head; /*00*/ - u_int8_t mib_cw_max[2]; /*4b*/ /*02*/ - u_int8_t mib_cw_min[2]; /*4d*/ /*02*/ - struct ray_mib_common_tail mib_tail; /*4f*/ - u_int8_t mib_allow_probe_resp; /*57*/ - u_int8_t mib_privacy_must_start; /*58*/ - u_int8_t mib_privacy_can_join; /*59*/ - u_int8_t mib_basic_rate_set[8]; /*5a*/ /*08*/ -} __attribute__((__packed__)); - -#define mib_net_type mib_head.mib_net_type -#define mib_ap_status mib_head.mib_ap_status -#define mib_ssid mib_head.mib_ssid -#define mib_scan_mode mib_head.mib_scan_mode -#define mib_apm_mode mib_head.mib_apm_mode -#define mib_mac_addr mib_head.mib_mac_addr -#define mib_frag_thresh mib_head.mib_frag_thresh -#define mib_dwell_time mib_head.mib_dwell_time -#define mib_beacon_period mib_head.mib_beacon_period -#define mib_dtim_interval mib_head.mib_dtim_interval -#define mib_max_retry mib_head.mib_max_retry -#define mib_ack_timo mib_head.mib_ack_timo -#define mib_sifs mib_head.mib_sifs -#define mib_difs mib_head.mib_difs -#define mib_pifs mib_head.mib_pifs -#define mib_rts_thresh mib_head.mib_rts_thresh -#define mib_scan_dwell mib_head.mib_scan_dwell -#define mib_scan_max_dwell mib_head.mib_scan_max_dwell -#define mib_assoc_timo mib_head.mib_assoc_timo -#define mib_adhoc_scan_cycle mib_head.mib_adhoc_scan_cycle -#define mib_infra_scan_cycle mib_head.mib_infra_scan_cycle -#define mib_infra_super_scan_cycle \ - mib_head.mib_infra_super_scan_cycle -#define mib_promisc mib_head.mib_promisc -#define mib_uniq_word mib_head.mib_uniq_word -#define mib_slot_time mib_head.mib_slot_time -#define mib_roam_low_snr_thresh mib_head.mib_roam_low_snr_thresh -#define mib_low_snr_count mib_head.mib_low_snr_count -#define mib_infra_missed_beacon_count \ - mib_head.mib_infra_missed_beacon_count -#define mib_adhoc_missed_beacon_count \ - mib_head.mib_adhoc_missed_beacon_count -#define mib_country_code mib_head.mib_country_code -#define mib_hop_seq mib_head.mib_hop_seq -#define mib_hop_seq_len mib_head.mib_hop_seq_len - -#define mib_noise_filter_gain mib_tail.mib_noise_filter_gain -#define mib_noise_limit_offset mib_tail.mib_noise_limit_offset -#define mib_rssi_thresh_offset mib_tail.mib_rssi_thresh_offset -#define mib_busy_thresh_offset mib_tail.mib_busy_thresh_offset -#define mib_sync_thresh mib_tail.mib_sync_thresh -#define mib_test_mode mib_tail.mib_test_mode -#define mib_test_min_chan mib_tail.mib_test_min_chan -#define mib_test_max_chan mib_tail.mib_test_max_chan - -/* - * MIB IDs for the update/report param commands - */ -#define RAY_MIB_NET_TYPE 0 -#define RAY_MIB_AP_STATUS 1 -#define RAY_MIB_SSID 2 -#define RAY_MIB_SCAN_MODE 3 -#define RAY_MIB_APM_MODE 4 -#define RAY_MIB_MAC_ADDR 5 -#define RAY_MIB_FRAG_THRESH 6 -#define RAY_MIB_DWELL_TIME 7 -#define RAY_MIB_BEACON_PERIOD 8 -#define RAY_MIB_DTIM_INTERVAL 9 -#define RAY_MIB_MAX_RETRY 10 -#define RAY_MIB_ACK_TIMO 11 -#define RAY_MIB_SIFS 12 -#define RAY_MIB_DIFS 13 -#define RAY_MIB_PIFS 14 -#define RAY_MIB_RTS_THRESH 15 -#define RAY_MIB_SCAN_DWELL 16 -#define RAY_MIB_SCAN_MAX_DWELL 17 -#define RAY_MIB_ASSOC_TIMO 18 -#define RAY_MIB_ADHOC_SCAN_CYCLE 19 -#define RAY_MIB_INFRA_SCAN_CYCLE 20 -#define RAY_MIB_INFRA_SUPER_SCAN_CYCLE 21 -#define RAY_MIB_PROMISC 22 -#define RAY_MIB_UNIQ_WORD 23 -#define RAY_MIB_SLOT_TIME 24 -#define RAY_MIB_ROAM_LOW_SNR_THRESH 25 -#define RAY_MIB_LOW_SNR_COUNT 26 -#define RAY_MIB_INFRA_MISSED_BEACON_COUNT 27 -#define RAY_MIB_ADHOC_MISSED_BEACON_COUNT 28 -#define RAY_MIB_COUNTRY_CODE 29 -#define RAY_MIB_HOP_SEQ 30 -#define RAY_MIB_HOP_SEQ_LEN 31 -#define RAY_MIB_CW_MAX 32 -#define RAY_MIB_CW_MIN 33 -#define RAY_MIB_NOISE_FILTER_GAIN 34 -#define RAY_MIB_NOISE_LIMIT_OFFSET 35 -#define RAY_MIB_RSSI_THRESH_OFFSET 36 -#define RAY_MIB_BUSY_THRESH_OFFSET 37 -#define RAY_MIB_SYNC_THRESH 38 -#define RAY_MIB_TEST_MODE 39 -#define RAY_MIB_TEST_MIN_CHAN 40 -#define RAY_MIB_TEST_MAX_CHAN 41 -#define RAY_MIB_ALLOW_PROBE_RESP 42 -#define RAY_MIB_PRIVACY_MUST_START 43 -#define RAY_MIB_PRIVACY_CAN_JOIN 44 -#define RAY_MIB_BASIC_RATE_SET 45 -#define RAY_MIB_VERSION 46 -#define RAY_MIB_CUR_BSSID 47 -#define RAY_MIB_CUR_INITED 48 -#define RAY_MIB_CUR_DEF_TXRATE 49 -#define RAY_MIB_CUR_ENCRYPT 50 -#define RAY_MIB_CUR_NET_TYPE 51 -#define RAY_MIB_CUR_SSID 52 -#define RAY_MIB_CUR_PRIV_START 53 -#define RAY_MIB_CUR_PRIV_JOIN 54 -#define RAY_MIB_DES_BSSID 55 -#define RAY_MIB_DES_INITED 56 -#define RAY_MIB_DES_DEF_TXRATE 57 -#define RAY_MIB_DES_ENCRYPT 58 -#define RAY_MIB_DES_NET_TYPE 59 -#define RAY_MIB_DES_SSID 60 -#define RAY_MIB_DES_PRIV_START 61 -#define RAY_MIB_DES_PRIV_JOIN 62 -#define RAY_MIB_CUR_AP_STATUS 63 -#define RAY_MIB_CUR_PROMISC 64 -#define RAY_MIB_DES_AP_STATUS 65 -#define RAY_MIB_DES_PROMISC 66 - -#define RAY_MIB_LASTUSER 45 -#define RAY_MIB_MAX 66 - -/* - * Strings for the MIB - */ -#define RAY_MIB_STRINGS { \ - "Network type", \ - "AP status", \ - "SSID", \ - "Scan mode", \ - "APM mode", \ - "MAC address", \ - "Fragmentation threshold", \ - "Dwell time", \ - "Beacon period", \ - "DTIM_INTERVAL", \ - "MAX_RETRY", \ - "ACK_TIMO", \ - "SIFS", \ - "DIFS", \ - "PIFS", \ - "RTS_THRESH", \ - "SCAN_DWELL", \ - "SCAN_MAX_DWELL", \ - "ASSOC_TIMO", \ - "ADHOC_SCAN_CYCLE", \ - "INFRA_SCAN_CYCLE", \ - "INFRA_SUPER_SCAN_CYCLE", \ - "PROMISC", \ - "UNIQ_WORD", \ - "SLOT_TIME", \ - "ROAM_LOW_SNR_THRESH", \ - "LOW_SNR_COUNT", \ - "INFRA_MISSED_BEACON_COUNT", \ - "ADHOC_MISSED_BEACON_COUNT", \ - "COUNTRY_CODE", \ - "HOP_SEQ", \ - "HOP_SEQ_LEN", \ - "CW_MAX", \ - "CW_MIN", \ - "NOISE_FILTER_GAIN", \ - "NOISE_LIMIT_OFFSET", \ - "RSSI_THRESH_OFFSET", \ - "BUSY_THRESH_OFFSET", \ - "SYNC_THRESH", \ - "TEST_MODE", \ - "TEST_MIN_CHAN", \ - "TEST_MAX_CHAN", \ - "ALLOW_PROBE_RESP", \ - "PRIVACY_MUST_START", \ - "PRIVACY_CAN_JOIN", \ - "BASIC_RATE_SET", \ - "Firmware version", \ - "Current BSS Id", \ - "Current INITED", \ - "Current DEF_TXRATE", \ - "Current ENCRYPT", \ - "Current NET_TYPE", \ - "Current SSID", \ - "Current PRIV_START", \ - "Current PRIV_JOIN", \ - "Desired BSSID", \ - "Desired INITED", \ - "Desired DEF_TXRATE", \ - "Desired ENCRYPT", \ - "Desired NET_TYPE", \ - "Desired SSID", \ - "Desired PRIV_START", \ - "Desired PRIV_JOIN", \ - "Current AP_STATUS", \ - "Current PROMISC", \ - "Desired AP_STATUS", \ - "Desired PROMISC" \ -} - -#define RAY_MIB_HELP_STRINGS { \ - "0 Ad hoc, 1 Infrastructure", \ - "0 Station, 1 Access Point", \ - "", \ - "0 Passive, 1 Active", \ - "0 Off, 1 On", \ - "", \ - "Bytes", \ - "DWELL_TIME", \ - "BEACON_PERIOD", \ - "DTIM_INTERVAL", \ - "MAX_RETRY", \ - "ACK_TIMO", \ - "SIFS", \ - "DIFS", \ - "PIFS", \ - "RTS_THRESH", \ - "SCAN_DWELL", \ - "SCAN_MAX_DWELL", \ - "ASSOC_TIMO", \ - "ADHOC_SCAN_CYCLE", \ - "INFRA_SCAN_CYCLE", \ - "INFRA_SUPER_SCAN_CYCLE", \ - "PROMISC", \ - "UNIQ_WORD", \ - "SLOT_TIME", \ - "ROAM_LOW_SNR_THRESH", \ - "LOW_SNR_COUNT", \ - "INFRA_MISSED_BEACON_COUNT", \ - "ADHOC_MISSED_BEACON_COUNT", \ - "COUNTRY_CODE", \ - "HOP_SEQ", \ - "HOP_SEQ_LEN", \ - "CW_MAX", \ - "CW_MIN", \ - "NOISE_FILTER_GAIN", \ - "NOISE_LIMIT_OFFSET", \ - "RSSI_THRESH_OFFSET", \ - "BUSY_THRESH_OFFSET", \ - "SYNC_THRESH", \ - "TEST_MODE", \ - "TEST_MIN_CHAN", \ - "TEST_MAX_CHAN", \ - "ALLOW_PROBE_RESP", \ - "PRIVACY_MUST_START", \ - "PRIVACY_CAN_JOIN", \ - "BASIC_RATE_SET", \ - "", \ - "", \ - "0 Joined a net, 1 Created a net", \ - "Current DEF_TXRATE", \ - "Current ENCRYPT", \ - "Current NET_TYPE", \ - "", \ - "Current PRIV_START", \ - "Current PRIV_JOIN", \ - "", \ - "N/A", \ - "Desired DEF_TXRATE", \ - "Desired ENCRYPT", \ - "Desired NET_TYPE", \ - "", \ - "Desired PRIV_START", \ - "Desired PRIV_JOIN", \ - "Current AP_STATUS", \ - "Current PROMISC", \ - "Desired AP_STATUS", \ - "Desired PROMISC" \ -} - -/* - * Applicable versions and work size for each MIB element - */ -#define RAY_MIB_INFO_SIZ4 1 -#define RAY_MIB_INFO_SIZ5 2 -#define RAY_MIB_SIZE(info, mib, version) \ - info[(mib)][(version & RAY_V4)?RAY_MIB_INFO_SIZ4:RAY_MIB_INFO_SIZ5] -#define RAY_MIB_INFO { \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_NET_TYPE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_AP_STATUS */ \ -{RAY_V4|RAY_V5, IEEE80211_NWID_LEN, \ - IEEE80211_NWID_LEN},/* RAY_MIB_SSID */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_SCAN_MODE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_APM_MODE */ \ -{RAY_V4|RAY_V5, ETHER_ADDR_LEN, \ - ETHER_ADDR_LEN},/* RAY_MIB_MAC_ADDR */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_FRAG_THRESH */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_DWELL_TIME */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_BEACON_PERIOD */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DTIM_INTERVAL */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_MAX_RETRY */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_ACK_TIMO */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_SIFS */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DIFS */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_PIFS */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_RTS_THRESH */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_SCAN_DWELL */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_SCAN_MAX_DWELL */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_ASSOC_TIMO */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_ADHOC_SCAN_CYCLE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_INFRA_SCAN_CYCLE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_INFRA_SUPER_SCAN_CYCLE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_PROMISC */ \ -{RAY_V4|RAY_V5, 2, 2}, /* RAY_MIB_UNIQ_WORD */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_SLOT_TIME */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_ROAM_LOW_SNR_THRESH */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_LOW_SNR_COUNT */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_INFRA_MISSED_BEACON_COUNT */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_ADHOC_MISSED_BEACON_COUNT */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_COUNTRY_CODE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_HOP_SEQ */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_HOP_SEQ_LEN */ \ -{RAY_V4|RAY_V5, 1, 2}, /* RAY_MIB_CW_MAX */ \ -{RAY_V4|RAY_V5, 1, 2}, /* RAY_MIB_CW_MIN */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_NOISE_FILTER_GAIN */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_NOISE_LIMIT_OFFSET */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_RSSI_THRESH_OFFSET */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_BUSY_THRESH_OFFSET */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_SYNC_THRESH */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_TEST_MODE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_TEST_MIN_CHAN */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_TEST_MAX_CHAN */ \ -{ RAY_V5, 0, 1}, /* RAY_MIB_ALLOW_PROBE_RESP */ \ -{ RAY_V5, 0, 1}, /* RAY_MIB_PRIVACY_MUST_START */ \ -{ RAY_V5, 0, 1}, /* RAY_MIB_PRIVACY_CAN_JOIN */ \ -{ RAY_V5, 0, 8}, /* RAY_MIB_BASIC_RATE_SET */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_VERSION */ \ -{RAY_V4|RAY_V5, ETHER_ADDR_LEN, \ - ETHER_ADDR_LEN},/* RAY_MIB_CUR_BSSID */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_INITED */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_DEF_TXRATE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_ENCRYPT */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_NET_TYPE */ \ -{RAY_V4|RAY_V5, IEEE80211_NWID_LEN, \ - IEEE80211_NWID_LEN}, /* RAY_MIB_CUR_SSID */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_PRIV_START */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_PRIV_JOIN */ \ -{RAY_V4|RAY_V5, ETHER_ADDR_LEN, \ - ETHER_ADDR_LEN},/* RAY_MIB_DES_BSSID */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_INITED */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_DEF_TXRATE */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_ENCRYPT */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_NET_TYPE */ \ -{RAY_V4|RAY_V5, IEEE80211_NWID_LEN, \ - IEEE80211_NWID_LEN}, /* RAY_MIB_DES_SSID */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_PRIV_START */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_PRIV_JOIN */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_AP_STATUS */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_CUR_PROMISC */ \ -{RAY_V4|RAY_V5, 1, 1}, /* RAY_MIB_DES_AP_STATUS */ \ -{RAY_V4|RAY_V5, 1, 1} /* RAY_MIB_DES_PROMISC */ \ -} - -/* - * MIB values - * - * I've included comments as to where the numbers have originated - * from. - * - * Linux refers to ray_cs.c and rayctl.h from version 167 of the - * Linux Raylink driver. - * - * NetBSD refers to if_ray.c from version 1.12 of the NetBSD Raylink - * driver. - * - * Symb refers to numbers cleaned from the 802.11 specification, - * discussion with 802.11 knowledgable people at Symbionics or - * stuff needed by me (i.e. me, * aps, ifo, hjl). - * - * V4 and V5 refer to settings for version 4 and version 5 of - * the firmware. - * - * DOC refers to the - * Combined Interface Requirements Specification - * and Interface Design Document (IRS/IDD) - * for the - * WLAN System Interfaces Between the - * HOST COMPUTER and the - * PCMCIA WLAN INTERFACE CARD - * Revision ECF 5.00 - * 17 June, 1998 - */ - -/* XXX Obtained by raycontrol _before_ downloading - * # /sys/dev/ray/raycontrol/raycontrol -i ray0 - * Firmware version 4 - * Network type 0x01 0 Ad hoc, 1 Infrastructure - * AP status 0x00 0 Station, 1 Access Point - * SSID - * Scan mode 0x01 0 Passive, 1 Active - * APM mode 0x00 0 Off, 1 On - * MAC address 00:00:8f:48:e4:44 - * Fragmentation threshold 0x0200 FRAG_THRESH - * Dwell tIME 0x01 DWELL_TIME - * Beacon period 0x01 BEACON_PERIOD - * DTIM_INTERVAL 0x05 DTIM_INTERVAL - * MAX_RETRY 0x03 MAX_RETRY - * ACK_TIMO 0x8c ACK_TIMO - * SIFS 0x1e SIFS - * DIFS 0x82 DIFS - * PIFS 0xce PIFS - * RTS_THRESH 0x0100 RTS_THRESH - * SCAN_DWELL 0xfc18 SCAN_DWELL - * SCAN_MAX_DWELL 0xc180 SCAN_MAX_DWELL - * ASSOC_TIMO 0x05 ASSOC_TIMO - * ADHOC_SCAN_CYCLE 0x04 ADHOC_SCAN_CYCLE - * INFRA_SCAN_CYCLE 0x02 INFRA_SCAN_CYCLE - * INFRA_SUPER_SCAN_CYCLE 0x04 INFRA_SUPER_SCAN_CYCLE - * PROMISC 0x00 PROMISC - * UNIQ_WORD 0x0cbd UNIQ_WORD - * SLOT_TIME 0x4e SLOT_TIME - * ROAM_LOW_SNR_THRESH 0x20 ROAM_LOW_SNR_THRESH - * LOW_SNR_COUNT 0x04 LOW_SNR_COUNT - * INFRA_MISSED_BEACON_COUNT 0x04 INFRA_MISSED_BEACON_COUNT - * ADHOC_MISSED_BEACON_COUNT 0x04 ADHOC_MISSED_BEACON_COUNT - * COUNTRY_CODE 0x01 COUNTRY_CODE - * HOP_SEQ 0x07 HOP_SEQ - * HOP_SEQ_LEN 0x4e HOP_SEQ_LEN - * CW_MAX 0x3f CW_MAX - * CW_MIN 0x0f CW_MIN - * NOISE_FILTER_GAIN 0x00 NOISE_FILTER_GAIN - * NOISE_LIMIT_OFFSET 0x00 NOISE_LIMIT_OFFSET - * RSSI_THRESH_OFFSET 0x70 RSSI_THRESH_OFFSET - * BUSY_THRESH_OFFSET 0x70 BUSY_THRESH_OFFSET - * SYNC_THRESH 0x07 SYNC_THRESH - * TEST_MODE 0x00 TEST_MODE - * TEST_MIN_CHAN 0x02 TEST_MIN_CHAN - * TEST_MAX_CHAN 0x02 TEST_MAX_CHAN -*/ - -/* - * mib_net_type - * - * DOC 0x01 - Defines network type for Start and Join - * - Network commands. - * - * Symb 0x00 - Adhoc is safer and I ain't got an AP - */ -#define RAY_MIB_NET_TYPE_ADHOC 0x00 -#define RAY_MIB_NET_TYPE_INFRA 0x01 -#define RAY_MIB_NET_TYPE_DEFAULT RAY_MIB_NET_TYPE_ADHOC - -/* - * mib_ap_status - * - * DOC 0x00 - Applicable only when Network Type is - * - Infrastructure. - */ -#define RAY_MIB_AP_STATUS_TERMINAL 0x00 -#define RAY_MIB_AP_STATUS_AP 0x01 -#define RAY_MIB_AP_STATUS_DEFAULT RAY_MIB_AP_STATUS_TERMINAL - -/* - * mib_ssid - * - * DOC ESSID1 - Service Set ID. Can be any ASCII string - * - up to 32 bytes in length. If the string is - * - less than 32 bytes long, it must be - * - followed by a byte of 00h. - * - * Symb - windows setting comes from the Aviator software v1.1 - */ -#define RAY_MIB_SSID_WINDOWS "NETWORK_NAME" -#define RAY_MIB_SSID_NOT_WINDOWS "WIRELESS_NETWORK" -#define RAY_MIB_SSID_DEFAULT RAY_MIB_SSID_WINDOWS - -/* - * mib_scan_mode - * - * DOC 0x01 - Defines acquisition approach for - * - terminals operating in either Ad Hoc or - * - Infrastructure Networks. N/A for APs. - */ -#define RAY_MIB_SCAN_MODE_PASSIVE 0x00 -#define RAY_MIB_SCAN_MODE_ACTIVE 0x01 -#define RAY_MIB_SCAN_MODE_DEFAULT RAY_MIB_SCAN_MODE_ACTIVE - -/* - * mib_apm_mode - * - * DOC 0x00 - Defines power management mode for - * - stations operating in either Ad Hoc or - * - Infrastructure Networks. Must always - * - be 0 for APs. - */ -#define RAY_MIB_APM_MODE_NONE 0x00 -#define RAY_MIB_APM_MODE_POWERSAVE 0x01 -#define RAY_MIB_APM_MODE_DEFAULT RAY_MIB_APM_MODE_NONE - -/* - * mib_mac_addr - * - * DOC - MAC Address to be used by WIC (For - * - format see Figure 3.2.4.1.2-1, MAC - * - Address Format). Host may echo card - * - supplied address or use locally - * - administered address. - */ - -/* - * mib_frag_thresh - * - * DOC 0x7fff - Maximum over-the-air packet size (in - * - bytes) - * - * Symb 0xXXXX - you really should fragment when in low signal - * - conditions but getting it wrong - * crucifies the performance - */ -#define RAY_MIB_FRAG_THRESH_MINIMUM 0 -#define RAY_MIB_FRAG_THRESH_MAXIMUM 2346 -#define RAY_MIB_FRAG_THRESH_DISABLE 0x7fff -#define RAY_MIB_FRAG_THRESH_DEFAULT RAY_MIB_FRAG_THRESH_DISABLE - -/* - * mib_dwell_time - * - * DOC 0x0080 - Defines hop dwell time in Kusec. - * - Required only of stations which intend - * - to issue a Start Network command. - * - Forward Compatible Firmware (Build - * - 5) requires that the dwell time be one of - * - the set 16, 32, 64, 128, and 256. - * - * Linux.h - 16k * 2**n, n=0-4 in Kus - * Linux.c-V4 0x0200 - * Linux.c-V5 0x0080 - 128 Kus - * NetBSD-V4 0x0200 - from Linux - * NetBSD-V4 0x0400 - "divined" - * NetBSD-V5 0x0080 - * Symb-V4 0xXXXX - 802.11 dwell time is XXX Kus - * Symb-V5 0xXXXX - 802.11 dwell time is XXX Kus - * - * XXX confirm that 1024Kus is okay for windows driver - how? and see - * XXX how it is over the maximum - */ -#define RAY_MIB_DWELL_TIME_MINIMUM 1 -#define RAY_MIB_DWELL_TIME_MAXIMUM 390 -#define RAY_MIB_DWELL_TIME_V4 0x0400 -#define RAY_MIB_DWELL_TIME_V5 0x0080 - -/* - * mib_beacon_period - * - * DOC 0x0100 - Defines time between target beacon - * - transmit times (TBTT) in Kusec. - * - Forward Compatible Firmware (Build - * - 5) requires that the Beacon Period be an - * - integral multiple of the Dwell Time (not - * - exceeding 255 hops). - * - Required only of stations which intend - * - to issue a Start Network command. - * - * Linux.h - n * a_hop_time in Kus - * Linux.c-V4 0x0001 - * Linux.c-V5 0x0100 - 256 Kus - * NetBSD-V4 0x0001 - from Linux - * NetBSD-V4 0x0000 - "divined" - * NetBSD-V5 0x0100 - * Symb-V4 0x0001 - best performance is one beacon each dwell XXX - * Symb-V5 0x0080 - best performance is one beacon each dwell XXX - * - * XXX V4 should probably set this to dwell_time - */ -#define RAY_MIB_BEACON_PERIOD_MINIMUM 1 -#define RAY_MIB_BEACON_PERIOD_MAXIMUM 0xffff -#define RAY_MIB_BEACON_PERIOD_V4 0x0001 -#define RAY_MIB_BEACON_PERIOD_V5 RAY_MIB_DWELL_TIME_V5 - -/* - * mib_dtim_interval - * - * DOC 0x01 - Number of beacons per DTIM period. - * - Only APs will use this parameter, to set - * - the DTIM period. - * - * Linux.h - in beacons - * Linux.c 0x01 - * NetBSD 0x01 - * Symb 0xXX - need to find out what DTIM is - */ -#define RAY_MIB_DTIM_INTERVAL_MINIMUM 1 -#define RAY_MIB_DTIM_INTERVAL_MAXIMUM 255 -#define RAY_MIB_DTIM_INTERVAL_DEFAULT 0x01 - -/* - * mib_max_retry - * - * DOC 31 - Number of times WIC will attempt to - * - retransmit a failed packet. - * - * Linux.c 0x07 - * NetBSD 0x01 - "documented default for 5/6" - * NetBSD 0x07 - from Linux - * NetBSD 0x03 - "divined" - * Symb 0xXX - 7 retries seems okay but check with APS - */ -#define RAY_MIB_MAX_RETRY_MINIMUM 0 -#define RAY_MIB_MAX_RETRY_MAXIMUM 255 -#define RAY_MIB_MAX_RETRY_DEFAULT 0x07 - -/* - * mib_ack_timo - * - * DOC 0x86 - Time WIC will wait after completion of - * - a transmit before timing out anticipated - * - ACK (2 usec steps). Should equal - * - SIFS + constant. - * - * Linux.c 0xa3 - * NetBSD 0x86 - documented default for 5/6 - * NetBSD 0xa3 - from Linux - * NetBSD 0xa3 - "divined" - * Symb 0xXX - this must be a 802.11 defined setting? - */ -#define RAY_MIB_ACK_TIMO_MINIMUM 0 -#define RAY_MIB_ACK_TIMO_MAXIMUM 255 -#define RAY_MIB_ACK_TIMO_DEFAULT 0xa3 - -/* - * mib_sifs - * - * DOC 0x1c - SIFS time in usec. - * - * Linux.c 0x1d - * NetBSD 0x1c - documented default for 5/6 - * NetBSD 0x1d - from Linux - * NetBSD 0x1d - "divined" - * Symb 0xXX - default SIFS for 802.11 - */ -#define RAY_MIB_SIFS_MINIMUM 28 -#define RAY_MIB_SIFS_MAXIMUM 62 -#define RAY_MIB_SIFS_DEFAULT 0x1d - -/* - * mib_difs - * - * DOC 0x82 - DIFS time in usec. - */ -#define RAY_MIB_DIFS_MINIMUM 130 -#define RAY_MIB_DIFS_MAXIMUM 255 -#define RAY_MIB_DIFS_DEFAULT 0x82 - -/* - * mib_pifs - * - * DOC 78 - PIFS time in usec. (Not currently - * - implemented. - */ -#define RAY_MIB_PIFS_MINIMUM 78 -#define RAY_MIB_PIFS_MAXIMUM 255 -#define RAY_MIB_PIFS_V4 0xce -#define RAY_MIB_PIFS_V5 0x4e - -/* - * mib_rts_thresh - * - * DOC 0x7ffff - Threshold size in bytes below which - * - messages will not require use of RTS - * - Protocol. - * - * Linux.c 0x7fff - * NetBSD 0x7fff - disabled - * Symb 0xXXXX - need to set this realistically to get CTS/RTS mode - * working right - */ -#define RAY_MIB_RTS_THRESH_MINIMUM 0 -#define RAY_MIB_RTS_THRESH_MAXIMUM 2346 -#define RAY_MIB_RTS_THRESH_DISABLE 0x7fff -#define RAY_MIB_RTS_THRESH_DEFAULT RAY_MIB_RTS_THRESH_DISABLE - -/* - * mib_scan_dwell - * - * DOC 0x04e2 - Time channel remains clear after probe - * - transmission prior to hopping to next - * - channel. (in 2 msec steps). - * - * Linux.c-V4 0xfb1e - 128572us - * Linix.c-V5 0x04e2 - 2500us - * NetBSD-V4 0xfb1e - * NetBSD-V5 0x04e2 - * Symb 0xXXXX - Check that v4 h/w can do 2.5ms and default it - */ -#define RAY_MIB_SCAN_DWELL_MINIMUM 1 -#define RAY_MIB_SCAN_DWELL_MAXIMUM 65535 -#define RAY_MIB_SCAN_DWELL_V4 0xfb1e -#define RAY_MIB_SCAN_DWELL_V5 0x04e2 - -/* - * mib_scan_max_dwell - * - * DOC 0x38a4 - Time to remain on a frequency channel - * - if CCA is detected after probe - * - transmission. (in 2 usec steps). - * - * Linux.c-V4 0xc75c - 102072us - * Linix.c-V5 0x38a4 - 29000us - * NetBSD-V4 0xc75c - * NetBSD-V5 0x38a4 - * Symb 0xXXXX - see above - this may be total time before giving up - */ -#define RAY_MIB_SCAN_MAX_DWELL_MINIMUM 1 -#define RAY_MIB_SCAN_MAX_DWELL_MAXIMUM 65535 -#define RAY_MIB_SCAN_MAX_DWELL_V4 0xc75c -#define RAY_MIB_SCAN_MAX_DWELL_V5 0x38a4 - -/* - * mib_assoc_timo - * - * DOC 0x05 - Time (in hops) a station waits after - * - transmitting an Association Request - * - Message before association attempt is - * - considered failed. N/A for Ad Hoc - * - Networks and for APs in Infrastructure - */ -#define RAY_MIB_ASSOC_TIMO_MINIMUM 0 -#define RAY_MIB_ASSOC_TIMO_MAXIMUM 255 -#define RAY_MIB_ASSOC_TIMO_DEFAULT 0x05 - -/* - * mib_adhoc_scan_cycle - * - * DOC 0x08 - Maximum number of times to cycle - * - through frequency hopping pattern as - * - part of scanning during Ad Hoc - * - Acquisition. - */ -#define RAY_MIB_ADHOC_SCAN_CYCLE_MINIMUM 1 -#define RAY_MIB_ADHOC_SCAN_CYCLE_MAXIMUM 255 -#define RAY_MIB_ADHOC_SCAN_CYCLE_DEFAULT 0x08 - -/* - * mib_infra_scan_cycle - * - * DOC 0x02 - Number of times to cycle through - * - frequency hopping pattern as part of - * - scanning during Infrastructure Network - * - Acquisition. - */ -#define RAY_MIB_INFRA_SCAN_CYCLE_MINIMUM 1 -#define RAY_MIB_INFRA_SCAN_CYCLE_MAXIMUM 255 -#define RAY_MIB_INFRA_SCAN_CYCLE_DEFAULT 0x02 - -/* - * mib_infra_super_scan_cycle - * - * DOC 0x08 - Number of times to repeat an - * - Infrastructure scan cycle if no APs are - * - found before indicating a failure. - */ -#define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_MINIMUM 1 -#define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_MAXIMUM 255 -#define RAY_MIB_INFRA_SUPER_SCAN_CYCLE_DEFAULT 0x08 - -/* - * mib_promisc - * - * DOC 0x00 - Controls operation of WIC in - * - promiscuous mode. - */ -#define RAY_MIB_PROMISC_DISABLED 0 -#define RAY_MIB_PROMISC_ENABLED 1 -#define RAY_MIB_PROMISC_DEFAULT 0x00 - -/* - * mib_uniq_word - * - * DOC 0x0cdb - Unique word pattern (Transmitted as - * - 0CBDh per 802.11) - */ -#define RAY_MIB_UNIQ_WORD_MINIMUM 0 -#define RAY_MIB_UNIQ_WORD_MAXIMUM 0xffff -#define RAY_MIB_UNIQ_WORD_DEFAULT 0x0cbd - -/* - * mib_slot_time - * - * DOC 0x32 - Slot time in usec - * - * Linux.c-V4 0x4e - * Linix.c-V5 0x32 - * NetBSD-V4 0x4e - Linux - * NetBSD-V4 0x18 - "divined" - * NetBSD-V5 0x32 - mentions spec. is 50us i.e. 0x32 - * Symb 0xXX - wtf 0x4e = 78 - */ -#define RAY_MIB_SLOT_TIME_MINIMUM 1 -#define RAY_MIB_SLOT_TIME_MAXIMUM 128 -#define RAY_MIB_SLOT_TIME_V4 0x4e -#define RAY_MIB_SLOT_TIME_V5 0x32 - -/* - * mib_roam_low_snr_thresh - * - * DOC 0xff - SNR Threshold for use by roaming - * - algorithm. [Low power count is - * - incremented when Beacon is received at - * - SNR lower than Roaming Low SNR - * - Threshold.] To disable, set to FFh. - * - * Linux.c 0xff - * NetBSD-V4 0xff - Linux - * NetBSD-V4 0x30 - "divined" - * NetBSD-V5 0xff - disabled - * NetBSD.h - if below this inc count - * Symb 0xXX - hmm is 0xff really disabled? need this to work - */ -#define RAY_MIB_ROAM_LOW_SNR_THRESH_MINIMUM 0 -#define RAY_MIB_ROAM_LOW_SNR_THRESH_MAXIMUM 255 -#define RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED 0xff -#define RAY_MIB_ROAM_LOW_SNR_THRESH_DEFAULT RAY_MIB_ROAM_LOW_SNR_THRESH_DISABLED - -/* - * mib_low_snr_count - * - * DOC 0xff - Threshold that number of consecutive - * - beacons received at SNR < Roaming - * - Low SNR Threshold must exceed - * - before roaming processing begins. To - * - disable, set to FFh. - * - * Linux.c 0xff - * NetBSD 0x07 - "divined - check" and marked as disabled - * NetBSD 0xff - disabled - * NetBSD.h - roam after cnt below thrsh - * Symb 0xXX - hmm is 0xff really disabled? need - * - this to work in infrastructure mode with mutliple APs - */ -#define RAY_MIB_LOW_SNR_COUNT_MINIMUM 0 -#define RAY_MIB_LOW_SNR_COUNT_MAXIMUM 255 -#define RAY_MIB_LOW_SNR_COUNT_DISABLED 0xff -#define RAY_MIB_LOW_SNR_COUNT_DEFAULT RAY_MIB_LOW_SNR_COUNT_DISABLED - -/* - * mib_infra_missed_beacon_count - * - * DOC 0x02 - Threshold that number of consecutive - * - beacons not received must exceed - * - before roaming processing begins in an - * - infrastructure network. To disable, set - * - to FFh. - * Linux.c 0x05 - * NetBSD 0x02 - documented default for 5/6 - * NetBSD 0x05 - Linux - * NetBSD 0x07 - "divined - check, looks fishy" - * Symb 0xXX - 5 missed beacons is probably okay - */ -#define RAY_MIB_INFRA_MISSED_BEACON_COUNT_MINIMUM 0 -#define RAY_MIB_INFRA_MISSED_BEACON_COUNT_MAXIMUM 255 -#define RAY_MIB_INFRA_MISSED_BEACON_COUNT_DEFAULT 0x05 - -/* - * mib_adhoc_missed_beacon_count - * - * DOC 0xff - Threshold that number of consecutive - * - beacons transmitted by a terminal must - * - exceed before reacquisition processing - * - begins in Ad Hoc Network. - */ -#define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_MINIMUM 0 -#define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_MAXIMUM 255 -#define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED 0xff -#define RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DEFAULT RAY_MIB_ADHOC_MISSED_BEACON_COUNT_DISABLED - -/* - * mib_country_code - * - * DOC 0x01 - Country set of hopping patterns - * - (element value in beacon) - * - Note: Japan Test is for a special test - * - mode required by the Japanese - * - regulatory authorities. - */ -#define RAY_MIB_COUNTRY_CODE_MIMIMUM 0x01 -#define RAY_MIB_COUNTRY_CODE_MAXIMUM 0x09 -#define RAY_MIB_COUNTRY_CODE_USA 0x01 -#define RAY_MIB_COUNTRY_CODE_EUROPE 0x02 -#define RAY_MIB_COUNTRY_CODE_JAPAN 0x03 -#define RAY_MIB_COUNTRY_CODE_KOREA 0x04 -#define RAY_MIB_COUNTRY_CODE_SPAIN 0x05 -#define RAY_MIB_COUNTRY_CODE_FRANCE 0x06 -#define RAY_MIB_COUNTRY_CODE_ISRAEL 0x07 -#define RAY_MIB_COUNTRY_CODE_AUSTRALIA 0x08 -#define RAY_MIB_COUNTRY_CODE_JAPAN_TEST 0x09 -#define RAY_MIB_COUNTRY_CODE_DEFAULT RAY_MIB_COUNTRY_CODE_USA - -/* - * mib_hop_seq - * - * DOC 0x0b - Hop Pattern to use. (Currently 66 - * - US/Europe plus 12 Japanese). - * - * NetBSD.h - no longer supported - */ -#define RAY_MIB_HOP_SEQ_MINIMUM 6 -#define RAY_MIB_HOP_SEQ_MAXIMUM 72 -#define RAY_MIB_HOP_SEQ_DEFAULT 0x0b - -/* - * mib_hop_seq_len - * - * DOC 0x4f - Number of frequency channels in - * - hopping pattern is now set to the value - * - defined in IEEE802.11 for the selected - * - Current Country Code. - */ -#define RAY_MIB_HOP_SEQ_LEN_MINIMUM 1 -#define RAY_MIB_HOP_SEQ_LEN_MAXIMUM 79 -#define RAY_MIB_HOP_SEQ_LEN_V4 0x4e -#define RAY_MIB_HOP_SEQ_LEN_V5 0x4f - -/* XXX need to update these to the spec. XXX */ - -/* - * All from here down are the same in Linux/NetBSD and seem to be sane. - */ -#define RAY_MIB_CW_MAX_V4 0x3f -#define RAY_MIB_CW_MAX_V5 0x003f - -#define RAY_MIB_CW_MIN_V4 0x0f -#define RAY_MIB_CW_MIN_V5 0x000f - -/* - * Symb 0xXX - these parameters will affect the clear channel - * assesment false triggering - * - */ -#define RAY_MIB_NOISE_FILTER_GAIN_DEFAULT 0x04 -#define RAY_MIB_NOISE_LIMIT_OFFSET_DEFAULT 0x08 -#define RAY_MIB_RSSI_THRESH_OFFSET_DEFAULT 0x28 -#define RAY_MIB_BUSY_THRESH_OFFSET_DEFAULT 0x28 -#define RAY_MIB_SYNC_THRESH_DEFAULT 0x07 - -#define RAY_MIB_TEST_MODE_NORMAL 0x0 -#define RAY_MIB_TEST_MODE_ANT_1 0x1 -#define RAY_MIB_TEST_MODE_ATN_2 0x2 -#define RAY_MIB_TEST_MODE_ATN_BOTH 0x3 -#define RAY_MIB_TEST_MODE_DEFAULT RAY_MIB_TEST_MODE_NORMAL - -#define RAY_MIB_TEST_MIN_CHAN_DEFAULT 0x02 -#define RAY_MIB_TEST_MAX_CHAN_DEFAULT 0x02 - -#define RAY_MIB_ALLOW_PROBE_RESP_DISALLOW 0x0 -#define RAY_MIB_ALLOW_PROBE_RESP_ALLOW 0x1 -#define RAY_MIB_ALLOW_PROBE_RESP_DEFAULT RAY_MIB_ALLOW_PROBE_RESP_DISALLOW - -#define RAY_MIB_PRIVACY_MUST_START_NOWEP 0x0 -#define RAY_MIB_PRIVACY_MUST_START_WEP 0x1 -#define RAY_MIB_PRIVACY_MUST_START_DEFAULT RAY_MIB_PRIVACY_MUST_START_NOWEP - -#define RAY_MIB_PRIVACY_CAN_JOIN_NOWEP 0x0 -#define RAY_MIB_PRIVACY_CAN_JOIN_WEP 0x1 -#define RAY_MIB_PRIVACY_CAN_JOIN_DONT_CARE 0x2 -#define RAY_MIB_PRIVACY_CAN_JOIN_DEFAULT RAY_MIB_PRIVACY_CAN_JOIN_NOWEP - -#define RAY_MIB_BASIC_RATE_SET_MINIMUM 1 -#define RAY_MIB_BASIC_RATE_SET_MAXIMUM 4 -#define RAY_MIB_BASIC_RATE_SET_500K 1 -#define RAY_MIB_BASIC_RATE_SET_1000K 2 -#define RAY_MIB_BASIC_RATE_SET_1500K 3 -#define RAY_MIB_BASIC_RATE_SET_2000K 4 -#define RAY_MIB_BASIC_RATE_SET_DEFAULT RAY_MIB_BASIC_RATE_SET_2000K - -/* - * IOCTL support - */ -struct ray_param_req { - int r_failcause; - u_int8_t r_paramid; - u_int8_t r_len; - u_int8_t r_data[256]; -}; -struct ray_stats_req { - u_int64_t rxoverflow; /* Number of rx overflows */ - u_int64_t rxcksum; /* Number of checksum errors */ - u_int64_t rxhcksum; /* Number of header checksum errors */ - u_int8_t rxnoise; /* Average receiver level */ -}; -#define RAY_FAILCAUSE_EIDRANGE 1 -#define RAY_FAILCAUSE_ELENGTH 2 -/* device can possibly return up to 255 */ -#define RAY_FAILCAUSE_EDEVSTOP 256 - -/* Get a param the data is a ray_param_req structure */ -#define SIOCSRAYPARAM SIOCSIFGENERIC -#define SIOCGRAYPARAM SIOCGIFGENERIC -/* Get the error counters the data is a ray_stats_req structure */ -#define SIOCGRAYSTATS _IOWR('i', 201, struct ifreq) -#define SIOCGRAYSIGLEV _IOWR('i', 202, struct ifreq) - -#define RAY_NSIGLEVRECS 8 -#define RAY_NSIGLEV 8 -#define RAY_NANTENNA 8 - -struct ray_siglev { - u_int8_t rsl_host[ETHER_ADDR_LEN]; /* MAC address */ - u_int8_t rsl_siglevs[RAY_NSIGLEV]; /* levels, newest in [0] */ - u_int8_t rsl_antennas[RAY_NANTENNA]; /* best antenna */ - struct timeval rsl_time; /* time of last packet */ -}; diff --git a/sys/dev/ray/if_rayreg.h b/sys/dev/ray/if_rayreg.h deleted file mode 100644 index cff653f6d0fb2..0000000000000 --- a/sys/dev/ray/if_rayreg.h +++ /dev/null @@ -1,480 +0,0 @@ -/* - * Copyright (C) 2000 - * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * - */ - -/* $NetBSD: if_rayreg.h,v 1.1 2000/01/23 23:59:22 chopps Exp $ */ -/* - * Copyright (c) 2000 Christian E. Hopps - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * CCR registers, appearing in the attribute memory space - */ -#define RAY_CCR 0xf00 /* CCR register offset */ -#define RAY_COR (RAY_CCR + 0x00) /* config option register */ -#define RAY_CCSR (RAY_CCR + 0x01) /* config/status register */ -#define RAY_PIN (RAY_CCR + 0x02) /* not used by hw */ -#define RAY_SOCKETCOPY (RAY_CCR + 0x03) /* not used by hw */ -#define RAY_HCSIR (RAY_CCR + 0x05) /* HCS intr register */ -#define RAY_ECFIR (RAY_CCR + 0x06) /* ECF intr register */ -/* - * We don't seem to be able to access these in a simple manner - */ -#define RAY_AR0 (RAY_CCR + 0x08) /* authorization register 0 (unused) */ -#define RAY_AR1 (RAY_CCR + 0x09) /* authorization register 1 (unused) */ -#define RAY_PMR (RAY_CCR + 0x0a) /* program mode register (unused) */ -#define RAY_TMR (RAY_CCR + 0x0b) /* pc test mode register (unused) */ -#define RAY_FCWR (RAY_CCR + 0x10) /* frequency control word register */ -#define RAY_TMC1 (RAY_CCR + 0x14) /* test mode control 1 (unused) */ -#define RAY_TMC2 (RAY_CCR + 0x15) /* test mode control 1 (unused) */ -#define RAY_TMC3 (RAY_CCR + 0x16) /* test mode control 1 (unused) */ -#define RAY_TMC4 (RAY_CCR + 0x17) /* test mode control 1 (unused) */ - -/* - * COR register bits - */ -#define RAY_COR_CFG_NUM 0x01 /* currently ignored and set */ -#define RAY_COR_CFG_MASK 0x3f /* mask for function */ -#define RAY_COR_LEVEL_IRQ 0x40 /* currently ignored and set */ -#define RAY_COR_RESET 0x80 /* soft-reset the card */ -#define RAY_COR_DEFAULT (RAY_COR_CFG_NUM | RAY_COR_LEVEL_IRQ) - -/* - * CCS register bits - */ -#define RAY_CCS_NORMAL 0x00 /* normal operation */ -#define RAY_CCS_IRQ 0x02 /* interrupt pending */ -#define RAY_CCS_POWER_DOWN 0x04 /* when written powers down card */ - -/* - * HCSIR bits - * - * the host can only clear this bit. - */ -#define RAY_HCSIR_IRQ 0x01 /* indicates an interrupt */ - -/* - * ECFIR values - */ -#define RAY_ECFIR_IRQ 0x01 /* interrupt the card */ - -/* - * AR0 values - * used for testing/programming the card (unused) - */ -#define RAY_AR0_ON 0x57 - -/* - * AR1 values - * used for testing/programming the card (unused) - */ -#define RAY_AR1_ON 0x82 - -/* - * PMR bits - * these are used to program the card (unused) - */ -#define RAY_PMR_NORMAL 0x00 /* normal operation */ -#define RAY_PMR_PC2PM 0x02 /* grant access to firmware flash */ -#define RAY_PMR_PC2CAL 0x10 /* read access to the A/D modem inp */ -#define RAY_PMR_MLSE 0x20 /* read access to the MSLE prom */ - -/* - * TMR bits - * get access to test modes (unused) - */ -#define RAY_TMR_NORMAL 0x00 /* normal operation */ -#define RAY_TMR_TEST 0x08 /* test mode */ - -/* - * FCWR -- frequency control word, values from [0x02,0xA6] map to - * RF frequency values. - */ - -/* - * 48k of memory - */ -#define RAY_SRAM_MEM_BASE 0 -#define RAY_SRAM_MEM_SIZE 0xc000 - -/* - * offsets into shared ram - */ -#define RAY_SCB_BASE 0x0000 /* cfg/status/ctl area */ -#define RAY_STATUS_BASE 0x0100 -#define RAY_HOST_TO_ECF_BASE 0x0200 -#define RAY_ECF_TO_HOST_BASE 0x0300 -#define RAY_CCS_BASE 0x0400 -#define RAY_RCS_BASE 0x0800 -#define RAY_APOINT_TIM_BASE 0x0c00 -#define RAY_SSID_LIST_BASE 0x0d00 -#define RAY_TX_BASE 0x1000 -#define RAY_TX_SIZE 0x7000 -#define RAY_TX_END 0x8000 -#define RAY_RX_BASE 0x8000 -#define RAY_RX_END 0xc000 -#define RAY_RX_MASK 0x3fff - -/* - * Startup reporting stucture - */ -struct ray_ecf_startup_v4 { - u_int8_t e_status; - u_int8_t e_station_addr[ETHER_ADDR_LEN]; - u_int8_t e_prg_cksum; - u_int8_t e_cis_cksum; - u_int8_t e_resv0[7]; - u_int8_t e_japan_callsign[12]; -}; -struct ray_ecf_startup_v5 { - u_int8_t e_status; - u_int8_t e_station_addr[ETHER_ADDR_LEN]; - u_int8_t e_resv0; - u_int8_t e_rates[8]; - u_int8_t e_japan_callsign[12]; - u_int8_t e_prg_cksum; - u_int8_t e_cis_cksum; - u_int8_t e_fw_build_string; - u_int8_t e_fw_build; - u_int8_t e_fw_resv; - u_int8_t e_asic_version; - u_int8_t e_tibsize; - u_int8_t e_resv1[29]; -}; - -/* - * Startup status word result codes - */ -#define RAY_ECFS_RESERVED0 0x01 -#define RAY_ECFS_PROC_SELF_TEST 0x02 -#define RAY_ECFS_PROG_MEM_CHECKSUM 0x04 -#define RAY_ECFS_DATA_MEM_TEST 0x08 -#define RAY_ECFS_RX_CALIBRATION 0x10 -#define RAY_ECFS_FW_VERSION_COMPAT 0x20 -#define RAY_ECFS_RERSERVED1 0x40 -#define RAY_ECFS_TEST_COMPLETE 0x80 -#define RAY_ECFS_CARD_OK RAY_ECFS_TEST_COMPLETE -#define RAY_ECFS_PRINTFB \ - "\020" \ - "\001RESERVED0" \ - "\002PROC_SELF_TEST" \ - "\003PROG_MEM_CHECKSUM" \ - "\004DATA_MEM_TEST" \ - "\005RX_CALIBRATION" \ - "\006FW_VERSION_COMPAT" \ - "\007RERSERVED1" \ - "\010TEST_COMPLETE" - -/* - * Firmware build codes - */ -#define RAY_ECFS_BUILD_4 0x55 -#define RAY_ECFS_BUILD_5 0x5 - -/* - * System Control Block - */ -#define RAY_SCB_CCSI 0x00 /* host CCS index */ -#define RAY_SCB_RCSI 0x01 /* ecf RCS index */ - -/* - * command control structures (for CCSR commands) - */ - -/* - * commands for CCSR - */ -#define RAY_CMD_DOWNLOAD_PARAMS 0x01 /* download start params */ -#define RAY_CMD_UPDATE_PARAMS 0x02 /* update params */ -#define RAY_CMD_REPORT_PARAMS 0x03 /* report params */ -#define RAY_CMD_UPDATE_MCAST 0x04 /* update mcast list */ -#define RAY_CMD_UPDATE_APM 0x05 /* update power saving mode */ -#define RAY_CMD_START_NET 0x06 -#define RAY_CMD_JOIN_NET 0x07 -#define RAY_CMD_START_ASSOC 0x08 -#define RAY_CMD_TX_REQ 0x09 -#define RAY_CMD_TEST_MEM 0x0a -#define RAY_CMD_SHUTDOWN 0x0b -#define RAY_CMD_DUMP_MEM 0x0c -#define RAY_CMD_START_TIMER 0x0d -#define RAY_CMD_MAX 0x0e - -/* - * unsolicted commands from the ECF - */ -#define RAY_ECMD_RX_DONE 0x80 /* process rx packet */ -#define RAY_ECMD_REJOIN_DONE 0x81 /* rejoined the network */ -#define RAY_ECMD_ROAM_START 0x82 /* romaining started */ -#define RAY_ECMD_JAPAN_CALL_SIGNAL 0x83 /* japan test thing */ - - -/* - * Configure/status/control memory - */ -struct ray_csc { - u_int8_t csc_mrxo_own; /* 0 ECF writes, 1 host write */ - u_int8_t csc_mrxc_own; /* 0 ECF writes, 1 host write */ - u_int8_t csc_rxhc_own; /* 0 ECF writes, 1 host write */ - u_int8_t csc_resv; - u_int16_t csc_mrx_overflow; /* ECF incs on rx overflow */ - u_int16_t csc_mrx_cksum; /* ECF incs on cksum error */ - u_int16_t csc_rx_hcksum; /* ECF incs on header cksum error */ - u_int8_t csc_rx_noise; /* average RSL measuremant */ -}; - -/* - * CCS area - */ -#define RAY_CCS_LINK_NULL 0xff -#define RAY_CCS_SIZE 16 - -#define RAY_CCS_TX_FIRST 0 -#define RAY_CCS_TX_LAST 13 -#define RAY_CCS_NTX (RAY_CCS_TX_LAST - RAY_CCS_TX_FIRST + 1) -#define RAY_TX_BUF_SIZE 2048 -#define RAY_CCS_CMD_FIRST 14 -#define RAY_CCS_CMD_LAST 63 -#define RAY_CCS_NCMD (RAY_CCS_CMD_LAST - RAY_CCS_CMD_FIRST + 1) -#define RAY_CCS_LAST 63 - -#define RAY_CCS_INDEX(ccs) (((ccs) - RAY_CCS_BASE) / RAY_CCS_SIZE) -#define RAY_CCS_ADDRESS(i) (RAY_CCS_BASE + (i) * RAY_CCS_SIZE) - -/* - * RCS area - */ -#define RAY_RCS_FIRST 64 -#define RAY_RCS_LAST 127 - -/* - * CCS commands - */ -struct ray_cmd { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ -}; - -#define RAY_CCS_STATUS_FREE 0x0 -#define RAY_CCS_STATUS_BUSY 0x1 -#define RAY_CCS_STATUS_COMPLETE 0x2 -#define RAY_CCS_STATUS_FAIL 0x3 -#define RAY_CCS_STATUS_STRINGS { \ - "free", \ - "busy", \ - "complete", \ - "fail" \ -} - -/* RAY_CMD_UPDATE_PARAMS */ -struct ray_cmd_update { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_paramid; - u_int8_t c_nparam; - u_int8_t c_failcause; -}; - -/* RAY_CMD_REPORT_PARAMS */ -struct ray_cmd_report { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_paramid; - u_int8_t c_nparam; - u_int8_t c_failcause; - u_int8_t c_len; -}; - -/* RAY_CMD_UPDATE_MCAST */ -struct ray_cmd_update_mcast { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_nmcast; -}; - -/* RAY_CMD_UPDATE_APM */ -struct ray_cmd_udpate_apm { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_mode; -}; - -/* RAY_CMD_START_NET and RAY_CMD_JOIN_NET */ -struct ray_cmd_net { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_upd_param; - u_int8_t c_bss_id[ETHER_ADDR_LEN]; - u_int8_t c_inited; - u_int8_t c_def_txrate; - u_int8_t c_encrypt; -}; -/* Parameters passed in HOST_TO_ECF section when c_upd_param is set in - * ray_cmd_net. */ -struct ray_net_params { - u_int8_t p_net_type; - u_int8_t p_ssid[32]; - u_int8_t p_privacy_must_start; - u_int8_t p_privacy_can_join; -}; - -/* RAY_CMD_START_ASSOC */ -struct ray_cmd_update_assoc { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_astatus; - u_int8_t c_aid[2]; -}; - -/* RAY_CMD_TX_REQ */ -struct ray_cmd_tx { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_bufp[2]; - u_int8_t c_len[2]; - u_int8_t c_resv[5]; - u_int8_t c_tx_rate; - u_int8_t c_apm_mode; - u_int8_t c_nretry; - u_int8_t c_antenna; -}; -struct ray_cmd_tx_4 { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_bufp[2]; - u_int8_t c_len[2]; - u_int8_t c_addr[ETHER_ADDR_LEN]; - u_int8_t c_apm_mode; - u_int8_t c_nretry; - u_int8_t c_antenna; -}; - -/* RAY_CMD_DUMP_MEM */ -struct ray_cmd_dump_mem { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_memtype; - u_int8_t c_memp[2]; - u_int8_t c_len; -}; - -/* RAY_CMD_START_TIMER */ -struct ray_cmd_start_timer { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_duration[2]; -}; - -/* RAY_ECMD_RX_DONE */ -struct ray_cmd_rx { - u_int8_t c_status; /* ccs generic header */ - u_int8_t c_cmd; /* " */ - u_int8_t c_link; /* " */ - u_int8_t c_bufp[2]; /* buffer pointer */ - u_int8_t c_len[2]; /* length */ - u_int8_t c_siglev; /* signal level */ - u_int8_t c_nextfrag; /* next fragment in packet */ - u_int8_t c_pktlen[2]; /* total packet length */ - u_int8_t c_antenna; /* ant. with best reception */ - u_int8_t c_updbss; /* only 1 for beacon messages */ -}; - -/* - * Transmit scratch space and phy header structures - */ -struct ray_tx_tib { - u_int8_t t_ccs_index; - u_int8_t t_psm; - u_int8_t t_pass_fail; - u_int8_t t_retry_count; - u_int8_t t_max_retries; - u_int8_t t_frags_remaining; - u_int8_t t_no_rb; - u_int8_t t_rts_reqd; - u_int8_t t_csma_tx_cntrl_2; - u_int8_t t_sifs_tx_cntrl_2; - u_int8_t t_tx_dma_addr_1[2]; - u_int8_t t_tx_dma_addr_2[2]; - u_int8_t t_var_dur_2mhz[2]; - u_int8_t t_var_dur_1mhz[2]; - u_int8_t t_max_dur_2mhz[2]; - u_int8_t t_max_dur_1mhz[2]; - u_int8_t t_hdr_len; - u_int8_t t_max_frag_len[2]; - u_int8_t t_var_len[2]; - u_int8_t t_phy_hdr_4; - u_int8_t t_mac_hdr_1; - u_int8_t t_mac_hdr_2; - u_int8_t t_sid[2]; -}; - -struct ray_tx_phy_header { - u_int8_t t_sfd[2]; - u_int8_t t_hdr_3; - u_int8_t t_hdr_4; -}; diff --git a/sys/dev/ray/if_rayvar.h b/sys/dev/ray/if_rayvar.h deleted file mode 100644 index d366918b213cd..0000000000000 --- a/sys/dev/ray/if_rayvar.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright (C) 2000 - * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * - */ - -/* - * Network parameters, used twice in sotfc to store what we want and what - * we have. - * - * The current parameters are ONLY valid in a function called from the runq - * and should not be accessed directly from ioctls. - */ -struct ray_nw_param { - struct ray_cmd_net p_1; - struct ray_net_params \ - p_2; - u_int8_t np_ap_status; - int np_promisc; -}; -#define np_upd_param p_1.c_upd_param -#define np_bss_id p_1.c_bss_id -#define np_inited p_1.c_inited -#define np_def_txrate p_1.c_def_txrate -#define np_encrypt p_1.c_encrypt -#define np_net_type p_2.p_net_type -#define np_ssid p_2.p_ssid -#define np_priv_start p_2.p_privacy_must_start -#define np_priv_join p_2.p_privacy_can_join - -/* - * One of these structures per allocated device - */ -struct ray_softc { - - device_t dev; /* Device */ - struct arpcom arpcom; /* Ethernet common */ - struct callout_handle - tx_timerh; /* Handle for tx timer */ - struct callout_handle - com_timerh; /* Handle for command timer */ - - bus_space_tag_t am_bst; /* Bus space tag for attribute memory */ - bus_space_handle_t am_bsh; /* Bus space handle for attribute mem */ - int am_rid; /* Resource id for attribute memory */ - struct resource* am_res; /* Resource for attribute memory */ - bus_space_tag_t cm_bst; /* Bus space tag for common memory */ - bus_space_handle_t cm_bsh; /* Bus space handle for common memory */ - int cm_rid; /* Resource id for common memory */ - struct resource* cm_res; /* Resource for common memory */ - int irq_rid; /* Resource id for irq */ - struct resource* irq_res; /* Resource for irq */ - void * irq_handle; /* Handle for irq handler */ - - u_char gone; /* 1 = Card bailed out */ - - int framing; /* Packet framing types */ - - struct ray_ecf_startup_v5 - sc_ecf_startup; /* Startup info from card */ - - TAILQ_HEAD(ray_comq, ray_comq_entry) - sc_comq; /* Command queue */ - - struct ray_nw_param sc_c; /* current network params */ - struct ray_nw_param sc_d; /* desired network params */ - int sc_havenet; /* true if we have a network */ - u_int8_t sc_ccsinuse[64];/* ccss' in use -- not for tx */ - - int sc_checkcounters; - u_int64_t sc_rxoverflow; /* Number of rx overflows */ - u_int64_t sc_rxcksum; /* Number of checksum errors */ - u_int64_t sc_rxhcksum; /* Number of header checksum errors */ - u_int8_t sc_rxnoise; /* Average receiver level */ - struct ray_siglev sc_siglevs[RAY_NSIGLEVRECS]; /* Antenna/levels */ -}; - -#define sc_station_addr sc_ecf_startup.e_station_addr -#define sc_version sc_ecf_startup.e_fw_build_string -#define sc_tibsize sc_ecf_startup.e_tibsize - -/* - * Command queue definitions - */ -typedef void (*ray_comqfn_t)(struct ray_softc *sc, struct ray_comq_entry *com); -MALLOC_DECLARE(M_RAYCOM); -MALLOC_DEFINE(M_RAYCOM, "raycom", "Raylink command queue entry"); -struct ray_comq_entry { - TAILQ_ENTRY(ray_comq_entry) c_chain; /* Tail queue. */ - ray_comqfn_t c_function; /* Function to call */ - int c_flags; /* Flags */ - u_int8_t c_retval; /* Return value */ - void *c_wakeup; /* Sleeping on this */ - size_t c_ccs; /* CCS structure */ - struct ray_nw_param - c_desired; /* network settings */ - struct ray_param_req - *c_pr; /* MIB report/update */ - char *c_mesg; -}; - -/* - * Framing types - */ -/* XXX maybe better as part of the if structure? */ -#define SC_FRAMING_WEBGEAR 0 - -/* - * Macro's and constants - */ -static int mib_info[RAY_MIB_MAX+1][3] = RAY_MIB_INFO; - -/* Indirections for reading/writing memory - from NetBSD/if_ray.c */ -#ifndef offsetof -#define offsetof(type, member) \ - ((size_t)(&((type *)0)->member)) -#endif /* offsetof */ - -#if RAY_NEED_CM_REMAPPING - -#define ATTR_READ_1(sc, off) \ - ray_attr_read_1((sc), (off)) - -#define ATTR_WRITE_1(sc, off, val) \ - ray_attr_write_1((sc), (off), (val)) - -#else - -#define ATTR_READ_1(sc, off) \ - ((u_int8_t)bus_space_read_1((sc)->am_bst, (sc)->am_bsh, (off))) - -#define ATTR_WRITE_1(sc, off, val) \ - bus_space_write_1((sc)->am_bst, (sc)->am_bsh, (off), (val)) - -#endif /* RAY_NEED_CM_REMAPPING */ - -#define SRAM_READ_1(sc, off) \ - ((u_int8_t)bus_space_read_1((sc)->cm_bst, (sc)->cm_bsh, (off))) - -#define SRAM_READ_REGION(sc, off, p, n) \ - bus_space_read_region_1((sc)->cm_bst, (sc)->cm_bsh, (off), (void *)(p), (n)) - -#define SRAM_READ_FIELD_1(sc, off, s, f) \ - SRAM_READ_1((sc), (off) + offsetof(struct s, f)) - -#define SRAM_READ_FIELD_2(sc, off, s, f) \ - ((((u_int16_t)SRAM_READ_1((sc), (off) + offsetof(struct s, f)) << 8) \ - |(SRAM_READ_1((sc), (off) + 1 + offsetof(struct s, f))))) - -#define SRAM_READ_FIELD_N(sc, off, s, f, p, n) \ - SRAM_READ_REGION((sc), (off) + offsetof(struct s, f), (p), (n)) - -#define SRAM_WRITE_1(sc, off, val) \ - bus_space_write_1((sc)->cm_bst, (sc)->cm_bsh, (off), (val)) - -#define SRAM_WRITE_REGION(sc, off, p, n) \ - bus_space_write_region_1((sc)->cm_bst, (sc)->cm_bsh, (off), (void *)(p), (n)) - -#define SRAM_WRITE_FIELD_1(sc, off, s, f, v) \ - SRAM_WRITE_1((sc), (off) + offsetof(struct s, f), (v)) - -#define SRAM_WRITE_FIELD_2(sc, off, s, f, v) do { \ - SRAM_WRITE_1((sc), (off) + offsetof(struct s, f), (((v) >> 8 ) & 0xff)); \ - SRAM_WRITE_1((sc), (off) + 1 + offsetof(struct s, f), ((v) & 0xff)); \ -} while (0) - -#define SRAM_WRITE_FIELD_N(sc, off, s, f, p, n) \ - SRAM_WRITE_REGION((sc), (off) + offsetof(struct s, f), (p), (n)) - -/* Flags for runq entries */ -#define RAY_COM_FWOK 0x0001 /* Wakeup on completion */ -#define RAY_COM_FRUNNING 0x0002 /* This one running */ -#define RAY_COM_FCOMPLETED 0x0004 /* This one completed */ -#define RAY_COM_FWAIT 0x0008 /* Do not run the queue */ -#define RAY_COM_FCHKRUNNING 0x0010 /* Check IFF_RUNNING */ -#define RAY_COM_FDETACHED 0x0020 /* Card is gone */ -#define RAY_COM_FWOKEN 0x0040 /* Woken by detach */ -#define RAY_COM_FLAGS_PRINTFB \ - "\020" \ - "\001WOK" \ - "\002RUNNING" \ - "\003COMPLETED" \ - "\004WAIT" \ - "\005CHKRUNNING" \ - "\006DETACHED" - -#define RAY_COM_NEEDS_TIMO(cmd) ( \ - (cmd == RAY_CMD_DOWNLOAD_PARAMS) || \ - (cmd == RAY_CMD_UPDATE_PARAMS) || \ - (cmd == RAY_CMD_UPDATE_MCAST) \ - ) - -#ifndef RAY_COM_TIMEOUT -#define RAY_COM_TIMEOUT (hz / 2) -#endif - -#ifndef RAY_RESET_TIMEOUT -#define RAY_RESET_TIMEOUT (10 * hz) -#endif - -#ifndef RAY_TX_TIMEOUT -#define RAY_TX_TIMEOUT (hz / 2) -#endif - -#define RAY_CCS_FREE(sc, ccs) \ - SRAM_WRITE_FIELD_1((sc), (ccs), ray_cmd, c_status, RAY_CCS_STATUS_FREE) - -#define RAY_ECF_READY(sc) \ - (!(ATTR_READ_1((sc), RAY_ECFIR) & RAY_ECFIR_IRQ)) - -#define RAY_ECF_START_CMD(sc) ATTR_WRITE_1((sc), RAY_ECFIR, RAY_ECFIR_IRQ) - -#define RAY_HCS_CLEAR_INTR(sc) ATTR_WRITE_1((sc), RAY_HCSIR, 0) - -#define RAY_HCS_INTR(sc) (ATTR_READ_1((sc), RAY_HCSIR) & RAY_HCSIR_IRQ) - -#define RAY_PANIC(sc, fmt, args...) do { \ - panic("ray%d: %s(%d) " fmt "\n", device_get_unit((sc)->dev), \ - __FUNCTION__ , __LINE__ , ##args); \ -} while (0) - -#define RAY_PRINTF(sc, fmt, args...) do { \ - device_printf((sc)->dev, "%s(%d) " fmt "\n", \ - __FUNCTION__ , __LINE__ , ##args); \ -} while (0) - -#define RAY_COM_MALLOC(function, flags) \ - ray_com_malloc((function), (flags), __STRING(function)); - -#define RAY_COM_FREE(com, ncom) do { \ - int i; \ - for (i = 0; i < ncom; i++) \ - FREE(com[i], M_RAYCOM); \ -} while (0) - -/* - * This macro handles adding commands to the runq and quickly - * getting away when the card is detached. The macro returns - * from the current function with ENXIO. - */ -#define RAY_COM_RUNQ(sc, com, ncom, mesg, error) do { \ - (error) = ray_com_runq_add((sc), (com), (ncom), (mesg)); \ - if ((error) == ENXIO) { \ - RAY_COM_FREE((com), (ncom)); \ - return (error); \ - } else if ((error) && ((error) != ENXIO)) \ - RAY_PRINTF(sc, "got error from runq 0x%x", (error)); \ -} while (0) - - -#define RAY_COM_INIT(com, function, flags) \ - ray_com_init((com), (function), (flags), __STRING(function)); - -#ifndef RAY_COM_CHECK -#define RAY_COM_CHECK(sc, com) -#endif /* RAY_COM_CHECK */ - -#ifndef RAY_MBUF_DUMP -#define RAY_MBUF_DUMP(sc, mask, m, s) -#endif /* RAY_MBUF_DUMP */ - -#ifndef RAY_RECERR -#define RAY_RECERR(sc, fmt, args...) do { \ - struct ifnet *ifp = &(sc)->arpcom.ac_if; \ - if (ifp->if_flags & IFF_DEBUG) { \ - device_printf((sc)->dev, "%s(%d) " fmt "\n", \ - __FUNCTION__ , __LINE__ , ##args); \ -} } while (0) -#endif /* RAY_RECERR */ - -/* - * The driver assumes that the common memory is always mapped in, - * for the moment we ensure this with the following macro at the - * head of each function and by using functions to access attribute - * memory. Hysterical raisins led to the non-"reflexive" approach. - * Roll on NEWCARD and it can all die... - */ -#if RAY_NEED_CM_REMAPPING -#define RAY_MAP_CM(sc) ray_attr_mapcm(sc) -#else -#define RAY_MAP_CM(sc) -#endif /* RAY_NEED_CM_REMAPPING */ diff --git a/sys/dev/rp/rpreg.h b/sys/dev/rp/rpreg.h deleted file mode 100644 index a7cde1b03a257..0000000000000 --- a/sys/dev/rp/rpreg.h +++ /dev/null @@ -1,1015 +0,0 @@ -/* - * Copyright (c) Comtrol Corporation <support@comtrol.com> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted prodived that the follwoing conditions - * are met. - * 1. Redistributions of source code must retain the above copyright - * notive, this list of conditions and the following disclainer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials prodided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Comtrol Corporation. - * 4. The name of Comtrol Corporation may not be used to endorse or - * promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY COMTROL CORPORATION ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL COMTROL CORPORATION BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Begin OS-specific defines - rpreg.h - for RocketPort FreeBSD - */ - -typedef unsigned char Byte_t; -typedef unsigned int ByteIO_t; - -typedef unsigned int Word_t; -typedef unsigned int WordIO_t; - -typedef unsigned long DWord_t; -typedef unsigned int DWordIO_t; - -#define rp_readio(size, ctlp, rid, offset) \ - (bus_space_read_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset)) -#define rp_readmultiio(size, ctlp, rid, offset, addr, count) \ - (bus_space_read_multi_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset, addr, count)) -#define rp_writeio(size, ctlp, rid, offset, data) \ - (bus_space_write_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset, data)) -#define rp_writemultiio(size, ctlp, rid, offset, addr, count) \ - (bus_space_write_multi_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset, addr, count)) - -#define rp_readio1(ctlp, rid, offset) rp_readio(1, ctlp, rid, offset) -#define rp_readio2(ctlp, rid, offset) rp_readio(2, ctlp, rid, offset) -#define rp_readio4(ctlp, rid, offset) rp_readio(4, ctlp, rid, offset) -#define rp_writeio1(ctlp, rid, offset, data) rp_writeio(1, ctlp, rid, offset, data) -#define rp_writeio2(ctlp, rid, offset, data) rp_writeio(2, ctlp, rid, offset, data) -#define rp_writeio4(ctlp, rid, offset, data) rp_writeio(4, ctlp, rid, offset, data) -#define rp_readmultiio1(ctlp, rid, offset, addr, count) rp_readmultiio(1, ctlp, rid, offset, addr, count) -#define rp_readmultiio2(ctlp, rid, offset, addr, count) rp_readmultiio(2, ctlp, rid, offset, addr, count) -#define rp_readmultiio4(ctlp, rid, offset, addr, count) rp_readmultiio(4, ctlp, rid, offset, addr, count) -#define rp_writemultiio1(ctlp, rid, offset, addr, count) rp_writemultiio(1, ctlp, rid, offset, addr, count) -#define rp_writemultiio2(ctlp, rid, offset, addr, count) rp_writemultiio(2, ctlp, rid, offset, addr, count) -#define rp_writemultiio4(ctlp, rid, offset, addr, count) rp_writemultiio(4, ctlp, rid, offset, addr, count) - -#define rp_readaiop1(ctlp, aiop, offset) \ - (rp_readio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset))) -#define rp_readaiop2(ctlp, aiop, offset) \ - (rp_readio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset))) -#define rp_readaiop4(ctlp, aiop, offset) \ - (rp_readio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset))) -#define rp_readmultiaiop1(ctlp, aiop, offset, addr, count) \ - (rp_readmultiio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count)) -#define rp_readmultiaiop2(ctlp, aiop, offset, addr, count) \ - (rp_readmultiio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count)) -#define rp_readmultiaiop4(ctlp, aiop, offset, addr, count) \ - (rp_readmultiio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count)) -#define rp_writeaiop1(ctlp, aiop, offset, data) \ - (rp_writeio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), data)) -#define rp_writeaiop2(ctlp, aiop, offset, data) \ - (rp_writeio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), data)) -#define rp_writeaiop4(ctlp, aiop, offset, data) \ - (rp_writeio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), data)) -#define rp_writemultiaiop1(ctlp, aiop, offset, addr, count) \ - (rp_writemultiio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count)) -#define rp_writemultiaiop2(ctlp, aiop, offset, addr, count) \ - (rp_writemultiio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count)) -#define rp_writemultiaiop4(ctlp, aiop, offset, addr, count) \ - (rp_writemultiio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count)) - -#define rp_readch1(chp, offset) \ - (rp_readaiop1((chp)->CtlP, (chp)->AiopNum, offset)) -#define rp_readch2(chp, offset) \ - (rp_readaiop2((chp)->CtlP, (chp)->AiopNum, offset)) -#define rp_readch4(chp, offset) \ - (rp_readaiop4((chp)->CtlP, (chp)->AiopNum, offset)) -#define rp_readmultich1(chp, offset, addr, count) \ - (rp_readmultiaiop1((chp)->CtlP, (chp)->AiopNum, offset, addr, count)) -#define rp_readmultich2(chp, offset, addr, count) \ - (rp_readmultiaiop2((chp)->CtlP, (chp)->AiopNum, offset, addr, count)) -#define rp_readmultich4(chp, offset, addr, count) \ - (rp_readmultiaiop4((chp)->CtlP, (chp)->AiopNum, offset, addr, count)) -#define rp_writech1(chp, offset, data) \ - (rp_writeaiop1((chp)->CtlP, (chp)->AiopNum, offset, data)) -#define rp_writech2(chp, offset, data) \ - (rp_writeaiop2((chp)->CtlP, (chp)->AiopNum, offset, data)) -#define rp_writech4(chp, offset, data) \ - (rp_writeaiop4((chp)->CtlP, (chp)->AiopNum, offset, data)) -#define rp_writemultich1(chp, offset, addr, count) \ - (rp_writemultiaiop1((chp)->CtlP, (chp)->AiopNum, offset, addr, count)) -#define rp_writemultich2(chp, offset, addr, count) \ - (rp_writemultiaiop2((chp)->CtlP, (chp)->AiopNum, offset, addr, count)) -#define rp_writemultich4(chp, offset, addr, count) \ - (rp_writemultiaiop4((chp)->CtlP, (chp)->AiopNum, offset, addr, count)) - -/* - * End of OS-specific defines - */ - -#define ROCKET_H - -#define CTL_SIZE 4 -#define AIOP_CTL_SIZE 4 -#define CHAN_AIOP_SIZE 8 -#define MAX_PORTS_PER_AIOP 8 -#define MAX_AIOPS_PER_BOARD 4 -#define MAX_PORTS_PER_BOARD 32 - -/* Controller ID numbers */ -#define CTLID_NULL -1 /* no controller exists */ -#define CTLID_0001 0x0001 /* controller release 1 */ - -/* AIOP ID numbers, identifies AIOP type implementing channel */ -#define AIOPID_NULL -1 /* no AIOP or channel exists */ -#define AIOPID_0001 0x0001 /* AIOP release 1 */ - -#define NULLDEV -1 /* identifies non-existant device */ -#define NULLCTL -1 /* identifies non-existant controller */ -#define NULLCTLPTR (CONTROLLER_T *)0 /* identifies non-existant controller */ -#define NULLAIOP -1 /* identifies non-existant AIOP */ -#define NULLCHAN -1 /* identifies non-existant channel */ - -/************************************************************************ - Global Register Offsets - Direct Access - Fixed values -************************************************************************/ - -#define _CMD_REG 0x38 /* Command Register 8 Write */ -#define _INT_CHAN 0x39 /* Interrupt Channel Register 8 Read */ -#define _INT_MASK 0x3A /* Interrupt Mask Register 8 Read / Write */ -#define _UNUSED 0x3B /* Unused 8 */ -#define _INDX_ADDR 0x3C /* Index Register Address 16 Write */ -#define _INDX_DATA 0x3E /* Index Register Data 8/16 Read / Write */ - -/************************************************************************ - Channel Register Offsets for 1st channel in AIOP - Direct Access -************************************************************************/ -#define _TD0 0x00 /* Transmit Data 16 Write */ -#define _RD0 0x00 /* Receive Data 16 Read */ -#define _CHN_STAT0 0x20 /* Channel Status 8/16 Read / Write */ -#define _FIFO_CNT0 0x10 /* Transmit/Receive FIFO Count 16 Read */ -#define _INT_ID0 0x30 /* Interrupt Identification 8 Read */ - -/************************************************************************ - Tx Control Register Offsets - Indexed - External - Fixed -************************************************************************/ -#define _TX_ENBLS 0x980 /* Tx Processor Enables Register 8 Read / Write */ -#define _TXCMP1 0x988 /* Transmit Compare Value #1 8 Read / Write */ -#define _TXCMP2 0x989 /* Transmit Compare Value #2 8 Read / Write */ -#define _TXREP1B1 0x98A /* Tx Replace Value #1 - Byte 1 8 Read / Write */ -#define _TXREP1B2 0x98B /* Tx Replace Value #1 - Byte 2 8 Read / Write */ -#define _TXREP2 0x98C /* Transmit Replace Value #2 8 Read / Write */ - -/************************************************************************ - Receive FIFO -************************************************************************/ -#define RXFIFO_DATA 0x5f -#define RXFIFO_OUT 0x5c -#define RXFIFO_EN 0x08 -#define RXFIFO_DIS 0xa7 - -/************************************************************************ -Memory Controller Register Offsets - Indexed - External - Fixed -************************************************************************/ -#define _RX_FIFO 0x000 /* Rx FIFO */ -#define _TX_FIFO 0x800 /* Tx FIFO */ -#define _RXF_OUTP 0x990 /* Rx FIFO OUT pointer 16 Read / Write */ -#define _RXF_INP 0x992 /* Rx FIFO IN pointer 16 Read / Write */ -#define _TXF_OUTP 0x994 /* Tx FIFO OUT pointer 8 Read / Write */ -#define _TXF_INP 0x995 /* Tx FIFO IN pointer 8 Read / Write */ -#define _TXP_CNT 0x996 /* Tx Priority Count 8 Read / Write */ -#define _TXP_PNTR 0x997 /* Tx Priority Pointer 8 Read / Write */ - -#define PRI_PEND 0x80 /* Priority data pending (bit7, Tx pri cnt) */ -#define TXFIFO_SIZE 255 /* size of Tx FIFO */ -#define RXFIFO_SIZE 1023 /* size of Rx FIFO */ - -/************************************************************************ -Tx Priority Buffer - Indexed - External - Fixed -************************************************************************/ -#define _TXP_BUF 0x9C0 /* Tx Priority Buffer 32 Bytes Read / Write */ -#define TXP_SIZE 0x20 /* 32 bytes */ - -/************************************************************************ -Channel Register Offsets - Indexed - Internal - Fixed -************************************************************************/ - -#define _TX_CTRL 0xFF0 /* Transmit Control 16 Write */ -#define _RX_CTRL 0xFF2 /* Receive Control 8 Write */ -#define _BAUD 0xFF4 /* Baud Rate 16 Write */ -#define _CLK_PRE 0xFF6 /* Clock Prescaler 8 Write */ - -#define CLOCK_PRESC 0x19 /* mod 9 (divide by 10) prescale */ - -#define BRD50 4607 -#define BRD75 3071 -#define BRD110 2094 -#define BRD134 1712 -#define BRD150 1535 -#define BRD200 1151 -#define BRD300 767 -#define BRD600 383 -#define BRD1200 191 -#define BRD1800 127 -#define BRD2000 114 -#define BRD2400 95 -#define BRD3600 64 -#define BRD4800 47 -#define BRD7200 31 -#define BRD9600 23 -#define BRD14400 15 -#define BRD19200 11 -#define BRD38400 5 -#define BRD57600 3 -#define BRD76800 2 -#define BRD115200 1 -#define BRD230400 0 - -#define STMBREAK 0x08 /* BREAK */ -#define STMFRAME 0x04 /* framing error */ -#define STMRCVROVR 0x02 /* receiver over run error */ -#define STMPARITY 0x01 /* parity error */ -#define STMERROR (STMBREAK | STMFRAME | STMPARITY) -#define STMBREAKH 0x800 /* BREAK */ -#define STMFRAMEH 0x400 /* framing error */ -#define STMRCVROVRH 0x200 /* receiver over run error */ -#define STMPARITYH 0x100 /* parity error */ -#define STMERRORH (STMBREAKH | STMFRAMEH | STMPARITYH) - -#define CTS_ACT 0x20 /* CTS input asserted */ -#define DSR_ACT 0x10 /* DSR input asserted */ -#define CD_ACT 0x08 /* CD input asserted */ -#define TXFIFOMT 0x04 /* Tx FIFO is empty */ -#define TXSHRMT 0x02 /* Tx shift register is empty */ -#define RDA 0x01 /* Rx data available */ -#define DRAINED (TXFIFOMT | TXSHRMT) /* indicates Tx is drained */ - -#define STATMODE 0x8000 /* status mode enable bit */ -#define RXFOVERFL 0x2000 /* receive FIFO overflow */ -#define RX2MATCH 0x1000 /* receive compare byte 2 match */ -#define RX1MATCH 0x0800 /* receive compare byte 1 match */ -#define RXBREAK 0x0400 /* received BREAK */ -#define RXFRAME 0x0200 /* received framing error */ -#define RXPARITY 0x0100 /* received parity error */ -#define STATERROR (RXBREAK | RXFRAME | RXPARITY) - -#define CTSFC_EN 0x80 /* CTS flow control enable bit */ -#define RTSTOG_EN 0x40 /* RTS toggle enable bit */ -#define TXINT_EN 0x10 /* transmit interrupt enable */ -#define STOP2 0x08 /* enable 2 stop bits (0 = 1 stop) */ -#define PARITY_EN 0x04 /* enable parity (0 = no parity) */ -#define EVEN_PAR 0x02 /* even parity (0 = odd parity) */ -#define DATA8BIT 0x01 /* 8 bit data (0 = 7 bit data) */ - -#define SETBREAK 0x10 /* send break condition (must clear) */ -#define LOCALLOOP 0x08 /* local loopback set for test */ -#define SET_DTR 0x04 /* assert DTR */ -#define SET_RTS 0x02 /* assert RTS */ -#define TX_ENABLE 0x01 /* enable transmitter */ - -#define RTSFC_EN 0x40 /* RTS flow control enable */ -#define RXPROC_EN 0x20 /* receive processor enable */ -#define TRIG_NO 0x00 /* Rx FIFO trigger level 0 (no trigger) */ -#define TRIG_1 0x08 /* trigger level 1 char */ -#define TRIG_1_2 0x10 /* trigger level 1/2 */ -#define TRIG_7_8 0x18 /* trigger level 7/8 */ -#define TRIG_MASK 0x18 /* trigger level mask */ -#define SRCINT_EN 0x04 /* special Rx condition interrupt enable */ -#define RXINT_EN 0x02 /* Rx interrupt enable */ -#define MCINT_EN 0x01 /* modem change interrupt enable */ - -#define RXF_TRIG 0x20 /* Rx FIFO trigger level interrupt */ -#define TXFIFO_MT 0x10 /* Tx FIFO empty interrupt */ -#define SRC_INT 0x08 /* special receive condition interrupt */ -#define DELTA_CD 0x04 /* CD change interrupt */ -#define DELTA_CTS 0x02 /* CTS change interrupt */ -#define DELTA_DSR 0x01 /* DSR change interrupt */ - -#define REP1W2_EN 0x10 /* replace byte 1 with 2 bytes enable */ -#define IGN2_EN 0x08 /* ignore byte 2 enable */ -#define IGN1_EN 0x04 /* ignore byte 1 enable */ -#define COMP2_EN 0x02 /* compare byte 2 enable */ -#define COMP1_EN 0x01 /* compare byte 1 enable */ - -#define RESET_ALL 0x80 /* reset AIOP (all channels) */ -#define TXOVERIDE 0x40 /* Transmit software off override */ -#define RESETUART 0x20 /* reset channel's UART */ -#define RESTXFCNT 0x10 /* reset channel's Tx FIFO count register */ -#define RESRXFCNT 0x08 /* reset channel's Rx FIFO count register */ - -#define INTSTAT0 0x01 /* AIOP 0 interrupt status */ -#define INTSTAT1 0x02 /* AIOP 1 interrupt status */ -#define INTSTAT2 0x04 /* AIOP 2 interrupt status */ -#define INTSTAT3 0x08 /* AIOP 3 interrupt status */ - -#define INTR_EN 0x08 /* allow interrupts to host */ -#define INT_STROB 0x04 /* strobe and clear interrupt line (EOI) */ - -#define CHAN3_EN 0x08 /* enable AIOP 3 */ -#define CHAN2_EN 0x04 /* enable AIOP 2 */ -#define CHAN1_EN 0x02 /* enable AIOP 1 */ -#define CHAN0_EN 0x01 /* enable AIOP 0 */ -#define FREQ_DIS 0x00 -#define FREQ_274HZ 0x60 -#define FREQ_137HZ 0x50 -#define FREQ_69HZ 0x40 -#define FREQ_34HZ 0x30 -#define FREQ_17HZ 0x20 -#define FREQ_9HZ 0x10 -#define PERIODIC_ONLY 0x80 /* only PERIODIC interrupt */ - -#define CHANINT_EN 0x0100 /* flags to enable/disable channel ints */ - -#define RDATASIZE 72 -#define RREGDATASIZE 52 - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -struct CONTROLLER_str; -struct CHANNEL_str; - -/* The types of bus-specific methods */ -typedef int rp_aiop2rid_t(int, int); -typedef int rp_aiop2off_t(int, int); -typedef unsigned char rp_ctlmask_t(struct CONTROLLER_str *); - -/* Controller level information structure */ -struct CONTROLLER_str -{ - int CtlID; - int NumAiop; - int AiopID[AIOP_CTL_SIZE]; - int AiopNumChan[AIOP_CTL_SIZE]; - - /* Device and resource management */ - device_t dev; /* device */ - int io_num; /* Number of IO resources */ - int *io_rid; /* IO resource IDs */ - struct resource **io; /* IO resources */ - - struct rp_port *rp; /* port */ - struct tty *tty; /* tty */ - - /* Device nodes */ - dev_t *dev_nodes; - - /* Bus-specific properties */ - void *bus_ctlp; - - /* Bus-specific methods */ - rp_aiop2rid_t *aiop2rid; /* (aiop, offset) -> rid */ - rp_aiop2off_t *aiop2off; /* (aiop, offset) -> off */ - rp_ctlmask_t *ctlmask; /* Int status */ -}; -typedef struct CONTROLLER_str CONTROLLER_T; -typedef CONTROLLER_T CONTROLLER_t; - -/* Channel level information structure */ -struct CHANNEL_str -{ - CONTROLLER_t *CtlP; - int AiopNum; - int ChanID; - int ChanNum; - - Word_t TxFIFO; - Word_t TxFIFOPtrs; - Word_t RxFIFO; - Word_t RxFIFOPtrs; - Word_t TxPrioCnt; - Word_t TxPrioPtr; - Word_t TxPrioBuf; - - Byte_t R[RREGDATASIZE]; - - Byte_t BaudDiv[4]; - Byte_t TxControl[4]; - Byte_t RxControl[4]; - Byte_t TxEnables[4]; - Byte_t TxCompare[4]; - Byte_t TxReplace1[4]; - Byte_t TxReplace2[4]; -}; - -typedef struct CHANNEL_str CHANNEL_T; -typedef CHANNEL_T CHANNEL_t; -typedef CHANNEL_T * CHANPTR_T; - -#define CHNOFF_TXRXDATA(chp) ((chp)->ChanNum * 2 + _TD0) -#define CHNOFF_CHANSTAT(chp) ((chp)->ChanNum * 2 + _CHN_STAT0) -#define CHNOFF_TXRXCOUNT(chp) ((chp)->ChanNum * 2 + _FIFO_CNT0) -#define CHNOFF_INTID(chp) ((chp)->ChanNum + _INT_ID0) - -/*************************************************************************** -Function: sClrBreak -Purpose: Stop sending a transmit BREAK signal -Call: sClrBreak(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sClrBreak(ChP) \ -{ \ - (ChP)->TxControl[3] &= ~SETBREAK; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sClrDTR -Purpose: Clr the DTR output -Call: sClrDTR(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sClrDTR(ChP) \ -{ \ - (ChP)->TxControl[3] &= ~SET_DTR; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sClrRTS -Purpose: Clr the RTS output -Call: sClrRTS(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sClrRTS(ChP) \ -{ \ - (ChP)->TxControl[3] &= ~SET_RTS; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sClrTxXOFF -Purpose: Clear any existing transmit software flow control off condition -Call: sClrTxXOFF(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sClrTxXOFF(ChP) \ -{ \ - rp_writech1(ChP,_CMD_REG,TXOVERIDE | (Byte_t)(ChP)->ChanNum); \ - rp_writech1(ChP,_CMD_REG,(Byte_t)(ChP)->ChanNum); \ -} - -/*************************************************************************** -Function: sDisCTSFlowCtl -Purpose: Disable output flow control using CTS -Call: sDisCTSFlowCtl(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sDisCTSFlowCtl(ChP) \ -{ \ - (ChP)->TxControl[2] &= ~CTSFC_EN; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: DisParity -Purpose: Disable parity -Call: sDisParity(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: Function sSetParity() can be used in place of functions sEnParity(), - sDisParity(), sSetOddParity(), and sSetEvenParity(). -*/ -#define sDisParity(ChP) \ -{ \ - (ChP)->TxControl[2] &= ~PARITY_EN; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sDisRxFIFO -Purpose: Disable Rx FIFO -Call: sDisRxFIFO(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sDisRxFIFO(ChP) \ -{ \ - (ChP)->R[0x32] = 0x0a; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0x30]); \ -} - -/*************************************************************************** -Function: sDisRxStatusMode -Purpose: Disable the Rx status mode -Call: sDisRxStatusMode(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: This takes the channel out of the receive status mode. All - subsequent reads of receive data using sReadRxWord() will return - two data bytes. -*/ -#define sDisRxStatusMode(ChP) rp_writech2(ChP,CHNOFF_CHANSTAT(ChP),0) - -/*************************************************************************** -Function: sDisTransmit -Purpose: Disable transmit -Call: sDisTransmit(ChP) - CHANNEL_T *ChP; Ptr to channel structure - This disables movement of Tx data from the Tx FIFO into the 1 byte - Tx buffer. Therefore there could be up to a 2 byte latency - between the time sDisTransmit() is called and the transmit buffer - and transmit shift register going completely empty. -*/ -#define sDisTransmit(ChP) \ -{ \ - (ChP)->TxControl[3] &= ~TX_ENABLE; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sDisTxSoftFlowCtl -Purpose: Disable Tx Software Flow Control -Call: sDisTxSoftFlowCtl(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sDisTxSoftFlowCtl(ChP) \ -{ \ - (ChP)->R[0x06] = 0x8a; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0x04]); \ -} - -/*************************************************************************** -Function: sEnCTSFlowCtl -Purpose: Enable output flow control using CTS -Call: sEnCTSFlowCtl(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sEnCTSFlowCtl(ChP) \ -{ \ - (ChP)->TxControl[2] |= CTSFC_EN; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: EnParity -Purpose: Enable parity -Call: sEnParity(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: Function sSetParity() can be used in place of functions sEnParity(), - sDisParity(), sSetOddParity(), and sSetEvenParity(). - -Warnings: Before enabling parity odd or even parity should be chosen using - functions sSetOddParity() or sSetEvenParity(). -*/ -#define sEnParity(ChP) \ -{ \ - (ChP)->TxControl[2] |= PARITY_EN; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sEnRTSFlowCtl -Return: void -*/ -#define sEnRTSFlowCtl(ChP) \ -{ \ - (ChP)->TxControl[2] &= ~RTSTOG_EN; \ - (ChP)->TxControl[3] &= ~SET_RTS; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ - (ChP)->RxControl[2] |= RTSFC_EN; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \ -} - -/*************************************************************************** -Function: sDisRTSFlowCtl -Return: void -*/ -#define sDisRTSFlowCtl(ChP) \ -{ \ - (ChP)->RxControl[2] &= ~RTSFC_EN; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \ -} - -/*************************************************************************** -Function: sEnRxFIFO -Purpose: Enable Rx FIFO -Call: sEnRxFIFO(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sEnRxFIFO(ChP) \ -{ \ - (ChP)->R[0x32] = 0x08; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0x30]); \ -} - -/*************************************************************************** -Function: sEnRxProcessor -Purpose: Enable the receive processor -Call: sEnRxProcessor(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: This function is used to start the receive processor. When - the channel is in the reset state the receive processor is not - running. This is done to prevent the receive processor from - executing invalid microcode instructions prior to the - downloading of the microcode. - -Warnings: This function must be called after valid microcode has been - downloaded to the AIOP, and it must not be called before the - microcode has been downloaded. -*/ -#define sEnRxProcessor(ChP) \ -{ \ - (ChP)->RxControl[2] |= RXPROC_EN; \ - rp_writech2(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \ -} - -/*************************************************************************** -Function: sEnRxStatusMode -Purpose: Enable the Rx status mode -Call: sEnRxStatusMode(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: This places the channel in the receive status mode. All subsequent - reads of receive data using sReadRxWord() will return a data byte - in the low word and a status byte in the high word. - -*/ -#define sEnRxStatusMode(ChP) rp_writech2(ChP,CHNOFF_CHANSTAT(ChP),STATMODE) - -/*************************************************************************** -Function: sEnTransmit -Purpose: Enable transmit -Call: sEnTransmit(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sEnTransmit(ChP) \ -{ \ - (ChP)->TxControl[3] |= TX_ENABLE; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sGetAiopIntStatus -Purpose: Get the AIOP interrupt status -Call: sGetAiopIntStatus(CtlP,AiopNum) - CONTROLLER_T *CtlP; Ptr to controller structure - int AiopNum; AIOP number -Return: Byte_t: The AIOP interrupt status. Bits 0 through 7 - represent channels 0 through 7 respectively. If a - bit is set that channel is interrupting. -*/ -#define sGetAiopIntStatus(CtlP,AIOPNUM) rp_readaiop1(CtlP,AIOPNUM,_INT_CHAN) - -/*************************************************************************** -Function: sGetAiopNumChan -Purpose: Get the number of channels supported by an AIOP -Call: sGetAiopNumChan(CtlP,AiopNum) - CONTROLLER_T *CtlP; Ptr to controller structure - int AiopNum; AIOP number -Return: int: The number of channels supported by the AIOP -*/ -#define sGetAiopNumChan(CtlP,AIOPNUM) CtlP->AiopNumChan[AIOPNUM] - -/*************************************************************************** -Function: sGetChanIntID -Purpose: Get a channel's interrupt identification byte -Call: sGetChanIntID(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: Byte_t: The channel interrupt ID. Can be any - combination of the following flags: - RXF_TRIG: Rx FIFO trigger level interrupt - TXFIFO_MT: Tx FIFO empty interrupt - SRC_INT: Special receive condition interrupt - DELTA_CD: CD change interrupt - DELTA_CTS: CTS change interrupt - DELTA_DSR: DSR change interrupt -*/ -#define sGetChanIntID(ChP) (rp_readch1(ChP,(ChP)->ChanNum+_INT_ID0) & (RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR)) - -/*************************************************************************** -Function: sGetChanNum -Purpose: Get the number of a channel within an AIOP -Call: sGetChanNum(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: int: Channel number within AIOP, or NULLCHAN if channel does - not exist. -*/ -#define sGetChanNum(ChP) (ChP)->ChanNum - -/*************************************************************************** -Function: sGetChanStatus -Purpose: Get the channel status -Call: sGetChanStatus(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: Word_t: The channel status. Can be any combination of - the following flags: - LOW BYTE FLAGS - CTS_ACT: CTS input asserted - DSR_ACT: DSR input asserted - CD_ACT: CD input asserted - TXFIFOMT: Tx FIFO is empty - TXSHRMT: Tx shift register is empty - RDA: Rx data available - - HIGH BYTE FLAGS - STATMODE: status mode enable bit - RXFOVERFL: receive FIFO overflow - RX2MATCH: receive compare byte 2 match - RX1MATCH: receive compare byte 1 match - RXBREAK: received BREAK - RXFRAME: received framing error - RXPARITY: received parity error -Warnings: This function will clear the high byte flags in the Channel - Status Register. -*/ -#define sGetChanStatus(ChP) rp_readch2(ChP,CHNOFF_CHANSTAT(ChP)) - -/*************************************************************************** -Function: sGetChanStatusLo -Purpose: Get the low byte only of the channel status -Call: sGetChanStatusLo(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: Byte_t: The channel status low byte. Can be any combination - of the following flags: - CTS_ACT: CTS input asserted - DSR_ACT: DSR input asserted - CD_ACT: CD input asserted - TXFIFOMT: Tx FIFO is empty - TXSHRMT: Tx shift register is empty - RDA: Rx data available -*/ -#define sGetChanStatusLo(ChP) rp_readch1(ChP,CHNOFF_CHANSTAT(ChP)) - -/*************************************************************************** -Function: sGetRxCnt -Purpose: Get the number of data bytes in the Rx FIFO -Call: sGetRxCnt(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: int: The number of data bytes in the Rx FIFO. -Comments: Byte read of count register is required to obtain Rx count. - -*/ -#define sGetRxCnt(ChP) rp_readch2(ChP,CHNOFF_TXRXCOUNT(ChP)) - -/*************************************************************************** -Function: sGetTxCnt -Purpose: Get the number of data bytes in the Tx FIFO -Call: sGetTxCnt(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: Byte_t: The number of data bytes in the Tx FIFO. -Comments: Byte read of count register is required to obtain Tx count. - -*/ -#define sGetTxCnt(ChP) rp_readch1(ChP,CHNOFF_TXRXCOUNT(ChP)) - -/***************************************************************************** -Function: sGetTxRxDataIO -Purpose: Get the offset of a channel's TxRx Data register -Call: sGetTxRxDataIO(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Return: WordIO_t: offset of a channel's TxRx Data register -*/ -#define sGetTxRxDataIO(ChP) CHNOFF_TXRXDATA(ChP) - -/*************************************************************************** -Function: sInitChanDefaults -Purpose: Initialize a channel structure to its default state. -Call: sInitChanDefaults(ChP) - CHANNEL_T *ChP; Ptr to the channel structure -Comments: This function must be called once for every channel structure - that exists before any other SSCI calls can be made. - -*/ -#define sInitChanDefaults(ChP) \ -{ \ - (ChP)->CtlP = NULLCTLPTR; \ - (ChP)->AiopNum = NULLAIOP; \ - (ChP)->ChanID = AIOPID_NULL; \ - (ChP)->ChanNum = NULLCHAN; \ -} - -/*************************************************************************** -Function: sResetAiopByNum -Purpose: Reset the AIOP by number -Call: sResetAiopByNum(CTLP,AIOPNUM) - CONTROLLER_T CTLP; Ptr to controller structure - AIOPNUM; AIOP index -*/ -#define sResetAiopByNum(CTLP,AIOPNUM) \ -{ \ - rp_writeaiop1(CTLP,AIOPNUM,_CMD_REG,RESET_ALL); \ - rp_writeaiop1(CTLP,AIOPNUM,_CMD_REG,0x0); \ -} - -/*************************************************************************** -Function: sSendBreak -Purpose: Send a transmit BREAK signal -Call: sSendBreak(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSendBreak(ChP) \ -{ \ - (ChP)->TxControl[3] |= SETBREAK; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetBaud -Purpose: Set baud rate -Call: sSetBaud(ChP,Divisor) - CHANNEL_T *ChP; Ptr to channel structure - Word_t Divisor; 16 bit baud rate divisor for channel -*/ -#define sSetBaud(ChP,DIVISOR) \ -{ \ - (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \ - (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->BaudDiv[0]); \ -} - -/*************************************************************************** -Function: sSetData7 -Purpose: Set data bits to 7 -Call: sSetData7(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSetData7(ChP) \ -{ \ - (ChP)->TxControl[2] &= ~DATA8BIT; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetData8 -Purpose: Set data bits to 8 -Call: sSetData8(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSetData8(ChP) \ -{ \ - (ChP)->TxControl[2] |= DATA8BIT; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetDTR -Purpose: Set the DTR output -Call: sSetDTR(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSetDTR(ChP) \ -{ \ - (ChP)->TxControl[3] |= SET_DTR; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetEvenParity -Purpose: Set even parity -Call: sSetEvenParity(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: Function sSetParity() can be used in place of functions sEnParity(), - sDisParity(), sSetOddParity(), and sSetEvenParity(). - -Warnings: This function has no effect unless parity is enabled with function - sEnParity(). -*/ -#define sSetEvenParity(ChP) \ -{ \ - (ChP)->TxControl[2] |= EVEN_PAR; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetOddParity -Purpose: Set odd parity -Call: sSetOddParity(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: Function sSetParity() can be used in place of functions sEnParity(), - sDisParity(), sSetOddParity(), and sSetEvenParity(). - -Warnings: This function has no effect unless parity is enabled with function - sEnParity(). -*/ -#define sSetOddParity(ChP) \ -{ \ - (ChP)->TxControl[2] &= ~EVEN_PAR; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetRTS -Purpose: Set the RTS output -Call: sSetRTS(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSetRTS(ChP) \ -{ \ - (ChP)->TxControl[3] |= SET_RTS; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetRxTrigger -Purpose: Set the Rx FIFO trigger level -Call: sSetRxProcessor(ChP,Level) - CHANNEL_T *ChP; Ptr to channel structure - Byte_t Level; Number of characters in Rx FIFO at which the - interrupt will be generated. Can be any of the following flags: - - TRIG_NO: no trigger - TRIG_1: 1 character in FIFO - TRIG_1_2: FIFO 1/2 full - TRIG_7_8: FIFO 7/8 full -Comments: An interrupt will be generated when the trigger level is reached - only if function sEnInterrupt() has been called with flag - RXINT_EN set. The RXF_TRIG flag in the Interrupt Idenfification - register will be set whenever the trigger level is reached - regardless of the setting of RXINT_EN. - -*/ -#define sSetRxTrigger(ChP,LEVEL) \ -{ \ - (ChP)->RxControl[2] &= ~TRIG_MASK; \ - (ChP)->RxControl[2] |= LEVEL; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \ -} - -/*************************************************************************** -Function: sSetStop1 -Purpose: Set stop bits to 1 -Call: sSetStop1(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSetStop1(ChP) \ -{ \ - (ChP)->TxControl[2] &= ~STOP2; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sSetStop2 -Purpose: Set stop bits to 2 -Call: sSetStop2(ChP) - CHANNEL_T *ChP; Ptr to channel structure -*/ -#define sSetStop2(ChP) \ -{ \ - (ChP)->TxControl[2] |= STOP2; \ - rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \ -} - -/*************************************************************************** -Function: sStartRxProcessor -Purpose: Start a channel's receive processor -Call: sStartRxProcessor(ChP) - CHANNEL_T *ChP; Ptr to channel structure -Comments: This function is used to start a Rx processor after it was - stopped with sStopRxProcessor() or sStopSWInFlowCtl(). It - will restart both the Rx processor and software input flow control. - -*/ -#define sStartRxProcessor(ChP) rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0]) - -/*************************************************************************** -Function: sWriteTxByte -Purpose: Write a transmit data byte to a channel. - CHANNEL_T *ChP; Ptr to channel structure - ByteIO_t io: Channel transmit register I/O address. This can - be obtained with sGetTxRxDataIO(). - Byte_t Data; The transmit data byte. -Warnings: This function writes the data byte without checking to see if - sMaxTxSize is exceeded in the Tx FIFO. -*/ -#define sWriteTxByte(ChP,IO,DATA) rp_writech1(ChP,IO,DATA) - -int sReadAiopID(CONTROLLER_T *CtlP, int aiop); -int sReadAiopNumChan(CONTROLLER_T *CtlP, int aiop); -int sInitChan( CONTROLLER_T *CtlP, - CHANNEL_T *ChP, - int AiopNum, - int ChanNum); -Byte_t sGetRxErrStatus(CHANNEL_T *ChP); -void sStopRxProcessor(CHANNEL_T *ChP); -void sStopSWInFlowCtl(CHANNEL_T *ChP); -void sFlushRxFIFO(CHANNEL_T *ChP); -void sFlushTxFIFO(CHANNEL_T *ChP); -int sWriteTxPrioByte(CHANNEL_T *ChP, Byte_t Data); -void sEnInterrupts(CHANNEL_T *ChP,Word_t Flags); -void sDisInterrupts(CHANNEL_T *ChP,Word_t Flags); -int rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports); -void rp_releaseresource(CONTROLLER_t *ctlp); - -#ifndef ROCKET_C -extern Byte_t R[RDATASIZE]; -extern CONTROLLER_T sController[CTL_SIZE]; -extern Byte_t sIRQMap[16]; -#endif -extern Byte_t rp_sBitMapClrTbl[8]; -extern Byte_t rp_sBitMapSetTbl[8]; diff --git a/sys/dev/usb/rio500_usb.h b/sys/dev/usb/rio500_usb.h deleted file mode 100644 index c2da72e91b116..0000000000000 --- a/sys/dev/usb/rio500_usb.h +++ /dev/null @@ -1,58 +0,0 @@ -/* ---------------------------------------------------------------------- - - Copyright (C) 2000 Cesar Miquel (miquel@df.uba.ar) - - Redistribution and use in source and binary forms, with or without - modification, are permitted under any licence of your choise which - meets the open source licence definiton - http://www.opensource.org/opd.html such as the GNU licence or the - BSD licence. - - This program 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 or the BSD license for more details. - - ---------------------------------------------------------------------- - - Modified for FreeBSD by Iwasa Kazmi <kzmi@ca2.so-net.ne.jp> - - ---------------------------------------------------------------------- */ - -/* $FreeBSD$ */ - -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -#include <sys/ioccom.h> -#ifndef USB_VENDOR_DIAMOND -#define USB_VENDOR_DIAMOND 0x841 -#endif -#ifndef USB_PRODUCT_DIAMOND_RIO500USB -#define USB_PRODUCT_DIAMOND_RIO500USB 0x1 -#endif -#endif - -struct RioCommand -{ -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) - u_int16_t length; -#else - short length; -#endif - int request; - int requesttype; - int value; - int index; - void *buffer; - int timeout; -}; - -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -#define RIO_SEND_COMMAND _IOWR('U', 200, struct RioCommand) -#define RIO_RECV_COMMAND _IOWR('U', 201, struct RioCommand) -#else -#define RIO_SEND_COMMAND 0x1 -#define RIO_RECV_COMMAND 0x2 -#endif - -#define RIO_DIR_OUT 0x0 -#define RIO_DIR_IN 0x1 diff --git a/sys/i386/include/i4b_isppp.h b/sys/i386/include/i4b_isppp.h deleted file mode 100644 index 9d1b59e355297..0000000000000 --- a/sys/i386/include/i4b_isppp.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Defines for synchronous PPP/Cisco link level subroutines. - * - * Copyright (C) 1994 Cronyx Ltd. - * Author: Serge Vakulenko, <vak@cronyx.ru> - * - * Heavily revamped to conform to RFC 1661. - * Copyright (C) 1997, Joerg Wunsch. - * - * This software is distributed with NO WARRANTIES, not even the implied - * warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * Authors grant any other persons or organizations permission to use - * or modify this software as long as this message is kept with the software, - * all derivative works or modified versions. - * - * From: Version 2.0, Fri Oct 6 20:39:21 MSK 1995 - * - * From: if_sppp.h,v 1.14 1999/03/30 13:28:26 phk Exp - * - * $Id: i4b_isppp.h,v 1.5 2000/07/18 15:05:37 hm Exp $ - * - * $FreeBSD$ - */ - -#ifndef _I4B_ISPPP_H_ -#define _I4B_ISPPP_H_ - -#define SPPP_VJ /* use VJ compression */ - - -#ifdef SPPP_VJ -#if !(defined (KERNEL) || defined (_KERNEL)) -#ifdef __FreeBSD__ -#if 0 -/* - * this is needed on FreeBSD to make /usr/src/usr.bin/kdump and - * /usr/src/usr.bin/truss compile. - */ -#include <sys/mbuf.h> -#endif -#include <netinet/in_systm.h> -#include <netinet/ip.h> -#include <net/slcompress.h> -#endif -#endif -#endif - -#define IDX_LCP 0 /* idx into state table */ - -struct slcp { - u_long opts; /* LCP options to send (bitfield) */ - u_long magic; /* local magic number */ - u_long mru; /* our max receive unit */ - u_long their_mru; /* their max receive unit */ - u_long protos; /* bitmask of protos that are started */ - u_char echoid; /* id of last keepalive echo request */ - /* restart max values, see RFC 1661 */ - int timeout; - int max_terminate; - int max_configure; - int max_failure; -}; - -#define IDX_IPCP 1 /* idx into state table */ - -struct sipcp { - u_long opts; /* IPCP options to send (bitfield) */ - u_int flags; -#define IPCP_HISADDR_SEEN 1 /* have seen his address already */ -#define IPCP_MYADDR_DYN 2 /* my address is dynamically assigned */ -#define IPCP_MYADDR_SEEN 4 /* have seen his address already */ -#define IPCP_VJ 8 /* We can use VJ compression */ - int max_state; /* Max-Slot-Id */ - int compress_cid; /* Comp-Slot-Id */ -}; - -#define AUTHNAMELEN 32 -#define AUTHKEYLEN 16 - -struct sauth { - u_short proto; /* authentication protocol to use */ - u_short flags; -#define AUTHFLAG_NOCALLOUT 1 /* do not require authentication on */ - /* callouts */ -#define AUTHFLAG_NORECHALLENGE 2 /* do not re-challenge CHAP */ - u_char name[AUTHNAMELEN]; /* system identification name */ - u_char secret[AUTHKEYLEN]; /* secret password */ - u_char challenge[AUTHKEYLEN]; /* random challenge */ -}; - -#define IDX_PAP 2 -#define IDX_CHAP 3 - -#define IDX_COUNT (IDX_CHAP + 1) /* bump this when adding cp's! */ - -/* - * Don't change the order of this. Ordering the phases this way allows - * for a comparision of ``pp_phase >= PHASE_AUTHENTICATE'' in order to - * know whether LCP is up. - */ -enum ppp_phase { - PHASE_DEAD, PHASE_ESTABLISH, PHASE_TERMINATE, - PHASE_AUTHENTICATE, PHASE_NETWORK -}; - -struct sppp { - /* NB: pp_if _must_ be first */ - struct ifnet pp_if; /* network interface data */ - struct ifqueue pp_fastq; /* fast output queue */ - struct ifqueue pp_cpq; /* PPP control protocol queue */ - struct sppp *pp_next; /* next interface in keepalive list */ - u_int pp_mode; /* major protocol modes (cisco/ppp/...) */ - u_int pp_flags; /* sub modes */ - u_short pp_alivecnt; /* keepalive packets counter */ - u_short pp_loopcnt; /* loopback detection counter */ - u_long pp_seq; /* local sequence number */ - u_long pp_rseq; /* remote sequence number */ - time_t pp_last_sent; - time_t pp_last_recv; - enum ppp_phase pp_phase; /* phase we're currently in */ - int state[IDX_COUNT]; /* state machine */ - u_char confid[IDX_COUNT]; /* id of last configuration request */ - int rst_counter[IDX_COUNT]; /* restart counter */ - int fail_counter[IDX_COUNT]; /* negotiation failure counter */ -#if defined(__FreeBSD__) && __FreeBSD__ >= 3 - struct callout_handle ch[IDX_COUNT]; /* per-proto and if callouts */ - struct callout_handle pap_my_to_ch; /* PAP needs one more... */ -#endif - struct slcp lcp; /* LCP params */ - struct sipcp ipcp; /* IPCP params */ - struct sauth myauth; /* auth params, i'm peer */ - struct sauth hisauth; /* auth params, i'm authenticator */ -#ifdef SPPP_VJ - int enable_vj; /* enable VJ negotiation */ - struct slcompress pp_comp; /* for VJ compression */ -#endif - /* - * These functions are filled in by sppp_attach(), and are - * expected to be used by the lower layer (hardware) drivers - * in order to communicate the (un)availability of the - * communication link. Lower layer drivers that are always - * ready to communicate (like hardware HDLC) can shortcut - * pp_up from pp_tls, and pp_down from pp_tlf. - */ - void (*pp_up)(struct sppp *sp); - void (*pp_down)(struct sppp *sp); - /* - * These functions need to be filled in by the lower layer - * (hardware) drivers if they request notification from the - * PPP layer whether the link is actually required. They - * correspond to the tls and tlf actions. - */ - void (*pp_tls)(struct sppp *sp); - void (*pp_tlf)(struct sppp *sp); - /* - * These (optional) functions may be filled by the hardware - * driver if any notification of established connections - * (currently: IPCP up) is desired (pp_con) or any internal - * state change of the interface state machine should be - * signaled for monitoring purposes (pp_chg). - */ - void (*pp_con)(struct sppp *sp); - void (*pp_chg)(struct sppp *sp, int new_state); - /* These two fields are for use by the lower layer */ - void *pp_lowerp; - int pp_loweri; -}; - -#define PP_KEEPALIVE 0x01 /* use keepalive protocol */ -#define PP_CALLIN 0x08 /* we are being called */ -#define PP_NEEDAUTH 0x10 /* remote requested authentication */ - - -#define PP_MTU 1500 /* default/minimal MRU */ -#define PP_MAX_MRU 2048 /* maximal MRU we want to negotiate */ - -/* - * Definitions to pass struct sppp data down into the kernel using the - * SIOC[SG]IFGENERIC ioctl interface. - * - * In order to use this, create a struct spppreq, fill in the cmd - * field with SPPPIOGDEFS, and put the address of this structure into - * the ifr_data portion of a struct ifreq. Pass this struct to a - * SIOCGIFGENERIC ioctl. Then replace the cmd field by SPPPIOCDEFS, - * modify the defs field as desired, and pass the struct ifreq now - * to a SIOCSIFGENERIC ioctl. - */ - -#define SPPPIOGDEFS ((caddr_t)(('S' << 24) + (1 << 16) + sizeof(struct sppp))) -#define SPPPIOSDEFS ((caddr_t)(('S' << 24) + (2 << 16) + sizeof(struct sppp))) - -struct spppreq { - u_long cmd; - struct sppp defs; -}; - -#ifndef SIOCSIFGENERIC -#define SIOCSIFGENERIC _IOW('i', 57, struct ifreq) /* generic IF set op */ -#endif - -#ifndef SIOCGIFGENERIC -#define SIOCGIFGENERIC _IOWR('i', 58, struct ifreq) /* generic IF get op */ -#endif - -#if defined(KERNEL) || defined(_KERNEL) - -#ifndef USE_ISPPP - -void sppp_attach (struct ifnet *ifp); -void sppp_detach (struct ifnet *ifp); -void sppp_input (struct ifnet *ifp, struct mbuf *m); - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003 -int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#else -#ifdef __FreeBSD__ -int sppp_ioctl (struct ifnet *ifp, int cmd, void *data); -#else -int sppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#endif -#endif - -struct mbuf *sppp_dequeue (struct ifnet *ifp); -struct mbuf *sppp_pick(struct ifnet *ifp); -int sppp_isempty (struct ifnet *ifp); -void sppp_flush (struct ifnet *ifp); - -#else /* USE_ISPPP */ - -void isppp_attach (struct ifnet *ifp); -void isppp_detach (struct ifnet *ifp); -void isppp_input (struct ifnet *ifp, struct mbuf *m); - -#if defined(__FreeBSD_version) && __FreeBSD_version >= 300003 -int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#else -#ifdef __FreeBSD__ -int isppp_ioctl (struct ifnet *ifp, int cmd, void *data); -#else -int isppp_ioctl (struct ifnet *ifp, u_long cmd, void *data); -#endif -#endif - -struct mbuf *isppp_dequeue (struct ifnet *ifp); -struct mbuf *isppp_pick(struct ifnet *ifp); -int isppp_isempty (struct ifnet *ifp); -void isppp_flush (struct ifnet *ifp); -#endif /* USE_ISPPP */ - -#endif /* KERNEL */ - -#endif /* _I4B_ISPPP_H_ */ diff --git a/sys/i386/include/pci_cfgreg.h b/sys/i386/include/pci_cfgreg.h deleted file mode 100644 index 6e79a22fc6d57..0000000000000 --- a/sys/i386/include/pci_cfgreg.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, Stefan Esser <se@freebsd.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - * - */ - -#define CONF1_ADDR_PORT 0x0cf8 -#define CONF1_DATA_PORT 0x0cfc - -#define CONF1_ENABLE 0x80000000ul -#define CONF1_ENABLE_CHK 0x80000000ul -#define CONF1_ENABLE_MSK 0x7ff00000ul -#define CONF1_ENABLE_CHK1 0xff000001ul -#define CONF1_ENABLE_MSK1 0x80000001ul -#define CONF1_ENABLE_RES1 0x80000000ul - -#define CONF2_ENABLE_PORT 0x0cf8 -#ifdef PC98 -#define CONF2_FORWARD_PORT 0x0cf9 -#else -#define CONF2_FORWARD_PORT 0x0cfa -#endif - -#define CONF2_ENABLE_CHK 0x0e -#define CONF2_ENABLE_RES 0x0e - -extern int pci_cfgregopen(void); -extern u_int32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes); -extern void pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes); -extern int pci_cfgintr(int bus, int device, int pin); diff --git a/sys/i4b/layer1/i4b_l1lib.c b/sys/i4b/layer1/i4b_l1lib.c deleted file mode 100644 index d2e69e48bf94e..0000000000000 --- a/sys/i4b/layer1/i4b_l1lib.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_l1lib.c - general useful L1 procedures - * ------------------------------------------ - * - * $Id: i4b_l1lib.c,v 1.3 2000/05/29 15:41:41 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon May 29 15:24:21 2000] - * - *---------------------------------------------------------------------------*/ - -#include <sys/param.h> -#include <sys/systm.h> - - -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/i4b_l1.h> - -#define TEL_IDLE_MIN (BCH_MAX_DATALEN/2) - -/*---------------------------------------------------------------------------* - * telephony silence detection - *---------------------------------------------------------------------------*/ -int -i4b_l1_bchan_tel_silence(unsigned char *data, int len) -{ - register int i = 0; - register int j = 0; - - /* count idle bytes */ - - for(;i < len; i++) - { - if((*data >= 0xaa) && (*data <= 0xac)) - j++; - data++; - } - -#ifdef NOTDEF - printf("i4b_l1_bchan_tel_silence: got %d silence bytes in frame\n", j); -#endif - - if(j < (TEL_IDLE_MIN)) - return(0); - else - return(1); - -} diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_ext.h b/sys/i4b/layer1/ifpi/i4b_ifpi_ext.h deleted file mode 100644 index c2d4cdf6e79af..0000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_ext.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpi - Fritz!Card PCI for split layers - * ------------------------------------------ - * - * $Id: i4b_ifpi_ext.h,v 1.2 2000/06/02 16:14:36 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:53:31 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IFPI_EXT_H_ -#define _I4B_IFPI_EXT_H_ - -#include <i4b/include/i4b_l3l4.h> - -void ifpi_set_linktab(int unit, int channel, drvr_link_t * dlt); -isdn_link_t *ifpi_ret_linktab(int unit, int channel); - -int ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag); -int ifpi_ph_activate_req(int unit); -int ifpi_mph_command_req(int unit, int command, void *parm); - -void ifpi_isac_irq(struct l1_softc *sc, int ista); -void ifpi_isac_l1_cmd(struct l1_softc *sc, int command); -int ifpi_isac_init(struct l1_softc *sc); - -void ifpi_recover(struct l1_softc *sc); -char * ifpi_printstate(struct l1_softc *sc); -void ifpi_next_state(struct l1_softc *sc, int event); - -#define IFPI_MAXUNIT 4 -extern struct l1_softc *ifpi_scp[IFPI_MAXUNIT]; - -#endif /* _I4B_IFPI_EXT_H_ */ diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c b/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c deleted file mode 100644 index 168506daba109..0000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_isac.c +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpi_isac.c - i4b Fritz PCI ISAC handler - * -------------------------------------------- - * - * $Id: i4b_ifpi_isac.c,v 1.3 2000/05/29 15:41:41 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon May 29 15:22:52 2000] - * - *---------------------------------------------------------------------------*/ - -#include "ifpi.h" -#include "pci.h" - -#if (NIFPI > 0) && (NPCI > 0) - -#include "opt_i4b.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/mbuf.h> -#include <sys/socket.h> - - -#include <net/if.h> - -#include <machine/i4b_debug.h> -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/i4b_l1.h> - -#include <i4b/layer1/isic/i4b_isic.h> -#include <i4b/layer1/isic/i4b_isac.h> -#include <i4b/layer1/isic/i4b_hscx.h> - -#include <i4b/layer1/ifpi/i4b_ifpi_ext.h> - -#include <i4b/include/i4b_global.h> -#include <i4b/include/i4b_mbuf.h> - -static u_char ifpi_isac_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void ifpi_isac_ind_hdlr(register struct l1_softc *sc, int ind); - -/*---------------------------------------------------------------------------* - * ISAC interrupt service routine - *---------------------------------------------------------------------------*/ -void -ifpi_isac_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - if(ista & ISAC_ISTA_EXI) /* extended interrupt */ - { - c |= ifpi_isac_exir_hdlr(sc, ISAC_READ(I_EXIR)); - } - - if(ista & ISAC_ISTA_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTA); - - if((rsta & ISAC_RSTA_MASK) != 0x20) - { - int error = 0; - - if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTA = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDR, ISAC_CMDR_RMC|ISAC_CMDR_RRES); - ISACCMDRWRDELAY(); - - return; - } - - rest = (ISAC_READ(I_RBCL) & (ISAC_FIFO_LEN-1)); - - if(rest == 0) - rest = ISAC_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("ifpi_isac_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - sc->sc_ilen += rest; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISAC_CMDR_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0IFPIUNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(ista & ISAC_ISTA_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("ifpi_isac_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISAC_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISAC_FIFO_LEN); - sc->sc_ilen += ISAC_FIFO_LEN; - sc->sc_ib += ISAC_FIFO_LEN; - c |= ISAC_CMDR_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - } - - if(ista & ISAC_ISTA_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; -#ifdef NOTDEF - printf("ob2=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - else - { -#ifdef NOTDEF - printf("ob=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISAC_FIFO_LEN)); - - if(sc->sc_ol > ISAC_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISAC_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISAC_FIFO_LEN; /* length - 32 */ - c |= ISAC_CMDR_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISAC_ISTA_CISQ) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIRR); - - /* if S/Q IRQ, read SQC reg to clr SQC IRQ */ - - if(ci & ISAC_CIRR_SQC) - (void) ISAC_READ(I_SQRR); - - /* C/I code change IRQ (flag already cleared by CIRR read) */ - - if(ci & ISAC_CIRR_CIC0) - ifpi_isac_ind_hdlr(sc, (ci >> 2) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDR, c); - ISACCMDRWRDELAY(); - } -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -ifpi_isac_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISAC_EXIR_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_PCE) - { - NDBGL1(L1_I_ERR, "EXIRQ Protocol Error"); - } - - if(exir & ISAC_EXIR_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - if(exir & ISAC_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISAC_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISAC_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISAC_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -ifpi_isac_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISAC_CIRR_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", ifpi_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpi_isac_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", ifpi_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpi_isac_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", ifpi_printstate(sc)); - event = EV_RSY; - break; - - case ISAC_CIRR_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", ifpi_printstate(sc)); - event = EV_PU; - break; - - case ISAC_CIRR_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", ifpi_printstate(sc)); - ifpi_isac_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISAC_CIRR_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISAC_CIRR_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", ifpi_printstate(sc)); - event = EV_DIS; - break; - - case ISAC_CIRR_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", ifpi_printstate(sc)); - ifpi_isac_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISAC_CIRR_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", ifpi_printstate(sc)); - event = EV_INFO2; - break; - - case ISAC_CIRR_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", ifpi_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, ifpi_printstate(sc)); - event = EV_INFO0; - break; - } - ifpi_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -ifpi_isac_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - -#ifdef I4B_SMP_WORKAROUND - - /* XXXXXXXXXXXXXXXXXXX */ - - /* - * patch from Wolfgang Helbig: - * - * Here is a patch that makes i4b work on an SMP: - * The card (TELES 16.3) didn't interrupt on an SMP machine. - * This is a gross workaround, but anyway it works *and* provides - * some information as how to finally fix this problem. - */ - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - ISAC_WRITE(I_MASK, ISAC_IMASK); - - /* XXXXXXXXXXXXXXXXXXX */ - -#endif /* I4B_SMP_WORKAROUND */ - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, ifpi_printstate(sc)); - return; - } - - if(sc->sc_bustyp == BUS_TYPE_IOM2) - cmd = ISAC_CIX0_LOW; - else - cmd = 0; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CTIM << 2); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CRS << 2); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CAR8 << 2); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CAR10 << 2); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", ifpi_printstate(sc)); - cmd |= (ISAC_CIXR_CDIU << 2); - break; - } - ISAC_WRITE(I_CIXR, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISAC initialization - *---------------------------------------------------------------------------*/ -int -ifpi_isac_init(struct l1_softc *sc) -{ - ISAC_IMASK = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - if(sc->sc_bustyp != BUS_TYPE_IOM2) - { - NDBGL1(L1_I_SETUP, "configuring for IOM-1 mode"); - - /* ADF2: Select mode IOM-1 */ - ISAC_WRITE(I_ADF2, 0x00); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SAC - SIP port high Z - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 and B2 switched to/from SPa - */ - ISAC_WRITE(I_SPCR, ISAC_SPCR_C1C1|ISAC_SPCR_C2C1); - - /* SQXR: S/Q channel xmit register: - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * CFS - IOM clock/frame always active - * FSC1/2 - polarity of 8kHz strobe - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, ISAC_ADF1_FC2); /* ADF1 */ - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - else - { - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* ADF2: Select mode IOM-2 */ - ISAC_WRITE(I_ADF2, ISAC_ADF2_IMS); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 + C1 and B2 + IC2 monitoring - */ - ISAC_WRITE(I_SPCR, 0x00); - - /* SQXR: S/Q channel xmit register: - * IDC - IOM direction = 0 (master) - * CFS - Config Select = 0 (clock always active) - * CI1E - C/I channel 1 IRQ enable = 0 - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * IOF - IOM i/f off = 0 - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, 0x00); - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - -#ifdef NOTDEF - /* - * XXX a transmitter reset causes an ISAC tx IRQ which will not - * be serviced at attach time under some circumstances leaving - * the associated IRQ line on the ISA bus active. This prevents - * any further interrupts to be serviced because no low -> high - * transition can take place anymore. (-hm) - */ - - /* command register: - * RRES - HDLC receiver reset - * XRES - transmitter reset - */ - ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES); - ISACCMDRWRDELAY(); -#endif - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * XPR - transmit pool ready - * CISQ - CI or S/Q channel change - * EXI - extended interrupt - */ - - ISAC_IMASK = ISAC_MASK_RSC | /* auto mode only */ - ISAC_MASK_TIN | /* timer irq */ - ISAC_MASK_SIN; /* sync xfer irq */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - return(0); -} - -#endif /* NIFPI > 0 */ diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c b/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c deleted file mode 100644 index 3d417a35fb95b..0000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_l1.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpi_l1.c - AVM Fritz PCI layer 1 handler - * --------------------------------------------- - * - * $Id: i4b_ifpi_l1.c,v 1.4 2000/06/02 16:14:36 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:54:30 2000] - * - *---------------------------------------------------------------------------*/ - -#include "ifpi.h" -#include "pci.h" - -#if (NIFPI > 0) && (NPCI > 0) - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/mbuf.h> -#include <sys/socket.h> - - -#include <net/if.h> - -#include <machine/i4b_debug.h> -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/isic/i4b_isic.h> -#include <i4b/layer1/isic/i4b_isac.h> - -#include <i4b/layer1/ifpi/i4b_ifpi_ext.h> - -#include <i4b/layer1/i4b_l1.h> - -#include <i4b/include/i4b_mbuf.h> -#include <i4b/include/i4b_global.h> - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -ifpi_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = ifpi_scp[unit]; - -#ifdef NOTDEF - NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); -#endif - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - ifpi_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", ifpi_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", ifpi_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPIUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -ifpi_ph_activate_req(int unit) -{ - struct l1_softc *sc = ifpi_scp[unit]; - NDBGL1(L1_PRIM, "PH-ACTIVATE-REQ, unit %d", unit); - ifpi_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -ifpi_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = ifpi_scp[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} - -#endif /* NIFPI > 0 */ diff --git a/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c b/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c deleted file mode 100644 index 274ab98969061..0000000000000 --- a/sys/i4b/layer1/ifpi/i4b_ifpi_l1fsm.c +++ /dev/null @@ -1,517 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpi_l1fsm.c - AVM Fritz PCI layer 1 I.430 state machine - * ------------------------------------------------------------ - * - * $Id: i4b_ifpi_l1fsm.c,v 1.4 2000/05/29 15:41:41 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon May 29 15:23:15 2000] - * - *---------------------------------------------------------------------------*/ - -#include "ifpi.h" -#include "pci.h" - -#if (NIFPI > 0) && (NPCI > 0) - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/socket.h> - - -#include <net/if.h> - -#include <machine/i4b_debug.h> -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/isic/i4b_isic.h> - -#include <i4b/layer1/i4b_l1.h> - -#include <i4b/include/i4b_global.h> - -#include <i4b/include/i4b_mbuf.h> - -#include <i4b/layer1/ifpi/i4b_ifpi_ext.h> - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - ifpi_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - ifpi_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPIUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0IFPIUNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpi_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPIUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPIUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPIUNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPIUNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - ifpi_isac_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0IFPIUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct ifpi_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} ifpi_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -ifpi_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = ifpi_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*ifpi_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -ifpi_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif - -#endif /* NIFPI > 0 */ diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h b/sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h deleted file mode 100644 index 3b51860ce9c97..0000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_ext.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2000 Gary Jennejohn. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpnp - Fritz!Card PnP for split layers - * ------------------------------------------- - * - * $Id: i4b_ifpnp_ext.h,v 1.2 2000/06/02 16:14:36 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_ext.h,v 1.4 2000/04/18 08:03:05 ust Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:54:57 2000] - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IFPNP_EXT_H_ -#define _I4B_IFPNP_EXT_H_ - -#include <i4b/include/i4b_l3l4.h> - -void ifpnp_set_linktab(int unit, int channel, drvr_link_t * dlt); -isdn_link_t *ifpnp_ret_linktab(int unit, int channel); - -int ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag); -int ifpnp_ph_activate_req(int unit); -int ifpnp_mph_command_req(int unit, int command, void *parm); - -void ifpnp_isac_irq(struct l1_softc *sc, int ista); -void ifpnp_isac_l1_cmd(struct l1_softc *sc, int command); -int ifpnp_isac_init(struct l1_softc *sc); - -void ifpnp_recover(struct l1_softc *sc); -char * ifpnp_printstate(struct l1_softc *sc); -void ifpnp_next_state(struct l1_softc *sc, int event); - -#define IFPNP_MAXUNIT 4 -extern struct l1_softc *ifpnp_scp[IFPNP_MAXUNIT]; - -#endif /* _I4B_IFPNP_EXT_H_ */ diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c deleted file mode 100644 index 83fe1bf7ef586..0000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_isac.c +++ /dev/null @@ -1,666 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpnp_isac.c - i4b Fritz PnP ISAC handler - * --------------------------------------------- - * - * $Id: i4b_ifpnp_isac.c,v 1.3 2000/05/29 15:41:41 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_isac.c,v 1.4 2000/04/18 08:03:05 ust Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon May 29 15:24:49 2000] - * - *---------------------------------------------------------------------------*/ - -#include "ifpnp.h" - -#if (NIFPNP > 0) - -#include "opt_i4b.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/mbuf.h> -#include <sys/socket.h> - - -#include <net/if.h> - -#include <machine/i4b_debug.h> -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/i4b_l1.h> - -#include <i4b/layer1/isic/i4b_isic.h> -#include <i4b/layer1/isic/i4b_isac.h> -#include <i4b/layer1/isic/i4b_hscx.h> - -#include <i4b/layer1/ifpnp/i4b_ifpnp_ext.h> - -#include <i4b/include/i4b_global.h> -#include <i4b/include/i4b_mbuf.h> - -static u_char ifpnp_isac_exir_hdlr(register struct l1_softc *sc, u_char exir); -static void ifpnp_isac_ind_hdlr(register struct l1_softc *sc, int ind); - -/*---------------------------------------------------------------------------* - * ISAC interrupt service routine - *---------------------------------------------------------------------------*/ -void -ifpnp_isac_irq(struct l1_softc *sc, int ista) -{ - register u_char c = 0; - NDBGL1(L1_F_MSG, "unit %d: ista = 0x%02x", sc->sc_unit, ista); - - if(ista & ISAC_ISTA_EXI) /* extended interrupt */ - { - c |= ifpnp_isac_exir_hdlr(sc, ISAC_READ(I_EXIR)); - } - - if(ista & ISAC_ISTA_RME) /* receive message end */ - { - register int rest; - u_char rsta; - - /* get rx status register */ - - rsta = ISAC_READ(I_RSTA); - - if((rsta & ISAC_RSTA_MASK) != 0x20) - { - int error = 0; - - if(!(rsta & ISAC_RSTA_CRC)) /* CRC error */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: CRC error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RDO) /* ReceiveDataOverflow */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Data Overrun error", sc->sc_unit); - } - - if(rsta & ISAC_RSTA_RAB) /* ReceiveABorted */ - { - error++; - NDBGL1(L1_I_ERR, "unit %d: Receive Aborted error", sc->sc_unit); - } - - if(error == 0) - NDBGL1(L1_I_ERR, "unit %d: RME unknown error, RSTA = 0x%02x!", sc->sc_unit, rsta); - - i4b_Dfreembuf(sc->sc_ibuf); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - - ISAC_WRITE(I_CMDR, ISAC_CMDR_RMC|ISAC_CMDR_RRES); - ISACCMDRWRDELAY(); - - return; - } - - rest = (ISAC_READ(I_RBCL) & (ISAC_FIFO_LEN-1)); - - if(rest == 0) - rest = ISAC_FIFO_LEN; - - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(rest)) != NULL) - sc->sc_ib = sc->sc_ibuf->m_data; - else - panic("ifpnp_isac_irq: RME, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - rest)) - { - ISAC_RDFIFO(sc->sc_ib, rest); - sc->sc_ilen += rest; - - sc->sc_ibuf->m_pkthdr.len = - sc->sc_ibuf->m_len = sc->sc_ilen; - - if(sc->sc_trace & TRACE_D_RX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_NT; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, sc->sc_ibuf->m_len, sc->sc_ibuf->m_data); - } - - c |= ISAC_CMDR_RMC; - - if(sc->sc_enabled && - (ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S)) - { - i4b_l1_ph_data_ind(L0IFPNPUNIT(sc->sc_unit), sc->sc_ibuf); - } - else - { - i4b_Dfreembuf(sc->sc_ibuf); - } - } - else - { - NDBGL1(L1_I_ERR, "RME, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - } - - if(ista & ISAC_ISTA_RPF) /* receive fifo full */ - { - if(sc->sc_ibuf == NULL) - { - if((sc->sc_ibuf = i4b_Dgetmbuf(MAX_DFRAME_LEN)) != NULL) - sc->sc_ib= sc->sc_ibuf->m_data; - else - panic("ifpnp_isac_irq: RPF, i4b_Dgetmbuf returns NULL!\n"); - sc->sc_ilen = 0; - } - - if(sc->sc_ilen <= (MAX_DFRAME_LEN - ISAC_FIFO_LEN)) - { - ISAC_RDFIFO(sc->sc_ib, ISAC_FIFO_LEN); - sc->sc_ilen += ISAC_FIFO_LEN; - sc->sc_ib += ISAC_FIFO_LEN; - c |= ISAC_CMDR_RMC; - } - else - { - NDBGL1(L1_I_ERR, "RPF, input buffer overflow!"); - i4b_Dfreembuf(sc->sc_ibuf); - sc->sc_ibuf = NULL; - sc->sc_ib = NULL; - sc->sc_ilen = 0; - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - } - - if(ista & ISAC_ISTA_XPR) /* transmit fifo empty (XPR bit set) */ - { - if((sc->sc_obuf2 != NULL) && (sc->sc_obuf == NULL)) - { - sc->sc_freeflag = sc->sc_freeflag2; - sc->sc_obuf = sc->sc_obuf2; - sc->sc_op = sc->sc_obuf->m_data; - sc->sc_ol = sc->sc_obuf->m_len; - sc->sc_obuf2 = NULL; -#ifdef NOTDEF - printf("ob2=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - else - { -#ifdef NOTDEF - printf("ob=%x, op=%x, ol=%d, f=%d #", - sc->sc_obuf, - sc->sc_op, - sc->sc_ol, - sc->sc_state); -#endif - } - - if(sc->sc_obuf) - { - ISAC_WRFIFO(sc->sc_op, min(sc->sc_ol, ISAC_FIFO_LEN)); - - if(sc->sc_ol > ISAC_FIFO_LEN) /* length > 32 ? */ - { - sc->sc_op += ISAC_FIFO_LEN; /* bufferptr+32 */ - sc->sc_ol -= ISAC_FIFO_LEN; /* length - 32 */ - c |= ISAC_CMDR_XTF; /* set XTF bit */ - } - else - { - if(sc->sc_freeflag) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_freeflag = 0; - } - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - c |= ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - } - else - { - sc->sc_state &= ~ISAC_TX_ACTIVE; - } - } - - if(ista & ISAC_ISTA_CISQ) /* channel status change CISQ */ - { - register u_char ci; - - /* get command/indication rx register*/ - - ci = ISAC_READ(I_CIRR); - - /* if S/Q IRQ, read SQC reg to clr SQC IRQ */ - - if(ci & ISAC_CIRR_SQC) - (void) ISAC_READ(I_SQRR); - - /* C/I code change IRQ (flag already cleared by CIRR read) */ - - if(ci & ISAC_CIRR_CIC0) - ifpnp_isac_ind_hdlr(sc, (ci >> 2) & 0xf); - } - - if(c) - { - ISAC_WRITE(I_CMDR, c); - ISACCMDRWRDELAY(); - } -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Extended IRQ handler - *---------------------------------------------------------------------------*/ -static u_char -ifpnp_isac_exir_hdlr(register struct l1_softc *sc, u_char exir) -{ - u_char c = 0; - - if(exir & ISAC_EXIR_XMR) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Message Repeat"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_XDU) - { - NDBGL1(L1_I_ERR, "EXIRQ Tx Data Underrun"); - - c |= ISAC_CMDR_XRES; - } - - if(exir & ISAC_EXIR_PCE) - { - NDBGL1(L1_I_ERR, "EXIRQ Protocol Error"); - } - - if(exir & ISAC_EXIR_RFO) - { - NDBGL1(L1_I_ERR, "EXIRQ Rx Frame Overflow"); - - c |= ISAC_CMDR_RMC|ISAC_CMDR_RRES; - } - - if(exir & ISAC_EXIR_SOV) - { - NDBGL1(L1_I_ERR, "EXIRQ Sync Xfer Overflow"); - } - - if(exir & ISAC_EXIR_MOS) - { - NDBGL1(L1_I_ERR, "EXIRQ Monitor Status"); - } - - if(exir & ISAC_EXIR_SAW) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Subscriber Awake"); - } - - if(exir & ISAC_EXIR_WOV) - { - /* cannot happen, STCR:TSF is set to 0 */ - - NDBGL1(L1_I_ERR, "EXIRQ Watchdog Timer Overflow"); - } - - return(c); -} - -/*---------------------------------------------------------------------------* - * ISAC L1 Indication handler - *---------------------------------------------------------------------------*/ -static void -ifpnp_isac_ind_hdlr(register struct l1_softc *sc, int ind) -{ - register int event; - - switch(ind) - { - case ISAC_CIRR_IAI8: - NDBGL1(L1_I_CICO, "rx AI8 in state %s", ifpnp_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpnp_isac_l1_cmd(sc, CMD_AR8); - event = EV_INFO48; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IAI10: - NDBGL1(L1_I_CICO, "rx AI10 in state %s", ifpnp_printstate(sc)); - if(sc->sc_bustyp == BUS_TYPE_IOM2) - ifpnp_isac_l1_cmd(sc, CMD_AR10); - event = EV_INFO410; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_L1STAT, LAYER_ACTIVE, NULL); - break; - - case ISAC_CIRR_IRSY: - NDBGL1(L1_I_CICO, "rx RSY in state %s", ifpnp_printstate(sc)); - event = EV_RSY; - break; - - case ISAC_CIRR_IPU: - NDBGL1(L1_I_CICO, "rx PU in state %s", ifpnp_printstate(sc)); - event = EV_PU; - break; - - case ISAC_CIRR_IDR: - NDBGL1(L1_I_CICO, "rx DR in state %s", ifpnp_printstate(sc)); - ifpnp_isac_l1_cmd(sc, CMD_DIU); - event = EV_DR; - break; - - case ISAC_CIRR_IDID: - NDBGL1(L1_I_CICO, "rx DID in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_L1STAT, LAYER_IDLE, NULL); - break; - - case ISAC_CIRR_IDIS: - NDBGL1(L1_I_CICO, "rx DIS in state %s", ifpnp_printstate(sc)); - event = EV_DIS; - break; - - case ISAC_CIRR_IEI: - NDBGL1(L1_I_CICO, "rx EI in state %s", ifpnp_printstate(sc)); - ifpnp_isac_l1_cmd(sc, CMD_DIU); - event = EV_EI; - break; - - case ISAC_CIRR_IARD: - NDBGL1(L1_I_CICO, "rx ARD in state %s", ifpnp_printstate(sc)); - event = EV_INFO2; - break; - - case ISAC_CIRR_ITI: - NDBGL1(L1_I_CICO, "rx TI in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_IATI: - NDBGL1(L1_I_CICO, "rx ATI in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - break; - - case ISAC_CIRR_ISD: - NDBGL1(L1_I_CICO, "rx SD in state %s", ifpnp_printstate(sc)); - event = EV_INFO0; - break; - - default: - NDBGL1(L1_I_ERR, "UNKNOWN Indication 0x%x in state %s", ind, ifpnp_printstate(sc)); - event = EV_INFO0; - break; - } - ifpnp_next_state(sc, event); -} - -/*---------------------------------------------------------------------------* - * execute a layer 1 command - *---------------------------------------------------------------------------*/ -void -ifpnp_isac_l1_cmd(struct l1_softc *sc, int command) -{ - u_char cmd; - -#ifdef I4B_SMP_WORKAROUND - - /* XXXXXXXXXXXXXXXXXXX */ - - /* - * patch from Wolfgang Helbig: - * - * Here is a patch that makes i4b work on an SMP: - * The card (TELES 16.3) didn't interrupt on an SMP machine. - * This is a gross workaround, but anyway it works *and* provides - * some information as how to finally fix this problem. - */ - - HSCX_WRITE(0, H_MASK, 0xff); - HSCX_WRITE(1, H_MASK, 0xff); - ISAC_WRITE(I_MASK, 0xff); - DELAY(100); - HSCX_WRITE(0, H_MASK, HSCX_A_IMASK); - HSCX_WRITE(1, H_MASK, HSCX_B_IMASK); - ISAC_WRITE(I_MASK, ISAC_IMASK); - - /* XXXXXXXXXXXXXXXXXXX */ - -#endif /* I4B_SMP_WORKAROUND */ - - if(command < 0 || command > CMD_ILL) - { - NDBGL1(L1_I_ERR, "illegal cmd 0x%x in state %s", command, ifpnp_printstate(sc)); - return; - } - - if(sc->sc_bustyp == BUS_TYPE_IOM2) - cmd = ISAC_CIX0_LOW; - else - cmd = 0; - - switch(command) - { - case CMD_TIM: - NDBGL1(L1_I_CICO, "tx TIM in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CTIM << 2); - break; - - case CMD_RS: - NDBGL1(L1_I_CICO, "tx RS in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CRS << 2); - break; - - case CMD_AR8: - NDBGL1(L1_I_CICO, "tx AR8 in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CAR8 << 2); - break; - - case CMD_AR10: - NDBGL1(L1_I_CICO, "tx AR10 in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CAR10 << 2); - break; - - case CMD_DIU: - NDBGL1(L1_I_CICO, "tx DIU in state %s", ifpnp_printstate(sc)); - cmd |= (ISAC_CIXR_CDIU << 2); - break; - } - ISAC_WRITE(I_CIXR, cmd); -} - -/*---------------------------------------------------------------------------* - * L1 ISAC initialization - *---------------------------------------------------------------------------*/ -int -ifpnp_isac_init(struct l1_softc *sc) -{ - ISAC_IMASK = 0xff; /* disable all irqs */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - if(sc->sc_bustyp != BUS_TYPE_IOM2) - { - NDBGL1(L1_I_SETUP, "configuring for IOM-1 mode"); - - /* ADF2: Select mode IOM-1 */ - ISAC_WRITE(I_ADF2, 0x00); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SAC - SIP port high Z - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 and B2 switched to/from SPa - */ - ISAC_WRITE(I_SPCR, ISAC_SPCR_C1C1|ISAC_SPCR_C2C1); - - /* SQXR: S/Q channel xmit register: - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * CFS - IOM clock/frame always active - * FSC1/2 - polarity of 8kHz strobe - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, ISAC_ADF1_FC2); /* ADF1 */ - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - else - { - NDBGL1(L1_I_SETUP, "configuring for IOM-2 mode"); - - /* ADF2: Select mode IOM-2 */ - ISAC_WRITE(I_ADF2, ISAC_ADF2_IMS); - - /* SPCR: serial port control register: - * SPU - software power up = 0 - * SPM - timing mode 0 - * TLP - test loop = 0 - * C1C, C2C - B1 + C1 and B2 + IC2 monitoring - */ - ISAC_WRITE(I_SPCR, 0x00); - - /* SQXR: S/Q channel xmit register: - * IDC - IOM direction = 0 (master) - * CFS - Config Select = 0 (clock always active) - * CI1E - C/I channel 1 IRQ enable = 0 - * SQIE - S/Q IRQ enable = 0 - * SQX1-4 - Fa bits = 1 - */ - ISAC_WRITE(I_SQXR, ISAC_SQXR_SQX1|ISAC_SQXR_SQX2|ISAC_SQXR_SQX3|ISAC_SQXR_SQX4); - - /* ADF1: additional feature reg 1: - * WTC - watchdog = 0 - * TEM - test mode = 0 - * PFS - pre-filter = 0 - * IOF - IOM i/f off = 0 - * ITF - interframe fill = idle - */ - ISAC_WRITE(I_ADF1, 0x00); - - /* STCR: sync transfer control reg: - * TSF - terminal secific functions = 0 - * TBA - TIC bus address = 7 - * STx/SCx = 0 - */ - ISAC_WRITE(I_STCR, ISAC_STCR_TBA2|ISAC_STCR_TBA1|ISAC_STCR_TBA0); - - /* MODE: Mode Register: - * MDSx - transparent mode 2 - * TMD - timer mode = external - * RAC - Receiver enabled - * DIMx - digital i/f mode - */ - ISAC_WRITE(I_MODE, ISAC_MODE_MDS2|ISAC_MODE_MDS1|ISAC_MODE_RAC|ISAC_MODE_DIM0); - } - -#ifdef NOTDEF - /* - * XXX a transmitter reset causes an ISAC tx IRQ which will not - * be serviced at attach time under some circumstances leaving - * the associated IRQ line on the ISA bus active. This prevents - * any further interrupts to be serviced because no low -> high - * transition can take place anymore. (-hm) - */ - - /* command register: - * RRES - HDLC receiver reset - * XRES - transmitter reset - */ - ISAC_WRITE(I_CMDR, ISAC_CMDR_RRES|ISAC_CMDR_XRES); - ISACCMDRWRDELAY(); -#endif - - /* enabled interrupts: - * =================== - * RME - receive message end - * RPF - receive pool full - * XPR - transmit pool ready - * CISQ - CI or S/Q channel change - * EXI - extended interrupt - */ - - ISAC_IMASK = ISAC_MASK_RSC | /* auto mode only */ - ISAC_MASK_TIN | /* timer irq */ - ISAC_MASK_SIN; /* sync xfer irq */ - - ISAC_WRITE(I_MASK, ISAC_IMASK); - - return(0); -} - -#endif /* NIFPNP > 0 */ diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c deleted file mode 100644 index f2b4ad228397a..0000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpnp_l1.c - AVM Fritz PnP layer 1 handler - * ---------------------------------------------- - * - * $Id: i4b_ifpnp_l1.c,v 1.4 2000/06/02 16:14:36 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_l1.c,v 1.4 2000/04/18 08:03:05 ust Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Fri Jun 2 14:55:49 2000] - * - *---------------------------------------------------------------------------*/ - -#include "ifpnp.h" - -#if (NIFPNP > 0) - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/mbuf.h> -#include <sys/socket.h> - - -#include <net/if.h> - -#include <machine/i4b_debug.h> -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/isic/i4b_isic.h> -#include <i4b/layer1/isic/i4b_isac.h> - -#include <i4b/layer1/ifpnp/i4b_ifpnp_ext.h> - -#include <i4b/layer1/i4b_l1.h> - -#include <i4b/include/i4b_mbuf.h> -#include <i4b/include/i4b_global.h> - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-DATA-REQUEST - * ========================= - * - * parms: - * unit physical interface unit number - * m mbuf containing L2 frame to be sent out - * freeflag MBUF_FREE: free mbuf here after having sent - * it out - * MBUF_DONTFREE: mbuf is freed by Layer 2 - * returns: - * ==0 fail, nothing sent out - * !=0 ok, frame sent out - * - *---------------------------------------------------------------------------*/ -int -ifpnp_ph_data_req(int unit, struct mbuf *m, int freeflag) -{ - u_char cmd; - int s; - struct l1_softc *sc = ifpnp_scp[unit]; - -#ifdef NOTDEF - NDBGL1(L1_PRIM, "PH-DATA-REQ, unit %d, freeflag=%d", unit, freeflag); -#endif - - if(m == NULL) /* failsafe */ - return (0); - - s = SPLI4B(); - - if(sc->sc_I430state == ST_F3) /* layer 1 not running ? */ - { - NDBGL1(L1_I_ERR, "still in state F3!"); - ifpnp_ph_activate_req(unit); - } - - if(sc->sc_state & ISAC_TX_ACTIVE) - { - if(sc->sc_obuf2 == NULL) - { - sc->sc_obuf2 = m; /* save mbuf ptr */ - - if(freeflag) - sc->sc_freeflag2 = 1; /* IRQ must mfree */ - else - sc->sc_freeflag2 = 0; /* IRQ must not mfree */ - - NDBGL1(L1_I_MSG, "using 2nd ISAC TX buffer, state = %s", ifpnp_printstate(sc)); - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - splx(s); - return(1); - } - - NDBGL1(L1_I_ERR, "No Space in TX FIFO, state = %s", ifpnp_printstate(sc)); - - if(freeflag == MBUF_FREE) - i4b_Dfreembuf(m); - - splx(s); - return (0); - } - - if(sc->sc_trace & TRACE_D_TX) - { - i4b_trace_hdr_t hdr; - hdr.unit = L0IFPNPUNIT(unit); - hdr.type = TRC_CH_D; - hdr.dir = FROM_TE; - hdr.count = ++sc->sc_trace_dcount; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, m->m_len, m->m_data); - } - - sc->sc_state |= ISAC_TX_ACTIVE; /* set transmitter busy flag */ - - NDBGL1(L1_I_MSG, "ISAC_TX_ACTIVE set"); - - sc->sc_freeflag = 0; /* IRQ must NOT mfree */ - - ISAC_WRFIFO(m->m_data, min(m->m_len, ISAC_FIFO_LEN)); /* output to TX fifo */ - - if(m->m_len > ISAC_FIFO_LEN) /* message > 32 bytes ? */ - { - sc->sc_obuf = m; /* save mbuf ptr */ - sc->sc_op = m->m_data + ISAC_FIFO_LEN; /* ptr for irq hdl */ - sc->sc_ol = m->m_len - ISAC_FIFO_LEN; /* length for irq hdl */ - - if(freeflag) - sc->sc_freeflag = 1; /* IRQ must mfree */ - - cmd = ISAC_CMDR_XTF; - } - else - { - sc->sc_obuf = NULL; - sc->sc_op = NULL; - sc->sc_ol = 0; - - if(freeflag) - i4b_Dfreembuf(m); - - cmd = ISAC_CMDR_XTF | ISAC_CMDR_XME; - } - - ISAC_WRITE(I_CMDR, cmd); - ISACCMDRWRDELAY(); - - splx(s); - - return(1); -} - -/*---------------------------------------------------------------------------* - * - * L2 -> L1: PH-ACTIVATE-REQUEST - * ============================= - * - * parms: - * unit physical interface unit number - * - * returns: - * ==0 - * !=0 - * - *---------------------------------------------------------------------------*/ -int -ifpnp_ph_activate_req(int unit) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - NDBGL1(L1_PRIM, "PH-ACTIVATE-REQ, unit %d\n", unit); - ifpnp_next_state(sc, EV_PHAR); - return(0); -} - -/*---------------------------------------------------------------------------* - * command from the upper layers - *---------------------------------------------------------------------------*/ -int -ifpnp_mph_command_req(int unit, int command, void *parm) -{ - struct l1_softc *sc = ifpnp_scp[unit]; - - switch(command) - { - case CMR_DOPEN: /* daemon running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DOPEN", unit); - sc->sc_enabled = 1; - break; - - case CMR_DCLOSE: /* daemon not running */ - NDBGL1(L1_PRIM, "unit %d, command = CMR_DCLOSE", unit); - sc->sc_enabled = 0; - break; - - case CMR_SETTRACE: - NDBGL1(L1_PRIM, "unit %d, command = CMR_SETTRACE, parm = %d", unit, (unsigned int)parm); - sc->sc_trace = (unsigned int)parm; - break; - - default: - NDBGL1(L1_ERROR, "ERROR, unknown command = %d, unit = %d, parm = %d", command, unit, (unsigned int)parm); - break; - } - - return(0); -} - -#endif /* NIFPNP > 0 */ diff --git a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c b/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c deleted file mode 100644 index 26b154031b5ef..0000000000000 --- a/sys/i4b/layer1/ifpnp/i4b_ifpnp_l1fsm.c +++ /dev/null @@ -1,517 +0,0 @@ -/* - * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ifpnp_l1fsm.c - AVM Fritz PnP layer 1 I.430 state machine - * ------------------------------------------------------------- - * - * $Id: i4b_ifpnp_l1fsm.c,v 1.4 2000/05/29 15:41:41 hm Exp $ - * $Ust: src/i4b/layer1-nb/ifpnp/i4b_ifpnp_l1fsm.c,v 1.4 2000/04/18 08:03:05 ust Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon May 29 15:25:04 2000] - * - *---------------------------------------------------------------------------*/ - -#include "ifpnp.h" - -#if (NIFPNP > 0) - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/socket.h> - - -#include <net/if.h> - -#include <machine/i4b_debug.h> -#include <machine/i4b_ioctl.h> -#include <machine/i4b_trace.h> - -#include <i4b/layer1/isic/i4b_isic.h> - -#include <i4b/layer1/i4b_l1.h> - -#include <i4b/include/i4b_global.h> - -#include <i4b/include/i4b_mbuf.h> - -#include <i4b/layer1/ifpnp/i4b_ifpnp_ext.h> - -#if DO_I4B_DEBUG -static char *state_text[N_STATES] = { - "F3 Deactivated", - "F4 Awaiting Signal", - "F5 Identifying Input", - "F6 Synchronized", - "F7 Activated", - "F8 Lost Framing", - "Illegal State" -}; - -static char *event_text[N_EVENTS] = { - "EV_PHAR PH_ACT_REQ", - "EV_T3 Timer 3 expired", - "EV_INFO0 INFO0 received", - "EV_RSY Level Detected", - "EV_INFO2 INFO2 received", - "EV_INFO48 INFO4 received", - "EV_INFO410 INFO4 received", - "EV_DR Deactivate Req", - "EV_PU Power UP", - "EV_DIS Disconnected", - "EV_EI Error Ind", - "Illegal Event" -}; -#endif - -/* Function prototypes */ - -static void timer3_expired (struct l1_softc *sc); -static void T3_start (struct l1_softc *sc); -static void T3_stop (struct l1_softc *sc); -static void F_T3ex (struct l1_softc *sc); -static void timer4_expired (struct l1_softc *sc); -static void T4_start (struct l1_softc *sc); -static void T4_stop (struct l1_softc *sc); -static void F_AI8 (struct l1_softc *sc); -static void F_AI10 (struct l1_softc *sc); -static void F_I01 (struct l1_softc *sc); -static void F_I02 (struct l1_softc *sc); -static void F_I03 (struct l1_softc *sc); -static void F_I2 (struct l1_softc *sc); -static void F_ill (struct l1_softc *sc); -static void F_NULL (struct l1_softc *sc); - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expire function - *---------------------------------------------------------------------------*/ -static void -timer3_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T3) - { - NDBGL1(L1_T_ERR, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T3 = 0; - - /* XXX try some recovery here XXX */ - - ifpnp_recover(sc); - - sc->sc_init_tries++; /* increment retry count */ - -/*XXX*/ if(sc->sc_init_tries > 4) - { - int s = SPLI4B(); - - sc->sc_init_tries = 0; - - if(sc->sc_obuf2 != NULL) - { - i4b_Dfreembuf(sc->sc_obuf2); - sc->sc_obuf2 = NULL; - } - if(sc->sc_obuf != NULL) - { - i4b_Dfreembuf(sc->sc_obuf); - sc->sc_obuf = NULL; - sc->sc_freeflag = 0; - sc->sc_op = NULL; - sc->sc_ol = 0; - } - - splx(s); - - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_NOL1ACC, 0, NULL); - } - - ifpnp_next_state(sc, EV_T3); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 start - *---------------------------------------------------------------------------*/ -static void -T3_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T3 = 1; - sc->sc_T3_callout = timeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, 2*hz); -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 stop - *---------------------------------------------------------------------------*/ -static void -T3_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - - sc->sc_init_tries = 0; /* init connect retry count */ - - if(sc->sc_I430T3) - { - sc->sc_I430T3 = 0; - untimeout((TIMEOUT_FUNC_T)timer3_expired,(struct l1_softc *)sc, sc->sc_T3_callout); - } -} - -/*---------------------------------------------------------------------------* - * I.430 Timer T3 expiry - *---------------------------------------------------------------------------*/ -static void -F_T3ex(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_T3ex executing"); - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPNPUNIT(sc->sc_unit)); -} - -/*---------------------------------------------------------------------------* - * Timer T4 expire function - *---------------------------------------------------------------------------*/ -static void -timer4_expired(struct l1_softc *sc) -{ - if(sc->sc_I430T4) - { - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T4 = 0; - i4b_l1_mph_status_ind(L0IFPNPUNIT(sc->sc_unit), STI_PDEACT, 0, NULL); - } - else - { - NDBGL1(L1_T_ERR, "expired without starting it ...."); - } -} - -/*---------------------------------------------------------------------------* - * Timer T4 start - *---------------------------------------------------------------------------*/ -static void -T4_start(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - sc->sc_I430T4 = 1; - sc->sc_T4_callout = timeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, hz); -} - -/*---------------------------------------------------------------------------* - * Timer T4 stop - *---------------------------------------------------------------------------*/ -static void -T4_stop(struct l1_softc *sc) -{ - NDBGL1(L1_T_MSG, "state = %s", ifpnp_printstate(sc)); - - if(sc->sc_I430T4) - { - sc->sc_I430T4 = 0; - untimeout((TIMEOUT_FUNC_T)timer4_expired,(struct l1_softc *)sc, sc->sc_T4_callout); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI8 - *---------------------------------------------------------------------------*/ -static void -F_AI8(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI8 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPNPUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_8; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received AI10 - *---------------------------------------------------------------------------*/ -static void -F_AI10(struct l1_softc *sc) -{ - T4_stop(sc); - - NDBGL1(L1_F_MSG, "FSM function F_AI10 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_activate_ind(L0IFPNPUNIT(sc->sc_unit)); - - T3_stop(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO4_10; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in states F3 .. F5 - *---------------------------------------------------------------------------*/ -static void -F_I01(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I01 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F6 - *---------------------------------------------------------------------------*/ -static void -F_I02(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I02 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPNPUNIT(sc->sc_unit)); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO 0 in state F7 or F8 - *---------------------------------------------------------------------------*/ -static void -F_I03(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I03 executing"); - - if(ctrl_desc[sc->sc_unit].protocol != PROTOCOL_D64S) - i4b_l1_ph_deactivate_ind(L0IFPNPUNIT(sc->sc_unit)); - - T4_start(sc); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO0; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } -} - -/*---------------------------------------------------------------------------* - * FSM function: activate request - *---------------------------------------------------------------------------*/ -static void -F_AR(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_AR executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO1_8; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_TE; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - - ifpnp_isac_l1_cmd(sc, CMD_AR8); - - T3_start(sc); -} - -/*---------------------------------------------------------------------------* - * FSM function: received INFO2 - *---------------------------------------------------------------------------*/ -static void -F_I2(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_I2 executing"); - - if(sc->sc_trace & TRACE_I) - { - i4b_trace_hdr_t hdr; - char info = INFO2; - - hdr.unit = L0IFPNPUNIT(sc->sc_unit); - hdr.type = TRC_CH_I; - hdr.dir = FROM_NT; - hdr.count = 0; - MICROTIME(hdr.time); - i4b_l1_trace_ind(&hdr, 1, &info); - } - -} - -/*---------------------------------------------------------------------------* - * illegal state default action - *---------------------------------------------------------------------------*/ -static void -F_ill(struct l1_softc *sc) -{ - NDBGL1(L1_F_ERR, "FSM function F_ill executing"); -} - -/*---------------------------------------------------------------------------* - * No action - *---------------------------------------------------------------------------*/ -static void -F_NULL(struct l1_softc *sc) -{ - NDBGL1(L1_F_MSG, "FSM function F_NULL executing"); -} - - -/*---------------------------------------------------------------------------* - * layer 1 state transition table - *---------------------------------------------------------------------------*/ -struct ifpnp_state_tab { - void (*func) (struct l1_softc *sc); /* function to execute */ - int newstate; /* next state */ -} ifpnp_state_tab[N_EVENTS][N_STATES] = { - -/* STATE: F3 F4 F5 F6 F7 F8 ILLEGAL STATE */ -/* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* EV_PHAR x*/ {{F_AR, ST_F4}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_ill, ST_ILL}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_T3 x*/ {{F_NULL, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_T3ex, ST_F3}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO0 */ {{F_I01, ST_F3}, {F_I01, ST_F4}, {F_I01, ST_F5}, {F_I02, ST_F3}, {F_I03, ST_F3}, {F_I03, ST_F3}, {F_ill, ST_ILL}}, -/* EV_RSY x*/ {{F_NULL, ST_F3}, {F_NULL, ST_F5}, {F_NULL, ST_F5}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_INFO2 */ {{F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_I2, ST_F6}, {F_ill, ST_ILL}}, -/* EV_INFO48*/ {{F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_AI8, ST_F7}, {F_NULL, ST_F7}, {F_AI8, ST_F7}, {F_ill, ST_ILL}}, -/* EV_INFO41*/ {{F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_AI10, ST_F7}, {F_NULL, ST_F7}, {F_AI10, ST_F7}, {F_ill, ST_ILL}}, -/* EV_DR */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_PU */ {{F_NULL, ST_F3}, {F_NULL, ST_F4}, {F_NULL, ST_F5}, {F_NULL, ST_F6}, {F_NULL, ST_F7}, {F_NULL, ST_F8}, {F_ill, ST_ILL}}, -/* EV_DIS */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}}, -/* EV_EI */ {{F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_NULL, ST_F3}, {F_ill, ST_ILL}}, -/* EV_ILL */ {{F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}, {F_ill, ST_ILL}} -}; - -/*---------------------------------------------------------------------------* - * event handler - *---------------------------------------------------------------------------*/ -void -ifpnp_next_state(struct l1_softc *sc, int event) -{ - int currstate, newstate; - - if(event >= N_EVENTS) - panic("i4b_l1fsm.c: event >= N_EVENTS\n"); - - currstate = sc->sc_I430state; - - if(currstate >= N_STATES) - panic("i4b_l1fsm.c: currstate >= N_STATES\n"); - - newstate = ifpnp_state_tab[event][currstate].newstate; - - if(newstate >= N_STATES) - panic("i4b_l1fsm.c: newstate >= N_STATES\n"); - - NDBGL1(L1_F_MSG, "FSM event [%s]: [%s => %s]", event_text[event], - state_text[currstate], - state_text[newstate]); - - (*ifpnp_state_tab[event][currstate].func)(sc); - - if(newstate == ST_ILL) - { - newstate = ST_F3; - NDBGL1(L1_F_ERR, "FSM Illegal State ERROR, oldstate = %s, newstate = %s, event = %s!", - state_text[currstate], - state_text[newstate], - event_text[event]); - } - - sc->sc_I430state = newstate; -} - -#if DO_I4B_DEBUG -/*---------------------------------------------------------------------------* - * return pointer to current state description - *---------------------------------------------------------------------------*/ -char * -ifpnp_printstate(struct l1_softc *sc) -{ - return((char *) state_text[sc->sc_I430state]); -} -#endif - -#endif /* NIFPNP > 0 */ diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc.h b/sys/i4b/layer1/ihfc/i4b_ihfc.h deleted file mode 100644 index 1036636629f9f..0000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc.h +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ihfc.h - ihfc common header file - * ------------------------------------ - * - * last edit-date: [Wed Jul 19 09:40:45 2000] - * - * $Id: i4b_ihfc.h,v 1.9 2000/09/19 13:50:36 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#ifndef _I4B_IHFC_H_ -#define _I4B_IHFC_H_ - -#include <i4b/include/i4b_l3l4.h> - -/*---------------------------------------------------------------------------* - * global stuff (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ -#define DCH_MAX_LEN 264 /* max length of a D frame */ - -#define IHFC_ACTIVATION_TIMEOUT 3*hz /* S0-bus must activate before this time */ - -#define IHFC_IO_BASES 1 - -#define IHFC_DISBUSYTO 500 /* do at least 500 inb's before giving up */ -#define IHFC_NONBUSYTO 8000 /* do at least 8000 inb's before giving up */ - -#define IHFC_NTMODE 0 /* use TE-mode as default */ -#define IHFC_DLP 0 /* use (8/9) priority as default */ - -#define IHFC_MAXUNIT 4 - -/* #define IHFC_DEBUG internal debugging enabled * - * #undef IHFC_DEBUG internal debugging disabled */ - -/* chan: * - * 0 - D1 (tx) * - * 1 - D1 (rx) * - * 2 - B1 (tx) * - * 3 - B1 (rx) * - * 4 - B2 (tx) * - * 5 - B2 (rx) */ - -#define HFC_1 0x01 /* HFC 2B */ -#define HFC_S 0x02 /* HFC - S 2BDS0 */ -#define HFC_SP 0x04 /* HFC - SP 2BDS0 */ -#define HFC_SPCI 0x08 /* HFC - SPCI 2BDS0 X */ -#define HFC_S2M 0x10 /* HFC - S2M 2BDS0 X */ -#define HFC_USB 0x20 /* HFC - USB 2BDS0 X */ - -/*---------------------------------------------------------------------------* - * "Help Fix Corruption" macros (HFC-1/S/SP) - * - * NOTE: If the code does not run at splhigh, we will sporadically - * lose bytes. On fast PC's (200 Mhz), this is very little noticable. - *---------------------------------------------------------------------------*/ -#define HFC_VAR int _s_ /* declare variable */ -#define HFC_BEG _s_ = splhigh() /* save spl */ -#define HFC_END splx(_s_) /* restore spl */ - -/*---------------------------------------------------------------------------* - * macros related to i4b linking (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ -#define S_BLINK sc->sc_blinktab[(chan > 3) ? 1 : 0] -#define S_BDRVLINK sc->sc_bdrvlinktab[(chan > 3) ? 1 : 0] - -/*---------------------------------------------------------------------------* - * macros related to ihfc_sc (HFC-1/S/SP) - *---------------------------------------------------------------------------*/ - -/* statemachine */ - -#define S_IOM2 (sc->sc_config.i_adf2 & 0x80) - /* 0x80: IOM2 mode selected */ - -#define S_DLP (sc->sc_config.dlp) -#define S_NTMODE (sc->sc_config.ntmode) -#define S_STDEL (sc->sc_config.stdel) - -#define S_PHSTATE sc->sc_statemachine.state -#define S_STM_T3 sc->sc_statemachine.T3 -#define S_STM_T3CALLOUT sc->sc_statemachine.T3callout - -/* unitnumbers */ - -#define S_UNIT sc->sc_unit -#define S_FLAG sc->sc_flag -#define S_I4BUNIT sc->sc_i4bunit -#define S_I4BFLAG sc->sc_i4bflag - -/* ISA bus setup */ - -#define S_IOBASE sc->sc_resources.io_base -#define S_IORID sc->sc_resources.io_rid -#define S_IRQ sc->sc_resources.irq -#define S_IRQRID sc->sc_resources.irq_rid - -/* hardware setup */ - -#define S_HFC sc->sc_config.chiptype -#define S_IIO sc->sc_config.iio -#define S_IIRQ sc->sc_config.iirq - -/* registers of the HFC-S/SP (write only) */ - -#define S_HFC_CONFIG sc->sc_config.cirm - -#define S_CIRM sc->sc_config.cirm -#define S_CTMT sc->sc_config.ctmt -#define S_TEST sc->sc_config.test -#define S_SCTRL sc->sc_config.sctrl -#define S_CLKDEL sc->sc_config.clkdel -#define S_INT_M1 sc->sc_config.int_m1 -#define S_INT_M2 sc->sc_config.int_m2 -#define S_CONNECT sc->sc_config.connect -#define S_SCTRL_R sc->sc_config.sctrl_r -#define S_MST_MODE sc->sc_config.mst_mode - -/* registers of the HFC-S/SP (read only) */ - -#define S_INT_S1 sc->sc_config.int_s1 - -/* registers of the ISAC (write only) */ - -#define S_ISAC_CONFIG sc->sc_config.i_adf2 - -#define S_ADF1 sc->sc_config.i_adf1 -#define S_ADF2 sc->sc_config.i_adf2 -#define S_MASK sc->sc_config.i_mask -#define S_MODE sc->sc_config.i_mode -#define S_SPCR sc->sc_config.i_spcr -#define S_SQXR sc->sc_config.i_sqxr -#define S_STCR sc->sc_config.i_stcr -#define S_STAR2 sc->sc_config.i_star2 - -/* registers of the ISAC (read only) */ - -#define S_ISTA sc->sc_config.i_ista - -/* state of the softc */ - -#define S_ENABLED sc->sc_enabled -#define S_INTR_ACTIVE sc->sc_intr_active - -/* SOFT-HDLC */ - -#define S_HDLC_IB sc->sc_fifo.chan[chan].hdlc.ib /* u_short */ -#define S_HDLC_CRC sc->sc_fifo.chan[chan].hdlc.crc /* u_short */ -#define S_HDLC_TMP sc->sc_fifo.chan[chan].hdlc.tmp /* u_int */ -#define S_HDLC_FLAG sc->sc_fifo.chan[chan].hdlc.flag /* u_char */ -#define S_HDLC_BLEVEL sc->sc_fifo.chan[chan].hdlc.blevel /* u_short */ - -/* stats */ - -#define S_BYTES sc->sc_fifo.chan[chan].bytes - -/* "Z"-values */ - -#define S_HDLC_DZ_TAB sc->sc_fifo.dztable - -/* filters */ - -#define S_PROT sc->sc_fifo.chan[chan].prot -#define S_FILTER sc->sc_fifo.chan[chan].filter -#define S_ACTIVITY sc->sc_fifo.chan[chan].activity -#define S_LAST_CHAN sc->sc_fifo.last_chan - -/* soft reset */ - -#define RESET_SOFT_CHAN(sc, chan) bzero(&sc->sc_fifo.chan[chan], sizeof(sc->sc_fifo.chan[0])) - -/* trace */ - -#define S_TRACE sc->sc_trace -#define S_DTRACECOUNT sc->sc_Dtracecount -#define S_BTRACECOUNT sc->sc_Btracecount - -/* mbuf */ - -#define S_MBUF sc->sc_fifo.chan[chan].buffer.mbuf -#define S_MBUFDUMMY sc->sc_fifo.chan[chan].buffer.mbufdummy -#define S_MBUFLEN sc->sc_fifo.chan[chan].buffer.mbuf->m_len -#define S_MBUFPKTHDR sc->sc_fifo.chan[chan].buffer.mbuf->m_pkthdr -#define S_MBUFDATA sc->sc_fifo.chan[chan].buffer.mbuf->m_data -#define S_MBUFDAT sc->sc_fifo.chan[chan].buffer.mbuf->m_dat - -#define S_IFQUEUE sc->sc_fifo.chan[chan].buffer.ifqueue - -/* hfc control */ - -#define HFC_INIT ihfc_init -#define HFC_INTR ((S_HFC & HFC_1) ? ihfc_intr1 : ihfc_intr2) -#define HFC_FSM ihfc_fsm -#define HFC_CONTROL ihfc_control - -/* softc parts */ - -struct ihfc_sc; - -struct sc_resources { - struct resource * io_base[IHFC_IO_BASES]; - int io_rid [IHFC_IO_BASES]; - struct resource * irq; - int irq_rid; -}; - -struct hdlc { - u_char flag; - u_short blevel; - u_short crc; - u_short ib; - u_int tmp; -}; - -struct buffer { - struct ifqueue ifqueue; /* data queue */ - struct mbuf *mbuf; /* current mbuf */ - struct mbuf *mbufdummy; /* temporary */ -}; - -struct chan { - struct hdlc hdlc; - u_int bytes; - u_int prot; - struct buffer buffer; - void (*filter)(struct ihfc_sc *sc, u_char chan); -}; - -struct sc_fifo { - struct chan chan[6]; - u_short dztable[16]; - u_char last_chan; -}; - -struct sc_config { - /* software only: */ - - u_short chiptype; /* chiptype (eg. HFC_1) */ - u_char dlp; /* D-priority */ - u_short iio; /* internal IO */ - u_char iirq; /* internal IRQ */ - u_char ntmode; /* mode */ - u_char stdel; /* S/T delay */ - - /* write only: */ - u_char cirm; - u_char ctmt; - u_char int_m1; - u_char int_m2; - u_char mst_mode; - u_char clkdel; - u_char sctrl; - u_char connect; - u_char test; - u_char sctrl_r; - - /* isac write only - hfc-1: */ - u_char i_adf2; - u_char i_spcr; - u_char i_sqxr; - u_char i_adf1; - u_char i_stcr; - u_char i_mode; - u_char i_mask; - u_char i_star2; - - /* read only: */ - u_char int_s1; - - /* isac read only - hfc-1: */ - u_char i_ista; -}; - -struct sc_statemachine { - u_char state; /* see i4b_ihfc_drv.h */ - u_char usync; - u_char T3; /* T3 running */ - struct callout_handle T3callout; -}; - -/*---------------------------------------------------------------------------* - * HFC softc - *---------------------------------------------------------------------------*/ -typedef struct ihfc_sc -{ int sc_unit; - int sc_flag; - - int sc_i4bunit; /* L0IHFCUNIT(sc_unit) */ - int sc_i4bflag; /* FLAG_TEL_S0_16_3C .. */ - - u_char sc_enabled; /* daemon running if set */ - u_char sc_intr_active; /* interrupt is active */ - - int sc_trace; - u_int sc_Btracecount; - u_int sc_Dtracecount; - - struct sc_config sc_config; - struct sc_resources sc_resources; - struct sc_statemachine sc_statemachine; - - isdn_link_t sc_blinktab[2]; - drvr_link_t *sc_bdrvlinktab[2]; - - struct sc_fifo sc_fifo; -} ihfc_sc_t; - -extern ihfc_sc_t ihfc_softc[]; - -#endif /* _I4B_IHFC_H_ */ diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.h b/sys/i4b/layer1/ihfc/i4b_ihfc_drv.h deleted file mode 100644 index d0456ad565e80..0000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_drv.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ihfc_drv.h - include file for the HFC-1/S/SP driver - * ------------------------------------------------------- - * - * last edit-date: [Wed Jul 19 09:40:55 2000] - * - * $Id: i4b_ihfc_drv.h,v 1.7 2000/09/19 13:50:36 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ -#ifndef I4B_IHFC_DRV_H_ -#define I4B_IHFC_DRV_H_ - -/*---------------------------------------------------------------------------* - * Ramptables related fifo (HFC-1/S/SP) - * - * The HFC-SP chip only uses ihfc_xxx[2] values for D-channel! - * NOTE: These tables are not used anymore. - *---------------------------------------------------------------------------* - * - * w - write, r - read: D1_w D1_r B1_w B1_r B2_w B2_r - * const u_char ihfc_readtable[6] = {0xa6, 0xa7, 0xbc, 0xbd, 0xbe, 0xbf}; - * const u_char ihfc_writetable[6] = {0x96, 0x97, 0xac, 0xad, 0xae, 0xaf}; - * const u_char ihfc_f1inctable[6] = {0x92, 0x93, 0xa8, 0xa9, 0xaa, 0xab}; - * const u_char ihfc_f2inctable[6] = {0xa2, 0xa3, 0xb8, 0xb9, 0xba, 0xbb}; - * - * const struct { u_char z1L, z1H, z2L, z2H, f1, f2, dummy; } - * ihfc_countertable[6] = { - * {0x90, 0x94, 0x98, 0x9c, 0x9a, 0x9e, 0x00}, D1_w - * {0x91, 0x95, 0x99, 0x9d, 0x9b, 0x9f, 0x00}, D1_r - * {0x80, 0x84, 0x88, 0x8c, 0xb0, 0xb4, 0x00}, B1_w - * {0x81, 0x85, 0x89, 0x8d, 0xb1, 0xb5, 0x00}, B1_r - * {0x82, 0x86, 0x8a, 0x8e, 0xb2, 0xb6, 0x00}, B2_w - * {0x83, 0x87, 0x8b, 0x8f, 0xb3, 0xb7, 0x00} B2_r - * }; - *---------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------* - * Ramptables related to configuration (HFC-1/S/SP) - * - * NOTE: Write registers only - *---------------------------------------------------------------------------*/ -const u_char ihfc_configtable[11] = -{ - 0x18, 0x19, 0x1a, /* cirm, ctmt, int_m1 */ - 0x1b, 0x2e, 0x37, /* int_m2, mst_mode, clkdel */ - 0x31, 0x2f, 0x32, /* sctrl, connect, test/sctrl_e */ - 0x33, 0x00 /* sctrl_r */ -}; -const u_char isac_configtable[9] = -{ - 0x39, 0x30, 0x3b, /* adf2, spcr, sqxr */ - 0x38, 0x37, 0x22, /* adf1, stcr, mode */ - 0x20, 0x2b, 0x00 /* mask, star2 */ -}; - -/*---------------------------------------------------------------------------* - * Ramptables related to statemachine (HFC-1/S/SP) - * - * state: - * 0 = deactivated - * 1 = pending - * 2 = syncronized - * 3 = activated - * 4 = error - * 5 = reset - * -1 = illegal - *---------------------------------------------------------------------------*/ - -const struct ihfc_FSMtable { u_char state, *string; } - - ihfc_TEtable[16] = /* HFC-S/SP - TE */ -{ - { 0x05 ,"Reset" }, - { 0xff , 0 }, - { 0x01 ,"Sensing" }, - { 0x00 ,"Deactivated" }, - { 0x01 ,"Awaiting signal" }, - { 0x01 ,"Identifying input" }, - { 0x02 ,"Syncronized" }, - { 0x03 ,"Activated" }, - { 0x04 ,"Lost framing" }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 } -}, - ihfc_NTtable[16] = /* HFC-S/SP - NT */ -{ - { 0x05 ,"Reset" }, - { 0x00 ,"Deactive" }, - { 0x02 ,"Pending activation" }, - { 0x03 ,"Active" }, - { 0x01 ,"Pending deactivation" }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 } -}, - ihfc_TEtable2[16] = /* HFC-1/ISAC - TE */ -{ - { 0x00 ,"Deactivate request" }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0xff , 0 }, - { 0x01 ,"Level detected" }, - { 0xff , 0 }, - { 0x04 ,"Error indication" }, - { 0x00 ,"Power-up" }, - { 0x02 ,"Activate request downstream" }, - { 0xff , 0 }, - { 0x00 ,"Test indication" }, - { 0x00 ,"Awake test indication" }, - { 0x03 ,"Activate ind. with priority class 8" }, - { 0x03 ,"Activate ind. with priority class 10" }, - { 0xff , 0 }, - { 0x00 ,"Deactivate indication downstream" } -}; - -/*---------------------------------------------------------------------------* - * Ramptable related to ISAC EXIR (HFC-1) - * - * cmd: command to execute, if any. - * - *---------------------------------------------------------------------------*/ -const struct ihfc_EXIRtable { u_char cmd, *string; } - - ihfc_EXIRtable[8] = -{ - { 0x00 ,"Watchdog Timer Overflow" }, - { 0x00 ,"Subscriber Awake" }, - { 0x00 ,"Monitor Status" }, - { 0x00 ,"Rx Sync Xfer Overflow" }, - { 0xc0 ,"Rx Frame Overflow" }, /* RMC + RRES */ - { 0x00 ,"Protocol Error" }, - { 0x01 ,"Tx Data Underrun" }, /* XRES */ - { 0x01 ,"Tx Message Repeat" }, /* XRES */ -}; - -/*---------------------------------------------------------------------------* - * Ramptables related to S/Q - channel (HFC-1/S/SP) - * - * From TE's viewpoint: - * Q: commands to NT - * S: indications from NT - * - * From NT's viewpoint: - * Q: indications from TE - * S: commands to TE - * - * cmd: not used - *---------------------------------------------------------------------------*/ -const struct ihfc_SQtable { u_char cmd, *string; } - - ihfc_Qtable[16] = -{ - { 0x00, "Loss of Power indication" }, - { 0x00, "ST request" }, - { 0x00, 0 }, - { 0x00, "LoopBack request (B1/B2)" }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, "LoopBack request (B1)" }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, 0 }, - { 0x00, "LoopBack request (B2)" }, - { 0x00, "V-DCE slave mode" }, - { 0x00, "V-DTE slave mode" }, - { 0x00, 0 }, - { 0x00, "Idle" } -}, - ihfc_Stable[16] = -{ - { 0x00, "Idle" }, - { 0x00, "ST Fail" }, - { 0x00, "ST Pass" }, - { 0x00, "Disruptive Operation Indication" }, - { 0x00, "DTSE-OUT" }, - { 0x00, "V-DCE master mode" }, - { 0x00, "ST Indication" }, - { 0x00, "DTSE-IN" }, - { 0x00, "LoopBack indication (B1/B2)" }, - { 0x00, "Loss of Received Signal indication" }, - { 0x00, "LoopBack indication (B2)" }, - { 0x00, "DTSE-IN and OUT" }, - { 0x00, "LoopBack indication (B1)" }, - { 0x00, "Loss of power indication" } -}; - - -#endif /* I4B_IHFC_DRV_H_ */ - diff --git a/sys/i4b/layer1/ihfc/i4b_ihfc_ext.h b/sys/i4b/layer1/ihfc/i4b_ihfc_ext.h deleted file mode 100644 index 0d1ee449a678d..0000000000000 --- a/sys/i4b/layer1/ihfc/i4b_ihfc_ext.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2000 Hans Petter Selasky. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * i4b_ihfc_ext.h - ihfc common prototypes - * --------------------------------------- - * - * last edit-date: [Wed Jul 19 09:40:59 2000] - * - * $Id: i4b_ihfc_ext.h,v 1.6 2000/08/20 07:14:08 hm Exp $ - * - * $FreeBSD$ - * - *---------------------------------------------------------------------------*/ - -#ifndef I4B_IHFC_EXT_H_ -#define I4B_IHFC_EXT_H_ - -#include <i4b/include/i4b_l3l4.h> - - -/* prototypes from i4b_ihfc_l1if.c */ - -extern struct i4b_l1mux_func ihfc_l1mux_func; - -void ihfc_B_linkinit (ihfc_sc_t *sc); -struct mbuf * ihfc_getmbuf (ihfc_sc_t *sc, u_char chan); -void ihfc_putmbuf (ihfc_sc_t *sc, u_char chan, struct mbuf *m); - - -/* prototypes from i4b_ihfc_drv.c */ - -void ihfc_intr1 (ihfc_sc_t *sc); -void ihfc_intr2 (ihfc_sc_t *sc); - -int ihfc_control (ihfc_sc_t *sc, int flag); -void ihfc_fsm (ihfc_sc_t *sc, int flag); -int ihfc_init (ihfc_sc_t *sc, u_char chan, int prot, int activate); - -#endif /* I4B_IHFC_EXT_H_ */ diff --git a/sys/net/if_ieee80211.h b/sys/net/if_ieee80211.h deleted file mode 100644 index d4364c77d2c88..0000000000000 --- a/sys/net/if_ieee80211.h +++ /dev/null @@ -1,171 +0,0 @@ -/* $NetBSD: if_ieee80211.h,v 1.5 2000/07/21 04:47:40 onoe Exp $ */ -/* $FreeBSD$ */ - -#ifndef _NET_IF_IEEE80211_H_ -#define _NET_IF_IEEE80211_H_ - -/* - * generic definitions for IEEE 802.11 frames - */ -struct ieee80211_frame { - u_int8_t i_fc[2]; - u_int8_t i_dur[2]; - u_int8_t i_addr1[ETHER_ADDR_LEN]; - u_int8_t i_addr2[ETHER_ADDR_LEN]; - u_int8_t i_addr3[ETHER_ADDR_LEN]; - u_int8_t i_seq[2]; - /* possibly followed by addr4[ETHER_ADDR_LEN]; */ -}; - -#define IEEE80211_FC0_VERSION_MASK 0x03 -#define IEEE80211_FC0_VERSION_0 0x00 -#define IEEE80211_FC0_TYPE_MASK 0x0c -#define IEEE80211_FC0_TYPE_MGT 0x00 -#define IEEE80211_FC0_TYPE_CTL 0x04 -#define IEEE80211_FC0_TYPE_DATA 0x08 - -#define IEEE80211_FC0_SUBTYPE_MASK 0xf0 -/* for TYPE_MGT */ -#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00 -#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10 -#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20 -#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30 -#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40 -#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50 -#define IEEE80211_FC0_SUBTYPE_BEACON 0x80 -#define IEEE80211_FC0_SUBTYPE_ATIM 0x90 -#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0 -#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0 -#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0 -/* for TYPE_CTL */ -#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0 -#define IEEE80211_FC0_SUBTYPE_RTS 0xb0 -#define IEEE80211_FC0_SUBTYPE_CTS 0xc0 -#define IEEE80211_FC0_SUBTYPE_ACK 0xd0 -#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0 -#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0 -/* for TYPE_DATA (bit combination) */ -#define IEEE80211_FC0_SUBTYPE_DATA 0x00 -#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10 -#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20 -#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30 -#define IEEE80211_FC0_SUBTYPE_NODATA 0x40 -#define IEEE80211_FC0_SUBTYPE_CFACK 0x50 -#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60 -#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70 - -#define IEEE80211_FC1_DIR_MASK 0x03 -#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */ -#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */ -#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */ -#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */ - -#define IEEE80211_FC1_MORE_FRAG 0x04 -#define IEEE80211_FC1_RETRY 0x08 -#define IEEE80211_FC1_PWR_MGT 0x10 -#define IEEE80211_FC1_MORE_DATA 0x20 -#define IEEE80211_FC1_WEP 0x40 -#define IEEE80211_FC1_ORDER 0x80 - -/* - * Management Frames - */ - -#define IEEE80211_ELEMID_SSID 0 -#define IEEE80211_ELEMID_RATES 1 -#define IEEE80211_ELEMID_FHPARMS 2 -#define IEEE80211_ELEMID_DSPARMS 3 -#define IEEE80211_ELEMID_CFPARMS 4 -#define IEEE80211_ELEMID_TIM 5 -#define IEEE80211_ELEMID_IBSSPARMS 6 -#define IEEE80211_ELEMID_CHALLENGE 16 - -/* - * AUTH management packets - * - * octect algo[2] - * octect seq[2] - * octect status[2] - * octect chal.id - * octect chal.length - * octect chal.text[253] - */ -typedef u_int8_t * ieee80211_mgt_auth_t; - -#define IEEE80211_AUTH_ALGORITHM(auth) \ - (auth[0] + (auth[1] << 8)) -#define IEEE80211_AUTH_TRANSACTION(auth) \ - (auth[2] + (auth[3] << 8)) -#define IEEE80211_AUTH_STATUS(auth) \ - (auth[4] + (auth[5] << 8)) - -#define IEEE80211_AUTH_ALG_OPEN 0x0000 -#define IEEE80211_AUTH_ALG_SHARED 0x0001 - -#define IEEE80211_CAPINFO_ESS 0x01 -#define IEEE80211_CAPINFO_IBSS 0x02 -#define IEEE80211_CAPINFO_CF_POLLABLE 0x04 -#define IEEE80211_CAPINFO_CF_POLLREQ 0x08 -#define IEEE80211_CAPINFO_PRIVACY 0x10 - -/* - * Reason codes - * - * Unlisted codes are reserved - */ -#define IEEE80211_REASON_UNSPECIFIED 1 -#define IEEE80211_REASON_AUTH_EXPIRE 2 -#define IEEE80211_REASON_AUTH_LEAVE 3 -#define IEEE80211_REASON_ASSOC_EXPIRE 4 -#define IEEE80211_REASON_ASSOC_TOOMANY 5 -#define IEEE80211_REASON_NOT_AUTHED 6 -#define IEEE80211_REASON_NOT_ASSOCED 7 -#define IEEE80211_REASON_ASSOC_LEAVE 8 -#define IEEE80211_REASON_ASSOC_NOT_AUTHED 9 - -/* - * Status code - * - * Unlisted codes are reserved - */ -#define IEEE80211_STATUS_SUCCESS 0x0000 -#define IEEE80211_STATUS_UNSPECIFIED 1 -#define IEEE80211_STATUS_CAPINFO 10 -#define IEEE80211_STATUS_NOT_ASSOCED 11 -#define IEEE80211_STATUS_OTHER 12 -#define IEEE80211_STATUS_ALG 13 -#define IEEE80211_STATUS_SEQUENCE 14 -#define IEEE80211_STATUS_CHALLENGE 15 -#define IEEE80211_STATUS_TIMEOUT 16 - -#define IEEE80211_WEP_KEYLEN 5 /* 40bit */ -#define IEEE80211_WEP_IVLEN 3 /* 24bit */ -#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */ -#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */ -#define IEEE80211_WEP_NKID 4 /* number of key ids */ - -#define IEEE80211_NWID_LEN 32 - -/* nwid is pointed at by ifr.ifr_data */ -struct ieee80211_nwid { - u_int8_t i_len; - u_int8_t i_nwid[IEEE80211_NWID_LEN]; -}; - -#define SIOCS80211NWID _IOWR('i', 230, struct ifreq) -#define SIOCG80211NWID _IOWR('i', 231, struct ifreq) - -/* the first member must be matched with struct ifreq */ -struct ieee80211_nwkey { - char i_name[IFNAMSIZ]; /* if_name, e.g. "wi0" */ - int i_wepon; /* wep enabled flag */ - int i_defkid; /* default encrypt key id */ - struct { - int i_keylen; - u_int8_t *i_keydat; - } i_key[IEEE80211_WEP_NKID]; -}; -#define SIOCS80211NWKEY _IOW('i', 232, struct ieee80211_nwkey) -#define SIOCG80211NWKEY _IOWR('i', 233, struct ieee80211_nwkey) - -#endif /* !_NET_IF_IEEE80211_H_ */ diff --git a/sys/sys/kobj.h b/sys/sys/kobj.h deleted file mode 100644 index c2919636419d3..0000000000000 --- a/sys/sys/kobj.h +++ /dev/null @@ -1,169 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _SYS_KOBJ_H_ -#define _SYS_KOBJ_H_ - -/* - * Forward declarations - */ -typedef struct kobj *kobj_t; -typedef struct kobj_class *kobj_class_t; -typedef struct kobj_method kobj_method_t; -typedef int (*kobjop_t)(void); -typedef struct kobj_ops *kobj_ops_t; -typedef struct kobjop_desc *kobjop_desc_t; -struct malloc_type; - -struct kobj_method { - kobjop_desc_t desc; - kobjop_t func; -}; - -/* - * A class is simply a method table and a sizeof value. When the first - * instance of the class is created, the method table will be compiled - * into a form more suited to efficient method dispatch. This compiled - * method table is always the first field of the object. - */ -#define KOBJ_CLASS_FIELDS \ - const char *name; /* class name */ \ - kobj_method_t *methods; /* method table */ \ - size_t size; /* object size */ \ - u_int refs; /* reference count */ \ - kobj_ops_t ops /* compiled method table */ - -struct kobj_class { - KOBJ_CLASS_FIELDS; -}; - -/* - * Implementation of kobj. - */ -#define KOBJ_FIELDS \ - kobj_ops_t ops - -struct kobj { - KOBJ_FIELDS; -}; - -/* - * The ops table is used as a cache of results from kobj_lookup_method(). - */ - -#define KOBJ_CACHE_SIZE 256 - -struct kobj_ops { - kobj_method_t cache[KOBJ_CACHE_SIZE]; - kobj_class_t cls; -}; - -struct kobjop_desc { - unsigned int id; /* unique ID */ - kobjop_t deflt; /* default implementation */ -}; - -/* - * Shorthand for constructing method tables. - */ -#define KOBJMETHOD(NAME, FUNC) { &NAME##_desc, (kobjop_t) FUNC } - -#define DEFINE_CLASS(name, methods, size) \ - \ -struct kobj_class name ## _class = { \ - #name, methods, size \ -} - -/* - * Compile the method table in a class. - */ -void kobj_class_compile(kobj_class_t cls); - -/* - * Compile the method table, with the caller providing the space for - * the ops table.(for use before malloc is initialised). - */ -void kobj_class_compile_static(kobj_class_t cls, kobj_ops_t ops); - -/* - * Free the compiled method table in a class. - */ -void kobj_class_free(kobj_class_t cls); - -/* - * Allocate memory for and initalise a new object. - */ -kobj_t kobj_create(kobj_class_t cls, - struct malloc_type *mtype, - int mflags); - -/* - * Initialise a pre-allocated object. - */ -void kobj_init(kobj_t obj, kobj_class_t cls); - -/* - * Delete an object. If mtype is non-zero, free the memory. - */ -void kobj_delete(kobj_t obj, struct malloc_type *mtype); - -/* - * Maintain stats on hits/misses in lookup caches. - */ -#ifdef KOBJ_STATS -extern int kobj_lookup_hits; -extern int kobj_lookup_misses; -#define KOBJOPHIT do { kobj_lookup_hits++; } while (0) -#define KOBJOPMISS do { kobj_lookup_misses++; } while (0) -#else -#define KOBJOPHIT do { } while (0) -#define KOBJOPMISS do { } while (0) -#endif - -/* - * Lookup the method in the cache and if it isn't there look it up the - * slow way. - */ -#define KOBJOPLOOKUP(OPS,OP) do { \ - kobjop_desc_t _desc = &OP##_##desc; \ - kobj_method_t *_ce = \ - &OPS->cache[_desc->id & (KOBJ_CACHE_SIZE-1)]; \ - if (_ce->desc != _desc) { \ - KOBJOPMISS; \ - kobj_lookup_method(OPS->cls->methods, _ce, _desc); \ - } else { \ - KOBJOPHIT; \ - } \ - _m = _ce->func; \ -} while(0) - -void kobj_lookup_method(kobj_method_t *methods, - kobj_method_t *ce, - kobjop_desc_t desc); - -#endif /* !_SYS_KOBJ_H_ */ diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all deleted file mode 100644 index 9cdd9641bb0f6..0000000000000 --- a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.all +++ /dev/null @@ -1,15 +0,0 @@ -/* - * òÕÓÓËÉÊ ËÁÌÅÎÄÁÒØ - * - * $FreeBSD$ - */ - -#ifndef _ru_RU_KOI8_R_all -#define _ru_RU_KOI8_R_all - -#include <ru_RU.KOI8-R/calendar.common> -#include <ru_RU.KOI8-R/calendar.msk> -#include <ru_RU.KOI8-R/calendar.pagan> -#include <ru_RU.KOI8-R/calendar.orthodox> - -#endif /* !_ru_RU_KOI8_R_all */ diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.msk b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.msk deleted file mode 100644 index 4db9563703d26..0000000000000 --- a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.msk +++ /dev/null @@ -1,16 +0,0 @@ -/* - * ðÅÒÅ×ÏÄ ÞÁÓÏ× ÄÌÑ ÍÏÓËÏ×ÓËÏÊ ×ÒÅÍÅÎÎÏÊ ÚÏÎÙ - * - * $FreeBSD$ - */ - -#ifndef _ru_RU_KOI8_R_msk_ -#define _ru_RU_KOI8_R_msk_ - -LANG=ru_RU.KOI8-R - -03/SunLast îÁÞÁÌÏ ÍÏÓËÏ×ÓËÏÇÏ ÌÅÔÎÅÇÏ ×ÒÅÍÅÎÉ; ÞÁÓÙ ÐÅÒÅ×ÏÄÑÔÓÑ ×ÐÅÒÅÄ -10/SunLast ëÏÎÅà ÍÏÓËÏ×ÓËÏÇÏ ÌÅÔÎÅÇÏ ×ÒÅÍÅÎÉ; ÞÁÓÙ ÐÅÒÅ×ÏÄÑÔÓÑ ÎÁÚÁÄ - -#endif /* !_ru_RU_KOI8_R_msk_ */ - diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox deleted file mode 100644 index ac38458d4a680..0000000000000 --- a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.orthodox +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ðÒÁ×ÏÓÌÁ×ÎÙÅ ÐÒÁÚÄÎÉËÉ - * - * $FreeBSD$ - */ - -#ifndef _ru_RU_KOI8_R_orthodox_ -#define _ru_RU_KOI8_R_orthodox_ - -LANG=ru_RU.KOI8-R -Paskha=ðÁÓÈÁ - -21 ÓÅÎ òÏÖÄÅÓÔ×Ï ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ -28 ÓÅÎ ÷ÏÚÄ×ÉÖÅÎÉÅ ëÒÅÓÔÁ çÏÓÐÏÄÎÑ -14 ÏËÔ ðÏËÒÏ× ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ - 4 ÄÅË ÷×ÅÄÅÎÉÅ ×Ï ÈÒÁÍ ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ - 7 ÑÎ× òÏÖÄÅÓÔ×Ï èÒÉÓÔÏ×Ï -19 ÑÎ× âÏÇÏÑ×ÌÅÎÉÅ ÉÌÉ ëÒÅÝÅÎÉÅ çÏÓÐÏÄÎÅ -15 ÆÅ× óÒÅÔÅÎÉÅ çÏÓÐÏÄÎÅ -ðÁÓÈÁ-46 ÷ÅÌÉËÉÊ ðÏÓÔ -ðÁÓÈÁ-7 ÷ÅÒÂÎÏÅ ÷ÏÓËÒÅÓÅÎØÅ -ðÁÓÈÁ-3 ÷ÅÌÉËÉÊ þÅÔ×ÅÒÇ -ðÁÓÈÁ-2 óÔÒÁÓÔÎÁÑ ðÑÔÎÉÃÁ -ðÁÓÈÁ ÷ÏÓËÒÅÓÅÎÉÅ èÒÉÓÔÏ×Ï -ðÁÓÈÁ+39 ÷ÏÚÎÅÓÅÎÉÅ -ðÁÓÈÁ+49 ðÑÔÉÄÅÓÑÔÎÉÃÁ -ðÁÓÈÁ+56 ôÒÏÉÃÉÎ äÅÎØ -ðÁÓÈÁ+60 ðÒÁÚÄÎÉË ôÅÌÁ èÒÉÓÔÏ×Á - 7 ÁÐÒ âÌÁÇÏ×ÅÝÅÎÉÅ ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ -19 Á×Ç ðÒÅÏÂÒÁÖÅÎÉÅ çÏÓÐÏÄÎÅ -28 Á×Ç õÓÐÅÎÉÅ ðÒÅÓ×ÑÔÏÊ âÏÇÏÒÏÄÉÃÙ - -#endif /* !_ru_RU_KOI8_R_orthodox_ */ - diff --git a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan b/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan deleted file mode 100644 index afcd809e4987e..0000000000000 --- a/usr.bin/calendar/calendars/ru_RU.KOI8-R/calendar.pagan +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ñÚÙÞÅÓËÉÅ ÐÒÁÚÄÎÉËÉ - * - * $FreeBSD$ - */ - -#ifndef _ru_RU_KOI8_R_pagan_ -#define _ru_RU_KOI8_R_pagan_ - -LANG=ru_RU.KOI8-R -Paskha=ðÁÓÈÁ - -21 ÄÅË* úÉÍÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ -25 ÄÅË ëÏÌÑÄÁ (ÓÄ×ÉÎÕÔÏÅ ÚÉÍÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ) -31 ÄÅË îÅÄÅÌÑ ðÒÁÏÔÃÏ× - 6 ÑÎ× äÅÎØ ëÁÝÅÑ É ÷ÅÌÅÓÁ, ÐÏÓÔ -24 ÆÅ× äÅÎØ ÷ÅÌÅÓÁ -29 ÆÅ× äÅÎØ ëÁÝÅÑ - 1 ÍÁÒ äÅÎØ íÁÒÅÎÙ -14 ÍÁÒ îÏ×ÙÊ çÏÄ, ï×ÓÅÎØ ÍÁÌÙÊ -ðÁÓÈÁ-47 íÁÓÌÅÎÉÃÁ -ðÁÓÈÁ+7 ëÒÁÓÎÁÑ çÏÒËÁ -ðÁÓÈÁ+16 òÁÄÕÎÉÃÁ -20 ÍÁÒ* ÷ÅÓÅÎÎÉÅ ÒÁ×ÎÏÄÅÎÓÔ×ÉÅ - 7 ÁÐÒ äÅÎØ íÁÒÅÎÙ (ÓÄ×ÉÎÕÔÏÅ ×ÅÓÅÎÎÅÅ ÒÁ×ÎÏÄÅÎÓÔ×ÉÅ) - 6 ÍÁÊ äÅÎØ äÁÖØÂÏÇÁ, ï×ÓÅÎØ ÂÏÌØÛÏÊ -22 ÍÁÊ ñÒÉÌÉÎ äÅÎØ -21 ÉÀÎ* ìÅÔÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ - 1 ÉÀÌ òÕÓÁÌØÎÁÑ îÅÄÅÌÑ - 7 ÉÀÌ ëÕÐÁÌÁ (ÓÄ×ÉÎÕÔÏÅ ÌÅÔÎÅÅ ÓÏÌÎÃÅÓÔÏÑÎÉÅ) -27 ÉÀÌ ïÔÂÏÒ ÖÅÒÔ× ðÅÒÕÎÕ, ÒÕÓÁÌÉÉ - 2 Á×Ç ðÅÒÕÎÏ× äÅÎØ -21 Á×Ç äÅÎØ óÔÒÉÂÏÇÁ -28 Á×Ç õÓÐÅÎÉÅ úÌÁÔÏÇÏÒËÉ -14 ÓÅÎ äÅÎØ ÷ÏÌÈÁ úÍÅÅ×ÉÞÁ -22 ÓÅÎ* ðÏ×ÏÒÏÔ Ë ÚÉÍÅ (ÏÓÅÎÎÅÅ ÒÁ×ÎÏÄÅÎÓÔ×ÉÅ) -10 ÎÏÑ äÅÎØ íÁËÏÛÉ -21 ÎÏÑ äÅÎØ ó×ÁÒÏÇÁ É óÅÍÁÒÇÌÁ - 9 ÄÅË äÅÎØ äÁÖØÂÏÇÁ É íÁÒÅÎÙ - -#endif /* !_ru_RU_KOI8_R_pagan_ */ - diff --git a/usr.bin/file/config.h b/usr.bin/file/config.h deleted file mode 100644 index e4b03da9e14fe..0000000000000 --- a/usr.bin/file/config.h +++ /dev/null @@ -1,81 +0,0 @@ -/* $FreeBSD$ */ - -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define if your struct stat has st_rdev. */ -#define HAVE_ST_RDEV 1 - -/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if major, minor, and makedev are declared in <mkdev.h>. */ -/* #undef MAJOR_IN_MKDEV */ - -/* Define if major, minor, and makedev are declared in <sysmacros.h>. */ -/* #undef MAJOR_IN_SYSMACROS */ - -/* Define to `long' if <sys/types.h> doesn't define. */ -/* #undef off_t */ - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -/* #undef size_t */ - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if builtin ELF support is enabled. */ -#define BUILTIN_ELF 1 - -/* Define if ELF core file support is enabled. */ -#define ELFCORE 1 - -/* Define if the `long long' type works. */ -#define HAVE_LONG_LONG 1 - -/* Define to `unsigned char' if standard headers don't define. */ -/* #undef uint8_t */ - -/* Define to `unsigned short' if standard headers don't define. */ -/* #undef uint16_t */ - -/* Define to `unsigned int' if standard headers don't define. */ -/* #undef uint32_t */ - -/* Define to `unsigned long long', if available, or `unsigned long', if - standard headers don't define. */ -/* #undef uint64_t */ - -/* The number of bytes in a uint8_t. */ -#define SIZEOF_UINT8_T 1 - -/* The number of bytes in a uint16_t. */ -#define SIZEOF_UINT16_T 2 - -/* The number of bytes in a uint32_t. */ -#define SIZEOF_UINT32_T 4 - -/* The number of bytes in a uint64_t. */ -#define SIZEOF_UINT64_T 8 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strtoul function. */ -#define HAVE_STRTOUL 1 - -/* Define if you have the <locale.h> header file. */ -#define HAVE_LOCALE_H 1 - -/* Define if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Name of package */ -#define PACKAGE "file" - -/* Version number of package */ -#define VERSION "3.32" - diff --git a/usr.bin/makewhatis/makewhatis.local.sh b/usr.bin/makewhatis/makewhatis.local.sh deleted file mode 100644 index 8be25300b75dd..0000000000000 --- a/usr.bin/makewhatis/makewhatis.local.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# -# Copyright (c) April 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# makewhatis.local - start makewhatis(1) only for file systems -# physically mounted on the system -# -# Running makewhatis from /etc/periodic/weekly/320.whatis for rw nfs-mounted -# /usr may kill your NFS server -- all clients start makewhatis at the same -# time! So use this wrapper instead calling makewhatis directly. -# -# PS: this wrapper works also for catman(1) -# -# $FreeBSD$ - -PATH=/bin:/usr/bin:$PATH; export PATH -opt= dirs= localdirs= - -for arg -do - case "$arg" in - -*) opt="$opt $arg";; - *) dirs="$dirs $arg";; - esac -done - -dirs=`echo $dirs | sed 's/:/ /g'` -case X"$dirs" in X) echo "usage: $0 [options] directories ..."; exit 1;; esac - -localdirs=`find -H $dirs -fstype local -type d -prune -print` - -case X"$localdirs" in - X) echo "$0: no local-mounted manual directories found: $dirs" - exit 1;; - *) exec `basename $0 .local` $opt $localdirs;; -esac diff --git a/usr.bin/usbhidctl/usbhidctl.1 b/usr.bin/usbhidctl/usbhidctl.1 deleted file mode 100644 index 3a9a49a8aeb3a..0000000000000 --- a/usr.bin/usbhidctl/usbhidctl.1 +++ /dev/null @@ -1,92 +0,0 @@ -.\" $NetBSD: usbhidctl.1,v 1.8 1999/05/11 21:03:58 augustss Exp $ -.\" $FreeBSD$ -.\" -.\" Copyright (c) 1998 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Lennart Augustsson. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the NetBSD -.\" Foundation, Inc. and its contributors. -.\" 4. Neither the name of The NetBSD Foundation nor the names of its -.\" contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd July 12, 1998 -.Dt USBHIDCTL 1 -.Os -.Sh NAME -.Nm usbhidctl -.Nd manipulate USB HID devices -.Sh SYNOPSIS -.Nm -.Op Fl a -.Fl f Ar device -.Op Fl l -.Op Fl n -.Op Fl r -.Op Fl t Ar table -.Op Fl v -.Op Ar item ... -.Sh DESCRIPTION -.Nm -can be used to dump the state of a USB HID (Human Interface Device). -Each named -.Ar item -is printed. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl a -Show all items. -.It Fl f Ar device -Specify a path name for the device to operate on. -.It Fl l -Loop and dump the device data every time it changes. -.It Fl n -Suppress printing of the item name. -.It Fl r -Dump the report descriptor. -.It Fl t Ar table -Specify a path name for the HID usage table file. -.It Fl v -Be verbose. -.El -.Sh FILES -.Pa /usr/share/misc/usb_hid_usages -The default HID usage table. -.Sh BUGS -.Nm -cannot show nor set output and feature items. -.Sh SEE ALSO -.Xr usb 3 , -.Xr uhid 4 , -.Xr usb 4 -.Sh HISTORY -The -.Nm -command appeared in -.Nx 1.4 . diff --git a/usr.sbin/i4b/isdnphone/audio.c b/usr.sbin/i4b/isdnphone/audio.c deleted file mode 100644 index 2dc88d6afc2e7..0000000000000 --- a/usr.sbin/i4b/isdnphone/audio.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - audio operations - * ============================ - * - * $Id: audio.c,v 1.5 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:39 1999] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * - *---------------------------------------------------------------------------*/ -int -init_audio(char *audiodevice) -{ - int ret; - int fd; - u_long fmt = 0; - - snd_chan_param pa; - struct snd_size sz; - snd_capabilities soundcaps; - - if((fd = open(audiodevice, O_RDWR)) < 0) - { - fprintf(stderr, "unable to open %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - ret = ioctl(fd, AIOGCAP, &soundcaps); - - if(ret == -1) - { - fprintf(stderr, "ERROR: ioctl AIOGCAP %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - fmt = soundcaps.formats; - - if((fmt & AFMT_FULLDUPLEX) && (!(fmt & AFMT_WEIRD))) - { -#ifdef NOTDEF - if(fmt & AFMT_A_LAW) - { - play_fmt = rec_fmt = AFMT_A_LAW; - } - else -#endif - if(fmt & AFMT_MU_LAW) - { - play_fmt = rec_fmt = AFMT_MU_LAW; - } - else - { - printf("sorry, A-law or u-law not supported!\n"); - close(fd); - return(-1); - } - } - else - { - printf("no full-duplex available!\n"); - close (fd); - return(-1); - } - - pa.play_format = play_fmt; - pa.rec_format = rec_fmt; - pa.play_rate = pa.rec_rate = AUDIORATE; - - ret = ioctl(fd, AIOSFMT, &pa); - - if(ret == -1) - { - fprintf(stderr, "ERROR: ioctl AIOSFMT %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - sz.play_size = BCH_MAX_DATALEN; - sz.rec_size = BCH_MAX_DATALEN; - - ret = ioctl(fd, AIOSSIZE, &sz); - - if(ret == -1) - { - fprintf(stderr, "ERROR: ioctl AIOSSIZE %s: %s\n", audiodevice, strerror(errno)); - return(-1); - } - - return(fd); -} - -/*---------------------------------------------------------------------------* - * audio device has speech data from microphone - *---------------------------------------------------------------------------*/ -void -audio_hdlr(void) -{ - unsigned char buffer[BCH_MAX_DATALEN]; - int ret; - - ret = read(audiofd, buffer, BCH_MAX_DATALEN); - - if(ret < 0) - { - fatal("read audio failed: %s", strerror(errno)); - } - - debug("audio_hdlr: read %d bytes\n", ret); - - if(ret > 0) - { - telwrite(ret, buffer); - } -} - -/*---------------------------------------------------------------------------* - * write audio data to loudspeaker - *---------------------------------------------------------------------------*/ -void -audiowrite(int len, unsigned char *buf) -{ - if((write(audiofd, buf, len)) < 0) - { - fatal("write audio failed: %s", strerror(errno)); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/defs.h b/usr.sbin/i4b/isdnphone/defs.h deleted file mode 100644 index 18da037afe902..0000000000000 --- a/usr.sbin/i4b/isdnphone/defs.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - header file - * ======================= - * - * $Id: defs.h,v 1.6 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:46 1999] - * - *----------------------------------------------------------------------------*/ - -#include <ncurses.h> -#include <stdio.h> -#include <stdarg.h> -#include <signal.h> -#include <errno.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <fcntl.h> -#include <ctype.h> - -#include <sys/stat.h> -#include <sys/wait.h> -#include <sys/ioctl.h> -#include <sys/soundcard.h> -#include <sys/types.h> -#include <sys/time.h> -#include <sys/param.h> - -#include <machine/i4b_ioctl.h> -#include <machine/i4b_tel_ioctl.h> - -/* device file prefixes */ - -#define I4BTELDEVICE "/dev/i4btel" -#define I4BTELDDEVICE "/dev/i4bteld" -#define AUDIODEVICE "/dev/audio" - -#define GOOD 0 -#define ERROR (-1) -#define WARNING (-2) - -/* main window dimensions */ - -#define MW_ROW 5 -#define MW_COL 8 - -#define MW_WIDTH 60 -#define MW_HEIGHT 8 - -#define DB_ROW 15 -#define DB_COL 1 -#define DB_WID 79 -#define DB_HGT 9 - -#define MW_STATEY 2 -#define MW_STATEX 1 -#define MW_STX 10 - -#define MW_NUMY 4 -#define MW_NUMX 1 -#define MW_NUX 10 - -#define MW_MSGY 6 -#define MW_MSGX 1 -#define MW_MSX 10 - -/* fullscreen mode menu window */ - -#define WMITEMS 4 /* no of items */ -#define WMENU_LEN 18 /* window width */ -#define WMENU_HGT (WMITEMS+4) /* window height */ -#define WMENU_TITLE "Command" -#define WMENU_POSLN 8 /* window position: lines */ -#define WMENU_POSCO 20 /* window position: columns */ - -#define CR 0x0d -#define LF 0x0a -#define TAB 0x09 -#define CNTRL_D 0x04 -#define CNTRL_L 0x0c - -#define ST_IDLE 0 -#define ST_DIALING 1 -#define ST_ACTIVE 2 -#define ST_MAX 2 - -#define AUDIORATE 8000 - -#ifdef MAIN - -WINDOW *main_w; /* curses main window pointer */ -WINDOW *dbg_w; - -int curses_ready = 0; /* flag, curses display is initialized */ -int state = ST_IDLE; - -char *states[] = { - "IDLE", - "DIALING", - "ACTIVE" -}; - -int dialerfd = -1; -int audiofd = -1; -int telfd = -1; -int curx; -char numberbuffer[TELNO_MAX]; - -int play_fmt = AFMT_MU_LAW; -int rec_fmt = AFMT_MU_LAW; - -int opt_unit = 0; -int opt_d = 0; -#else - -extern WINDOW *main_w; -extern WINDOW *dbg_w; - -extern int curses_ready; -extern int state; - -extern char *states[]; - -extern int dialerfd; -extern int audiofd; -extern int telfd; -extern int curx; -extern char numberbuffer[]; - -extern int play_fmt; -extern int rec_fmt; - -int opt_unit; -int opt_d; - -#endif - -extern void audio_hdlr ( void ); -extern void tel_hdlr ( void ); -extern void init_mainw ( void ); -extern int init_audio ( char * ); -extern void do_menu ( void ); -extern int main ( int argc, char **argv ); -extern void do_quit ( int exitval ); -extern void fatal ( char *fmt, ... ); -extern void message ( char *fmt, ... ); -extern void do_dial ( char *number ); -extern void do_hangup ( void ); - -extern void audiowrite ( int, unsigned char * ); -extern void telwrite ( int, unsigned char * ); - -extern void newstate ( int newstate ); - -int init_dial(char *device); -void dial_hdlr(void); -int init_tel(char *device); - -extern void debug ( char *fmt, ... ); - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/display.c b/usr.sbin/i4b/isdnphone/display.c deleted file mode 100644 index 1dff9a16f3f98..0000000000000 --- a/usr.sbin/i4b/isdnphone/display.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - some display operations - * =================================== - * - * $Id: display.c,v 1.4 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:52:55 1999] - * - *----------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * init curses fullscreen display - *---------------------------------------------------------------------------*/ -void -init_mainw(void) -{ - char buffer[512]; - - initscr(); /* curses init */ - - if((COLS < 80) || (LINES < 24)) - fatal(0, "ERROR, minimal screensize must be 80x24, is %dx%d, terminating!", COLS, LINES); - - - if((main_w = newwin(MW_HEIGHT, MW_WIDTH, MW_ROW, MW_COL)) == NULL) - fatal("ERROR, curses init main window, terminating!"); - - if(opt_d) - { - if((dbg_w = newwin(DB_HGT, DB_WID, DB_ROW, DB_COL)) == NULL) - fatal("ERROR, curses init debug window, terminating!"); - scrollok(dbg_w, TRUE); - } - - raw(); /* raw input */ - noecho(); /* do not echo input */ - keypad(stdscr, TRUE); /* use special keys */ - keypad(main_w, TRUE); /* use special keys */ - - box(main_w, 0, 0); - - sprintf(buffer, "isdnphone %d.%d ", VERSION, REL); - - wstandout(main_w); - mvwaddstr(main_w, 0, (MW_WIDTH / 2) - (strlen(buffer) / 2), buffer); - wstandend(main_w); - - mvwaddstr(main_w, MW_STATEY, MW_STATEX, " state: "); - mvwprintw(main_w, MW_STATEY, MW_STX, "%s", states[state]); - wmove(main_w, MW_STATEY+1, 1); - whline(main_w, 0, MW_WIDTH-2); - - mvwaddstr(main_w, MW_NUMY, MW_NUMX, " number: "); - wmove(main_w, MW_NUMY+1, 1); - whline(main_w, 0, MW_WIDTH-2); - - mvwaddstr(main_w, MW_MSGY, MW_MSGX, "message: "); - - wrefresh(main_w); - - curses_ready = 1; -} - -/*---------------------------------------------------------------------------* - * curses menu for fullscreen command mode - *---------------------------------------------------------------------------*/ -void -do_menu(void) -{ - static char *menu[WMITEMS] = - { - "Hangup", -#define HANGUP 0 - "Dial", -#define DIAL 1 - "Refresh", -#define REFRESH 2 - "Exit", -#define EXIT 3 - }; - - WINDOW *menu_w; - int c; - int mpos; - - /* create a new window in the lower screen area */ - - if((menu_w = newwin(WMENU_HGT, WMENU_LEN, WMENU_POSLN, WMENU_POSCO )) == NULL) - return; - - keypad(menu_w, TRUE); /* use special keys */ - - /* draw border around the window */ - - box(menu_w, 0, 0); - - /* add a title */ - - wstandout(menu_w); - mvwaddstr(menu_w, 0, (WMENU_LEN / 2) - (strlen(WMENU_TITLE) / 2), WMENU_TITLE); - wstandend(menu_w); - - /* fill the window with the menu options */ - - for(mpos=0; mpos <= (WMITEMS-1); mpos++) - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - - /* highlight the first menu option */ - - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - - /* input loop */ - - for(;;) - { - wrefresh(menu_w); - - c = wgetch(menu_w); - - switch(c) - { - case TAB: - case KEY_DOWN: /* down-move cursor */ - case ' ': - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - mpos++; - if(mpos >= WMITEMS) - mpos = 0; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case KEY_UP: /* up-move cursor */ - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - if(mpos) - mpos--; - else - mpos = WMITEMS-1; - wstandout(menu_w); - mvwaddstr(menu_w, mpos + 2, 2, menu[mpos]); - wstandend(menu_w); - break; - - case 'R': - case 'r': - wrefresh(curscr); - goto mexit; - - case 'E': - case 'e': - case 'Q': - case 'q': - case 'X': - case 'x': - do_quit(0); - goto mexit; - break; - - case 'H': - case 'h': - do_hangup(); - goto mexit; - break; - - case 'D': - case 'd': - goto mexit; - break; - - case CR: - case LF: /* exec highlighted option */ -#ifdef KEY_ENTER - case KEY_ENTER: -#endif - switch(mpos) - { - case DIAL: - goto mexit; - break; - case HANGUP: - do_hangup(); - goto mexit; - break; - case REFRESH: - wrefresh(curscr); - break; - case EXIT: - do_quit(0); - break; - } - goto mexit; - break; - - default: - goto mexit; - break; - } - } - -mexit: - /* delete the menu window */ - - wclear(menu_w); - wrefresh(menu_w); - delwin(menu_w); - - /* re-display the original lower window contents */ - - touchwin(main_w); - wrefresh(main_w); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/isdn.c b/usr.sbin/i4b/isdnphone/isdn.c deleted file mode 100644 index 34719c7272699..0000000000000 --- a/usr.sbin/i4b/isdnphone/isdn.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - isdn (i4b) handling - * =============================== - * - * $Id: isdn.c,v 1.4 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:53:05 1999] - * - *---------------------------------------------------------------------------*/ - -#include "defs.h" - -/*---------------------------------------------------------------------------* - * dialer init - *---------------------------------------------------------------------------*/ -int -init_dial(char *device) -{ - int ret; - - if((ret = open(device, O_RDWR)) < 0) - { - fprintf(stderr, "unable to open %s: %s\n", device, strerror(errno)); - return(-1); - } - return(ret); -} - -/*---------------------------------------------------------------------------* - * i4bteld data available handler - *---------------------------------------------------------------------------*/ -void -dial_hdlr(void) -{ - char result; - - if((read (dialerfd, &result, 1) < 0)) - { - fatal("read failed: %s", strerror(errno)); - } - - switch(result) - { - case RSP_CONN: - newstate(ST_ACTIVE); - message("connected to remote!"); - break; - - case RSP_BUSY: - message("remote is busy!"); - break; - - case RSP_HUP: - newstate(ST_IDLE); - message("disconnected from remote!"); - break; - - case RSP_NOA: - message("no answer from remote!"); - break; - - default: - message("unknown response = 0x%2x!", result); - break; - } -} - -/*---------------------------------------------------------------------------* - * telephone init - *---------------------------------------------------------------------------*/ -int -init_tel(char *device) -{ - int ret; - int format; - - if(play_fmt == AFMT_MU_LAW) - format = CVT_ALAW2ULAW; - else - format = CVT_NONE; - - if((ret = open(device, O_RDWR)) < 0) - fatal("unable to open %s: %s\n", device, strerror(errno)); - - if((ioctl(ret, I4B_TEL_SETAUDIOFMT, &format)) < 0) - fatal("ioctl I4B_TEL_SETAUDIOFMT failed: %s", strerror(errno)); - - return(ret); -} - -/*---------------------------------------------------------------------------* - * dial number - *---------------------------------------------------------------------------*/ -void -do_dial(char *number) -{ - char commandbuffer[80]; - sprintf(commandbuffer, "D%s", number); - - if((write(dialerfd, commandbuffer, strlen(commandbuffer))) < 0) - { - fatal("write commandbuffer failed: %s", strerror(errno)); - } -} - -/*---------------------------------------------------------------------------* - * hangup - *---------------------------------------------------------------------------*/ -void -do_hangup(void) -{ - char commandbuffer[80]; - - if(state == ST_IDLE) - { - message("tried hangup while ST_IDLE"); - return; - } - - sprintf(commandbuffer, "H"); - - if((write(dialerfd, commandbuffer, strlen(commandbuffer))) < 0) - { - fatal("write commandbuffer failed: %s", strerror(errno)); - } -} - -/*---------------------------------------------------------------------------* - * i4btel speech data available handler - *---------------------------------------------------------------------------*/ -void -tel_hdlr(void) -{ - unsigned char buffer[BCH_MAX_DATALEN]; - int ret; - - ret = read(telfd, buffer, BCH_MAX_DATALEN); - - if(ret < 0) - { - fatal("read telfd failed: %s", strerror(errno)); - } - - debug("tel_hdlr: read %d bytes\n", ret); - - if(ret > 0) - { - audiowrite(ret, buffer); - } -} - -/*---------------------------------------------------------------------------* - * write audio data to ISDN - *---------------------------------------------------------------------------*/ -void -telwrite(int len, unsigned char *buf) -{ - if((write(telfd, buf, len)) < 0) - { - fatal("write tel failed: %s", strerror(errno)); - } -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdnphone/main.c b/usr.sbin/i4b/isdnphone/main.c deleted file mode 100644 index af463570c9099..0000000000000 --- a/usr.sbin/i4b/isdnphone/main.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * isdnphone - main module - * ======================= - * - * $Id: main.c,v 1.12 1999/12/13 21:25:26 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Mon Dec 13 21:53:25 1999] - * - *---------------------------------------------------------------------------*/ - -#define MAIN -#include "defs.h" - -static void kbd_hdlr(void); - -/*---------------------------------------------------------------------------* - * usage display and exit - *---------------------------------------------------------------------------*/ -static void -usage(void) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "isdnphone - i4b phone program, version %d.%d.%d, compiled %s %s\n",VERSION, REL, STEP, __DATE__, __TIME__); - fprintf(stderr, "usage: isdnphone -d -h -n <number> -u <unit>\n"); - fprintf(stderr, " -d debug\n"); - fprintf(stderr, " -h hangup\n"); - fprintf(stderr, " -n number dial number\n"); - fprintf(stderr, " -u unit set unit number\n"); - fprintf(stderr, "\n"); - exit(1); -} - -/*---------------------------------------------------------------------------* - * program entry - *---------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - int c; - char namebuffer[128]; - int bschar; - int ret; - int opt_n = 0; - int opt_h = 0; - char *number = ""; - - numberbuffer[0] = '\0'; - - while ((c = getopt(argc, argv, "dhn:u:")) != -1) - { - switch(c) - { - case 'd': - opt_d = 1; - break; - - case 'h': - opt_h = 1; - break; - - case 'n': - number = optarg; - opt_n = 1; - break; - - case 'u': - opt_unit = atoi(optarg); - if(opt_unit < 0 || opt_unit > 9) - usage(); - break; - - case '?': - default: - usage(); - break; - } - } - - sprintf(namebuffer,"%s%d", I4BTELDDEVICE, opt_unit); - - if((dialerfd = init_dial(namebuffer)) == -1) - exit(1); - - if(opt_n || opt_h) - { - char commandbuffer[80]; - - /* commandline operation goes here */ - - if(opt_n) - { - sprintf(commandbuffer, "D%s", number); - - } - else if(opt_h) - { - sprintf(commandbuffer, "H"); - } - - if((ret = write(dialerfd, commandbuffer, strlen(commandbuffer))) < 0) - { - fprintf(stderr, "write commandbuffer failed: %s", strerror(errno)); - exit(1); - } - - close(dialerfd); - - exit(0); - } - - if((audiofd = init_audio(AUDIODEVICE)) == -1) - exit(1); - - /* fullscreen operation here */ - - init_mainw(); - - bschar = erasechar(); - curx = 0; - - wmove(main_w, MW_NUMY, MW_NUX + curx); - - /* go into loop */ - - for (;;) - { - int maxfd = 0; - fd_set set; - struct timeval timeout; - - FD_ZERO(&set); - - FD_SET(STDIN_FILENO, &set); - if(STDIN_FILENO > maxfd) - maxfd = STDIN_FILENO; - - FD_SET(dialerfd, &set); - if(dialerfd > maxfd) - maxfd = dialerfd; - - if(state == ST_ACTIVE) - { - if(audiofd != -1) - { - FD_SET(audiofd, &set); - if(audiofd > maxfd) - maxfd = audiofd; - } - - if(telfd != -1) - { - FD_SET(telfd, &set); - if(telfd > maxfd) - maxfd = telfd; - } - } - - timeout.tv_sec = 2; - timeout.tv_usec = 0; - - wrefresh(main_w); - - /* if no char is available within timeout, do something */ - -#ifdef NOTDEF - ret = select(maxfd+1, &set, NULL, NULL, &timeout); -#else - ret = select(maxfd+1, &set, NULL, NULL, NULL); -#endif - - if(ret > 0) - { - if((telfd != -1) && (FD_ISSET(telfd, &set))) - { - message("select from ISDN"); - tel_hdlr(); - } - if((audiofd != -1) && (FD_ISSET(audiofd, &set))) - { - message("select from audio"); - audio_hdlr(); - } - if(FD_ISSET(dialerfd, &set)) - { - message("select from tel"); - dial_hdlr(); - } - if(FD_ISSET(STDIN_FILENO, &set)) - { - message("select from kbd"); - kbd_hdlr(); - } - } - } - do_quit(0); - - return(0); -} - -/*---------------------------------------------------------------------------* - * keyboard character available handler - *---------------------------------------------------------------------------*/ -static void -kbd_hdlr(void) -{ - int kchar; - - kchar = wgetch(main_w); /* get char */ - - switch (kchar) - { - case CR: - case LF: -#ifdef KEY_ENTER - case KEY_ENTER: -#endif - if((state == ST_IDLE) && - (numberbuffer[0] != '\0')) - { - message("dialing ....."); - do_dial(&numberbuffer[0]); - } - else - { - do_menu(); - } - break; - - case CNTRL_D: - if(state == ST_IDLE) - { - do_quit(0); - } - else - { - message("cannot exit while not idle!"); - beep(); - } - - break; - - case CNTRL_L: /* refresh */ - touchwin(curscr); - wrefresh(curscr); - break; - - case KEY_BACKSPACE: - case KEY_DC: - if (curx == 0) - break; - - curx--; - mvwaddch(main_w, MW_NUMY, MW_NUX + curx, ' '); - numberbuffer[curx] = '\0'; - wmove(main_w, MW_NUMY, MW_NUX + curx); - - if(curx == 0) - message(" "); - - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if(curx > (TELNO_MAX-1)) - break; - - mvwaddch(main_w, MW_NUMY, MW_NUX + curx, kchar); - - numberbuffer[curx] = kchar; - - curx++; - - numberbuffer[curx] = '\0'; - - message("press ENTER to dial number ....."); - break; - } -} - -/*---------------------------------------------------------------------------* - * exit program - *---------------------------------------------------------------------------*/ -void -do_quit(int exitval) -{ - close(dialerfd); - move(LINES-1, 0); - clrtoeol(); - refresh(); - endwin(); - exit(exitval); -} - -/*---------------------------------------------------------------------------* - * fatal error exit - *---------------------------------------------------------------------------*/ -void -fatal(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - do_hangup(); /* failsafe */ - - if(curses_ready) - { - close(dialerfd); - move(LINES-1, 0); - clrtoeol(); - refresh(); - endwin(); - } - - fprintf(stderr, "\nFatal error: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n\n"); - - va_end(ap); - - exit(1); -} - -/*---------------------------------------------------------------------------* - * message printing - *---------------------------------------------------------------------------*/ -void -message(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - - if(curses_ready) - { - int i; - char sbuf[MW_WIDTH]; - - wmove(main_w, MW_MSGY, MW_MSX); - vsnprintf(sbuf, MW_WIDTH-MW_MSX-1, fmt, ap); - waddstr(main_w, sbuf); - for(i=strlen(sbuf);i < MW_WIDTH-MW_MSX-2; i++) - waddch(main_w, ' '); - wmove(main_w, MW_NUMY, MW_NUX + curx); - wrefresh(main_w); - } - else - { - fprintf(stderr, "ERROR: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - } - - va_end(ap); -} - -/*---------------------------------------------------------------------------* - * message printing - *---------------------------------------------------------------------------*/ -void -debug(char *fmt, ...) -{ - va_list ap; - - if(opt_d == 0) - return; - - va_start(ap, fmt); - - vwprintw(dbg_w, fmt, ap); - wrefresh(dbg_w); - - va_end(ap); -} - -/*---------------------------------------------------------------------------* - * go to new state - *---------------------------------------------------------------------------*/ -void -newstate(int newstate) -{ - int i; - - if(newstate < 0 || newstate > ST_MAX) - { - message("newstate %d undefined!", newstate); - return; - } - - state = newstate; - - if(newstate == ST_ACTIVE) - { - char namebuffer[128]; - - sprintf(namebuffer,"%s%d", I4BTELDEVICE, opt_unit); - telfd = init_tel(namebuffer); - } - - if(newstate == ST_IDLE) - { - close(telfd); - telfd = -1; - } - - wmove(main_w, MW_STATEY, MW_STX); - waddstr(main_w, states[newstate]); - - for(i=strlen(states[newstate]);i < MW_WIDTH-MW_STX-2; i++) - waddch(main_w, ' '); - - wmove(main_w, MW_NUMY, MW_NUX + curx); - wrefresh(main_w); -} - -/* EOF */ diff --git a/usr.sbin/i4b/isdntrace/unknownl3.c b/usr.sbin/i4b/isdntrace/unknownl3.c deleted file mode 100644 index 8967a6a9b037c..0000000000000 --- a/usr.sbin/i4b/isdntrace/unknownl3.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2000 Hellmuth Michaelis. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - *--------------------------------------------------------------------------- - * - * unknownl3.c - print L3 packets with unknown PD - * ---------------------------------------------- - * - * $Id: unknownl3.c,v 1.2 2000/02/13 15:26:52 hm Exp $ - * - * $FreeBSD$ - * - * last edit-date: [Sun Feb 13 14:16:44 2000] - * - *---------------------------------------------------------------------------*/ - -#include "trace.h" - -/*---------------------------------------------------------------------------* - * decode unknown protocol - *---------------------------------------------------------------------------*/ -void -decode_unknownl3(char *pbuf, int n, int off, unsigned char *buf, int raw) -{ - int pd; - int j; - int i; - - if(n <= 0) - return; - - *pbuf = '\0'; - - if(raw) - { - for (i = 0; i < n; i += 16) - { - sprintf((pbuf+strlen(pbuf)),"Dump:%.3d ", i+off); - for (j = 0; j < 16; j++) - if (i + j < n) - sprintf((pbuf+strlen(pbuf)),"%02x ", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf))," "); - sprintf((pbuf+strlen(pbuf))," "); - for (j = 0; j < 16 && i + j < n; j++) - if (isprint(buf[i + j])) - sprintf((pbuf+strlen(pbuf)),"%c", buf[i + j]); - else - sprintf((pbuf+strlen(pbuf)),"."); - sprintf((pbuf+strlen(pbuf)),"\n"); - } - } - - i = 0; - - /* protocol discriminator */ - - pd = buf[i]; - - sprintf((pbuf+strlen(pbuf)), "PD%02X: ", pd); - - if(pd >= 0x00 && pd <= 0x07) - sprintf((pbuf+strlen(pbuf)), "pd=User-User (0x%02x)",pd); - else if(pd == 0x08) - sprintf((pbuf+strlen(pbuf)), "pd=Q.931/I.451"); - else if(pd >= 0x10 && pd <= 0x3f) - sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)",pd); - else if(pd >= 0x40 && pd <= 0x4f) - sprintf((pbuf+strlen(pbuf)), "pd=National Use (0x%02x)",pd); - else if(pd >= 0x50 && pd <= 0xfe) - sprintf((pbuf+strlen(pbuf)), "pd=Other Layer 3 or X.25 (0x%02x)",pd); - else - sprintf((pbuf+strlen(pbuf)), "pd=Reserved (0x%02x)",pd); - - sprintf((pbuf+strlen(pbuf)), "\n ["); - for(j = 0; j < (n-i); j++) - { - sprintf((pbuf+strlen(pbuf)),"0x%02x ", buf[j+i]); - } - - sprintf((pbuf+strlen(pbuf)),"]\n"); -} - -/* EOF */ - diff --git a/usr.sbin/i4b/ispppcontrol/ispppcontrol.c b/usr.sbin/i4b/ispppcontrol/ispppcontrol.c deleted file mode 100644 index ef4dc64cb48d6..0000000000000 --- a/usr.sbin/i4b/ispppcontrol/ispppcontrol.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 1997 Joerg Wunsch - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * From: spppcontrol.c,v 1.3 1998/01/07 07:55:26 charnier Exp - * - *--------------------------------------------------------------------------- - * - * last edit-date: [Mon Oct 9 16:21:15 2000] - * - *--------------------------------------------------------------------------- - * - * $FreeBSD$ - */ - -#ifndef lint -static const char rcsid[] = - "$Id: ispppcontrol.c,v 1.4 2000/08/24 11:48:57 hm Exp $"; -#endif /* not lint */ - -#include <sys/param.h> -#include <sys/callout.h> -#include <sys/ioctl.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/time.h> -#include <sys/sysctl.h> - -#include <net/if.h> - -#if (defined (__FreeBSD__) && __FreeBSD__ >= 3) -#include <net/if_var.h> -#endif - -#if defined (__FreeBSD__) || defined (__OpenBSD__) -#include <netinet/in.h> -#include <netinet/in_systm.h> -#include <netinet/ip.h> -#include <net/slcompress.h> -#endif - -#ifdef __NetBSD__ -#include <net/if_sppp.h> -#else -#include <machine/i4b_isppp.h> -#endif - -#include <err.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sysexits.h> -#include <unistd.h> - -static void usage(void); -void print_vals(const char *ifname, struct spppreq *sp); -const char *phase_name(enum ppp_phase phase); -const char *proto_name(u_short proto); -const char *authflags(u_short flags); - -#define PPP_PAP 0xc023 -#define PPP_CHAP 0xc223 - -int hz = 0; - -int -main(int argc, char **argv) -{ - int s, c; - int errs = 0, verbose = 0; - size_t off; - const char *ifname, *cp; - struct ifreq ifr; - struct spppreq spr; - int len; - int mib[2]; - struct clockinfo clockinfo; - - while ((c = getopt(argc, argv, "v")) != -1) - switch (c) { - case 'v': - verbose++; - break; - - default: - errs++; - break; - } - argv += optind; - argc -= optind; - - if (errs || argc < 1) - usage(); - - ifname = argv[0]; - strncpy(ifr.ifr_name, ifname, sizeof ifr.ifr_name); - - /* use a random AF to create the socket */ - if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - err(EX_UNAVAILABLE, "ifconfig: socket"); - - argc--; - argv++; - - spr.cmd = (int)SPPPIOGDEFS; - ifr.ifr_data = (caddr_t)&spr; - - if (ioctl(s, SIOCGIFGENERIC, &ifr) == -1) - err(EX_OSERR, "SIOCGIFGENERIC(SPPPIOGDEFS)"); - - mib[0] = CTL_KERN; - mib[1] = KERN_CLOCKRATE; - len = sizeof(clockinfo); - if(sysctl(mib, 2, &clockinfo, &len, NULL, 0) == -1) - { - fprintf(stderr, "error, cannot sysctl kern.clockrate!\n"); - exit(1); - } - - hz = clockinfo.hz; - - if (argc == 0) { - /* list only mode */ - print_vals(ifname, &spr); - return 0; - } - -#define startswith(s) strncmp(argv[0], s, (off = strlen(s))) == 0 - - while (argc > 0) { - if (startswith("authproto=")) { - cp = argv[0] + off; - if (strcmp(cp, "pap") == 0) - spr.defs.myauth.proto = - spr.defs.hisauth.proto = PPP_PAP; - else if (strcmp(cp, "chap") == 0) - spr.defs.myauth.proto = - spr.defs.hisauth.proto = PPP_CHAP; - else if (strcmp(cp, "none") == 0) - spr.defs.myauth.proto = - spr.defs.hisauth.proto = 0; - else - errx(EX_DATAERR, "bad auth proto: %s", cp); - } else if (startswith("myauthproto=")) { - cp = argv[0] + off; - if (strcmp(cp, "pap") == 0) - spr.defs.myauth.proto = PPP_PAP; - else if (strcmp(cp, "chap") == 0) - spr.defs.myauth.proto = PPP_CHAP; - else if (strcmp(cp, "none") == 0) - spr.defs.myauth.proto = 0; - else - errx(EX_DATAERR, "bad auth proto: %s", cp); - } else if (startswith("myauthname=")) - strncpy(spr.defs.myauth.name, argv[0] + off, - AUTHNAMELEN); - else if (startswith("myauthsecret=") || - startswith("myauthkey=")) - strncpy(spr.defs.myauth.secret, argv[0] + off, - AUTHKEYLEN); - else if (startswith("hisauthproto=")) { - cp = argv[0] + off; - if (strcmp(cp, "pap") == 0) - spr.defs.hisauth.proto = PPP_PAP; - else if (strcmp(cp, "chap") == 0) - spr.defs.hisauth.proto = PPP_CHAP; - else if (strcmp(cp, "none") == 0) - spr.defs.hisauth.proto = 0; - else - errx(EX_DATAERR, "bad auth proto: %s", cp); - } else if (startswith("hisauthname=")) - strncpy(spr.defs.hisauth.name, argv[0] + off, - AUTHNAMELEN); - else if (startswith("hisauthsecret=") || - startswith("hisauthkey=")) - strncpy(spr.defs.hisauth.secret, argv[0] + off, - AUTHKEYLEN); - else if (strcmp(argv[0], "callin") == 0) - spr.defs.hisauth.flags |= AUTHFLAG_NOCALLOUT; - else if (strcmp(argv[0], "always") == 0) - spr.defs.hisauth.flags &= ~AUTHFLAG_NOCALLOUT; - else if (strcmp(argv[0], "norechallenge") == 0) - spr.defs.hisauth.flags |= AUTHFLAG_NORECHALLENGE; - else if (strcmp(argv[0], "rechallenge") == 0) - spr.defs.hisauth.flags &= ~AUTHFLAG_NORECHALLENGE; -#ifndef __NetBSD__ - else if (strcmp(argv[0], "enable-vj") == 0) - spr.defs.enable_vj = 1; - else if (strcmp(argv[0], "disable-vj") == 0) - spr.defs.enable_vj = 0; -#endif - else if (startswith("lcp-timeout=")) { - int timeout_arg = atoi(argv[0]+off); - if ((timeout_arg > 20000) || (timeout_arg <= 0)) - errx(EX_DATAERR, "bad lcp timeout value: %s", - argv[0]+off); - spr.defs.lcp.timeout = timeout_arg * hz / 1000; - } else - errx(EX_DATAERR, "bad parameter: \"%s\"", argv[0]); - - argv++; - argc--; - } - - spr.cmd = (int)SPPPIOSDEFS; - - if (ioctl(s, SIOCSIFGENERIC, &ifr) == -1) - err(EX_OSERR, "SIOCSIFGENERIC(SPPPIOSDEFS)"); - - if (verbose) - print_vals(ifname, &spr); - - return 0; -} - -static void -usage(void) -{ - fprintf(stderr, "%s\n%s\n", - "usage: ispppcontrol [-v] ifname [{my|his}auth{proto|name|secret}=...]", - " ispppcontrol [-v] ifname callin|always"); - exit(EX_USAGE); -} - -void -print_vals(const char *ifname, struct spppreq *sp) -{ -#ifndef __NetBSD__ - time_t send, recv; -#endif - - printf("%s:\tphase=%s\n", ifname, phase_name(sp->defs.pp_phase)); - if (sp->defs.myauth.proto) { - printf("\tmyauthproto=%s myauthname=\"%.*s\"\n", - proto_name(sp->defs.myauth.proto), - AUTHNAMELEN, sp->defs.myauth.name); - } - if (sp->defs.hisauth.proto) { - printf("\thisauthproto=%s hisauthname=\"%.*s\"%s\n", - proto_name(sp->defs.hisauth.proto), - AUTHNAMELEN, sp->defs.hisauth.name, - authflags(sp->defs.hisauth.flags)); - } -#ifndef __NetBSD__ - if (sp->defs.pp_phase > PHASE_DEAD) { - send = time(NULL) - sp->defs.pp_last_sent; - recv = time(NULL) - sp->defs.pp_last_recv; - printf("\tidle_time=%ld\n", (send<recv)? send : recv); - } -#endif - printf("\tlcp timeout: %.3f s\n", - (double)sp->defs.lcp.timeout / hz); -#ifndef __NetBSD__ - printf("\tenable_vj: %s\n", - sp->defs.enable_vj ? "on" : "off"); -#endif -} - -const char * -phase_name(enum ppp_phase phase) -{ - switch (phase) { - case PHASE_DEAD: return "dead"; - case PHASE_ESTABLISH: return "establish"; - case PHASE_TERMINATE: return "terminate"; - case PHASE_AUTHENTICATE: return "authenticate"; - case PHASE_NETWORK: return "network"; - } - return "illegal"; -} - -const char * -proto_name(u_short proto) -{ - static char buf[12]; - switch (proto) { - case PPP_PAP: return "pap"; - case PPP_CHAP: return "chap"; - } - sprintf(buf, "0x%x", (unsigned)proto); - return buf; -} - -const char * -authflags(u_short flags) -{ - static char buf[32]; - buf[0] = '\0'; - if (flags & AUTHFLAG_NOCALLOUT) - strcat(buf, " callin"); - if (flags & AUTHFLAG_NORECHALLENGE) - strcat(buf, " norechallenge"); - return buf; -} diff --git a/usr.sbin/kgzip/aouthdr.c b/usr.sbin/kgzip/aouthdr.c deleted file mode 100644 index 27541e6cae11b..0000000000000 --- a/usr.sbin/kgzip/aouthdr.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2000 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <stddef.h> -#include "aouthdr.h" - -#define KGZ_FIX_NSIZE 0 /* Run-time fixup */ - -const struct kgz_aouthdr0 aouthdr0 = { - /* a.out header */ - { - MID_I386 << 020 | OMAGIC, /* a_midmag */ - 0, /* a_text */ - sizeof(struct kgz_hdr) + KGZ_FIX_NSIZE, /* a_data */ - 0, /* a_bss */ - sizeof(struct nlist) * KGZ__STNUM, /* a_syms */ - 0, /* a_entry */ - 0, /* a_trsize */ - 0 /* a_drsize */ - } -}; - -const struct kgz_aouthdr1 aouthdr1 = { - /* Symbol table */ - { - { - { - (char *)offsetof(struct kgz__strtab, - kgz) /* n_un */ - }, - N_DATA | N_EXT, /* n_type */ - AUX_OBJECT, /* n_other */ - 0, /* n_desc */ - 0 /* n_value */ - }, - { - { - (char *)offsetof(struct kgz__strtab, - kgz_ndata) /* n_un */ - }, - N_DATA | N_EXT, /* n_type */ - AUX_OBJECT, /* n_other */ - 0, /* n_desc */ - sizeof(struct kgz_hdr) /* n_value */ - } - }, - /* String table */ - { - sizeof(struct kgz__strtab), /* length */ - KGZ__STR_KGZ, /* kgz */ - KGZ__STR_KGZ_NDATA /* kgz_ndata */ - } -}; diff --git a/usr.sbin/kgzip/aouthdr.h b/usr.sbin/kgzip/aouthdr.h deleted file mode 100644 index 63c2dff669047..0000000000000 --- a/usr.sbin/kgzip/aouthdr.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <a.out.h> -#include "kgz.h" - -/* Relocatable header: part 0 */ -struct kgz_aouthdr0 { - struct exec a; -}; - -/* Symbol table entries */ -#define KGZ__STNUM 2 - -/* Symbol table strings */ -#define KGZ__STR_KGZ "_kgz" -#define KGZ__STR_KGZ_NDATA "_kgz_ndata" - -/* String table */ -struct kgz__strtab { - unsigned long length; - char kgz[sizeof(KGZ__STR_KGZ)]; - char kgz_ndata[sizeof(KGZ__STR_KGZ_NDATA)]; -}; - -/* Relocatable header: part 1 */ -struct kgz_aouthdr1 { - struct nlist st[KGZ__STNUM]; - struct kgz__strtab strtab; -}; - -extern const struct kgz_aouthdr0 aouthdr0; -extern const struct kgz_aouthdr1 aouthdr1; diff --git a/usr.sbin/lastlogin/Makefile b/usr.sbin/lastlogin/Makefile deleted file mode 100644 index 289e46e46390c..0000000000000 --- a/usr.sbin/lastlogin/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $FreeBSD$ - -PROG= lastlogin -MAN8= lastlogin.8 -CFLAGS+=-Wall - -.include <bsd.prog.mk> diff --git a/usr.sbin/ngctl/config.c b/usr.sbin/ngctl/config.c deleted file mode 100644 index 144293abd5604..0000000000000 --- a/usr.sbin/ngctl/config.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * config.c - * - * Copyright (c) 1996-1999 Whistle Communications, Inc. - * All rights reserved. - * - * Subject to the following obligations and disclaimer of warranty, use and - * redistribution of this software, in source or object code forms, with or - * without modifications are expressly permitted by Whistle Communications; - * provided, however, that: - * 1. Any and all reproductions of the source or object code must include the - * copyright notice above and the following disclaimer of warranties; and - * 2. No rights are granted, in any manner or form, to use Whistle - * Communications, Inc. trademarks, including the mark "WHISTLE - * COMMUNICATIONS" on advertising, endorsements, or otherwise except as - * such appears in the above copyright notice or in the software. - * - * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND - * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO - * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE, - * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. - * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY - * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS - * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE. - * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES - * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING - * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "ngctl.h" - -#define NOCONFIG "<no config>" - -static int ConfigCmd(int ac, char **av); - -const struct ngcmd config_cmd = { - ConfigCmd, - "config <path> [arguments]", - "get or set configuration of node at <path>", - NULL -}; - -static int -ConfigCmd(int ac, char **av) -{ - u_char sbuf[sizeof(struct ng_mesg) + NG_TEXTRESPONSE]; - struct ng_mesg *const resp = (struct ng_mesg *) sbuf; - char *const status = (char *) resp->data; - char *path; - char buf[NG_TEXTRESPONSE]; - int nostat = 0, i; - - /* Get arguments */ - if (ac < 2) - return(CMDRTN_USAGE); - path = av[1]; - - *buf = '\0'; - for (i = 2; i < ac; i++) { - if (i != 2) - strcat(buf, " "); - strcat(buf, av[i]); - } - - /* Get node config summary */ - if (*buf != '\0') - i = NgSendMsg(csock, path, NGM_GENERIC_COOKIE, - NGM_TEXT_CONFIG, buf, strlen(buf) + 1); - else - i = NgSendMsg(csock, path, NGM_GENERIC_COOKIE, - NGM_TEXT_CONFIG, NULL, 0); - if (i < 0) { - switch (errno) { - case EINVAL: - nostat = 1; - break; - default: - warn("send msg"); - return(CMDRTN_ERROR); - } - } else { - if (NgRecvMsg(csock, resp, sizeof(sbuf), NULL) < 0 - || (resp->header.flags & NGF_RESP) == 0) - nostat = 1; - } - - /* Show it */ - if (nostat) - printf("No config available for \"%s\"\n", path); - else - printf("Config for \"%s\":\n%s\n", path, status); - return(CMDRTN_OK); -} - diff --git a/usr.sbin/ppp/atm.h b/usr.sbin/ppp/atm.h deleted file mode 100644 index 3fbc0c5c98e82..0000000000000 --- a/usr.sbin/ppp/atm.h +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 2000 Jakob Stoklund Olesen <stoklund@taxidriver.dk> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -struct physical; -struct device; - -extern struct device *atm_Create(struct physical *); -extern struct device *atm_iov2device(int, struct physical *, - struct iovec *, int *, int, int *, int *); -extern int atm_DeviceSize(void); diff --git a/usr.sbin/ppp/mppe.c b/usr.sbin/ppp/mppe.c deleted file mode 100644 index d843ecbfd114d..0000000000000 --- a/usr.sbin/ppp/mppe.c +++ /dev/null @@ -1,433 +0,0 @@ -/*- - * Copyright (c) 2000 Semen Ustimenko <semenu@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> - -#include <stdio.h> -#include <stdlib.h> -#include <termios.h> -#ifdef __FreeBSD__ -#include <sha.h> -#else -#include <openssl/sha.h> -#endif -#include <openssl/rc4.h> - -#include "defs.h" -#include "mbuf.h" -#include "log.h" -#include "timer.h" -#include "fsm.h" -#include "lqr.h" -#include "hdlc.h" -#include "lcp.h" -#include "ccp.h" -#include "chap_ms.h" -#include "mppe.h" - -/* - * Documentation: - * - * draft-ietf-pppext-mppe-04.txt - * draft-ietf-pppext-mppe-keys-02.txt - */ - -struct mppe_state { - int cohnum; - int keylen; /* 8 or 16 bytes */ - int keybits; /* 40, 56 or 128 bits */ - char sesskey[MPPE_KEY_LEN]; - char mastkey[MPPE_KEY_LEN]; - RC4_KEY rc4key; -}; - -int MPPE_MasterKeyValid = 0; -int MPPE_IsServer = 0; -char MPPE_MasterKey[MPPE_KEY_LEN]; - -static void -MPPEResetOutput(void *v) -{ - log_Printf(LogCCP, "MPPE: Output channel reset\n"); -} - -static void -MPPEReduceSessionKey(struct mppe_state *mp) -{ - switch(mp->keybits) { - case 40: - mp->sesskey[2] = 0x9e; - mp->sesskey[1] = 0x26; - case 56: - mp->sesskey[0] = 0xd1; - case 128: - } -} - -static void -MPPEKeyChange(struct mppe_state *mp) -{ - char InterimKey[MPPE_KEY_LEN]; - RC4_KEY RC4Key; - - GetNewKeyFromSHA(mp->mastkey, mp->sesskey, mp->keylen, InterimKey); - RC4_set_key(&RC4Key, mp->keylen, InterimKey); - RC4(&RC4Key, mp->keylen, InterimKey, mp->sesskey); - - MPPEReduceSessionKey(mp); -} - -static struct mbuf * -MPPEOutput(void *v, struct ccp *ccp, struct link *l, int pri, u_short *proto, - struct mbuf *mp) -{ - struct mppe_state *mop = (struct mppe_state *)v; - struct mbuf *mo; - u_short nproto; - int ilen; - char *rp; - - log_Printf(LogCCP, "MPPE: Output\n"); - - ilen = m_length(mp); - - log_Printf(LogDEBUG, "MPPE: Output: Proto %02x (%d bytes)\n", *proto, ilen); - if (*proto < 0x21 && *proto > 0xFA) { - log_Printf(LogDEBUG, "MPPE: Output: Not encrypting\n"); - return mp; - } - - log_DumpBp(LogDEBUG, "MPPE: Output: Encrypt packet:", mp); - - /* Get mbuf for prefixes */ - mo = m_get(4, MB_CCPOUT); - mo->m_next = mp; - - /* Init RC4 keys */ - RC4_set_key(&mop->rc4key, mop->keylen, mop->sesskey); - - /* Set MPPE packet prefix */ - rp = MBUF_CTOP(mo); - *(u_short *)rp = htons(0x9000 | mop->cohnum); - - /* Save encrypted protocol number */ - nproto = htons(*proto); - RC4(&mop->rc4key, 2, (char *)&nproto, rp + 2); - - /* Encrypt main packet */ - rp = MBUF_CTOP(mp); - RC4(&mop->rc4key, ilen, rp, rp); - - /* Rotate keys */ - MPPEKeyChange(mop); - mop->cohnum ++; mop->cohnum &= 0xFFF; - - /* Chage protocol number */ - *proto = ccp_Proto(ccp); - - log_Printf(LogDEBUG, "MPPE: Output: Encrypted: Proto %02x (%d bytes)\n", - *proto, m_length(mo)); - - return mo; -} - -static void -MPPEResetInput(void *v) -{ - log_Printf(LogCCP, "MPPE: Input channel reset\n"); -} - -static struct mbuf * -MPPEInput(void *v, struct ccp *ccp, u_short *proto, struct mbuf *mp) -{ - struct mppe_state *mip = (struct mppe_state *)v; - u_short prefix; - char *rp; - int ilen; - - log_Printf(LogCCP, "MPPE: Input\n"); - - ilen = m_length(mp); - - log_Printf(LogDEBUG, "MPPE: Input: Proto %02x (%d bytes)\n", *proto, ilen); - - log_DumpBp(LogDEBUG, "MPPE: Input: Packet:", mp); - - mp = mbuf_Read(mp, &prefix, 2); - prefix = ntohs(prefix); - if ((prefix & 0xF000) != 0x9000) { - log_Printf(LogERROR, "MPPE: Input: Invalid packet\n"); - m_freem(mp); - return NULL; - } - - prefix &= 0xFFF; - while (prefix != mip->cohnum) { - MPPEKeyChange(mip); - mip->cohnum ++; mip->cohnum &= 0xFFF; - } - - RC4_set_key(&mip->rc4key, mip->keylen, mip->sesskey); - - mp = mbuf_Read(mp, proto, 2); - RC4(&mip->rc4key, 2, (char *)proto, (char *)proto); - *proto = ntohs(*proto); - - rp = MBUF_CTOP(mp); - RC4(&mip->rc4key, m_length(mp), rp, rp); - - log_Printf(LogDEBUG, "MPPE: Input: Decrypted: Proto %02x (%d bytes)\n", - *proto, m_length(mp)); - - log_DumpBp(LogDEBUG, "MPPE: Input: Decrypted: Packet:", mp); - - return mp; -} - -static void -MPPEDictSetup(void *v, struct ccp *ccp, u_short proto, struct mbuf *mi) -{ - log_Printf(LogCCP, "MPPE: DictSetup\n"); -} - -static const char * -MPPEDispOpts(struct lcp_opt *o) -{ - static char buf[32]; - sprintf(buf, "value 0x%08x", (int)ntohl(*(u_int32_t *)(o->data))); - return buf; -} - -static void -MPPEInitOptsOutput(struct lcp_opt *o, const struct ccp_config *cfg) -{ - u_long val; - - o->len = 6; - - log_Printf(LogCCP, "MPPE: InitOptsOutput\n"); - - if (!MPPE_MasterKeyValid) { - log_Printf(LogWARN, "MPPE: MasterKey is invalid," - " MPPE is capable only with CHAP81 authentication\n"); - *(u_int32_t *)o->data = htonl(0x0); - return; - } - - val = 0x1000000; - switch(cfg->mppe.keybits) { - case 128: - val |= 0x40; break; - case 56: - val |= 0x80; break; - case 40: - val |= 0x20; break; - } - *(u_int32_t *)o->data = htonl(val); -} - -static int -MPPESetOptsOutput(struct lcp_opt *o) -{ - u_long *p = (u_long *)(o->data); - u_long val = ntohl(*p); - - log_Printf(LogCCP, "MPPE: SetOptsOutput\n"); - - if (!MPPE_MasterKeyValid) { - if (*p != 0x0) { - *p = 0x0; - return MODE_NAK; - } else { - return MODE_ACK; - } - } - - if (val == 0x01000020 || - val == 0x01000040 || - val == 0x01000080) - return MODE_ACK; - - return MODE_NAK; -} - -static int -MPPESetOptsInput(struct lcp_opt *o, const struct ccp_config *cfg) -{ - u_long *p = (u_long *)(o->data); - u_long val = ntohl(*p); - u_long mval; - - log_Printf(LogCCP, "MPPE: SetOptsInput\n"); - - if (!MPPE_MasterKeyValid) { - if (*p != 0x0) { - *p = 0x0; - return MODE_NAK; - } else { - return MODE_ACK; - } - } - - mval = 0x01000000; - switch(cfg->mppe.keybits) { - case 128: - mval |= 0x40; break; - case 56: - mval |= 0x80; break; - case 40: - mval |= 0x20; break; - } - - if (val == mval) - return MODE_ACK; - - *p = htonl(mval); - - return MODE_NAK; -} - -static void * -MPPEInitInput(struct lcp_opt *o) -{ - struct mppe_state *mip; - u_int32_t val = ntohl(*(unsigned long *)o->data); - - log_Printf(LogCCP, "MPPE: InitInput\n"); - - if (!MPPE_MasterKeyValid) { - log_Printf(LogERROR, "MPPE: InitInput: MasterKey is invalid!!!!\n"); - return NULL; - } - - mip = malloc(sizeof(*mip)); - memset(mip, 0, sizeof(*mip)); - - if (val & 0x20) { /* 40-bits */ - mip->keylen = 8; - mip->keybits = 40; - } else if (val & 0x80) { /* 56-bits */ - mip->keylen = 8; - mip->keybits = 56; - } else { /* 128-bits */ - mip->keylen = 16; - mip->keybits = 128; - } - - log_Printf(LogDEBUG, "MPPE: InitInput: %d-bits\n", mip->keybits); - - GetAsymetricStartKey(MPPE_MasterKey, mip->mastkey, mip->keylen, 0, - MPPE_IsServer); - GetNewKeyFromSHA(mip->mastkey, mip->mastkey, mip->keylen, mip->sesskey); - - MPPEReduceSessionKey(mip); - - MPPEKeyChange(mip); - - mip->cohnum = 0; - - return mip; -} - -static void * -MPPEInitOutput(struct lcp_opt *o) -{ - struct mppe_state *mop; - u_int32_t val = ntohl(*(unsigned long *)o->data); - - log_Printf(LogCCP, "MPPE: InitOutput\n"); - - if (!MPPE_MasterKeyValid) { - log_Printf(LogERROR, "MPPE: InitOutput: MasterKey is invalid!!!!\n"); - return NULL; - } - - mop = malloc(sizeof(*mop)); - memset(mop, 0, sizeof(*mop)); - - if (val & 0x20) { /* 40-bits */ - mop->keylen = 8; - mop->keybits = 40; - } else if (val & 0x80) { /* 56-bits */ - mop->keylen = 8; - mop->keybits = 56; - } else { /* 128-bits */ - mop->keylen = 16; - mop->keybits = 128; - } - - log_Printf(LogDEBUG, "MPPE: InitOutput: %d-bits\n", mop->keybits); - - GetAsymetricStartKey(MPPE_MasterKey, mop->mastkey, mop->keylen, 1, - MPPE_IsServer); - GetNewKeyFromSHA(mop->mastkey, mop->mastkey, mop->keylen, mop->sesskey); - - MPPEReduceSessionKey(mop); - - MPPEKeyChange(mop); - - mop->cohnum = 0; - - return mop; -} - -static void -MPPETermInput(void *v) -{ - log_Printf(LogCCP, "MPPE: TermInput\n"); - free(v); -} - -static void -MPPETermOutput(void *v) -{ - log_Printf(LogCCP, "MPPE: TermOutput\n"); - free(v); -} - -const struct ccp_algorithm MPPEAlgorithm = { - TY_MPPE, - CCP_NEG_MPPE, - MPPEDispOpts, - { - MPPESetOptsInput, - MPPEInitInput, - MPPETermInput, - MPPEResetInput, - MPPEInput, - MPPEDictSetup - }, - { - MPPEInitOptsOutput, - MPPESetOptsOutput, - MPPEInitOutput, - MPPETermOutput, - MPPEResetOutput, - MPPEOutput - }, -}; diff --git a/usr.sbin/ppp/mppe.h b/usr.sbin/ppp/mppe.h deleted file mode 100644 index c70a60906ba1d..0000000000000 --- a/usr.sbin/ppp/mppe.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 2000 Semen Ustimenko <semenu@FreeBSD.org> - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#define MPPE_KEY_LEN 16 -extern const struct ccp_algorithm MPPEAlgorithm; -extern int MPPE_MasterKeyValid; -extern int MPPE_IsServer; -extern char MPPE_MasterKey[]; diff --git a/usr.sbin/raycontrol/Makefile b/usr.sbin/raycontrol/Makefile deleted file mode 100644 index 8fd1eef798ca4..0000000000000 --- a/usr.sbin/raycontrol/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ -PROG= raycontrol -SRCS= raycontrol.c - -MAN8= raycontrol.8 - -CFLAGS+=-I${.CURDIR}/../../sys - -.include <bsd.prog.mk> diff --git a/usr.sbin/raycontrol/raycontrol.c b/usr.sbin/raycontrol/raycontrol.c deleted file mode 100644 index 604960f16b090..0000000000000 --- a/usr.sbin/raycontrol/raycontrol.c +++ /dev/null @@ -1,488 +0,0 @@ -/* - * Copyright (c) 1999, 2000 - * Dr. Duncan McLennan Barclay, dmlb@ragnet.demon.co.uk. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Bill Paul. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY DUNCAN BARCLAY AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL DUNCAN BARCLAY OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include <sys/types.h> -#include <sys/cdefs.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <sys/ioctl.h> -#include <sys/socket.h> - -#include <net/if.h> -#include <net/ethernet.h> -#include <net/if_ieee80211.h> - -#include <dev/ray/if_rayreg.h> -#include <dev/ray/if_raymib.h> - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> -#include <err.h> - -static char * ray_printhex (u_int8_t *d, char *s, int len); -static void ray_getval (char *iface, struct ray_param_req *rreq); -static void ray_getstats (char *iface, struct ray_stats_req *sreq); -static int ray_version (char *iface); -static void ray_dumpstats (char *iface); -static void ray_dumpinfo (char *iface); -static void ray_setstr (char *iface, u_int8_t mib, char *s); -static void ray_setword (char *iface, u_int8_t mib, u_int16_t v); -static void ray_setval (char *iface, struct ray_param_req *rreq); -static void usage (char *p); - -static char *mib_strings[] = RAY_MIB_STRINGS; -static char *mib_help_strings[] = RAY_MIB_HELP_STRINGS; -static int mib_info[RAY_MIB_MAX+1][3] = RAY_MIB_INFO; - -static char * -ray_printhex(u_int8_t *d, char *s, int len) -{ - static char buf[3*256]; - char *p; - int i; - - if (len > 256) - err(1, "Byte string too long"); - - sprintf(buf, "%02x", *d); - for (p = buf + 2, i = 1; i < len; i++) { - sprintf(p, "%s%02x", s, *(d+i)); - p = p + 2 + strlen(s); - } - - return(buf); -} - -static void -ray_getval(char *iface, struct ray_param_req *rreq) -{ - struct ifreq ifr; - int s; - - bzero((char *)&ifr, sizeof(ifr)); - - strcpy(ifr.ifr_name, iface); - ifr.ifr_data = (caddr_t)rreq; - - s = socket(AF_INET, SOCK_DGRAM, 0); - - if (s == -1) - err(1, "socket"); - - if (ioctl(s, SIOCGRAYPARAM, &ifr) == -1) - warn("SIOCGRAYPARAM failed with failcode 0x%02x", - rreq->r_failcause); - - close(s); -} - -static void -ray_getsiglev(char *iface, struct ray_siglev *siglev) -{ - struct ifreq ifr; - int s; - - bzero((char *)&ifr, sizeof(ifr)); - - strcpy(ifr.ifr_name, iface); - ifr.ifr_data = (caddr_t)siglev; - - s = socket(AF_INET, SOCK_DGRAM, 0); - - if (s == -1) - err(1, "socket"); - - if (ioctl(s, SIOCGRAYSIGLEV, &ifr) == -1) - err(1, "SIOCGRAYSIGLEV failed"); - - close(s); -} - -static void -ray_getstats(char *iface, struct ray_stats_req *sreq) -{ - struct ifreq ifr; - int s; - - bzero((char *)&ifr, sizeof(ifr)); - - strcpy(ifr.ifr_name, iface); - ifr.ifr_data = (caddr_t)sreq; - - s = socket(AF_INET, SOCK_DGRAM, 0); - - if (s == -1) - err(1, "socket"); - - if (ioctl(s, SIOCGRAYSTATS, &ifr) == -1) - err(1, "SIOCGRAYSTATS failed"); - - close(s); -} - -static int -ray_version(char *iface) -{ - struct ray_param_req rreq; - - if (iface == NULL) - errx(1, "must specify interface name"); - - bzero((char *)&rreq, sizeof(rreq)); - rreq.r_paramid = RAY_MIB_VERSION; - ray_getval(iface, &rreq); - return(*rreq.r_data); -} - -static void -ray_dumpinfo(char *iface) -{ - struct ray_param_req rreq; - u_int8_t mib, version; - - if (iface == NULL) - errx(1, "must specify interface name"); - - bzero((char *)&rreq, sizeof(rreq)); - - version = ray_version(iface); - printf("%-26s\t", mib_strings[RAY_MIB_VERSION]); - printf("%d\n", 3+version); - - for (mib = RAY_MIB_NET_TYPE; mib < RAY_MIB_MAX; mib++) { - - if ((mib_info[mib][0] & version) == 0) - continue; - if (mib == RAY_MIB_VERSION) - continue; - - rreq.r_paramid = mib; - ray_getval(iface, &rreq); - printf("%-26s\t", mib_strings[mib]); - switch (rreq.r_len) { - - case 2: - printf("0x%02x%02x", *rreq.r_data, *(rreq.r_data+1)); - break; - - case ETHER_ADDR_LEN: - printf("%s", - ray_printhex(rreq.r_data, ":", rreq.r_len)); - break; - - case IEEE80211_NWID_LEN: - printf("%-32s", (char *)rreq.r_data); - break; - - - case 1: - default: - printf("0x%02x", *rreq.r_data); - break; - } - printf("\t%s\n", mib_help_strings[mib]); - } -} - -static void -ray_dumpsiglev(char *iface) -{ - struct ray_siglev siglevs[RAY_NSIGLEVRECS]; - int i; - - if (iface == NULL) - errx(1, "must specify interface name"); - - bzero((char *)siglevs, sizeof(siglevs)); - - ray_getsiglev(iface, siglevs); - - for (i = 0; i < RAY_NSIGLEVRECS; i++) { - printf("Slot %d: %s", i, - ray_printhex(siglevs[i].rsl_host, ":", ETHER_ADDR_LEN)); - printf(" %s", - ray_printhex(siglevs[i].rsl_siglevs, ",", RAY_NSIGLEV)); - printf(" %s\n", - ray_printhex(siglevs[i].rsl_antennas, "", RAY_NANTENNA)); - } - -} - -static void -ray_dumpstats(char *iface) -{ - struct ray_stats_req sreq; - - if (iface == NULL) - errx(1, "must specify interface name"); - - bzero((char *)&sreq, sizeof(sreq)); - - ray_getstats(iface, &sreq); - - printf("Receiver overflows %lu\n", - (unsigned long int)sreq.rxoverflow); - printf("Receiver checksum errors %lu\n", - (unsigned long int)sreq.rxcksum); - printf("Header checksum errors %lu\n", - (unsigned long int)sreq.rxhcksum); - printf("Clear channel noise level %u\n", sreq.rxnoise); -} - -static void -ray_setval(char *iface, struct ray_param_req *rreq) -{ - struct ifreq ifr; - int s; - - bzero((char *)&ifr, sizeof(ifr)); - - strcpy(ifr.ifr_name, iface); - ifr.ifr_data = (caddr_t)rreq; - - s = socket(AF_INET, SOCK_DGRAM, 0); - - if (s == -1) - err(1, "socket"); - - if (ioctl(s, SIOCSRAYPARAM, &ifr) == -1) { - err(1, "SIOCSRAYPARAM failed with failcode 0x%02x", - rreq->r_failcause); - } - - close(s); -} - -static void -ray_setword(char *iface, u_int8_t mib, u_int16_t v) -{ - struct ray_param_req rreq; - - if (iface == NULL) - errx(1, "must specify interface name"); - - bzero((char *)&rreq, sizeof(rreq)); - - rreq.r_paramid = mib; - rreq.r_len = RAY_MIB_SIZE(mib_info, mib, ray_version(iface)); - switch (rreq.r_len) { - - case 1: - *rreq.r_data = (u_int8_t)(v & 0xff); - break; - - case 2: - *rreq.r_data = (u_int8_t)((v & 0xff00) >> 8); - *(rreq.r_data+1) = (u_int8_t)(v & 0xff); - break; - - default: - break; - } - - ray_setval(iface, &rreq); -} - -static void -ray_setstr(char *iface, u_int8_t mib, char *s) -{ - struct ray_param_req rreq; - - if (iface == NULL) - errx(1, "must specify interface name"); - if (s == NULL) - errx(1, "must specify string"); - if (strlen(s) > RAY_MIB_SIZE(mib_info, mib, ray_version(iface))) - errx(1, "string too long"); - - bzero((char *)&rreq, sizeof(rreq)); - - rreq.r_paramid = mib; - rreq.r_len = RAY_MIB_SIZE(mib_info, mib, ray_version(iface)); - bcopy(s, (char *)rreq.r_data, strlen(s)); - - ray_setval(iface, &rreq); -} - -static void -usage(char *p) -{ - fprintf(stderr, "usage: %s -i iface\n", p); - fprintf(stderr, "\t%s -i iface -o\n", p); - fprintf(stderr, "\t%s -i iface -t tx rate\n", p); - fprintf(stderr, "\t%s -i iface -n network name\n", p); - fprintf(stderr, "\t%s -i iface -p port type\n", p); - fprintf(stderr, "\t%s -i iface -m mac address\n", p); - fprintf(stderr, "\t%s -i iface -d max data length\n", p); - fprintf(stderr, "\t%s -i iface -r RTS threshold\n", p); - fprintf(stderr, "\t%s -i iface -f hopset\n", p); - fprintf(stderr, "\t%s -i iface -P 0|1\n", p); - fprintf(stderr, "\t%s -i iface -S max sleep duration\n", p); - fprintf(stderr, "\t%s -i iface -C print signal cache\n", p); - - exit(1); -} - -int -main(int argc, char *argv[]) -{ - - char *iface, *p; - int ch, val; - - iface = NULL; - p = argv[0]; - - /* Get the interface name */ - opterr = 0; - ch = getopt(argc, argv, "i:"); - if (ch == 'i') { - iface = optarg; - } else { - if (argc > 1 && *argv[1] != '-') { - iface = argv[1]; - optind = 2; - } else { - iface = "ray0"; - optind = 1; - } - optreset = 1; - } - opterr = 1; - - while ((ch = getopt(argc, argv, "hoCi:d:f:n:p:r:t:W:")) != -1) { - switch (ch) { - - case 'i': - iface = optarg; - break; - - case 'd': - val = atoi(optarg); - if (((val < 350) && - (val != -1)) || (val > RAY_MIB_FRAG_THRESH_MAXIMUM)) - usage(p); - if (val == -1) - val = 0x7fff; - ray_setword(iface, RAY_MIB_FRAG_THRESH, val); - exit(0); - break; - - case 'f': - val = atoi(optarg); - if ((val < RAY_MIB_COUNTRY_CODE_MIMIMUM) || - (val > RAY_MIB_COUNTRY_CODE_MAXIMUM)) - usage(p); - ray_setword(iface, RAY_MIB_COUNTRY_CODE, val); - exit(0); - break; - - case 'n': - ray_setstr(iface, RAY_MIB_SSID, optarg); - exit(0); - break; - - case 'o': - ray_dumpstats(iface); - exit(0); - break; - - case 'p': - val = atoi(optarg); - if ((val < 0) || (val > 1)) - usage(p); - ray_setword(iface, RAY_MIB_NET_TYPE, val); - exit(0); - break; - - - case 'r': - val = atoi(optarg); - if ((val < -1) || (val > RAY_MIB_RTS_THRESH_MAXIMUM)) - usage(p); - if (val == -1) - val = 0x7fff; - ray_setword(iface, RAY_MIB_RTS_THRESH, val); - exit(0); - break; - - case 't': - val = atoi(optarg); - if ((val < RAY_MIB_BASIC_RATE_SET_MINIMUM) || - (val > RAY_MIB_BASIC_RATE_SET_MAXIMUM)) - usage(p); - ray_setword(iface, RAY_MIB_BASIC_RATE_SET, val); - exit(0); - break; - - case 'C': - ray_dumpsiglev(iface); - exit(0); - break; - - case 'W': - { - char *stringp, **ap, *av[5]; - u_int8_t mib; - - stringp = optarg; - ap = av; - *ap = strsep(&stringp, ":"); - ap++; - *ap = strsep(&stringp, ":"); - mib = atoi(av[0]); - sscanf(av[1], "%x", &val); - printf("mib %d, val 0x%02x\n", mib, val); - ray_setword(iface, mib, val); - } - exit(0); - break; - - case 'h': - default: - usage(p); - - } - } - - if (iface == NULL) - usage(p); - - ray_dumpinfo(iface); - - exit(0); -} |