This commit was generated by cvs2svn to compensate for changes in r4038,
authortomo <tomo>
Mon, 31 Dec 2001 20:02:55 +0000 (20:02 +0000)
committertomo <tomo>
Mon, 31 Dec 2001 20:02:55 +0000 (20:02 +0000)
which included commits to RCS files with non-trunk default branches.

47 files changed:
config.guess
config.sub
etc/etags.1
lib-src/ChangeLog
lib-src/etags.c
lib-src/gnuclient.c
lib-src/gnuserv.c
lib-src/gnuslib.c
lib-src/pop.c
lisp/mwheel.el
lisp/sound.el
lwlib/ChangeLog
lwlib/config.h.in
lwlib/lwlib-Xm.c
man/ChangeLog
man/lispref/eval.texi
man/lispref/variables.texi
man/xemacs/packages.texi
man/xemacs/programs.texi
man/xemacs/xemacs.texi
nt/ChangeLog
src/cmdloop.c
src/commands.h
src/dired-msw.c
src/eldap.c
src/elhash.c
src/eval.c
src/event-Xt.c
src/event-msw.c
src/event-stream.c
src/extents.c
src/glyphs-widget.c
src/hpplay.c
src/keymap.c
src/m/hp9000s300.h
src/m/sun386.h
src/nt.c
src/process-unix.c
src/profile.c
src/ralloc.c
src/sound.c
src/symeval.h
src/sysproc.h
src/tparam.c
src/window.c
tests/ChangeLog
version.sh

index b4faaed..32a779b 100755 (executable)
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 #   Free Software Foundation, Inc.
 
-version='2000-05-30'
+timestamp='2001-01-17'
 
 # 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
@@ -32,7 +32,7 @@ version='2000-05-30'
 # exits with 0.  Otherwise, it exits with 1.
 #
 # The plan is that this can be called by configure scripts if you
-# don't specify an explicit system type (host/target name).
+# don't specify an explicit build system type.
 #
 # Only a few systems have been added to this list; please add others
 # (but try to keep the structure clean).
@@ -43,19 +43,34 @@ me=`echo "$0" | sed -e 's,.*/,,'`
 usage="\
 Usage: $0 [OPTION]
 
-Output the configuration name of this system.
+Output the configuration name of the system \`$me' is run on.
 
 Operation modes:
-  -h, --help               print this help, then exit
-  -V, --version            print version number, then exit"
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 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."
 
 help="
 Try \`$me --help' for more information."
 
 # Parse command line
 while test $# -gt 0 ; do
-  case "$1" in
-    --version | --vers* | -V )
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
        echo "$version" ; exit 0 ;;
     --help | --h* | -h )
        echo "$usage"; exit 0 ;;
@@ -64,9 +79,7 @@ while test $# -gt 0 ; do
     - )        # Use stdin as input.
        break ;;
     -* )
-       exec >&2
-       echo "$me: invalid option $1"
-       echo "$help"
+       echo "$me: invalid option $1$help" >&2
        exit 1 ;;
     * )
        break ;;
@@ -78,19 +91,30 @@ if test $# != 0; then
   exit 1
 fi
 
-# Use $HOST_CC if defined. $CC may point to a cross-compiler
-if test x"$CC_FOR_BUILD" = x; then
-  if test x"$HOST_CC" != x; then
-    CC_FOR_BUILD="$HOST_CC"
-  else
-    if test x"$CC" != x; then
-      CC_FOR_BUILD="$CC"
-    else
-      CC_FOR_BUILD=cc
-    fi
-  fi
-fi
 
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script.
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int dummy(){}" > $dummy.c
+       for c in cc gcc c89 ; do
+         ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1
+         if test $? = 0 ; then
+            CC_FOR_BUILD="$c"; break
+         fi
+       done
+       rm -f $dummy.c $dummy.o $dummy.rel
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 8/24/94.)
@@ -100,12 +124,9 @@ fi
 
 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
-
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -119,7 +140,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        # object file format.
        # Determine the machine/vendor (is the vendor relevant).
        case "${UNAME_MACHINE}" in
-           amiga) machine=m68k-cbm ;;
+           amiga) machine=m68k-unknown ;;
            arm32) machine=arm-unknown ;;
            atari*) machine=m68k-atari ;;
            sun3*) machine=m68k-sun ;;
@@ -129,16 +150,24 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
            ibmrt|romp-ibm) machine=romp-ibm ;;
            *) machine=${UNAME_MACHINE}-unknown ;;
        esac
-       # The Operating System including object format.
-       if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-               | grep __ELF__ >/dev/null
-       then
-           # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-           # Return netbsd for either.  FIX?
-           os=netbsd
-       else
-           os=netbsdelf
-       fi
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE}" in
+           i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
        # The OS release
        release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
        # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
@@ -215,7 +244,7 @@ EOF
        echo alpha-dec-winnt3.5
        exit 0 ;;
     Amiga*:UNIX_System_V:4.0:*)
-       echo m68k-cbm-sysv4
+       echo m68k-unknown-sysv4
        exit 0;;
     amiga:OpenBSD:*:*)
        echo m68k-unknown-openbsd${UNAME_RELEASE}
@@ -247,7 +276,7 @@ EOF
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
        echo arm-acorn-riscix${UNAME_RELEASE}
        exit 0;;
-    SR2?01:HI-UX/MPP:*:*)
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
        echo hppa1.1-hitachi-hiuxmpp
        exit 0;;
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
@@ -473,6 +502,19 @@ EOF
        fi
        echo ${IBM_ARCH}-ibm-aix${IBM_REV}
        exit 0 ;;
+    *:AIX:*:5)
+       case "`lsattr -El proc0 -a type -F value`" in
+           PowerPC*) IBM_ARCH=powerpc
+                     IBM_MANUF=ibm ;;
+           Itanium)  IBM_ARCH=ia64
+                     IBM_MANUF=unknown ;;
+           POWER*)   IBM_ARCH=power
+                     IBM_MANUF=ibm ;;
+           *)        IBM_ARCH=powerpc
+                     IBM_MANUF=ibm ;;
+       esac
+       echo ${IBM_ARCH}-${IBM_MANUF}-aix${UNAME_VERSION}.${UNAME_RELEASE}
+       exit 0 ;;
     *:AIX:*:*)
        echo rs6000-ibm-aix
        exit 0 ;;
@@ -495,10 +537,28 @@ EOF
        echo m68k-hp-bsd4.4
        exit 0 ;;
     9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        case "${UNAME_MACHINE}" in
            9000/31? )            HP_ARCH=m68000 ;;
            9000/[34]?? )         HP_ARCH=m68k ;;
            9000/[678][0-9][0-9])
+              case "${HPUX_REV}" in
+                11.[0-9][0-9])
+                  if [ -x /usr/bin/getconf ]; then
+                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                        esac ;;
+                    esac
+                  fi ;;
+              esac
+              if [ "${HP_ARCH}" = "" ]; then
               sed 's/^              //' << EOF >$dummy.c
 
               #define _HPUX_SOURCE
@@ -533,11 +593,16 @@ EOF
               }
 EOF
        (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+       if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
        rm -f $dummy.c $dummy
+       fi ;;
        esac
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
        echo ${HP_ARCH}-hp-hpux${HPUX_REV}
        exit 0 ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit 0 ;;
     3050*:HI-UX:*:*)
        sed 's/^        //' << EOF >$dummy.c
        #include <unistd.h>
@@ -628,23 +693,24 @@ EOF
     CRAY*TS:*:*:*)
        echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit 0 ;;
-    CRAY*T3E:*:*:*)
+    CRAY*T3D:*:*:*)
        echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit 0 ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit 0 ;;
     CRAY*SV1:*:*:*)
        echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
        exit 0 ;;
     CRAY-2:*:*:*)
        echo cray2-cray-unicos
         exit 0 ;;
-    F300:UNIX_System_V:*:*)
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
         exit 0 ;;
-    F301:UNIX_System_V:*:*)
-       echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
-       exit 0 ;;
     hp300:OpenBSD:*:*)
        echo m68k-unknown-openbsd${UNAME_RELEASE}
        exit 0 ;;
@@ -669,6 +735,9 @@ EOF
     i*:MINGW*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
        exit 0 ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
        # How do we know it's Interix rather than the generic POSIX subsystem?
        # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -687,13 +756,15 @@ EOF
     *:GNU:*:*)
        echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
        exit 0 ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit 0 ;;
     *:Linux:*:*)
 
        # The BFD linker knows what the default object file format is, so
        # first see if it will tell us. cd to the root directory to prevent
        # problems with other programs or directories called `ld' in the path.
-       ld_help_string=`cd /; ld --help 2>&1`
-       ld_supported_emulations=`echo $ld_help_string \
+       ld_supported_emulations=`cd /; ld --help 2>&1 \
                         | sed -ne '/supported emulations:/!d
                                    s/[         ][      ]*/ /g
                                    s/.*supported emulations: *//
@@ -709,8 +780,7 @@ EOF
                exit 0
                ;;
          elf_i?86)
-               echo "${UNAME_MACHINE}-pc-linux"
-               exit 0
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
                ;;
          i?86coff)
                echo "${UNAME_MACHINE}-pc-linux-gnucoff"
@@ -720,6 +790,10 @@ EOF
                echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
                exit 0
                ;;
+         elf32_sparc)
+               echo "${UNAME_MACHINE}-unknown-linux-gnu"
+               exit 0
+               ;;
          armlinux)
                echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
                exit 0
@@ -853,14 +927,30 @@ EOF
          rm -f $dummy.c $dummy
        elif test "${UNAME_MACHINE}" = "s390"; then
          echo s390-ibm-linux && exit 0
+       elif test "${UNAME_MACHINE}" = "x86_64"; then
+         echo x86_64-unknown-linux-gnu && exit 0
+       elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then
+         # Look for CPU level
+         case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+           PA7*)
+               echo hppa1.1-unknown-linux-gnu
+               ;;
+           PA8*)
+               echo hppa2.0-unknown-linux-gnu
+               ;;
+           *)
+               echo hppa-unknown-linux-gnu
+               ;;
+         esac
+         exit 0
        else
          # Either a pre-BFD a.out linker (linux-gnuoldld)
          # or one that does not give us useful --help.
          # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
          # If ld does not provide *any* "supported emulations:"
          # that means it is gnuoldld.
-         echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
-         test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+         test -z "$ld_supported_emulations" \
+           && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
 
          case "${UNAME_MACHINE}" in
          i?86)
@@ -897,6 +987,7 @@ EOF
 EOF
          $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
          rm -f $dummy.c $dummy
+         test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
        fi ;;
 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.  earlier versions
 # are messed up and put the nodename in both sysname and nodename.
@@ -974,7 +1065,7 @@ EOF
        exit 0 ;;
     M68*:*:R3V[567]*:*)
        test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
        OS_REL=''
        test -r /etc/.relid \
        && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -997,9 +1088,12 @@ EOF
     TSUNAMI:LynxOS:2.*:*)
        echo sparc-unknown-lynxos${UNAME_RELEASE}
        exit 0 ;;
-    rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+    rs6000:LynxOS:2.*:*)
        echo rs6000-unknown-lynxos${UNAME_RELEASE}
        exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit 0 ;;
     SM[BE]S:UNIX_SV:*:*)
        echo mips-dde-sysv${UNAME_RELEASE}
        exit 0 ;;
@@ -1033,7 +1127,7 @@ EOF
     mc68*:A/UX:*:*)
        echo m68k-apple-aux${UNAME_RELEASE}
        exit 0 ;;
-    news*:NEWS-OS:*:6*)
+    news*:NEWS-OS:6*:*)
        echo mips-sony-newsos6
        exit 0 ;;
     R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
@@ -1076,15 +1170,52 @@ EOF
     *:QNX:*:4*)
        echo i386-pc-qnx
        exit 0 ;;
-    NSR-W:NONSTOP_KERNEL:*:*)
+    NSR-[KW]:NONSTOP_KERNEL:*:*)
        echo nsr-tandem-nsk${UNAME_RELEASE}
        exit 0 ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit 0 ;;
     BS2000:POSIX*:*:*)
        echo bs2000-siemens-sysv
        exit 0 ;;
     DS/*:UNIX_System_V:*:*)
        echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
        exit 0 ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit 0 ;;
+    i?86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit 0 ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit 0 ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit 0 ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit 0 ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit 0 ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1227,8 +1358,9 @@ fi
 cat >&2 <<EOF
 $0: unable to guess system type
 
-The $version version of this script cannot recognize your system type.
-Please download the most up to date version of the config scripts:
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
 
     ftp://ftp.gnu.org/pub/gnu/config/
 
@@ -1237,7 +1369,7 @@ send the following data and any information you think might be
 pertinent to <config-patches@gnu.org> in order to provide the needed
 information to handle your system.
 
-config.guess version = $version
+config.guess timestamp = $timestamp
 
 uname -m = `(uname -m) 2>/dev/null || echo unknown`
 uname -r = `(uname -r) 2>/dev/null || echo unknown`
@@ -1264,7 +1396,7 @@ exit 1
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "version='"
+# time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
 # End:
index cb86fe1..fe8d4ac 100755 (executable)
@@ -1,9 +1,9 @@
 #! /bin/sh
-# Configuration validation subroutine script, version 1.1.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 #   Free Software Foundation, Inc.
 
-version='2000-05-31'
+timestamp='2001-01-12'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -29,7 +29,6 @@ version='2000-05-31'
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Written by Per Bothner <bothner@cygnus.com>.
 # Please send patches to <config-patches@gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
@@ -61,16 +60,30 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS
 Canonicalize a configuration name.
 
 Operation modes:
-  -h, --help               print this help, then exit
-  -V, --version            print version number, then exit"
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+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."
 
 help="
 Try \`$me --help' for more information."
 
 # Parse command line
 while test $# -gt 0 ; do
-  case "$1" in
-    --version | --vers* | -V )
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
        echo "$version" ; exit 0 ;;
     --help | --h* | -h )
        echo "$usage"; exit 0 ;;
@@ -79,9 +92,7 @@ while test $# -gt 0 ; do
     - )        # Use stdin as input.
        break ;;
     -* )
-       exec >&2
-       echo "$me: invalid option $1"
-       echo "$help"
+       echo "$me: invalid option $1$help"
        exit 1 ;;
 
     *local*)
@@ -106,7 +117,7 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu*)
+  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -132,7 +143,7 @@ case $os in
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple)
+       -apple | -axis)
                os=
                basic_machine=$1
                ;;
@@ -204,30 +215,38 @@ esac
 case $basic_machine in
        # Recognize the basic CPU types without company name.
        # Some are omitted here because they have special meanings below.
-       tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
-               | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+       tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
+               | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
+               | pyramid | mn10200 | mn10300 | tron | a29k \
                | 580 | i960 | h8300 \
-               | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
+               | x86 | ppcbe | mipsbe | mipsle | shbe | shle \
                | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
                | hppa64 \
                | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
                | alphaev6[78] \
-               | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
-               | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+               | we32k | ns16k | clipper | i370 | sh | sh[34] \
+               | powerpc | powerpcle \
+               | 1750a | dsp16xx | pdp10 | pdp11 \
+               | mips16 | mips64 | mipsel | mips64el \
                | mips64orion | mips64orionel | mipstx39 | mipstx39el \
                | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
                | mips64vr5000 | miprs64vr5000el | mcore \
                | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
-               | thumb | d10v | fr30 | avr)
+               | thumb | d10v | d30v | fr30 | avr | openrisc)
                basic_machine=$basic_machine-unknown
                ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
                ;;
 
        # We use `pc' rather than `unknown'
        # because (1) that's what they normally are, and
        # (2) the word "unknown" tends to confuse beginning users.
-       i[34567]86)
+       i[234567]86 | x86_64)
          basic_machine=$basic_machine-pc
          ;;
        # Object if more than one company name word.
@@ -237,27 +256,28 @@ case $basic_machine in
                ;;
        # Recognize the basic CPU types with company name.
        # FIXME: clean up the formatting here.
-       vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
-             | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+       vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+             | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
+             | arm-*  | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
              | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
              | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
              | xmp-* | ymp-* \
-             | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
+             | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
              | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
              | hppa2.0n-* | hppa64-* \
              | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
              | alphaev6[78]-* \
              | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
              | clipper-* | orion-* \
-             | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+             | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
              | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
              | mips64el-* | mips64orion-* | mips64orionel-* \
              | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
              | mipstx39-* | mipstx39el-* | mcore-* \
-             | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
+             | f30[01]-* | f700-* | s390-* | sv1-* | t3e-* \
              | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
              | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
-             | bs2000-*)
+             | bs2000-* | tic54x-* | c54x-* | x86_64-*)
                ;;
        # Recognize the various machine names and aliases which stand
        # for a CPU type and a company and sometimes even an OS.
@@ -294,14 +314,14 @@ case $basic_machine in
                os=-sysv
                ;;
        amiga | amiga-*)
-               basic_machine=m68k-cbm
+               basic_machine=m68k-unknown
                ;;
        amigaos | amigados)
-               basic_machine=m68k-cbm
+               basic_machine=m68k-unknown
                os=-amigaos
                ;;
        amigaunix | amix)
-               basic_machine=m68k-cbm
+               basic_machine=m68k-unknown
                os=-sysv4
                ;;
        apollo68)
@@ -355,6 +375,9 @@ case $basic_machine in
        crds | unos)
                basic_machine=m68k-crds
                ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
        da30 | da30-*)
                basic_machine=m68k-da30
                ;;
@@ -402,6 +425,10 @@ case $basic_machine in
                basic_machine=tron-gmicro
                os=-sysv
                ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
        h3050r* | hiux*)
                basic_machine=hppa1.1-hitachi
                os=-hiuxwe2
@@ -501,14 +528,6 @@ case $basic_machine in
                basic_machine=i386-unknown
                os=-vsta
                ;;
-       i386-go32 | go32)
-               basic_machine=i386-unknown
-               os=-go32
-               ;;
-       i386-mingw32 | mingw32)
-               basic_machine=i386-unknown
-               os=-mingw32
-               ;;
        iris | iris4d)
                basic_machine=mips-sgi
                case $os in
@@ -534,6 +553,10 @@ case $basic_machine in
                basic_machine=ns32k-utek
                os=-sysv
                ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
        miniframe)
                basic_machine=m68000-convergent
                ;;
@@ -564,7 +587,7 @@ case $basic_machine in
                os=-coff
                ;;
        msdos)
-               basic_machine=i386-unknown
+               basic_machine=i386-pc
                os=-msdos
                ;;
        mvs)
@@ -628,6 +651,10 @@ case $basic_machine in
                basic_machine=i960-intel
                os=-mon960
                ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
        np1)
                basic_machine=np1-gould
                ;;
@@ -663,28 +690,28 @@ case $basic_machine in
         pc532 | pc532-*)
                basic_machine=ns32k-pc532
                ;;
-       pentium | p5 | k5 | k6 | nexen)
+       pentium | p5 | k5 | k6 | nexgen)
                basic_machine=i586-pc
                ;;
        pentiumpro | p6 | 6x86 | athlon)
                basic_machine=i686-pc
                ;;
        pentiumii | pentium2)
-               basic_machine=i786-pc
+               basic_machine=i686-pc
                ;;
-       pentium-* | p5-* | k5-* | k6-* | nexen-*)
+       pentium-* | p5-* | k5-* | k6-* | nexgen-*)
                basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
        pentiumpro-* | p6-* | 6x86-* | athlon-*)
                basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
        pentiumii-* | pentium2-*)
-               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
                ;;
        pn)
                basic_machine=pn-gould
                ;;
-       power)  basic_machine=rs6000-ibm
+       power)  basic_machine=power-ibm
                ;;
        ppc)    basic_machine=powerpc-unknown
                ;;
@@ -699,6 +726,10 @@ case $basic_machine in
        ps2)
                basic_machine=i386-ibm
                ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
        rom68k)
                basic_machine=m68k-rom68k
                os=-coff
@@ -790,6 +821,10 @@ case $basic_machine in
                basic_machine=t3e-cray
                os=-unicos
                ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
        tx39)
                basic_machine=mipstx39-unknown
                ;;
@@ -885,12 +920,19 @@ case $basic_machine in
        vax)
                basic_machine=vax-dec
                ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
        pdp11)
                basic_machine=pdp11-dec
                ;;
        we32k)
                basic_machine=we32k-att
                ;;
+       sh3 | sh4)
+               basic_machine=sh-unknown
+               ;;
        sparc | sparcv9)
                basic_machine=sparc-sun
                ;;
@@ -972,7 +1014,8 @@ case $os in
              | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
              | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
              | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
-             | -openstep* | -oskit*)
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1033,7 +1076,7 @@ case $os in
        -ns2 )
                os=-nextstep2
                ;;
-       -nsk)
+       -nsk*)
                os=-nsk
                ;;
        # Preserve the version number of sinix5.
@@ -1070,7 +1113,7 @@ case $os in
        -xenix)
                os=-xenix
                ;;
-        -*mint | -*MiNT)
+        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
                os=-mint
                ;;
        -none)
@@ -1104,6 +1147,9 @@ case $basic_machine in
        arm*-semi)
                os=-aout
                ;;
+       pdp10-*)
+               os=-tops20
+               ;;
         pdp11-*)
                os=-none
                ;;
@@ -1212,7 +1258,7 @@ case $basic_machine in
        *-masscomp)
                os=-rtu
                ;;
-       f301-fujitsu)
+       f30[01]-fujitsu | f700-fujitsu)
                os=-uxpv
                ;;
        *-rom68k)
@@ -1290,7 +1336,7 @@ case $basic_machine in
                        -mpw* | -macos*)
                                vendor=apple
                                ;;
-                       -*mint | -*MiNT)
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
                                vendor=atari
                                ;;
                esac
@@ -1303,7 +1349,7 @@ exit 0
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "version='"
+# time-stamp-start: "timestamp='"
 # time-stamp-format: "%:y-%02m-%02d"
 # time-stamp-end: "'"
 # End:
index 735b187..3ae60ec 100644 (file)
@@ -1,6 +1,6 @@
 .\" Copyright (c) 1992 Free Software Foundation
 .\" See section COPYING for conditions for redistribution
-.TH etags 1 "02nov1999" "GNU Tools" "GNU Tools"
+.TH etags 1 "14gen2001" "GNU Tools" "GNU Tools"
 .de BP
 .sp
 .ti -.2i
@@ -16,28 +16,28 @@ etags, ctags \- generate tag file for Emacs, vi
 .if n .br
 .B [\|\-o \fItagfile\fP\|] [\|\-r \fIregexp\fP\|]
 .br
-[\|\-\-append\|] [\|\-\-c++\|] [\|\-\-no\-defines\|]
-[\|\-\-no\-globals\|] [\|\-\-include=\fIfile\fP\|]
-[\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|]
-[\|\-\-members\|] [\|\-\-output=\fItagfile\fP\|]
-[\|\-\-regex=\fIregexp\fP\|] [\|\-\-no\-regex\|]
-[\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
-[\|\-\-help\|] [\|\-\-version\|]
+.B [\|\-\-append\|] [\|\-\-no\-defines\|]
+.B [\|\-\-no\-globals\|] [\|\-\-include=\fIfile\fP\|]
+.B [\|\-\-ignore\-indentation\|] [\|\-\-language=\fIlanguage\fP\|]
+.B [\|\-\-members\|] [\|\-\-output=\fItagfile\fP\|]
+.B [\|\-\-regex=\fIregexp\fP\|] [\|\-\-no\-regex\|]
+.B [\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
+.B [\|\-\-help\|] [\|\-\-version\|]
 \fIfile\fP .\|.\|.
 
 .B ctags [\|\-aCdgImRVh\|] [\|\-BtTuvwx\|] [\|\-l \fIlanguage\fP\|]
 .if n .br
 .B [\|\-o \fItagfile\fP\|] [\|\-r \fIregexp\fP\|]
 .br
-[\|\-\-append\|] [\|\-\-backward\-search\|] [\|\-\-c++\|]
-[\|\-\-cxref\|] [\|\-\-defines\|] [\|\-\-forward\-search\|]
-[\|\-\-globals\|] [\|\-\-ignore\-indentation\|]
-[\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|]
-[\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|]
-[\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
-[\|\-\-typedefs\|] [\|\-\-typedefs\-and\-c++\|]
-[\|\-\-update\|] [\|\-\-no\-warn\|]
-[\|\-\-help\|] [\|\-\-version\|]
+.B [\|\-\-append\|] [\|\-\-backward\-search\|]
+.B [\|\-\-cxref\|] [\|\-\-defines\|] [\|\-\-forward\-search\|]
+.B [\|\-\-globals\|] [\|\-\-ignore\-indentation\|]
+.B [\|\-\-language=\fIlanguage\fP\|] [\|\-\-members\|]
+.B [\|\-\-output=\fItagfile\fP\|] [\|\-\-regex=\fIregexp\fP\|]
+.B [\|\-\-ignore\-case\-regex=\fIregexp\fP\|]
+.B [\|\-\-typedefs\|] [\|\-\-typedefs\-and\-c++\|]
+.B [\|\-\-update\|] [\|\-\-no\-warn\|]
+.B [\|\-\-help\|] [\|\-\-version\|]
 \fIfile\fP .\|.\|.
 .ad b
 .hy 1
@@ -48,10 +48,10 @@ understood by
 \&; the `\|\fBctags\fP\|' program is used to create a similar table in a
 format understood by
 .BR vi ( 1 )\c
-\&.  Both forms of the program understand
-the syntax of C, Objective C, C++, Java, Fortran, Pascal, Cobol, Ada, Perl,
-LaTeX, Scheme, Emacs Lisp/Common Lisp, Postscript, Erlang, Python, Prolog and
-most assembler\-like syntaxes.
+\&.  Both forms of the program understand the syntax of C, Objective C,
+C++, Java, Fortran, Ada, Cobol, Erlang, LaTeX, Emacs Lisp/Common Lisp,
+makefiles, Pascal, Perl, Postscript, Python, Prolog, Scheme and most
+assembler\-like syntaxes.
 Both forms read the files specified on the command line, and write a tag
 table (defaults: `\|TAGS\|' for \fBetags\fP, `\|tags\|' for
 \fBctags\fP) in the current working directory.
@@ -81,11 +81,6 @@ The default is to use the delimiter `\|\fB/\fP\|', to search \fIforwards\fP
 through files.
 Only \fBctags\fP accepts this option.
 .TP
-.B \-C, \-\-c++
-Treat files with `\|.c\|' and `\|.h\|' extensions as C++ code, not C
-code.  Files with `\|.C\|', `\|.H\|', `\|.cxx\|', `\|.hxx\|', or
-`\|.cc\|' extensions are always assumed to be C++ code.
-.TP
 .B \-\-declarations
 In C and derived languages, create tags for function declarations,
 and create tags for extern variables unless \-\-no\-globals is used.
@@ -125,7 +120,7 @@ Parse the following files according to the given language.  More than
 one such options may be intermixed with filenames.  Use \fB\-\-help\fP
 to get a list of the available languages and their default filename
 extensions.  The `auto' language can be used to restore automatic
-detection of language based on filename extension.  The `none'
+detection of language based on the file name.  The `none'
 language may be used to disable language parsing altogether; only
 regexp matching is done in this case (see the \fB\-\-regex\fP option).
 .TP
@@ -143,8 +138,7 @@ Only tag packages in Ada files.
 Explicit name of file for tag table; overrides default `\|TAGS\|' or
 `\|tags\|'.   (But ignored with \fB\-v\fP or \fB\-x\fP.)
 .TP
-\fB\-r\fP \fIregexp\fP, \fB\-\-regex=\fIregexp\fP
-\fB\-\-ignore\-case\-regex=\fIregexp\fP\
+\fB\-r\fP \fIregexp\fP, \fB\-\-regex=\fIregexp\fP, \fB\-\-ignore\-case\-regex=\fIregexp\fP
 Make tags based on regexp matching for each line of the files following
 this option, in addition to the tags made with the standard parsing based
 on language.  When using \-\-regex, case is significant, while it is not
@@ -187,9 +181,9 @@ Tag TCL files (this last example shows the usage of a \fItagregexp\fP):
 
 .br
 A regexp can be preceded by {lang}, thus restriciting it to match lines of
-files of the specified language.  Use \fBetags --help\bP to obtain a list
+files of the specified language.  Use \fBetags --help\fP to obtain a list
 of the recognised languages.  This feature is particularly useful inside
-\fBregex files\fB.  A regex file contains one regex per line.  Empty lines,
+\fBregex files\fP.  A regex file contains one regex per line.  Empty lines,
 and those lines beginning with space or tab are ignored.  Lines beginning
 with @ are references to regex files whose name follows the @ sign.  Other
 lines are considered regular expressions like those following \-\-regex.
index 9b88cc1..ae5c8af 100644 (file)
@@ -1,3 +1,134 @@
+2001-02-08  Martin Buchholz <martin@xemacs.org>
+
+       * XEmacs 21.2.44 "Thalia" is released.
+
+2001-01-31  Francesco Potorti`  <pot@gnu.org>
+
+       * etags.c: [NDEBUG] #undef assert and #define it as ((void)0), for
+       the sake of some buggy assert.h (e.g. in MinGW and sunos4 pcc).
+       (C_entries): Tag token renamed to still_in_token because sunos4
+       pcc wants to expand it as the token() macro even though it has no
+       arguments.
+
+2001-01-30  Francesco Potorti`  <pot@gnu.org>
+
+       * etags.c: [WIN32-NATIVE]: #undef MSDOS, #undef WINDOWSNT and
+       #define it for the sake of Xemacs.
+       [WINDOWSNT]: #undef HAVE_NTGUI even if built without
+       HAVE_CONFIG_H.  This change only affects a standalone etags.
+       [WINDOWSNT]: #undef DOS_NT and #define it even if built with
+       HAVE_CONFIG_H.  This change does nothing in Emacs, as DOS_NT is
+       always defined when HAVE_CONFIG_H and WINDOWS are both defined.
+       [!HAVE_UNISTD_H]: use defined(WINDOWSNT) instead of the bare
+       WINDOWSNT, as this is the correct way to use it.
+
+2001-01-28  Francesco Potorti`  <pot@gnu.org>
+
+       * etags.c: Be capable to parse nested struct-like structures.
+       (structdef, structtag): Struct state machine revisited.
+       (struct tok): Revisited.
+       (cstack, nestlev, instruct): New struct and macros.
+       (pushclass_above, popclass_above, write_classname): New functions
+       for dealing with nested class names, inspired by Mykola Dzyuba.
+       (consider_token, make_C_tag, C_entries): Many changes for dealing
+       with arbitrarily nested structures.
+       (etags_getcwd): #if MSDOS, not #ifdef MSDOS!
+       (C_entries): Consider templates in C++.
+       (sym_type): New constant st_C_class for detecting "class" also in
+       C mode.
+       (C_AUTO): New macro for automatic detection of C++.
+       (consider_token): Automatic set C++ mode.
+       (C_entries): New security check for yacc.
+       (print_language_names, print_help): Mention the autodetect
+       feature, do not show help for the -C option, now mostly useless.
+       (C_entries): Tag C++ forward declarations if --declarations.
+       (C_entries): Don't be fooled by things like XDEFUN.
+       (consider_token): Discard asm pseudo function.
+
+2001-01-25  Francesco Potorti`  <pot@potorti.it>
+
+       * etags.c (struct tok): Renamed from struct token.
+       (token): Renamed from tok.
+       (structtype): Make it a local variable.
+       [DEBUG]: Use assert.
+       (xrnew): Change the synopsis.
+       (typedefs_or_cplusplus): Renamed from typedefs_and_cplusplus.
+       (grow_linebuffer): Don't call xrnew when not needed.
+       (token): buffer renamed to line.
+       (C_entries): Three calls to inibuffer moved here from main.
+       (C_entries): Removed all references to var methodlen, delete it.
+       (linebuffer_setlen): Was grow_buffer, now also sets len.
+       (consider_token, C_entries, Pascal_functions): Use it.
+       (C_entries): Preventing problems relative to extern "C".
+       (C_entries): Can tag more than one variable or func separated by
+       comma when --declarations is used.
+       (C_entries): More accurate tagging of members and declarations.
+       (yacc_rules): Was global, made local to C_entries.
+       (next_token_is_func): Removed.
+       (fvdef): New constants fdefunkey, fdefunname.
+       (consider_token, C_entries): Use them.
+       (C_entries): Build proper lisp names for Emacs DEFUNs.
+
+2001-01-15  Francesco Potorti`  <pot@pot.cnuce.cnr.it>
+
+       * etags.c (print_language_names): Print filenames in addition to
+       suffixes.
+
+2001-01-12  Francesco Potorti`  <pot@gnu.org>
+
+       * etags.c (get_language_from_langname): Renamed from
+       get_language_from_name.
+       (get_language_from_filename): Renamed from
+       get_language_from_suffix.  Now first looks for the complete file
+       name.
+       (language): New member char **filenames.
+       (Makefile_filenames): List of possible filenames for makefiles.
+       (lang_names): Added a NULL member for every entry, added an entry
+       for makefiles.
+       (Makefile_targets): New function, inspired by Assar Westerlund
+       <assar@sics.se>.
+
+2000-11-07  Francesco Potortì  <pot@pot.cnuce.cnr.it>
+
+       * etags.c (Texinfo_nodes): Renamed from Texinfo_fuctions and made
+       it conformant to the style of the rest of the code.
+
+2000-02-10  Francesco Potorti`  <pot@gnu.org>
+
+       * etags.c (iswhite): Redefined not to consider '\0' as white
+       space, and use it throughout in place of isspace, thus preventing a
+       potential signed char to int conversion problem.
+       (MSDOS): #undefine befere redefining
+
+2000-02-04  Francesco Potorti`  <F.Potorti@cnuce.cnr.it>
+
+       * etags.c (many functions): Add prototypes.
+
+2000-01-31  Francesco Potorti`  <F.Potorti@cnuce.cnr.it>
+
+       * etags.c [MSDOS]: Set MSDOS to 1 if #defined, 0 otherwise.
+       (get_compressor_from_suffix, process_file): Use MSDOS in if clause.
+       (etags_strchr, etags_strrchr): Use const char * and int as arguments.
+       (getenv, getcwd): Only declare them if necessary.
+       (EMACS_NAME): New constant macro.
+       (print_version): Use it.
+       (P_) [__STDC__]: Macro for defining function prototypes.
+
+2001-02-06  Martin Buchholz  <martin@xemacs.org>
+
+       * gnuclient.c:
+       * gnuserv.c:
+       * gnuslib.c:
+       * pop.c:
+       Remove use of BSD-specific types.
+       s/u_(char|short|int_long)/unsigned $1/g
+       Remove pointless casts.
+
+2001-01-28  Martin Buchholz  <martin@xemacs.org>
+
+       * gnuclient.c (get_current_working_directory): Use HAVE_GETCWD.
+       warning: getwd() possibly used unsafely, consider using getcwd().
+
 2001-01-26  Martin Buchholz <martin@xemacs.org>
 
        * XEmacs 21.2.43 "Terspichore" is released.
index ce7d1c2..7ae810d 100644 (file)
@@ -1,5 +1,5 @@
-/* Tags file maker to go with GNU Emacs
-   Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98, 99
+/* Tags file maker to go with GNU Emacs           -*- coding: latin-1 -*-
+   Copyright (C) 1984, 87, 88, 89, 93, 94, 95, 98, 99, 2000, 2001
    Free Software Foundation, Inc. and Ken Arnold
 
 This file is not considered part of GNU Emacs.
@@ -24,20 +24,25 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  *     Fortran added by Jim Kleckner.
  *     Ed Pelegri-Llopart added C typedefs.
  *     Gnu Emacs TAGS format and modifications by RMS?
- *     Sam Kendall added C++.
- *     Francesco Potorti` reorganised C and C++ based on work by Joe Wells.
- *     Regexp tags by Tom Tromey.
+ * 1989        Sam Kendall added C++.
+ * 1993        Francesco Potortì reorganised C and C++ based on work by Joe Wells.
+ * 1994        Regexp tags by Tom Tromey.
+ * 2001 Nested classes by Francesco Potortì based on work by Mykola Dzyuba.
  *
- *     Francesco Potorti` (pot@gnu.org) is the current maintainer.
+ *     Francesco Potortì <pot@gnu.org> has maintained it since 1993.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 13.44";
+char pot_etags_version[] = "@(#) pot revision number is 14.15";
 
 #define        TRUE    1
 #define        FALSE   0
 
-#ifndef DEBUG
-# define DEBUG FALSE
+#ifdef DEBUG
+#  undef DEBUG
+#  define DEBUG TRUE
+#else
+#  define DEBUG  FALSE
+#  define NDEBUG               /* disable assert */
 #endif
 
 #if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
@@ -59,29 +64,54 @@ char pot_etags_version[] = "@(#) pot revision number is 13.44";
 # define _GNU_SOURCE 1         /* enables some compiler checks on GNU */
 #endif
 
+/* WIN32_NATIVE is for Xemacs.
+   MSDOS, WINDOWSNT, DOS_NT are for Emacs. */
 #ifdef WIN32_NATIVE
+# undef MSDOS
+# undef  WINDOWSNT
+# define WINDOWSNT
+#endif /* WIN32_NATIVE */
+
+#ifdef MSDOS
+# undef MSDOS
+# define MSDOS TRUE
+# include <fcntl.h>
+# include <sys/param.h>
+# include <io.h>
+# ifndef HAVE_CONFIG_H
+#   define DOS_NT
+#   include <sys/config.h>
+# endif
+#else
+# define MSDOS FALSE
+#endif /* MSDOS */
+
+#ifdef WINDOWSNT
 # include <stdlib.h>
 # include <fcntl.h>
 # include <string.h>
 # include <direct.h>
 # include <io.h>
 # define MAXPATHLEN _MAX_PATH
+# undef HAVE_NTGUI
+# undef  DOS_NT
+# define DOS_NT
 # ifndef HAVE_GETCWD
 #   define HAVE_GETCWD
 # endif /* undef HAVE_GETCWD */
-#else /* !WIN32_NATIVE */
+#else /* !WINDOWSNT */
 # ifdef STDC_HEADERS
 #  include <stdlib.h>
 #  include <string.h>
 # else
     extern char *getenv ();
 # endif
-#endif /* !WIN32_NATIVE */
+#endif /* !WINDOWSNT */
 
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #else
-# if defined (HAVE_GETCWD) && !defined (WIN32_NATIVE)
+# if defined (HAVE_GETCWD) && !defined (WINDOWSNT)
     extern char *getcwd (char *buf, size_t size);
 # endif
 #endif /* HAVE_UNISTD_H */
@@ -95,6 +125,12 @@ char pot_etags_version[] = "@(#) pot revision number is 13.44";
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <assert.h>
+#ifdef NDEBUG
+# undef  assert                        /* some systems have a buggy assert.h */
+# define assert(x) ((void) 0)
+#endif
+
 #if !defined (S_ISREG) && defined (S_IFREG)
 # define S_ISREG(m)    (((m) & S_IFMT) == S_IFREG)
 #endif
@@ -130,43 +166,42 @@ char pot_etags_version[] = "@(#) pot revision number is 13.44";
 # define       BAD     1
 #endif
 
-/* C extensions. */
-#define C_PLPL 0x00001         /* C++ */
-#define C_STAR 0x00003         /* C* */
-#define C_JAVA 0x00005         /* JAVA */
-#define YACC   0x10000         /* yacc file */
-
-#define streq(s,t)     ((DEBUG && (s) == NULL && (t) == NULL   \
-                         && (abort (), 1)) || !strcmp (s, t))
-#define strneq(s,t,n)  ((DEBUG && (s) == NULL && (t) == NULL   \
-                         && (abort (), 1)) || !strncmp (s, t, n))
-
-#define lowcase(c)     tolower ((char)c)
+#define streq(s,t)     (assert((s)!=NULL || (t)!=NULL), !strcmp (s, t))
+#define strneq(s,t,n)  (assert((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
 
 #define CHARS 256              /* 2^sizeof(char) */
-#define CHAR(x)                ((unsigned int)x & (CHARS - 1))
+#define CHAR(x)                ((unsigned int)(x) & (CHARS - 1))
 #define        iswhite(c)      (_wht[CHAR(c)]) /* c is white */
 #define notinname(c)   (_nin[CHAR(c)]) /* c is not in a name */
 #define        begtoken(c)     (_btk[CHAR(c)]) /* c can start token */
 #define        intoken(c)      (_itk[CHAR(c)]) /* c can be in token */
 #define        endtoken(c)     (_etk[CHAR(c)]) /* c ends tokens */
 
+#define ISALNUM(c)     isalnum (CHAR(c))
+#define ISALPHA(c)     isalpha (CHAR(c))
+#define ISDIGIT(c)     isdigit (CHAR(c))
+#define ISLOWER(c)     islower (CHAR(c))
+
+#define lowcase(c)     tolower (CHAR(c))
+#define upcase(c)      toupper (CHAR(c))
+
 
 /*
  *     xnew, xrnew -- allocate, reallocate storage
  *
  * SYNOPSIS:   Type *xnew (int n, Type);
- *             Type *xrnew (OldPointer, int n, Type);
+ *             void xrnew (OldPointer, int n, Type);
  */
-#ifdef chkmalloc
+#if DEBUG
 # include "chkmalloc.h"
 # define xnew(n,Type)    ((Type *) trace_malloc (__FILE__, __LINE__, \
                                                  (n) * sizeof (Type)))
-# define xrnew(op,n,Type) ((Type *) trace_realloc (__FILE__, __LINE__, \
-                                                  (op), (n) * sizeof (Type)))
+# define xrnew(op,n,Type) ((op) = (Type *) trace_realloc (__FILE__, __LINE__, \
+                                       (char *) (op), (n) * sizeof (Type)))
 #else
 # define xnew(n,Type)    ((Type *) xmalloc ((n) * sizeof (Type)))
-# define xrnew(op,n,Type) ((Type *) xrealloc ((op), (n) * sizeof (Type)))
+# define xrnew(op,n,Type) ((op) = (Type *) xrealloc ( \
+                                       (char *) (op), (n) * sizeof (Type)))
 #endif
 
 typedef int bool;
@@ -183,6 +218,7 @@ typedef struct
 {
   char *name;
   Lang_function *function;
+  char **filenames;
   char **suffixes;
   char **interpreters;
 } language;
@@ -229,13 +265,15 @@ static void Erlang_functions P_((FILE *));
 static void Fortran_functions P_((FILE *));
 static void Yacc_entries P_((FILE *));
 static void Lisp_functions P_((FILE *));
+static void Makefile_targets P_((FILE *));
 static void Pascal_functions P_((FILE *));
 static void Perl_functions P_((FILE *));
 static void Postscript_functions P_((FILE *));
 static void Prolog_functions P_((FILE *));
 static void Python_functions P_((FILE *));
 static void Scheme_functions P_((FILE *));
-static void TeX_functions P_((FILE *));
+static void TeX_commands P_((FILE *));
+static void Texinfo_nodes P_((FILE *));
 static void just_read_file P_((FILE *));
 
 static void print_language_names P_((void));
@@ -245,9 +283,9 @@ int main P_((int, char **));
 static int number_len P_((long));
 
 static compressor *get_compressor_from_suffix P_((char *, char **));
-static language *get_language_from_name P_((char *));
+static language *get_language_from_langname P_((char *));
 static language *get_language_from_interpreter P_((char *));
-static language *get_language_from_suffix P_((char *));
+static language *get_language_from_filename P_((char *));
 static int total_size_of_entries P_((node *));
 static long readline P_((linebuffer *, FILE *));
 static long readline_internal P_((linebuffer *, FILE *));
@@ -260,7 +298,7 @@ static void free_patterns P_((void));
 #endif /* ETAGS_REGEXPS */
 static void error P_((const char *, const char *));
 static void suggest_asking_for_help P_((void));
-static void fatal P_((char *, char *));
+void fatal P_((char *, char *));
 static void pfatal P_((char *));
 static void add_node P_((node *, node **));
 
@@ -287,9 +325,9 @@ static char *absolute_filename P_((char *, char *));
 static char *absolute_dirname P_((char *, char *));
 static bool filename_is_absolute P_((char *f));
 static void canonicalize_filename P_((char *));
-static void grow_linebuffer P_((linebuffer *, int));
-static long *xmalloc P_((unsigned int));
-static long *xrealloc P_((char *, unsigned int));
+static void linebuffer_setlen P_((linebuffer *, int));
+long *xmalloc P_((unsigned int));
+long *xrealloc P_((char *, unsigned int));
 
 \f
 char searchar = '/';           /* use /.../ searches */
@@ -311,12 +349,6 @@ char *dbp;                 /* pointer to start of current tag */
 node *head;                    /* the head of the binary tree of tags */
 
 linebuffer lb;                 /* the current line */
-linebuffer token_name;         /* used by C_entries as a temporary area */
-struct
-{
-  long linepos;
-  linebuffer lb;               /* used by C_entries instead of lb */
-} lbs[2];
 
 /* boolean "functions" (see init)      */
 bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
@@ -335,7 +367,7 @@ char
 bool append_to_tagfile;                /* -a: append to tags */
 /* The following four default to TRUE for etags, but to FALSE for ctags.  */
 bool typedefs;                 /* -t: create tags for C and Ada typedefs */
-bool typedefs_and_cplusplus;   /* -T: create tags for C typedefs, level */
+bool typedefs_or_cplusplus;    /* -T: create tags for C typedefs, level */
                                /* 0 struct/enum/union decls, and C++ */
                                /* member functions. */
 bool constantypedefs;          /* -d: create tags for C #define, enum */
@@ -445,12 +477,13 @@ char *Asm_suffixes [] = { "a",    /* Unix assembler */
                        };
 
 /* Note that .c and .h can be considered C++, if the --c++ flag was
-   given.  That is why default_C_entries is called here. */
+   given, or if the `class' keyowrd is met inside the file.
+   That is why default_C_entries is called for these. */
 char *default_C_suffixes [] =
   { "c", "h", NULL };
 
 char *Cplusplus_suffixes [] =
-  { "C", "H", "c++", "cc", "cpp", "cxx", "h++", "hh", "hpp", "hxx",
+  { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
     "M",                       /* Objective C++ */
     "pdb",                     /* Postscript with C syntax */
     NULL };
@@ -471,7 +504,10 @@ char *Fortran_suffixes [] =
   { "F", "f", "f90", "for", NULL };
 
 char *Lisp_suffixes [] =
-  { "cl", "clisp", "el", "l", "lisp", "lsp", "ml", NULL };
+  { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
+
+char *Makefile_filenames [] =
+  { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
 
 char *Pascal_suffixes [] =
   { "p", "pas", NULL };
@@ -482,9 +518,9 @@ char *Perl_interpreters [] =
   { "perl", "@PERL@", NULL };
 
 char *plain_C_suffixes [] =
-  { "pc",                      /* Pro*C file */
+  { "lm",                      /* Objective lex file */
     "m",                       /* Objective C file */
-    "lm",                      /* Objective lex file */
+    "pc",                      /* Pro*C file */
      NULL };
 
 char *Postscript_suffixes [] =
@@ -498,13 +534,16 @@ char *Python_suffixes [] =
 
 /* Can't do the `SCM' or `scm' prefix with a version number. */
 char *Scheme_suffixes [] =
-  { "SCM", "SM", "oak", "sch", "scheme", "scm", "sm", "ss", "t", NULL };
+  { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
 
 char *TeX_suffixes [] =
-  { "TeX", "bib", "clo", "cls", "ltx", "sty", "tex", NULL };
+  { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
+
+char *Texinfo_suffixes [] =
+  { "texi", "texinfo", "txi", NULL };
 
 char *Yacc_suffixes [] =
-  { "y", "ym", "yy", "yxx", "y++", NULL }; /* .ym is Objective yacc file */
+  { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
 
 /*
  * Table of languages.
@@ -515,41 +554,47 @@ char *Yacc_suffixes [] =
 
 language lang_names [] =
 {
-  { "ada",     Ada_funcs,           Ada_suffixes,         NULL              },
-  { "asm",     Asm_labels,          Asm_suffixes,         NULL              },
-  { "c",       default_C_entries,   default_C_suffixes,   NULL              },
-  { "c++",     Cplusplus_entries,   Cplusplus_suffixes,   NULL              },
-  { "c*",      Cstar_entries,       Cstar_suffixes,       NULL              },
-  { "cobol",   Cobol_paragraphs,    Cobol_suffixes,       NULL              },
-  { "erlang",  Erlang_functions,    Erlang_suffixes,      NULL              },
-  { "fortran", Fortran_functions,   Fortran_suffixes,     NULL              },
-  { "java",    Cjava_entries,       Cjava_suffixes,       NULL              },
-  { "lisp",    Lisp_functions,      Lisp_suffixes,        NULL              },
-  { "pascal",  Pascal_functions,    Pascal_suffixes,      NULL              },
-  { "perl",    Perl_functions,      Perl_suffixes,        Perl_interpreters },
-  { "postscript", Postscript_functions, Postscript_suffixes, NULL           },
-  { "proc",    plain_C_entries,     plain_C_suffixes,     NULL              },
-  { "prolog",  Prolog_functions,    Prolog_suffixes,      NULL              },
-  { "python",  Python_functions,    Python_suffixes,      NULL              },
-  { "scheme",  Scheme_functions,    Scheme_suffixes,      NULL              },
-  { "tex",     TeX_functions,       TeX_suffixes,         NULL              },
-  { "yacc",    Yacc_entries,        Yacc_suffixes,        NULL              },
+  { "ada",               Ada_funcs,            NULL, Ada_suffixes,             NULL },
+  { "asm",               Asm_labels,           NULL, Asm_suffixes,             NULL },
+  { "c",                 default_C_entries,    NULL, default_C_suffixes,       NULL },
+  { "c++",               Cplusplus_entries,    NULL, Cplusplus_suffixes,       NULL },
+  { "c*",                Cstar_entries,        NULL, Cstar_suffixes,           NULL },
+  { "cobol",             Cobol_paragraphs,     NULL, Cobol_suffixes,           NULL },
+  { "erlang",            Erlang_functions,     NULL, Erlang_suffixes,          NULL },
+  { "fortran",           Fortran_functions,    NULL, Fortran_suffixes,         NULL },
+  { "java",              Cjava_entries,        NULL, Cjava_suffixes,           NULL },
+  { "lisp",              Lisp_functions,       NULL, Lisp_suffixes,            NULL },
+  { "makefile",   Makefile_targets,     Makefile_filenames, NULL,      NULL },
+  { "pascal",            Pascal_functions,     NULL, Pascal_suffixes,          NULL },
+  { "perl",              Perl_functions,     NULL, Perl_suffixes, Perl_interpreters },
+  { "postscript", Postscript_functions, NULL, Postscript_suffixes,     NULL },
+  { "proc",              plain_C_entries,      NULL, plain_C_suffixes,         NULL },
+  { "prolog",            Prolog_functions,     NULL, Prolog_suffixes,          NULL },
+  { "python",            Python_functions,     NULL, Python_suffixes,          NULL },
+  { "scheme",            Scheme_functions,     NULL, Scheme_suffixes,          NULL },
+  { "tex",               TeX_commands,         NULL, TeX_suffixes,             NULL },
+  { "texinfo",           Texinfo_nodes,        NULL, Texinfo_suffixes,         NULL },
+  { "yacc",              Yacc_entries,         NULL, Yacc_suffixes,            NULL },
   { "auto", NULL },             /* default guessing scheme */
   { "none", just_read_file },   /* regexp matching only */
   { NULL, NULL }                /* end of list */
 };
+
 \f
 static void
 print_language_names ()
 {
   language *lang;
-  char **ext;
+  char **name, **ext;
 
   puts ("\nThese are the currently supported languages, along with the\n\
-default file name suffixes:");
+default file names and dot suffixes:");
   for (lang = lang_names; lang->name != NULL; lang++)
     {
-      printf ("\t%s\t", lang->name);
+      printf ("  %-*s", 10, lang->name);
+      if (lang->filenames != NULL)
+       for (name = lang->filenames; *name != NULL; name++)
+         printf (" %s", *name);
       if (lang->suffixes != NULL)
        for (ext = lang->suffixes; *ext != NULL; ext++)
          printf (" .%s", *ext);
@@ -561,6 +606,7 @@ If no language is specified and no matching suffix is found,\n\
 the first line of the file is read for a sharp-bang (#!) sequence\n\
 followed by the name of an interpreter.  If no such sequence is found,\n\
 Fortran is tried first; if no tags are found, C is tried next.\n\
+When parsing any C file, a \"class\" keyword switches to C++.\n\
 Compressed files are supported using gzip and bzip2.");
 }
 
@@ -609,8 +655,13 @@ Relative ones are stored relative to the output file's directory.");
         Write the search commands for the tag entries using '?', the\n\
         backward-search command instead of '/', the forward-search command.");
 
+  /* This option is mostly obsolete, because etags can now automatically
+     detect C++.  Retained for backward compatibility and for debugging and
+     experimentation.  In principle, we could want to tag as C++ even
+     before any "class" keyword.
   puts ("-C, --c++\n\
         Treat files whose name suffix defaults to C language as C++ files.");
+  */
 
   puts ("--declarations\n\
        In C and derived languages, create tags for function declarations,");
@@ -870,9 +921,9 @@ main (argc, argv)
   bool got_err;
 #endif
 
-#ifdef WIN32_NATIVE
+#ifdef DOS_NT
   _fmode = O_BINARY;   /* all of files are treated as binary files */
-#endif /* WIN32_NATIVE */
+#endif /* DOS_NT */
 
   progname = argv[0];
   nincluded_files = 0;
@@ -894,13 +945,14 @@ main (argc, argv)
 
   /*
    * If etags, always find typedefs and structure tags.  Why not?
-   * Also default is to find macro constants, enum constants and
+   * Also default to find macro constants, enum constants and
    * global variables.
    */
   if (!CTAGS)
     {
-      typedefs = typedefs_and_cplusplus = constantypedefs = TRUE;
+      typedefs = typedefs_or_cplusplus = constantypedefs = TRUE;
       globals = TRUE;
+      declarations = FALSE;
       members = FALSE;
     }
 
@@ -958,7 +1010,7 @@ main (argc, argv)
          break;
        case 'l':
          {
-           language *lang = get_language_from_name (optarg);
+           language *lang = get_language_from_langname (optarg);
            if (lang != NULL)
              {
                argbuffer[current_arg].lang = lang;
@@ -995,7 +1047,7 @@ main (argc, argv)
          typedefs = TRUE;
          break;
        case 'T':
-         typedefs = typedefs_and_cplusplus = TRUE;
+         typedefs = typedefs_or_cplusplus = TRUE;
          break;
 #if (!CTAGS)
          /* Etags options */
@@ -1046,9 +1098,6 @@ main (argc, argv)
   init ();                     /* set up boolean "functions" */
 
   initbuffer (&lb);
-  initbuffer (&token_name);
-  initbuffer (&lbs[0].lb);
-  initbuffer (&lbs[1].lb);
   initbuffer (&filename_lb);
 
   if (!CTAGS)
@@ -1056,12 +1105,12 @@ main (argc, argv)
       if (streq (tagfile, "-"))
        {
          tagf = stdout;
-#ifdef WIN32_NATIVE
+#ifdef DOS_NT
          /* Switch redirected `stdout' to binary mode (setting `_fmode'
             doesn't take effect until after `stdout' is already open). */
          if (!isatty (fileno (stdout)))
            setmode (fileno (stdout), O_BINARY);
-#endif /* WIN32_NATIVE */
+#endif /* DOS_NT */
        }
       else
        tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
@@ -1180,7 +1229,7 @@ main (argc, argv)
  * return a pointer into FILE where the compressor-specific
  * extension begins.  If no compressor is found, NULL is returned
  * and EXTPTR is not significant.
- * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca>
+ * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998)
  */
 static compressor *
 get_compressor_from_suffix (file, extptr)
@@ -1191,7 +1240,7 @@ get_compressor_from_suffix (file, extptr)
   char *slash, *suffix;
 
   /* This relies on FN to be after canonicalize_filename,
-     so we don't need to consider backslashes on WIN32_NATIVE.  */
+     so we don't need to consider backslashes on DOS_NT.  */
   slash = etags_strrchr (file, '/');
   suffix = etags_strrchr (file, '.');
   if (suffix == NULL || suffix < slash)
@@ -1201,13 +1250,13 @@ get_compressor_from_suffix (file, extptr)
   suffix += 1;
   /* Let those poor souls who live with DOS 8+3 file name limits get
      some solace by treating foo.cgz as if it were foo.c.gz, etc.
- */
+     Only the first do loop is run if not MSDOS */
   do
     {
       for (compr = compressors; compr->suffix != NULL; compr++)
        if (streq (compr->suffix, suffix))
          return compr;
-      if (1) /* !MSDOS */
+      if (!MSDOS)
        break;                  /* do it only once: not really a loop */
       if (extptr != NULL)
        *extptr = ++suffix;
@@ -1221,7 +1270,7 @@ get_compressor_from_suffix (file, extptr)
  * Return a language given the name.
  */
 static language *
-get_language_from_name (name)
+get_language_from_langname (name)
      char *name;
 {
   language *lang;
@@ -1267,12 +1316,20 @@ get_language_from_interpreter (interpreter)
  * Return a language given the file name.
  */
 static language *
-get_language_from_suffix (file)
+get_language_from_filename (file)
      char *file;
 {
   language *lang;
-  char **ext, *suffix;
+  char **name, **ext, *suffix;
+
+  /* Try whole file name first. */
+  for (lang = lang_names; lang->name != NULL; lang++)
+    if (lang->filenames != NULL)
+      for (name = lang->filenames; *name != NULL; name++)
+       if (streq (*name, file))
+         return lang;
 
+  /* If not found, try suffix after last dot. */
   suffix = etags_strrchr (file, '.');
   if (suffix == NULL)
     return NULL;
@@ -1354,7 +1411,22 @@ process_file (file)
              compressed_name = concat (file, ".", compr->suffix);
              if (stat (compressed_name, &stat_buf) != 0)
                {
-                 /* XEmacs: delete MSDOS code */
+                 if (MSDOS)
+                   {
+                     char *suf = compressed_name + strlen (file);
+                     size_t suflen = strlen (compr->suffix) + 1;
+                     for ( ; suf[1]; suf++, suflen--)
+                       {
+                         memmove (suf, suf + 1, suflen);
+                         if (stat (compressed_name, &stat_buf) == 0)
+                           {
+                             real_name = compressed_name;
+                             break;
+                           }
+                       }
+                     if (real_name != NULL)
+                       break;
+                   } /* MSDOS */
                  free (compressed_name);
                  compressed_name = NULL;
                }
@@ -1380,7 +1452,7 @@ process_file (file)
   if (real_name == compressed_name)
     {
       char *cmd = concat (compr->command, " ", real_name);
-      inf = popen (cmd, "r");
+      inf = (FILE *) popen (cmd, "r");
       free (cmd);
     }
   else
@@ -1485,7 +1557,7 @@ find_entries (file, inf)
     }
 
   /* Try to guess the language given the file name. */
-  lang = get_language_from_suffix (file);
+  lang = get_language_from_filename (file);
   if (lang != NULL && lang->function != NULL)
     {
       curlang = lang;
@@ -1530,7 +1602,7 @@ find_entries (file, inf)
 
   /* Try Fortran. */
   old_last_node = last_node;
-  curlang = get_language_from_name ("fortran");
+  curlang = get_language_from_langname ("fortran");
   Fortran_functions (inf);
 
   /* No Fortran entries found.  Try C. */
@@ -1539,11 +1611,12 @@ find_entries (file, inf)
       /* We do not tag if rewind fails.
         Only the file name will be recorded in the tags file. */
       rewind (inf);
-      curlang = get_language_from_name (cplusplus ? "c++" : "c");
+      curlang = get_language_from_langname (cplusplus ? "c++" : "c");
       default_C_entries (inf);
     }
   return;
 }
+
 \f
 /* Record a tag. */
 static void
@@ -1597,10 +1670,9 @@ pfnote (name, is_func, linestart, linelen, lno, cno)
   add_node (np, &head);
 }
 
-/* Date: Wed, 22 Jan 1997 02:56:31 -0500 [last amended 18 Sep 1997]
- * From: Sam Kendall <kendall@mv.mv.com>
- * Subject: Proposal for firming up the TAGS format specification
- * To: F.Potorti@cnuce.cnr.it
+/*
+ * TAGS format specification
+ * Idea by Sam Kendall <kendall@mv.mv.com> (1997)
  *
  * pfnote should emit the optimized form [unnamed tag] only if:
  *  1. name does not contain any of the characters " \t\r\n(),;";
@@ -1740,6 +1812,7 @@ add_node (np, cur_node_p)
       add_node (np, dif < 0 ? &cur_node->left : &cur_node->right);
     }
 }
+
 \f
 static void
 put_entries (np)
@@ -1848,7 +1921,17 @@ total_size_of_entries (np)
 
   return total;
 }
+
 \f
+/* C extensions. */
+#define C_EXT  0x00fff         /* C extensions */
+#define C_PLAIN 0x00000                /* C */
+#define C_PLPL 0x00001         /* C++ */
+#define C_STAR 0x00003         /* C* */
+#define C_JAVA 0x00005         /* JAVA */
+#define C_AUTO  0x01000                /* C, but switch to C++ if `class' is met */
+#define YACC   0x10000         /* yacc file */
+
 /*
  * The C symbol tables.
  */
@@ -1860,6 +1943,7 @@ enum sym_type
   st_C_ignore,
   st_C_javastruct,
   st_C_operator,
+  st_C_class,
   st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec
 };
 
@@ -1869,6 +1953,7 @@ static enum sym_type C_symtype P_((char *, int, int));
 
 /* Feed stuff between (but not including) %[ and %] lines to:
       gperf -c -k 1,3 -o -p -r -t
+   then put a `static' keyword in front of the in_word_set function.
 %[
 struct C_stab_entry { char *name; int c_ext; enum sym_type type; }
 %%
@@ -1887,7 +1972,7 @@ friend,           C_PLPL, st_C_ignore
 extends,       C_JAVA, st_C_javastruct
 implements,    C_JAVA, st_C_javastruct
 interface,     C_JAVA, st_C_struct
-class,         C_PLPL, st_C_struct
+class,         0,      st_C_class
 namespace,     C_PLPL, st_C_struct
 domain,        C_STAR, st_C_struct
 union,         0,      st_C_struct
@@ -1924,7 +2009,8 @@ PSEUDO,           0,      st_C_gnumacro
 #EXFUN,                0,      st_C_gnumacro
 #DEFVAR_,      0,      st_C_gnumacro
 %]
-and replace lines between %< and %> with its output. */
+and replace lines between %< and %> with its output,
+then make in_word_set static. */
 /*%<*/
 /* C code produced by gperf version 2.7.1 (19981006 egcs) */
 /* Command-line: gperf -c -k 1,3 -o -p -r -t  */
@@ -1934,8 +2020,8 @@ struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
 #define MIN_WORD_LENGTH 2
 #define MAX_WORD_LENGTH 15
 #define MIN_HASH_VALUE 13
-#define MAX_HASH_VALUE 123
-/* maximum key range = 111, duplicates = 0 */
+#define MAX_HASH_VALUE 121
+/* maximum key range = 109, duplicates = 0 */
 
 #ifdef __GNUC__
 __inline
@@ -1947,32 +2033,32 @@ hash (str, len)
 {
   static unsigned char asso_values[] =
     {
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124,   3, 124, 124, 124,  43,   6,
-       11, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-       11, 124, 124,  58,   7, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124,  57,   7,  42,
-        4,  14,  52,   0, 124,  53, 124, 124,  29,  11,
-        6,  35,  32, 124,  29,  34,  59,  58,  51,  24,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-      124, 124, 124, 124, 124, 124
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122,  57, 122, 122, 122,  55,   6,
+       60, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+       51, 122, 122,  10,   2, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122,   2,  52,  59,
+       49,  38,  56,  41, 122,  22, 122, 122,   9,  32,
+       33,  60,  26, 122,   1,  28,  46,  59,  44,  51,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122, 122, 122, 122, 122,
+      122, 122, 122, 122, 122, 122
     };
   register int hval = len;
 
@@ -2001,77 +2087,76 @@ in_word_set (str, len)
     {
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
       {""}, {""}, {""}, {""},
-      {"@end",         0,      st_C_objend},
-      {""}, {""}, {""}, {""},
       {"ENTRY",                0,      st_C_gnumacro},
-      {"@interface",   0,      st_C_objprot},
-      {""},
-      {"domain",       C_STAR, st_C_struct},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
       {""},
-      {"PSEUDO",               0,      st_C_gnumacro},
-      {""}, {""},
-      {"namespace",    C_PLPL, st_C_struct},
+      {"if",           0,      st_C_ignore},
       {""}, {""},
-      {"@implementation",0,    st_C_objimpl},
+      {"SYSCALL",      0,      st_C_gnumacro},
+      {""}, {""}, {""}, {""}, {""}, {""}, {""},
+      {"struct",       0,      st_C_struct},
+      {"static",       0,      st_C_typespec},
       {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
       {"long",         0,      st_C_typespec},
-      {"signed",       0,      st_C_typespec},
-      {"@protocol",    0,      st_C_objprot},
-      {""}, {""}, {""}, {""},
-      {"bool",         C_PLPL, st_C_typespec},
-      {""}, {""}, {""}, {""}, {""}, {""},
-      {"const",        0,      st_C_typespec},
-      {"explicit",     C_PLPL, st_C_typespec},
-      {"if",           0,      st_C_ignore},
-      {""},
-      {"operator",     C_PLPL, st_C_operator},
-      {""},
-      {"DEFUN",                0,      st_C_gnumacro},
-      {""}, {""},
-      {"define",       0,      st_C_define},
       {""}, {""}, {""}, {""}, {""},
-      {"double",       0,      st_C_typespec},
-      {"struct",       0,      st_C_struct},
-      {""}, {""}, {""}, {""},
-      {"short",        0,      st_C_typespec},
+      {"auto",         0,      st_C_typespec},
+      {"return",               0,      st_C_ignore},
+      {"import",               C_JAVA, st_C_ignore},
       {""},
-      {"enum",         0,      st_C_enum},
-      {"mutable",      C_PLPL, st_C_typespec},
+      {"switch",               0,      st_C_ignore},
       {""},
-      {"extern",       0,      st_C_extern},
-      {"extends",      C_JAVA, st_C_javastruct},
-      {"package",      C_JAVA, st_C_ignore},
-      {"while",                0,      st_C_ignore},
+      {"implements",   C_JAVA, st_C_javastruct},
       {""},
       {"for",          0,      st_C_ignore},
-      {""}, {""}, {""},
       {"volatile",     0,      st_C_typespec},
+      {""},
+      {"PSEUDO",               0,      st_C_gnumacro},
+      {""},
+      {"char",         0,      st_C_typespec},
+      {"class",        0,      st_C_class},
+      {"@protocol",    0,      st_C_objprot},
       {""}, {""},
-      {"import",               C_JAVA, st_C_ignore},
-      {"float",        0,      st_C_typespec},
-      {"switch",               0,      st_C_ignore},
-      {"return",               0,      st_C_ignore},
-      {"implements",   C_JAVA, st_C_javastruct},
+      {"void",         0,      st_C_typespec},
+      {"int",          0,      st_C_typespec},
+      {"explicit",     C_PLPL, st_C_typespec},
       {""},
-      {"static",       0,      st_C_typespec},
+      {"namespace",    C_PLPL, st_C_struct},
+      {"signed",       0,      st_C_typespec},
+      {""},
+      {"interface",    C_JAVA, st_C_struct},
+      {"while",                0,      st_C_ignore},
       {"typedef",      0,      st_C_typedef},
       {"typename",     C_PLPL, st_C_typespec},
-      {"unsigned",     0,      st_C_typespec},
-      {""}, {""},
-      {"char",         0,      st_C_typespec},
-      {"class",        C_PLPL, st_C_struct},
       {""}, {""}, {""},
-      {"void",         0,      st_C_typespec},
-      {""}, {""},
       {"friend",               C_PLPL, st_C_ignore},
-      {""}, {""}, {""},
-      {"int",          0,      st_C_typespec},
+      {"mutable",      C_PLPL, st_C_typespec},
       {"union",        0,      st_C_struct},
-      {""}, {""}, {""},
-      {"auto",         0,      st_C_typespec},
-      {"interface",    C_JAVA, st_C_struct},
+      {"domain",       C_STAR, st_C_struct},
+      {""}, {""},
+      {"extern",       0,      st_C_extern},
+      {"extends",      C_JAVA, st_C_javastruct},
+      {"package",      C_JAVA, st_C_ignore},
+      {"short",        0,      st_C_typespec},
+      {"@end",         0,      st_C_objend},
+      {"unsigned",     0,      st_C_typespec},
+      {""},
+      {"const",        0,      st_C_typespec},
+      {""}, {""},
+      {"@interface",   0,      st_C_objprot},
+      {"enum",         0,      st_C_enum},
+      {""}, {""},
+      {"@implementation",0,    st_C_objimpl},
+      {""},
+      {"operator",     C_PLPL, st_C_operator},
+      {""}, {""}, {""}, {""},
+      {"define",       0,      st_C_define},
+      {""}, {""},
+      {"double",       0,      st_C_typespec},
       {""},
-      {"SYSCALL",      0,      st_C_gnumacro}
+      {"bool",         C_PLPL, st_C_typespec},
+      {""}, {""}, {""},
+      {"DEFUN",                0,      st_C_gnumacro},
+      {"float",        0,      st_C_typespec}
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -2102,14 +2187,17 @@ C_symtype (str, len, c_ext)
     return st_none;
   return se->type;
 }
+
 \f
- /*
-  * C functions and variables are recognized using a simple
-  * finite automaton.  fvdef is its state variable.
-  */
+/*
+ * C functions and variables are recognized using a simple
+ * finite automaton.  fvdef is its state variable.
+ */
 enum
 {
   fvnone,                      /* nothing seen */
+  fdefunkey,                   /* Emacs DEFUN keyword seen */
+  fdefunname,                  /* Emacs DEFUN name seen */
   foperator,                   /* func: operator keyword seen (cplpl) */
   fvnameseen,                  /* function or variable name seen */
   fstartlist,                  /* func: just after open parenthesis */
@@ -2121,10 +2209,10 @@ enum
 
 bool fvextern;                 /* func or var: extern keyword seen; */
 
- /*
-  * typedefs are recognized using a simple finite automaton.
-  * typdef is its state variable.
-  */
+/*
+ * typedefs are recognized using a simple finite automaton.
+ * typdef is its state variable.
+ */
 enum
 {
   tnone,                       /* nothing seen */
@@ -2135,30 +2223,22 @@ enum
   tignore                      /* junk after typedef tag */
 } typdef;
 
-
- /*
-  * struct-like structures (enum, struct and union) are recognized
-  * using another simple finite automaton.  `structdef' is its state
-  * variable.
-  */
+/*
+ * struct-like structures (enum, struct and union) are recognized
+ * using another simple finite automaton.  `structdef' is its state
+ * variable.
+ */
 enum
 {
-  snone,                       /* nothing seen yet */
+  snone,                       /* nothing seen yet,
+                                  or in struct body if cblev > 0 */
   skeyseen,                    /* struct-like keyword seen */
   stagseen,                    /* struct-like tag seen */
-  scolonseen,                  /* colon seen after struct-like tag */
-  sinbody                      /* in struct body: recognize member func defs*/
+  sintemplate,                 /* inside template (ignore) */
+  scolonseen                   /* colon seen after struct-like tag */
 } structdef;
 
 /*
- * When structdef is stagseen, scolonseen, or sinbody, structtag is the
- * struct tag, and structtype is the type of the preceding struct-like
- * keyword.
- */
-char *structtag = "<uninited>";
-enum sym_type structtype;
-
-/*
  * When objdef is different from onone, objtag is the name of the class.
  */
 char *objtag = "<uninited>";
@@ -2176,7 +2256,7 @@ enum
 
 /*
  * State machine for Objective C protocols and implementations.
- * Tom R.Hageman <tom@basil.icce.rug.nl>
+ * Idea by Tom R.Hageman <tom@basil.icce.rug.nl> (1995)
  */
 enum
 {
@@ -2199,36 +2279,114 @@ enum
  * Use this structure to keep info about the token read, and how it
  * should be tagged.  Used by the make_C_tag function to build a tag.
  */
-typedef struct
+struct tok
 {
   bool valid;
-  char *str;
   bool named;
-  int linelen;
+  int offset;
+  int length;
   int lineno;
   long linepos;
-  char *buffer;
-} token;
-
-token tok;                     /* latest token read */
+  char *line;
+} token;                       /* latest token read */
+linebuffer token_name;         /* its name */
 
 /*
- * Set this to TRUE, and the next token considered is called a function.
- * Used only for GNU emacs's function-defining macros.
+ * Variables and functions for dealing with nested structures.
+ * Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001)
  */
-bool next_token_is_func;
+static void pushclass_above P_((int, char *, int));
+static void popclass_above P_((int));
+static void write_classname P_((linebuffer *, char *qualifier));
+
+struct {
+  char **cname;                        /* nested class names */
+  int *cblev;                  /* nested class curly brace level */
+  int nl;                      /* class nesting level (elements used) */
+  int size;                    /* length of the array */
+} cstack;                      /* stack for nested declaration tags */
+/* Current struct nesting depth (namespace, class, struct, union, enum). */
+#define nestlev                (cstack.nl)
+/* After struct keyword or in struct body, not inside an nested function. */
+#define instruct       (structdef == snone && nestlev > 0                      \
+                        && cblev == cstack.cblev[nestlev-1] + 1)
 
-/*
- * TRUE in the rules part of a yacc file, FALSE outside (parse as C).
- */
-bool yacc_rules;
+static void
+pushclass_above (cblev, str, len)
+     int cblev;
+     char *str;
+     int len;
+{
+  int nl;
 
-/*
- * methodlen is the length of the method name stored in token_name.
- */
-int methodlen;
+  popclass_above (cblev);
+  nl = cstack.nl;
+  if (nl >= cstack.size)
+    {
+      int size = cstack.size *= 2;
+      xrnew (cstack.cname, size, char *);
+      xrnew (cstack.cblev, size, int);
+    }
+  assert (nl == 0 || cstack.cblev[nl-1] < cblev);
+  cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len);
+  cstack.cblev[nl] = cblev;
+  cstack.nl = nl + 1;
+}
+
+static void
+popclass_above (cblev)
+     int cblev;
+{
+  int nl;
 
-static bool consider_token P_((char *, int, int, int, int, int, bool *));
+  for (nl = cstack.nl - 1;
+       nl >= 0 && cstack.cblev[nl] >= cblev;
+       nl--)
+    {
+      if (cstack.cname[nl] != NULL)
+       free (cstack.cname[nl]);
+      cstack.nl = nl;
+    }
+}
+
+static void
+write_classname (cn, qualifier)
+     linebuffer *cn;
+     char *qualifier;
+{
+  int i, len;
+  int qlen = strlen (qualifier);
+
+  if (cstack.nl == 0 || cstack.cname[0] == NULL)
+    {
+      len = 0;
+      cn->len = 0;
+      cn->buffer[0] = '\0';
+    }
+  else
+    {
+      len = strlen (cstack.cname[0]);
+      linebuffer_setlen (cn, len);
+      strcpy (cn->buffer, cstack.cname[0]);
+    }
+  for (i = 1; i < cstack.nl; i++)
+    {
+      char *s;
+      int slen;
+
+      s = cstack.cname[i];
+      if (s == NULL)
+       continue;
+      slen = strlen (s);
+      len += slen + qlen;
+      linebuffer_setlen (cn, len);
+      strncat (cn->buffer, qualifier, qlen);
+      strncat (cn->buffer, s, slen);
+    }
+}
+
+\f
+static bool consider_token P_((char *, int, int, int *, int, int, bool *));
 static void make_C_tag P_((bool));
 
 /*
@@ -2238,7 +2396,7 @@ static void make_C_tag P_((bool));
  *     is a struct/union/enum tag, or #define, or an enum constant.
  *
  *     *IS_FUNC gets TRUE iff the token is a function or #define macro
- *     with args.  C_EXT is which language we are looking at.
+ *     with args.  C_EXTP points to which language we are looking at.
  *
  * Globals
  *     fvdef                   IN OUT
@@ -2246,20 +2404,27 @@ static void make_C_tag P_((bool));
  *     definedef               IN OUT
  *     typdef                  IN OUT
  *     objdef                  IN OUT
- *     next_token_is_func      IN OUT
  */
 
 static bool
-consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
+consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var)
      register char *str;       /* IN: token pointer */
      register int len;         /* IN: token length */
      register int c;           /* IN: first char after the token */
-     int c_ext;                        /* IN: C extensions mask */
+     int *c_extp;              /* IN, OUT: C extensions mask */
      int cblev;                        /* IN: curly brace level */
      int parlev;               /* IN: parenthesis level */
      bool *is_func_or_var;     /* OUT: function or variable found */
 {
-  enum sym_type toktype = C_symtype (str, len, c_ext);
+  /* When structdef is stagseen, scolonseen, or snone with cblev > 0,
+     structtype is the type of the preceding struct-like keyword, and
+     structcblev is the curly brace level where it has been seen. */
+  static enum sym_type structtype;
+  static int structcblev;
+  static enum sym_type toktype;
+
+
+  toktype = C_symtype (str, len, *c_extp);
 
   /*
    * Advance the definedef state machine.
@@ -2268,6 +2433,11 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
     {
     case dnone:
       /* We're not on a preprocessor line. */
+      if (toktype == st_C_gnumacro)
+       {
+         fvdef = fdefunkey;
+         return FALSE;
+       }
       break;
     case dsharpseen:
       if (toktype == st_C_define)
@@ -2316,17 +2486,25 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
        {
        case st_none:
        case st_C_typespec:
+       case st_C_class:
        case st_C_struct:
        case st_C_enum:
          typdef = ttypeseen;
          break;
        }
-      /* Do not return here, so the structdef stuff has a chance. */
+      break;
+    case ttypeseen:
+      if (structdef == snone && fvdef == fvnone)
+       {
+         fvdef = fvnameseen;
+         return TRUE;
+       }
       break;
     case tend:
       switch (toktype)
        {
        case st_C_typespec:
+       case st_C_class:
        case st_C_struct:
        case st_C_enum:
          return FALSE;
@@ -2335,11 +2513,6 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
     }
 
   /*
-   * This structdef business is currently only invoked when cblev==0.
-   * It should be recursively invoked whatever the curly brace level,
-   * and a stack of states kept, to allow for definitions of structs
-   * within structs.
-   *
    * This structdef business is NOT invoked when we are ctags and the
    * file is plain C.  This is because a struct tag may have the same
    * name as another tag, and this loses with ctags.
@@ -2350,25 +2523,29 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
       if (structdef == stagseen)
         structdef = scolonseen;
       return FALSE;
+    case st_C_class:
+      if (cblev == 0
+         && (*c_extp & C_AUTO) /* automatic detection of C++ language */
+         && definedef == dnone && structdef == snone
+         && typdef == tnone && fvdef == fvnone)
+       *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
+      /* FALLTHRU */
     case st_C_struct:
     case st_C_enum:
-      if (typdef == tkeyseen
-         || (typedefs_and_cplusplus && cblev == 0 && structdef == snone))
+      if (parlev == 0
+         && fvdef != vignore
+         && (typdef == tkeyseen
+             || (typedefs_or_cplusplus && structdef == snone)))
        {
          structdef = skeyseen;
          structtype = toktype;
+         structcblev = cblev;
        }
       return FALSE;
     }
 
   if (structdef == skeyseen)
     {
-      /* Save the tag for struct/union/class, for functions and variables
-        that may be defined inside. */
-      if (structtype == st_C_struct)
-       structtag = savenstr (str, len);
-      else
-       structtag = "<enum>";
       structdef = stagseen;
       return TRUE;
     }
@@ -2376,34 +2553,6 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
   if (typdef != tnone)
     definedef = dnone;
 
-  /* Detect GNU macros.
-
-     Writers of emacs code are recommended to put the
-     first two args of a DEFUN on the same line.
-
-      The DEFUN macro, used in emacs C source code, has a first arg
-     that is a string (the lisp function name), and a second arg that
-     is a C function name.  Since etags skips strings, the second arg
-     is tagged.  This is unfortunate, as it would be better to tag the
-     first arg.  The simplest way to deal with this problem would be
-     to name the tag with a name built from the function name, by
-     removing the initial 'F' character and substituting '-' for '_'.
-     Anyway, this assumes that the conventions of naming lisp
-     functions will never change.  Currently, this method is not
-     implemented. */
-  if (definedef == dnone && toktype == st_C_gnumacro)
-    {
-      next_token_is_func = TRUE;
-      return FALSE;
-    }
-  if (next_token_is_func)
-    {
-      next_token_is_func = FALSE;
-      fvdef = fignore;
-      *is_func_or_var = TRUE;
-      return TRUE;
-    }
-
   /* Detect Objective C constructs. */
   switch (objdef)
     {
@@ -2439,11 +2588,9 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
       if (parlev == 0)
        {
          objdef = omethodtag;
-         methodlen = len;
-         grow_linebuffer (&token_name, methodlen + 1);
+         linebuffer_setlen (&token_name, len);
          strncpy (token_name.buffer, str, len);
-         token_name.buffer[methodlen] = '\0';
-         token_name.len = methodlen;
+         token_name.buffer[len] = '\0';
          return TRUE;
        }
       return FALSE;
@@ -2455,10 +2602,8 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
       if (parlev == 0)
        {
          objdef = omethodtag;
-         methodlen += len;
-         grow_linebuffer (&token_name, methodlen + 1);
+         linebuffer_setlen (&token_name, token_name.len + len);
          strncat (token_name.buffer, str, len);
-         token_name.len = methodlen;
          return TRUE;
        }
       return FALSE;
@@ -2495,16 +2640,33 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
       *is_func_or_var = TRUE;
       return TRUE;
     case st_none:
-      if ((c_ext & C_PLPL) && strneq (str+len-10, "::operator", 10))
+      if (constantypedefs
+         && structdef == snone
+         && structtype == st_C_enum && cblev > structcblev)
+       return TRUE;            /* enum constant */
+      switch (fvdef)
        {
-         fvdef = foperator;
+       case fdefunkey:
+         if (cblev > 0)
+           break;
+         fvdef = fdefunname;   /* GNU macro */
          *is_func_or_var = TRUE;
          return TRUE;
-       }
-      if (constantypedefs && structdef == sinbody && structtype == st_C_enum)
-       return TRUE;
-      if (fvdef == fvnone)
-       {
+       case fvnone:
+         if ((strneq (str, "asm", 3) && endtoken (str[3]))
+             || (strneq (str, "__asm__", 7) && endtoken (str[7])))
+           {
+             fvdef = vignore;
+             return FALSE;
+           }
+         if ((*c_extp & C_PLPL) && strneq (str+len-10, "::operator", 10))
+           {
+             fvdef = foperator;
+             *is_func_or_var = TRUE;
+             return TRUE;
+           }
+         if (cblev > 0 && !instruct)
+           break;
          fvdef = fvnameseen;   /* function or variable */
          *is_func_or_var = TRUE;
          return TRUE;
@@ -2515,20 +2677,24 @@ consider_token (str, len, c, c_ext, cblev, parlev, is_func_or_var)
   return FALSE;
 }
 
+\f
 /*
- * C_entries ()
- *     This routine finds functions, variables, typedefs,
- *     #define's, enum constants and struct/union/enum definitions in
- *     C syntax and adds them to the list.
+ * C_entries often keeps pointers to tokens or lines which are older than
+ * the line currently read.  By keeping two line buffers, and switching
+ * them at end of line, it is possible to use those pointers.
  */
+struct
+{
+  long linepos;
+  linebuffer lb;
+} lbs[2];
+
 #define current_lb_is_new (newndx == curndx)
 #define switch_line_buffers() (curndx = 1 - curndx)
 
 #define curlb (lbs[curndx].lb)
-#define othlb (lbs[1-curndx].lb)
 #define newlb (lbs[newndx].lb)
 #define curlinepos (lbs[curndx].linepos)
-#define othlinepos (lbs[1-curndx].linepos)
 #define newlinepos (lbs[newndx].linepos)
 
 #define CNL_SAVE_DEFINEDEF()                                           \
@@ -2545,10 +2711,10 @@ do {                                                                    \
 #define CNL()                                                          \
 do {                                                                   \
   CNL_SAVE_DEFINEDEF();                                                        \
-  if (savetok.valid)                                                   \
+  if (savetoken.valid)                                                 \
     {                                                                  \
-      tok = savetok;                                                   \
-      savetok.valid = FALSE;                                           \
+      token = savetoken;                                               \
+      savetoken.valid = FALSE;                                         \
     }                                                                  \
   definedef = dnone;                                                   \
 } while (0)
@@ -2558,9 +2724,9 @@ static void
 make_C_tag (isfun)
      bool isfun;
 {
-  /* This function should never be called when tok.valid is FALSE, but
+  /* This function should never be called when token.valid is FALSE, but
      we must protect against invalid input or internal errors. */
-  if (tok.valid)
+  if (DEBUG || token.valid)
     {
       if (traditional_tag_style)
        {
@@ -2568,21 +2734,32 @@ make_C_tag (isfun)
             which uses the new method for naming tags (see new_pfnote). */
          char *name = NULL;
 
-         if (CTAGS || tok.named)
+         if (CTAGS || token.named)
            name = savestr (token_name.buffer);
-         pfnote (name, isfun,
-                 tok.buffer, tok.linelen, tok.lineno, tok.linepos);
+         if (DEBUG && !token.valid)
+           {
+             if (token.named)
+               name = concat (name, "##invalid##", "");
+             else
+               name = savestr ("##invalid##");
+           }
+         pfnote (name, isfun, token.line,
+                 token.offset+token.length+1, token.lineno, token.linepos);
        }
       else
-       new_pfnote (token_name.buffer, token_name.len, isfun,
-                   tok.buffer, tok.linelen, tok.lineno, tok.linepos);
-      tok.valid = FALSE;
+       new_pfnote (token_name.buffer, token_name.len, isfun, token.line,
+                   token.offset+token.length+1, token.lineno, token.linepos);
+      token.valid = FALSE;
     }
-  else if (DEBUG)
-    abort ();
 }
 
 
+/*
+ * C_entries ()
+ *     This routine finds functions, variables, typedefs,
+ *     #define's, enum constants and struct/union/enum definitions in
+ *     C syntax and adds them to the list.
+ */
 static void
 C_entries (c_ext, inf)
      int c_ext;                        /* extension of C */
@@ -2597,10 +2774,23 @@ C_entries (c_ext, inf)
   int qlen;                    /* length of qualifier */
   int cblev;                   /* current curly brace level */
   int parlev;                  /* current parenthesis level */
+  int typdefcblev;             /* cblev where a typedef struct body begun */
   bool incomm, inquote, inchar, quotednl, midtoken;
-  bool purec, cplpl, cjava;
-  token savetok;               /* token saved during preprocessor handling */
+  bool cplpl, cjava;
+  bool yacc_rules;             /* in the rules part of a yacc file */
+  struct tok savetoken;                /* token saved during preprocessor handling */
+
 
+  initbuffer (&token_name);
+  initbuffer (&lbs[0].lb);
+  initbuffer (&lbs[1].lb);
+  if (cstack.size == 0)
+    {
+      cstack.size = (DEBUG) ? 1 : 4;
+      cstack.nl = 0;
+      cstack.cname = xnew (cstack.size, char *);
+      cstack.cblev = xnew (cstack.size, int);
+    }
 
   tokoff = toklen = 0;         /* keep compiler quiet */
   curndx = newndx = 0;
@@ -2611,12 +2801,11 @@ C_entries (c_ext, inf)
 
   fvdef = fvnone; fvextern = FALSE; typdef = tnone;
   structdef = snone; definedef = dnone; objdef = onone;
-  next_token_is_func = yacc_rules = FALSE;
+  yacc_rules = FALSE;
   midtoken = inquote = inchar = incomm = quotednl = FALSE;
-  tok.valid = savetok.valid = FALSE;
+  token.valid = savetoken.valid = FALSE;
   cblev = 0;
   parlev = 0;
-  purec = !(c_ext & ~YACC);    /* no extensions (apart from possibly yacc) */
   cplpl = (c_ext & C_PLPL) == C_PLPL;
   cjava = (c_ext & C_JAVA) == C_JAVA;
   if (cjava)
@@ -2624,6 +2813,7 @@ C_entries (c_ext, inf)
   else
     { qualifier = "::"; qlen = 2; }
 
+
   while (!feof (inf))
     {
       c = *lp++;
@@ -2694,8 +2884,15 @@ C_entries (c_ext, inf)
          {
          case '"':
            inquote = TRUE;
-           if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
+           switch (fvdef)
              {
+             case fdefunkey:
+             case fstartlist:
+             case finlist:
+             case fignore:
+             case vignore:
+               break;
+             default:
                fvextern = FALSE;
                fvdef = fvnone;
              }
@@ -2725,11 +2922,10 @@ C_entries (c_ext, inf)
          case '%':
            if ((c_ext & YACC) && *lp == '%')
              {
-               /* entering or exiting rules section in yacc file */
+               /* Entering or exiting rules section in yacc file. */
                lp++;
                definedef = dnone; fvdef = fvnone; fvextern = FALSE;
                typdef = tnone; structdef = snone;
-               next_token_is_func = FALSE;
                midtoken = inquote = inchar = incomm = quotednl = FALSE;
                cblev = 0;
                yacc_rules = !yacc_rules;
@@ -2765,21 +2961,18 @@ C_entries (c_ext, inf)
          } /* switch (c) */
 
 
-      /* Consider token only if some complicated conditions are satisfied. */
-      if ((definedef != dnone
-          || (cblev == 0 && structdef != scolonseen)
-          || (cblev == 1 && cplpl && structdef == sinbody)
-          || (structdef == sinbody && purec))
-         && typdef != tignore
+      /* Consider token only if some involved conditions are satisfied. */
+      if (typdef != tignore
          && definedef != dignorerest
-         && fvdef != finlist)
+         && fvdef != finlist
+         && structdef != sintemplate
+         && (definedef != dnone
+             || structdef != scolonseen))
        {
          if (midtoken)
            {
              if (endtoken (c))
                {
-                 bool funorvar = FALSE;
-
                  if (c == ':' && cplpl && *lp == ':' && begtoken (lp[1]))
                    {
                      /*
@@ -2790,13 +2983,15 @@ C_entries (c_ext, inf)
                      lp += 2;
                      toklen += 2;
                      c = lp[-1];
-                     goto intok;
+                     goto still_in_token;
                    }
                  else
                    {
+                     bool funorvar = FALSE;
+
                      if (yacc_rules
                          || consider_token (newlb.buffer + tokoff, toklen, c,
-                                            c_ext, cblev, parlev, &funorvar))
+                                            &c_ext, cblev, parlev, &funorvar))
                        {
                          if (fvdef == foperator)
                            {
@@ -2810,82 +3005,107 @@ C_entries (c_ext, inf)
                              c = *lp++;
                              toklen += lp - oldlp;
                            }
-                         tok.named = FALSE;
-                         if (!purec
-                             && funorvar
-                             && definedef == dnone
-                             && structdef == sinbody)
-                           /* function or var defined in C++ class body */
+                         token.named = FALSE;
+                         if ((c_ext & C_EXT)   /* not pure C */
+                             && nestlev > 0 && definedef == dnone)
+                           /* in struct body */
                            {
-                             int len = strlen (structtag) + qlen + toklen;
-                             grow_linebuffer (&token_name, len + 1);
-                             strcpy (token_name.buffer, structtag);
+                              write_classname (&token_name, qualifier);
+                             linebuffer_setlen (&token_name,
+                                                token_name.len+qlen+toklen);
                              strcat (token_name.buffer, qualifier);
                              strncat (token_name.buffer,
                                       newlb.buffer + tokoff, toklen);
-                             token_name.len = len;
-                             tok.named = TRUE;
+                             token.named = TRUE;
                            }
                          else if (objdef == ocatseen)
                            /* Objective C category */
                            {
                              int len = strlen (objtag) + 2 + toklen;
-                             grow_linebuffer (&token_name, len + 1);
+                             linebuffer_setlen (&token_name, len);
                              strcpy (token_name.buffer, objtag);
                              strcat (token_name.buffer, "(");
                              strncat (token_name.buffer,
                                       newlb.buffer + tokoff, toklen);
                              strcat (token_name.buffer, ")");
-                             token_name.len = len;
-                             tok.named = TRUE;
+                             token.named = TRUE;
                            }
                          else if (objdef == omethodtag
                                   || objdef == omethodparm)
                            /* Objective C method */
                            {
-                             tok.named = TRUE;
+                             token.named = TRUE;
+                           }
+                         else if (fvdef == fdefunname)
+                           /* GNU DEFUN and similar macros */
+                           {
+                             bool defun = (newlb.buffer[tokoff] == 'F');
+                             int off = tokoff;
+                             int len = toklen;
+
+                             /* Rewrite the tag so that emacs lisp DEFUNs
+                                can be found by their elisp name */
+                             if (defun)
+                               {
+                                 off += 1;
+                                 len -= 1;
+                               }
+                             len = toklen;
+                             linebuffer_setlen (&token_name, len);
+                             strncpy (token_name.buffer,
+                                      newlb.buffer + off, len);
+                             token_name.buffer[len] = '\0';
+                             if (defun)
+                               while (--len >= 0)
+                                 if (token_name.buffer[len] == '_')
+                                   token_name.buffer[len] = '-';
+                             token.named = defun;
                            }
                          else
                            {
-                             grow_linebuffer (&token_name, toklen + 1);
+                             linebuffer_setlen (&token_name, toklen);
                              strncpy (token_name.buffer,
                                       newlb.buffer + tokoff, toklen);
                              token_name.buffer[toklen] = '\0';
-                             token_name.len = toklen;
                              /* Name macros and members. */
-                             tok.named = (structdef == stagseen
-                                          || typdef == ttypeseen
-                                          || typdef == tend
-                                          || (funorvar
-                                              && definedef == dignorerest)
-                                          || (funorvar
-                                              && definedef == dnone
-                                              && structdef == sinbody));
+                             token.named = (structdef == stagseen
+                                            || typdef == ttypeseen
+                                            || typdef == tend
+                                            || (funorvar
+                                                && definedef == dignorerest)
+                                            || (funorvar
+                                                && definedef == dnone
+                                                && structdef == snone
+                                                && cblev > 0));
                            }
-                         tok.lineno = lineno;
-                         tok.linelen = tokoff + toklen + 1;
-                         tok.buffer = newlb.buffer;
-                         tok.linepos = newlinepos;
-                         tok.valid = TRUE;
+                         token.lineno = lineno;
+                         token.offset = tokoff;
+                         token.length = toklen;
+                         token.line = newlb.buffer;
+                         token.linepos = newlinepos;
+                         token.valid = TRUE;
 
                          if (definedef == dnone
                              && (fvdef == fvnameseen
                                  || fvdef == foperator
                                  || structdef == stagseen
                                  || typdef == tend
+                                 || typdef == ttypeseen
                                  || objdef != onone))
                            {
                              if (current_lb_is_new)
                                switch_line_buffers ();
                            }
-                         else
+                         else if (definedef != dnone
+                                  || fvdef == fdefunname
+                                  || instruct)
                            make_C_tag (funorvar);
                        }
                      midtoken = FALSE;
                    }
                } /* if (endtoken (c)) */
              else if (intoken (c))
-               intok:
+               still_in_token:
                {
                  toklen++;
                  continue;
@@ -2910,10 +3130,13 @@ C_entries (c_ext, inf)
                      break;
                    }
                  if (structdef == stagseen && !cjava)
-                   structdef = snone;
+                   {
+                     popclass_above (cblev);
+                     structdef = snone;
+                   }
                  break;
                case dsharpseen:
-                 savetok = tok;
+                 savetoken = token;
                }
              if (!yacc_rules || lp == newlb.buffer + 1)
                {
@@ -2931,6 +3154,11 @@ C_entries (c_ext, inf)
       switch (c)
        {
        case ':':
+         if (yacc_rules && token.offset == 0 && token.valid)
+           {
+             make_C_tag (FALSE); /* a yacc function */
+             break;
+           }
          if (definedef != dnone)
            break;
          switch (objdef)
@@ -2942,65 +3170,62 @@ C_entries (c_ext, inf)
            case omethodtag:
            case omethodparm:
              objdef = omethodcolon;
-             methodlen += 1;
-             grow_linebuffer (&token_name, methodlen + 1);
+             linebuffer_setlen (&token_name, token_name.len + 1);
              strcat (token_name.buffer, ":");
-             token_name.len = methodlen;
              break;
            }
          if (structdef == stagseen)
            structdef = scolonseen;
-         else
-           switch (fvdef)
-             {
-             case fvnameseen:
-               if (yacc_rules)
-                 {
-                   make_C_tag (FALSE); /* a yacc function */
-                   fvdef = fignore;
-                 }
-               break;
-             case fstartlist:
-               fvextern = FALSE;
-               fvdef = fvnone;
-               break;
-             }
          break;
        case ';':
          if (definedef != dnone)
            break;
-         if (cblev == 0)
-           switch (typdef)
-             {
-             case tend:
-               make_C_tag (FALSE); /* a typedef */
-               /* FALLTHRU */
-             default:
-               typdef = tnone;
-             }
-         switch (fvdef)
+         switch (typdef)
            {
-           case fignore:
-             break;
-           case fvnameseen:
-             if ((members && cblev == 1)
-                 || (globals && cblev == 0 && (!fvextern || declarations)))
-               make_C_tag (FALSE); /* a variable */
-             fvextern = FALSE;
+           case tend:
+           case ttypeseen:
+             make_C_tag (FALSE); /* a typedef */
+             typdef = tnone;
              fvdef = fvnone;
-             tok.valid = FALSE;
              break;
-           case flistseen:
-             if (declarations && (cblev == 0 || cblev == 1))
-               make_C_tag (TRUE); /* a function declaration */
+           case tnone:
+           case tinbody:
+           case tignore:
+             switch (fvdef)
+               {
+               case fignore:
+                 if (typdef == tignore)
+                   fvdef = fvnone;
+                 break;
+               case fvnameseen:
+                 if ((globals && cblev == 0 && (!fvextern || declarations))
+                     || (members && instruct))
+                   make_C_tag (FALSE); /* a variable */
+                 fvextern = FALSE;
+                 fvdef = fvnone;
+                 token.valid = FALSE;
+                 break;
+               case flistseen:
+                 if ((declarations && typdef == tnone && !instruct)
+                     || (members && typdef != tignore && instruct))
+                   make_C_tag (TRUE);  /* a function declaration */
+                 /* FALLTHRU */
+               default:
+                 fvextern = FALSE;
+                 fvdef = fvnone;
+                 if (declarations
+                     && structdef == stagseen && (c_ext & C_PLPL))
+                   make_C_tag (FALSE); /* forward declaration */
+                 else
+                   /* The following instruction invalidates the token.
+                      Probably the token should be invalidated in all other
+                      cases where some state machine is reset prematurely. */
+                   token.valid = FALSE;
+               } /* switch (fvdef) */
              /* FALLTHRU */
            default:
-             fvextern = FALSE;
-             fvdef = fvnone;
-             /* The following instruction invalidates the token.
-                Probably the token should be invalidated in all
-                other cases  where some state machine is reset. */
-             tok.valid = FALSE;
+             if (!instruct)
+               typdef = tnone;
            }
          if (structdef == stagseen)
            structdef = snone;
@@ -3018,15 +3243,31 @@ C_entries (c_ext, inf)
            }
          switch (fvdef)
            {
+           case fdefunkey:
            case foperator:
+           case fstartlist:
            case finlist:
            case fignore:
            case vignore:
              break;
-           case fvnameseen:
-             if ((members && cblev == 1)
-                 || (globals && cblev == 0 && (!fvextern || declarations)))
-               make_C_tag (FALSE); /* a variable */
+           case fdefunname:
+             fvdef = fignore;
+             break;
+           case fvnameseen:    /* a variable */
+             if ((globals && cblev == 0 && (!fvextern || declarations))
+                 || (members && instruct))
+               make_C_tag (FALSE);
+             break;
+           case flistseen:     /* a function */
+             if ((declarations && typdef == tnone && !instruct)
+                 || (members && typdef != tignore && instruct))
+               {
+                 make_C_tag (TRUE); /* a function declaration */
+                 fvdef = fvnameseen;
+               }
+             else if (!declarations)
+               fvdef = fvnone;
+             token.valid = FALSE;
              break;
            default:
              fvdef = fvnone;
@@ -3037,29 +3278,35 @@ C_entries (c_ext, inf)
        case '[':
          if (definedef != dnone)
            break;
-         if (cblev == 0 && typdef == tend)
+         if (structdef == stagseen)
+           structdef = snone;
+         switch (typdef)
            {
+           case ttypeseen:
+           case tend:
              typdef = tignore;
              make_C_tag (FALSE);       /* a typedef */
              break;
-           }
-         switch (fvdef)
-           {
-           case foperator:
-           case finlist:
-           case fignore:
-           case vignore:
+           case tnone:
+           case tinbody:
+             switch (fvdef)
+               {
+               case foperator:
+               case finlist:
+               case fignore:
+               case vignore:
+                 break;
+               case fvnameseen:
+                 if ((members && cblev == 1)
+                     || (globals && cblev == 0
+                         && (!fvextern || declarations)))
+                   make_C_tag (FALSE); /* a variable */
+                 /* FALLTHRU */
+               default:
+                 fvdef = fvnone;
+               }
              break;
-           case fvnameseen:
-             if ((members && cblev == 1)
-                 || (globals && cblev == 0 && (!fvextern || declarations)))
-               make_C_tag (FALSE); /* a variable */
-             /* FALLTHRU */
-           default:
-             fvdef = fvnone;
            }
-         if (structdef == stagseen)
-           structdef = snone;
          break;
        case '(':
          if (definedef != dnone)
@@ -3070,14 +3317,15 @@ C_entries (c_ext, inf)
            {
            case fvnameseen:
              if (typdef == ttypeseen
-                 && tok.valid
                  && *lp != '*'
-                 && structdef != sinbody)
+                 && !instruct)
                {
                  /* This handles constructs like:
                     typedef void OperatorFun (int fun); */
                  make_C_tag (FALSE);
                  typdef = tignore;
+                 fvdef = fignore;
+                 break;
                }
              /* FALLTHRU */
            case foperator:
@@ -3106,7 +3354,9 @@ C_entries (c_ext, inf)
                  fvdef = flistseen;
                  break;
                }
-             if (cblev == 0 && (typdef == tend))
+             if (!instruct
+                 && (typdef == tend
+                     || typdef == ttypeseen))
                {
                  typdef = tignore;
                  make_C_tag (FALSE); /* a typedef */
@@ -3119,23 +3369,14 @@ C_entries (c_ext, inf)
          if (definedef != dnone)
            break;
          if (typdef == ttypeseen)
-           typdef = tinbody;
-         switch (structdef)
            {
-           case skeyseen:      /* unnamed struct */
-             structdef = sinbody;
-             structtag = "_anonymous_";
-             break;
-           case stagseen:
-           case scolonseen:    /* named struct */
-             structdef = sinbody;
-             make_C_tag (FALSE);       /* a struct */
-             break;
+             typdefcblev = cblev;
+             typdef = tinbody;
            }
          switch (fvdef)
            {
            case flistseen:
-             make_C_tag (TRUE); /* a function */
+             make_C_tag (TRUE);    /* a function */
              /* FALLTHRU */
            case fignore:
              fvdef = fvnone;
@@ -3154,10 +3395,24 @@ C_entries (c_ext, inf)
                  break;
                default:
                  /* Neutralize `extern "C" {' grot. */
-                 if (cblev == 0 && structdef == snone && typdef == tnone)
+                 if (cblev == 0 && structdef == snone && nestlev == 0
+                     && typdef == tnone)
                    cblev = -1;
                }
            }
+         switch (structdef)
+           {
+           case skeyseen:         /* unnamed struct */
+             pushclass_above (cblev, NULL, 0);
+             structdef = snone;
+             break;
+           case stagseen:         /* named struct or enum */
+           case scolonseen:       /* a class */
+             pushclass_above (cblev, token.line+token.offset, token.length);
+             structdef = snone;
+             make_C_tag (FALSE);  /* a struct or enum */
+             break;
+           }
          cblev++;
          break;
        case '*':
@@ -3176,20 +3431,12 @@ C_entries (c_ext, inf)
            }
          else if (cblev > 0)
            cblev--;
-         if (cblev == 0)
+         popclass_above (cblev);
+         structdef = snone;
+         if (typdef == tinbody && cblev <= typdefcblev)
            {
-             if (typdef == tinbody)
-               typdef = tend;
-             /* Memory leakage here: the string pointed by structtag is
-                never released, because I fear to miss something and
-                break things while freeing the area.  The amount of
-                memory leaked here is the sum of the lengths of the
-                struct tags.
-             if (structdef == sinbody)
-               free (structtag); */
-
-             structdef = snone;
-             structtag = "<error>";
+             assert (cblev == typdefcblev);
+             typdef = tend;
            }
          break;
        case '=':
@@ -3211,6 +3458,20 @@ C_entries (c_ext, inf)
              fvdef = vignore;
            }
          break;
+       case '<':
+         if (cplpl && structdef == stagseen)
+           {
+             structdef = sintemplate;
+             break;
+           }
+         goto resetfvdef;
+       case '>':
+         if (structdef == sintemplate)
+           {
+             structdef = stagseen;
+             break;
+           }
+         goto resetfvdef;
        case '+':
        case '-':
          if (objdef == oinbody && cblev == 0)
@@ -3219,8 +3480,9 @@ C_entries (c_ext, inf)
              break;
            }
          /* FALLTHRU */
+       resetfvdef:
        case '#': case '~': case '&': case '%': case '/': case '|':
-       case '^': case '!': case '<': case '>': case '.': case '?': case ']':
+       case '^': case '!': case '.': case '?': case ']':
          if (definedef != dnone)
            break;
          /* These surely cannot follow a function tag in C. */
@@ -3250,6 +3512,10 @@ C_entries (c_ext, inf)
        } /* switch (c) */
 
     } /* while not eof */
+
+  free (token_name.buffer);
+  free (lbs[0].lb.buffer);
+  free (lbs[1].lb.buffer);
 }
 
 /*
@@ -3260,10 +3526,10 @@ static void
 default_C_entries (inf)
      FILE *inf;
 {
-  C_entries (cplusplus ? C_PLPL : 0, inf);
+  C_entries (cplusplus ? C_PLPL : C_AUTO, inf);
 }
 
-/* Always do plain ANSI C. */
+/* Always do plain C. */
 static void
 plain_C_entries (inf)
      FILE *inf;
@@ -3302,6 +3568,7 @@ Yacc_entries (inf)
 {
   C_entries (YACC, inf);
 }
+
 \f
 /* A useful macro. */
 #define LOOP_ON_INPUT_LINES(file_pointer, line_buffer, char_pointer)   \
@@ -3328,6 +3595,7 @@ just_read_file (inf)
   LOOP_ON_INPUT_LINES (inf, lb, dummy)
     continue;
 }
+
 \f
 /* Fortran parsing */
 
@@ -3364,14 +3632,14 @@ takeprec ()
       dbp += 3;
       return;
     }
-  if (!isdigit ((unsigned char) *dbp))
+  if (!ISDIGIT (*dbp))
     {
       --dbp;                   /* force failure */
       return;
     }
   do
     dbp++;
-  while (isdigit ((unsigned char) *dbp));
+  while (ISDIGIT (*dbp));
 }
 
 static void
@@ -3392,7 +3660,7 @@ getit (inf)
       dbp += 6;
       dbp = skip_spaces (dbp);
     }
-  if (!isalpha ((unsigned char) *dbp) && *dbp != '_' && *dbp != '$')
+  if (!ISALPHA (*dbp) && *dbp != '_' && *dbp != '$')
     return;
   for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
     continue;
@@ -3473,10 +3741,11 @@ Fortran_functions (inf)
        }
     }
 }
+
 \f
 /*
- * Philippe Waroquiers <philippe.waroquiers@eurocontrol.be>, 1998-04-24
  * Ada parsing
+ * Philippe Waroquiers <philippe.waroquiers@eurocontrol.be> (1998)
  */
 
 static void adagetit P_((FILE *, char *));
@@ -3533,7 +3802,7 @@ adagetit (inf, name_qualifier)
          dbp = skip_spaces (dbp);
          for (cp = dbp;
               (*cp != '\0'
-               && (isalpha ((unsigned char) *cp) || isdigit ((unsigned char) *cp) || *cp == '_' || *cp == '.'));
+               && (ISALPHA (*cp) || ISDIGIT (*cp) || *cp == '_' || *cp == '.'));
               cp++)
            continue;
          if (cp == dbp)
@@ -3641,6 +3910,7 @@ Ada_funcs (inf)
        } /* advance char */
     } /* advance line */
 }
+
 \f
 /*
  * Bob Weiner, Motorola Inc., 4/3/94
@@ -3657,11 +3927,11 @@ Asm_labels (inf)
     {
       /* If first char is alphabetic or one of [_.$], test for colon
         following identifier. */
-      if (isalpha ((unsigned char) *cp) || *cp == '_' || *cp == '.' || *cp == '$')
+      if (ISALPHA (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
        {
          /* Read past label. */
          cp++;
-         while (isalnum ((unsigned char) *cp) || *cp == '_' || *cp == '.' || *cp == '$')
+         while (ISALNUM (*cp) || *cp == '_' || *cp == '.' || *cp == '$')
            cp++;
          if (*cp == ':' || iswhite (*cp))
            {
@@ -3672,12 +3942,14 @@ Asm_labels (inf)
        }
     }
 }
+
 \f
 /*
- * Perl support by Bart Robinson <lomew@cs.utah.edu>
- *              enhanced by Michael Ernst <mernst@alum.mit.edu>
+ * Perl support
  * Perl sub names: look for /^sub[ \t\n]+[^ \t\n{]+/
  * Perl variable names: /^(my|local).../
+ * Bart Robinson <lomew@cs.utah.edu> (1995)
+ * Michael Ernst <mernst@alum.mit.edu> (1997)
  */
 static void
 Perl_functions (inf)
@@ -3721,7 +3993,7 @@ Perl_functions (inf)
          if (*cp == '$' || *cp == '@' || *cp == '%')
            {
              char* varstart = ++cp;
-             while (isalnum ((unsigned char) *cp) || *cp == '_')
+             while (ISALNUM (*cp) || *cp == '_')
                cp++;
              varname = savenstr (varstart, cp-varstart);
            }
@@ -3740,10 +4012,12 @@ Perl_functions (inf)
        }
     }
 }
+
 \f
 /*
- * Python support by Eric S. Raymond <esr@thyrsus.com>
+ * Python support
  * Look for /^def[ \t\n]+[^ \t\n(:]+/ or /^class[ \t\n]+[^ \t\n(:]+/
+ * Eric S. Raymond <esr@thyrsus.com> (1997)
  */
 static void
 Python_functions (inf)
@@ -3779,6 +4053,7 @@ Python_functions (inf)
        }
     }
 }
+
 \f
 /* Idea by Corny de Souza
  * Cobol tag functions
@@ -3798,16 +4073,40 @@ Cobol_paragraphs (inf)
       bp += 8;
 
       /* If eoln, compiler option or comment ignore whole line. */
-      if (bp[-1] != ' ' || !isalnum ((unsigned char) bp[0]))
+      if (bp[-1] != ' ' || !ISALNUM (bp[0]))
         continue;
 
-      for (ep = bp; isalnum ((unsigned char) *ep) || *ep == '-'; ep++)
+      for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
        continue;
       if (*ep++ == '.')
        pfnote (savenstr (bp, ep-bp), TRUE,
                lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
     }
 }
+
+\f
+/*
+ * Makefile support
+ * Idea by Assar Westerlund <assar@sics.se> (2001)
+ */
+static void
+Makefile_targets (inf)
+     FILE *inf;
+{
+  register char *bp;
+
+  LOOP_ON_INPUT_LINES (inf, lb, bp)
+    {
+      if (*bp == '\t' || *bp == '#')
+       continue;
+      while (*bp != '\0' && *bp != '=' && *bp != ':')
+       bp++;
+      if (*bp == ':')
+       pfnote (savenstr (lb.buffer, bp - lb.buffer), TRUE,
+               lb.buffer, bp - lb.buffer + 1, lineno, linecharno);
+    }
+}
+
 \f
 /* Added by Mosur Mohan, 4/22/88 */
 /* Pascal parsing                */
@@ -3954,7 +4253,7 @@ Pascal_functions (inf)
            continue;
 
          /* save all values for later tagging */
-         grow_linebuffer (&tline, lb.len + 1);
+         linebuffer_setlen (&tline, lb.len);
          strcpy (tline.buffer, lb.buffer);
          save_lineno = lineno;
          save_lcno = linecharno;
@@ -3990,9 +4289,10 @@ Pascal_functions (inf)
 
   free (tline.buffer);
 }
+
 \f
 /*
- * lisp tag functions
+ * Lisp tag functions
  *  look for (def or (DEF, quote or QUOTE
  */
 
@@ -4086,13 +4386,14 @@ Lisp_functions (inf)
        }
     }
 }
+
 \f
 /*
  * Postscript tag functions
  * Just look for lines where the first character is '/'
- * Richard Mlynarik <mly@adoc.xerox.com>
  * Also look at "defineps" for PSWrap
- * suggested by Masatake YAMATO <masata-y@is.aist-nara.ac.jp>
+ * Richard Mlynarik <mly@adoc.xerox.com> (1997)
+ * Ideas by Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999)
  */
 static void
 Postscript_functions (inf)
@@ -4161,6 +4462,7 @@ Scheme_functions (inf)
        }
     }
 }
+
 \f
 /* Find tags in TeX and LaTeX input files.  */
 
@@ -4194,7 +4496,7 @@ char TEX_clgrp = '}';
  * TeX/LaTeX scanning loop.
  */
 static void
-TeX_functions (inf)
+TeX_commands (inf)
      FILE *inf;
 {
   char *cp, *lasthit;
@@ -4343,6 +4645,31 @@ TEX_Token (cp)
       return i;
   return -1;
 }
+
+\f
+/* Texinfo support.  Dave Love, Mar. 2000.  */
+static void
+Texinfo_nodes (inf)
+     FILE * inf;
+{
+  char *cp, *start;
+  LOOP_ON_INPUT_LINES (inf, lb, cp)
+    {
+      if ((*cp++ == '@'
+          && *cp++ == 'n'
+          && *cp++ == 'o'
+          && *cp++ == 'd'
+          && *cp++ == 'e' && iswhite (*cp++)))
+       {
+         start = cp = skip_spaces(cp);
+         while (*cp != '\0' && *cp != ',')
+           cp++;
+         pfnote (savenstr (start, cp - start), TRUE,
+                 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
+       }
+    }
+}
+
 \f
 /*
  * Prolog support (rewritten) by Anders Lindgren, Mar. 96
@@ -4381,7 +4708,7 @@ Prolog_functions (inf)
          if (last == NULL)
            last = xnew(len + 1, char);
          else if (len + 1 > allocated)
-           last = xrnew (last, len + 1, char);
+           xrnew (last, len + 1, char);
          allocated = len + 1;
          strncpy (last, cp, len);
          last[len] = '\0';
@@ -4468,11 +4795,11 @@ prolog_atom (s, pos)
 
   origpos = pos;
 
-  if (islower((unsigned char) s[pos]) || (s[pos] == '_'))
+  if (ISLOWER(s[pos]) || (s[pos] == '_'))
     {
       /* The atom is unquoted. */
       pos++;
-      while (isalnum((unsigned char) s[pos]) || (s[pos] == '_'))
+      while (ISALNUM(s[pos]) || (s[pos] == '_'))
        {
          pos++;
        }
@@ -4508,6 +4835,7 @@ prolog_atom (s, pos)
   else
     return -1;
 }
+
 \f
 /*
  * Support for Erlang  --  Anders Lindgren, Feb 1996.
@@ -4556,7 +4884,7 @@ Erlang_functions (inf)
          if (last == NULL)
            last = xnew (len + 1, char);
          else if (len + 1 > allocated)
-           last = xrnew (last, len + 1, char);
+           xrnew (last, len + 1, char);
          allocated = len + 1;
          strncpy (last, cp, len);
          last[len] = '\0';
@@ -4649,11 +4977,11 @@ erlang_atom (s, pos)
 
   origpos = pos;
 
-  if (isalpha ((unsigned char) s[pos]) || s[pos] == '_')
+  if (ISALPHA (s[pos]) || s[pos] == '_')
     {
       /* The atom is unquoted. */
       pos++;
-      while (isalnum ((unsigned char) s[pos]) || s[pos] == '_')
+      while (ISALNUM (s[pos]) || s[pos] == '_')
        pos++;
       return pos - origpos;
     }
@@ -4685,6 +5013,7 @@ erlang_atom (s, pos)
   else
     return -1;
 }
+
 \f
 #ifdef ETAGS_REGEXPS
 
@@ -4792,7 +5121,7 @@ analyse_regex (regex_arg, ignore_case)
              return;
            }
        *cp = '\0';
-       lang = get_language_from_name (lang_name);
+       lang = get_language_from_langname (lang_name);
        if (lang == NULL)
          return;
        add_regex (cp + 1, ignore_case, lang);
@@ -4840,10 +5169,6 @@ add_regex (regexp_pattern, ignore_case, lang)
   patbuf->buffer = NULL;
   patbuf->allocated = 0;
 
-#if 0 /* useful when debugging windows quoting convention problems */
-  printf ("Compiling regex pattern: %s\n", regexp_pattern);
-#endif
-
   err = re_compile_pattern (regexp_pattern, strlen (regexp_pattern), patbuf);
   if (err != NULL)
     {
@@ -4882,7 +5207,7 @@ substitute (in, out, regs)
   for (t = etags_strchr (out, '\\');
        t != NULL;
        t = etags_strchr (t + 2, '\\'))
-    if (isdigit ((unsigned char) t[1]))
+    if (ISDIGIT (t[1]))
       {
        dig = t[1] - '0';
        diglen = regs->end[dig] - regs->start[dig];
@@ -4895,9 +5220,8 @@ substitute (in, out, regs)
   result = xnew (size + 1, char);
 
   for (t = result; *out != '\0'; out++)
-    if (*out == '\\' && isdigit ((unsigned char) *++out))
+    if (*out == '\\' && ISDIGIT (*++out))
       {
-       /* Using "dig2" satisfies my debugger.  Bleah. */
        dig = *out - '0';
        diglen = regs->end[dig] - regs->start[dig];
        strncpy (t, in + regs->start[dig], diglen);
@@ -4907,8 +5231,7 @@ substitute (in, out, regs)
       *t++ = *out;
   *t = '\0';
 
-  if (DEBUG && (t > result + size || t - result != (int)strlen (result)))
-    abort ();
+  assert (t <= result + size && t - result == (int)strlen (result));
 
   return result;
 }
@@ -4928,6 +5251,8 @@ free_patterns ()
     }
   return;
 }
+#endif /* ETAGS_REGEXPS */
+
 \f
 static void
 get_tag (bp)
@@ -4946,14 +5271,15 @@ get_tag (bp)
          lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
 }
 
-#endif /* ETAGS_REGEXPS */
 /* Initialize a linebuffer for use */
 static void
 initbuffer (lbp)
      linebuffer *lbp;
 {
-  lbp->size = 200;
-  lbp->buffer = xnew (200, char);
+  lbp->size = (DEBUG) ? 3 : 200;
+  lbp->buffer = xnew (lbp->size, char);
+  lbp->buffer[0] = '\0';
+  lbp->len = 0;
 }
 
 /*
@@ -4985,7 +5311,7 @@ readline_internal (lbp, stream)
        {
          /* We're at the end of linebuffer: expand it. */
          lbp->size *= 2;
-         buffer = xrnew (buffer, lbp->size, char);
+         xrnew (buffer, lbp->size, char);
          p += buffer - lbp->buffer;
          pend = buffer + lbp->size;
          lbp->buffer = buffer;
@@ -5001,7 +5327,7 @@ readline_internal (lbp, stream)
          if (p > buffer && p[-1] == '\r')
            {
              p -= 1;
-#ifdef WIN32_NATIVE
+#ifdef DOS_NT
             /* Assume CRLF->LF translation will be performed by Emacs
                when loading this file, so CRs won't appear in the buffer.
                It would be cleaner to compensate within Emacs;
@@ -5086,6 +5412,7 @@ readline (lbp, stream)
 
   return result;
 }
+
 \f
 /*
  * Return a pointer to a space of size strlen(cp)+1 allocated
@@ -5178,7 +5505,7 @@ skip_non_spaces (cp)
 }
 
 /* Print error message and exit.  */
-static void
+void
 fatal (s1, s2)
      char *s1, *s2;
 {
@@ -5234,6 +5561,7 @@ concat (s1, s2, s3)
 
   return result;
 }
+
 \f
 /* Does the same work as the system V getcwd, but does not need to
    guess the buffer size in advance. */
@@ -5257,6 +5585,20 @@ etags_getcwd ()
   return path;
 
 #else /* not HAVE_GETCWD */
+#if MSDOS
+
+  char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS.  */
+
+  getwd (path);
+
+  for (p = path; *p != '\0'; p++)
+    if (*p == '\\')
+      *p = '/';
+    else
+      *p = lowcase (*p);
+
+  return strdup (path);
+#else /* not MSDOS */
   linebuffer path;
   FILE *pipe;
 
@@ -5267,6 +5609,7 @@ etags_getcwd ()
   pclose (pipe);
 
   return path.buffer;
+#endif /* not MSDOS */
 #endif /* not HAVE_GETCWD */
 }
 
@@ -5286,7 +5629,7 @@ relative_filename (file, dir)
   while (*fp++ == *dp++)
     continue;
   fp--, dp--;                  /* back to the first differing char */
-#ifdef WIN32_NATIVE
+#ifdef DOS_NT
   if (fp == afn && afn[0] != '/') /* cannot build a relative name */
     return afn;
 #endif
@@ -5320,7 +5663,7 @@ absolute_filename (file, dir)
 
   if (filename_is_absolute (file))
     res = savestr (file);
-#ifdef WIN32_NATIVE
+#ifdef DOS_NT
   /* We don't support non-absolute file names with a drive
      letter, like `d:NAME' (it's too much hassle).  */
   else if (file[1] == ':')
@@ -5344,8 +5687,8 @@ absolute_filename (file, dir)
              while (cp >= res && !filename_is_absolute (cp));
              if (cp < res)
                cp = slashp;    /* the absolute name begins with "/.." */
-#ifdef WIN32_NATIVE
-             /* Under Windows we get `d:/NAME' as absolute
+#ifdef DOS_NT
+             /* Under MSDOS and NT we get `d:/NAME' as absolute
                 file name, so the luser could say `d:/../NAME'.
                 We silently treat this as `d:/NAME'.  */
              else if (cp[0] != '/')
@@ -5400,8 +5743,8 @@ filename_is_absolute (fn)
      char *fn;
 {
   return (fn[0] == '/'
-#ifdef WIN32_NATIVE
-         || (isalpha(fn[0]) && fn[1] == ':' && fn[2] == '/')
+#ifdef DOS_NT
+         || (ISALPHA(fn[0]) && fn[1] == ':' && fn[2] == '/')
 #endif
          );
 }
@@ -5411,10 +5754,10 @@ static void
 canonicalize_filename (fn)
      register char *fn;
 {
-#ifdef WIN32_NATIVE
+#ifdef DOS_NT
   /* Canonicalize drive letter case.  */
-  if (islower (fn[0]) && fn[1] == ':')
-    fn[0] = toupper (fn[0]);
+  if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0]))
+    fn[0] = upcase (fn[0]);
   /* Convert backslashes to slashes.  */
   for (; *fn != '\0'; fn++)
     if (*fn == '\\')
@@ -5425,19 +5768,22 @@ canonicalize_filename (fn)
 #endif
 }
 
-/* Increase the size of a linebuffer. */
+/* Set the minimum size of a string contained in a linebuffer. */
 static void
-grow_linebuffer (lbp, toksize)
+linebuffer_setlen (lbp, toksize)
      linebuffer *lbp;
      int toksize;
 {
-  while (lbp->size < toksize)
-    lbp->size *= 2;
-  lbp->buffer = xrnew (lbp->buffer, lbp->size, char);
+  while (lbp->size <= toksize)
+    {
+      lbp->size *= 2;
+      xrnew (lbp->buffer, lbp->size, char);
+    }
+  lbp->len = toksize;
 }
 
 /* Like malloc but get fatal error if memory is exhausted.  */
-static long *
+long *
 xmalloc (size)
      unsigned int size;
 {
@@ -5447,7 +5793,7 @@ xmalloc (size)
   return result;
 }
 
-static long *
+long *
 xrealloc (ptr, size)
      char *ptr;
      unsigned int size;
index 9901186..d4c1630 100644 (file)
@@ -103,7 +103,7 @@ tell_emacs_to_resume (int sig)
   signal(SIGCONT, tell_emacs_to_resume);
 #endif
 
-  connect_type = make_connection (NULL, (u_short) 0, &s);
+  connect_type = make_connection (NULL, 0, &s);
 
   sprintf(buffer,"(gnuserv-eval '(resume-pid-console %d))", (int)getpid());
   send_string(s, buffer);
@@ -156,11 +156,11 @@ get_current_working_directory (void)
 {
   if (cp == NULL)
     {                          /* haven't calculated it yet */
-#ifdef BSD
-      if (getwd (cwd) == 0)
-#else /* !BSD */
+#ifdef HAVE_GETCWD
       if (getcwd (cwd,MAXPATHLEN) == NULL)
-#endif /* !BSD */
+#else
+      if (getwd (cwd) == 0)
+#endif /* HAVE_GETCWD */
        {
          perror (progname);
          fprintf (stderr, "%s: unable to get current working directory\n",
@@ -337,7 +337,7 @@ main (int argc, char *argv[])
   char *path;
   int rflg = 0;                        /* pathname given on cmdline */
   char *portarg;
-  u_short port = 0;            /* port to server */
+  unsigned short port = 0;     /* port to server */
 #endif /* INTERNET_DOMAIN_SOCKETS */
 #ifdef SYSV_IPC
   struct msgbuf *msgp;         /* message */
@@ -488,7 +488,7 @@ main (int argc, char *argv[])
 #if defined(INTERNET_DOMAIN_SOCKETS)
       connect_type = make_connection (hostarg, port, &s);
 #else
-      connect_type = make_connection (NULL, (u_short) 0, &s);
+      connect_type = make_connection (NULL, 0, &s);
 #endif
       sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : "");
       send_string (s, command);
@@ -526,7 +526,7 @@ main (int argc, char *argv[])
 #if defined(INTERNET_DOMAIN_SOCKETS)
       connect_type = make_connection (hostarg, port, &s);
 #else
-      connect_type = make_connection (NULL, (u_short) 0, &s);
+      connect_type = make_connection (NULL, 0, &s);
 #endif
       sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : "");
       send_string (s, command);
@@ -560,7 +560,7 @@ main (int argc, char *argv[])
 #if defined(INTERNET_DOMAIN_SOCKETS)
          connect_type = make_connection (hostarg, port, &s);
 #else
-         connect_type = make_connection (NULL, (u_short) 0, &s);
+         connect_type = make_connection (NULL, 0, &s);
 #endif
          send_string (s, "(gnuserv-eval '(emacs-pid))");
          send_string (s, EOT_STR);
@@ -585,7 +585,7 @@ main (int argc, char *argv[])
 #if defined(INTERNET_DOMAIN_SOCKETS)
       connect_type = make_connection (hostarg, port, &s);
 #else
-      connect_type = make_connection (NULL, (u_short) 0, &s);
+      connect_type = make_connection (NULL, 0, &s);
 #endif
 
 #ifdef INTERNET_DOMAIN_SOCKETS
index b90443d..2ba5785 100644 (file)
@@ -378,7 +378,7 @@ handle_response (void)
 
 #ifdef INTERNET_DOMAIN_SOCKETS
 struct entry {
-  u_long host_addr;
+  unsigned long host_addr;
   struct entry *next;
 };
 
@@ -450,7 +450,7 @@ timed_read (int fd, char *buf, int max, int timeout, int one_line)
   permitted -- return whether a given host is allowed to connect to the server.
 */
 static int
-permitted (u_long host_addr, int fd)
+permitted (unsigned long host_addr, int fd)
 {
   int key;
   struct entry *entry;
@@ -560,7 +560,7 @@ permitted (u_long host_addr, int fd)
               already there.
 */
 static void
-add_host (u_long host_addr)
+add_host (unsigned long host_addr)
 {
   int key;
   struct entry *new_entry;
@@ -596,7 +596,7 @@ setup_table (void)
   FILE *host_file;
   char *file_name;
   char hostname[HOSTNAMSZ];
-  u_int host_addr;
+  unsigned int host_addr;
   int i, hosts=0;
 
   /* Make sure every entry is null */
index c16aa31..f0226e6 100644 (file)
@@ -43,7 +43,7 @@ static int connect_to_ipc_server (void);
 static int connect_to_unix_server (void);
 #endif
 #ifdef INTERNET_DOMAIN_SOCKETS
-static int connect_to_internet_server (char *serverhost, u_short port);
+static int connect_to_internet_server (char *serverhost, unsigned short port);
 #endif
 
 /* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
@@ -313,7 +313,7 @@ static Xauth *server_xauth = NULL;
                                descriptor for server if successful.
 */
 static int
-connect_to_internet_server (char *serverhost, u_short port)
+connect_to_internet_server (char *serverhost, unsigned short port)
 {
   int s;                               /* connected socket descriptor */
   struct servent *sp;                  /* pointer to service information */
index 79160eb..0bf05de 100644 (file)
@@ -95,7 +95,7 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
 #ifdef KERBEROS
 #ifndef KRB5
 extern int krb_sendauth (/* long, int, KTEXT, char *, char *, char *,
-                           u_long, MSG_DAT *, CREDENTIALS *, Key_schedule,
+                           unsigned long, MSG_DAT *, CREDENTIALS *, Key_schedule,
                            struct sockaddr_in *, struct sockaddr_in *,
                            char * */);
 extern char *krb_realmofhost (/* char * */);
index 03d4392..094ca43 100644 (file)
@@ -17,7 +17,7 @@
 ;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with XEmacs; see the file COPYING.  If not, write to the 
+;; along with XEmacs; see the file COPYING.  If not, write to the
 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
@@ -91,11 +91,13 @@ This can be slightly disconcerting, but some people may prefer it."
        (amt (if (memq 'shift (event-modifiers event))
                 (cdr mwheel-scroll-amount)
               (car mwheel-scroll-amount))))
-    (case (mwheel-event-button event)
-      (4 (scroll-down amt))
-      (5 (scroll-up amt))
-      (otherwise (error "Bad binding in mwheel-scroll")))
-    (if curwin (select-window curwin))))
+    (unwind-protect
+       (case (mwheel-event-button event)
+         (4 (scroll-down amt))
+         (5 (scroll-up amt))
+         (otherwise (error "Bad binding in mwheel-scroll")))
+      (if curwin (select-window curwin)))
+    ))
 
 ;;;###autoload
 (defun mwheel-install ()
@@ -112,7 +114,7 @@ This can be slightly disconcerting, but some people may prefer it."
          (define-key global-map (car keys) 'mwheel-scroll)
          (setq keys (cdr keys)))
       (error nil))))
-    
+
 (provide 'mwheel)
 
 ;;; mwheel.el ends here
index 2857165..46e277c 100644 (file)
   )
 
 ;; #### This should really be a list.  --hniksic
-(defcustom sound-extension-list (if (or (eq system-type 'cygwin32)
-                                       (eq system-type 'windows-nt))
-                                   ".wav:" ".au:")
+(defcustom sound-extension-list (cond ((or (eq system-type 'cygwin32)
+                                          (eq system-type 'windows-nt))
+                                      ".wav:")
+                                     ((eq system-type 'linux)
+                                      ".wav:.au:")
+                                     (t
+                                      ".au:"))
   "Filename extensions to complete sound file name with. If more than one
    extension is used, they should be separated by \":\". "
   :group 'sound
   :type 'string)
 
 (defcustom default-sound-directory-list (locate-data-directory-list "sounds")
-
   "List of directories which to search for sound files"
   :group 'sound
   :type '(repeat directory )
 (defun load-sound-file (filename sound-name &optional volume)
   "Read in an audio-file and add it to the sound-alist.
 
+FILENAME can either be absolute or relative, in which case the file will
+be searched in the directories given by `default-sound-directory-list'.
+When looking for the file, the extensions given by `sound-extension-list' are
+also tried in the given order.
+
 You can only play sound files if you are running on display 0 of the
 console of a machine with native sound support or running a NetAudio
 server and XEmacs has the necessary sound support compiled in.
@@ -143,10 +151,18 @@ nVolume (0 for default): ")
     (error "sound-name not a symbol"))
   (unless (or (null volume) (integerp volume))
     (error "volume not an integer or nil"))
-  (let (buf
-       data
-       (file (locate-file filename default-sound-directory-list
-                          sound-extension-list)))
+  (let ((file (if (file-name-absolute-p filename)
+                 ;; For absolute file names, we don't have on choice on the
+                 ;; location, but sound extensions however can still be tried
+                 (setq file (locate-file filename
+                                         (list (file-name-directory filename))
+                                         (split-string sound-extension-list
+                                                       ":")))
+               (setq file (locate-file filename
+                                       default-sound-directory-list
+                                       (split-string sound-extension-list
+                                                     ":")))))
+       buf data)
     (unless file
       (error "Couldn't load sound file %s" filename))
     (unwind-protect
index d81bceb..d3dad72 100644 (file)
@@ -1,3 +1,27 @@
+2001-02-08  Martin Buchholz <martin@xemacs.org>
+
+       * XEmacs 21.2.44 "Thalia" is released.
+
+2001-02-06  Martin Buchholz  <martin@xemacs.org>
+
+       * xlwgauge.c:
+       * xlwgcs.c:
+       * xlwgcs.c (XtAllocateGC): Fix typo for X11R4.
+       * xlwgcs.h:
+       * xlwradio.c (RadioExpose):
+       * xlwcheckbox.c:
+       Remove use of BSD-specific types.
+       s/u_(char|short|int_long)/unsigned $1/g
+
+2001-02-05  Martin Buchholz  <martin@xemacs.org>
+
+       * lwlib-Xm.c (xm_update_one_value):
+       Obey the man page; use XtFree instead of free.
+
+2001-02-02  Martin Buchholz  <martin@xemacs.org>
+
+       * config.h.in: Use "..." to include config.h
+
 2001-01-26  Martin Buchholz <martin@xemacs.org>
 
        * XEmacs 21.2.43 "Terspichore" is released.
index 0a7be10..00d3af1 100644 (file)
@@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #ifndef _LWLIB_CONFIG_H_
 #define _LWLIB_CONFIG_H_
 
-#include <../src/config.h>
+#include "../src/config.h"
 
 #undef NEED_MOTIF
 #undef NEED_ATHENA
index 2903ede..3e25262 100644 (file)
@@ -889,14 +889,14 @@ xm_update_one_value (widget_instance* instance, Widget widget,
   else if (class == xmTextWidgetClass)
     {
       if (val->value)
-       free (val->value);
+       XtFree (val->value);
       val->value = XmTextGetString (widget);
       val->edited = True;
     }
   else if (class == xmTextFieldWidgetClass)
     {
       if (val->value)
-       free (val->value);
+       XtFree (val->value);
       val->value = XmTextFieldGetString (widget);
       val->edited = True;
     }
index e59e0ef..e92f405 100644 (file)
@@ -1,3 +1,20 @@
+2001-02-08  Martin Buchholz <martin@xemacs.org>
+
+       * XEmacs 21.2.44 "Thalia" is released.
+
+2001-02-04  Steve Youngs  <youngs@xemacs.org>
+
+       * xemacs/xemacs.texi: Update to accomodate new and improved
+       packages.texi.
+
+       * xemacs/packages.texi: Basically, apart from a few things,
+       rewritten from scratch.
+
+2001-01-27  Martin Buchholz  <martin@xemacs.org>
+
+       * lispref/variables.texi (max-specpdl-size): Correct default value.
+       * lispref/eval.texi (max-lisp-eval-depth): Correct default value.
+
 2001-01-26  Martin Buchholz <martin@xemacs.org>
 
        * XEmacs 21.2.43 "Terspichore" is released.
index 71ce6d2..3b378cd 100644 (file)
@@ -182,7 +182,7 @@ This limit, with the associated error when it is exceeded, is one way
 that Lisp avoids infinite recursion on an ill-defined function.
 @cindex Lisp nesting error
 
-The default value of this variable is 500.  If you set it to a value
+The default value of this variable is 1000.  If you set it to a value
 less than 100, Lisp will reset it to 100 if the given value is reached.
 
 @code{max-specpdl-size} provides another limit on nesting.
index 6d3cc9d..21aa3af 100644 (file)
@@ -251,7 +251,7 @@ binding depth exceeds max-specpdl-size"}).
   This limit, with the associated error when it is exceeded, is one way
 that Lisp avoids infinite recursion on an ill-defined function.
 
-  The default value is 600.
+  The default value is 3000.
 
   @code{max-lisp-eval-depth} provides another limit on depth of nesting.
 @xref{Eval}.
index e2202d8..5aaeeaf 100644 (file)
@@ -17,15 +17,16 @@ local needs with safe removal of unnecessary code.
 
 @menu
 * Package Terminology:: Understanding different kinds of packages.
-* Using Packages::      How to install and use packages.
-* Building Packages::   Building packages from sources.
+* Installing Packages:: How to install packages.
+* Building Packages::   Building packages from CVS sources.
+* Local.rules File::    This is an important file don't forget to create/edit it.
 * Creating Packages::   The basics.
-* Available Packages::  A brief, out-of-date, directory of packaged LISP.
+* Available Packages::  A brief directory of packaged LISP.
 @end menu
 
-@node Package Terminology, Using Packages, , Packages
+@node Package Terminology, Installing Packages, , Packages
 @comment  node-name,  next,  previous,  up
-
+@heading Package Terminology:
 @subsection Package Flavors
 
 There are two main flavors of packages.
@@ -41,13 +42,14 @@ may not in general safely remove any of them.
 A single-file package is an aggregate collection of thematically
 related but otherwise independent lisp files.  These files are bundled 
 together for download convenience and individual files may be deleted at
-will without any loss of functionality.
+will without any loss of functionality.  However, we would recommend
+that you follow this rule of thumb: "When in doubt, don't delete".
 @end itemize
 
 @subsection Package Distributions
-
+@cindex package distributions
 XEmacs Lisp packages are distributed in two ways, depending on the
-intended use.  Binary Packages are for installers and end-users and may
+intended use.  Binary Packages are for installers and end-users that can
 be installed directly into an XEmacs package directory.  Source Packages
 are for developers and include all files necessary for rebuilding
 bytecompiled lisp and creating tarballs for distribution.
@@ -64,16 +66,20 @@ in regular packages) source code plus all of the files necessary to
 build distribution tarballs (Unix Tar format files, gzipped for space
 savings).
 
-@node Using Packages, Building Packages, Package Terminology, Packages
+Currently, source packages are only available via CVS.  See
+@url{http://cvs.xemacs.org/} for details.
+@node Installing Packages, Building Packages, Package Terminology, Packages
 @comment  node-name,  next,  previous,  up
-
+@cindex installing packages
+@cindex install
+@heading Installing Packages:
 @subsection Getting Started
 
 When you first download XEmacs 21, you will usually first grab the
 @dfn{core distribution},
 @cindex core distribution
 a file called
-@file{xemacs-21.0.tar.gz}. (Replace the @t{21.0} by the current version
+@file{xemacs-21.x.x.tar.gz}. (Replace the @t{21.x.x} by the current version
 number.)  The core distribution contains the sources of XEmacs and a
 minimal set of Emacs Lisp files, which are in the subdirectory named
 @file{lisp}.  This subdirectory used to contain all Emacs Lisp files
@@ -81,10 +87,10 @@ distributed with XEmacs.  Now, to conserve disk space, most
 non-essential packages were made optional.
 
 @subsection Choosing the Packages You Need
-
-The available packages can currently be found in the same ftp directory
+@cindex choosing packages
+The @ref{Available Packages} can currently be found in the same ftp directory
 where you grabbed the core distribution from, and are located in the
-subdirectory @file{packages/binary-packages}.  Package file names follow
+subdirectory @file{packages}.  Package file names follow
 the naming convention @file{<package-name>-<version>-pkg.tar.gz}.
 
 If you have EFS @ref{(EFS)}, packages can be installed over the network.
@@ -92,11 +98,11 @@ Alternatively, if you have copies of the packages locally, you can
 install packages from a local disk or CDROM.
 
 The file @file{etc/PACKAGES} in the core distribution contains a list of
-the packages available at the time of the XEmacs release.  Packages are
+the @ref{Available Packages} at the time of the XEmacs release.  Packages are
 also listed on the @code{Options} menu under:
 
 @example
-        Options->Customize->Emacs->Packages
+        Options -> Customize -> Emacs -> Packages
 @end example
 
 However, don't select any of these menu picks unless you actually want 
@@ -108,7 +114,7 @@ are installed, using the visual package browser and installer.  You can
 access it via the menus:
 
 @example
-        Options->Manage Packages->List & Install
+        Options -> Manage Packages -> List & Install
 @end example
 
 Or, you can get to it via the keyboard:
@@ -129,62 +135,137 @@ that you need @code{thingatpt}, type:
 M-x package-get-package-provider RET thingatpt
 @end example
 
-which will return something like (fsf-compat "1.06"). You can the use
+which will return something like (fsf-compat "1.08"). You can the use
 one of the methods above for installing the package you want.
 
 @subsection XEmacs and Installing Packages
 
-Normally, packages are installed over the network, using EFS
-@ref{(EFS)}.  However, you may not have network access, or you may
-already have some or all of the packages on a local disk, such as a
-CDROM.  If you want to install from a local disk, you must first tell
-XEmacs where to find the package binaries.  This is done by adding a line
-like the following to your init file:
+There are three main ways to install packages:
 
-@example
-(setq package-get-remote (cons (list nil "/my/path/to/package/binaries")
-                               package-get-remote))
-@end example
+@menu
+* Sumo::              All at once, using the 'Sumo Tarball'.
+* Manually::          Using individual package tarballs.
+* Automatically::     Using the package tools from XEmacs.
+* Which Packages::    Which packages to install.
+* Removing Packages:: Removing packages.
+@end menu
 
-@xref{Init File}.
+But regardless of the method you use to install packages, they can only
+be used by XEmacs after a restart.
 
-Here, you'd change @file{/my/path/to/package/binaries} to be the path
-to your local package binaries.  Next, restart XEmacs, and you're ready
-to go (advanced users can just re-evaluate the sexp).
+@node Sumo, Manually, ,Installing Packages
+@comment  node-name,  next,  previous,  up
+@cindex sumo package install
+@heading Installing the Sumo Packages:
+Those with little time, cheap connections and plenty of disk space can
+install all the packages at once using the sumo tarballs.
+Download the file: @file{xemacs-sumo.tar.gz}
 
-If you are installing from a temporary, one-time directory, you can also 
-add these directory names to @code{package-get-remote} using:
+For an XEmacs compiled with Mule you also need: @file{xemacs-mule-sumo.tar.gz}
 
-@example
-        M-x pui-add-install-directory
-@end example
+N.B. They are called 'Sumo Tarballs' for good reason. They are
+currently about 19MB and 4.5MB (gzipped) respectively.
+
+Install them by:
+
+@code{cd $prefix/lib/xemacs ; gunzip -c <tarballname> | tar xvf - RET}
 
-Note, however, that any directories added using this function are not
-saved; this information will be lost when you quit XEmacs.
+Or, if you have GNU tar:
+
+@code{cd $prefix/lib/xemacs ; tar zxvf /path/to/<tarballname> RET}
+
+As the Sumo tarballs are not regenerated as often as the individual
+packages, it is recommended that you use the automatic package tools
+afterwards to pick up any recent updates.
+
+@node Manually, Automatically, Sumo, Installing Packages
+@comment  node-name,  next,  previous,  up
+@cindex manual package install
+@heading Manual Package Installation:
+Fetch the packages from the FTP site, CD-ROM whatever. The filenames
+have the form @file{name-<version>-pkg.tar.gz} and are gzipped tar files. For
+a fresh install it is sufficient to untar the file at the top of the
+package hierarchy. 
 
-If you're going to install over the network, you only have to insure
-that EFS @ref{(EFS)} works, and that it can get outside a firewall, if
-you happen to be behind one.  You shouldn't have to do anything else;
-XEmacs already knows where to go. However you can add your own mirrors
-to this list. See @code{package-get-remote}.
+Note: If you are upgrading packages already installed, it's best to
+remove the old package first @ref{Removing Packages}.
 
-The easiest way to install a package is to use the visual package
-browser and installer, using the menu pick:
+For example if we are installing the @file{xemacs-base}
+package (version 1.48):
 
 @example
-        Options->Manage Packages->List & Install
+   mkdir $prefix/lib/xemacs/xemacs-packages RET # if it does not exist yet
+   cd $prefix/lib/xemacs/xemacs-packages RET
+   gunzip -c /path/to/xemacs-base-1.48-pkg.tar.gz | tar xvf - RET
+
+Or if you have GNU tar, the last step can be:
+
+   tar zxvf /path/to/xemacs-base-1.48-pkg.tar.gz RET
 @end example
-or
+
+For MULE related packages, it is best to untar into the mule-packages
+hierarchy, i.e. for the @file{mule-base} package, version 1.37:
+
 @example
-        Options->Manage Packages->Using Custom->Select-> ...
+   mkdir $prefix/lib/xemacs/mule-packages RET # if it does not exist yet
+   cd $prefix/lib/xemacs/mule-packages RET
+   gunzip -c /path/to/mule-base-1.37-pkg.tar.gz | tar xvf - RET
+
+Or if you have GNU tar, the last step can be:
+
+   tar zxvf /path/to/mule-base-1.37-pkg.tar.gz RET
 @end example
 
-You can also access it using the keyboard:
+@node Automatically, Which Packages ,Manually, Installing Packages
+@comment  node-name,  next,  previous,  up
+@cindex automatic package install
+@cindex package tools
+@heading Automatic Package Installation:
+XEmacs comes with some tools to make the periodic updating and
+installing easier. It will notice if new packages or versions are
+available and will fetch them from the FTP site.
+
+Unfortunately this requires that a few packages are already in place.
+You will have to install them by hand as above or use a SUMO tarball.
+This requirement will hopefully go away in the future. The packages
+you need are:
 
 @example
-M-x pui-list-packages
+   efs          - To fetch the files from the FTP site or mirrors.
+   xemacs-base  - Needed by efs.
+
+and optionally:
+
+   mule-base    - Needed if you want to use XEmacs with MULE.
 @end example
 
+After installing these by hand, fire up XEmacs and follow these
+steps.
+
+Note: The menus in XEmacs 21.2.x and up have changed slightly, so
+where I mention "Options -> Manage Packages", substitute "Tools ->
+Packages".
+
+@enumerate 1
+@item Choose a download site.
+via menu: Options -> Manages Packages -> Add Download Site 
+via keyb: @code{M-x customize-variable RET package-get-remote RET}
+(put in the details of remote host and directory)
+
+If the package tarballs _AND_ the package-index file are in a
+local directory, you can: @code{M-x pui-add-install-directory RET}
+
+@item Obtain a list of packages and display the list in a buffer named
+@file{*Packages*}.
+menu: Options -> Manage Packages -> List & Install
+keyb: @code{M-x pui-list-packages RET}
+
+XEmacs will now connect to the remote site and download the
+latest package-index file.  If you see an error about the
+package-index entries not being PGP signed, you can safely
+ignore this because PGP has not been integrated into the XEmacs
+package tools yet.
+
 The visual package browser will then display a list of all packages.
 Help information will be displayed at the very bottom of the buffer; you
 may have to scroll down to see it.  You can also press @kbd{?} to get
@@ -237,30 +318,26 @@ Kill the package buffer.
 Moving the mouse over a package will also cause additional information
 about the package to be displayed in the minibuffer.
 
-@subsection Other package installation interfaces
 
-For an alternative package interface, you can select packages from the
-customize menus, under:
+@item Choose the packages you wish to install.
+mouse: Click button 2 on the package name.
+ keyb: @kbd{RET} on the package name
 
-@example
-        Options->Customize->Emacs->Packages-> ...
-@end example
-or
-@example
-        Options->Manage Packages->Using Custom->Select-> ...
-@end example
+@item Make sure you have everything you need.
+menu: Packages -> Add Required
+keyb: @kbd{r}
 
-Set their state to on, and then do:
+XEmacs will now search for packages that are required by the
+ones that you have chosen to install and offer to select
+those packages also.
 
-@example
-        Options->Manage Packages->Using Custom->Update Packages
-@end example
+For novices and gurus alike, this step can save your bacon.
+It's easy to forget to install a critical package.
 
-This will automatically retrieve the packages you have selected from the
-XEmacs ftp site or your local disk, and install them into
-XEmacs.  Additionally it will update any packages you already have
-installed to the newest version.  Note that if a package is newly
-installed you will have to restart XEmacs for the change to take effect.
+@item Download and install the packages.
+menu: Packages -> Install/Remove Selected
+keyb: @kbd{x}
+@end enumerate
 
 You can also install packages using a semi-manual interface:
 
@@ -269,118 +346,102 @@ M-x package-get-all <return>
 @end example
 
 Enter the name of the package (e.g., @code{prog-modes}), and XEmacs
-will search for the latest version (as listed in the lisp file
-@file{lisp/package-get-base.el}), and install it and any packages that
+will search for the latest version and install it and any packages that
 it depends upon.
 
-@subsection Manual Binary Package Installation
-
-Pre-compiled, binary packages can be installed in either a system
-package directory (this is determined when XEmacs is compiled), or in
-one of the following
-subdirectories of your @file{$HOME} directory:
-
-@example
-~/.xemacs/mule-packages
-~/.xemacs/xemacs-packages
-@end example
-
-Packages in the former directory will only be found by a Mule-enabled
-XEmacs.
-
-XEmacs does not have to be running to install binary packages, although
-XEmacs will not know about any newly-installed packages until you
-restart XEmacs.  Note, however, that installing a newer version of a
-package while XEmacs is running could cause strange errors in XEmacs;
-it's best to exit XEmacs before upgrading an existing package.
-
-To install binary packages manually:
-
-@enumerate
-@item
-Download the package(s) that you want to install.  Each binary package
-will typically be a gzip'd tarball.
-
-@item
-Decide where to install the packages: in the system package
-directory, or in @file{~/.xemacs/mule-packages} or
-@file{~/.xemacs/xemacs-packages}, respectively.  If you want to install
-the packages in the system package directory, make sure you can write
-into that directory.  If you want to install in your @file{$HOME}
-directory, create the directory, @file{~/.xemacs/mule-packages} or
-@file{~/.xemacs/xemacs-packages}, respectively.
-
-@item
-Next, @code{cd} to the directory under which you want to install the
-package(s).
-
-@item
-From this directory, uncompress and extract each of the gzip'd tarballs
-that you downloaded in step 1.  Unix and Cygnus cygwin users will
-typically do this using the commands:
-
-@example
-        gunzip < package.tar.gz | tar xvf -
-@end example
-
-Above, replace @file{package.tar.gz} with the filename of the
-package that you downloaded in step 1.
+@node Which Packages, Removing Packages, Automatically, Installing Packages
+@comment  node-name,  next,  previous,  up
+@cindex which packages
+@cindex choosing packages
+@heading Which Packages to Install:
+This is difficult to say. When in doubt install a package. If you
+administrate a big site it might be a good idea to just install
+everything. A good minimal set of packages for XEmacs-latin1 would be
 
-Of course, if you use GNU @code{tar}, you could also use:
+xemacs-base, xemacs-devel, c-support, cc-mode, debug, dired, efs,
+edit-utils, fsf-compat, mail-lib, net-utils, os-utils, prog-modes,
+text-modes, time
 
-@example
-        tar xvzf package.tar.gz
-@end example
+If you are using the XEmacs package tools, don't forget to do:
 
-@comment What about native MS Windows users???
+       Packages -> Add Required
 
-@item
-That's it.  Quit and restart XEmacs to get it to recognize any new or
-changed packages.
+To make sure you have everything that the packages you have chosen to
+install need.
 
-@end enumerate
+See also @ref{Available Packages} for further descriptions of the individual
+packages.
 
-@node Building Packages, Creating Packages, Using Packages, Packages
+@node Removing Packages, ,Which Packages, Installing Packages
 @comment  node-name,  next,  previous,  up
-
-Source packages are available from the @file{packages/source-packages}
-subdirectory of your favorite XEmacs distribution site.  Alternatively,
-they are available via CVS from @file{cvs.xemacs.org}.  Look at
-@file{http://cvs.xemacs.org} for instructions.
+@cindex removing packages
+@cindex deleting packages
+@heading Removing Packages:
+Because the exact files and their locations contained in a package may
+change it is recommended to remove a package first before installing a
+new version. In order to facilitate removal each package contains an
+@file{pgkinfo/MANIFEST.pkgname} file which list all the files belonging
+to the package. 
+
+No need to panic, you don't have to go through the
+@file{pkinfo/MANIFEST.pkgname} and manually delete the files.  Instead, use
+@code{M-x package-admin-delete-binary-package RET}.
+
+Note that the interactive package tools included with XEmacs already do
+this for you.
+
+@node Building Packages, Local.rules File, Installing Packages, Packages
+@comment  node-name,  next,  previous,  up
+@cindex building packages
+@cindex package building
+@heading Building Packages:
+Currently, source packages are only available via anonymous CVS.  See
+@url{http://cvs.xemacs.org/} for details of checking out the
+@file{xemacs-packages} module.
 
 @subsection Prerequisites for Building Source Packages
 
-You must have GNU @code{cp}, GNU @code{install} (or a BSD compatible
-@code{install} program) GNU @code{make} (3.75 or later preferred),
-@code{makeinfo} (1.68 from @code{texinfo-3.11} or later required), GNU
-@code{tar} and XEmacs 21.0.  The source packages will untar into a
-correct directory structure.  At the top level you must have
-@file{XEmacs.rules} and @file{package-compile.el}.  These files are
-available from the XEmacs FTP site from the same place you obtained your
-source package distributions.
+@table @code
+@item GNU cp
+@item GNU ginstall 
+(or a BSD compatible install program).
+@item GNU make 
+(3.75 or later preferred).
+@item makeinfo 
+(1.68 from texinfo-3.11 or later required).
+@item GNU tar
+(or equivalent).
+@item GNU gzip
+(or equivalent).
+@item A properly configured @file{Local.rules} file.
+@ref{Local.rules File}.
+@end table
+And of course, XEmacs 21.0 or higher.
 
 @subsection What You Can Do With Source Packages
 
-NB:  A global build operation doesn't exist yet as of 13 January 1998.
-
-Source packages are most useful for creating XEmacs package tarballs
-for installation into your own XEmacs installations or for
+The packages CVS sources are most useful for creating XEmacs package
+tarballs for installation into your own XEmacs installations or for
 distributing to others.
 
 Supported operations from @file{make} are:
 
 @table @code
-@item clean
-Remove all built files except @file{auto-autoloads.el} and @file{custom-load.el}.
-
-@item distclean
-Remove XEmacs backups as well as the files deleted by @code{make clean}.
-
 @item all
 Bytecompile all files, build and bytecompile byproduct files like
 @file{auto-autoloads.el} and @file{custom-load.el}.  Create info version
 of TeXinfo documentation if present.
 
+@item bindist
+Does a @code{make all} as well as create a binary package tarball in the
+staging directory.
+
+@item install
+Bytecompile all files, build and bytecompile byproduct files like
+@file{auto-autoloads.el} and @file{custom-load.el}.  Create info version
+of TeXinfo documentation if present.  And install everything into the
+staging directory.
+
 @item srckit
 Usually aliased to @code{srckit-std}.  This does a @code{make
 distclean} and creates a package source tarball in the staging
@@ -401,11 +462,84 @@ beyond the basic templates so this is not yet complete.
 Runs the rules @code{srckit} followed by @code{binkit}.  This is
 primarily of use by XEmacs maintainers producing files for distribution.
 
+@item clean
+Remove all built files except @file{auto-autoloads.el} and @file{custom-load.el}.
+
+@item distclean
+Remove all created files.
 @end table
 
-@node Creating Packages, Available Packages, Building Packages, Packages
+@node Local.rules File, Creating Packages, Building Packages, Packages
 @comment  node-name,  next,  previous,  up
+@cindex local.rules
+@heading The Local.rules File:
+This file is used when building and installing packages from source.  In
+the top level of the CVS module, @file{xemacs-packages}, contains the
+file, @file{Local.rules.template}.  Simply copy that to
+@file{Local.rules} and edit it to suit your needs.
+
+These are the variables in 'Local.rules' that you will need to
+address. 
+
+@table @var
+@item symlink = 
+Set this to 't' if you want to do a "run in place".
+Setting this doesn't work well with 'make bindist'
+
+@item XEMACS_PACKAGES =
+This is where you set the normal packages that you
+want to install. eg:
+@example
+      XEMACS_PACKAGES = libs/xemacs-base comm/bbdb
+@end example
+
+@item XEMACS_STAGING = $@{XEMACS_PACKAGES_BASE@}/../Packages
+Set this to where you want normal packages to be
+installed to.
 
+@item PACKAGE_INDEX = package-index
+If you want the package-index file to have a different
+name, change this.
+
+@item BUILD_WITHOUT_MULE =
+Building from CVS defaults to building the Mule
+packages.  Set this to 't' if you don't want/have Mule
+
+@item MULE_PACKAGES =
+Same as for 'XEMACS_PACKAGES' except you list the Mule
+packages you want to install here. eg:
+@example
+      MULE_PACKAGES = mule/mule-base mule/skk
+@end example
+
+@item MULE_STAGING = $@{XEMACS_PACKAGES_BASE@}/../Mule-Packages
+Set this to where you want Mule packages installed
+to.  Note:  'make bindist' does not use this variable.
+
+@item XEMACS = xemacs
+If your XEmacs isn't in your path, change this.
+
+@item XEMACS_NATIVE_NT =
+Set this to 't' if you are building on WinNT.
+
+@item INSTALL = install -c
+The path to your BSD compatible install program.
+
+@item TAR = tar
+The path to your tar program
+
+@item BZIP2 =
+If you want bzip2 tarballs, set this.
+
+@item MAKEINFO = makeinfo
+The path to your makeinfo program
+@end table
+
+
+@node Creating Packages, Available Packages, Local.rules File, Packages
+@comment  node-name,  next,  previous,  up
+@cindex creating packages
+@heading Creating Packages:
 Creating a package from an existing Lisp library is not very difficult.
 
 In addition to the Lisp libraries themselves, you need a
@@ -530,14 +664,15 @@ or a future revision of this manual for details.
 
 @node Available Packages,  , Creating Packages, Packages
 @comment  node-name,  next,  previous,  up
+@cindex available packages
+@cindex packages
+@heading Available Packages:
+This section lists the Lisp packages that are currently available from
+xemacs.org and it's mirrors.  If a particular package that you are
+looking for isn't here, please send a message to the
+@email{xemacs-beta@@xemacs.org, XEmacs Beta list}.
 
-This section is surely out-of-date.  If you're sure that XEmacs is
-able to do something, but your installed XEmacs won't do it for you,
-it's probably in a package.  If you can't find it in this section,
-that's a bug---please report it.  It is very hard to keep this section
-up-to-date; your reports, comments, and questions will help a lot.
-
-This data is up-to-date as of 10 February 1999.  (Ouch!  I told you!)
+This data is up-to-date as of January 17, 2001.
 
 @subsection Library Packages (libs)
 
@@ -552,19 +687,31 @@ Support for Sparcworks.
 @item apel
 A Portable Emacs Library.  Used by XEmacs MIME support.
 
-@item edebug
-A Lisp debugger.
-
 @item dired
 The DIRectory EDitor is for manipulating, and running commands on
 files in a directory.
 
+@item edebug
+A Lisp debugger.
+
 @item efs
 Treat files on remote systems the same as local files.
 
+@item elib
+Portable Emacs Lisp utilities library.
+
+@item fsf-compat
+FSF Emacs compatibility files.
+
 @item mail-lib
 Fundamental lisp files for providing email support.
 
+@item sounds-au
+XEmacs Sun sound files.
+
+@item sounds-wav
+XEmacs Microsoft sound files.
+
 @item tooltalk
 Support for building with Tooltalk.
 
@@ -584,6 +731,16 @@ These packages provide support for various communications, primarily
 email and usenet.
 
 @table @file
+@item bbdb
+The Big Brother Data Base
+
+@item eicq
+ICQ Client developed and tested on Linux x86; 
+only supported on that platform
+
+@item eudc
+Emacs Unified Directory Client (LDAP, PH).
+
 @item footnote
 Footnoting in mail message editing modes.
 
@@ -596,6 +753,9 @@ The Gnus Newsreader and Mailreader.
 @item mailcrypt
 Support for messaging encryption with PGP.
 
+@item mew
+Messaging in an Emacs World.
+
 @item mh-e
 Front end support for MH.
 
@@ -603,9 +763,6 @@ Front end support for MH.
 Miscellaneous Networking Utilities.  This is a single-file package and 
 files may be deleted at will.
 
-@item ph
-Emacs implementation of the ph client to CCSO/qi directory servers.
-
 @item rmail
 An obsolete Emacs mailer.  If you do not already use it don't start.
 
@@ -613,17 +770,22 @@ An obsolete Emacs mailer.  If you do not already use it don't start.
 An Emacs citation tool.  Useful with all Emacs Mailers and Newsreaders.
 
 @item tm
-Emacs MIME support.
+Emacs MIME support. Not needed for Gnus >= 5.8.0
 
 @item vm
 An Emacs mailer.
 
 @item w3
 A Web browser.
+
+@item zenirc
+ZENIRC IRC Client.
 @end table
 
 @subsection Games and Amusements (games)
 
+All work and no play...
+
 @table @file
 @item cookie
 Spook and Yow (Zippy quotes).
@@ -640,7 +802,15 @@ Other amusements and diversions.
 
 @subsection Mule Support (mule)
 
+MULti-lingual Enhancement.  Support for world scripts such as
+Latin, Arabic, Cyrillic, Chinese, Japanese, Greek, Hebrew etc.
+To use these packages your XEmacs must be compiled with Mule
+support.
+
 @table @file
+@item edict
+Lisp Interface to EDICT, Kanji Dictionary.
+
 @item egg-its
 Wnn (4.2 and 6) support.  SJ3 support.  Must be installed prior to
 XEmacs build.
@@ -652,6 +822,9 @@ Quail.  Used for everything other than English and Japanese.
 Used for localized menubars (French and Japanese) and localized splash
 screens (Japanese).
 
+@item lookup
+Dictionary support. (This isn't an English dictionary program)
+
 @item mule-base
 Basic Mule support.  Must be installed prior to building with Mule.
 
@@ -662,7 +835,12 @@ separate process running as a dictionary server.
 
 @subsection Productivity Packages (oa)
 
+Things to make life a little easier.
+
 @table @file
+@item calc
+Emacs calculator.
+
 @item calendar
 Calendar and diary support.
 
@@ -671,7 +849,7 @@ Single file lisp packages for various XEmacs goodies.  Load this and
 weed out the junk you don't want.
 
 @item forms
-Forms editing support (obsolete, use the builtin Widget instead).
+Forms editing support (obsolete, use the built-in Widget instead).
 
 @item frame-icon
 Provide a WM icon based on major mode.
@@ -695,7 +873,7 @@ SGML/Linuxdoc-SGML editing.
 User interface tool.
 
 @item speedbar
-??? Document me.
+Provides a separate frame with convenient references.
 
 @item strokes
 Mouse enhancement utility.
@@ -709,7 +887,12 @@ Display time & date on the modeline.
 
 @subsection Operating System Utilities (os)
 
+Tools for working with the operating system.
+
 @table @file
+@item eshell
+Command shell implemented entirely in Emacs Lisp.
+
 @item eterm
 Terminal emulator.
 
@@ -723,12 +906,21 @@ Front-end for Inferior Lisp.
 Miscellaneous single-file O/S utilities, for printing, archiving,
 compression, remote shells, etc.
 
+@item pcomplete
+Provides programmatic completion.
+
+@item ps-print-nomule
+Old, but no-Mule safe ps-print.
+
 @item view-process
 A Unix process browsing tool.
 @end table
 
 @subsection Program Editing Support (prog)
 
+XEmacs supports a multitude of programming languages.  These
+packages will help your coding.
+
 @table @file
 @item ada
 Ada language support.
@@ -748,23 +940,33 @@ Interface over patch.
 @item emerge
 Another interface over patch.
 
+@item idlwave
+Editing and Shell mode for the Interactive Data Language.
+
+@item jde
+Java language and development support.
+
 @item pcl-cvs
 CVS frontend.
 
 @item prog-modes
-Miscellaneous Lisp libraries for various programming languages.
+Miscellaneous single-file lisp files for various programming languages.
 
 @item scheme
 Front-end support for Inferior Scheme.
 
+@item semantic
+Semantic bovinator.
+
 @item sh-script
 Support for editing shell scripts.
 
 @item vc
-Version control for free systems.
+Version Control for Free systems.
 
 @item vc-cc
-Version control for ClearCase.
+Version Control for ClearCase.  This package will shortly be
+replaced with clearcase.el
 
 @item vhdl
 Support for VHDL.
@@ -772,6 +974,8 @@ Support for VHDL.
 
 @subsection Word Processing (wp)
 
+Working with text.
+
 @table @file
 @item auctex
 Basic TeX/LaTeX support.
@@ -782,6 +986,9 @@ Crisp/Brief emulation.
 @item edt
 DEC EDIT/EDT emulation.
 
+@item reftex
+Emacs support for LaTeX cross-references, citations.
+
 @item texinfo
 XEmacs TeXinfo support.
 
index 9103a2d..87b61c4 100644 (file)
@@ -1028,6 +1028,13 @@ normally include all functions and subroutines, and may also include
 global variables, data types, and anything else convenient.  Each name
 recorded is called a @dfn{tag}.
 
+@cindex C++ class browser, tags
+@cindex tags, C++
+@cindex class browser, C++
+@cindex Ebrowse
+The Ebrowse is a separate facility tailored for C++, with tags and a
+class browser.  @xref{,,, ebrowse, Ebrowse User's Manual}.
+
 @menu
 * Tag Syntax::         Tag syntax for various types of code and text files.
 * Create Tags Table::  Creating a tags table with @code{etags}.
@@ -1038,7 +1045,7 @@ recorded is called a @dfn{tag}.
 * List Tags::          Listing and finding tags defined in a file.
 @end menu
 
-@node Tag Syntax, Create Tags Table, Tags, Tags
+@node Tag Syntax
 @subsection Source File Tag Syntax
 
   Here is how tag syntax is defined for the most popular languages:
@@ -1077,7 +1084,7 @@ In La@TeX{} text, the argument of any of the commands @code{\chapter},
 tag.@refill
 
 Other commands can make tags as well, if you specify them in the
-environment variable @code{TEXTAGS} before invoking @code{etags}.  The
+environment variable @env{TEXTAGS} before invoking @code{etags}.  The
 value of this environment variable should be a colon-separated list of
 command names.  For example,
 
@@ -1108,8 +1115,34 @@ set with @code{set!} at top level in the file.
 
 @item
 In Ada code, functions, procedures, packages, tasks, and types are
-tags.  Use the @samp{--packages-only} option to create tags for packages
-only.
+tags.  Use the @samp{--packages-only} option to create tags for
+packages only.
+
+With Ada, it is possible to have the same name used for different
+entity kinds (e.g.@: the same name for a procedure and a function).  Also,
+for things like packages, procedures and functions, there is the spec
+(i.e.@: the interface) and the body (i.e.@: the implementation).  To
+facilitate the choice to the user, a tag value is appended with a
+qualifier:
+
+@table @asis
+@item function
+ @kbd{/f}
+@item procedure
+ @kbd{/p}
+@item package spec
+ @kbd{/s}
+@item package body
+ @kbd{/b}
+@item type
+ @kbd{/t}
+@item task
+ @kbd{/k}
+@end table
+
+So, as an example, @kbd{M-x find-tag bidule/b} will go directly to the
+body of the package @var{bidule} while @kbd{M-x find-tag bidule} will
+just search for any tag @var{bidule}.
 
 @item
 In assembler code, labels appearing at the beginning of a line,
@@ -1132,6 +1165,9 @@ in the file.
 In Fortran code, functions, subroutines and blockdata are tags.
 
 @item
+In makefiles, targets are tags.
+
+@item
 In Objective C code, tags include Objective C definitions for classes,
 class categories, methods, and protocols.
 
@@ -1145,7 +1181,7 @@ In Perl code, the tags are the procedures defined by the @code{sub},
 to tag global variables.
 
 @item
-In Postscript code, the tags are the functions.
+In PostScript code, the tags are the functions.
 
 @item
 In Prolog code, a tag name appears at the left margin.
@@ -1155,10 +1191,10 @@ In Python code, @code{def} or @code{class} at the beginning of a line
 generate a tag.
 @end itemize
 
-  You can also generate tags based on regexp matching 
-(@pxref{Etags Regexps}) to handle other formats and languages.
+  You can also generate tags based on regexp matching (@pxref{Etags
+Regexps}) to handle other formats and languages.
 
-@node Create Tags Table, Etags Regexps, Tag Syntax, Tags
+@node Create Tags Table
 @subsection Creating Tags Tables
 @cindex @code{etags} program
 
@@ -1251,7 +1287,7 @@ knows, and the file name rules for guessing the language. It also prints
 a list of all the available @code{etags} options, together with a short
 explanation.
 
-@node Etags Regexps, Select Tags Table, Create Tags Table, Tags
+@node Etags Regexps
 @subsection Etags Regexps
 
   The @samp{--regex} option provides a general way of recognizing tags
index abb9efb..d5d83b6 100644 (file)
@@ -238,8 +238,11 @@ Packages
 
 * Packages::            Introduction to XEmacs Packages.
 * Package Terminology:: Understanding different kinds of packages.
-* Using Packages::      How to install and use packages.
+* Installing Packages:: How to install packages.
 * Building Packages::   Building packages from sources.
+* Local.rules File::    An important part of building packages.
+* Creating Packages::   The basics.
+* Available Packages::  A brief directory of packaged LISP.
 
 Basic Editing Commands
 
index e103bcd..dc6c984 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-08  Martin Buchholz <martin@xemacs.org>
+
+       * XEmacs 21.2.44 "Thalia" is released.
+
 2001-01-26  Martin Buchholz <martin@xemacs.org>
 
        * XEmacs 21.2.43 "Terspichore" is released.
index 80a99dc..024ed8a 100644 (file)
@@ -38,7 +38,7 @@ Boston, MA 02111-1307, USA.  */
 #include "window.h"
 
 /* Current depth in recursive edits.  */
-int command_loop_level;
+Fixnum command_loop_level;
 
 #ifndef LISP_COMMAND_LOOP
 /* Form to evaluate (if non-nil) when Emacs is started.  */
index 0c1d755..ef5bcb7 100644 (file)
@@ -110,7 +110,7 @@ extern Lisp_Object Vcommand_loop;
 /* #endif */
 DECLARE_DOESNT_RETURN (initial_command_loop (Lisp_Object));
 Lisp_Object call_command_loop (Lisp_Object catch_errors);
-extern int command_loop_level;
+extern Fixnum command_loop_level;
 
 extern Lisp_Object Vkeyboard_translate_table;
 extern Lisp_Object Vlast_input_time;
index 73dfe42..73c5d10 100644 (file)
@@ -90,7 +90,7 @@ Boston, MA 02111-1307, USA.  */
 
 
 static int mswindows_ls_sort_case_insensitive;
-static int mswindows_ls_round_file_size;
+static Fixnum mswindows_ls_round_file_size;
 
 Lisp_Object            Qmswindows_insert_directory;
 
index 70a8603..16756e5 100644 (file)
@@ -40,7 +40,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include "eldap.h"
 
-static int ldap_default_port;
+static Fixnum ldap_default_port;
 static Lisp_Object Vldap_default_base;
 
 /* Needed by the lrecord definition */
index 8677f95..5bf3476 100644 (file)
@@ -440,7 +440,7 @@ make_standard_lisp_hash_table (enum hash_table_test test,
                               double rehash_threshold,
                               enum hash_table_weakness weakness)
 {
-  hash_table_hash_function_t hash_function =  0;
+  hash_table_hash_function_t hash_function = 0;
   hash_table_test_function_t test_function = 0;
 
   switch (test)
@@ -500,13 +500,7 @@ make_general_lisp_hash_table (hash_table_hash_function_t hash_function,
   compute_hash_table_derived_values (ht);
 
   /* We leave room for one never-occupied sentinel hentry at the end.  */
-  ht->hentries = xnew_array (hentry, ht->size + 1);
-
-  {
-    hentry *e, *sentinel;
-    for (e = ht->hentries, sentinel = e + ht->size; e <= sentinel; e++)
-      CLEAR_HENTRY (e);
-  }
+  ht->hentries = xnew_array_and_zero (hentry, ht->size + 1);
 
   XSETHASH_TABLE (hash_table, ht);
 
index cf07fc2..00d15e9 100644 (file)
@@ -163,13 +163,13 @@ struct specbinding *specpdl_ptr;
 int specpdl_depth_counter;
 
 /* Maximum size allowed for specpdl allocation */
-int max_specpdl_size;
+Fixnum max_specpdl_size;
 
 /* Depth in Lisp evaluations and function calls.  */
 static int lisp_eval_depth;
 
 /* Maximum allowed depth in Lisp evaluations and function calls.  */
-int max_lisp_eval_depth;
+Fixnum max_lisp_eval_depth;
 
 /* Nonzero means enter debugger before next function call */
 static int debug_on_next_call;
index 04b54d3..8c55b2b 100644 (file)
@@ -87,7 +87,7 @@ XtAppContext Xt_app_con;
 int x_allow_sendevents;
 
 #ifdef DEBUG_XEMACS
-int debug_x_events;
+Fixnum debug_x_events;
 #endif
 
 static int process_events_occurred;
index 7055984..f098d73 100644 (file)
@@ -146,13 +146,13 @@ int mswindows_quit_chars_count = 0;
 /* These are Lisp integers; see DEFVARS in this file for description. */
 int mswindows_dynamic_frame_resize;
 int mswindows_alt_by_itself_activates_menu;
-int mswindows_num_mouse_buttons;
-int mswindows_mouse_button_max_skew_x;
-int mswindows_mouse_button_max_skew_y;
-int mswindows_mouse_button_tolerance;
+Fixnum mswindows_num_mouse_buttons;
+Fixnum mswindows_mouse_button_max_skew_x;
+Fixnum mswindows_mouse_button_max_skew_y;
+Fixnum mswindows_mouse_button_tolerance;
 
 #ifdef DEBUG_XEMACS
-int debug_mswindows_events;
+Fixnum debug_mswindows_events;
 #endif
 
 /* This is the event signaled by the event pump.
index 063b9e2..847ab65 100644 (file)
@@ -100,7 +100,7 @@ Boston, MA 02111-1307, USA.  */
 #include <errno.h>
 
 /* The number of keystrokes between auto-saves. */
-static int auto_save_interval;
+static Fixnum auto_save_interval;
 
 Lisp_Object Qundefined_keystroke_sequence;
 
@@ -250,7 +250,7 @@ Lisp_Object Qself_insert_defer_undo;
 extern Lisp_Object Fmake_keymap (Lisp_Object name);
 
 #ifdef DEBUG_XEMACS
-int debug_emacs_events;
+Fixnum debug_emacs_events;
 
 static void
 external_debugging_print_event (char *event_description, Lisp_Object event)
index a79f7d6..95a059b 100644 (file)
@@ -406,7 +406,7 @@ typedef int Endpoint_Index;
 #define DE_MUST_BE_ATTACHED 2
 
 Lisp_Object Vlast_highlighted_extent;
-int mouse_highlight_priority;
+Fixnum mouse_highlight_priority;
 
 Lisp_Object Qextentp;
 Lisp_Object Qextent_live_p;
index fd754c6..be7b5fa 100644 (file)
@@ -150,7 +150,7 @@ check_valid_callback (Lisp_Object data)
 static void
 check_valid_int_or_function (Lisp_Object data)
 {
-  if (!INTP (data) && !CONSP (data))
+  if (!INTP (data) && !CONSP (data) && !SYMBOLP (data))
     invalid_argument ("must be an integer or expresssion", data);
 }
 
@@ -1021,6 +1021,8 @@ layout_update (Lisp_Object image_instance, Lisp_Object instantiator)
          /* Instantiate any new glyphs. */
          for (; !NILP (items); items = XCDR (items))
            {
+             /* #### We really want to use call_with_suspended_errors
+                here, but it won't allow us to call lisp. */
              border = Fcons (call1 (Qmake_glyph, XCAR (items)), border);
            }
          IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = Fnreverse (border);
index 9036452..9499385 100644 (file)
@@ -66,7 +66,7 @@ Boston, MA 02111-1307, USA.  */
 
 Lisp_Object Vhp_play_server;
 Lisp_Object Vhp_play_speaker;
-int         hp_play_gain;
+Fixnum      hp_play_gain;
 
 /* Functions */
 
index cd66cef..4aa26f7 100644 (file)
@@ -189,7 +189,7 @@ static Lisp_Object Vvertical_divider_map;
    so that things which care (such as the menubar code) can recompute
    privately-cached data when the user has changed keybindings.
  */
-int keymap_tick;
+Fixnum keymap_tick;
 
 /* Prefixing a key with this character is the same as sending a meta bit. */
 Lisp_Object Vmeta_prefix_char;
@@ -221,9 +221,13 @@ Lisp_Object Qbutton4up, Qbutton5up, Qbutton6up, Qbutton7up;
 
 Lisp_Object Qmenu_selection;
 /* Emacs compatibility */
-Lisp_Object Qdown_mouse_1, Qdown_mouse_2, Qdown_mouse_3, Qdown_mouse_4,
-  Qdown_mouse_5;
-Lisp_Object Qmouse_1, Qmouse_2, Qmouse_3, Qmouse_4, Qmouse_5;
+Lisp_Object Qdown_mouse_1, Qmouse_1;
+Lisp_Object Qdown_mouse_2, Qmouse_2;
+Lisp_Object Qdown_mouse_3, Qmouse_3;
+Lisp_Object Qdown_mouse_4, Qmouse_4;
+Lisp_Object Qdown_mouse_5, Qmouse_5;
+Lisp_Object Qdown_mouse_6, Qmouse_6;
+Lisp_Object Qdown_mouse_7, Qmouse_7;
 
 /* Kludge kludge kludge */
 Lisp_Object QLFD, QTAB, QRET, QESC, QDEL, QSPC, QBS;
@@ -1366,6 +1370,10 @@ define_key_check_and_coerce_keysym (Lisp_Object spec,
        *keysym = Qbutton4;
       else if (EQ(*keysym, Qdown_mouse_5))
        *keysym = Qbutton5;
+      else if (EQ(*keysym, Qdown_mouse_6))
+       *keysym = Qbutton6;
+      else if (EQ(*keysym, Qdown_mouse_7))
+       *keysym = Qbutton7;
       else if (EQ(*keysym, Qmouse_1))
        *keysym = Qbutton1up;
       else if (EQ(*keysym, Qmouse_2))
@@ -1376,6 +1384,10 @@ define_key_check_and_coerce_keysym (Lisp_Object spec,
        *keysym = Qbutton4up;
       else if (EQ(*keysym, Qmouse_5))
        *keysym = Qbutton5up;
+      else if (EQ(*keysym, Qmouse_6))
+       *keysym = Qbutton6up;
+      else if (EQ(*keysym, Qmouse_7))
+       *keysym = Qbutton7up;
     }
 }
 
@@ -4281,11 +4293,15 @@ syms_of_keymap (void)
   defsymbol (&Qmouse_3, "mouse-3");
   defsymbol (&Qmouse_4, "mouse-4");
   defsymbol (&Qmouse_5, "mouse-5");
+  defsymbol (&Qmouse_6, "mouse-6");
+  defsymbol (&Qmouse_7, "mouse-7");
   defsymbol (&Qdown_mouse_1, "down-mouse-1");
   defsymbol (&Qdown_mouse_2, "down-mouse-2");
   defsymbol (&Qdown_mouse_3, "down-mouse-3");
   defsymbol (&Qdown_mouse_4, "down-mouse-4");
   defsymbol (&Qdown_mouse_5, "down-mouse-5");
+  defsymbol (&Qdown_mouse_6, "down-mouse-6");
+  defsymbol (&Qdown_mouse_7, "down-mouse-7");
   defsymbol (&Qmenu_selection, "menu-selection");
   defsymbol (&QLFD, "LFD");
   defsymbol (&QTAB, "TAB");
index 100dbed..858f5f1 100644 (file)
@@ -52,9 +52,8 @@ NOTE-END */
 
 /* #define CANNOT_DUMP */
 
-/* XEmacs: Richard Cognot <cognot@ensg.u-nancy.fr> says we need this for
-   HPUX; but eeide@asylum.cs.utah.edu (Eric Eide) says it loses on BSD. */
-#ifndef BSD
+/* Let the OS header file determine this if not HPUX. */
+#ifdef HPUX
 # define UNEXEC "unexhp9k3.o"
 #endif
 
index 005ab13..26b086b 100644 (file)
@@ -74,10 +74,10 @@ NOTE-END  */
 
 /* XEmacs change:  from Thomas.Tornblom@nexus.comm.se */
 #ifdef USE_GCC
-#define C_SWITCH_MACHINE "-static -Dmode_t=\"u_short\"" /* avoid dynamic linking */
+#define C_SWITCH_MACHINE "-static -Dmode_t=\"unsigned short\"" /* avoid dynamic linking */
 #define LD_SWITCH_MACHINE "-Wl,-N -static"
 #else
-#define C_SWITCH_MACHINE "-Bstatic -Dmode_t=\"u_short\""/* avoid dynamic linking */
+#define C_SWITCH_MACHINE "-Bstatic -Dmode_t=\"unsigned short\""/* avoid dynamic linking */
 #define LD_SWITCH_MACHINE "-N -Bstatic"
 #endif
 
index 27d3ae3..0824e2a 100644 (file)
--- a/src/nt.c
+++ b/src/nt.c
@@ -48,7 +48,7 @@ extern Lisp_Object Vwin32_generate_fake_inodes;
 #endif
 extern Lisp_Object Vmswindows_get_true_file_attributes;
 
-int nt_fake_unix_uid;
+Fixnum nt_fake_unix_uid;
 
 static char startup_dir[ MAXPATHLEN ];
 
index 0063a6e..d50028e 100644 (file)
@@ -1541,8 +1541,17 @@ unix_kill_child_process (Lisp_Object proc, int signo,
 
   /* Finally send the signal. */
   if (EMACS_KILLPG (pgid, signo) == -1)
-    error ("kill (%ld, %ld) failed: %s",
-          (long) pgid, (long) signo, strerror (errno));
+    {
+      /* It's not an error if our victim is already dead.
+         And we can't rely on the result of killing a zombie, since
+         XPG 4.2 requires that killing a zombie fail with ESRCH,
+         while FIPS 151-2 requires that it succeeds! */
+#ifdef ESRCH
+      if (errno != ESRCH)
+#endif
+       error ("kill (%ld, %ld) failed: %s",
+              (long) pgid, (long) signo, strerror (errno));
+    }
 }
 
 /* Send signal SIGCODE to any process in the system given its PID.
index 5f2fbf6..4d097bc 100644 (file)
@@ -60,7 +60,7 @@ Boston, MA 02111-1307, USA.  */
 static struct hash_table *big_profile_table;
 Lisp_Object Vcall_count_profile_table;
 
-int default_profiling_interval;
+Fixnum default_profiling_interval;
 
 int profiling_active;
 
index ea8f8f8..2938971 100644 (file)
@@ -1438,7 +1438,7 @@ typedef struct alloc_dll
 
 static MMAP_HANDLE mmap_start = 0; /* Head of linked list */
 static size_t page_size = 0;   /* Size of VM pages */
-static int mmap_hysteresis;    /* Should be size_t, really. */
+static Fixnum mmap_hysteresis; /* Logically a "size_t" */
 
 /* Get a new handle for a fresh block. */
 static MMAP_HANDLE
index fe31b7b..acb272b 100644 (file)
@@ -50,8 +50,8 @@ extern int esd_play_sound_data (unsigned char *data, size_t length, int vol);
 # define DEVICE_CONNECTED_TO_ESD_P(x) 1 /* FIXME: better check */
 #endif
 
-int bell_volume;
-int bell_inhibit_time;
+Fixnum bell_volume;
+Fixnum bell_inhibit_time;
 Lisp_Object Vsound_alist;
 Lisp_Object Vsynchronous_sounds;
 Lisp_Object Vnative_sound_only_on_console;
index 44a5849..141430b 100644 (file)
@@ -31,7 +31,7 @@ enum symbol_value_type
 {
   /* The following tags use the 'symbol_value_forward' structure
      and are strictly for variables DEFVARed on the C level. */
-  SYMVAL_FIXNUM_FORWARD,       /* Forward C "int" */
+  SYMVAL_FIXNUM_FORWARD,       /* Forward C "Fixnum", really "EMACS_INT" */
   SYMVAL_CONST_FIXNUM_FORWARD, /* Same, but can't be set */
   SYMVAL_BOOLEAN_FORWARD,      /* Forward C boolean ("int") */
   SYMVAL_CONST_BOOLEAN_FORWARD,        /* Same, but can't be set */
@@ -70,6 +70,9 @@ enum symbol_value_type
 #endif
 };
 
+/* Underlying C type used to implement DEFVAR_INT */
+typedef EMACS_INT Fixnum;
+
 struct symbol_value_magic
 {
   struct lcrecord_header lcheader;
@@ -345,13 +348,21 @@ void defvar_magic (const char *symbol_name, const struct symbol_value_forward *m
 
 #define DEFVAR_SYMVAL_FWD_INT(lname, c_location, forward_type, magicfun) do{   \
   DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun);               \
-  dump_add_opaque (c_location, sizeof(int));                                   \
+  dump_add_opaque_int (c_location);                                            \
+} while (0)
+
+#define DEFVAR_SYMVAL_FWD_FIXNUM(lname, c_location, forward_type, magicfun) do{        \
+  DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun);               \
+  dump_add_opaque_fixnum (c_location);                                         \
 } while (0)
 
-#define DEFVAR_SYMVAL_FWD_OBJECT(lname, c_location, forward_type, magicfun) do{ \
+#define DEFVAR_SYMVAL_FWD_OBJECT(lname, c_location, forward_type, magicfun) do{        \
   DEFVAR_SYMVAL_FWD (lname, c_location, forward_type, magicfun);               \
-  staticpro (c_location);                                                      \
-  if (EQ (*c_location, Qnull_pointer)) *c_location = Qnil;                     \
+  {                                                                            \
+    Lisp_Object *DSF_location = c_location; /* Type check */                   \
+    staticpro (DSF_location);                                                  \
+    if (EQ (*DSF_location, Qnull_pointer)) *DSF_location = Qnil;               \
+  }                                                                            \
 } while (0)
 
 #define DEFVAR_LISP(lname, c_location) \
@@ -361,9 +372,9 @@ void defvar_magic (const char *symbol_name, const struct symbol_value_forward *m
 #define DEFVAR_SPECIFIER(lname, c_location) \
        DEFVAR_SYMVAL_FWD_OBJECT (lname, c_location, SYMVAL_CONST_SPECIFIER_FORWARD, 0)
 #define DEFVAR_INT(lname, c_location) \
-       DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_FIXNUM_FORWARD, 0)
+       DEFVAR_SYMVAL_FWD_FIXNUM (lname, c_location, SYMVAL_FIXNUM_FORWARD, 0)
 #define DEFVAR_CONST_INT(lname, c_location) \
-       DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_CONST_FIXNUM_FORWARD, 0)
+       DEFVAR_SYMVAL_FWD_FIXNUM (lname, c_location, SYMVAL_CONST_FIXNUM_FORWARD, 0)
 #define DEFVAR_BOOL(lname, c_location) \
        DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_BOOLEAN_FORWARD, 0)
 #define DEFVAR_CONST_BOOL(lname, c_location) \
@@ -371,7 +382,7 @@ void defvar_magic (const char *symbol_name, const struct symbol_value_forward *m
 #define DEFVAR_LISP_MAGIC(lname, c_location, magicfun) \
        DEFVAR_SYMVAL_FWD_OBJECT (lname, c_location, SYMVAL_OBJECT_FORWARD, magicfun)
 #define DEFVAR_INT_MAGIC(lname, c_location, magicfun) \
-       DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_FIXNUM_FORWARD, magicfun)
+       DEFVAR_SYMVAL_FWD_FIXNUM (lname, c_location, SYMVAL_FIXNUM_FORWARD, magicfun)
 #define DEFVAR_BOOL_MAGIC(lname, c_location, magicfun) \
        DEFVAR_SYMVAL_FWD_INT (lname, c_location, SYMVAL_BOOLEAN_FORWARD, magicfun)
 
index fc23d27..a6b9cb3 100644 (file)
@@ -131,7 +131,11 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #ifdef HAVE_LIBUTIL_H
-#include <libutil.h>           /* openpty() on BSD */
+#include <libutil.h>           /* openpty() on FreeBSD */
+#endif
+
+#ifdef HAVE_UTIL_H
+#include <util.h>              /* openpty() on NetBSD */
 #endif
 
 #ifdef FD_SET
index c4b6bfd..eb7fcf2 100644 (file)
@@ -30,8 +30,8 @@ Boston, MA 02111-1307, USA.  */
 #define realloc xrealloc
 #define malloc xmalloc
 #define free xfree
-extern void *xmalloc (int size);
-extern void *xrealloc (void *, int size);
+extern void *xmalloc (size_t size);
+extern void *xrealloc (void *, size_t size);
 
 #else /* emacs */
 
index a3ad1b1..ccddef8 100644 (file)
@@ -111,14 +111,14 @@ Lisp_Object Vtemp_buffer_show_function;
 Lisp_Object Vtemp_buffer_show_hook;
 
 /* If a window gets smaller than either of these, it is removed. */
-int window_min_height;
-int window_min_width;
+Fixnum window_min_height;
+Fixnum window_min_width;
 
 /* Hook run at end of temp_output_buffer_show.  */
 Lisp_Object Qtemp_buffer_show_hook;
 
 /* Number of lines of continuity in scrolling by screenfuls.  */
-int next_screen_context_lines;
+Fixnum next_screen_context_lines;
 
 /* List of freed window configurations with 1 - 10 windows. */
 static Lisp_Object Vwindow_configuration_free_list[10];
@@ -4331,7 +4331,7 @@ window_scroll (Lisp_Object window, Lisp_Object count, int direction,
          &&
          Dynarr_length (dla) >= (1 + modeline)
          &&
-         (dl->ascent - dl->top_clip) - fheight * value > 0)
+         (dl->ascent - dl->top_clip) > fheight * value)
        {
          WINDOW_TEXT_TOP_CLIP (w) += value * fheight;
          MARK_WINDOWS_CHANGED (w);
index 877dc91..7a7f6da 100644 (file)
@@ -1,3 +1,7 @@
+2001-02-08  Martin Buchholz <martin@xemacs.org>
+
+       * XEmacs 21.2.44 "Thalia" is released.
+
 2001-01-26  Martin Buchholz <martin@xemacs.org>
 
        * XEmacs 21.2.43 "Terspichore" is released.
index a9e37c3..336189a 100644 (file)
@@ -2,8 +2,8 @@
 emacs_is_beta=t
 emacs_major_version=21
 emacs_minor_version=2
-emacs_beta_version=43
-xemacs_codename="Terspichore"
+emacs_beta_version=44
+xemacs_codename="Thalia"
 infodock_major_version=4
 infodock_minor_version=0
 infodock_build_version=8