which included commits to RCS files with non-trunk default branches.
of the relocating allocator. Turning on --rel-alloc will allow XEmacs
to return unused memory to the operating system, thereby reducing its
memory footprint. However, it may make XEmacs runs more slowly,
-especially if your system's `mmap' implemntation is missing or
+especially if your system's `mmap' implementation is missing or
inefficient. Generally, it's best to go with the default
configuration for your system. You can tweak this based on how you
use XEmacs, and the memory and cpu resources available on your system.
contains the results of the compile and link tests used by configure.
The `--with-mule' option enables (MUlti-Lingual Emacs) support, needed
-to suport non-Latin-1 (including Asian) languages. The Mule support
+to support non-Latin-1 (including Asian) languages. The Mule support
is not yet as stable or efficient as the `Latin1' support. Enabling
Mule support requires the mule-base package installed prior to
building XEmacs. The following options require Mule support:
`/usr/local/lib/xemacs-VERSION/CONFIGURATION-NAME/modules'
(where VERSION and CONFIGURATION-NAME are as described above).
By their very nature, dynamic loadable modules are architecture-
- dependant, and care should be taken not to set this directory
- to a system- or architecture-independant directory.
+ dependent, and care should be taken not to set this directory
+ to a system- or architecture-independent directory.
Remember that you must specify any variable values you need each time
you run `make' in the top directory. If you run `make' once to build
add mod2 = Mode_switch
EOF
+
+*** XEmacs dumps core at startup when native audio is used. Native
+audio does not work with recent versions of HP-UX.
+
+Under HP-UX 10.20 and later (e.g., HP-UX 11.XX), with native audio
+enabled, the dumped XEmacs binary ("xemacs") core dumps at startup if
+recent versions of the libAlib.sl audio shared library is used. Note
+that "temacs" will run, but "xemacs" will dump core. This, of course,
+causes the XEmacs build to fail. If GNU malloc is enabled, a stack
+trace will show XEmacs to have crashed in the "first" call to malloc().
+
+This bug currently exists in all versions of XEmacs, when the undump
+mechanism is used. It is not known if using the experimental portable
+dumper will allow native audio to work.
+
+**** Cause:
+
+Recent versions of the HP-UX 10.20 (and later) audio shared library (in
+/opt/audio/lib), pulls in the libdce shared library, which pulls in a
+thread (libcma) library. This prevents the HP-UX undump() routine (in
+unexhp9k800.c) from properly working. What's happening is that some
+initialization routines are being called in the libcma library, *BEFORE*
+main() is called, and these initialization routines are calling
+malloc(). Unfortunately, in order for the undumper to work, XEmacs must
+adjust (move upwards) the sbrk() value *BEFORE* the first call to
+malloc(); if malloc() is called before XEmacs has properly adjusted sbrk
+(which is what is happening), dumped memory that is being used by
+XEmacs, is improperly re-allocated for use by malloc() and the dumped
+memory is corrupted. This causes XEmacs to die an horrible death.
+
+It is believed that versions of the audio library past December 1998
+will trigger this problem. Under HP-UX 10.20, you probably have to
+install audio library patches to encounter this. It's probable that
+recent "fresh, out-of-the-box" HP-UX 11.XX workstations also have this
+problem. For HP-UX 10.20, it's believed that audio patch PHSS_17121 (or
+a superceeding one, like PHSS_17554, PHSS_17971, PHSS_18777, PHSS_21481,
+or PHSS_21662, etc.) will trigger this.
+
+To check if your audio library will cause problems for XEmacs, run
+"chatr /opt/audio/lib/libAlib.sl". If "libdce" appears in the displayed
+shared library list, XEmacs will probably encounter problems if audio is
+enabled.
+
+**** Workaround:
+
+Don't enable native audio. Re-run configure without native audio
+support.
+
+If your site supports it, try using NAS (Network Audio Support).
+
+Try using the experimental portable dumper. It may work, or it may
+not.
+
+
*** `Pid xxx killed due to text modification or page I/O error'
On HP-UX, you can get that error when the Emacs executable is on an NFS
# like `-m68040'.
dll_cflags='-m68020 -resident32 -malways-restore-a4'
;;
+ *cygwin* | *mingw* )
+ # PIC is the default
+ ;;
*)
dll_cflags='-fPIC'
;;
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.
-#
+
+version='2000-05-30'
+
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
-# The master version of this file is at the FSF in /home/gd/gnu/lib.
-# Please send patches to <autoconf-patches@gnu.org>.
+# Please send patches to <config-patches@gnu.org>.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# (but try to keep the structure clean).
#
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of this system.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit"
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case "$1" in
+ --version | --vers* | -V )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ exec >&2
+ echo "$me: invalid option $1"
+ echo "$help"
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ 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
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # Netbsd (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ # Determine the machine/vendor (is the vendor relevant).
+ case "${UNAME_MACHINE}" in
+ amiga) machine=m68k-cbm ;;
+ arm32) machine=arm-unknown ;;
+ atari*) machine=m68k-atari ;;
+ sun3*) machine=m68k-sun ;;
+ mac68k) machine=m68k-apple ;;
+ macppc) machine=powerpc-apple ;;
+ hp3[0-9][05]) machine=m68k-hp ;;
+ 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 OS release
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit 0 ;;
alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
cat <<EOF >$dummy.s
+ .data
+\$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
.globl main
+ .align 4
.ent main
main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
.end main
EOF
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
- ./$dummy
- case "$?" in
- 7)
+ case `./$dummy` in
+ 0-0)
UNAME_MACHINE="alpha"
;;
- 15)
+ 1-0)
UNAME_MACHINE="alphaev5"
;;
- 14)
+ 1-1)
UNAME_MACHINE="alphaev56"
;;
- 10)
+ 1-101)
UNAME_MACHINE="alphapca56"
;;
- 16)
+ 2-303)
UNAME_MACHINE="alphaev6"
;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
esac
fi
rm -f $dummy.s $dummy
Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4
exit 0;;
- amiga:NetBSD:*:*)
- echo m68k-cbm-netbsd${UNAME_RELEASE}
- exit 0 ;;
amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;;
- arm32:NetBSD:*:*)
- echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- exit 0 ;;
SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp
exit 0;;
aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;;
- atari*:NetBSD:*:*)
- echo m68k-atari-netbsd${UNAME_RELEASE}
- exit 0 ;;
atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
# The situation for MiNT is a little confusing. The machine name
# can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
+ # "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;;
- sun3*:NetBSD:*:*)
- echo m68k-sun-netbsd${UNAME_RELEASE}
- exit 0 ;;
sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- mac68k:NetBSD:*:*)
- echo m68k-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;;
- macppc:NetBSD:*:*)
- echo powerpc-apple-netbsd${UNAME_RELEASE}
- exit 0 ;;
RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3
exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4
exit 0 ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*)
9000/[34]?? ) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
#include <stdlib.h>
#include <unistd.h>
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;;
CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE}
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*T3E:*:*:*)
- echo alpha-cray-unicosmk${UNAME_RELEASE}
+ echo alpha-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
F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;;
- hp3[0-9][05]:NetBSD:*:*)
- echo m68k-hp-netbsd${UNAME_RELEASE}
- exit 0 ;;
hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;;
- i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;;
*:FreeBSD:*:*)
- if test -x /usr/bin/objformat; then
- if test "elf" = "`/usr/bin/objformat`"; then
- echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
- exit 0
- fi
- fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;;
- *:NetBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
- exit 0 ;;
*:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit 0
;;
+ elf_i?86)
+ echo "${UNAME_MACHINE}-pc-linux"
+ exit 0
+ ;;
i?86coff)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0
exit 0
;;
elf32arm*)
- echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
exit 0
;;
armelf_linux*)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
- elf32ppc)
+ elf32ppc | elf32ppclinux)
# Determine Lib Version
cat >$dummy.c <<EOF
#include <features.h>
if test "$?" = 0 ; then
LIBC="libc1"
fi
- fi
+ fi
rm -f $dummy.c $dummy
echo powerpc-unknown-linux-gnu${LIBC}
exit 0
;;
+ shelf_linux)
+ echo "${UNAME_MACHINE}-unknown-linux-gnu"
+ exit 0
+ ;;
esac
if test "${UNAME_MACHINE}" = "alpha" ; then
- sed 's/^ //' <<EOF >$dummy.s
- .globl main
- .ent main
- main:
- .frame \$30,0,\$26,0
- .prologue 0
- .long 0x47e03d80 # implver $0
- lda \$2,259
- .long 0x47e20c21 # amask $2,$1
- srl \$1,8,\$2
- sll \$2,2,\$2
- sll \$0,3,\$0
- addl \$1,\$0,\$0
- addl \$2,\$0,\$0
- ret \$31,(\$26),1
- .end main
+ cat <<EOF >$dummy.s
+ .data
+ \$Lformat:
+ .byte 37,100,45,37,120,10,0 # "%d-%x\n"
+
+ .text
+ .globl main
+ .align 4
+ .ent main
+ main:
+ .frame \$30,16,\$26,0
+ ldgp \$29,0(\$27)
+ .prologue 1
+ .long 0x47e03d80 # implver \$0
+ lda \$2,-1
+ .long 0x47e20c21 # amask \$2,\$1
+ lda \$16,\$Lformat
+ mov \$0,\$17
+ not \$1,\$18
+ jsr \$26,printf
+ ldgp \$29,0(\$26)
+ mov 0,\$16
+ jsr \$26,exit
+ .end main
EOF
LIBC=""
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then
- ./$dummy
- case "$?" in
- 7)
+ case `./$dummy` in
+ 0-0)
UNAME_MACHINE="alpha"
;;
- 15)
+ 1-0)
UNAME_MACHINE="alphaev5"
;;
- 14)
+ 1-1)
UNAME_MACHINE="alphaev56"
;;
- 10)
+ 1-101)
UNAME_MACHINE="alphapca56"
;;
- 16)
+ 2-303)
UNAME_MACHINE="alphaev6"
;;
+ 2-307)
+ UNAME_MACHINE="alphaev67"
+ ;;
esac
objdump --private-headers $dummy | \
elif test "${UNAME_MACHINE}" = "mips" ; then
cat >$dummy.c <<EOF
#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
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
+ elif test "${UNAME_MACHINE}" = "s390"; then
+ echo s390-ibm-linux && exit 0
else
# Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help.
cat >$dummy.c <<EOF
#include <features.h>
#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) {
#else
int main (argc, argv) int argc; char *argv[]; {
echo ${UNAME_MACHINE}-pc-sysv32
fi
exit 0 ;;
+ i?86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit 0 ;;
pc:*:*:*)
+ # Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp
*:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;;
+ *:Darwin:*:*)
+ echo `uname -p`-apple-darwin${UNAME_RELEASE}
+ exit 0 ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ if test "${UNAME_MACHINE}" = "x86pc"; then
+ UNAME_MACHINE=pc
+ fi
+ echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+ exit 0 ;;
*:QNX:*:4*)
- echo i386-qnx-qnx${UNAME_VERSION}
+ echo i386-pc-qnx
+ exit 0 ;;
+ NSR-W:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit 0 ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit 0 ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit 0 ;;
esac
esac
fi
-#echo '(Unable to guess system type)' 1>&2
+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:
+
+ ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+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
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "version='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
#! /bin/sh
# Configuration validation subroutine script, version 1.1.
-# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+# Free Software Foundation, Inc.
+
+version='2000-05-31'
+
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
# 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.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
# It is wrong to echo any other type of specification.
-if [ x$1 = x ]
-then
- echo Configuration name missing. 1>&2
- echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
- echo "or $0 ALIAS" 1>&2
- echo where ALIAS is a recognized configuration type. 1>&2
- exit 1
-fi
+me=`echo "$0" | sed -e 's,.*/,,'`
-# First pass through any local machine types.
-case $1 in
- *local*)
- echo $1
- exit 0
- ;;
- *)
- ;;
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit"
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case "$1" in
+ --version | --vers* | -V )
+ echo "$version" ; exit 0 ;;
+ --help | --h* | -h )
+ echo "$usage"; exit 0 ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ exec >&2
+ echo "$me: invalid option $1"
+ echo "$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit 0;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
esac
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- linux-gnu*)
+ nto-qnx* | linux-gnu*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
| 580 | i960 | h8300 \
+ | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
- | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
+ | hppa64 \
+ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
+ | alphaev6[78] \
| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
| 1750a | dsp16xx | 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)
+ | thumb | d10v | fr30 | avr)
basic_machine=$basic_machine-unknown
;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
| xmp-* | ymp-* \
- | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
- | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
+ | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
+ | 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-* \
| mips64el-* | mips64orion-* | mips64orionel-* \
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
| mipstx39-* | mipstx39el-* | mcore-* \
- | f301-* | armv*-* | t3e-* \
+ | f301-* | armv*-* | s390-* | sv1-* | t3e-* \
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
- | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
+ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
+ | bs2000-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
basic_machine=i386-unknown
os=-mingw32
;;
- i386-qnx | qnx)
- basic_machine=i386-qnx
- ;;
iris | iris4d)
basic_machine=mips-sgi
case $os in
mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;;
+ mmix*)
+ basic_machine=mmix-knuth
+ os=-mmixware
+ ;;
monitor)
basic_machine=m68k-rom68k
os=-coff
np1)
basic_machine=np1-gould
;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
pentium | p5 | k5 | k6 | nexen)
basic_machine=i586-pc
;;
- pentiumpro | p6 | 6x86)
+ pentiumpro | p6 | 6x86 | athlon)
basic_machine=i686-pc
;;
pentiumii | pentium2)
pentium-* | p5-* | k5-* | k6-* | nexen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- pentiumpro-* | p6-* | 6x86-*)
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
pentiumii-* | pentium2-*)
sun386 | sun386i | roadrunner)
basic_machine=i386-sun
;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
symmetry)
basic_machine=i386-sequent
os=-dynix
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*)
+ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i[34567]86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto*)
+ os=-nto-qnx
+ ;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
- | -macos* | -mpw* | -magic* | -mon960* | -lnews*)
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
-opened*)
os=-openedition
;;
+ -wince*)
+ os=-wince
+ ;;
-osfrose*)
os=-osfrose
;;
-ns2 )
os=-nextstep2
;;
+ -nsk)
+ os=-nsk
+ ;;
# Preserve the version number of sinix5.
-sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'`
-oss*)
os=-sysv3
;;
- -qnx)
- os=-qnx4
- ;;
-svr4)
os=-sysv4
;;
esac
echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "version='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Options marked with a (*) are auto-detected.
+Many features require external packages to be installed first.
+Get them from ftp://ftp.xemacs.org/pub/xemacs/aux.
+
Use colons (or quoted spaces) to separate directory names in option
values which are PATHs (i.e. lists of directories).
+The results of configure tests are saved in config.log, which is useful
+for diagnosing problems.
+
+
General options:
--help Issue this usage message.
---verbose Display the results of configure tests.
---extra-verbose Display even more information, useful for debugging.
+--verbose Accepted but ignored.
+--extra-verbose Display more information, useful for debugging.
Compilation options:
---compiler=prog C compiler to use.
+--compiler=PROG C compiler to use
--with-gcc (*) Use GCC to compile XEmacs.
---without-gcc Don't use GCC to compile XEmacs.
--cflags=FLAGS Compiler flags (such as -O)
---cpp=prog C preprocessor to use (e.g. /usr/ccs/lib/cpp or cc -E)
+--cpp=PROG C preprocessor to use (e.g. /usr/ccs/lib/cpp or cc -E)
--cppflags=FLAGS C preprocessor flags (e.g. -I/foo or -Dfoo=bar)
--libs=LIBS Additional libraries (e.g. -lfoo)
--ldflags=FLAGS Additional linker flags (e.g. -L/foo)
---site-includes=PATH List of directories to search first for header files.
---site-libraries=PATH List of directories to search first for libraries.
+--site-includes=PATH List of directories to search first for header files
+--site-libraries=PATH List of directories to search first for libraries
--site-prefixes=PATH List of directories to search for include/ and lib/
subdirectories, just after 'site-includes' and
- 'site-libraries'.
+ 'site-libraries'
--site-runtime-libraries=PATH
List of ALL directories to search for dynamically
- linked libraries at run time.
+ linked libraries at run time
--dynamic=yes Link dynamically if supported by system.
--dynamic=no Force static linking on systems where dynamic
linking is the default.
Installation options:
--prefix=DIR Install files below DIR. Defaults to `/usr/local'.
---with-prefix Compile the value of --prefix into the executable.
- Defaults to `yes'.
---without-prefix Don't compile the value of --prefix into the executable.
+--with-prefix=no Don't compile the value of --prefix into the
+ executable.
Window-system options:
--with-x11 (*) Support the X Window System.
---without-x11 Don't support X.
--x-includes=DIR Search for X header files in DIR.
--x-libraries=DIR Search for X libraries in DIR.
---without-toolbars Don't compile with any toolbar support.
---without-wmcommand Compile without realized leader window which will
+--with-msw (*) Support MS Windows as a window system (only under
+ Cygwin and MinGW).
+--with-toolbars=no Don't compile with any toolbar support.
+--with-wmcommand=no Compile without realized leader window which will
keep the WM_COMMAND property.
--with-athena=TYPE Use TYPE Athena widgets
(xaw, 3d, next, 95, or xpm)
--with-widgets=TYPE Use TYPE widgets (motif, athena, or no).
Motif widgets will be used if Motif can be found.
Other widget types are currently unsupported.
---with-dragndrop (*) Compile in the generic drag and drop API. This is
+--with-dragndrop Compile in the generic drag and drop API. This is
automatically added if one of the drag and drop
protocols is found (currently CDE, OffiX, MSWindows).
*WARNING* The Drag'n'drop support is under development
and is considered experimental.
---with-cde (*) Compile in support for CDE drag and drop.
---with-offix (*) Compile in support for OffiX drag and drop.
+--with-cde Compile in support for CDE drag and drop.
+--with-offix Compile in support for OffiX drag and drop.
*WARNING* If you compile in OffiX, you may not be
able to use multiple X displays success-
fully. If the two servers are from
different vendors, the results may be
unpredictable.
---without-xmu (*) For those unfortunates whose vendors don't ship Xmu.
+--with-xmu=no (*) For those unfortunates whose vendors don't ship Xmu.
--external-widget Compile with external widget support.
-TTY options:
+TTY (character terminal) options:
---without-tty Don't support TTY-s.
+--with-tty=no Don't support ttys.
--with-ncurses (*) Use the ncurses library for tty support.
---with-gpm (*) Compile in support for General Purpose Mouse.
+--with-gpm (*) Compile in GPM mouse support for ttys.
Image options:
---with-xpm (*) Compile with support for XPM files.
- It is highly recommended that you obtain XPM
- (version 3.4h or better) if you don't already
- have it. Get it from the XEmacs FTP site.
---with-xface (*) Compile with support for X-Face mail header
- conversion. Requires the compface library.
- Get it from the XEmacs FTP site.
---without-gif Compile without the built-in support for GIF image
- conversion.
---with-jpeg (*) Compile with support for JPEG image conversion.
- Requires libjpeg from the Independent JPEG Group.
- Get it from the XEmacs FTP site.
---with-png (*) Compile with support for PNG image conversion.
- Requires libpng. Get it from the XEmacs FTP site.
---with-tiff (*) Compile with support for TIFF image conversion.
- Requires Sam Lefflier's libtiff library.
- Get if from the XEmacs FTP site.
+--with-xpm (*) Compile with support for XPM images. PRACTICALLY
+ REQUIRED. Although this library is nonstandard and
+ a real hassle to build, many basic things (e.g.
+ toolbars) depend on it, and you will run into
+ many problems without it.
+--with-png (*) Compile with support for PNG images. Recommended
+ because the images on the About page are not viewable
+ without it.
+--with-jpeg (*) Compile with support for JPEG images. Useful if
+ you are using a mail, news reader, or web browser
+ in XEmacs, so that JPEG images can be displayed.
+--with-tiff (*) Compile with support for TIFF images. Possibly
+ useful, for the same reason as JPEG images.
+--with-xface (*) Compile with support for X-Face mail headers.
+ Requires the compface package. Of doubtful
+ usefulness.
+--with-gif=no Compile without the (builtin) support for GIF images.
Sound options:
--with-sound=TYPE,[TYPE],... Compile with native sound support.
- Valid types are `native', `nas' and `esd'.
- Prefix a type with 'no' to disable.
- The first option can be `none' or `all'.
- `none' is a synonym for `nonative,nonas,noesd'.
- `all' is a synonym for native,nas,esd or `all'.
- The default is to autodetect all sound support.
+ Valid types are `native', `nas' and `esd'.
+ Prefix a type with 'no' to disable.
+ The first option can be `none' or `all'.
+ `none' is a synonym for `nonative,nonas,noesd'.
+ `all' is a synonym for native,nas,esd or `all'.
+ The default is to autodetect all sound support.
--native-sound-lib=LIB Native sound support library. Needed on Suns
with --with-sound=both because both sound libraries
are called libaudio.
--with-database=TYPE (*) Compile with database support. Valid types are
`no' or a comma-separated list of one or more
of `berkdb' and either `dbm' or `gnudbm'.
---with-ldap (*) Compile with support for the LDAP protocol (requires
- installed LDAP libraries on the system).
---with-postgresql (*) Compile with support for the PostgreSQL RDBMS (requires
- installed PostreSQL libraries on the system).
+--with-ldap (*) Compile with support for the LDAP protocol.
+--with-postgresql (*) Compile with support for the PostgreSQL RDBMS.
Mail options:
--mail-locking=TYPE (*) Specify the locking to be used by movemail to prevent
concurrent updates of mail spool files. Valid types
are `lockf', `flock', and `dot'.
---with-pop support POP for mail retrieval
---with-kerberos support Kerberos-authenticated POP
---with-hesiod support Hesiod to get the POP server host
+--with-pop Support POP for mail retrieval.
+--with-kerberos Support Kerberos-authenticated POP.
+--with-hesiod Support Hesiod to get the POP server host.
Additional features:
development environment.
--with-socks Compile with support for SOCKS (an Internet proxy).
--with-dnet (*) Compile with support for DECnet.
---with-modules Compile in experimental support for dynamically
- loaded libraries (Dynamic Shared Objects).
+--with-modules Compile in experimental support for dynamically
+ loaded libraries (Dynamic Shared Objects).
--with-site-lisp=yes Allow for a site-lisp directory in the XEmacs hierarchy
searched before the installation packages.
--with-site-modules=no Disable site-modules directory in the XEmacs hierarchy,
and localdir files in case run-time searching
for them fails.
--moduledir=DIR Directory to install dynamic modules in.
---pdump New, experimental, non-working, don't-sue-me-if-
- your-house-collapses-and-your-wife-goes-away,
- portable dumper.
+--pdump New, experimental, non-working, don't-sue-me-if-
+ your-house-collapses-and-your-wife-leaves-you,
+ portable dumper.
Internationalization options:
used in conjunction with Mule support).
--with-wnn (*) Compile with support for WNN (a multi-language input
method used in conjunction with Mule support).
---with-wnn6 (*) Compile with support for the comercial package WNN
- version 6
+--with-wnn6 (*) Compile with support for the commercial package WNN6.
--with-i18n3 Compile with I18N level 3 (support for message
translation). This doesn't currently work.
--with-xfs Compile with XFontSet support for bilingual menubar.
unsuccessful after disturbing the status quo, it removes config.status.
The configure script also recognizes some environment variables, each
-of which is equivalent to a corresponding configure flag. A specified
-configure flag always overrides the environment variable.
-
-envvar configure flag
------ --------------
-CC --compiler
-CPP --cpp
-CFLAGS --cflags
-CPPFLAGS --cppflags
-LDFLAGS --ldflags
-LIBS --libs
-LD_RUN_PATH --site-runtime-libraries
+of which is equivalent to a corresponding configure flag. Configure
+flags take precedence over environment variables, if both are specified.
+
+environment corresponding
+variable configure flag
+----------- --------------
+CC --compiler
+CPP --cpp
+CFLAGS --cflags
+CPPFLAGS --cppflags
+LDFLAGS --ldflags
+LIBS --libs
+LD_RUN_PATH --site-runtime-libraries
For more details on the install process, consult the INSTALL file.
binary kit, set the `mail-lock-method' variable at startup, or the
EMACSLOCKMETHOD environment variable.
-** New command-line switches -user-init-file and -user-init-directory.
-These can be used to specify alternate locations for what is normally
-~/.emacs and ~/.xemacs.
+** Init file will move to ~/.xemacs/init.el.
-Moreover, -user <user> (which used to only work in unpredictable ways)
-is now equivalent to
--user-init-file ~<user>/.emacs -user-init-directory ~<user>/.xemacs.
+If `~/.xemacs/init.el' exists, XEmacs will prefer it over `~/.emacs'
+as an init file. The file may be byte-compiled as
+`~/.xemacs/init.elc'.
+
+Future versions of XEmacs will stop supporting `~/.emacs' as an init
+file. XEmacs offers automatic migration upon startup.
+
+** Custom file will move to ~/.xemacs/custom.el.
+
+Whereas customize settings were formerly stored in the regular init
+file, XEmacs now prefers them to be in a separate file
+`~/.xemacs/custom.el', completely under automatic control. This
+change goes with the migration of the init file, and XEmacs offers
+automatic migration upon startup.
** Init file may be called .emacs.el.
-Like in GNU Emacs 20.4 and on, you can now name the XEmacs init file
-`.emacs.el'. Formerly the name had to be `.emacs'. If you use the
-name `.emacs.el', you can byte-compile the file in the usual way.
+For the time being, like in GNU Emacs 20.4 and on, you can now name
+the XEmacs init file `.emacs.el'. Formerly the name had to be
+`.emacs'. If you use the name `.emacs.el', you can byte-compile the
+file in the usual way.
If both `.emacs' and `.emacs.el' exist, the latter file is the one
that is used.
+** New command-line switches -user-init-file and -user-init-directory.
+These can be used to specify alternate locations for what is normally
+~/.emacs and ~/.xemacs.
+
+Moreover, -user <user> (which used to only work in unpredictable ways)
+is now equivalent to -user-init-file ~<user>/.xemacs/init.el
+-user-init-directory ~<user>/.xemacs. or -user-init-file
+~<user>/.emacs -user-init-directory ~<user>/.xemacs, whichever init
+file comes first.
+
** New variable `mswindows-meta-activates-menu'.
If you set this variable to nil then pressing and releasing the Alt
key under MS-Windows will no longer activate the menubar. The default
+2000-07-19 Martin Buchholz <martin@xemacs.org>
+
+ * XEmacs 21.2.35 is released.
+
+2000-07-12 Martin Buchholz <martin@xemacs.org>
+
+ * gnuserv.c:
+ (handle_internet_request):
+ (handle_unix_request):
+ (internet_init):
+ Use socklen_t instead of int or size_t.
+
+2000-07-11 Martin Buchholz <martin@xemacs.org>
+
+ * hexl.c (usage): Use full ANSI C prototypes.
+
+2000-07-05 Craig Lanning <lanning@scra.org>
+
+ * Makefile.in.in (INSTALL_DATA):
+ * Makefile.in.in (UTILITIES):
+ * Makefile.in.in (GETOPTDEPS):
+ * Makefile.in.in (i):
+ mingw support: don't try to build gnuclient, add
+ support for building and installing minitar
+
+2000-06-10 Ben Wing <ben@xemacs.org>
+
+ * Makefile.in.in (INSTALLABLES_BASE):
+ * Makefile.in.in (ootags_args):
+ * Makefile.in.in (yow):
+ Build i.exe.
+ Don't build run*.exe.
+
+ * b2m.c:
+ * b2m.c (main):
+ * ellcc.c (main):
+ * etags.c:
+ * etags.c (main):
+ * etags.c (get_compressor_from_suffix):
+ * etags.c (process_file):
+ * etags.c (readline_internal):
+ * etags.c (etags_getcwd):
+ * etags.c (relative_filename):
+ * etags.c (absolute_filename):
+ * etags.c (filename_is_absolute):
+ * etags.c (canonicalize_filename):
+ * fakemail.c:
+ * fakemail.c (make_file_preface):
+ * getopt.c:
+ * getopt.h:
+ * gnuclient.c:
+ * gnuclient.c (filename_expand):
+ * gnuserv.h:
+ * gnuserv.h (PATCHLEVEL):
+ * hexl.c:
+ * hexl.c (main):
+ * make-docfile.c:
+ * make-docfile.c (APPEND_BINARY):
+ * make-docfile.c (main):
+ * make-dump-id.c:
+ * mmencode.c:
+ * mmencode.c (fromqp):
+ * mmencode.c (main):
+ * movemail.c:
+ * movemail.c (main):
+ * movemail.c (popmail):
+ * ootags.c:
+ * ootags.c (main):
+ * ootags.c (readline_internal):
+ * ootags.c (etags_getcwd):
+ * ootags.c (absolute_filename):
+ * ootags.c (filename_is_absolute):
+ * ootags.c (canonicalize_filename):
+ * pop.c:
+ * pop.c (DONT_ENCAPSULATE):
+ * pop.c (pop_open):
+ * pop.c (socket_connection):
+ * pop.c (pop_trash):
+ * profile.c (gettimeofday):
+ * wakeup.c:
+ * yow.c (rootrelativepath):
+ Remove MSDOS support, converting to WIN32_NATIVE where necessary.
+ WINDOWSNT -> WIN32_NATIVE.
+ __CYGWIN32__ -> CYGWIN.
+ DOS_NT -> WIN32_NATIVE.
+ Remove unused NO_SHORTNAMES.
+ Changes for removed nt\inc.
+
+2000-06-07 Ben Wing <ben@xemacs.org>
+
+ * run.c, run.h, run.rc: Removed. We no longer need these for
+ building runxemacs.exe, and it's questionable at best whether
+ rungnuclient.exe was ever used or is even needed. The correct
+ solution is just to make gnuclient.exe a windows program and
+ use the gnuattach script to run 'i gnuclient.exe'. Not that
+ gnuclient currently works under Windows native in any case.
+
2000-05-28 Martin Buchholz <martin@xemacs.org>
* XEmacs 21.2.34 is released.
## Things that a user might actually run,
## which should be installed in bindir.
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
INSTALLABLES_BASE = etags ctags b2m ootags
#else
INSTALLABLES_BASE = etags ctags b2m gnuclient ootags
#endif
INSTALLABLE_SCRIPTS = rcs-checkin gnudoit gnuattach
#ifdef HAVE_SHLIB
-#ifdef HAVE_MS_WINDOWS
-INSTALLABLES = $(INSTALLABLES_BASE) runxemacs rungnuclient ellcc
-#else
INSTALLABLES = $(INSTALLABLES_BASE) ellcc
-#endif
-#else
-#ifdef HAVE_MS_WINDOWS
-INSTALLABLES = $(INSTALLABLES_BASE) runxemacs rungnuclient
#else
INSTALLABLES = $(INSTALLABLES_BASE)
#endif
-#endif
## Things that Emacs runs internally, or during the build process,
## which should not be installed in bindir.
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
UTILITIES= make-path wakeup profile make-docfile digest-doc \
- sorted-doc movemail cvtmail yow hexl \
- mmencode
+ sorted-doc movemail cvtmail yow i hexl \
+ mmencode minitar
#else
UTILITIES= make-path wakeup profile make-docfile digest-doc \
sorted-doc movemail cvtmail fakemail yow hexl \
regex.o: ${srcdir}/../src/regex.c ${top_srcdir}/src/regex.h
$(CC) -c `echo $(cflags) | sed 's/-Demacs/ /'` \
- -DINHIBIT_STRING_HEADER ${top_srcdir}/src/regex.c
+ -DINHIBIT_STRING_HEADER ${top_srcdir}/src/regex.c
etags_args = $(cflags) -DVERSION='"${version}"' ${srcdir}/etags.c \
$(GETOPTOBJS) regex.o $(ldflags)
ellcc: ${ellcc_deps}
$(CC) ${ellcc_args} -o $@
-run_args = $(cflags) -DVERSION='"${version}"' ${srcdir}/run.c \
- $(ldflags) -Wl,--subsystem,windows -e _mainCRTStartup
-run_deps = ${srcdir}/run.c ${srcdir}/run.h ${srcdir}/run.rc \
- ${srcdir}/../nt/xemacs.ico ${srcdir}/../nt/file.ico \
- ${srcdir}/../nt/lisp.ico
-
-run: ${run_deps}
- windres --include-dir ${srcdir}/../nt -i run.rc -o run_res.o
- $(CC) run_res.o ${run_args} -o $@
- strip $@.exe
-
-runxemacs: run
- cp run.exe $@.exe
-
-rungnuclient: run
- cp run.exe $@.exe
-
ootags_args = $(cflags) -DVERSION='"${version}"' ${srcdir}/ootags.c \
$(GETOPTOBJS) regex.o $(ldflags)
ootags_deps = ${srcdir}/ootags.c $(GETOPTDEPS) regex.o ../src/config.h
yow: ${srcdir}/yow.c ../src/paths.h
$(CC) $(cflags) ${srcdir}/yow.c $(ldflags) -o $@
+i: ${srcdir}/i.c
+ $(CC) $(cflags) ${srcdir}/i.c $(ldflags) -o $@
+
+minitar: ${srcdir}/../nt/minitar.c
+ $(CC) $(cflags) ${srcdir}/../nt/minitar.c $(ldflags) -lz -o $@
+
hexl: ${srcdir}/hexl.c
$(CC) $(cflags) ${srcdir}/hexl.c $(ldflags) -o $@
#include <string.h>
#include <time.h>
#include <sys/types.h>
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
#include <fcntl.h>
#endif
char *labels = NULL, *p, *today;
struct linebuffer data;
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
_fmode = O_BINARY; /* all of files are treated as binary files */
-#if __DJGPP__ > 1
if (!isatty (fileno (stdout)))
setmode (fileno (stdout), O_BINARY);
if (!isatty (fileno (stdin)))
setmode (fileno (stdin), O_BINARY);
-#else /* not __DJGPP__ > 1 */
- (stdout)->_flag &= ~_IOTEXT;
- (stdin)->_flag &= ~_IOTEXT;
-#endif /* not __DJGPP__ > 1 */
#endif
progname = argv[0];
prog_argc = argc;
prog_argv = argv;
-#if defined(MSDOS) || defined(WINDOWSNT)
+#if defined(WIN32_NATIVE)
tmp = strrchr (argv[0], '\\');
if (tmp != (char *)0)
tmp++;
# define _GNU_SOURCE 1 /* enables some compiler checks on GNU */
#endif
-#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
+#ifdef WIN32_NATIVE
# include <stdlib.h>
# include <fcntl.h>
# include <string.h>
# include <direct.h>
# include <io.h>
# define MAXPATHLEN _MAX_PATH
-# ifdef HAVE_CONFIG_H
-# undef HAVE_NTGUI
-# else
-# define DOS_NT
-# endif /* not HAVE_CONFIG_H */
# ifndef HAVE_GETCWD
# define HAVE_GETCWD
# endif /* undef HAVE_GETCWD */
-#else /* !WINDOWSNT */
+#else /* !WIN32_NATIVE */
# ifdef STDC_HEADERS
# include <stdlib.h>
# include <string.h>
# else
extern char *getenv ();
# endif
-#endif /* !WINDOWSNT */
+#endif /* !WIN32_NATIVE */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#else
-# if defined (HAVE_GETCWD) && !WINDOWSNT
+# if defined (HAVE_GETCWD) && !defined (WIN32_NATIVE)
extern char *getcwd (char *buf, size_t size);
# endif
#endif /* HAVE_UNISTD_H */
bool got_err;
#endif
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
_fmode = O_BINARY; /* all of files are treated as binary files */
-#endif /* DOS_NT */
+#endif /* WIN32_NATIVE */
progname = argv[0];
nincluded_files = 0;
if (streq (tagfile, "-"))
{
tagf = stdout;
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* 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 /* DOS_NT */
+#endif /* WIN32_NATIVE */
}
else
tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
char *slash, *suffix;
/* This relies on FN to be after canonicalize_filename,
- so we don't need to consider backslashes on DOS_NT. */
+ so we don't need to consider backslashes on WIN32_NATIVE. */
slash = etags_strrchr (file, '/');
suffix = etags_strrchr (file, '.');
if (suffix == NULL || suffix < slash)
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 (!MSDOS)
+ if (1) /* !MSDOS */
break; /* do it only once: not really a loop */
if (extptr != NULL)
*extptr = ++suffix;
compressed_name = concat (file, ".", compr->suffix);
if (stat (compressed_name, &stat_buf) != 0)
{
- 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 */
+ /* XEmacs: delete MSDOS code */
free (compressed_name);
compressed_name = NULL;
}
if (p > buffer && p[-1] == '\r')
{
p -= 1;
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* 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;
return path;
#else /* not HAVE_GETCWD */
-#ifdef 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;
pclose (pipe);
return path.buffer;
-#endif /* not MSDOS */
#endif /* not HAVE_GETCWD */
}
while (*fp++ == *dp++)
continue;
fp--, dp--; /* back to the first differing char */
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
if (fp == afn && afn[0] != '/') /* cannot build a relative name */
return afn;
#endif
if (filename_is_absolute (file))
res = savestr (file);
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* We don't support non-absolute file names with a drive
letter, like `d:NAME' (it's too much hassle). */
else if (file[1] == ':')
while (cp >= res && !filename_is_absolute (cp));
if (cp < res)
cp = slashp; /* the absolute name begins with "/.." */
-#ifdef DOS_NT
- /* Under MSDOS and NT we get `d:/NAME' as absolute
+#ifdef WIN32_NATIVE
+ /* Under Windows 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] != '/')
char *fn;
{
return (fn[0] == '/'
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
|| (isalpha(fn[0]) && fn[1] == ':' && fn[2] == '/')
#endif
);
canonicalize_filename (fn)
register char *fn;
{
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* Canonicalize drive letter case. */
if (islower (fn[0]) && fn[1] == ':')
fn[0] = toupper (fn[0]);
return 1;
}
#else /* not BSD 4.2 (or newer) */
-#ifdef MSDOS
-int
-main (int argc, char *argv[])
-{
- return 0;
-}
-#else /* not MSDOS */
-/* This conditional contains all the rest of the file. */
/* These are defined in config in some versions. */
/* the_date has an unwanted newline at the end */
date_length = strlen (the_date) - 1;
the_date[date_length] = '\0';
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
temp = "(null)";
#else
temp = cuserid ((char *) NULL);
return close_the_streams ();
}
-#endif /* not MSDOS */
#endif /* not BSD 4.2 (or newer) */
#endif
#endif
-#if defined (WIN32) && !defined (__CYGWIN32__)
+#if defined (WIN32_NATIVE) && !defined (CYGWIN)
/* It's not Unix, really. See? Capital letters. */
#include <windows.h>
#undef getpid
#define required_argument 1
#define optional_argument 2
-#if defined (__GNU_LIBRARY__) || defined (__cplusplus)
+#if defined (__GNU_LIBRARY__) || defined (__cplusplus) || defined (CYGWIN)
/* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */
Please mail bugs and suggestions to the XEmacs maintainer.
*/
+/* #### This file should be a windows-mode, not console-mode program under
+ Windows. (i.e. its entry point should be WinMain.) gnuattach functionality,
+ to the extent it's used at all, should be retrieved using a script that
+ calls the i.exe wrapper program, to obtain stdio handles.
+
+ #### For that matter, both the functionality of gnuclient and gnuserv
+ should be merged into XEmacs itself using a -remote arg, just like
+ Netscape and other modern programs.
+
+ --ben */
+
/*
* This file incorporates new features added by Bob Weiner <weiner@mot.com>,
* Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
-#define DONT_ENCAPSULATE
#include <sysfile.h>
#ifdef HAVE_STRING_H
/* Absolute (unix-style) pathname. Do nothing */
strcat (fullpath, filename);
}
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
else if (filename[0] && filename[0] == '\\' &&
filename[1] && filename[1] == '\\')
{
Please mail bugs and suggestions to the author at the above address.
*/
-/* HISTORY
- * 11-Nov-1990 bristor@simba
+/* HISTORY
+ * 11-Nov-1990 bristor@simba
* Added EOT stuff.
*/
ipc_exit (int stat)
{
msgctl (ipc_qid,IPC_RMID,0);
-
+
if (ipc_wpid != 0)
kill (ipc_wpid, SIGKILL);
} /* ipc_handle_signal */
-/*
+/*
ipc_spawn_watchdog -- spawn a watchdog task to clean up the message queue should the
server process die.
*/
msgctl (ipc_qid, IPC_STAT, &msg_st);
strncpy (buf, msgp->mtext, len);
buf[len] = '\0'; /* terminate */
-
+
printf ("%d %s", ipc_qid, buf);
fflush (stdout);
/* read in "n/m:" (n=client fd, m=message length) */
- while (offset < (GSERV_BUFSZ-1) &&
+ while (offset < (GSERV_BUFSZ-1) &&
((len = read (0, buf + offset, 1)) > 0) &&
buf[offset] != ':')
{
exit (1);
}
- /* Send this string off, but only if we have enough space */
+ /* Send this string off, but only if we have enough space */
if (GSERV_BUFSZ > total)
{
int len;
printf("%d ",s);
-
+
/* read until we get a newline or no characters */
while ((len = recv(s,buf,GSERV_BUFSZ-1,0)) > 0) {
buf[len] = '\0';
fprintf(stderr,"%s: unable to recv\n",progname);
exit(1);
} /* if */
-
+
} /* echo_request */
int result_len;
/* read in "n/m:" (n=client fd, m=message length) */
- while (offset < GSERV_BUFSZ &&
+ while (offset < GSERV_BUFSZ &&
((len = read(0,buf+offset,1)) > 0) &&
buf[offset] != ':') {
offset += len;
fprintf(stderr,"%s: unable to read\n",progname);
exit(1);
}
-
+
/* parse the response from emacs, getting client fd & result length */
buf[offset] = '\0';
sscanf(buf,"%d/%d", &s, &result_len);
/* send the newline */
buf[1] = '\0';
send_string(s,buf);
- close(s);
+ close(s);
} /* handle_response */
#endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
# include <X11/Xauth.h>
static Xauth *server_xauth = NULL;
-#endif
+#endif
-static int
+static int
timed_read (int fd, char *buf, int max, int timeout, int one_line)
{
fd_set rmask;
char c = 0;
int nbytes = 0;
int r;
-
+
tv.tv_sec = timeout;
tv.tv_usec = 0;
FD_ZERO(&rmask);
FD_SET(fd, &rmask);
-
+
do
{
r = select(fd + 1, &rmask, NULL, NULL, &tv);
return nbytes;
}
-
-
+
+
/*
permitted -- return whether a given host is allowed to connect to the server.
int key;
struct entry *entry;
- char auth_protocol[128];
+ char auth_protocol[128];
char buf[1024];
int auth_data_len;
/* we are checking permission on a real connection */
/* Read auth protocol name */
-
+
if (timed_read(fd, auth_protocol, AUTH_NAMESZ, AUTH_TIMEOUT, 1) <= 0)
return FALSE;
if (strcmp (auth_protocol, DEFAUTH_NAME) &&
strcmp (auth_protocol, MCOOKIE_NAME))
{
- printf ("authentication protocol (%s) from client is invalid...\n",
+ printf ("authentication protocol (%s) from client is invalid...\n",
auth_protocol);
printf ("... Was the client an old version of gnuclient/gnudoit?\004\n");
-
+
return FALSE;
}
if (timed_read(fd, buf, auth_data_len, AUTH_TIMEOUT, 0) != auth_data_len)
return FALSE;
-
+
#ifdef AUTH_MAGIC_COOKIE
if (server_xauth && server_xauth->data &&
!memcmp(buf, server_xauth->data, auth_data_len))
{
return TRUE;
}
-#else
+#else
printf ("client tried Xauth, but server is not compiled with Xauth\n");
#endif
-
+
/*
* auth failed, but allow this to fall through to the GNU_SECURE
* protocol....
printf ("Xauth authentication failed, trying GNU_SECURE auth...\004\n");
}
-
+
/* Other auth protocols go here, and should execute only if the
* auth_protocol name matches.
*/
/* Now, try the old GNU_SECURE stuff... */
-
+
/* First find the hash key */
key = HASH(host_addr) % TABLE_SIZE;
-
+
/* Now check the chain for that hash key */
for(entry=permitted_hosts[key]; entry != NULL; entry=entry->next)
- if (host_addr == entry->host_addr)
+ if (host_addr == entry->host_addr)
return(TRUE);
-
+
return(FALSE);
} /* permitted */
-/*
+/*
add_host -- add the given host to the list of permitted hosts, provided it isn't
already there.
-*/
+*/
static void
add_host (u_long host_addr)
{
int key;
struct entry *new_entry;
-
+
if (!permitted(host_addr, -1))
{
if ((new_entry = (struct entry *) malloc(sizeof(struct entry))) == NULL) {
char hostname[HOSTNAMSZ];
u_int host_addr;
int i, hosts=0;
-
+
/* Make sure every entry is null */
for (i=0; i<TABLE_SIZE; i++)
permitted_hosts[i] = NULL;
if ((host_addr = internet_addr(hostname)) == -1)
{
- fprintf(stderr,"%s: unable to find %s in /etc/hosts or from YP",
+ fprintf(stderr,"%s: unable to find %s in /etc/hosts or from YP",
progname,hostname);
exit(1);
} /* if */
#ifdef AUTH_MAGIC_COOKIE
-
- server_xauth = XauGetAuthByAddr (FamilyInternet,
+
+ server_xauth = XauGetAuthByAddr (FamilyInternet,
sizeof(host_addr), (char *)&host_addr,
- strlen(MCOOKIE_SCREEN), MCOOKIE_SCREEN,
+ strlen(MCOOKIE_SCREEN), MCOOKIE_SCREEN,
strlen(MCOOKIE_X_NAME), MCOOKIE_X_NAME);
hosts++;
#endif /* AUTH_MAGIC_COOKIE */
-
+
#if 0 /* Don't even want to allow access from the local host by default */
add_host(host_addr); /* add local host */
-#endif
+#endif
if (((file_name = getenv("GNU_SECURE")) != NULL && /* security file */
(host_file = fopen(file_name,"r")) != NULL)) /* opened ok */
struct sockaddr_in server; /* for local socket address */
char *ptr; /* ptr to return from getenv */
- if (setup_table() == 0)
+ if (setup_table() == 0)
return -1;
/* clear out address structure */
- memset((char *)&server,0,sizeof(struct sockaddr_in));
-
+ memset (&server, '\0', sizeof (server));
+
/* Set up address structure for the listen socket. */
server.sin_family = AF_INET;
server.sin_addr.s_addr = INADDR_ANY;
server.sin_port = htons(DEFAULT_PORT+getuid());
else
server.sin_port = sp->s_port;
-
+
/* Create the listen socket. */
if ((ls = socket (AF_INET,SOCK_STREAM, 0)) == -1)
{
fprintf(stderr,"%s: unable to create socket\n",progname);
exit(1);
} /* if */
-
+
/* Bind the listen address to the socket. */
if (bind(ls,(struct sockaddr *) &server,sizeof(struct sockaddr_in)) == -1)
{
} /* if */
/* Initiate the listen on the socket so remote users
- * can connect.
+ * can connect.
*/
if (listen(ls,20) == -1)
{
handle_internet_request (int ls)
{
int s;
- size_t addrlen = sizeof(struct sockaddr_in);
+ socklen_t addrlen = sizeof (struct sockaddr_in);
struct sockaddr_in peer; /* for peer socket address */
- memset((char *)&peer,0,sizeof(struct sockaddr_in));
+ memset (&peer, '\0', sizeof (peer));
if ((s = accept(ls,(struct sockaddr *)&peer, &addrlen)) == -1)
{
fprintf(stderr,"%s: unable to accept\n",progname);
exit(1);
} /* if */
-
+
/* Check that access is allowed - if not return crud to the client */
if (!permitted(peer.sin_addr.s_addr, s))
{
} /* if */
echo_request(s);
-
+
} /* handle_internet_request */
#endif /* INTERNET_DOMAIN_SOCKETS */
{
int ls; /* socket descriptor */
struct sockaddr_un server; /* unix socket address */
- int bindlen;
+ socklen_t bindlen;
if ((ls = socket(AF_UNIX,SOCK_STREAM, 0)) < 0)
{
#else
bindlen = strlen (server.sun_path) + sizeof (server.sun_family);
#endif
-
+
if (bind(ls,(struct sockaddr *)&server,bindlen) < 0)
{
perror(progname);
/* #### there are also better ways of dealing with this when
sigvec() is present. */
#if defined (HAVE_SIGPROCMASK)
- {
+ {
sigset_t _mask;
sigemptyset (&_mask);
sigaddset (&_mask, SIGPIPE);
handle_unix_request (int ls)
{
int s;
- size_t len = sizeof(struct sockaddr_un);
+ socklen_t len = sizeof (struct sockaddr_un);
struct sockaddr_un server; /* for unix socket address */
server.sun_family = AF_UNIX;
} /* if */
echo_request(s);
-
+
} /* handle_unix_request */
#endif /* UNIX_DOMAIN_SOCKETS */
FD_SET(uls, &rmask);
if (ils >= 0)
FD_SET(ils, &rmask);
-
- if (select(max2(fileno(stdin),max2(uls,ils)) + 1, &rmask,
+
+ if (select(max2(fileno(stdin),max2(uls,ils)) + 1, &rmask,
(fd_set *)NULL, (fd_set *)NULL, (struct timeval *)NULL) < 0)
{
perror(progname);
#define USE_TMPDIR
-#define NO_SHORTNAMES
-
#define PATCHLEVEL 2
#define NO_SHORTNAMES
/* gnuserv should not be compiled using SOCKS */
#define DO_NOT_SOCKSIFY
+#define DONT_ENCAPSULATE
#include <config.h>
-#undef read
-#undef write
-#undef open
-#undef close
#undef signal
/* Define the communication method between server and clients:
*/
#ifndef DONT_USE_LITOUT
#if !defined(HAVE_TERMIO) && !defined(HAVE_TERMIOS) && !defined(VMS)
-#if !defined(MSDOS) && !defined(BSD4_1)
+#if !defined(BSD4_1)
#define USE_LITOUT
#endif
#endif
#include <stdio.h>
#include <ctype.h>
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <io.h>
#include <fcntl.h>
#endif
#if __STDC__ || defined(STDC_HEADERS)
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <string.h>
#endif
{
char buf[18];
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
_setmode (_fileno (stdout), O_BINARY);
#endif
for (;;)
}
else
{
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
_setmode (_fileno (fp), O_BINARY);
#endif
address = 0;
}
void
-usage ()
+usage (void)
{
(void) fprintf (stderr, "usage: %s [-de] [-iso]\n", progname);
exit (1);
#include <errno.h>
#if __STDC__ || defined(STDC_HEADERS)
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <string.h>
#include <ctype.h>
#endif
-#if defined(MSDOS) || defined(__CYGWIN32__)
+#ifdef CYGWIN
#include <fcntl.h>
-#endif /* MSDOS */
-#ifdef WINDOWSNT
+#endif
+#ifdef WIN32_NATIVE
#include <direct.h>
#include <fcntl.h>
#include <io.h>
#include <stdlib.h>
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
+#ifndef WIN32_NATIVE
#include <sys/param.h>
+#endif /* not WIN32_NATIVE */
-#if defined(DOS_NT) || defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
#define READ_TEXT "rt"
#define READ_BINARY "rb"
#define WRITE_BINARY "wb"
#define APPEND_BINARY "ab"
-#else /* not DOS_NT */
+#else /* not WIN32_NATIVE */
#define READ_TEXT "r"
#define READ_BINARY "r"
#define WRITE_BINARY "w"
#define APPEND_BINARY "a"
-#endif /* not DOS_NT */
-
-#ifdef MSDOS
-/* s/msdos.h defines this as sys_chdir, but we're not linking with the
- file where that function is defined. */
-#undef chdir
-#endif
+#endif /* not WIN32_NATIVE */
/* Stdio stream for output to the DOC file. */
static FILE *outfile;
outfile = stdout;
/* Don't put CRs in the DOC file. */
-#ifdef MSDOS
- _fmode = O_BINARY;
-#if 0 /* Suspicion is that this causes hanging.
- So instead we require people to use -o on MSDOS. */
- (stdout)->_flag &= ~_IOTEXT;
- _setmode (fileno (stdout), O_BINARY);
-#endif
- outfile = 0;
-#endif /* MSDOS */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
_fmode = O_BINARY;
_setmode (fileno (stdout), O_BINARY);
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
/* If first two args are -o FILE, output to FILE. */
i = 1;
putc(c1<<4 | c2, outfile);
}
} else {
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
if (*s == '\n')
putc('\r', outfile); /* insert CR for binary-mode write */
#endif
OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
*/
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
+#include <io.h>
#include <fcntl.h>
#endif
exit(-1);
}
} else {
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
if (encode)
fp = fopen(argv[i], "rb");
else
} /* else */
#else
fp = fopen(argv[i], "r");
-#endif /* MSDOS */
+#endif /* WIN32_NATIVE */
if (!fp) {
perror(argv[i]);
exit(-1);
}
}
}
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
if (fp == stdin) setmode(fileno(fp), O_BINARY);
-#endif /* MSDOS */
+#endif /* WIN32_NATIVE */
if (which == BASE64) {
if (encode) {
to64(fp, fpo, portablenewlines);
#include <errno.h>
#include "../src/sysfile.h"
#include "../src/syswait.h"
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#include "../src/systime.h"
#endif
#include <stdlib.h>
char * strerror (int errnum);
#endif /* HAVE_STRERROR */
-#ifdef MSDOS
-#undef access
-#endif /* MSDOS */
-
#ifndef DIRECTORY_SEP
#define DIRECTORY_SEP '/'
#endif
#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
#endif
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#undef access
#undef unlink
#define fork() 0
properly - make sure it does before you enable this! */
#define DISABLE_DIRECT_ACCESS
#include <io.h>
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#if defined (HAVE_UNISTD_H)
#include <unistd.h>
exit (retcode);
}
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
setuid (getuid ());
#endif
#endif /* MAIL_USE_POP */
#ifdef MAIL_USE_POP
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <winsock.h>
#endif
#include <stdio.h>
-#include <pwd.h>
+#include "../src/syspwd.h"
#define POP_ERROR (-1)
#define POP_RETRIEVED (0)
error ("Error in open: %s, %s", strerror (errno), outfile);
return (1);
}
-#if !defined(__CYGWIN32__) && !defined(WINDOWSNT)
+#if !defined(CYGWIN) && !defined(WIN32_NATIVE)
fchown (mbfi, getuid (), (gid_t) -1);
#endif
# define DEBUG FALSE
#endif
-#ifdef MSDOS
-# include <fcntl.h>
-# include <sys/param.h>
-# include <io.h>
-# ifndef HAVE_CONFIG_H
-# define DOS_NT
-# include <sys/config.h>
-# endif
-#endif /* MSDOS */
-
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
# include <stdlib.h>
# include <fcntl.h>
# include <string.h>
# include <io.h>
# define MAXPATHLEN _MAX_PATH
-# ifdef HAVE_CONFIG_H
-# undef HAVE_NTGUI
-# else
-# define DOS_NT
+# ifndef HAVE_CONFIG_H
# define HAVE_GETCWD
# endif /* not HAVE_CONFIG_H */
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
-#if !defined (WINDOWSNT) && defined (STDC_HEADERS)
+#if !defined (WIN32_NATIVE) && defined (STDC_HEADERS)
#include <stdlib.h>
#include <string.h>
#endif
bool got_err;
#endif
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
_fmode = O_BINARY; /* all of files are treated as binary files */
-#endif /* DOS_NT */
+#endif /* WIN32_NATIVE */
progname = argv[0];
nincluded_files = 0;
if (streq (tagfile, "-"))
{
tagf = stdout;
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* 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 /* DOS_NT */
+#endif /* WIN32_NATIVE */
}
else
tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
if (p > buffer && p[-1] == '\r')
{
p -= 1;
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* 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;
return path;
#else /* not HAVE_GETCWD */
-#ifdef 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;
pclose (pipe);
return path.buffer;
-#endif /* not MSDOS */
#endif /* not HAVE_GETCWD */
}
if (filename_is_absolute (file))
res = savestr (file);
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* We don't support non-absolute file names with a drive
letter, like `d:NAME' (it's too much hassle). */
else if (file[1] == ':')
while (cp >= res && !filename_is_absolute (cp));
if (cp < res)
cp = slashp; /* the absolute name begins with "/.." */
-#ifdef DOS_NT
- /* Under MSDOS and NT we get `d:/NAME' as absolute
+#ifdef WIN32_NATIVE
+ /* Under Windows 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] != '/')
char *fn;
{
return (fn[0] == '/'
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
|| (isalpha(fn[0]) && fn[1] == ':' && fn[2] == '/')
#endif
);
canonicalize_filename (fn)
register char *fn;
{
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
for (; *fn != '\0'; fn++)
if (*fn == '\\')
*fn = '/';
#ifdef HAVE_CONFIG_H
#define NO_SHORTNAMES /* Tell config not to load remap.h */
+#define DONT_ENCAPSULATE
#include <config.h>
#else
#define MAIL_USE_POP
#ifdef MAIL_USE_POP
-#ifdef HAVE_CONFIG_H
-/* Cancel these substitutions made in config.h */
-#undef open
-#undef read
-#undef write
-#undef close
-#endif
-
#include <sys/types.h>
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <winsock.h>
#undef SOCKET_ERROR
#define RECV(s,buf,len,flags) recv(s,buf,len,flags)
extern struct servent *hes_getservbyname (/* char *, char * */);
#endif
-#include <pwd.h>
+#include "../src/syspwd.h"
+#ifndef WIN32_NATIVE
#include <netdb.h>
+#endif
#include <errno.h>
#include <stdio.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <sys/stat.h>
+#ifndef WIN32_NATIVE
#include <sys/file.h>
+#endif
#include "../src/syswait.h"
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#include "../src/systime.h"
#endif
#include <stdlib.h>
#endif /* ! KRB5 */
#endif /* KERBEROS */
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#if !defined(HAVE_H_ERRNO) || !defined(HAVE_CONFIG_H)
extern int h_errno;
#endif
#define ERROR_MAX 80 /* a pretty arbitrary size */
#define POP_PORT 110
#define KPOP_PORT 1109
-#if defined(WINDOWSNT) || defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
#define POP_SERVICE "pop3" /* we don't want the POP2 port! */
#else
#define POP_SERVICE "pop"
username = getenv ("USER");
if (! (username && *username))
{
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
username = getlogin ();
if (! (username && *username))
{
if ((! password) && (! DONT_NEED_PASSWORD))
{
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
if (! (flags & POP_NO_GETPASS))
{
password = getpass ("Enter POP password:");
return (ret);
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
static int have_winsock = 0;
#endif
int try_count = 0;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
{
WSADATA winsockData;
if (WSAStartup (0x101, &winsockData) == 0)
}
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
if (have_winsock)
WSACleanup ();
#endif
static int watch_not_started = 1; /* flag */
static char time_string[30];
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <sys/timeb.h>
/* Emulate gettimeofday (Ulrich Leodolter, 1/11/95). */
void
#if __STDC__ || defined(STDC_HEADERS)
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
+#endif
#include <stdio.h>
#include <sys/types.h>
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef sleep
#define sleep(t) Sleep ((t) * 1000)
#define getppid() (0)
#undef HAVE_SYS_TIME_H
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
void yow (FILE *fp);
void setup_yow (FILE *fp);
-#ifdef MSDOS
+#ifdef WIN32_NATIVE
#define rootrelativepath(rel) \
({\
static char res[BUFSIZE], *p;\
;; Finds all documentation related to APROPOS-REGEXP in internal-doc-file-name.
(defun apropos-documentation-check-doc-file ()
- (let (type symbol (sepa 2) sepb beg end)
+ (let (type symbol (sepa 2) sepb beg end doc)
(insert ?\^_)
(backward-char)
(insert-file-contents (concat doc-directory internal-doc-file-name))
(defvar generate-autoload-section-trailer "\n;;;***\n"
"String which indicates the end of the section of autoloads for a file.")
+(defvar autoload-package-name nil)
+
;;; Forms which have doc-strings which should be printed specially.
;;; A doc-string-elt property of ELT says that (nth ELT FORM) is
;;; the doc-string in FORM.
(goto-char (point-max))
(insert "\n(provide '" sym ")\n")))))
-(defvar autoload-package-name nil)
-
;; #### this function is almost identical, but subtly different,
;; from batch-update-autoloads. Steve, it's your responsibility to
;; clean this up. The two should be merged, but I'm not sure what
\f
+(eval-when-compile (autoload 'visit-tags-table "etags"))
+
(defun Buffer-menu-visit-tags-table ()
"Visit the tags table in the buffer on this line. See `visit-tags-table'."
(interactive)
(defalias 'mime-edit-insert-binary-file
'mime-editor/insert-binary-file)))
+;;;###autoload
(defun build-report (&rest args)
"Initializes a fresh mail composition buffer using `compose-mail'
with the contents of XEmacs Installation file and excerpts from XEmacs
#'(lambda (n p f)
(list 'put (list 'quote n) (list 'quote p)
(list 'function (cons 'lambda f))))))
- (car (or features (setq features (list 'cl-kludge))))))
+ 'xemacs))
;;; Initialization.
;;; this file independent from cl-macs.
(defmacro cl-parsing-keywords (kwords other-keys &rest body)
+ "Helper macro for functions with keyword arguments.
+This is a temporary solution, until keyword arguments are natively supported.
+Declare your function ending with (... &rest cl-keys), then wrap the
+function body in a call to `cl-parsing-keywords'.
+
+KWORDS is a list of keyword definitions. Each definition should be
+either a keyword or a list (KEYWORD DEFAULT-VALUE). In the former case,
+the default value is nil. The keywords are available in BODY as the name
+of the keyword, minus its initial colon and prepended with `cl-'.
+
+OTHER-KEYS specifies other keywords that are accepted but ignored. It
+is either the value 't' (ignore all other keys, equivalent to the
+&allow-other-keys argument declaration in Common Lisp) or a list in the
+same format as KWORDS. If keywords are given that are not in KWORDS
+and not allowed by OTHER-KEYS, an error will normally be signalled; but
+the caller can override this by specifying a non-nil value for the
+keyword :allow-other-keys (which defaults to t)."
(cons
'let*
(cons (mapcar
(defun cl-hack-byte-compiler ()
(if (and (not cl-hacked-flag) (fboundp 'byte-compile-file-form))
(progn
+ (when (not (fboundp 'cl-compile-time-init))
+ (load "cl-macs" nil t))
(cl-compile-time-init) ; in cl-macs.el
(setq cl-hacked-flag t))))
:group 'editing-basics)
(defun command-error (error-object)
- (let ((inhibit-quit t)
- (debug-on-error nil)
- (etype (car-safe error-object)))
+ (let* ((old-debug-on-error debug-on-error)
+ (inhibit-quit t)
+ (debug-on-error nil)
+ (etype (car-safe error-object)))
(setq quit-flag nil)
(setq standard-output t)
(setq standard-input t)
(if (noninteractive)
(progn
- (message "%s exiting." emacs-program-name)
+ (if old-debug-on-error
+ (progn
+ (message "Backtrace:\n\n")
+ (backtrace)
+ (message "\n")))
+ (message "%s exiting\n." emacs-program-name)
(kill-emacs -1)))
t))
("TUTORIAL\\.\\(?:hr\\|pl\\|ro\\)\\'" . iso-8859-2)
;; ("\\.\\(el\\|emacs\\|info\\(-[0-9]+\\)?\\|texi\\)$" . iso-2022-8)
;; ("\\(ChangeLog\\|CHANGES-beta\\)$" . iso-2022-8)
- ("/spool/mail/.*$" . convert-mbox-coding-system))
+
+ ;; This idea is totally broken, and the code didn't work anyway.
+ ;; Mailboxes should be decoded by mail clients, who actually know
+ ;; how to deal with them. Otherwise, their contents should be
+ ;; treated as `binary'.
+ ;("/spool/mail/.*$" . convert-mbox-coding-system)
+ )
"Alist to decide a coding system to use for a file I/O operation.
The format is ((PATTERN . VAL) ...),
where PATTERN is a regular expression matching a file name,
((find-coding-system codesys))
))))
-(defun convert-mbox-coding-system (filename visit start end)
- "Decoding function for Unix mailboxes.
-Does separate detection and decoding on each message, since each
-message might be in a different encoding."
- (let ((buffer-read-only nil))
- (save-restriction
- (narrow-to-region start end)
- (goto-char (point-min))
- (while (not (eobp))
- (let ((start (point))
- end)
- (forward-char 1)
- (if (re-search-forward "^From" nil 'move)
- (beginning-of-line))
- (setq end (point))
- (decode-coding-region start end 'undecided))))))
+;; This is completely broken, not only in implementation (does not
+;; understand MIME), but in concept -- such high-level decoding should
+;; be done by mail readers, not by IO code!
+
+;(defun convert-mbox-coding-system (filename visit start end)
+;...
(defun find-coding-system-magic-cookie ()
"Look for the coding-system magic cookie in the current buffer.\n"
(cond ((consp ret)
(setq cs-r (car ret)
cs-w (cdr ret)))
+ ((null ret)
+ (setq cs-r buffer-file-coding-system
+ cs-w buffer-file-coding-system))
((find-coding-system ret)
(setq cs-r ret
cs-w ret))))
(with-temp-file cusload-file
(insert ";;; " cusload-base-file
" --- automatically extracted custom dependencies\n"
- "\n;;; Code:\n\n")
+ "\n;;; Code:\n\n"
+ "(autoload 'custom-add-loads \"cus-load\")\n\n")
(mapatoms
(lambda (sym)
(let ((members (get sym 'custom-group))
(require 'cus-load)
(require 'cus-start)
+(require 'cus-file)
;; Huh? This looks dirty!
(put 'custom-define-hook 'custom-type 'hook)
"Restore the saved value for the variable being edited by WIDGET."
(let* ((symbol (widget-value widget))
(set (or (get symbol 'custom-set) 'set-default))
- (comment-widget (widget-get widget :comment-widget))
(value (get symbol 'saved-value))
(comment (get symbol 'saved-variable-comment)))
(cond ((or value comment)
(defun custom-variable-reset-standard (widget)
"Restore the standard setting for the variable being edited by WIDGET."
(let* ((symbol (widget-value widget))
- (set (or (get symbol 'custom-set) 'set-default))
- (comment-widget (widget-get widget :comment-widget)))
+ (set (or (get symbol 'custom-set) 'set-default)))
(if (get symbol 'standard-value)
(funcall set symbol (eval (car (get symbol 'standard-value))))
(signal 'error (list "No standard setting known for variable" symbol)))
(widget-put widget :custom-state found)))
(custom-magic-reset widget))
-;;; The `custom-save-all' Function.
-;;;###autoload
-(defcustom custom-file "~/.emacs"
- "File used for storing customization information.
-If you change this from the default \"~/.emacs\" you need to
-explicitly load that file for the settings to take effect."
- :type 'file
- :group 'customize)
-
(defun custom-save-delete (symbol)
"Delete the call to SYMBOL form in `custom-file'.
Leave point at the location of the call, or after the last expression."
(run-hooks 'custom-mode-hook))
\f
+;;;###autoload
+(defun custom-migrate-custom-file (new-custom-file-name)
+ "Migrate custom file from home directory."
+ (mapc 'custom-save-delete
+ '(custom-load-themes custom-reset-variables
+ custom-set-variables
+ custom-set-faces
+ custom-reset-faces))
+ (with-current-buffer (find-file-noselect custom-file)
+ (save-buffer))
+ (setq custom-file new-custom-file-name)
+ (custom-save-all))
+\f
;;; The End.
(provide 'cus-edit)
(visible-bell sound boolean)
(x-allow-sendevents x boolean)
(zmacs-regions editing-basics boolean)
+ (load-home-init-file installation boolean)
;; integer
(auto-save-interval auto-save integer)
(bell-volume sound integer)
;;; Code:
(eval-when-compile
- (load "cl-macs"))
+ (load "cl-macs" nil t))
-(if (not (fboundp 'defun*))
- (autoload 'defun* "cl-macs"))
+(autoload 'custom-declare-face "cus-face")
+(autoload 'defun* "cl-macs")
(require 'widget)
((string-match "\\.scm\\'" filename)
'scheme-mode)
(t nil)))
+ (defvar c-mode-syntax-table)
(set-syntax-table (cond ((and (eq file-type 'c-mode)
c-mode-syntax-table)
c-mode-syntax-table)
(and
(featurep 'x)
(x-get-resource "backgroundToolBarColor"
- "BackgroundToolBarColor" 'string))
+ "BackgroundToolBarColor" 'string
+ nil nil 'warn))
(face-background 'toolbar))))
(purecopy '("foregroundToolBarColor"
(and
(featurep 'x)
(x-get-resource "foregroundToolBarColor"
- "ForegroundToolBarColor" 'string))
+ "ForegroundToolBarColor" 'string
+ nil nil 'warn))
(face-foreground 'toolbar))))
)))
(paths-file-readable-directory-p (paths-construct-path (list directory "lisp")))
(paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))
+(defun paths-root-in-place-p (root)
+ "Check if ROOT is an in-place installation root for XEmacs."
+ (paths-file-readable-directory-p (paths-construct-path (list root "lisp"))))
+
(defun paths-chase-symlink (file-name)
"Chase a symlink until the bitter end."
(let ((maybe-symlink (file-symlink-p file-name)))
base))))
(defun paths-find-emacs-directory (roots suffix base
- &optional envvar default keep-suffix)
+ &optional envvar default keep-suffix
+ in-place-external)
"Find a directory in the XEmacs hierarchy.
ROOTS must be a list of installation roots.
SUFFIX is the subdirectory from there.
specify the directory.
DEFAULT is the preferred value.
If KEEP-SUFFIX is non-nil, the suffix must be respected in searching
-the directory."
+the directory.
+If IN-PLACE-EXTERNAL is non-nil, the directory might be found outside
+an in-place root-hierarchy."
(let ((preferred-value (or (and envvar (getenv envvar))
default)))
(if (and preferred-value
(file-name-as-directory preferred-value)
(catch 'gotcha
(while roots
- (let* ((root (car roots))
- ;; installed
- (path (paths-construct-emacs-directory root suffix base)))
- (if (paths-file-readable-directory-p path)
- (throw 'gotcha path)
- ;; in-place
- (if (null keep-suffix)
- (let ((path (paths-construct-emacs-directory root "" base)))
- (if (paths-file-readable-directory-p path)
- (throw 'gotcha path))))))
+ (let ((root (car roots)))
+ ;; installed
+ (let ((path (paths-construct-emacs-directory root suffix base)))
+ (if (paths-file-readable-directory-p path)
+ (throw 'gotcha path)))
+ ;; in-place
+ (if (null keep-suffix)
+ (let ((path (paths-construct-emacs-directory root "" base)))
+ (if (paths-file-readable-directory-p path)
+ (throw 'gotcha path))))
+ (if (and in-place-external
+ (paths-root-in-place-p root))
+ (let ((path (paths-construct-emacs-directory
+ (paths-construct-path '("..") root)
+ "" base)))
+ (if (paths-file-readable-directory-p path)
+ (throw 'gotcha path)))))
(setq roots (cdr roots)))
nil))))
-(defun paths-find-site-directory (roots base &optional envvar default)
- "Find a site-specific directory in the XEmacs hierarchy."
+(defun paths-find-site-directory (roots base &optional envvar default in-place-external)
+ "Find a site-specific directory in the XEmacs hierarchy.
+If IN-PLACE-EXTERNAL is non-nil, the directory might be found outside
+an in-place root-hierarchy."
(paths-find-emacs-directory roots
(file-name-as-directory
(paths-construct-path (list
"lib"
emacs-program-name)))
base
- envvar default))
+ envvar default
+ nil
+ in-place-external))
(defun paths-find-version-directory (roots base
&optional envvar default enforce-version)
(let ((processed nil)
(directory-abbrev-alist
(append
- (mapcar (function (lambda (dir) (cons dir "")))
+ (mapcar (function (lambda (dir)
+ (cons (concat "^" (regexp-quote dir))
+ "")))
finder-abbreviate-directory-list)
directory-abbrev-alist))
(using-load-path))
;; #### barf gag retch. Horrid FSF lossage that we need to
;; keep around for compatibility with font-lock-keywords that
-;; forget to properly quote their faces.
+;; forget to properly quote their faces. I tried just let-binding
+;; them when we eval the face expression, but that failes because
+;; some files actually use the variables directly in their init code
+;; without quoting them. --ben
(defvar font-lock-comment-face 'font-lock-comment-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-doc-string-face 'font-lock-doc-string-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-string-face 'font-lock-string-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-keyword-face 'font-lock-keyword-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-function-name-face 'font-lock-function-name-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-variable-name-face 'font-lock-variable-name-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-type-face 'font-lock-type-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-reference-face 'font-lock-reference-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defvar font-lock-preprocessor-face 'font-lock-preprocessor-face
- "Don't even think of using this.")
+ "This variable should not be set.
+It is present only for horrid FSF compatibility reasons.
+The corresponding face should be set using `edit-faces' or the
+`set-face-*' functions.")
(defconst font-lock-face-list
'(font-lock-comment-face
;; (if (or change-was-deletion (bobp)
;; (= (preceding-char) ?\n))
;; (buffer-syntactic-context-flush-cache))
- (if (and (= beg (point-min))
- (= end (point-max)))
- (font-lock-fontify-buffer)
- (font-lock-fontify-region beg end)))
+ ;; #### This creates some unnecessary progress gauges.
+;; (if (and (= beg (point-min))
+;; (= end (point-max)))
+;; (font-lock-fontify-buffer)
+;; (font-lock-fontify-region beg end)))
+ (font-lock-fontify-region beg end))
font-lock-range-table)))))))
font-lock-pending-extent-table)))
\f
(list
;; Javadoc tags
- '("@\\(author\\|exception\\|throws\\|deprecated\\|param\\|return\\|see\\|since\\|version\\)\\s "
+ '("@\\(author\\|deprecated\\|exception\\|throws\\|param\\|return\\|see\\|since\\|version\\|serial\\|serialData\\|serialField\\)\\s "
0 font-lock-keyword-face t)
;; Doc tag - Parameter identifiers
(bury-buffer (find-file-noselect (car f))))
(setq f (cdr f)))))
+;;;###autoload
(defun Info-find-node (filename &optional nodename no-going-back tryfile line)
"Go to an info node specified as separate FILENAME and NODENAME.
Look for a plausible filename, or if not found then look for URL's and
;; buffer.
(mapc #'delete-extent isearch-highlight-extents)
(setq isearch-highlight-extents nil)
- (setq isearch-highlight-all-start nil
- isearch-window-end nil
+ (setq isearch-window-end nil
isearch-highlight-last-string nil))
(defun isearch-highlight-all-update ()
tab-stop-list '(22 32 40 60 67))
(abbrev-mode 0)
(auto-fill-mode 0)
- (buffer-flush-undo (current-buffer))
+ (buffer-disable-undo (current-buffer))
(use-local-map itimer-edit-map)
(set-syntax-table emacs-lisp-mode-syntax-table))
(unwind-protect
(condition-case condition-data
(save-match-data
+ ;; Suppress warnings - see comment below.
+ (defvar last-event-time)
+ (defvar next-wakeup)
+ (defvar itimer)
+ (defvar itimers)
+ (defvar time-elapsed)
(let* ((current-itimer itimer)
(quit-flag nil)
(inhibit-quit nil)
;; for FSF Emacs timer.el emulation under XEmacs.
;; eldoc expect this to be done, apparently.
(this-command nil)
- ;; bind these variables so that the
- ;; itimer function can't screw with
- ;; them.
+ ;; bind these variables so that the itimer
+ ;; function can't screw with them.
last-event-time next-wakeup
itimer itimers time-elapsed)
(if (itimer-uses-arguments current-itimer)
(interactive "*")
(setq last-command nil)
(setq this-command 'yank) ; so that yank-pop works.
- (let ((clip (mswindows-get-clipboard)) (s (mark-marker)) (e (point-marker)))
+ (let ((clip (get-clipboard)) (s (mark-marker)) (e (point-marker)))
(or clip (error "there is no text on the clipboard"))
(if s
(if mouse-track-rectangle-p
occupy exactly twice the screen space of ASCII (`halfwidth')
characters. On many systems, e.g. Sun CDE systems, this can only be
achieved by using a national variant roman font to display ASCII."
- (let ((charset-font-width
- (lambda (charset)
- (font-instance-width
- (face-font-instance 'default (selected-device) charset))))
-
- (twice-as-wide
- (lambda (cs1 cs2)
- (let ((width1 (funcall charset-font-width cs1))
- (width2 (funcall charset-font-width cs2)))
- (and width1 width2 (eq (+ width1 width1) width2))))))
+ (let* ((charset-font-width
+ (lambda (charset)
+ (font-instance-width
+ (face-font-instance 'default (selected-device) charset))))
+
+ (twice-as-wide
+ (lambda (cs1 cs2)
+ (let ((width1 (funcall charset-font-width cs1))
+ (width2 (funcall charset-font-width cs2)))
+ (and width1 width2 (eq (+ width1 width1) width2))))))
(when (eq 'x (device-type))
(condition-case nil
(unless (and location (file-writable-p location))
(setq location package-get-user-index-filename))
(when (y-or-n-p (concat "Update package index in " location "? "))
- (write-file location))))))
+ (let ((coding-system-for-write 'binary))
+ (write-file location)))))))
;;;###autoload
(save-excursion
(set-buffer buf)
(erase-buffer buf)
- (insert-file-contents-internal db-file)
+ (insert-file-contents-literally db-file)
(package-get-update-base-from-buffer buf)
(if (file-remote-p db-file)
(package-get-maybe-save-index db-file)))
;; Doing it with XEmacs removes the need for an external md5 program
(message "Validating checksum for `%s'..." package) (sit-for 0)
(with-temp-buffer
- ;; What ever happened to i-f-c-literally
- (let (file-name-handler-alist)
- (insert-file-contents-internal full-package-filename))
+ (insert-file-contents-literally full-package-filename)
(if (not (string= (md5 (current-buffer))
(package-get-info-prop this-package
'md5sum)))
; (setq result (md5 (current-buffer))))
; result))
+;;; APA: Stolen from package-get in package-get.el
(defun pi-md5sum (file)
(with-temp-buffer
- (call-process "md5sum" file t)
- (goto-char (point-min))
- (looking-at "[a-z0-9]+")
- (buffer-substring (match-beginning 0) (match-end 0))))
+ (insert-file-contents-literally file)
+ (md5 (current-buffer))))
(defun pi-update-key (key value)
(save-excursion
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defgroup pui nil
- "Conventient interface to the package system."
+ "Convenient interface to the package system."
:group 'package-tools
:tag "Package User interface"
:prefix "pui-")
(delete pkg-sym pui-deleted-packages))
(setq pui-deleted-packages
(cons pkg-sym pui-deleted-packages))
- (setq pui-seleted-packages
+ (setq pui-selected-packages
(delete pkg-sym pui-selected-packages)))
(pui-update-package-display extent pkg-sym)
))
;; make sure paths-find-version-directory and paths-find-site-directory
;; don't both pick up version-independent directories ...
(let ((version-directory (paths-find-version-directory roots base nil nil t))
- (site-directory (paths-find-site-directory roots base)))
+ (site-directory (paths-find-site-directory roots base nil nil t)))
(paths-uniq-append
(and version-directory (list version-directory))
(and site-directory (list site-directory)))))
(setq infile (expand-file-name infile))
(setq inbuf (generate-new-buffer "*call-process*"))
(with-current-buffer inbuf
- (insert-file-contents-internal infile nil nil nil nil
- coding-system-for-read)))
+ ;; Make sure this works with jka-compr
+ (let ((file-name-handler-alist nil))
+ (insert-file-contents-internal infile nil nil nil nil
+ 'binary))))
(let ((stderr (if (consp buffer) (second buffer) t)))
(if (consp buffer) (setq buffer (car buffer)))
(setq buffer
(defun shell-quote-argument (argument)
"Quote an argument for passing as argument to an inferior shell."
- (if (eq system-type 'windows-nt)
- (nt-quote-process-args (list shell-file-name argument))
+ (if (and (eq system-type 'windows-nt)
+ ;; #### this is a temporary hack. a better solution needs
+ ;; futzing with the c code. i'll do this shortly.
+ (let ((progname (downcase (file-name-nondirectory
+ shell-file-name))))
+ (or (equal progname "command.com")
+ (equal progname "cmd.exe"))))
+ argument
;; Quote everything except POSIX filename characters.
;; This should be safe enough even for really weird shells.
(let ((result "") (start 0) end)
(defun open-rectangle-line (startcol endcol fill)
- (let (spaces)
- (when (= (move-to-column startcol (or fill 'coerce)) startcol)
- (unless (and (not fill)
- (= (point) (point-at-eol)))
- (indent-to endcol)))
- ))
+ (when (= (move-to-column startcol (or fill 'coerce)) startcol)
+ (unless (and (not fill)
+ (= (point) (point-at-eol)))
+ (indent-to endcol))))
;;;###autoload
(defun open-rectangle (start end &optional fill)
When called from a program, the rectangle's corners are START and END."
(interactive "*r\nsString rectangle: ")
+ (defvar pending-delete-mode)
(apply-on-rectangle 'string-rectangle-line start end string
(and (boundp 'pending-delete-mode) pending-delete-mode)))
(get-selection type (cdr data-type))
(signal (car err) (cdr err)))))
(get-selection-internal type data-type))))
- (when (and (consp text) (symbolp (car text)))
- (setq text (cdr text)))
- (when (not (stringp text))
- (error "Selection is not a string: %S" text))
text))
;; FSFmacs calls this `x-set-selection', and reverses the
;; first two arguments (duh ...). This order is more logical.
-(defun own-selection (data &optional type append)
+(defun own-selection (data &optional type how-to-add data-type)
"Make a window-system selection of type TYPE and value DATA.
The argument TYPE (default `PRIMARY') says which selection,
-and DATA specifies the contents. DATA may be a string,
-a symbol, an integer (or a cons of two integers or list of two integers).
-If APPEND is non-nil, append the data to the existing selection data.
+and DATA specifies the contents. DATA may be any lisp data type
+that can be converted using the function corresponding to DATA-TYPE
+in `select-converter-alist'---strings are the usual choice, but
+other types may be permissible depending on the DATA-TYPE parameter
+(if DATA-TYPE is not supplied, the default behaviour is window
+system specific, but strings are always accepted).
+HOW-TO-ADD may be any of the following:
+
+ 'replace-all or nil -- replace all data in the selection.
+ 'replace-existing -- replace data for specified DATA-TYPE only.
+ 'append or t -- append data to existing DATA-TYPE data.
+
+DATA-TYPE is the window-system specific data type identifier
+(see `register-selection-data-type' for more information).
The selection may also be a cons of two markers pointing to the same buffer,
or an overlay. In these cases, the selection is considered to be the text
-between the markers *at whatever time the selection is examined*.
+between the markers *at whatever time the selection is examined* (note
+that the window system clipboard does not necessarily duplicate this
+behaviour - it doesn't on mswindows for example).
Thus, editing done in the buffer after you specify the selection
can alter the effective value of the selection.
;; "This is for temporary compatibility with pre-release Emacs 19."
;(if (stringp type)
; (setq type (intern type)))
- (or (valid-simple-selection-p data)
- (and (vectorp data)
- (let ((valid t)
- (i (1- (length data))))
- (while (>= i 0)
- (or (valid-simple-selection-p (aref data i))
- (setq valid nil))
- (setq i (1- i)))
- valid))
- (signal 'error (list "invalid selection" data)))
(or type (setq type 'PRIMARY))
- (flet ((own-selection-1
- (type data append)
- (when append
- (unless (stringp data)
- ;; kludge!
- (setq data (select-convert-to-text type 'STRING data))
- (if (stringp data)
- (setq data (concat (get-selection type) data)))))
- (own-selection-internal type data)))
- (if (null data)
- (disown-selection-internal type)
- (own-selection-1 type data append)
- (when (and (eq type 'PRIMARY)
- selection-sets-clipboard)
- (own-selection-internal 'CLIPBOARD data append))))
+ (if (null data)
+ (disown-selection-internal type)
+ (own-selection-internal type data how-to-add data-type)
+ (when (and (eq type 'PRIMARY)
+ selection-sets-clipboard)
+ (own-selection-internal 'CLIPBOARD data how-to-add data-type)))
(cond ((eq type 'PRIMARY)
(setq primary-selection-extent
(select-make-extent-for-selection
;; when behaving as the latter, we better not set it, or we will
;; cause unwanted sticky-region behavior in kill-region and friends.
(if (interactive-p)
- (setq zmacs-region-stays t))
+ (setq zmacs-region-stays t))
data)
(defun dehilight-selection (selection)
(setq lost-selection-hooks 'dehilight-selection)
-(defun own-clipboard (string &optional append)
+(defun own-clipboard (string &optional push)
"Paste the given string to the window system Clipboard.
-If APPEND is non-nil, append the string to the existing contents."
+See `interprogram-cut-function' for more information."
(own-selection string 'CLIPBOARD))
(defun disown-selection (&optional secondary-p)
;; moved from x-select.el
(defun valid-simple-selection-p (data)
+ "An obsolete function that tests whether something was a valid simple
+selection using the old XEmacs selection support. You shouldn't use this
+any more, because just about anything could be a valid selection now."
(or (stringp data)
;FSFmacs huh?? (symbolp data)
(integerp data)
(disown-selection nil)
)))
+\f
;;; Functions to convert the selection into various other selection
-;;; types. Every selection type that emacs handles is implemented
-;;; this way, except for TIMESTAMP, which is a special case. These are
-;;; all moved from x-select.el
-
+;;; types.
+
+;; These two functions get called by C code...
+(defun select-convert-in (selection type value)
+ "Attempt to convert the specified external VALUE to the specified DATA-TYPE,
+for the specified SELECTION. Return nil if this is impossible, or a
+suitable internal representation otherwise."
+ (when value
+ (let ((handler-fn (cdr (assq type selection-converter-in-alist))))
+ (when handler-fn
+ (apply handler-fn (list selection type value))))))
+
+(defun select-convert-out (selection type value)
+ "Attempt to convert the specified internal VALUE for the specified DATA-TYPE
+and SELECTION. Return nil if this is impossible, or a suitable external
+representation otherwise."
+ (when value
+ (let ((handler-fn (cdr (assq type selection-converter-out-alist))))
+ (when handler-fn
+ (apply handler-fn (list selection type value))))))
+
+;; The rest of the functions on this "page" are conversion handlers,
+;; append handlers and buffer-kill handlers.
(defun select-convert-to-text (selection type value)
(cond ((stringp value)
value)
(buffer-substring (car value) (cdr value)))))
(t nil)))
+(defun select-convert-from-text (selection type value)
+ (when (stringp value)
+ value))
+
(defun select-convert-to-string (selection type value)
(let ((outval (select-convert-to-text selection type value)))
;; force the string to be not in Compound Text format.
(cons (ash value -16) (logand value 65535))
nil)))
+(defun select-convert-from-length (selection type value)
+ (select-convert-to-length selection type value))
+
(defun select-convert-to-targets (selection type value)
;; return a vector of atoms, but remove duplicates first.
(let* ((all (cons 'TIMESTAMP (mapcar 'car selection-converter-alist)))
(while rest
(cond ((memq (car rest) (cdr rest))
(setcdr rest (delq (car rest) (cdr rest))))
- ((eq (car (cdr rest)) '_EMACS_INTERNAL) ; shh, it's a secret
- (setcdr rest (cdr (cdr rest))))
(t
(setq rest (cdr rest)))))
(apply 'vector all)))
(error "selection is in a killed buffer"))))
(t nil)))
+(defun select-convert-from-filename (selection type value)
+ (when (stringp value)
+ value))
+
(defun select-convert-to-charpos (selection type value)
(let (a b tmp)
(cond ((cond ((extentp value)
(and (integerp value)
(cons (ash value -16) (logand value 65535))))
+;; Can convert from the following integer representations
+;;
+;; integer
+;; (integer . integer)
+;; (integer integer)
+;; (list [integer|(integer . integer)]*)
+;; (vector [integer|(integer . integer)]*)
+;;
+;; Cons'd integers get cleaned up a little.
+
+(defun select-convert-from-integer (selection type value)
+ (cond ((integerp value) ; Integer
+ value)
+
+ ((and (consp value) ; (integer . integer)
+ (integerp (car value))
+ (integerp (cdr value)))
+ (if (eq (car value) 0)
+ (cdr value)
+ (if (and (eq (car value) -1)
+ (< (cdr value) 0))
+ (cdr value)
+ value)))
+
+ ((and (listp value) ; (integer integer)
+ (eq (length value) 2)
+ (integerp (car value))
+ (integerp (cadr value)))
+ (if (eq (car value) 0)
+ (cadr value)
+ (if (and (eq (car value) -1)
+ (< (cdr value) 0))
+ (- (cadr value))
+ (cons (car value) (cadr value)))))
+
+ ((listp value) ; list
+ (if (cdr value)
+ (mapcar '(lambda (x)
+ (select-convert-from-integer selection type x))
+ value)
+ (select-convert-from-integer selection type (car value))))
+
+ ((vectorp value) ; vector
+ (if (eq (length value) 1)
+ (select-convert-from-integer selection type (aref value 0))
+ (mapvector '(lambda (x)
+ (select-convert-from-integer selection type x))
+ value)))
+
+ (t nil)
+ ))
+
(defun select-convert-to-atom (selection type value)
(and (symbolp value) value))
-(defun select-convert-to-identity (selection type value) ; used internally
- (vector value))
+;;; CF_xxx conversions
+(defun select-convert-from-cf-text (selection type value)
+ (replace-in-string (if (string-match "\0" value)
+ (substring value 0 (match-beginning 0))
+ value)
+ "\\(\r\n\\|\n\r\\)" "\n" t))
+
+(defun select-convert-to-cf-text (selection type value)
+ (let ((text (select-convert-to-text selection type value)))
+ (concat (replace-in-string text "\n" "\r\n" t) "\0")))
+
+;;; Appenders
+(defun select-append-to-text (selection type value1 value2)
+ (let ((text1 (select-convert-to-text selection 'STRING value1))
+ (text2 (select-convert-to-text selection 'STRING value2)))
+ (if (and text1 text2)
+ (concat text1 text2)
+ nil)))
+
+(defun select-append-to-string (selection type value1 value2)
+ (select-append-to-text selection type value1 value2))
+
+(defun select-append-to-compound-text (selection type value1 value2)
+ (select-append-to-text selection type value1 value2))
+
+(defun select-append-to-cf-text (selection type value1 value2)
+ (let ((text1 (select-convert-from-cf-text selection 'CF_TEXT value1))
+ (text2 (select-convert-from-cf-text selection 'CF_TEXT value2)))
+ (if (and text1 text2)
+ (select-convert-to-cf-text selection type (concat text1 text2))
+ nil)))
-(setq selection-converter-alist
+(defun select-append-default (selection type value1 value2)
+;; This appender gets used if the type is "nil" - i.e. default.
+;; It should probably have more cases implemented than it does - e.g.
+;; appending numbers to strings, etc...
+ (cond ((and (stringp value1) (stringp value2))
+ (select-append-to-string selection 'STRING value1 value2))
+ (t nil)))
+
+;;; Buffer kill handlers
+
+;; #### Should this function take the text *out* of the buffer that's
+;; being killed? Or should it do what the original code did and just
+;; destroy the selection?
+(defun select-buffer-killed-default (selection type value buffer)
+;; This handler gets used if the type is "nil".
+ (cond ((extentp value)
+ (unless (eq (extent-object value) buffer)
+ value))
+ ((markerp value)
+ (unless (eq (marker-buffer value) buffer)
+ value))
+ ((and (consp value)
+ (markerp (car value))
+ (markerp (cdr value)))
+ (unless (or (eq (marker-buffer (car value)) buffer)
+ (eq (marker-buffer (cdr value)) buffer))
+ value))
+ (t value)))
+
+(defun select-buffer-killed-text (selection type value buffer)
+ (select-buffer-killed-default selection type value buffer))
+
+;; Types listed in here can be selections of XEmacs
+(setq selection-converter-out-alist
'((TEXT . select-convert-to-text)
(STRING . select-convert-to-string)
(COMPOUND_TEXT . select-convert-to-compound-text)
(NAME . select-convert-to-name)
(ATOM . select-convert-to-atom)
(INTEGER . select-convert-to-integer)
- (_EMACS_INTERNAL . select-convert-to-identity)
+ (CF_TEXT . select-convert-to-cf-text)
))
+;; Types listed here can be selections foreign to XEmacs
+(setq selection-converter-in-alist
+ '(; Specific types that get handled by generic converters
+ (COMPOUND_TEXT . select-convert-from-text)
+ (SOURCE_LOC . select-convert-from-text)
+ (OWNER_OS . select-convert-from-text)
+ (HOST_NAME . select-convert-from-text)
+ (USER . select-convert-from-text)
+ (CLASS . select-convert-from-text)
+ (NAME . select-convert-from-text)
+ ; Generic types
+ (INTEGER . select-convert-from-integer)
+ (TEXT . select-convert-from-text)
+ (STRING . select-convert-from-text)
+ (LENGTH . select-convert-from-length)
+ (FILE_NAME . select-convert-from-filename)
+ (CF_TEXT . select-convert-from-cf-text)
+ ))
+
+;; Types listed here can be appended by own-selection
+(setq selection-appender-alist
+ '((nil . select-append-default)
+ (TEXT . select-append-to-text)
+ (STRING . select-append-to-string)
+ (COMPOUND_TEXT . select-append-to-compound-text)
+ (CF_TEXT . select-append-to-cf-text)
+ ))
+
+;; Types listed here have buffer-kill handlers
+(setq selection-buffer-killed-alist
+ '((nil . select-buffer-killed-default)
+ (TEXT . select-buffer-killed-text)
+ (STRING . select-buffer-killed-text)
+ (COMPOUND_TEXT . select-buffer-killed-text)
+ (CF_TEXT . select-buffer-killed-text)))
+
+;; Lists of types that are coercible (can be converted to other types)
+(setq selection-coercible-types '(TEXT STRING COMPOUND_TEXT))
+
;;; select.el ends here
(message "Line %d" buffer-line)))))))
(setq zmacs-region-stays t))
-;;; Bob Weiner, Altrasoft, 02/12/1998
-;;; Added the 3rd arg in `count-lines' to conditionalize the counting of
-;;; collapsed lines.
+;; new in XEmacs 21.2 (not in FSF).
+(defun line-number (&optional pos respect-narrowing)
+ "Return the line number of POS (defaults to point).
+If RESPECT-NARROWING is non-nil, then the narrowed line number is returned;
+otherwise, the absolute line number is returned. The returned line can always
+be given to `goto-line' to get back to the current line."
+ (if (and pos (/= pos (point)))
+ (save-excursion
+ (goto-char pos)
+ (line-number nil respect-narrowing))
+ (1+ (count-lines (if respect-narrowing (point-min) 1) (point-at-bol)))))
+
(defun count-lines (start end &optional ignore-invisible-lines-flag)
"Return number of lines between START and END.
This is usually the number of newlines between them,
and the greater of them is not at the start of a line.
With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, lines collapsed with
-selective-display are excluded from the line count."
+selective-display are excluded from the line count.
+
+NOTE: The expression to return the current line number is not obvious:
+
+(1+ (count-lines 1 (point-at-bol)))
+
+See also `line-number'."
(save-excursion
(save-restriction
(narrow-to-region start end)
(defvar last-pressed-toolbar-button nil)
(defvar toolbar-active nil)
+(defvar toolbar-blank-press-function nil
+ "Function to call if a blank area of the toolbar is pressed.")
+
;;
;; It really sucks that we also have to tie onto
;; default-mouse-motion-handler to make sliding buttons work right.
(setq last-pressed-toolbar-button button))
;; Added by Bob Weiner, Motorola Inc., 10/6/95, to handle
;; presses on blank portions of toolbars.
- (and (boundp 'toolbar-blank-press-function)
- (functionp toolbar-blank-press-function)
- (funcall toolbar-blank-press-function event)))))
+ (when (functionp toolbar-blank-press-function)
+ (funcall toolbar-blank-press-function event)))))
(defun release-and-activate-toolbar-button (event)
"Release a toolbar button and activate its callback.
(or (null locale) (eq locale 'global)))
(progn
(or fn (setq fn (x-get-resource
- "font" "Font" 'string locale)))
+ "font" "Font" 'string locale nil 'warn)))
(or fg (setq fg (x-get-resource
- "foreground" "Foreground" 'string locale)))
+ "foreground" "Foreground" 'string locale nil
+ 'warn)))
(or bg (setq bg (x-get-resource
- "background" "Background" 'string locale)))))
+ "background" "Background" 'string locale nil
+ 'warn)))))
;;
;; "*cursorColor: foo" is equivalent to setting the background of the
;; text-cursor face.
(if (and (eq (face-name face) 'text-cursor)
(or (null locale) (eq locale 'global)))
(setq bg (or (x-get-resource
- "cursorColor" "CursorColor" 'string locale) bg)))
+ "cursorColor" "CursorColor" 'string locale nil 'warn)
+ bg)))
;; #### should issue warnings? I think this should be
;; done when the instancing actually happens, but I'm not
;; sure how it should actually be dealt with.
;; If reverseVideo was specified, swap the foreground and background
;; of the default and modeline faces.
;;
- (cond ((car (x-get-resource "reverseVideo" "ReverseVideo" 'boolean frame))
+ (cond ((car (x-get-resource "reverseVideo" "ReverseVideo" 'boolean frame
+ nil 'warn))
;; First make sure the modeline has fg and bg, inherited from the
;; current default face - for the case where only one is specified,
;; so that invert-face doesn't do something weird.
(let* ((name (caar resource-list))
(class (cdar resource-list))
(resource
- (x-get-resource name class type locale nil t)))
+ (x-get-resource name class type locale nil 'warn)))
(if resource
(progn
(add-spec-to-specifier specifier resource locale)
(defun x-get-resource-and-bogosity-check (name class type &optional locale)
(x-bogosity-check-resource name class type)
- (x-get-resource name class type locale nil t))
+ (x-get-resource name class type locale nil 'warn))
(defun x-get-resource-and-maybe-bogosity-check (name class type &optional
locale)
(if (eq locale 'global)
(x-bogosity-check-resource name class type))
- (x-get-resource name class type locale nil t))
+ (x-get-resource name class type locale nil 'warn))
;;; x-misc.el ends here
(if x-pointers-initialized ; only do it when the first device is created
nil
(set-glyph-image text-pointer-glyph
- (or (x-get-resource "textPointer" "Cursor" 'string device)
+ (or (x-get-resource "textPointer" "Cursor" 'string device nil 'warn)
"xterm"))
(set-glyph-image selection-pointer-glyph
- (or (x-get-resource "selectionPointer" "Cursor" 'string device)
+ (or (x-get-resource "selectionPointer" "Cursor" 'string device
+ nil 'warn)
"top_left_arrow"))
(set-glyph-image nontext-pointer-glyph
- (or (x-get-resource "spacePointer" "Cursor" 'string device)
+ (or (x-get-resource "spacePointer" "Cursor" 'string device nil 'warn)
"xterm")) ; was "crosshair"
(set-glyph-image modeline-pointer-glyph
- (or (x-get-resource "modeLinePointer" "Cursor" 'string device)
+ (or (x-get-resource "modeLinePointer" "Cursor" 'string device
+ nil 'warn)
;; "fleur"))
"sb_v_double_arrow"))
(set-glyph-image gc-pointer-glyph
- (or (x-get-resource "gcPointer" "Cursor" 'string device)
+ (or (x-get-resource "gcPointer" "Cursor" 'string device nil 'warn)
"watch"))
(when (featurep 'scrollbar)
(set-glyph-image
scrollbar-pointer-glyph
- (or (x-get-resource "scrollbarPointer" "Cursor" 'string device)
+ (or (x-get-resource "scrollbarPointer" "Cursor" 'string device
+ nil 'warn)
"top_left_arrow")))
(set-glyph-image busy-pointer-glyph
- (or (x-get-resource "busyPointer" "Cursor" 'string device)
+ (or (x-get-resource "busyPointer" "Cursor" 'string device nil 'warn)
"watch"))
(set-glyph-image toolbar-pointer-glyph
- (or (x-get-resource "toolBarPointer" "Cursor" 'string device)
+ (or (x-get-resource "toolBarPointer" "Cursor" 'string device
+ nil 'warn)
"left_ptr"))
(set-glyph-image divider-pointer-glyph
- (or (x-get-resource "dividerPointer" "Cursor" 'string device)
+ (or (x-get-resource "dividerPointer" "Cursor" 'string device
+ nil 'warn)
"sb_h_double_arrow"))
(let ((fg
- (x-get-resource "pointerColor" "Foreground" 'string device)))
+ (x-get-resource "pointerColor" "Foreground" 'string device
+ nil 'warn)))
(and fg
(set-face-foreground 'pointer fg)))
(let ((bg
- (x-get-resource "pointerBackground" "Background" 'string device)))
+ (x-get-resource "pointerBackground" "Background" 'string device
+ nil 'warn)))
(and bg
(set-face-background 'pointer bg)))
(setq x-pointers-initialized t))
;; Now do ScrollBarPlacement.scrollBarPlacement
(let ((case-fold-search t)
(resval (x-get-resource "ScrollBarPlacement" "scrollBarPlacement"
- 'string locale)))
+ 'string locale nil 'warn)))
(cond
((null resval))
((string-match "^top[_-]left$" resval)
;(setq x-sent-selection-hooks 'x-notice-selection-failures)
\f
-;;; Selections in killed buffers
-;;; this function is called by kill-buffer as if it were on the
-;;; kill-buffer-hook (though it isn't really).
-
-(defun xselect-kill-buffer-hook ()
- ;; Probably the right thing is to write a C function to return a list
- ;; of the selections which emacs owns, since it could conceivably own
- ;; a user-defined selection type that we've never heard of.
- (xselect-kill-buffer-hook-1 'PRIMARY)
- (xselect-kill-buffer-hook-1 'SECONDARY)
- (xselect-kill-buffer-hook-1 'CLIPBOARD))
-
-(defun xselect-kill-buffer-hook-1 (selection)
- (let (value)
- (if (and (selection-owner-p selection)
- (setq value (get-selection-internal selection '_EMACS_INTERNAL))
- ;; The _EMACS_INTERNAL selection type has a converter registered
- ;; for it that does no translation. This only works if emacs is
- ;; requesting the selection from itself. We could have done this
- ;; by writing a C function to return the raw selection data, and
- ;; that might be the right way to do this, but this was easy.
- (or (and (consp value)
- (markerp (car value))
- (eq (current-buffer) (marker-buffer (car value))))
- (and (extent-live-p value)
- (eq (current-buffer) (extent-object value)))
- (and (extentp value) (not (extent-live-p value)))))
- (disown-selection-internal selection))))
-
-\f
;;; Cut Buffer support
;;; FSF name x-get-cut-buffer
+2000-07-19 Martin Buchholz <martin@xemacs.org>
+
+ * XEmacs 21.2.35 is released.
+
+2000-07-09 Martin Buchholz <martin@xemacs.org>
+
+ * xlwcheckbox.c:
+ * xlwgauge.h:
+ * xlwgaugeP.h:
+ * xlwradio.h:
+ * xlwradioP.h:
+ * xlwgauge.c:
+ * config.h.in:
+ * xlwradio.c:
+ * lwlib-Xaw.c:
+ Replace SMART_INCLUDE with a dumber, but more reliable method.
+
+ * xlwmenu.c (parameterize_string): Fix C++ compilation warnings.
+
+2000-06-10 Ben Wing <ben@xemacs.org>
+
+ * lwlib-Xaw.c (xaw_create_label): add sanity check on arg limit.
+ (xaw_update_one_value): fix crash due to incorrect arg count.
+
2000-05-28 Martin Buchholz <martin@xemacs.org>
* XEmacs 21.2.34 is released.
#undef NEED_ATHENA
#undef NEED_LUCID
-/* The path to the Athena widgets - the usual value is `X11/Xaw' */
-#undef ATHENA_H_PATH
-#ifdef ATHENA_H_PATH
-# define ATHENA_INCLUDE(file) SMART_INCLUDE (ATHENA_H_PATH,file)
-#else
-# define ATHENA_INCLUDE(file) <file>
-#endif
+/* The exact path to the Athena header files depends on which `flavor'
+ of Athena is being used - hence configure defines them for us. */
+
+#undef ATHENA_Scrollbar_h_
+#undef ATHENA_Dialog_h_
+#undef ATHENA_Form_h_
+#undef ATHENA_Command_h_
+#undef ATHENA_Label_h_
+#undef ATHENA_LabelP_h_
+#undef ATHENA_Toggle_h_
+#undef ATHENA_ToggleP_h_
+#undef ATHENA_AsciiText_h_
+#undef ATHENA_XawInit_h_
#endif /* _LWLIB_CONFIG_H_ */
#include <X11/Shell.h>
#ifdef LWLIB_SCROLLBARS_ATHENA
-#include ATHENA_INCLUDE(Scrollbar.h)
+#include ATHENA_Scrollbar_h_
#endif
#ifdef LWLIB_DIALOGS_ATHENA
-#include ATHENA_INCLUDE(Dialog.h)
-#include ATHENA_INCLUDE(Form.h)
-#include ATHENA_INCLUDE(Command.h)
-#include ATHENA_INCLUDE(Label.h)
+#include ATHENA_Dialog_h_
+#include ATHENA_Form_h_
+#include ATHENA_Command_h_
+#include ATHENA_Label_h_
#endif
#ifdef LWLIB_WIDGETS_ATHENA
-#include ATHENA_INCLUDE(Toggle.h)
+#include ATHENA_Toggle_h_
#include "xlwradio.h"
#include "xlwcheckbox.h"
#include "xlwgauge.h"
#ifndef NEED_MOTIF
-#include ATHENA_INCLUDE(AsciiText.h)
+#include ATHENA_AsciiText_h_
#endif
#endif
#include <X11/Xatom.h>
Arg al [2];
String buf = 0;
XtSetArg (al [0], XtNstring, &buf);
- XtGetValues (widget, al, 2);
+ XtGetValues (widget, al, 1);
if (val->value)
{
/* Do it again for arguments that have no effect until the widget is realized. */
ac = 0;
lw_add_value_args_to_args (val, al, &ac);
+ if (ac > 20)
+ abort (); /* #### need assert macro in lwlib */
XtSetValues (label, al, ac);
return label;
return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
}
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
static change_type
max (change_type i1, change_type i2)
{
0, XtRImmediate, 0 }
};
-/*
- * This function looks through string searching for parameter
- * inserts of the form:
- * %[padding]1
- * padding is space (' ') or dash ('-') characters meaning
- * padding to the left or right of the inserted parameter.
- * In essence all %1 strings are replaced by value in the return
- * value (which the caller is expected to free).
- * %% means insert one % (like printf).
- * %1 means insert value.
- * %-1 means insert value followed by one space. The latter is
- * not inserted if value is a zero length string.
- */
+/* This function searches STRING for parameter inserts of the form:
+ %[padding]1
+ padding is either space (' ') or dash ('-') meaning
+ padding to the left or right of the inserted parameter.
+ In essence, all %1 strings are replaced by VALUE in the return value.
+ The caller is expected to free the return value using XtFree().
+ %% means insert one % (like printf).
+ %1 means insert VALUE.
+ %-1 means insert VALUE followed by one space. The latter is
+ not inserted if VALUE is a zero length string.
+*/
static char*
parameterize_string (const char *string, const char *value)
{
- char *percent;
+ const char *percent;
char *result;
unsigned int done = 0;
unsigned int ntimes;
{
result = XtMalloc(1);
result[0] = '\0';
- return (result);
+ return result;
}
if (!value)
value = "";
- for (ntimes = 1, result = (char *) string; (percent = strchr(result, '%'));
+ for (ntimes = 1, percent = string;
+ (percent = strchr (percent, '%'));
ntimes++)
- result = &percent[1];
+ percent++;
result = XtMalloc ((ntimes * strlen(value)) + strlen(string) + 4);
result[0] = '\0';
- while ((percent = strchr(string, '%')))
+ while ((percent = strchr (string, '%')))
{
unsigned int left_pad;
unsigned int right_pad;
- char *p;
+ const char *p;
if (percent[1] == '%')
{ /* it's a real % */
+2000-07-19 Martin Buchholz <martin@xemacs.org>
+
+ * XEmacs 21.2.35 is released.
+
+2000-07-10 Martin Buchholz <martin@xemacs.org>
+
+ * Makefile: rm -f ==> $(RM)
+
+2000-07-09 Martin Buchholz <martin@xemacs.org>
+
+ * lispref/postgresql.texi:
+ - Don't mention ".so" extension.
+ - Make installation instructions more generic.
+ - Mention M-x describe-installation.
+
+2000-07-08 Ben Wing <ben@xemacs.org>
+
+ * xemacs-faq.texi (Q6.4.1): Update the perennial nonstart under
+ Windows problem with binary locs and latest info.
+
+2000-06-17 Adrian Aichner <aichner@ecf.teradyne.com>
+
+ * lispref/glyphs.texi: Fix trivial typos.
+ * lispref/gutter.texi: Ditto.
+ * lispref/loading.texi: Ditto.
+ * lispref/postgresql.texi: Ditto.
+
+2000-06-14 Adrian Aichner <aichner@ecf.teradyne.com>
+
+ * internals/internals.texi (Markers and Extents): Fix trivial typo.
+
+2000-06-11 Adrian Aichner <aichner@ecf.teradyne.com>
+
+ * make-stds.texi: Fix trivial typos.
+ * xemacs-faq.texi: Ditto.
+ * internals/internals.texi: Ditto.
+ * new-users-guide/edit.texi: Ditto.
+ * new-users-guide/modes.texi: Ditto.
+ * new-users-guide/region.texi: Ditto.
+
+2000-06-10 Ben Wing <ben@xemacs.org>
+
+ * xemacs-faq.texi (Q6.1.2):
+ * xemacs-faq.texi (Q6.1.5):
+ * xemacs-faq.texi (Q6.1.6):
+ Corrections for Cygwin, MinGW.
+
+2000-06-07 Adrian Aichner <aichner@ecf.teradyne.com>
+
+ * xemacs/basic.texi: Fix trivial typos.
+ * xemacs/buffers.texi: Fix trivial typos.
+ * xemacs/building.texi: Ditto.
+ * xemacs/glossary.texi: Ditto.
+ * xemacs/gnu.texi: Ditto.
+ * xemacs/help.texi: Ditto.
+ * xemacs/keystrokes.texi: Ditto.
+ * xemacs/programs.texi: Ditto.
+ * xemacs/search.texi: Ditto.
+ * xemacs/sending.texi: Ditto.
+
2000-05-28 Martin Buchholz <martin@xemacs.org>
* XEmacs 21.2.34 is released.
SHELL = /bin/sh
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
+RM = rm -f
.SUFFIXES:
.SUFFIXES: .info .texi .dvi
.PHONY: mostlyclean clean distclean realclean extraclean
mostlyclean:
- rm -f *.toc *.aux *.log *.op *.cp *.cps *.fn *.fns
- rm -f *.ky *.kys *.pg *.pgs *.tp *.tps *.vr *.vrs
+ $(RM) *.toc *.aux *.log *.op *.cp *.cps *.fn *.fns
+ $(RM) *.ky *.kys *.pg *.pgs *.tp *.tps *.vr *.vrs
clean: mostlyclean
- rm -f core *.dvi
+ $(RM) core *.dvi
distclean: clean
realclean: distclean
extraclean: distclean
- rm -f *~ \#* */*~ */\#*
+ $(RM) *~ \#* */*~ */\#*
buffer positions in them as integers, and every time text is inserted or
deleted, these positions must be updated. In order to minimize the
amount of shuffling that needs to be done, the positions in markers and
-extents (there's one per marker, two per extent) and stored in Meminds.
+extents (there's one per marker, two per extent) are stored in Meminds.
This means that they only need to be moved when the text is physically
moved in memory; since the gap structure tries to minimize this, it also
minimizes the number of marker and extent indices that need to be
other encoded/decoded data has been written out. This is not used for
charset CCL programs.
-REGISTER: 0..7 -- refered by RRR or rrr
+REGISTER: 0..7 -- referred by RRR or rrr
OPERATOR BIT FIELD (27-bit): XXXXXXXXXXXXXXX RRR TTTTT
TTTTT (5-bit): operator type
modeline, etc. Do an apropos over @code{*-pointer-glyph} to find all of
them. (Note also that you can temporarily set the mouse pointer to some
specific shape by using @code{set-frame-pointer}, which takes an image
-instace, as obtained from calling @code{glyph-image-instance} on a glyph
+instance, as obtained from calling @code{glyph-image-instance} on a glyph
of type @code{pointer} -- either one of the above-mentioned variables or
one you created yourself. (See below for what it means to create a
glyph of type @code{pointer}.) This pointer will last only until the
function to search through @code{load-path}.) It searches for
@var{filename} through @var{path-list}, expanded by one of the optional
@var{suffixes} (string of suffixes separated by @samp{:}s), checking for
-access @var{mode} (0|1|2|4 = exists|executable|writeable|readable),
+access @var{mode} (0|1|2|4 = exists|executable|writable|readable),
default readable.
@code{locate-file} keeps hash tables of the directories it searches
where @var{I} is an intermediate character or characters in the range
0x20 - 0x3F, and @var{F}, from the range 0x30-0x7Fm is the final
character identifying this charset. (Final characters in the range
-0x30-0x3F are reserved for private use and will never have a publically
+0x30-0x3F are reserved for private use and will never have a publicly
registered meaning.)
Then that register is @dfn{invoked} to either GL or GR, either
@item srcdir
The directory for the sources being compiled. The value of this
variable is normally inserted by the @code{configure} shell script.
-(If you are using Autconf, use @samp{srcdir = @@srcdir@@}.)
+(If you are using Autoconf, use @samp{srcdir = @@srcdir@@}.)
@end table
For example:
Move the cursor forward one word (@code{forward-word}).
@item M-b
@findex backward-word
-Move the cursor backword one word (@code{backward-word}).
+Move the cursor backward one word (@code{backward-word}).
@item M-<
Move the cursor to the top of the buffer (@code{beginning-of-buffer}).
@item M->
@item line-number-mode
@cindex line-number-mode
After you enable this mode, the line number at which your cursor is
-present will be displayed continously in the mode line.
+present will be displayed continuously in the mode line.
@item blink-paren
@cindex blink-paren
contents. This command will also prompt you for a buffer name.
@item M-x insert-buffer
Insert contents of specified buffer into current buffer at point. This
-command will prompt you for a buffername which you want to be copied
+command will prompt you for a buffer name which you want to be copied
into the current buffer at the location of the cursor.
@item M-x append-to-file
This command will prompt you for a filename and append the region to
@finalout
@titlepage
@title XEmacs FAQ
-@subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2000/04/26 07:18:27 $
+@subtitle Frequently asked questions about XEmacs @* Last Modified: $Date: 2000/07/08 09:14:11 $
@sp 1
@author Tony Rossini <rossini@@biostat.washington.edu>
@author Ben Wing <ben@@xemacs.org>
@example
Emacs*XlwMenu.resourceLabels: True
Emacs*XlwMenu.file.labelString: Fichier
-Emacs*XlwMenu.openInOtherWindow.labelString: In anderem Fenster offnen
+Emacs*XlwMenu.openInOtherWindow.labelString: In anderem Fenster oeffnen
@end example
The name of the resource is derived from the non-localized entry by
@node Q6.1.2, Q6.1.3, Q6.1.1, MS Windows
@unnumberedsubsec Q6.1.2: What compiler do I need to compile XEmacs?
-You need Visual C++ 4.2 or 5.0, with the exception of the Cygwin port,
-which uses Gcc.
+You need Visual C++ 4.2, 5.0, or 6.0, with the exception of the Cygwin
+port, which uses Gcc. There is also a MINGW32 port of XEmacs (using
+Gcc, but using native libraries rather than the Cygwin libraries). ####
+More information about this should be provided.
@node Q6.1.3, Q6.1.4, Q6.1.2, MS Windows
from;
@item
-CYGWIN32 needs to be set to tty for process support
-work. e.g. CYGWIN32=tty;
+CYGWIN needs to be set to tty for process support work. e.g. CYGWIN=tty;
+(use CYGWIN32=tty under b19 and older.)
@item
picking up some other grep or other unix like tools can kill configure;
@uref{http://sourceware.cygnus.com/cygwin/}
You will need version b19 or later.
+The latest current version is 1.1.1.
+Other common versions you will see are b20.1.
-You will also need the X libraries. There are libraries at
+Another location, one of the mirror sites of the site just mentioned,
+is usually a last faster:
+
+@uref{ftp://ftp.freesoftware.com/pub/sourceware/cygwin/}
+
+You can obtain the latest version (currently 1.1.1) from the
+@samp{latest/} subdirectory of either of the above two just-mentioned
+URL's.
+
+@strong{WARNING: The version of GCC supplied under @samp{latest/}, as of
+June 6th, 2000, does not appear to work. It generates loads of spurious
+preprocessor warnings and errors, which makes it impossible to compile
+XEmacs with it.}
+
+You will also need the X libraries. You can get them on the XEmacs FTP
+site at
+
+@uref{ftp://ftp.xemacs.org/pub/xemacs/aux/cygwin/}
+
+You will find b19 and b20 versions of the X libraries, plus b19 and b20
+versions of stuff that should go into @samp{/usr/local/}, donated by
+Andy Piper. This includes pre-built versions of various graphics libraries,
+such as PNG, JPEG, TIFF, and XPM. (Remember, GIF support is built-in to
+XEmacs.)
+
+(X libraries for v1 and beyond of Cygwin can be found on the Cygwin site
+itself -- look in the @samp{xfree/} subdirectory.)
+
+@emph{NOTE:} There are two versions of the XPM library provided in
+Andy's packets. Once is for building with X support, and the other for
+building without. The X version should work if you're building with
+both X and Windows support. The two files are called @file{libXpm-X.a}
+and @file{libXpm-noX.a} respectively, and you must symlink the
+appropriate one to @file{libXpm.a}. @strong{CAREFUL:} By default, the
+non-X version is symlinked in. If you then configure XEmacs with X,
+you won't run into problems until you start compiling @file{events.c},
+at which point you'll get strange and decidedly non-obvious errors.
+
+Please see @uref{http://www.xemacs.freeserve.co.uk/} (Andy Piper's home
+page) for more information.
+
+BTW There are also libraries at
@iftex
@*
@end iftex
@uref{http://dao.gsfc.nasa.gov/software/grads/win32/X11R6.3/}, but
-these are not b19 compatible. You can get b19 X11R6.3 binaries, as
-well as pre-built ncurses and graphic libraries, from:
-
-@uref{ftp://ftp.parallax.co.uk/pub/andyp/}.
+these are not b19 compatible, and may in fact be native-compiled.
@node Q6.2.1, Q6.2.2, Q6.1.6, MS Windows
executable. In this instance XEmacs will fail to start without any
explanation. Note that this is extremely machine specific.
-Work is being done on fixes for 21.1.* that will make more intelligent
-guesses about which memory addresses will be free and so this should
-cure the problem for most people.
+21.1.10 includes a fix for this that makes more intelligent guesses
+about which memory addresses will be free, and this should cure the
+problem for most people. Unfortunately, no binary is yet available for
+this version. Check back periodically at
+
+@uref{ftp://ftp.xemacs.org/pub/xemacs/binaries/}.
21.2 implements "portable dumping" which will eliminate the problem
-altogether.
+altogether. You might have better luck with the 21.2 beta binary,
+available at
+
+@uref{ftp://ftp.xemacs.org/pub/xemacs/beta/binaries/}.
+
@node Current Events, , MS Windows, Top
@unnumbered 7 What the Future Holds
minibuffer and reads the specified file, defining abbrevs according to
its contents. @kbd{M-x quietly-read-abbrev-file} is the same but does
not display a message in the echo area; it is actually useful primarily
-in the @file{.emacs} file. If you give an empty argument to either of
-these functions, the file name Emacs uses is the value of the variable
-@code{abbrev-file-name}, which is by default @code{"~/.abbrev_defs"}.
+in the init file. @xref{Init File}. If you give an empty argument to
+either of these functions, the file name Emacs uses is the value of the
+variable @code{abbrev-file-name}, which is by default
+@code{"~/.abbrev_defs"}.
@vindex save-abbrevs
Emacs offers to save abbrevs automatically if you have changed any of
the @b{Help} menu.
XEmacs comes with many translations of tutorial. If your XEmacs is with
-MULE and you set up language environment correctly, XEmacs choses right
+MULE and you set up language environment correctly, XEmacs chooses right
tutorial when available (@pxref{Language Environments}). If you want
specific translation, give @kbd{C-h t} a prefix argument, like @kbd{C-u
C-h t}.
@item C-d
Like @kbd{d} but move up afterwards instead of down.
@item s
-Request to save the buffer. An @samp{S} befor the buffer name on a line
+Request to save the buffer. An @samp{S} before the buffer name on a line
indicates the request. Requested saves actually take place when you use
the @kbd{x} command. You can request both saving and deletion for the
same buffer.
you can switch buffers, visit files, and perform any other editing
operations. However, the debugger is a recursive editing level
(@pxref{Recursive Edit}); it is a good idea to return to the backtrace
-buffer and explictly exit the debugger when you don't want to use it any
+buffer and explicitly exit the debugger when you don't want to use it any
more. Exiting the debugger kills the backtrace buffer.
@cindex current stack frame
for how daylight savings time is determined.
As a user, you might find it convenient to set the calendar location
-variables for your usual physical location in your @file{.emacs} file.
-And when you install Emacs on a machine, you can create a
-@file{default.el} file which sets them properly for the typical location
-of most users of that machine. @xref{Init File}.
+variables for your usual physical location in your init file. And when
+you install Emacs on a machine, you can create a @file{default.el} file
+which sets them properly for the typical location of most users of that
+machine. @xref{Init File}.
@node Lunar Phases, Other Calendars, Sunrise/Sunset, Calendar/Diary
@subsection Phases of the Moon
few days as well; the variable @code{number-of-diary-entries} specifies
how many days to include (@pxref{Customization}).
- If you put @code{(diary)} in your @file{.emacs} file, this
+ If you put @code{(diary)} in your init file, this
automatically displays a window with the day's diary entries, when you
-enter Emacs. The mode line of the displayed window shows the date and
-any holidays that fall on that date.
+enter Emacs. @xref{Init File}. The mode line of the displayed window
+shows the date and any holidays that fall on that date.
@findex diary-mail-entries
@vindex diary-mail-days
@code{t}, calling up the calendar automatically displays the diary
entries for the current date as well. The diary dates appear only if
the current date is visible. If you add both of the following lines to
-your @file{.emacs} file:@refill
+your init file:@refill
@example
(setq view-diary-entries-initially t)
@end example
@noindent
-this displays both the calendar and diary windows whenever you start Emacs.
+this displays both the calendar and diary windows whenever you start
+Emacs. @xref{Init File}.
@vindex view-calendar-holidays-initially
Similarly, if you set the variable
For example, suppose you want to add Bastille Day, celebrated in
France on July 14. You can do this by adding the following line
-to your @file{.emacs} file:
+to your init file:
@smallexample
(setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
@end smallexample
+@xref{Init File}.
+
@noindent
The holiday form @code{(holiday-fixed 7 14 "Bastille Day")} specifies the
fourteenth day of the seventh month (July).
@cindex sorting diary entries
If you use the fancy diary display, you can use the normal hook
@code{list-diary-entries-hook} to sort each day's diary entries by their
-time of day. Add this line to your @file{.emacs} file:
+time of day. Add this line to your init file:
@findex sort-diary-entries
@example
(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
@end example
+@xref{Init File}.
+
@noindent
For each day, this sorts diary entries that begin with a recognizable
time of day according to their times. Diary entries without times come
@item -no-init-file
@itemx -q
-Do not load your Emacs init file @file{~/.emacs}.
+Do not load your Emacs init file. @xref{Init File}.
@item -no-site-file
Do not load the site-specific init file @file{lisp/site-start.el}.
This is equivalent to @samp{-q -no-site-file -no-early-packages}.
@item -user-init-file @var{file}
-Load @var{file} as your Emacs init file instead of @file{~/.emacs}.
+Load @var{file} as your Emacs init file instead of
+@file{~/.xemacs/init.el}/@file{~/.emacs}.
@item -user-init-directory @var{directory}
Use @var{directory} as the location of your early package hierarchies
@item -user @var{user}
@itemx -u @var{user}
-Equivalent to
-@samp{-user-init-file ~@var{user}/.emacs -user-init-directory ~@var{user}/.xemacs}.
-
+Equivalent to @samp{-user-init-file ~@var{user}/.xemacs/init.el
+-user-init-directory ~@var{user}/.xemacs}, or @samp{-user-init-file
+~@var{user}/.emacs -user-init-directory ~@var{user}/.xemacs}. whichever
+init file comes first. @xref{Init File}.
@end table
behavior of Emacs in minor ways.
All kinds of customization affect only the particular Emacs job that you
-do them in. They are completely lost when you kill the Emacs job, and have
-no effect on other Emacs jobs you may run at the same time or later. The
-only way an Emacs job can affect anything outside of it is by writing a
-file; in particular, the only way to make a customization `permanent' is to
-put something in your @file{.emacs} file or other appropriate file to do the
-customization in each session. @xref{Init File}.
+do them in. They are completely lost when you kill the Emacs job, and
+have no effect on other Emacs jobs you may run at the same time or
+later. The only way an Emacs job can affect anything outside of it is
+by writing a file; in particular, the only way to make a customization
+`permanent' is to put something in your init file or other appropriate
+file to do the customization in each session. @xref{Init File}.
@menu
* Minor Modes:: Each minor mode is one feature you can turn on
By changing them, you can "redefine keys".
* Syntax:: The syntax table controls how words and expressions
are parsed.
-* Init File:: How to write common customizations in the @file{.emacs}
- file.
+* Init File:: How to write common customizations in the init file.
* Audible Bell:: Changing how Emacs sounds the bell.
* Faces:: Changing the fonts and colors of a region of text.
* Frame Components:: Controlling the presence and positions of the
@cindex saving option value
Setting the option changes its value in the current Emacs session;
@dfn{saving} the value changes it for future sessions as well. This
-works by writing code into your @file{~/.emacs} file so as to set the
-option variable again each time you start Emacs. To save the option,
-invoke @samp{[State]} and select the @samp{Save for Future Sessions}
-operation.
+works by writing code into your init file so as to set the option
+variable again each time you start Emacs. @xref{Init File}. To save
+the option, invoke @samp{[State]} and select the @samp{Save for Future
+Sessions} operation.
You can also restore the option to its standard value by invoking
@samp{[State]} and selecting the @samp{Reset} operation. There are
list. That is inappropriate. Whether you use Auto Fill mode or not is
a matter of personal taste, not a matter of the contents of particular
files. If you want to use Auto Fill, set up major mode hooks with your
-@file{.emacs} file to turn it on (when appropriate) for you alone
+file file to turn it on (when appropriate) for you alone
(@pxref{Init File}). Don't try to use a local variable list that would
impose your taste on everyone working with the file.
code to do this, because @code{insert-kbd-macro} writes the Lisp code for you.
Then save the file. You can load the file with @code{load-file}
(@pxref{Lisp Libraries}). If the file you save in is your initialization file
-@file{~/.emacs} (@pxref{Init File}), then the macro will be defined each
+(@pxref{Init File}), then the macro will be defined each
time you run Emacs.
If you give @code{insert-kbd-macro} a prefix argument, it creates
@findex define-key
@findex substitute-key-definition
The most general way to modify a keymap is the function
-@code{define-key}, used in Lisp code (such as your @file{.emacs} file).
+@code{define-key}, used in Lisp code (such as your init file).
@code{define-key} takes three arguments: the keymap, the key to modify
in it, and the new definition. @xref{Init File}, for an example.
@code{substitute-key-definition} is used similarly; it takes three
The direct mechanism for disabling a command is to have a non-@code{nil}
@code{disabled} property on the Lisp symbol for the command. These
-properties are normally set by the user's @file{.emacs} file with
+properties are normally set by the user's init file with
Lisp expressions such as:
@example
(put 'delete-region 'disabled t)
@end example
+@xref{Init File}.
+
If the value of the @code{disabled} property is a string, that string
is included in the message printed when the command is used:
@findex disable-command
@findex enable-command
- You can disable a command either by editing the @file{.emacs} file
+ You can disable a command either by editing the init file
directly or with the command @kbd{M-x disable-command}, which edits the
-@file{.emacs} file for you. @xref{Init File}.
+init file for you. @xref{Init File}.
When you attempt to invoke a disabled command interactively in Emacs,
a window is displayed containing the command's name, its
enable it and execute, or cancel it. If you decide to enable the
command, you are asked whether to do this permanently or just for the
current session. Enabling permanently works by automatically editing
-your @file{.emacs} file. You can use @kbd{M-x enable-command} at any
+your init file. You can use @kbd{M-x enable-command} at any
time to enable any command permanently.
Whether a command is disabled is independent of what key is used to
and some English to explain that string if necessary.
@node Init File
-@section The Init File, .emacs
+@section The Init File
@cindex init file
@cindex Emacs initialization file
@cindex key rebinding, permanent
@cindex rebinding keys, permanently
- When you start Emacs, it normally loads the file @file{.emacs} in your
-home directory. This file, if it exists, should contain Lisp code. It
-is called your initialization file or @dfn{init file}. Use the command
-line switch @samp{-q} to tell Emacs whether to load an
-init file (@pxref{Entering Emacs}). Use the command line switch
-@samp{-user-init-file} (@pxref{Command Switches}) to tell Emacs to load
-a different file instead of @file{~/.emacs}.
+ When you start Emacs, it normally loads either @file{.xemacs/init.el}
+or the file @file{.emacs} (whichever comes first) in your home directory.
+This file, if it exists, should contain Lisp code. It is called your
+initialization file or @dfn{init file}. Use the command line switch
+@samp{-q} to tell Emacs whether to load an init file (@pxref{Entering
+Emacs}). Use the command line switch @samp{-user-init-file}
+(@pxref{Command Switches}) to tell Emacs to load a different file
+instead of @file{~/.xemacs/init.el}/@file{~/.emacs}.
-When the @file{.emacs} file is read, the variable @code{user-init-file}
-says which init file was loaded.
+When the init file is read, the variable @code{user-init-file} says
+which init file was loaded.
At some sites there is a @dfn{default init file}, which is the
library named @file{default.el}, found via the standard search path for
first; if it sets @code{inhibit-default-init} non-@code{nil}, then
@file{default} is not loaded.
- If you have a large amount of code in your @file{.emacs} file, you
-should move it into another file named @file{@var{something}.el},
-byte-compile it (@pxref{Lisp Libraries}), and load that file from your
-@file{.emacs} file using @code{load}.
+ If you have a large amount of code in your init file, you should
+byte-compile it to @file{~/.xemacs/init.elc} or @file{~/.emacs.elc}.
@menu
* Init Syntax:: Syntax of constants in Emacs Lisp.
@node Init Syntax
@subsection Init File Syntax
- The @file{.emacs} file contains one or more Lisp function call
+ The init file contains one or more Lisp function call
expressions. Each consists of a function name followed by
arguments, all surrounded by parentheses. For example, @code{(setq
fill-column 60)} represents a call to the function @code{setq} which is
The second argument to @code{setq} is an expression for the new value
of the variable. This can be a constant, a variable, or a function call
-expression. In @file{.emacs}, constants are used most of the time.
+expression. In the init file, constants are used most of the time.
They can be:
@table @asis
@vindex term-file-prefix
The library's name is constructed by concatenating the value of the
-variable @code{term-file-prefix} and the terminal type. Your @file{.emacs}
+variable @code{term-file-prefix} and the terminal type. Your init
file can prevent the loading of the terminal-specific library by setting
-@code{term-file-prefix} to @code{nil}.
+@code{term-file-prefix} to @code{nil}. @xref{Init File}.
@vindex term-setup-hook
The value of the variable @code{term-setup-hook}, if not @code{nil}, is
called as a function of no arguments at the end of Emacs initialization,
-after both your @file{.emacs} file and any terminal-specific library have
-been read. You can set the value in the @file{.emacs} file to override
-part of any of the terminal-specific libraries and to define
+after both your init file and any terminal-specific library have been
+read. @xref{Init File}. You can set the value in the init file to
+override part of any of the terminal-specific libraries and to define
initializations for terminals that do not have a library.@refill
@node Audible Bell
@item Read-only Buffer
A read-only buffer is one whose text you are not allowed to change.
Normally Emacs makes buffers read-only when they contain text which
-has a special significance to Emacs, such asDired buffers.
+has a special significance to Emacs, such as Dired buffers.
Visiting a file that is write-protected also makes a read-only buffer.
@xref{Buffers}.
With Unix, the price of sources puts this out of consideration for most
businesses. With GNU this will be easy. It is still possible for there to
be no available competent person, but this problem cannot be blamed on
-distibution arrangements. GNU does not eliminate all the world's problems,
+distribution arrangements. GNU does not eliminate all the world's problems,
only some of them.
Meanwhile, the users who know nothing about computers need handholding:
@table @kbd
@item C-h a @var{regexp} @key{RET}
Display a list of functions and variables whose names match @var{regexp}
-(@code{heper-apropos}).
+(@code{hyper-apropos}).
@item C-h A @var{regexp}
Show all commands whose names contain matches for @var{regexp}
(@code{command-apropos}).
(@code{command-apropos}).
@item M-x apropos @var{regexp}
-Show all symbols whose names comtain matches for @var{regexp}.
+Show all symbols whose names contain matches for @var{regexp}.
@end table
A more sophisticated sort of question to ask is, ``What are the
Release the middle mouse button, while pressing @key{CTRL} and
@key{META}.
@end table
-@cindex shift modifer
+@cindex shift modifier
Note: As you define keystrokes, you can use the @kbd{shift} key only
as a modifier with characters that do not have a second keysym on the
same key, such as @kbd{backspace} and @kbd{tab}. It is an error to
schematic representation of a complete key sequence is as follows:
@example
- [(modifier .. modifer keysym) ... (modifier .. modifier keysym)]
+ [(modifier .. modifier keysym) ... (modifier .. modifier keysym)]
@end example
Here are some examples of complete key sequences:
alternate binding before the command executes.
@item Syntax Highlighting
-You can customize your @code{.emacs} file to include the font-lock
-mode so that when you select this item, the comments will be
-displayed in one face, strings in another, reserved words in another,
-and so on. When @b{Fonts} is selected, different parts of the program
-will appear in different Fonts. When @b{Colors} is selected, then the
-program will be displayed in different colors. Selecting @b{None}
-causes the program to appear in just one Font and Color. Selecting
-@b{Less} resets the Fonts and Colors to a fast, minimal set of
-decorations. Selecting @b{More} resets the Fonts and Colors to a larger
-set of decorations. For example, if @b{Less} is selected (which is the
-default setting) then you might have all comments in green color.
-Whereas, if @b{More} is selected then a function name in the comments
-themselves might appear in a different Color or Font.@refill
+You can customize your init file to include the font-lock mode so that
+when you select this item, the comments will be displayed in one face,
+strings in another, reserved words in another, and so on. @xref{Init
+File}. When @b{Fonts} is selected, different parts of the program will
+appear in different Fonts. When @b{Colors} is selected, then the program
+will be displayed in different colors. Selecting @b{None} causes the
+program to appear in just one Font and Color. Selecting @b{Less} resets
+the Fonts and Colors to a fast, minimal set of decorations. Selecting
+@b{More} resets the Fonts and Colors to a larger set of decorations. For
+example, if @b{Less} is selected (which is the default setting) then you
+might have all comments in green color. Whereas, if @b{More} is
+selected then a function name in the comments themselves might appear in
+a different Color or Font.@refill
@item Paren Highlighting
After selecting @b{Blink} from this item, if you place the cursor
@item Save Options
Selecting this item will save the current settings of your Options
-menu to your @code{.emacs} file.
+menu to your init file. @xref{Init File}.
@end table
@node Buffers Menu
specify a directory, the directories in the list @code{exec-path} are
searched; this list is initialized based on the @code{PATH} environment
variable when you start XEmacs. You can override either or both of these
-default initializations in your @file{.emacs} file.@refill
+default initializations in your init file. @xref{Init File}.@refill
When you use @kbd{M-!} and @kbd{M-|}, XEmacs has to wait until the
shell command completes. You can quit with @kbd{C-g}; that terminates
(viper-mode)
@end example
-in your @file{.emacs} file.
+in your init file. @xref{Init File}.
Viper comes with a separate manual that is provided standard
with the XEmacs distribution.
XEmacs has a new vi emulation mode called evi mode. To
start evi mode in Emacs, type the command @kbd{M-x evi}. If you want
Emacs to automatically put you in evi-mode all the time, include this
-line in your @file{.emacs} file:
+line in your init file:
@example
(setq term-setup-hook 'evi)
@end example
@xref{evi Mode} for a brief discussion.
+@xref{Init File}.
@end ignore
@item
XEmacs has a new vi emulation mode called ``viper'' mode. To start
viper mode in XEmacs, type the command @kbd{M-x viper-mode}. If you
want XEmacs to automatically put you in viper-mode all the time, include
-this line in your @file{.emacs} file:
+this line in your init file:
@example
(viper-mode)
@end example
+@xref{Init File}.
@item
Earlier versions of Emacs only allowed keybindings to ASCII character
))
@end example
-Of particular interest for use in @file{.emacs} files are:
+Alternatively, use @file{.xemacs/init.el} for an init file. @xref{Init File}.
+
+Of particular interest for use in files are:
@itemize @bullet
@findex add-menu
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 @file{.emacs} file:
+like the following to your init file:
@example
(setq package-get-remote (cons (list nil "/my/path/to/package/binaries")
package-get-remote))
@end example
+@xref{Init File}.
+
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).
There are editing commands to operate on them.
* Grinding:: Adjusting indentation to show the nesting.
* Matching:: Insertion of a close-delimiter flashes matching open.
-* Comments:: Inserting, illing and aligning comments.
+* Comments:: Inserting, filling and aligning comments.
* Balanced Editing:: Inserting two matching parentheses at once, etc.
* Lisp Completion:: Completion on symbol names in Lisp code.
* Documentation:: Getting documentation of functions you plan to call.
within searches (@kbd{C-q}, @kbd{C-w}, @kbd{C-r}, @kbd{C-s}, or @kbd{C-y}).
Sometimes you search for @samp{FOO} and find it, but were actually
-looking for a different occurance of it. To move to the next occurrence
+looking for a different occurence of it. To move to the next occurrence
of the search string, type another @kbd{C-s}. Do this as often as
necessary. If you overshoot, you can cancel some @kbd{C-s}
characters with @key{DEL}.
command @code{M-x merge-mail-aliases}. The @code{rebuild-mail-aliases}
command is similar, but deletes existing aliases first.
-@vindex mail-alias-seperator-string
+@vindex mail-alias-separator-string
If you want multiple addresses separated by a string other than @samp{,}
-(a comma), then set the variable @code{mail-alias-seperator-string} to
+(a comma), then set the variable @code{mail-alias-separator-string} to
it. This has to be a comma bracketed by whitespace if you want any kind
of reasonable behavior.
very front, late ones somewhere in the middle, and last hierarchies are
(you guessed it) last.
-By default, XEmacs expects an early package hierarchy in the a
-subdirectory @file{.xemacs} of the user's home directory.
+By default, XEmacs expects an early package hierarchy in the
+subdirectory @file{.xemacs/xemacs-packages} of the user's home
+directory.
Moreover, XEmacs expects late hierarchies in the subdirectories
@file{site-packages}, @file{mule-packages}, and @file{xemacs-packages}
By default, XEmacs does not have a pre-configured last package
hierarchy. Last hierarchies are primarily for using package hierarchies
of outdated versions of XEmacs as a fallback option. For example, it is
-possible to run XEmacs 21.0 with the 20.4 package hierarchy as a last
+possible to run XEmacs 21 with the 20.4 package hierarchy as a last
hierarchy.
It is possible to specify at configure-time the location of the various
it happen again, you can report at least that.
Check whether any programs you have loaded into the Lisp world, including
-your @file{.emacs} file, set any variables that may affect the functioning
-of Emacs. Also, see whether the problem happens in a freshly started Emacs
-without loading your @file{.emacs} file (start Emacs with the @code{-q} switch
-to prevent loading the init file). If the problem does @var{not} occur
-then, it is essential that we know the contents of any programs that you
-must load into the Lisp world in order to cause the problem to occur.
+your init file, set any variables that may affect the functioning of
+Emacs. @xref{Init File}. Also, see whether the problem happens in a
+freshly started Emacs without loading your init file (start Emacs with
+the @code{-q} switch to prevent loading the init file). If the problem
+does @var{not} occur then, it is essential that we know the contents of
+any programs that you must load into the Lisp world in order to cause
+the problem to occur.
If the problem does depend on an init file or other Lisp programs that
are not part of the standard Emacs system, then you should make sure it is
(open-termscript "~/termscript")
@end example
-@noindent
-using @kbd{Meta-@key{ESC}} or from the @samp{*scratch*} buffer just
-after starting Emacs. From then on, all output from Emacs to the terminal
-will be written in the specified termscript file as well, until the Emacs
-process is killed. If the problem happens when Emacs starts up, put this
-expression into your @file{.emacs} file so that the termscript file will
-be open when Emacs displays the screen for the first time. Be warned:
-it is often difficult, and sometimes impossible, to fix a terminal-dependent
-bug without access to a terminal of the type that stimulates the bug.@refill
+@noindent using @kbd{Meta-@key{ESC}} or from the @samp{*scratch*} buffer
+just after starting Emacs. From then on, all output from Emacs to the
+terminal will be written in the specified termscript file as well, until
+the Emacs process is killed. If the problem happens when Emacs starts
+up, put this expression into your init file so that the termscript file
+will be open when Emacs displays the screen for the first time.
+@xref{Init File}. Be warned: it is often difficult, and sometimes
+impossible, to fix a terminal-dependent bug without access to a terminal
+of the type that stimulates the bug.@refill
The newsgroup @samp{comp.emacs.xemacs} may be used for bug reports,
other discussions and requests for assistance.
By changing them, you can "redefine keys".
* Syntax:: The syntax table controls how words and expressions
are parsed.
-* Init File:: How to write common customizations in the @file{.emacs}
- file.
+* Init File:: How to write common customizations in the init file.
* Audible Bell:: Changing how XEmacs sounds the bell.
* Faces:: Changing the fonts and colors of a region of text.
* X Resources:: X resources controlling various aspects of the
* Entry: Syntax Entry. What the syntax table records for each character.
* Change: Syntax Change. How to change the information.
-The Init File, @file{~/.emacs}
+The Init File
* Init Syntax:: Syntax of constants in Emacs Lisp.
* Init Examples:: How to do some things with an init file.
#
-# Sample makefile for a simple Emacs module.
# This is slightly more complicated than would normally be the case,
# as this makefile has been tailored to work in the Emacs source tree.
# For samples of how to compile modules outside of the source tree
# 'installed'.
#
+SHELL=/bin/sh
+RM=rm -f
CC=../../lib-src/ellcc
CFLAGS=-I. -I../../src
LD=$(CC) --mode=link
distclean: clean
clean:
- rm -f $(MODNAME).ell $(OBJS) base64_i.o base64_i.c
+ $(RM) $(MODNAME).ell $(OBJS) base64_i.o base64_i.c
$(MODNAME).ell: $(OBJS) base64_i.o
$(LD) --mod-output=$@ $(OBJS) base64_i.o
#
-# Sample makefile for a simple Emacs module.
# This is slightly more complicated than would normally be the case,
# as this makefile has been tailored to work in the Emacs source tree.
# For samples of how to compile modules outside of the source tree
# 'installed'.
#
+SHELL=/bin/sh
+RM=rm -f
CC=../../lib-src/ellcc
CFLAGS=-I. -I../../src
LD=$(CC) --mode=link
distclean: clean
clean:
- rm -f $(MODNAME).ell $(OBJS) eldap_i.o eldap_i.c
+ $(RM) $(MODNAME).ell $(OBJS) eldap_i.o eldap_i.c
$(MODNAME).ell: $(OBJS) eldap_i.o
$(LD) --mod-output=$@ $(OBJS) eldap_i.o
# 'installed'.
#
+SHELL=/bin/sh
+RM=rm -f
CC=../../lib-src/ellcc
CFLAGS=-I. -I../../src
LD=$(CC) --mode=link
distclean: clean
clean:
- rm -f $(MODNAME).ell $(OBJS) sample_i.o sample_i.c
+ $(RM) $(MODNAME).ell $(OBJS) sample_i.o sample_i.c
$(MODNAME).ell: $(OBJS) sample_i.o
$(LD) --mod-output=$@ $(OBJS) sample_i.o
# 'installed'.
#
+SHELL=/bin/sh
+RM=rm -f
CC=../../lib-src/ellcc
CFLAGS=-I. -I../../src
LD=$(CC) --mode=link
distclean: clean
clean:
- rm -f $(MODNAME).ell $(OBJS) zlib_i.o zlib_i.c
+ $(RM) $(MODNAME).ell $(OBJS) zlib_i.o zlib_i.c
$(MODNAME).ell: $(OBJS) zlib_i.o
$(LD) --mod-output=$@ $(OBJS) zlib_i.o
+2000-07-19 Martin Buchholz <martin@xemacs.org>
+
+ * XEmacs 21.2.35 is released.
+
+2000-07-14 IKEYAMA Tomonori <tomonori@suiyokai.org>
+
+ * config.h: Import C++ compilation stuff from src/config.h.
+
+2000-07-05 Craig Lanning <lanning@scra.org>
+
+ * xemacs.rc: Uppercase the id's so that windres will work.
+
+2000-07-05 Kirill 'Big K' Katsnelson <kkm@dtmx.com>
+
+ * xemacs.mak (TEMACS_LIBS): Added comdlg32.lib
+
+2000-06-12 Ben Wing <ben@xemacs.org>
+
+ * config.h (ENCAPSULATE_STAT):
+ Always encapsulate stat/fstat. Also suggested by Mike Alexander
+ <mike.alexander@xemacs.org>.
+
+2000-06-10 Ben Wing <ben@xemacs.org>
+
+ * config.h:
+ * config.h (HAVE_GETPAGESIZE):
+ * config.h (HAVE_GETTIMEOFDAY):
+ corrections to go along with removed nt/inc.
+ removed HAVE_FEP.
+
+ * config.inc.samp:
+ correct graphics lib paths to agree with binaries provided in
+ ftp aux dir.
+
+ * xemacs.mak (DEPEND):
+ * xemacs.mak (DEFINES):
+ * xemacs.mak (LIB_SRC_DEFINES):
+ * xemacs.mak (minitar):
+ * xemacs.mak (TEMACS_LFLAGS):
+ * xemacs.mak (tags):
+ * xemacs.mak (all):
+ * xemacs.mak (install):
+ WINDOWSNT -> WIN32_NATIVE.
+ Don't build run*.exe.
+ comments about required ^^.
+ Added setargv.obj to the list of linked entities,
+ causing automatic wildcarding of filenames given on the
+ command line. (As usual, enclose in double quotes to avoid
+ this.)
+
+2000-06-07 Ben Wing <ben@xemacs.org>
+
+ * runemacs.c: Removed. No longer necessary.
+
+ * Makefile.cygwin: Removed.
+
+ * inc\*: Removed. At long-fucking-last!
+
2000-05-28 Martin Buchholz <martin@xemacs.org>
* XEmacs 21.2.34 is released.
* XEmacs 21.2.16 is released
-1999-05-14 Adrian Aichner <adrian@xemacs.org>
+1999-05-14 Adrian Aichner <adrian@xemacs.org>
* xemacs.mak (GUNG_HO): Explicitly default to 0.
Fix some comment typos.
#undef WORDS_BIGENDIAN
#undef TIME_WITH_SYS_TIME
-#define HAVE_SYS_TIME_H
+#undef HAVE_SYS_TIME_H
#define HAVE_LOCALE_H
#ifdef HAVE_X_WINDOWS
#define HAVE_X11_LOCALE_H
#undef HAVE_FREXP
#undef HAVE_FTIME
#undef HAVE_GETHOSTNAME
-#undef HAVE_GETPAGESIZE
+
+#define HAVE_GETPAGESIZE
+#define getpagesize() 4096
+
#define HAVE_GETTIMEOFDAY
#define HAVE_GETWD
#undef HAVE_LOGB
#define ENCAPSULATE_OPEN
#define ENCAPSULATE_FOPEN
#define ENCAPSULATE_MKDIR
-
-#if defined (WIN32) && defined (USE_IME)
-#define HAVE_FEP
-#endif
+#define ENCAPSULATE_STAT
+#define ENCAPSULATE_FSTAT
#if defined (HAVE_SOCKS) && !defined (DO_NOT_SOCKSIFY)
#define accept Raccept
#endif /* compiler understands #pragma warning*/
+#ifndef NOT_C_CODE /* Actually means C or C++ */
+# if defined (__cplusplus)
+/* Avoid C++ keywords used as ordinary C identifiers */
+# define class c_class
+# define new c_new
+# define this c_this
+# define catch c_catch
+# define not c_not
+
+# define EXTERN_C extern "C"
+# else /* C code */
+# define EXTERN_C extern
+# endif
+#endif /* C or C++ */
+
#define enum_field(enumeration_type) unsigned int
/* We want to avoid saving the signal mask if possible, because
! if [if not exist $(OUTDIR)\nul mkdir "$(OUTDIR)"]
! endif
# generate an nmake-readable version of depend
+# #### here, it doesn't seem to matter if we double ^'s!
+# results are the same with all single ^ and all double ^^!
+# see comment below.
! if [perl -p -e "s/^\x23ifdef (.+)/!if defined($$1)/; s/^\x23e/!e/;" \
-e "s/([\s=^])([\w\d\.\-^]+\.[ch^])/$$1$(SRC:\=\\)\\$$2/g;" \
-e "s/^(.+)\.o:(.+)/$(OUTDIR:\=\\)\\$$1.obj:$$2 $(NT:\=\\)\\config.inc/;" \
DEFINES=$(X_DEFINES) $(MSW_DEFINES) $(MULE_DEFINES) \
$(TAGBITS_DEFINES) $(LRECORD_DEFINES) $(UNION_DEFINES) \
$(DUMPER_DEFINES) $(MALLOC_DEFINES) $(QUICK_DEFINES) \
- -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN -DWINDOWSNT -Demacs \
+ -DWIN32_LEAN_AND_MEAN -DWIN32_NATIVE -Demacs \
-DHAVE_CONFIG_H $(PROGRAM_DEFINES) $(PATH_DEFINES)
#------------------------------------------------------------------------------
# lib-src programs
-LIB_SRC_DEFINES = -DHAVE_CONFIG_H -DWIN32 -DWINDOWSNT
+LIB_SRC_DEFINES = -DHAVE_CONFIG_H -DWIN32_NATIVE
#
# Creating config.values to be used by config.el
#------------------------------------------------------------------------------
-# runxemacs proglet
-
-RUNEMACS = $(SRC)\runxemacs.exe
-
-$(RUNEMACS): $(LIB_SRC)\run.c $(LIB_SRC)\run.res
- $(CCV) -I$(LIB_SRC) $(CFLAGS) -Fe$@ -Fo$(LIB_SRC) -Fd$(LIB_SRC)\ $** kernel32.lib user32.lib -link -incremental:no
-
-$(LIB_SRC)\run.res: $(LIB_SRC)\run.rc
- rc -I$(LIB_SRC) -Fo$@ $**
-
-#------------------------------------------------------------------------------
-
# dump-id.c file that contains the dump id
$(SRC)\dump-id.c : $(LIB_SRC)/make-dump-id.exe
TEMACS_BROWSE=$(TEMACS_DIR)\temacs.bsc
TEMACS_SRC=$(SRC)
TEMACS_LIBS=$(LASTFILE) $(LWLIB) $(X_LIBS) $(MSW_LIBS) \
- oldnames.lib kernel32.lib user32.lib gdi32.lib advapi32.lib \
+ oldnames.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib \
shell32.lib wsock32.lib winmm.lib winspool.lib ole32.lib uuid.lib $(LIBC_LIB)
TEMACS_LFLAGS=-nologo $(LIBRARIES) $(DEBUG_FLAGS) -base:0x1000000\
-stack:0x800000 $(TEMACS_ENTRYPOINT) -subsystem:windows\
-pdb:$(TEMACS_DIR)\temacs.pdb -map:$(TEMACS_DIR)\temacs.map \
- -heap:0x00100000 -nodefaultlib -incremental:no
+ -heap:0x00100000 -nodefaultlib -incremental:no setargv.obj
TEMACS_CPP_FLAGS=-c \
$(CFLAGS) $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \
-DEMACS_MAJOR_VERSION=$(emacs_major_version) \
cd $(XEMACS)
$(DEL) TAGS
set PATH=lib-src;%PATH%
-# argh!!! we need two ^^'s to get one ^, but only before a backslash.
-# i have no idea why. probably some obscure nmake quoting convention.
+# we need to double ^, but only before backslash! Doubling it elsewhere
+# causes problems. I don't understand this -- CMD.EXE uses ^ as a quoting
+# convention of sorts, but appears to leave it alone inside of double quotes,
+# even before \. Could this be nmake interference?
etags -a -r "/[ ]*DEF\(VAR\|INE\)_[A-Z_]+[ ]*([ ]*\"\([^^\"]+\)\"/\2/" src\*.c src\*.h lwlib\*.c lwlib\*.h lib-src\*.c lib-src\*.h
etags -a -l none -r "/^(def\(var\|un\|alias\|const\|macro\|subst\|struct\|face\|group\|custom\|ine-\(function\|compiler-macro\|[a-z-]+alias\)\)[ ]+'?\([^ ]+\)/\3/" $(tagslisp)\*.el
# use this rule to build the complete system
all: installation $(OUTDIR)\nul $(LASTFILE) $(LWLIB) \
- $(LIB_SRC_TOOLS) $(RUNEMACS) $(TEMACS) update-elc $(DOC) $(PROGNAME) \
+ $(LIB_SRC_TOOLS) $(TEMACS) update-elc $(DOC) $(PROGNAME) \
update-auto-and-custom info
temacs: $(LASTFILE) $(TEMACS)
@copy $(LIB_SRC)\DOC "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)"
@copy $(CONFIG_VALUES) "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)"
@copy $(SRC)\xemacs.exe "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)"
- @copy $(RUNEMACS) "$(INSTALL_DIR)\$(EMACS_CONFIGURATION)"
@xcopy /e /q $(XEMACS)\etc "$(INSTALL_DIR)\etc\"
@xcopy /e /q $(XEMACS)\info "$(INSTALL_DIR)\info\"
@xcopy /e /q $(XEMACS)\lisp "$(INSTALL_DIR)\lisp\"
101 DUMP "xemacs.dmp"
#endif
-XEmacs icon preload "xemacs.ico"
-XEmacsFile icon "File.ico"
-XEmacsLisp icon "Lisp.ico"
+XEmacs ICON PRELOAD "xemacs.ico"
+XEmacsFile ICON "File.ico"
+XEmacsLisp ICON "Lisp.ico"
sheap_obj=sheap.o
#endif
+#if defined(MINGW) || defined(CYGWIN)
+res_obj=xemacs_res.o
+#endif
+
## -Demacs is needed to make some files produce the correct version
## for use in Emacs.
rangetab.o redisplay.o redisplay-output.o regex.o\
search.o select.o $(sheap_obj) signal.o sound.o\
specifier.o strftime.o symbols.o syntax.o sysdep.o\
- undo.o $(x_objs) widget.o window.o
+ undo.o $(x_objs) widget.o window.o $(res_obj)
obj_rtl = $(objs:.o=.c.rtl)
./${PROGNAME} -batch -vanilla -f list-load-path-shadows; fi; \
$(RM) SATISFIED; exit 0; fi; \
if test -f SATISFIED; then $(RM) SATISFIED; exit 1; fi; \
+ @$(RM) $@; \
$(RECURSIVE_MAKE) $@;
#else
@$(RM) $@
$(CC) -c -Demacs $(sound_cflags) $(cflags) ${srcdir}/hpplay.c
#endif /* HAVE_NATIVE_SOUND */
+xemacs_res.o: ${srcdir}/../nt/xemacs.rc
+ windres --include-dir ${srcdir}/../nt -i ${srcdir}/../nt/xemacs.rc -o $@
+
## System-specific programs to be made.
## ${other_files}, $(objects_system) and $(objects_machine)
## select which of these should be compiled. */
# endif
#endif
-#ifndef WINDOWSNT
+#ifndef NULL
#define NULL 0
#endif
#ifndef emacs
#define malloc xmalloc
#endif
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
extern pointer malloc ();
#else
extern void *malloc();
#include "balloon_help.h"
-#ifndef WINDOWSNT
+#ifndef max
#define max(x,y) (x>y?x:y)
#endif
#include "opaque.h"
#include "syntax.h"
-#include <limits.h>
-
EXFUN (Ffetch_bytecode, 1);
Lisp_Object Qbyte_code, Qcompiled_functionp, Qinvalid_byte_code;
#include "syssignal.h" /* Always include before systty.h */
#include "systty.h"
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define _P_NOWAIT 1 /* from process.h */
#include "nt.h"
#endif
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* When we are starting external processes we need to know whether they
take binary input (no conversion) or text input (\n is converted to
\r\n). Similarly for output: if newlines are written as \r\n then it's
text process output, otherwise it's binary. */
Lisp_Object Vbinary_process_input;
Lisp_Object Vbinary_process_output;
-#endif /* DOS_NT */
+#endif /* WIN32_NATIVE */
Lisp_Object Vshell_file_name;
int synch_process_retcode;
\f
/* Clean up when exiting Fcall_process_internal.
- On MSDOS, delete the temporary file on any kind of termination.
+ On Windows, delete the temporary file on any kind of termination.
On Unix, kill the process and any children on termination by signal. */
/* Nonzero if this is termination due to exit. */
/* #### "c-G" -- need non-consing Single-key-description */
message ("Waiting for process to die...(type C-g again to kill it instantly)");
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
{
HANDLE pHandle = OpenProcess (PROCESS_ALL_ACCESS, 0, pid);
if (pHandle == NULL)
Lisp_Object infile, buffer, current_dir, display, path;
int fd[2];
int filefd;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
HANDLE pHandle;
#endif
int pid;
else if (STRINGP (error_file))
{
fd_error = open ((const char *) XSTRING_DATA (error_file),
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
O_WRONLY | O_TRUNC | O_CREAT | O_TEXT,
S_IREAD | S_IWRITE
-#else /* not DOS_NT */
+#else /* not WIN32_NATIVE */
O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
CREAT_MODE
-#endif /* not DOS_NT */
+#endif /* not WIN32_NATIVE */
);
}
}
fork_error = Qnil;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
pid = child_setup (filefd, fd1, fd_error, new_argv,
(char *) XSTRING_DATA (current_dir));
if (!INTP (buffer))
/* Close STDERR into the parent process. We no longer need it. */
if (fd_error >= 0)
close (fd_error);
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
pid = fork ();
if (pid == 0)
if (fd_error >= 0)
close (fd_error);
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
environ = save_environ;
if (!NILP (fork_error))
signal_error (Qfile_error, fork_error);
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
if (pid < 0)
{
if (fd[0] >= 0)
break;
#if 0
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
/* Until we pull out of MULE things like
make_decoding_input_stream(), we do the following which is
less elegant. --marcpa */
QUIT;
/* Wait for it to terminate, unless it already has. */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
wait_for_termination (pHandle);
#else
wait_for_termination (pid);
a decent error from within the child, this should be verified as an
executable directory by the parent. */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
int
#else
void
{
char **env;
char *pwd;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
int cpid;
HANDLE handles[4];
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#ifdef SET_EMACS_PRIORITY
if (emacs_priority != 0)
nice (- emacs_priority);
#endif
-#if !defined (NO_SUBPROCESSES) && !defined (WINDOWSNT)
+ /* Under Windows, we are not in a child process at all, so we should
+ not close handles inherited from the parent -- we are the parent
+ and doing so will screw up all manner of things! Similarly, most
+ of the rest of the cleanup done in this function is not done
+ under Windows.
+
+ #### This entire child_setup() function is an utter and complete
+ piece of shit. I would rewrite it, at the very least splitting
+ out the Windows and non-Windows stuff into two completely
+ different functions; but instead I'm trying to make it go away
+ entirely, using the Lisp definition in process.el. What's left
+ is to fix up the routines in event-msw.c (and in event-Xt.c and
+ event-tty.c) to allow for stream devices to be handled correctly.
+ There isn't much to do, in fact, and I'll fix it shortly. That
+ way, the Lisp definition can be used non-interactively too. */
+#if !defined (NO_SUBPROCESSES) && !defined (WIN32_NATIVE)
/* Close Emacs's descriptors that this process should not have. */
close_process_descs ();
#endif /* not NO_SUBPROCESSES */
+#ifndef WIN32_NATIVE
close_load_descs ();
+#endif
/* Note that use of alloca is always safe here. It's obvious for systems
that do not have true vfork or that have true (stack) alloca.
*new_env = 0;
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
prepare_standard_handles (in, out, err, handles);
set_process_dir (current_dir);
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
/* Make sure that in, out, and err are not actually already in
descriptors zero, one, or two; this could happen if Emacs is
started with its standard in, out, or error closed, as might
for (fd=3; fd<=64; fd++)
close (fd);
}
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
#ifdef vipc
something missing here;
#endif /* vipc */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Spawn the child. (See ntproc.c:Spawnve). */
cpid = spawnve (_P_NOWAIT, new_argv[0], (const char* const*)new_argv,
(const char* const*)env);
report_file_error ("Spawning child process", Qnil);
reset_standard_handles (in, out, err, handles);
return cpid;
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
/* execvp does not accept an environment arg so the only way
to pass this environment is to set environ. Our caller
is responsible for restoring the ambient value of environ. */
stdout_out ("Can't exec program %s\n", new_argv[0]);
_exit (1);
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
}
static int
if (STRINGP (entry)
&& XSTRING_LENGTH (entry) > varlen
&& XSTRING_BYTE (entry, varlen) == '='
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* NT environment variables are case insensitive. */
&& ! memicmp (XSTRING_DATA (entry), var, varlen)
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
&& ! memcmp (XSTRING_DATA (entry), var, varlen)
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
)
{
*value = XSTRING_DATA (entry) + (varlen + 1);
{
/* Initialize shell-file-name from environment variables or best guess. */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
const char *shell = egetenv ("COMSPEC");
if (!shell) shell = "\\WINNT\\system32\\cmd.exe";
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
const char *shell = egetenv ("SHELL");
if (!shell) shell = "/bin/sh";
#endif
vars_of_callproc (void)
{
/* This function can GC */
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
DEFVAR_LISP ("binary-process-input", &Vbinary_process_input /*
*If non-nil then new subprocesses are assumed to take binary input.
*/ );
*If non-nil then new subprocesses are assumed to produce binary output.
*/ );
Vbinary_process_output = Qnil;
-#endif /* DOS_NT */
+#endif /* WIN32_NATIVE */
DEFVAR_LISP ("shell-file-name", &Vshell_file_name /*
*File name to load inferior shells from.
#define EXPENSIVE 2000
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern char *tgoto (const char *cm, int hpos, int vpos);
-extern void tputs (const char *, int, void (*)(int));
-#ifdef __cplusplus
-}
-#endif
+EXTERN_C char *tgoto (const char *cm, int hpos, int vpos);
+EXTERN_C int tputs (const char *, int, void (*)(int));
static void cmgoto_for_real (struct console *c, int row, int col);
return 1;
}
-static HWND msw_console_hwnd = 0;
+static HWND mswindows_console_hwnd = 0;
#define KLUDGE_BUFSIZE 1024 /* buffer size for console window titles */
}
HWND
-msw_get_console_hwnd (void)
+mswindows_get_console_hwnd (void)
{
- if (!msw_console_hwnd)
- msw_console_hwnd = GetConsoleHwnd ();
- return msw_console_hwnd;
+ if (!mswindows_console_hwnd)
+ mswindows_console_hwnd = GetConsoleHwnd ();
+ return mswindows_console_hwnd;
}
-int
-msw_ensure_console_allocated (void)
+static int
+mswindows_ensure_console_allocated (void)
{
HWND fgwin = GetForegroundWindow ();
/* stupid mswin api won't let you create the console window
}
void
-msw_hide_console (void)
+mswindows_hide_console (void)
{
- ShowWindow (msw_get_console_hwnd (), SW_HIDE);
+ ShowWindow (mswindows_get_console_hwnd (), SW_HIDE);
}
void
-msw_show_console (void)
+mswindows_show_console (void)
{
- HWND hwnd = msw_get_console_hwnd ();
+ HWND hwnd = mswindows_get_console_hwnd ();
ShowWindow (hwnd, SW_SHOWNA);
/* I tried to raise the window to the top without activating
SWP_NOACTIVATE);
}
-static int msw_console_buffered = 0;
-HANDLE msw_console_buffer;
+static int mswindows_console_buffered = 0;
+HANDLE mswindows_console_buffer;
static void
-msw_ensure_console_buffered (void)
+mswindows_ensure_console_buffered (void)
{
- if (!msw_console_buffered)
+ if (!mswindows_console_buffered)
{
COORD new_size;
new_size.X = 80;
new_size.Y = 1000;
- msw_ensure_console_allocated ();
- msw_console_buffer =
+ mswindows_ensure_console_allocated ();
+ mswindows_console_buffer =
CreateConsoleScreenBuffer (GENERIC_WRITE, 0, NULL,
CONSOLE_TEXTMODE_BUFFER, NULL);
- SetConsoleScreenBufferSize (msw_console_buffer, new_size);
- SetConsoleActiveScreenBuffer (msw_console_buffer);
- msw_console_buffered = 1;
+ SetConsoleScreenBufferSize (mswindows_console_buffer, new_size);
+ SetConsoleActiveScreenBuffer (mswindows_console_buffer);
+ mswindows_console_buffered = 1;
}
}
+int mswindows_message_outputted;
+
int
-msw_output_console_string (CONST Extbyte *str, Extcount len)
+mswindows_output_console_string (CONST Extbyte *str, Extcount len)
{
DWORD num_written;
- msw_ensure_console_buffered ();
- msw_show_console ();
- return WriteConsole (msw_console_buffer, str, len, &num_written, NULL);
+ mswindows_message_outputted = 1;
+ mswindows_ensure_console_buffered ();
+ mswindows_show_console ();
+ return WriteConsole (mswindows_console_buffer, str, len, &num_written, NULL);
}
/* Determine if running on Windows 9x and not NT */
int
-msw_windows9x_p (void)
+mswindows_windows9x_p (void)
{
return GetVersion () & 0x80000000;
}
* Intended for use in the MSVC "Watch" window which doesn't like
* the aborts that the error_check_foo() functions can make.
*/
+struct lrecord_header *DHEADER (Lisp_Object obj);
struct lrecord_header *
DHEADER (Lisp_Object obj)
{
return LRECORDP (obj) ? XRECORD_LHEADER (obj) : NULL;
}
+void *DOPAQUE_DATA (Lisp_Object obj);
void *
DOPAQUE_DATA (Lisp_Object obj)
{
return OPAQUEP (obj) ? OPAQUE_DATA (XOPAQUE (obj)) : NULL;
}
+Lisp_Event *DEVENT (Lisp_Object obj);
Lisp_Event *
DEVENT (Lisp_Object obj)
{
return EVENTP (obj) ? XEVENT (obj) : NULL;
}
+Lisp_Cons *DCONS (Lisp_Object obj);
Lisp_Cons *
DCONS (Lisp_Object obj)
{
return CONSP (obj) ? XCONS (obj) : NULL;
}
+Lisp_Cons *DCONSCDR (Lisp_Object obj);
Lisp_Cons *
DCONSCDR (Lisp_Object obj)
{
return (CONSP (obj) && CONSP (XCDR (obj))) ? XCONS (XCDR (obj)) : 0;
}
+Bufbyte *DSTRING (Lisp_Object obj);
Bufbyte *
DSTRING (Lisp_Object obj)
{
return STRINGP (obj) ? XSTRING_DATA (obj) : NULL;
}
+Lisp_Vector *DVECTOR (Lisp_Object obj);
Lisp_Vector *
DVECTOR (Lisp_Object obj)
{
return VECTORP (obj) ? XVECTOR (obj) : NULL;
}
+Lisp_Symbol *DSYMBOL (Lisp_Object obj);
Lisp_Symbol *
DSYMBOL (Lisp_Object obj)
{
return SYMBOLP (obj) ? XSYMBOL (obj) : NULL;
}
+Bufbyte *DSYMNAME (Lisp_Object obj);
Bufbyte *
DSYMNAME (Lisp_Object obj)
{
#define XEMACS_CONTROL_CLASS "XEmacsControl"
/*
- * Console
+ * Consoles
*/
DECLARE_CONSOLE_TYPE (mswindows);
DECLARE_CONSOLE_TYPE (msprinter);
/*
- * Device
+ * Printer settings, aka devmode
+ */
+
+typedef struct Lisp_Devmode
+{
+ struct lcrecord_header header;
+
+ /* Pointer to the DEVMODE structure */
+ DEVMODE* devmode;
+
+ /* Full printer name. It can be longer than devmode->dmDeviceName
+ can accomodate, so need to keep it separately */
+ char* printer_name;
+
+ /* Printer device this object is currently selected in, or Qnil
+ if not selected */
+ Lisp_Object device;
+
+} Lisp_Devmode;
+
+
+DECLARE_LRECORD (devmode, Lisp_Devmode);
+#define XDEVMODE(x) XRECORD (x, devmode, Lisp_Devmode)
+#define XSETDEVMODE(x, p) XSETRECORD (x, p, devmode)
+#define DEVMODEP(x) RECORDP (x, devmode)
+#define CHECK_DEVMODE(x) CHECK_RECORD (x, devmode)
+#define CONCHECK_DEVMODE(x) CONCHECK_RECORD (x, devmode)
+
+#define DEVMODE_SIZE(dm) ((dm)->dmSize + (dm)->dmDriverExtra)
+#define XDEVMODE_SIZE(x) ((x)->devmode ? DEVMODE_SIZE((x)->devmode) : 0)
+
+/*
+ * Devices
*/
#define MSW_FONTSIZE (LF_FACESIZE*4+12)
struct mswindows_device
{
- int logpixelsx, logpixelsy;
- int planes, cells;
- int horzres, vertres; /* Size in pixels */
- int horzsize, vertsize; /* Size in mm */
- int bitspixel;
Lisp_Object fontlist; /* List of strings, device fonts */
HDC hcdc; /* Compatible DC */
+ DWORD update_tick; /* Used when device is modified through
+ Windows mwssages, see WM_DISPLAYCHANGE
+ in event-msw.c */
};
#define DEVICE_MSWINDOWS_DATA(d) DEVICE_TYPE_DATA (d, mswindows)
-#define DEVICE_MSWINDOWS_LOGPIXELSX(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsx)
-#define DEVICE_MSWINDOWS_LOGPIXELSY(d) (DEVICE_MSWINDOWS_DATA (d)->logpixelsy)
-#define DEVICE_MSWINDOWS_PLANES(d) (DEVICE_MSWINDOWS_DATA (d)->planes)
-#define DEVICE_MSWINDOWS_CELLS(d) (DEVICE_MSWINDOWS_DATA (d)->cells)
-#define DEVICE_MSWINDOWS_HORZRES(d) (DEVICE_MSWINDOWS_DATA (d)->horzres)
-#define DEVICE_MSWINDOWS_VERTRES(d) (DEVICE_MSWINDOWS_DATA (d)->vertres)
-#define DEVICE_MSWINDOWS_HORZSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->horzsize)
-#define DEVICE_MSWINDOWS_VERTSIZE(d) (DEVICE_MSWINDOWS_DATA (d)->vertsize)
-#define DEVICE_MSWINDOWS_BITSPIXEL(d) (DEVICE_MSWINDOWS_DATA (d)->bitspixel)
-#define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist)
-#define DEVICE_MSWINDOWS_HCDC(d) (DEVICE_MSWINDOWS_DATA (d)->hcdc)
+#define DEVICE_MSWINDOWS_FONTLIST(d) (DEVICE_MSWINDOWS_DATA (d)->fontlist)
+#define DEVICE_MSWINDOWS_HCDC(d) (DEVICE_MSWINDOWS_DATA (d)->hcdc)
+#define DEVICE_MSWINDOWS_UPDATE_TICK(d) (DEVICE_MSWINDOWS_DATA (d)->update_tick)
struct msprinter_device
{
HDC hdc, hcdc; /* Printer and the comp. DCs */
HANDLE hprinter;
- Lisp_Object fontlist;
char* name;
- DEVMODE *devmode, *devmode_mirror;
- size_t devmode_size;
+ Lisp_Object devmode;
+ Lisp_Object fontlist;
};
#define DEVICE_MSPRINTER_DATA(d) DEVICE_TYPE_DATA (d, msprinter)
#define DEVICE_MSPRINTER_FONTLIST(d) (DEVICE_MSPRINTER_DATA (d)->fontlist)
#define DEVICE_MSPRINTER_NAME(d) (DEVICE_MSPRINTER_DATA (d)->name)
#define DEVICE_MSPRINTER_DEVMODE(d) (DEVICE_MSPRINTER_DATA (d)->devmode)
-#define DEVICE_MSPRINTER_DEVMODE_MIRROR(d) \
- (DEVICE_MSPRINTER_DATA (d)->devmode_mirror)
-#define DEVICE_MSPRINTER_DEVMODE_SIZE(d) \
- (DEVICE_MSPRINTER_DATA (d)->devmode_size)
#define CONSOLE_TYPESYM_MSPRINTER_P(typesym) EQ (typesym, Qmsprinter)
#define DEVICE_MSPRINTER_P(dev) CONSOLE_TYPESYM_MSPRINTER_P (DEVICE_TYPE (dev))
#define CHECK_MSPRINTER_DEVICE(z) CHECK_DEVICE_TYPE (z, msprinter)
#define CONCHECK_MSPRINTER_DEVICE(z) CONCHECK_DEVICE_TYPE (z, msprinter)
-/* Printer functions in device-msw.c */
-DEVMODE* msprinter_get_devmode_copy (struct device *d);
-void msprinter_apply_devmode (struct device *d, DEVMODE *devmode);
-
/* Printer functions in frame-msw.c */
void msprinter_start_page (struct frame *f);
} while (0)
/*
- * Frame
+ * Frames
*/
typedef struct
{
int left_margin, top_margin, /* All in twips */
right_margin, bottom_margin;
int charheight, charwidth; /* As per proplist or -1 if not gven */
- Lisp_Object orientation, duplex; /* nil for printer's default */
+ int pix_left, pix_top; /* Calculated in init_frame_*, VP offset */
int job_started : 1;
int page_started : 1;
};
#define FRAME_MSPRINTER_BOTTOM_MARGIN(f) (FRAME_MSPRINTER_DATA (f)->bottom_margin)
#define FRAME_MSPRINTER_JOB_STARTED(f) (FRAME_MSPRINTER_DATA (f)->job_started)
#define FRAME_MSPRINTER_PAGE_STARTED(f) (FRAME_MSPRINTER_DATA (f)->page_started)
-#define FRAME_MSPRINTER_ORIENTATION(f) (FRAME_MSPRINTER_DATA (f)->orientation)
-#define FRAME_MSPRINTER_DUPLEX(f) (FRAME_MSPRINTER_DATA (f)->duplex)
#define FRAME_MSPRINTER_CHARWIDTH(f) (FRAME_MSPRINTER_DATA (f)->charheight)
#define FRAME_MSPRINTER_CHARHEIGHT(f) (FRAME_MSPRINTER_DATA (f)->charwidth)
+#define FRAME_MSPRINTER_PIXLEFT(f) (FRAME_MSPRINTER_DATA (f)->pix_left)
+#define FRAME_MSPRINTER_PIXTOP(f) (FRAME_MSPRINTER_DATA (f)->pix_top)
/*
* Events
void mswindows_redraw_exposed_area (struct frame *f, int x, int y,
int width, int height);
void mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest);
+HWND mswindows_get_selected_frame_hwnd (void);
void mswindows_enqueue_magic_event (HWND hwnd, UINT msg);
/* win32 DDE management library */
extern Lisp_Object Vmswindows_frame_being_created;
extern Lisp_Object mswindows_frame_being_created;
-void msw_get_workspace_coords (RECT *rc);
+void mswindows_get_workspace_coords (RECT *rc);
-HWND msw_get_console_hwnd (void);
-void msw_hide_console (void);
-void msw_show_console (void);
-int msw_output_console_string (CONST Extbyte *str, Extcount len);
+HWND mswindows_get_console_hwnd (void);
+void mswindows_hide_console (void);
+void mswindows_show_console (void);
+int mswindows_output_console_string (CONST Extbyte *str, Extcount len);
Lisp_Object mswindows_enumerate_fonts (HDC hdc);
-int msw_char_is_accelerator (struct frame *f, Emchar ch);
-Bytecount msw_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
+int mswindows_char_is_accelerator (struct frame *f, Emchar ch);
+Bytecount mswindows_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
Bytecount maxlen, Emchar *accel,
Lisp_Object error_name);
Lisp_Object mswindows_handle_gui_wm_command (struct frame* f,
HWND ctrl, LPARAM id);
-int msw_windows9x_p (void);
+int mswindows_windows9x_p (void);
void mswindows_output_last_error (char *frob);
#include "frame.h"
#include "sysdep.h"
-#if !(defined (__CYGWIN32__) || defined(__MINGW32__))
+/* #### Andy, these includes might break cygwin compilation - kkm*/
+#include <commdlg.h>
+#include <winspool.h>
+
+#if !(defined (CYGWIN) || defined(MINGW))
# include <objbase.h> /* For CoInitialize */
#endif
Lisp_Object Vmswindows_get_true_file_attributes;
Lisp_Object Qinit_pre_mswindows_win, Qinit_post_mswindows_win;
+Lisp_Object Qdevmodep;
+static Lisp_Object allocate_devmode (DEVMODE* src_devmode, int do_copy,
+ char* src_name, struct device *d);
/************************************************************************/
/* helpers */
index2 < 0 ? Qnil : make_int (GetDeviceCaps (hdc, index2)));
}
-
\f
/************************************************************************/
/* display methods */
d->device_data = xnew_and_zero (struct mswindows_device);
hdc = CreateCompatibleDC (NULL);
assert (hdc!=NULL);
- DEVICE_MSWINDOWS_LOGPIXELSX(d) = GetDeviceCaps(hdc, LOGPIXELSX);
- DEVICE_MSWINDOWS_LOGPIXELSY(d) = GetDeviceCaps(hdc, LOGPIXELSY);
- DEVICE_MSWINDOWS_PLANES(d) = GetDeviceCaps(hdc, PLANES);
- /* #### SIZEPALETTE only valid if RC_PALETTE bit set in RASTERCAPS,
- what should we return for a non-palette-based device? */
- DEVICE_MSWINDOWS_CELLS(d) = GetDeviceCaps(hdc, SIZEPALETTE);
- DEVICE_MSWINDOWS_HORZRES(d) = GetDeviceCaps(hdc, HORZRES);
- DEVICE_MSWINDOWS_VERTRES(d) = GetDeviceCaps(hdc, VERTRES);
- DEVICE_MSWINDOWS_HORZSIZE(d) = GetDeviceCaps(hdc, HORZSIZE);
- DEVICE_MSWINDOWS_VERTSIZE(d) = GetDeviceCaps(hdc, VERTSIZE);
- DEVICE_MSWINDOWS_BITSPIXEL(d) = GetDeviceCaps(hdc, BITSPIXEL);
- DEVICE_MSWINDOWS_FONTLIST (d) = mswindows_enumerate_fonts (hdc);
-
DEVICE_MSWINDOWS_HCDC(d) = hdc;
+ DEVICE_MSWINDOWS_FONTLIST (d) = mswindows_enumerate_fonts (hdc);
+ DEVICE_MSWINDOWS_UPDATE_TICK (d) = GetTickCount ();
/* Register the main window class */
wc.cbSize = sizeof (WNDCLASSEX);
/* Initialize DDE management library and our related globals. We execute a
* dde Open("file") by simulating a drop, so this depends on dnd support. */
#ifdef HAVE_DRAGNDROP
-# if !(defined(__CYGWIN32__) || defined(__MINGW32__))
+# if !(defined(CYGWIN) || defined(MINGW))
CoInitialize (NULL);
# endif
DdeFreeStringHandle (mswindows_dde_mlid, mswindows_dde_service);
DdeUninitialize (mswindows_dde_mlid);
-# if !(defined(__CYGWIN32__) || defined(__MINGW32__))
+# if !(defined(CYGWIN) || defined(MINGW))
CoUninitialize ();
# endif
#endif
DeleteDC (DEVICE_MSWINDOWS_HCDC(d));
- free (d->device_data);
+ xfree (d->device_data);
}
void
-msw_get_workspace_coords (RECT *rc)
+mswindows_get_workspace_coords (RECT *rc)
{
SystemParametersInfo (SPI_GETWORKAREA, 0, rc, 0);
}
mswindows_device_system_metrics (struct device *d,
enum device_metrics m)
{
+ const HDC hdc = DEVICE_MSWINDOWS_HCDC(d);
+
switch (m)
{
case DM_size_device:
- return Fcons (make_int (DEVICE_MSWINDOWS_HORZRES(d)),
- make_int (DEVICE_MSWINDOWS_VERTRES(d)));
+ return Fcons (make_int (GetDeviceCaps (hdc, HORZRES)),
+ make_int (GetDeviceCaps (hdc, VERTRES)));
break;
case DM_device_dpi:
- return Fcons (make_int (DEVICE_MSWINDOWS_LOGPIXELSX(d)),
- make_int (DEVICE_MSWINDOWS_LOGPIXELSY(d)));
+ return Fcons (make_int (GetDeviceCaps (hdc, LOGPIXELSX)),
+ make_int (GetDeviceCaps (hdc, LOGPIXELSY)));
break;
case DM_size_device_mm:
- return Fcons (make_int (DEVICE_MSWINDOWS_HORZSIZE(d)),
- make_int (DEVICE_MSWINDOWS_VERTSIZE(d)));
+ return Fcons (make_int (GetDeviceCaps (hdc, HORZSIZE)),
+ make_int (GetDeviceCaps (hdc, VERTSIZE)));
break;
case DM_num_bit_planes:
/* this is what X means by bitplanes therefore we ought to be
consistent. num planes is always 1 under mswindows and
therefore useless */
- return make_int (DEVICE_MSWINDOWS_BITSPIXEL(d));
+ return make_int (GetDeviceCaps (hdc, BITSPIXEL));
break;
case DM_num_color_cells:
- return make_int (DEVICE_MSWINDOWS_CELLS(d));
+ /* #### SIZEPALETTE only valid if RC_PALETTE bit set in RASTERCAPS,
+ what should we return for a non-palette-based device? */
+ return make_int (GetDeviceCaps (hdc, SIZEPALETTE));
break;
/*** Colors ***/
case DM_size_workspace:
{
RECT rc;
- msw_get_workspace_coords (&rc);
+ mswindows_get_workspace_coords (&rc);
return Fcons (make_int (rc.right - rc.left),
make_int (rc.bottom - rc.top));
}
case DM_offset_workspace:
{
RECT rc;
- msw_get_workspace_coords (&rc);
+ mswindows_get_workspace_coords (&rc);
return Fcons (make_int (rc.left), make_int (rc.top));
}
\f
/************************************************************************/
-/* printer methods */
+/* printer helpers */
/************************************************************************/
static void
signal_simple_error ("Failed to open printer", DEVICE_CONNECTION (d));
}
-static void
-msprinter_init_device (struct device *d, Lisp_Object props)
-{
- char* printer_name;
-
- DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
-
- CHECK_STRING (DEVICE_CONNECTION (d));
-
- TO_EXTERNAL_FORMAT (LISP_STRING, DEVICE_CONNECTION (d),
- C_STRING_ALLOCA, printer_name,
- Qctext);
-
- d->device_data = xnew_and_zero (struct msprinter_device);
+/* Helper function */
+static int
+msprinter_init_device_internal (struct device *d, char* printer_name)
+{
DEVICE_MSPRINTER_NAME(d) = xstrdup (printer_name);
if (!OpenPrinter (printer_name, &DEVICE_MSPRINTER_HPRINTER (d), NULL))
{
DEVICE_MSPRINTER_HPRINTER (d) = NULL;
- signal_open_printer_error (d);
+ return 0;
}
DEVICE_MSPRINTER_HDC (d) = CreateDC ("WINSPOOL", printer_name,
NULL, NULL);
if (DEVICE_MSPRINTER_HDC (d) == NULL)
- signal_open_printer_error (d);
+ return 0;
DEVICE_MSPRINTER_HCDC(d) =
CreateCompatibleDC (DEVICE_MSPRINTER_HDC (d));
- /* Determinie DEVMODE size and store the default DEVMODE */
- DEVICE_MSPRINTER_DEVMODE_SIZE(d) =
- DocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER(d),
- printer_name, NULL, NULL, 0);
- if (DEVICE_MSPRINTER_DEVMODE_SIZE(d) <= 0)
- signal_open_printer_error (d);
+ DEVICE_CLASS (d) = (GetDeviceCaps (DEVICE_MSPRINTER_HDC (d), BITSPIXEL)
+ * GetDeviceCaps (DEVICE_MSPRINTER_HDC (d), PLANES)
+ > 1) ? Qcolor : Qmono;
+ return 1;
+}
- DEVICE_MSPRINTER_DEVMODE(d) =
- (DEVMODE*) xmalloc (DEVICE_MSPRINTER_DEVMODE_SIZE(d));
- DocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER(d),
- printer_name, DEVICE_MSPRINTER_DEVMODE(d),
- NULL, DM_OUT_BUFFER);
+static void
+msprinter_delete_device_internal (struct device *d)
+{
+ if (DEVICE_MSPRINTER_HPRINTER (d))
+ ClosePrinter (DEVICE_MSPRINTER_HPRINTER (d));
+ if (DEVICE_MSPRINTER_HDC (d))
+ DeleteDC (DEVICE_MSPRINTER_HDC (d));
+ if (DEVICE_MSPRINTER_HCDC (d))
+ DeleteDC (DEVICE_MSPRINTER_HCDC (d));
+ if (DEVICE_MSPRINTER_NAME (d))
+ xfree (DEVICE_MSPRINTER_NAME (d));
+
+ DEVICE_MSPRINTER_FONTLIST (d) = Qnil;
+}
+
+static int msprinter_reinit_device (struct device *d, char* devname)
+{
+ msprinter_delete_device_internal (d);
+ return msprinter_init_device_internal (d, devname);
+}
+
+\f
+/************************************************************************/
+/* printer methods */
+/************************************************************************/
+
+static void
+msprinter_init_device (struct device *d, Lisp_Object props)
+{
+ char* printer_name;
+ DEVMODE *pdm;
+ size_t dm_size;
+
+ d->device_data = xnew_and_zero (struct msprinter_device);
+
+ DEVICE_INFD (d) = DEVICE_OUTFD (d) = -1;
+ DEVICE_MSPRINTER_DEVMODE(d) = Qnil;
/* We do not use printer fon list as we do with the display
device. Rather, we allow GDI to pick the closest match to the
display font. */
DEVICE_MSPRINTER_FONTLIST (d) = Qnil;
- DEVICE_CLASS (d) = (GetDeviceCaps (DEVICE_MSPRINTER_HDC (d), BITSPIXEL)
- * GetDeviceCaps (DEVICE_MSPRINTER_HDC (d), PLANES)
- > 1) ? Qcolor : Qmono;
+ CHECK_STRING (DEVICE_CONNECTION (d));
+
+ TO_EXTERNAL_FORMAT (LISP_STRING, DEVICE_CONNECTION (d),
+ C_STRING_ALLOCA, printer_name,
+ Qmswindows_tstr);
+
+ if (!msprinter_init_device_internal (d, printer_name))
+ signal_open_printer_error (d);
+
+ /* Determinie DEVMODE size and store the default DEVMODE */
+ dm_size = DocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER(d),
+ printer_name, NULL, NULL, 0);
+ if (dm_size <= 0)
+ signal_open_printer_error (d);
+
+ pdm = (DEVMODE*) xmalloc (dm_size);
+ DocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER(d),
+ printer_name, pdm,
+ NULL, DM_OUT_BUFFER);
+
+ assert (DEVMODE_SIZE (pdm) <= dm_size);
+
+ DEVICE_MSPRINTER_DEVMODE(d) =
+ allocate_devmode (pdm, 0, printer_name, d);
+
+}
+
+static void
+msprinter_delete_device (struct device *d)
+{
+ if (d->device_data)
+ {
+ msprinter_delete_device_internal (d);
+
+ /* Disassociate the selected devmode with the device */
+ if (!NILP (DEVICE_MSPRINTER_DEVMODE (d)))
+ {
+ XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d))->device = Qnil;
+ DEVICE_MSPRINTER_DEVMODE (d) = Qnil;
+ }
+
+ xfree (d->device_data);
+ }
}
static Lisp_Object
}
static void
-msprinter_delete_device (struct device *d)
-{
- if (d->device_data)
- {
- if (DEVICE_MSPRINTER_HPRINTER (d))
- ClosePrinter (DEVICE_MSPRINTER_HPRINTER (d));
- if (DEVICE_MSPRINTER_HDC (d))
- DeleteDC (DEVICE_MSPRINTER_HDC (d));
- if (DEVICE_MSPRINTER_HCDC (d))
- DeleteDC (DEVICE_MSPRINTER_HCDC (d));
- if (DEVICE_MSPRINTER_NAME (d))
- free (DEVICE_MSPRINTER_NAME (d));
- if (DEVICE_MSPRINTER_DEVMODE (d))
- free (DEVICE_MSPRINTER_DEVMODE (d));
- if (DEVICE_MSPRINTER_DEVMODE_MIRROR (d))
- free (DEVICE_MSPRINTER_DEVMODE_MIRROR (d));
-
- free (d->device_data);
- }
-}
-
-static void
msprinter_mark_device (struct device *d)
{
mark_object (DEVICE_MSPRINTER_FONTLIST (d));
+ mark_object (DEVICE_MSPRINTER_DEVMODE (d));
}
static unsigned int
| XDEVIMPF_NO_AUTO_REDISPLAY
| XDEVIMPF_FRAMELESS_OK );
}
-
\f
/************************************************************************/
-/* printer external functions */
+/* printer Lisp subroutines */
/************************************************************************/
-/*
- * Return a copy of default DEVMODE. The copy returned is in
- * a static buffer which will be overwritten by next call.
- */
-DEVMODE*
-msprinter_get_devmode_copy (struct device *d)
+static void
+global_free_2_maybe (HGLOBAL hg1, HGLOBAL hg2)
{
- assert (DEVICE_MSPRINTER_P (d));
-
- if (DEVICE_MSPRINTER_DEVMODE_MIRROR(d) == NULL)
- DEVICE_MSPRINTER_DEVMODE_MIRROR(d) =
- (DEVMODE*) xmalloc (DEVICE_MSPRINTER_DEVMODE_SIZE(d));
-
- memcpy (DEVICE_MSPRINTER_DEVMODE_MIRROR(d),
- DEVICE_MSPRINTER_DEVMODE(d),
- DEVICE_MSPRINTER_DEVMODE_SIZE(d));
+ if (hg1 != NULL)
+ GlobalFree (hg1);
+ if (hg2 != NULL)
+ GlobalFree (hg2);
+}
- return DEVICE_MSPRINTER_DEVMODE_MIRROR(d);
+static HGLOBAL
+devmode_to_hglobal (Lisp_Devmode *ldm)
+{
+ HGLOBAL hg = GlobalAlloc (GHND, XDEVMODE_SIZE (ldm));
+ memcpy (GlobalLock (hg), ldm->devmode, XDEVMODE_SIZE (ldm));
+ GlobalUnlock (hg);
+ return hg;
}
-/*
- * Apply settings from the DEVMODE. The settings are considered
- * incremental to the default DEVMODE, so that changes in the
- * passed structure supercede parameters of the printer.
- *
- * The passed structure is overwritten by the fuction call;
- * complete printer settings are returned.
- */
-void
-msprinter_apply_devmode (struct device *d, DEVMODE *devmode)
+/* Returns 0 if the printer has been deleted due to a fatal I/O error,
+ 1 otherwise. */
+static int
+sync_printer_with_devmode (struct device* d, DEVMODE* devmode_in,
+ DEVMODE* devmode_out, char* devname)
{
- assert (DEVICE_MSPRINTER_P (d));
+ /* Change connection if the device changed */
+ if (devname != NULL
+ && stricmp (devname, DEVICE_MSPRINTER_NAME(d)) != 0)
+ {
+ Lisp_Object new_connection = build_ext_string (devname, Qmswindows_tstr);
+ struct gcpro gcpro1;
+
+ GCPRO1 (new_connection);
+ DEVICE_CONNECTION (d) = Qnil;
+ if (!NILP (Ffind_device (new_connection, Qmsprinter)))
+ {
+ /* We are in trouble - second msprinter for the same device.
+ Nothing wrong on the Windows side, just forge a unique
+ connection name. Use the memory address of d as a unique
+ suffix. */
+ char* new_connext = alloca (strlen (devname + 11));
+ sprintf (new_connext, "%s:%X", devname, d->header.uid);
+ new_connection = build_ext_string (devname, Qmswindows_tstr);
+ }
+ DEVICE_CONNECTION (d) = new_connection;
+ UNGCPRO;
+
+ /* Reinitialize printer. The device can pop off in process */
+ if (!msprinter_reinit_device (d, devname))
+ {
+ /* Kaboom! */
+ delete_device_internal (d, 1, 0, 1);
+ return 0;
+ }
+ }
+ /* Apply the new devmode to the printer */
DocumentProperties (NULL,
DEVICE_MSPRINTER_HPRINTER(d),
DEVICE_MSPRINTER_NAME(d),
- devmode, devmode,
+ devmode_out, devmode_in,
DM_IN_BUFFER | DM_OUT_BUFFER);
- /* #### ResetDC fails sometimes, Bill only know s why.
+ /* #### ResetDC fails sometimes, Bill only knows why.
The solution below looks more like a workaround to me,
although it might be fine. --kkm */
- if (ResetDC (DEVICE_MSPRINTER_HDC (d), devmode) == NULL)
+ if (ResetDC (DEVICE_MSPRINTER_HDC (d), devmode_out) == NULL)
{
DeleteDC (DEVICE_MSPRINTER_HDC (d));
DEVICE_MSPRINTER_HDC (d) =
- CreateDC ("WINSPOOL", DEVICE_MSPRINTER_NAME(d), NULL, devmode);
+ CreateDC ("WINSPOOL", DEVICE_MSPRINTER_NAME(d), NULL, devmode_out);
+ }
+
+ return 1;
+}
+
+static void
+handle_devmode_changes (Lisp_Devmode *ldm, HGLOBAL hDevNames, HGLOBAL hDevMode)
+{
+ DEVNAMES* devnames = (DEVNAMES*) GlobalLock (hDevNames);
+ char *new_name = devnames ? (char*)devnames + devnames->wDeviceOffset : NULL;
+ DEVMODE* devmode = (DEVMODE*) GlobalLock (hDevMode);
+
+ /* Size and name may have changed */
+ ldm->devmode = xrealloc (ldm->devmode, DEVMODE_SIZE (devmode));
+ if (new_name)
+ {
+ if (ldm->printer_name)
+ xfree (ldm->printer_name);
+ ldm->printer_name = xstrdup (new_name);
+ }
+
+ if (!NILP (ldm->device))
+ {
+ /* Apply the new devmode to the printer and get a compete one back */
+ struct device *d = XDEVICE (ldm->device);
+ if (!sync_printer_with_devmode (d, devmode, ldm->devmode, new_name))
+ {
+ global_free_2_maybe (hDevNames, hDevMode);
+ error ("Printer device initialization I/O error, device deleted.");
+ }
+ }
+ else
+ {
+ /* Just copy the devmode structure */
+ memcpy (ldm->devmode, devmode, DEVMODE_SIZE (devmode));
+ }
+}
+
+static void
+ensure_not_printing (struct device *d)
+{
+ if (!NILP (DEVICE_FRAME_LIST (d)))
+ {
+ Lisp_Object device;
+ XSETDEVICE (device, d);
+ signal_simple_error ("Cannot change settings while print job is active",
+ device);
+ }
+}
+
+static Lisp_Devmode *
+decode_devmode (Lisp_Object dev)
+{
+ if (DEVMODEP (dev))
+ return XDEVMODE (dev);
+ else
+ {
+ struct device* d = decode_device (dev);
+ Lisp_Object device;
+ XSETDEVICE (device, d);
+ CHECK_MSPRINTER_DEVICE (device);
+ ensure_not_printing (d);
+ return XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d));
+ }
+}
+
+/*
+ * DEV can be either a printer or devmode
+ * PRINT_P is non-zero for the Print dialog, zero for the
+ * Page Setup dialog
+ */
+static Lisp_Object
+print_dialog_worker (Lisp_Object dev, int print_p)
+{
+ Lisp_Devmode *ldm = decode_devmode (dev);
+ PRINTDLG pd;
+
+ memset (&pd, 0, sizeof (pd));
+ pd.lStructSize = sizeof (pd);
+ pd.hwndOwner = mswindows_get_selected_frame_hwnd ();
+ pd.hDevMode = devmode_to_hglobal (ldm);
+ pd.Flags = (PD_NOSELECTION | PD_USEDEVMODECOPIESANDCOLLATE
+ | (print_p ? 0 : PD_PRINTSETUP));
+ pd.nMinPage = 0;
+ pd.nMaxPage = 0xFFFF;
+
+ if (!PrintDlg (&pd))
+ {
+ global_free_2_maybe (pd.hDevNames, pd.hDevMode);
+ return Qnil;
+ }
+
+ handle_devmode_changes (ldm, pd.hDevNames, pd.hDevMode);
+
+ /* Finally, build the resulting plist */
+ {
+ Lisp_Object result = Qnil;
+ struct gcpro gcpro1;
+ GCPRO1 (result);
+
+ /* Do consing in reverse order.
+ Number of copies */
+ if (print_p)
+ result = Fcons (Qcopies, Fcons (make_int (pd.nCopies), result));
+
+ /* Page range */
+ if (print_p && (pd.Flags & PD_PAGENUMS))
+ {
+ result = Fcons (Qto_page, Fcons (make_int (pd.nToPage), result));
+ result = Fcons (Qfrom_page, Fcons (make_int (pd.nFromPage), result));
+ }
+
+ /* Device name */
+ result = Fcons (Qname,
+ Fcons (build_ext_string (ldm->printer_name,
+ Qmswindows_tstr),
+ result));
+ UNGCPRO;
+
+ global_free_2_maybe (pd.hDevNames, pd.hDevMode);
+ return result;
+ }
+}
+
+DEFUN ("msprinter-print-setup-dialog", Fmsprinter_print_setup_dialog, 1, 1, 0, /*
+Invoke Windows standard Printer Setup dialog.
+This dialog is usually invoked when the user selects the Printer Setup
+command.
+
+DEVICE must be either an 'msprinter device, or a printer settings
+object. The function brings up the Printer Setup dialog, where the user
+can select a different printer and/or change printer options.
+Connection name can change as a result of selecting a different printer
+device. If a printer is specified, then changes are stored into the
+settings object currently selected into that printer. If a settings
+object is supplied, then changes are recorded into it, and, it it is
+selected into a printer, then changes are propagated to that printer
+too.
+
+Return value is nil if the user has canceled the dialog. Otherwise, it
+is a new plist, with the following properties:
+ name Printer device name, even if unchanged by the user.
+
+The printer device is destroyed and an error is signaled if new printer
+is selected by the user, but cannot be initialized.
+
+See also `msprinter-print-dialog' and `msprinter-page-setup-dialog'.
+*/
+ (device))
+{
+ return print_dialog_worker (device, 0);
+}
+
+DEFUN ("msprinter-print-dialog", Fmsprinter_print_dialog, 1, 1, 0, /*
+Invoke Windows standard Print dialog.
+This dialog is usually invoked when the user selects the Print command.
+After the user presses OK, the program should start actual printout.
+
+DEVICE must be either an 'msprinter device, or a printer settings
+object. The function brings up the Print dialog, where the user can
+select a different printer and/or change printer options. Connection
+name can change as a result of selecting a different printer device. If
+a printer is specified, then changes are stored into the settings object
+currently selected into that printer. If a settings object is supplied,
+then changes are recorded into it, and, it it is selected into a
+printer, then changes are propagated to that printer
+too.
+
+Return value is nil if the user has canceled the dialog. Otherwise, it
+is a new plist, with the following properties:
+ name Printer device name, even if unchanged by the user.
+ from-page First page to print, 1-based. If not specified by the user,
+ then this value is not included in the plist.
+ to-page Last page to print, inclusive, 1-based. If not specified by
+ the user, then this value is not included in the plist.
+ copies Number of copies to print. Always returned.
+
+The DEVICE is destroyed and an error is signaled in case of
+initialization problem with the new printer.
+
+See also `msprinter-setup-print-dialog' and
+`msprinter-page-setup-dialog'.
+*/
+ (device))
+{
+ return print_dialog_worker (device, 1);
+}
+
+
+static int
+plist_get_margin (Lisp_Object plist, Lisp_Object prop)
+{
+ Lisp_Object val = Fplist_get (plist, prop, make_int (1440));
+ if (!INTP (val))
+ signal_simple_error ("Margin value must be an integer", val);
+
+ return MulDiv (XINT (val), 100, 144);
+}
+
+static Lisp_Object
+plist_set_margin (Lisp_Object plist, Lisp_Object prop, int margin, int mm_p)
+{
+ Lisp_Object val = make_int (MulDiv (margin, 144, mm_p ? 2450 : 100));
+ return Fcons (prop, Fcons (val, plist));
+}
+
+DEFUN ("msprinter-page-setup-dialog", Fmsprinter_page_setup_dialog, 1, 2, 0, /*
+Invoke Windows standard Page Setup dialog.
+This dialog is usually invoked in response to Page Setup command, and
+used to chose such parameters as page orientation, print margins etc.
+Note that this dialog contains the "Printer" button, which invokes
+Printer Setup dialog (see `msprinter-print-setup-dialog') so that the
+user can update the printer options or even select a different printer
+as well.
+
+DEVICE must be either an 'msprinter device, or a printer settings
+object. The function brings up the Page Setup dialog, where the user
+can select a different printer and/or change printer options.
+Connection name can change as a result of selecting a different printer
+device. If a printer is specified, then changes are stored into the
+settings object currently selected into that printer. If a settings
+object is supplied, then changes are recorded into it, and, it it is
+selected into a printer, then changes are propagated to that printer
+too.
+
+PLIST is a plist of job properties;
+see `default-msprinter-frame-plist' for the complete list. The plist
+is used to initialize the dialog.
+
+Return value is nil if the user has canceled the dialog. Otherwise,
+it is a new plist, containing the new list of properties.
+
+The DEVICE is destroyed and an error is signaled in case of
+initialization problem with the new printer.
+
+See also `msprinter-print-setup-dialog' and `msprinter-print-dialog'.
+*/
+ (device, plist))
+{
+ Lisp_Devmode *ldm = decode_devmode (device);
+ PAGESETUPDLG pd;
+
+ memset (&pd, 0, sizeof (pd));
+ pd.lStructSize = sizeof (pd);
+ pd.hwndOwner = mswindows_get_selected_frame_hwnd ();
+ pd.Flags = PSD_MARGINS;
+ pd.rtMargin.left = plist_get_margin (plist, Qleft_margin);
+ pd.rtMargin.top = plist_get_margin (plist, Qtop_margin);
+ pd.rtMargin.right = plist_get_margin (plist, Qright_margin);
+ pd.rtMargin.bottom = plist_get_margin (plist, Qbottom_margin);
+ pd.hDevMode = devmode_to_hglobal (ldm);
+
+ if (!PageSetupDlg (&pd))
+ {
+ global_free_2_maybe (pd.hDevNames, pd.hDevMode);
+ return Qnil;
}
+
+ if (pd.hDevMode)
+ handle_devmode_changes (ldm, pd.hDevNames, pd.hDevMode);
+
+ /* Finally, build the resulting plist */
+ {
+ Lisp_Object result = Qnil;
+ int mm_p = pd.Flags & PSD_INHUNDREDTHSOFMILLIMETERS;
+ result = plist_set_margin (result, Qbottom_margin, pd.rtMargin.bottom, mm_p);
+ result = plist_set_margin (result, Qright_margin, pd.rtMargin.right, mm_p);
+ result = plist_set_margin (result, Qtop_margin, pd.rtMargin.top, mm_p);
+ result = plist_set_margin (result, Qleft_margin, pd.rtMargin.left, mm_p);
+ return result;
+ }
+}
+
+DEFUN ("msprinter-get-settings", Fmsprinter_get_settings, 1, 1, 0, /*
+Return the settings object currently used by DEVICE.
+The object returned is not a copy, but rather a pointer to the
+original one. Use `msprinter-settings-copy' to create a copy of it.
+*/
+ (device))
+{
+ struct device *d = decode_device (device);
+ XSETDEVICE (device, d);
+ CHECK_MSPRINTER_DEVICE (device);
+ return DEVICE_MSPRINTER_DEVMODE (d);
+}
+
+DEFUN ("msprinter-select-settings", Fmsprinter_select_settings, 2, 2, 0, /*
+Select SETTINGS object into a DEVICE.
+The settings from the settings object are immediately applied to the
+printer, possibly changing even the target printer itself, and all
+future changes are applied synchronously to the printer device and the
+selected printer object, until a different settings object is selected
+into the same printer.
+
+A settings object can be selected to no more than one printer at a time.
+
+If the supplied settings object is not specialized, it is specialized
+for the printer immediately upon selection. The object can be
+despecialized after it is unselected by calling the function
+`msprinter-settings-despecialize'.
+
+Return value is the previously selected settings object.
+*/
+ (device, settings))
+{
+ Lisp_Devmode *ldm;
+ struct device *d = decode_device (device);
+
+ struct gcpro gcpro1;
+ GCPRO1 (settings);
+
+ XSETDEVICE (device, d);
+ CHECK_MSPRINTER_DEVICE (device);
+ CHECK_DEVMODE (settings);
+ ldm = XDEVMODE (settings);
+
+ if (!NILP (ldm->device))
+ signal_simple_error ("The object is currently selected into a device",
+ settings);
+
+ /* If the object being selected is de-specialized, then its
+ size is perhaps not enough to receive the new devmode. We can ask
+ for printer's devmode size here, because despecialized settings
+ cannot force switching to a different printer, as they supply no
+ printer name at all. */
+ if (ldm->printer_name == NULL)
+ {
+ size_t dm_size =
+ DocumentProperties (NULL, DEVICE_MSPRINTER_HPRINTER(d),
+ DEVICE_MSPRINTER_NAME(d), NULL, NULL, 0);
+ if (dm_size <= 0)
+ signal_simple_error ("Unable to specialize settings, printer error",
+ device);
+
+ assert (XDEVMODE_SIZE (ldm) <= dm_size);
+ ldm->devmode = xrealloc (ldm->devmode, dm_size);
+ }
+
+ /* If we bail out on signal here, no damage is done, except that
+ the stirage for the DEVMODE structure might be reallocated to
+ hold a larger one - not a big deal */
+ if (!sync_printer_with_devmode (d, ldm->devmode, ldm->devmode,
+ ldm->printer_name))
+ error ("Printer device initialization I/O error, device deleted.");
+
+ if (ldm->printer_name == NULL)
+ ldm->printer_name = xstrdup (DEVICE_MSPRINTER_NAME(d));
+
+ {
+ Lisp_Object old_mode = DEVICE_MSPRINTER_DEVMODE (d);
+ ldm->device = device;
+ XDEVMODE (old_mode)->device = Qnil;
+ DEVICE_MSPRINTER_DEVMODE (d) = settings;
+ UNGCPRO;
+ return old_mode;
+ }
+}
+
+DEFUN ("msprinter-apply-settings", Fmsprinter_apply_settings, 2, 2, 0, /*
+Apply settings from a SETTINGS object to a 'msprinter DEVICE.
+The settings from the settings object are immediately applied to the
+printer, possibly changing even the target printer itself. The SETTING
+object is not modified, unlike `msprinter-select-settings', and the
+supplied object is not changed. The changes are immediately recorded
+into the settings object which is currently selected into the printer
+device.
+
+Return value is the currently selected settings object.
+*/
+ (device, settings))
+{
+ Lisp_Devmode *ldm_current, *ldm_new;
+ struct device *d = decode_device (device);
+
+ struct gcpro gcpro1;
+ GCPRO1 (settings);
+
+ XSETDEVICE (device, d);
+ CHECK_MSPRINTER_DEVICE (device);
+ CHECK_DEVMODE (settings);
+ ldm_new = XDEVMODE (settings);
+ ldm_current = XDEVMODE (DEVICE_MSPRINTER_DEVMODE (d));
+
+ /* If the supplied devmode is not specialized, then the current
+ devmode size will always be sufficient, as the printer does
+ not change. If it is specialized, we must reallocate the cuttent
+ devmode storage to match with the supplied one, as it has the right
+ size for the new printer, if it is going to change. The correct
+ way is to use the largest of the two though, to keep the old
+ contents unchanged in case of preliminary exit.
+ */
+ if (ldm_new->printer_name)
+ ldm_current->devmode =
+ (DEVMODE*) xrealloc (ldm_current->devmode,
+ max (XDEVMODE_SIZE (ldm_new),
+ XDEVMODE_SIZE (ldm_current)));
+
+ if (!sync_printer_with_devmode (d, ldm_new->devmode,
+ ldm_current->devmode,
+ ldm_new->printer_name))
+ error ("Printer device initialization I/O error, device deleted.");
+
+ if (ldm_new->printer_name != NULL)
+ {
+ xfree (ldm_current->printer_name);
+ ldm_current->printer_name = xstrdup (ldm_new->printer_name);
+ }
+
+ return DEVICE_MSPRINTER_DEVMODE (d);
+}
+\f
+/************************************************************************/
+/* devmode */
+/************************************************************************/
+
+static void
+print_devmode (Lisp_Object obj, Lisp_Object printcharfun,
+ int escapeflag)
+{
+ char buf[100];
+ Lisp_Devmode *dm = XDEVMODE (obj);
+ if (print_readably)
+ error ("printing unreadable object #<msprinter-settings 0x%x>",
+ dm->header.uid);
+ write_c_string ("#<msprinter-settings", printcharfun);
+ if (dm->printer_name)
+ {
+ write_c_string (" for \"", printcharfun);
+ write_c_string (dm->printer_name, printcharfun);
+ write_c_string ("\"", printcharfun);
+ }
+ if (!NILP (dm->device))
+ {
+ write_c_string (" (currently on ", printcharfun);
+ print_internal (dm->device, printcharfun, 0);
+ write_c_string (")", printcharfun);
+ }
+ sprintf (buf, " 0x%x>", dm->header.uid);
+ write_c_string (buf, printcharfun);
+}
+
+static void
+finalize_devmode (void *header, int for_disksave)
+{
+ Lisp_Devmode *dm = (Lisp_Devmode *) header;
+
+ if (for_disksave)
+ {
+ Lisp_Object devmode;
+ XSETDEVMODE (devmode, dm);
+ signal_simple_error (
+ "Cannot dump XEmacs containing an msprinter-settings object",
+ devmode);
+ }
+
+ assert (NILP (dm->device));
+
+ if (dm->printer_name)
+ xfree (dm->printer_name);
+}
+
+static int
+equal_devmode (Lisp_Object obj1, Lisp_Object obj2, int depth)
+{
+ Lisp_Devmode *dm1 = XDEVMODE (obj1);
+ Lisp_Devmode *dm2 = XDEVMODE (obj2);
+
+ if ((dm1->devmode != NULL) != (dm1->devmode != NULL))
+ return 0;
+ if (dm1->devmode == NULL)
+ return 1;
+ if (memcmp (dm1->devmode, dm2->devmode, XDEVMODE_SIZE (dm1)) != 0)
+ return 0;
+ if (dm1->printer_name == NULL || dm2->printer_name == NULL)
+ return 1;
+ return stricmp (dm1->printer_name, dm2->printer_name) == 0;
+}
+
+static unsigned long
+hash_devmode (Lisp_Object obj, int depth)
+{
+ Lisp_Devmode *dm = XDEVMODE (obj);
+
+ return HASH3 (XDEVMODE_SIZE (dm),
+ dm->devmode ? memory_hash (dm->devmode, XDEVMODE_SIZE (dm))
+ : 0,
+ dm->printer_name ? string_hash (dm->printer_name) : 0);
+}
+
+DEFINE_LRECORD_IMPLEMENTATION ("msprinter-settings", devmode,
+ 0/*mark*/, print_devmode, finalize_devmode,
+ equal_devmode, hash_devmode, 0/*description*/,
+ Lisp_Devmode);
+static Lisp_Object
+allocate_devmode (DEVMODE* src_devmode, int do_copy,
+ char* src_name, struct device *d)
+{
+ Lisp_Devmode *dm;
+ Lisp_Object ob;
+
+ dm = alloc_lcrecord_type (Lisp_Devmode, &lrecord_devmode);
+
+ if (d)
+ XSETDEVICE (dm->device, d);
+ else
+ dm->device = Qnil;
+
+ dm->printer_name = src_name ? xstrdup (src_name) : NULL;
+
+ if (src_devmode != NULL && do_copy)
+ {
+ dm->devmode = (DEVMODE*) xmalloc (DEVMODE_SIZE (src_devmode));
+ memcpy (dm->devmode, src_devmode, DEVMODE_SIZE (src_devmode));
+ }
+ else
+ {
+ dm->devmode = src_devmode;
+ }
+
+ XSETDEVMODE (ob, dm);
+ return ob;
+}
+
+DEFUN ("msprinter-settings-copy", Fmsprinter_settings_copy, 1, 1, 0, /*
+Create and returns an exact copy of a printer settings object.
+*/
+ (settings))
+{
+ Lisp_Devmode *dm;
+
+ CHECK_DEVMODE (settings);
+ dm = XDEVMODE (settings);
+
+ return allocate_devmode (dm->devmode, 1, dm->printer_name, NULL);
+}
+
+DEFUN ("msprinter-settings-despecialize", Fmsprinter_settings_despecialize, 1, 1, 0, /*
+Erase printer-specific settings from a printer settings object.
+*/
+ (settings))
+{
+ Lisp_Devmode *ldm;
+ DEVMODE *dm;
+
+ CHECK_DEVMODE (settings);
+ ldm = XDEVMODE (settings);
+
+ if (!NILP (ldm->device))
+ signal_simple_error ("The object is currently selected into a device",
+ settings);
+
+ dm = ldm->devmode;
+
+ /* #### TODO. Either remove references to device specific bins,
+ paper sizes etc, or signal an error of they are present. */
+
+ dm->dmDriverExtra = 0;
+ dm->dmDeviceName[0] = '\0';
+
+ if (ldm->printer_name)
+ xfree (ldm->printer_name);
+
+ return Qnil;
}
\f
void
syms_of_device_mswindows (void)
{
+ INIT_LRECORD_IMPLEMENTATION (devmode);
+
+ DEFSUBR (Fmsprinter_print_setup_dialog);
+ DEFSUBR (Fmsprinter_print_dialog);
+ DEFSUBR (Fmsprinter_page_setup_dialog);
+ DEFSUBR (Fmsprinter_get_settings);
+ DEFSUBR (Fmsprinter_select_settings);
+ DEFSUBR (Fmsprinter_apply_settings);
+ DEFSUBR (Fmsprinter_settings_copy);
+ DEFSUBR (Fmsprinter_settings_despecialize);
+
defsymbol (&Qinit_pre_mswindows_win, "init-pre-mswindows-win");
defsymbol (&Qinit_post_mswindows_win, "init-post-mswindows-win");
}
The sixth arg NOERROR, if non-nil, means do not signal an error if a
bogus resource specification was retrieved (e.g. if a non-integer was
given when an integer was requested). In this case, a warning is issued
- instead.
+ instead, unless NOERROR is t, in which case no warning is issued.
The resource names passed to this function are looked up relative to the
locale.
/* reset the flag to 0 unless another notification occurred while
we were processing this one. Block SIGWINCH during this
check to prevent a possible race condition. */
-#ifndef WINDOWSNT
+#ifdef SIGWINCH
EMACS_BLOCK_SIGNAL (SIGWINCH);
#endif
if (old_asynch_device_change_pending == asynch_device_change_pending)
asynch_device_change_pending = 0;
-#ifndef WINDOWSNT
+#ifdef SIGWINCH
EMACS_UNBLOCK_SIGNAL (SIGWINCH);
#endif
}
EXFUN (Fdevice_console, 1);
EXFUN (Fdevice_name, 1);
+EXFUN (Ffind_device, 2);
EXFUN (Fmake_device, 3);
EXFUN (Fselected_device, 1);
* 19 Feb 98 - Version 1.2 by Jareth Hein (Support for user specified I/O) *
******************************************************************************/
-#ifdef __MSDOS__
-#include <io.h>
-#include <alloc.h>
-#include <stdlib.h>
-#include <sys\stat.h>
-#else
-#include <sys/types.h>
-#include <sys/stat.h>
-#endif /* __MSDOS__ */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <config.h>
+#include "lisp.h"
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
+#include "sysfile.h"
#include "gifrlib.h"
FILE *f;
if ((f = fopen(FileName,
-#ifdef __MSDOS__
+#ifdef WIN32_NATIVE
"rb"
#else
"r"
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
)) == NULL)
GifInternError(GifFile, D_GIF_ERR_OPEN_FAILED);
{
FILE *f;
-#ifdef __MSDOS__
+#ifdef WIN32_NATIVE
setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */
f = fdopen(FileHandle, "rb"); /* Make it into a stream: */
setvbuf(f, NULL, _IOFBF, GIF_FILE_BUFFER_SIZE);/* And inc. stream buffer.*/
#else
f = fdopen(FileHandle, "r"); /* Make it into a stream: */
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
GifStdIOInit(GifFile, f, -1);
DGifInitRead(GifFile);
if (!LineLen) LineLen = GifFile->Image.Width;
-#if defined(__MSDOS__) || defined(__GNUC__)
+#if defined(WIN32_NATIVE) || defined(__GNUC__)
if ((Private->PixelCount -= LineLen) > 0xffff0000UL)
#else
if ((Private->PixelCount -= LineLen) > 0xffff0000)
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
{
GifInternError(GifFile, D_GIF_ERR_DATA_TOO_BIG);
}
GifInternError(GifFile, D_GIF_ERR_NOT_READABLE);
}
-#if defined(__MSDOS__) || defined(__GNUC__)
+#if defined(WIN32_NATIVE) || defined(__GNUC__)
if (--Private->PixelCount > 0xffff0000UL)
#else
if (--Private->PixelCount > 0xffff0000)
-#endif /* __MSDOS__ */
+#endif /* WIN32_NATIVE */
{
GifInternError(GifFile, D_GIF_ERR_DATA_TOO_BIG);
}
memcpy (trans, XSTRING_DATA (ctext), XSTRING_LENGTH (ctext) + 1);
translen =
- msw_translate_menu_or_dialog_item (trans,
+ mswindows_translate_menu_or_dialog_item (trans,
XSTRING_LENGTH (ctext),
2 * XSTRING_LENGTH (ctext) + 3,
&accel_unused,
#include "buffer.h"
#include "regex.h"
-#include "sysfile.h"
#include "sysdir.h"
#include "sysproc.h"
+#include "sysfile.h"
-#include <limits.h>
#include <time.h>
#include <winsock.h> /* To make nt.h happy */
CHECK_STRING (file);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Filename completion on Windows ignores case, since Windows
filesystems do. */
specbind (Qcompletion_ignore_case, Qt);
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#ifdef FILE_SYSTEM_CASE
file = FILE_SYSTEM_CASE (file);
\f
/* The *pwent() functions do not exist on NT */
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
static Lisp_Object user_name_completion (Lisp_Object user,
int all_flag,
return Qt;
return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
}
-#endif /* ! defined WINDOWSNT */
+#endif /* ! defined WIN32_NATIVE */
\f
Lisp_Object
directory = Ffile_name_directory (filename);
#endif
-#ifdef MSDOS
+#if 0 /* #### shouldn't this apply to WIN32_NATIVE and maybe CYGWIN? */
{
char *tmpnam = (char *) XSTRING_DATA (Ffile_name_nondirectory (filename));
int l = strlen (tmpnam);
s.st_mode |= S_IEXEC;
}
}
-#endif /* MSDOS */
+#endif
switch (s.st_mode & S_IFMT)
{
DEFSUBR (Fdirectory_files);
DEFSUBR (Ffile_name_completion);
DEFSUBR (Ffile_name_all_completions);
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
DEFSUBR (Fuser_name_completion);
DEFSUBR (Fuser_name_completion_1);
DEFSUBR (Fuser_name_all_completions);
#include <config.h>
#include "lisp.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
#include "buffer.h"
#include "commands.h"
\f
DEFUN ("temp-directory", Ftemp_directory, 0, 0, 0, /*
Return the pathname to the directory to use for temporary files.
-On NT/MSDOS, this is obtained from the TEMP or TMP environment variables,
+On MS Windows, this is obtained from the TEMP or TMP environment variables,
defaulting to / if they are both undefined.
On Unix it is obtained from TMPDIR, with /tmp as the default
*/
())
{
char *tmpdir;
-#if defined(WINDOWSNT) || defined(MSDOS)
+#if defined(WIN32_NATIVE)
tmpdir = getenv ("TEMP");
if (!tmpdir)
tmpdir = getenv ("TMP");
if (!tmpdir)
tmpdir = "/";
-#else /* WINDOWSNT || MSDOS */
+#else /* WIN32_NATIVE */
tmpdir = getenv ("TMPDIR");
if (!tmpdir)
tmpdir = "/tmp";
char *user_name = getenv ("LOGNAME");
if (!user_name)
user_name = getenv (
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
"USERNAME" /* it's USERNAME on NT */
#else
"USER"
else
{
struct passwd *pw = getpwuid (geteuid ());
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
/* Since the Cygwin environment may not have an /etc/passwd,
return "unknown" instead of the null if the username
cannot be determined.
struct passwd *pw = getpwuid (getuid ());
/* #### - I believe this should return nil instead of "unknown" when pw==0 */
-#ifdef MSDOS
- /* We let the real user name default to "root" because that's quite
- accurate on MSDOG and because it lets Emacs find the init file.
- (The DVX libraries override the Djgpp libraries here.) */
- Lisp_Object tem = build_string (pw ? pw->pw_name : "root");/* no gettext */
-#else
Lisp_Object tem = build_string (pw ? pw->pw_name : "unknown");/* no gettext */
-#endif
return tem;
}
{
if ((cached_home_directory = (Extbyte *) getenv("HOME")) == NULL)
{
-#if defined(WINDOWSNT) && !defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE)
char *homedrive, *homepath;
if ((homedrive = getenv("HOMEDRIVE")) != NULL &&
output_home_warning = 1;
# endif
}
-#else /* !WINDOWSNT */
+#else /* !WIN32_NATIVE */
/*
* Unix, typically.
* Using "/" isn't quite right, but what should we do?
*/
cached_home_directory = (Extbyte *) "/";
output_home_warning = 1;
-#endif /* !WINDOWSNT */
+#endif /* !WIN32_NATIVE */
}
if (initialized && output_home_warning)
{
Lisp_Object Qhash_tablep;
static Lisp_Object Qhashtable, Qhash_table;
-static Lisp_Object Qweakness, Qvalue;
+static Lisp_Object Qweakness, Qvalue, Qkey_value;
static Lisp_Object Vall_weak_hash_tables;
static Lisp_Object Qrehash_size, Qrehash_threshold;
static Lisp_Object Q_size, Q_test, Q_weakness, Q_rehash_size, Q_rehash_threshold;
/* obsolete as of 19990901 in xemacs-21.2 */
-static Lisp_Object Qweak, Qkey_weak, Qvalue_weak, Qnon_weak, Q_type;
+static Lisp_Object Qweak, Qkey_weak, Qvalue_weak, Qkey_value_weak;
+static Lisp_Object Qnon_weak, Q_type;
typedef struct hentry
{
(ht->weakness == HASH_TABLE_WEAK ? "t" :
ht->weakness == HASH_TABLE_KEY_WEAK ? "key" :
ht->weakness == HASH_TABLE_VALUE_WEAK ? "value" :
+ ht->weakness == HASH_TABLE_KEY_VALUE_WEAK ? "key-value" :
"you-d-better-not-see-this"));
write_c_string (buf, printcharfun);
}
if (EQ (value, Qnil)) return 1;
if (EQ (value, Qt)) return 1;
if (EQ (value, Qkey)) return 1;
+ if (EQ (value, Qkey_value)) return 1;
if (EQ (value, Qvalue)) return 1;
/* Following values are obsolete as of 19990901 in xemacs-21.2 */
if (EQ (value, Qnon_weak)) return 1;
if (EQ (value, Qweak)) return 1;
if (EQ (value, Qkey_weak)) return 1;
+ if (EQ (value, Qkey_value_weak)) return 1;
if (EQ (value, Qvalue_weak)) return 1;
maybe_signal_simple_error ("Invalid hash table weakness",
if (EQ (obj, Qnil)) return HASH_TABLE_NON_WEAK;
if (EQ (obj, Qt)) return HASH_TABLE_WEAK;
if (EQ (obj, Qkey)) return HASH_TABLE_KEY_WEAK;
+ if (EQ (obj, Qkey_value)) return HASH_TABLE_KEY_VALUE_WEAK;
if (EQ (obj, Qvalue)) return HASH_TABLE_VALUE_WEAK;
/* Following values are obsolete as of 19990901 in xemacs-21.2 */
if (EQ (obj, Qnon_weak)) return HASH_TABLE_NON_WEAK;
if (EQ (obj, Qweak)) return HASH_TABLE_WEAK;
if (EQ (obj, Qkey_weak)) return HASH_TABLE_KEY_WEAK;
+ if (EQ (obj, Qkey_value_weak)) return HASH_TABLE_KEY_VALUE_WEAK;
if (EQ (obj, Qvalue_weak)) return HASH_TABLE_VALUE_WEAK;
signal_simple_error ("Invalid hash table weakness", obj);
Keyword :rehash-threshold must be a float between 0.0 and 1.0,
and specifies the load factor of the hash table which triggers enlarging.
-Non-standard keyword :weakness can be `nil' (default), `t', `key' or `value'.
+Non-standard keyword :weakness can be `nil' (default), `t', `key', `value'
+or `key-value'.
A weak hash table is one whose pointers do not count as GC referents:
for any key-value pair in the hash table, if the only remaining pointer
unmarked outside of weak hash tables. The pair will remain in the
hash table if the value is pointed to by something other than a weak
hash table, even if the key is not.
+
+A key-value-weak hash table is similar to a fully-weak hash table except
+that a key-value pair will be removed only if the value and the key remain
+unmarked outside of weak hash tables. The pair will remain in the
+hash table if the value or key are pointed to by something other than a weak
+hash table, even if the other is not.
*/
(int nargs, Lisp_Object *args))
{
{
case HASH_TABLE_WEAK: return Qt;
case HASH_TABLE_KEY_WEAK: return Qkey;
+ case HASH_TABLE_KEY_VALUE_WEAK: return Qkey_value;
case HASH_TABLE_VALUE_WEAK: return Qvalue;
default: return Qnil;
}
{
case HASH_TABLE_WEAK: return Qweak;
case HASH_TABLE_KEY_WEAK: return Qkey_weak;
+ case HASH_TABLE_KEY_VALUE_WEAK: return Qkey_value_weak;
case HASH_TABLE_VALUE_WEAK: return Qvalue_weak;
default: return Qnon_weak;
}
MARK_OBJ (e->key);
break;
+ case HASH_TABLE_KEY_VALUE_WEAK:
+ for (; e < sentinel; e++)
+ if (!HENTRY_CLEAR_P (e))
+ {
+ if (marked_p (e->value))
+ MARK_OBJ (e->key);
+ else if (marked_p (e->key))
+ MARK_OBJ (e->value);
+ }
+ break;
+
case HASH_TABLE_KEY_CAR_WEAK:
for (; e < sentinel; e++)
if (!HENTRY_CLEAR_P (e))
defsymbol (&Qhashtable, "hashtable");
defsymbol (&Qweakness, "weakness");
defsymbol (&Qvalue, "value");
+ defsymbol (&Qkey_value, "key-value");
defsymbol (&Qrehash_size, "rehash-size");
defsymbol (&Qrehash_threshold, "rehash-threshold");
defsymbol (&Qweak, "weak"); /* obsolete */
defsymbol (&Qkey_weak, "key-weak"); /* obsolete */
+ defsymbol (&Qkey_value_weak, "key-value-weak"); /* obsolete */
defsymbol (&Qvalue_weak, "value-weak"); /* obsolete */
defsymbol (&Qnon_weak, "non-weak"); /* obsolete */
HASH_TABLE_NON_WEAK,
HASH_TABLE_KEY_WEAK,
HASH_TABLE_VALUE_WEAK,
+ HASH_TABLE_KEY_VALUE_WEAK,
HASH_TABLE_KEY_CAR_WEAK,
HASH_TABLE_VALUE_CAR_WEAK,
HASH_TABLE_WEAK
buffer-local values are not affected.
INITVALUE and DOCSTRING are optional.
If DOCSTRING starts with *, this variable is identified as a user option.
- This means that M-x set-variable and M-x edit-options recognize it.
+ This means that M-x set-variable recognizes it.
If INITVALUE is missing, SYMBOL's value is not set.
In lisp-interaction-mode defvar is treated as defconst.
buffer-local values are not affected.
DOCSTRING is optional.
If DOCSTRING starts with *, this variable is identified as a user option.
- This means that M-x set-variable and M-x edit-options recognize it.
+ This means that M-x set-variable recognizes it.
Note: do not use `defconst' for user options in libraries that are not
normally loaded, since it is useful for users to be able to specify
if (SUBRP (function))
{
- return function_min_args_p ?
- Fsubr_min_args (function):
- Fsubr_max_args (function);
+ /* Using return with the ?: operator tickles a DEC CC compiler bug. */
+ if (function_min_args_p)
+ return Fsubr_min_args (function);
+ else
+ return Fsubr_max_args (function);
}
else if (COMPILED_FUNCTIONP (function))
{
XSetErrorHandler (x_error_handler);
XSetIOErrorHandler (x_IO_error_handler);
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
XtAppAddInput (Xt_app_con, signal_event_pipe[0],
(XtPointer) (XtInputReadMask /* | XtInputExceptMask */),
Xt_what_callback, 0);
#ifdef HAVE_MSG_SELECT
#include "sysfile.h"
#include "console-tty.h"
-#elif defined(__CYGWIN32__)
+#elif defined(CYGWIN)
typedef unsigned int SOCKET;
#endif
#include <io.h>
#include <errno.h>
-#if !(defined(__CYGWIN32__) || defined(__MINGW32__))
+#if !(defined(CYGWIN) || defined(MINGW))
# include <shlobj.h> /* For IShellLink */
#endif
#define NTPIPE_SHOVE_STREAM_DATA(stream) \
LSTREAM_TYPE_DATA (stream, ntpipe_shove)
-#define MAX_SHOVE_BUFFER_SIZE 128
+#define MAX_SHOVE_BUFFER_SIZE 512
struct ntpipe_shove_stream
{
InterlockedIncrement (&s->idle_p);
WaitForSingleObject (s->hev_thread, INFINITE);
- if (s->die_p)
- break;
-
- /* Write passed buffer */
- if (!WriteFile (s->hpipe, s->buffer, s->size, &bytes_written, NULL)
- || bytes_written != s->size)
+ /* Write passed buffer if any */
+ if (s->size > 0)
{
- s->error_p = TRUE;
- InterlockedIncrement (&s->die_p);
+ if (!WriteFile (s->hpipe, s->buffer, s->size, &bytes_written, NULL)
+ || bytes_written != s->size)
+ {
+ s->error_p = TRUE;
+ InterlockedIncrement (&s->die_p);
+ }
+ /* Set size to zero so we won't write it again if the closer sets
+ die_p and kicks us */
+ s->size = 0;
}
if (s->die_p)
return Qnil;
}
+ /* Set the priority of the thread higher so we don't end up waiting
+ on it to send things. */
+ if (!SetThreadPriority (s->hthread, THREAD_PRIORITY_HIGHEST))
+ {
+ CloseHandle (s->hthread);
+ Lstream_delete (lstr);
+ return Qnil;
+ }
+
/* hev_thread is an auto-reset event, initially nonsignaled */
s->hev_thread = CreateEvent (NULL, FALSE, FALSE, NULL);
/* Start output */
InterlockedDecrement (&s->idle_p);
SetEvent (s->hev_thread);
+ /* Give it a chance to run -- this dramatically improves performance
+ of things like crypt. */
+ (void) SwitchToThread ();
return size;
}
/* Force thread stop */
InterlockedIncrement (&s->die_p);
- /* Close pipe handle, possibly breaking it */
- CloseHandle (s->hpipe);
-
- /* Thread will end upon unblocking */
+ /* Thread will end upon unblocking. If it's already unblocked this will
+ do nothing, but the thread won't look at die_p until it's written any
+ pending output. */
SetEvent (s->hev_thread);
/* Wait while thread terminates */
WaitForSingleObject (s->hthread, INFINITE);
+
+ /* Close pipe handle, possibly breaking it */
+ CloseHandle (s->hpipe);
+
+ /* Close the thread handle */
CloseHandle (s->hthread);
/* Destroy the event */
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
- /* We have to translate messages that are not sent to the main
- window. This is so that key presses work ok in things like
- edit fields. However, we *musn't* translate message for the
- main window as this is handled in the wnd proc.
+ /* We have to translate messages that are not sent to an XEmacs
+ frame. This is so that key presses work ok in things like
+ edit fields. However, we *musn't* translate message for XEmacs
+ frames as this is handled in the wnd proc.
We also have to avoid generating paint magic events for windows
that aren't XEmacs frames */
- if (GetWindowLong (msg.hwnd, GWL_STYLE) & (WS_CHILD|WS_POPUP))
+ /* GetClassName will truncate a longer class name. By adding one
+ extra character, we are forcing textual comparison to fail
+ if the name is longer than XEMACS_CLASS */
+ char class_name_buf [sizeof (XEMACS_CLASS) + 2] = "";
+ GetClassName (msg.hwnd, class_name_buf, sizeof (class_name_buf) - 1);
+ if (stricmp (class_name_buf, XEMACS_CLASS) != 0)
{
+ /* Not an XEmacs frame */
TranslateMessage (&msg);
}
else if (msg.message == WM_PAINT)
assert (msg.wParam == 0);
/* Queue a magic event for handling when safe */
- msframe = FRAME_MSWINDOWS_DATA (
- XFRAME (mswindows_find_frame (msg.hwnd)));
+ msframe =
+ FRAME_MSWINDOWS_DATA (XFRAME (mswindows_find_frame (msg.hwnd)));
if (!msframe->paint_pending)
{
msframe->paint_pending = 1;
if (*end)
return DDE_FNOTPROCESSED;
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
filename = alloca (cygwin32_win32_to_posix_path_list_buf_size (cmd) + 5);
strcpy (filename, "file:");
cygwin32_win32_to_posix_path_list (cmd, filename+5);
This means that we need to distinguish between an
auto-repeated key and a key pressed and released a bunch
of times. */
- else if (downp && !keyp ||
+ else if ((downp && !keyp) ||
(downp && keyp && last_downkey &&
(wParam != last_downkey ||
/* the "previous key state" bit indicates autorepeat */
} \
} while (0)
- if (wParam == VK_CONTROL && (lParam & 0x1000000)
+ if ((wParam == VK_CONTROL && (lParam & 0x1000000))
|| wParam == VK_RCONTROL)
FROB (XEMSW_RCONTROL);
- if (wParam == VK_CONTROL && !(lParam & 0x1000000)
+ if ((wParam == VK_CONTROL && !(lParam & 0x1000000))
|| wParam == VK_LCONTROL)
FROB (XEMSW_LCONTROL);
- if (wParam == VK_SHIFT && (lParam & 0x1000000)
+ if ((wParam == VK_SHIFT && (lParam & 0x1000000))
|| wParam == VK_RSHIFT)
FROB (XEMSW_RSHIFT);
- if (wParam == VK_SHIFT && !(lParam & 0x1000000)
+ if ((wParam == VK_SHIFT && !(lParam & 0x1000000))
|| wParam == VK_LSHIFT)
FROB (XEMSW_LSHIFT);
- if (wParam == VK_MENU && (lParam & 0x1000000)
+ if ((wParam == VK_MENU && (lParam & 0x1000000))
|| wParam == VK_RMENU)
FROB (XEMSW_RMENU);
- if (wParam == VK_MENU && !(lParam & 0x1000000)
+ if ((wParam == VK_MENU && !(lParam & 0x1000000))
|| wParam == VK_LMENU)
FROB (XEMSW_LMENU);
}
#ifdef DEBUG_XEMACS
+#if 0
+
static void
output_modifier_keyboard_state (void)
{
keymap[VK_RSHIFT] & 0x1 ? 1 : 0);
}
+#endif
+
/* try to debug the stuck-alt-key problem.
#### this happens only inconsistently, and may only happen when using
* The windows procedure for the window class XEMACS_CLASS
*/
LRESULT WINAPI
-mswindows_wnd_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+mswindows_wnd_proc (HWND hwnd, UINT message_, WPARAM wParam, LPARAM lParam)
{
/* Note: Remember to initialize emacs_event and event before use.
This code calls code that can GC. You must GCPRO before calling such code. */
struct mswindows_frame* msframe;
assert (!GetWindowLong (hwnd, GWL_USERDATA));
- switch (message)
+ switch (message_)
{
case WM_DESTROYCLIPBOARD:
/* We own the clipboard and someone else wants it. Delete our
cached copy of the clipboard contents so we'll ask for it from
- Windows again when someone does a paste. */
- handle_selection_clear(QCLIPBOARD);
+ Windows again when someone does a paste, and destroy any memory
+ objects we hold on the clipboard that are not in the list of types
+ that Windows will delete itself. */
+ mswindows_destroy_selection (QCLIPBOARD);
+ handle_selection_clear (QCLIPBOARD);
break;
case WM_ERASEBKGND:
if (mswindows_debug_events)
{
stderr_out ("%s wparam=%d lparam=%d\n",
- message == WM_KEYUP ? "WM_KEYUP" : "WM_SYSKEYUP",
+ message_ == WM_KEYUP ? "WM_KEYUP" : "WM_SYSKEYUP",
wParam, (int)lParam);
output_alt_keyboard_state ();
}
}
if (should_set_keymap)
- // && (message != WM_SYSKEYUP
+ // && (message_ != WM_SYSKEYUP
// || NILP (Vmenu_accelerator_enabled)))
SetKeyboardState (keymap);
if (mswindows_debug_events)
{
stderr_out ("%s wparam=%d lparam=%d\n",
- message == WM_KEYDOWN ? "WM_KEYDOWN" : "WM_SYSKEYDOWN",
+ message_ == WM_KEYDOWN ? "WM_KEYDOWN" : "WM_SYSKEYDOWN",
wParam, (int)lParam);
output_alt_keyboard_state ();
}
GetKeyboardState (keymap_sticky);
if (keymap_sticky[VK_MENU] & 0x80)
{
- message = WM_SYSKEYDOWN;
+ message_ = WM_SYSKEYDOWN;
/* We have to set the "context bit" so that the
TranslateMessage() call below that generates the
SYSCHAR message does its thing; see the documentation
int got_accelerator = 0;
msg.hwnd = hwnd;
- msg.message = message;
+ msg.message = message_;
msg.wParam = wParam;
msg.lParam = lParam;
msg.time = GetMessageTime();
}
if (!NILP (Vmenu_accelerator_enabled) &&
- !(mods & XEMACS_MOD_SHIFT) && message == WM_SYSKEYDOWN)
+ !(mods & XEMACS_MOD_SHIFT) && message_ == WM_SYSKEYDOWN)
potential_accelerator = 1;
/* Remove shift modifier from an ascii character */
++mswindows_quit_chars_count;
}
else if (potential_accelerator && !got_accelerator &&
- msw_char_is_accelerator (frame, ch))
+ mswindows_char_is_accelerator (frame, ch))
{
got_accelerator = 1;
break;
/* Real middle mouse button has nothing to do with emulated one:
if one wants to exercise fingers playing chords on the mouse,
he is allowed to do that! */
- mswindows_enqueue_mouse_button_event (hwnd, message,
+ mswindows_enqueue_mouse_button_event (hwnd, message_,
MAKEPOINTS (lParam), GetMessageTime());
break;
case WM_DISPLAYCHANGE:
{
struct device *d;
+ DWORD message_tick = GetMessageTime ();
fobj = mswindows_find_frame (hwnd);
frame = XFRAME (fobj);
d = XDEVICE (FRAME_DEVICE (frame));
- DEVICE_MSWINDOWS_HORZRES(d) = LOWORD (lParam);
- DEVICE_MSWINDOWS_VERTRES(d) = HIWORD (lParam);
- DEVICE_MSWINDOWS_BITSPIXEL(d) = wParam;
- break;
+ /* Do this only once per message. XEmacs can receive this message
+ through as many frames as it currently has open. Message time
+ will be the same for all these messages. Despite extreme
+ efficiency, the code below has about one in 4 billion
+ probability that the HDC is not recreated, provided that
+ XEmacs is running sufficiently longer than 52 days. */
+ if (DEVICE_MSWINDOWS_UPDATE_TICK(d) != message_tick)
+ {
+ DEVICE_MSWINDOWS_UPDATE_TICK(d) = message_tick;
+ DeleteDC (DEVICE_MSWINDOWS_HCDC(d));
+ DEVICE_MSWINDOWS_HCDC(d) = CreateCompatibleDC (NULL);
+ }
}
+ break;
/* Misc magic events which only require that the frame be identified */
case WM_SETFOCUS:
case WM_KILLFOCUS:
- mswindows_enqueue_magic_event (hwnd, message);
+ mswindows_enqueue_magic_event (hwnd, message_);
break;
case WM_WINDOWPOSCHANGING:
break;
#endif
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc (hwnd, message_, wParam, lParam);
/* Bite me - a spurious command. This used to not be able to
happen but with the introduction of widgets its now
possible. */
DragQueryFile ((HANDLE) wParam, i, fname, len+1);
/* May be a shell link aka "shortcut" - replace fname if so */
-#if !(defined(__CYGWIN32__) || defined(__MINGW32__))
+#if !(defined(CYGWIN) || defined(MINGW))
/* cygwin doesn't define this COM stuff */
if (!stricmp (fname + strlen (fname) - 4, ".LNK"))
{
}
#endif
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
filename = xmalloc (cygwin32_win32_to_posix_path_list_buf_size (fname) + 5);
strcpy (filename, "file:");
cygwin32_win32_to_posix_path_list (fname, filename+5);
defproc:
default:
- return DefWindowProc (hwnd, message, wParam, lParam);
+ return DefWindowProc (hwnd, message_, wParam, lParam);
}
return (0);
}
soon as a command other than self-insert-command is executed.
Programmers can also use the `self-insert-defer-undo'
- property to install that behaviour on functions other
+ property to install that behavior on functions other
than `self-insert-command', or to change the magic
number 20 to something else. #### DOCUMENT THIS! */
k = QKbackspace;
m &= ~XEMACS_MOD_CONTROL;
}
-#endif /* defined(HAVE_TTY) && !defined(__CYGWIN32__) */
+#endif /* defined(HAVE_TTY) && !defined(CYGWIN) */
break;
}
if (c >= 'A' && c <= 'Z') c -= 'A'-'a';
else if (do_backspace_mapping &&
CHARP (con->tty_erase_char) && c == XCHAR (con->tty_erase_char))
k = QKbackspace;
-#endif /* defined(HAVE_TTY) && !defined(__CYGWIN32__) */
+#endif /* defined(HAVE_TTY) && !defined(CYGWIN) */
else if (c == 127)
k = QKdelete;
else if (c == ' ')
#include <config.h>
#include "lisp.h"
-#include <limits.h>
#include "buffer.h"
#include "events.h"
#endif /* HPUX_PRE_8_0 */
#endif /* HPUX */
-#ifdef WINDOWSNT
-#define NOMINMAX 1
-#include <direct.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#endif /* not WINDOWSNT */
-
-#ifdef WINDOWSNT
-#define CORRECT_DIR_SEPS(s) \
- do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
- else unixtodos_filename (s); \
- } while (0)
+#ifdef WIN32_NATIVE
#define IS_DRIVE(x) isalpha (x)
/* Need to lower-case the drive letter, or else expanded
filenames will sometimes compare inequal, because
`expand-file-name' doesn't always down-case the drive letter. */
#define DRIVE_LETTER(x) tolower (x)
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
int lisp_to_time (Lisp_Object, time_t *);
Lisp_Object time_to_lisp (time_t);
p = beg + XSTRING_LENGTH (file);
while (p != beg && !IS_ANY_SEP (p[-1])
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* only recognize drive specifier at beginning */
&& !(p[-1] == ':' && p == beg + 2)
#endif
if (p == beg)
return Qnil;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Expansion of "c:" to drive and default directory. */
/* (NT does the right thing.) */
if (p == beg + 2 && beg[1] == ':')
{
/* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */
Bufbyte *res = (Bufbyte*) alloca (MAXPATHLEN + 1);
- if (getdefdir (toupper (*beg) - 'A' + 1, (char *)res))
+ if (_getdcwd (toupper (*beg) - 'A' + 1, (char *)res, MAXPATHLEN))
{
char *c=((char *) res) + strlen ((char *) res);
if (!IS_DIRECTORY_SEP (*c))
p = beg + strlen ((char *) beg);
}
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
return make_string (beg, p - beg);
}
end = p = beg + XSTRING_LENGTH (file);
while (p != beg && !IS_ANY_SEP (p[-1])
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* only recognize drive specifier at beginning */
&& !(p[-1] == ':' && p == beg + 2)
#endif
strcpy (dst, src);
if (slen > 1
&& IS_DIRECTORY_SEP (dst[slen - 1])
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
&& !IS_ANY_SEP (dst[slen - 2])
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
)
dst[slen - 1] = 0;
return 1;
Bufbyte *newdir, *p, *o;
int tlen;
Bufbyte *target;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
int drive = 0;
int collapse_newdir = 1;
#else
struct passwd *pw;
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
int length;
Lisp_Object handler;
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
char *user;
#endif
/* Save time in some common cases - as long as default_directory
is not relative, it can be canonicalized with name below (if it
is needed at all) without requiring it to be expanded now. */
-#ifdef WINDOWSNT
- /* Detect MSDOS file names with drive specifiers. */
+#ifdef WIN32_NATIVE
+ /* Detect Windows file names with drive specifiers. */
&& ! (IS_DRIVE (o[0]) && (IS_DEVICE_SEP (o[1]) && IS_DIRECTORY_SEP (o[2])))
/* Detect Windows file names in UNC format. */
&& ! (IS_DIRECTORY_SEP (o[0]) && IS_DIRECTORY_SEP (o[1]))
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
/* Detect Unix absolute file names (/... alone is not absolute on
- DOS or Windows). */
+ Windows). */
&& ! (IS_DIRECTORY_SEP (o[0]))
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
)
{
struct gcpro gcpro1;
into name should be safe during all of this, though. */
nm = XSTRING_DATA (name);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* We will force directory separators to be either all \ or /, so make
a local copy to modify, even if there ends up being no change. */
nm = strcpy ((char *)alloca (strlen ((char *)nm) + 1), (char *)nm);
"//somedir". */
if (drive && IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
nm++;
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
/* If nm is absolute, look for /./ or /../ sequences; if none are
found, we can probably return right away. We will avoid allocating
a new string if name is already fully expanded. */
if (
IS_DIRECTORY_SEP (nm[0])
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
&& (drive || IS_DIRECTORY_SEP (nm[1]))
#endif
)
}
if (!lose)
{
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Make sure directories are all separated with / or \ as
desired, but avoid allocation of a new string when not
required. */
XSTRING_DATA (name)[1] = ':';
}
return name;
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
if (nm == XSTRING_DATA (name))
return name;
return build_string ((char *) nm);
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
}
}
Qfile_name);
nm++;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
collapse_newdir = 0;
#endif
}
multiple user profiles users defined, each with its HOME.
Therefore, the following should be reworked to handle
this case. */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Now if the file given is "~foo/file" and HOME="c:/", then
we want the file to be named "c:/file" ("~foo" becomes
"c:/"). The variable o has "~foo", so we can use the
newdir = (Bufbyte *) get_home_directory();
dostounix_filename (newdir);
nm += strlen(o) + 1;
-#else /* not WINDOWSNT */
-#ifdef __CYGWIN32__
+#else /* not WIN32_NATIVE */
+#ifdef CYGWIN
if ((user = user_login_name (NULL)) != NULL)
{
/* Does the user login name match the ~name? */
}
if (! newdir)
{
-#endif /* __CYGWIN32__ */
+#endif /* CYGWIN */
/* Jamie reports that getpwnam() can get wedged by SIGIO/SIGALARM
occurring in it. (It can call select()). */
slow_down_interrupts ();
newdir = (Bufbyte *) pw -> pw_dir;
nm = p;
}
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
}
#endif
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
/* If we don't find a user of that name, leave the name
unchanged; don't move nm forward to p. */
}
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* On DOS and Windows, nm is absolute if a drive name was specified;
use the drive's current directory as the prefix if needed. */
if (!newdir && drive)
if (!IS_DIRECTORY_SEP (nm[0]))
{
newdir = alloca (MAXPATHLEN + 1);
- if (!getdefdir (toupper (drive) - 'A' + 1, newdir))
+ if (!_getdcwd (toupper (drive) - 'A' + 1, newdir, MAXPATHLEN))
newdir = NULL;
}
if (!newdir)
newdir[3] = 0;
}
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
/* Finally, if no prefix has been specified and nm is not absolute,
then it must be expanded relative to default_directory. */
if (1
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
/* /... alone is not absolute on DOS and Windows. */
&& !IS_DIRECTORY_SEP (nm[0])
#else
newdir = XSTRING_DATA (default_directory);
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
if (newdir)
{
/* First ensure newdir is an absolute name. */
if (
- /* Detect MSDOS file names with drive specifiers. */
+ /* Detect Windows file names with drive specifiers. */
! (IS_DRIVE (newdir[0])
&& IS_DEVICE_SEP (newdir[1]) && IS_DIRECTORY_SEP (newdir[2]))
/* Detect Windows file names in UNC format. */
newdir = alloca (MAXPATHLEN + 1);
if (drive)
{
- if (!getdefdir (toupper (drive) - 'A' + 1, newdir))
+ if (!_getdcwd (toupper (drive) - 'A' + 1, newdir, MAXPATHLEN))
newdir = "/";
}
else
newdir = "";
}
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
if (newdir)
{
just // (an incomplete UNC name). */
length = strlen ((char *) newdir);
if (length > 1 && IS_DIRECTORY_SEP (newdir[length - 1])
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
&& !(length == 2 && IS_DIRECTORY_SEP (newdir[0]))
#endif
)
/* Now concatenate the directory and name to new space in the stack frame */
tlen += strlen ((char *) nm) + 1;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Add reserved space for drive name. (The Microsoft x86 compiler
produces incorrect code if the following two lines are combined.) */
target = (Bufbyte *) alloca (tlen + 2);
target += 2;
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
target = (Bufbyte *) alloca (tlen);
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
*target = 0;
if (newdir)
++o;
p += 3;
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* if drive is set, we're not dealing with an UNC, so
multiple dir-seps are redundant (and reportedly cause trouble
under win95) */
}
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* At last, set drive name, except for network file name. */
if (drive)
{
assert (IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1]));
}
CORRECT_DIR_SEPS (target);
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
return make_string (target, o - target);
}
for (p = nm; p != endp; p++)
{
if ((p[0] == '~'
-#if defined (WINDOWSNT) || defined (__CYGWIN32__)
+#if defined (WIN32_NATIVE) || defined (CYGWIN)
/* // at start of file name is meaningful in WindowsNT systems */
|| (IS_DIRECTORY_SEP (p[0]) && p - 1 != nm)
-#else /* not (WINDOWSNT || __CYGWIN32__) */
+#else /* not (WIN32_NATIVE || CYGWIN) */
|| IS_DIRECTORY_SEP (p[0])
-#endif /* not (WINDOWSNT || __CYGWIN32__) */
+#endif /* not (WIN32_NATIVE || CYGWIN) */
)
&& p != nm
&& (IS_DIRECTORY_SEP (p[-1])))
nm = p;
substituted = 1;
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* see comment in expand-file-name about drive specifiers */
else if (IS_DRIVE (p[0]) && p[1] == ':'
&& p > nm && IS_DIRECTORY_SEP (p[-1]))
nm = p;
substituted = 1;
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
}
/* See if any variables are substituted into the string
target = (Bufbyte *) alloca (s - o + 1);
strncpy ((char *) target, (char *) o, s - o);
target[s - o] = 0;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
strupr (target); /* $home == $HOME etc. */
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
/* Get variable value */
o = (Bufbyte *) egetenv ((char *) target);
target = (Bufbyte *) alloca (s - o + 1);
strncpy ((char *) target, (char *) o, s - o);
target[s - o] = 0;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
strupr (target); /* $home == $HOME etc. */
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
/* Get variable value */
o = (Bufbyte *) egetenv ((char *) target);
for (p = xnm; p != x; p++)
if ((p[0] == '~'
-#if defined (WINDOWSNT)
+#if defined (WIN32_NATIVE)
|| (IS_DIRECTORY_SEP (p[0]) && p - 1 != xnm)
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
|| IS_DIRECTORY_SEP (p[0])
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
)
/* don't do p[-1] if that would go off the beginning --jwz */
&& p != nm && p > xnm && IS_DIRECTORY_SEP (p[-1]))
xnm = p;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
else if (IS_DRIVE (p[0]) && p[1] == ':'
&& p > nm && IS_DIRECTORY_SEP (p[-1]))
xnm = p;
copyable by us. */
input_file_statable_p = (fstat (ifd, &st) >= 0);
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
if (out_st.st_mode != 0
&& st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
{
INTP (ok_if_already_exists), 0);
/* Syncing with FSF 19.34.6 note: FSF does not have conditional code for
- WINDOWSNT here; I've removed it. --marcpa */
+ WIN32_NATIVE here; I've removed it. --marcpa */
- /* FSFmacs only calls rename() here under BSD 4.1, and calls
- link() and unlink() otherwise, but that's bogus. Sometimes
- rename() succeeds where link()/unlink() fail, and we have
- configure check for rename() and emulate using link()/unlink()
- if necessary. */
+ /* We have configure check for rename() and emulate using
+ link()/unlink() if necessary. */
if (0 > rename ((char *) XSTRING_DATA (filename),
(char *) XSTRING_DATA (newname)))
{
/* But FSF #defines link as sys_link which is supplied in nt.c. We can't do
that because sysfile.h defines sys_link depending on ENCAPSULATE_LINK.
Reverted to previous behavior pending a working fix. (jhar) */
-#if defined(WINDOWSNT)
+#if defined(WIN32_NATIVE)
/* Windows does not support this operation. */
report_file_error ("Adding new name", Flist (2, &filename));
-#else /* not defined(WINDOWSNT) */
+#else /* not defined(WIN32_NATIVE) */
unlink ((char *) XSTRING_DATA (newname));
if (0 > link ((char *) XSTRING_DATA (filename),
report_file_error ("Adding new name",
list2 (filename, newname));
}
-#endif /* defined(WINDOWSNT) */
+#endif /* defined(WIN32_NATIVE) */
UNGCPRO;
return Qnil;
CHECK_STRING (filename);
ptr = XSTRING_DATA (filename);
return (IS_DIRECTORY_SEP (*ptr) || *ptr == '~'
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
|| (IS_DRIVE (*ptr) && ptr[1] == ':' && IS_DIRECTORY_SEP (ptr[2]))
#endif
) ? Qt : Qnil;
static int
check_executable (char *filename)
{
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
struct stat st;
if (stat (filename, &st) < 0)
return 0;
return ((st.st_mode & S_IEXEC) != 0);
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
#ifdef HAVE_EACCESS
return eaccess (filename, 1) >= 0;
#else
But Unix doesn't give us a right way to do it. */
return access (filename, 1) >= 0;
#endif /* HAVE_EACCESS */
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
}
/* Return nonzero if file FILENAME exists and can be written. */
if (!NILP (handler))
RETURN_UNGCPRO (call2 (handler, Qfile_readable_p, abspath));
-#if defined(WINDOWSNT) || defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
/* Under MS-DOS and Windows, open does not work for directories. */
UNGCPRO;
if (access (XSTRING_DATA (abspath), 0) == 0)
return Qt;
else
return Qnil;
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
{
int desc = interruptible_open ((char *) XSTRING_DATA (abspath), O_RDONLY | OPEN_BINARY, 0);
UNGCPRO;
close (desc);
return Qt;
}
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
}
/* Having this before file-symlink-p mysteriously caused it to be forgotten
return call2 (handler, Qfile_accessible_directory_p,
filename);
-#if !defined(WINDOWSNT)
+#if !defined(WIN32_NATIVE)
if (NILP (Ffile_directory_p (filename)))
return (Qnil);
else
UNGCPRO;
return tem ? Qnil : Qt;
}
-#endif /* !defined(WINDOWSNT) */
+#endif /* !defined(WIN32_NATIVE) */
}
DEFUN ("file-regular-p", Ffile_regular_p, 1, 1, 0, /*
return Qnil;
/* Syncing with FSF 19.34.6 note: not in FSF, #if 0'ed out here. */
#if 0
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
if (check_executable (XSTRING_DATA (abspath)))
st.st_mode |= S_IEXEC;
-#endif /* DOS_NT */
+#endif /* WIN32_NATIVE */
#endif /* 0 */
return make_int (st.st_mode & 07777);
*/
())
{
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
sync ();
#endif
return Qnil;
on other platforms, it is initialized so that Lisp code can find out
what the normal separator is.
*/ );
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
Vdirectory_sep_char = make_char ('\\');
#else
Vdirectory_sep_char = make_char ('/');
/*----- DISPLAY FRAME -----*/
/*---------------------------------------------------------------------*/
+HWND
+mswindows_get_selected_frame_hwnd (void)
+{
+ Lisp_Object frame, device;
+
+ device = Ffind_device (Qnil, Qmswindows);
+ if (NILP (device))
+ return NULL;
+ frame = DEVICE_SELECTED_FRAME (XDEVICE (device));
+ if (NILP (frame))
+ return NULL;
+
+ return FRAME_MSWINDOWS_HANDLE (XFRAME (frame));
+}
+
static void
mswindows_init_frame_1 (struct frame *f, Lisp_Object props)
{
not restrictive since this will happen later anyway in WM_SIZE. We
have to do this after adjusting the rect to account for menubar
etc. */
- msw_get_workspace_coords (&ws_rect);
+ mswindows_get_workspace_coords (&ws_rect);
pixel_width = rect.right - rect.left;
pixel_height = rect.bottom - rect.top;
if (pixel_width > ws_rect.right - ws_rect.left)
/*----- PRINTER FRAME -----*/
/*---------------------------------------------------------------------*/
+/*
+ * With some drvier/os combination (I discovered this with HP drviers
+ * under W2K), DC geometry is reset upon StartDoc and EndPage
+ * calls. This is called every time one of these calls is made.
+ */
+static void
+apply_dc_geometry (struct frame* f)
+{
+ HDC hdc = DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f)));
+ SetTextAlign (hdc, TA_BASELINE | TA_LEFT | TA_NOUPDATECP);
+ SetViewportOrgEx (hdc, FRAME_MSPRINTER_PIXLEFT(f),
+ FRAME_MSPRINTER_PIXTOP(f), NULL);
+}
+
void
msprinter_start_page (struct frame *f)
{
{
FRAME_MSPRINTER_PAGE_STARTED (f) = 1;
StartPage (DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f))));
+ apply_dc_geometry (f);
}
}
/* Negative for "uinspecified" */
FRAME_MSPRINTER_CHARWIDTH(f) = -1;
FRAME_MSPRINTER_CHARHEIGHT(f) = -1;
-
- /* nil is for "system default" for these properties. */
- FRAME_MSPRINTER_ORIENTATION(f) = Qnil;
- FRAME_MSPRINTER_DUPLEX(f) = Qnil;
}
static void
HDC hdc;
int frame_left, frame_top, frame_width, frame_height;
- /* Change printer parameters */
- {
- DEVMODE* devmode = msprinter_get_devmode_copy (device);
- devmode->dmFields = 0;
-
- if (!NILP (FRAME_MSPRINTER_ORIENTATION(f)))
- {
- devmode->dmFields = DM_ORIENTATION;
- if (EQ (FRAME_MSPRINTER_ORIENTATION(f), Qportrait))
- devmode->dmOrientation = DMORIENT_PORTRAIT;
- else if (EQ (FRAME_MSPRINTER_ORIENTATION(f), Qlandscape))
- devmode->dmOrientation = DMORIENT_LANDSCAPE;
- else
- abort();
- }
-
- if (!NILP (FRAME_MSPRINTER_DUPLEX(f)))
- {
- devmode->dmFields = DM_DUPLEX;
- if (EQ (FRAME_MSPRINTER_DUPLEX(f), Qnone))
- devmode->dmDuplex = DMDUP_SIMPLEX;
- if (EQ (FRAME_MSPRINTER_DUPLEX(f), Qvertical))
- devmode->dmDuplex = DMDUP_VERTICAL;
- if (EQ (FRAME_MSPRINTER_DUPLEX(f), Qhorizontal))
- devmode->dmDuplex = DMDUP_HORIZONTAL;
- else
- abort();
- }
-
- assert (!FRAME_MSPRINTER_PAGE_STARTED (f));
- msprinter_apply_devmode (device, devmode);
- }
-
/* DC might be recreated in msprinter_apply_devmode,
so do not initialize until now */
hdc = DEVICE_MSPRINTER_HDC (device);
change_frame_size (f, rows, columns, 0);
}
- /* Apply DC geometry */
- SetTextAlign (hdc, TA_BASELINE | TA_LEFT | TA_NOUPDATECP);
- SetViewportOrgEx (hdc, frame_left, frame_top, NULL);
- SetWindowOrgEx (hdc, 0, 0, NULL);
+ FRAME_MSPRINTER_PIXLEFT(f) = frame_left;
+ FRAME_MSPRINTER_PIXTOP(f) = frame_top;
/* Start print job */
di.cbSize = sizeof (di);
if (StartDoc (hdc, &di) <= 0)
error ("Cannot start print job");
+ apply_dc_geometry (f);
+
/* Finish frame setup */
FRAME_MSPRINTER_JOB_STARTED (f) = 1;
FRAME_VISIBLE_P(f) = 0;
static void
msprinter_mark_frame (struct frame *f)
{
- /* NOTE: These need not be marked as long as we allow only c-defined
- symbols for their values. Although, marking these is safer than
- expensive. [I know a proof to the theorem postulating that a
- gator is longer than greener. Ask me. -- kkm] */
- mark_object (FRAME_MSPRINTER_ORIENTATION (f));
- mark_object (FRAME_MSPRINTER_DUPLEX (f));
}
static void
return make_int (FRAME_MSPRINTER_RIGHT_MARGIN(f));
else if (EQ (Qbottom_margin, property))
return make_int (FRAME_MSPRINTER_BOTTOM_MARGIN(f));
- else if (EQ (Qorientation, property))
- return FRAME_MSPRINTER_ORIENTATION(f);
- else if (EQ (Qduplex, property))
- return FRAME_MSPRINTER_DUPLEX(f);
else
return Qunbound;
}
msprinter_internal_frame_property_p (struct frame *f, Lisp_Object property)
{
return (EQ (Qleft_margin, property) || EQ (Qtop_margin, property) ||
- EQ (Qright_margin, property) || EQ (Qbottom_margin, property) ||
- EQ (Qorientation, property) || EQ (Qduplex, property));
+ EQ (Qright_margin, property) || EQ (Qbottom_margin, property));
}
static Lisp_Object
msprinter_frame_properties (struct frame *f)
{
Lisp_Object props = Qnil;
- props = cons3 (Qorientation, FRAME_MSPRINTER_ORIENTATION(f), props);
- props = cons3 (Qduplex, FRAME_MSPRINTER_DUPLEX(f), props);
props = cons3 (Qbottom_margin,
make_int (FRAME_MSPRINTER_BOTTOM_MARGIN(f)), props);
props = cons3 (Qright_margin,
CHECK_NATNUM (val);
FRAME_MSPRINTER_BOTTOM_MARGIN(f) = XINT (val);
}
- else if (EQ (prop, Qorientation))
- {
- maybe_error_if_job_active (f);
- CHECK_SYMBOL (val);
- if (!NILP(val) &&
- !EQ (val, Qportrait) &&
- !EQ (val, Qlandscape))
- signal_simple_error ("Page orientation can only be "
- "'portrait or 'landscape", val);
- FRAME_MSPRINTER_ORIENTATION(f) = val;
- }
- else if (EQ (prop, Qduplex))
- {
- maybe_error_if_job_active (f);
- CHECK_SYMBOL (val);
- if (!NILP(val) &&
- !EQ (val, Qnone) &&
- !EQ (val, Qvertical) &&
- !EQ (val, Qhorizontal))
- signal_simple_error ("Duplex can only be 'none, "
- "'vertical or 'horizontal", val);
- FRAME_MSPRINTER_DUPLEX(f) = val;
- }
}
}
}
{
FRAME_MSPRINTER_PAGE_STARTED (f) = 0;
EndPage (DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f))));
+ apply_dc_geometry (f);
}
}
(setq default-frame-plist '(height 55 'width 80)
default-msprinter-frame-plist '(height nil 'width nil))
-
- orientation Printer page orientation. Can be 'nil,
- indicating system default, 'portrait
- or 'landscape.
-
- duplex Duplex printing mode, subject to printer
- support. Can be 'nil for the device default,
- 'none for simplex printing, 'vertical or
- 'horizontal for duplex page bound along
- the corresponding page direction.
-
See also `default-frame-plist', which specifies properties which apply
to all frames, not just mswindows frames.
*/ );
Lisp_Object Qafter;
Lisp_Object Qall;
Lisp_Object Qand;
+Lisp_Object Qappend;
Lisp_Object Qassoc;
Lisp_Object Qat;
Lisp_Object Qautodetect;
Lisp_Object Qcolumns;
Lisp_Object Qcommand;
Lisp_Object Qconsole;
+Lisp_Object Qcopies;
Lisp_Object Qcritical;
Lisp_Object Qctext;
Lisp_Object Qcursor;
Lisp_Object Qfile_name;
Lisp_Object Qfont;
Lisp_Object Qframe;
+Lisp_Object Qfrom_page;
+Lisp_Object Qfull_assoc;
Lisp_Object Qfuncall;
Lisp_Object Qfunction;
Lisp_Object Qgap_overhead;
Lisp_Object Qtoolbar;
Lisp_Object Qtop;
Lisp_Object Qtop_margin;
+Lisp_Object Qto_page;
Lisp_Object Qtty;
Lisp_Object Qtype;
Lisp_Object Qundecided;
defsymbol (&Qafter, "after");
defsymbol (&Qall, "all");
defsymbol (&Qand, "and");
+ defsymbol (&Qappend, "append");
defsymbol (&Qassoc, "assoc");
defsymbol (&Qat, "at");
defsymbol (&Qautodetect, "autodetect");
defsymbol (&Qcolumns, "columns");
defsymbol (&Qcommand, "command");
defsymbol (&Qconsole, "console");
+ defsymbol (&Qcopies, "copies");
defsymbol (&Qcritical, "critical");
defsymbol (&Qctext, "ctext");
defsymbol (&Qcursor, "cursor");
defsymbol (&Qfile_name, "file-name");
defsymbol (&Qfont, "font");
defsymbol (&Qframe, "frame");
+ defsymbol (&Qfrom_page, "from-page");
+ defsymbol (&Qfunction, "function");
+ defsymbol (&Qfull_assoc, "full-assoc");
defsymbol (&Qfuncall, "funcall");
defsymbol (&Qfunction, "function");
defsymbol (&Qgap_overhead, "gap-overhead");
defsymbol (&Qtoolbar, "toolbar");
defsymbol (&Qtop, "top");
defsymbol (&Qtop_margin, "top-margin");
+ defsymbol (&Qto_page, "to-page");
defsymbol (&Qtty, "tty");
defsymbol (&Qtype, "type");
defsymbol (&Qundecided, "undecided");
convex
DGUX
hpux
- MSDOS No-op for MSDOS.
NeXT
sgi
sequent Sequent Dynix 3.x.x (BSD)
sony_news NEWS-OS (works at least for 4.1C)
UMAX
UMAX4_3
- WIN32 No-op for Windows95/NT.
+ WIN32_NATIVE No-op for Windows95/NT.
__linux__ Linux: assumes /proc filesystem mounted.
Support from Michael K. Johnson.
__NetBSD__ NetBSD: assumes /kern filesystem mounted.
#include <config.h>
#endif
-#ifndef WINDOWSNT
-#ifndef __CYGWIN32__
+#include "lisp.h"
+#include "sysfile.h" /* for encapsulated open, close, read, write */
+
+#ifndef WIN32_NATIVE
+#ifndef CYGWIN
#include <sys/types.h>
#include <sys/param.h>
#endif
-#ifdef XEMACS
-#include "lisp.h"
-#include "sysfile.h" /* for encapsulated open, close, read, write */
-#endif /* XEMACS */
/* Exclude all the code except the test program at the end
if the system has its own `getloadavg' function.
#define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
#endif
-#ifdef XEMACS
#if defined (HAVE_KSTAT_H)
#include <kstat.h>
#endif /* HAVE_KSTAT_H */
-#endif /* XEMACS */
#if !defined (BSD) && defined (ultrix)
/* Ultrix behaves like BSD on Vaxen. */
#include <sys/dg_sys_info.h>
#endif
-#ifdef XEMACS
#if defined (HAVE_SYS_PSTAT_H)
#include <sys/pstat.h>
#endif /* HAVE_SYS_PSTAT_H (on HPUX) */
-#endif /* XEMACS */
#if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION)
#include <fcntl.h>
: (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
#endif /* OSF_MIPS */
-#if !defined (LDAV_DONE) && (defined (MSDOS) || defined (WIN32))
+#if !defined (LDAV_DONE) && defined (WIN32_NATIVE)
#define LDAV_DONE
/* A faithful emulation is going to have to be saved for a rainy day. */
{
loadavg[elem] = 0.0;
}
-#endif /* MSDOS */
+#endif /* WIN32_NATIVE */
#if !defined (LDAV_DONE) && defined (OSF_ALPHA)
#define LDAV_DONE
}
#endif /*__GNUWIN32__*/
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
+#include <config.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "gifrlib.h"
#include "sysfile.h"
#define OIC_BANG 32515
#define OIC_NOTE 32516
#define OIC_WINLOGO 32517
-#if defined (__CYGWIN32__) && CYGWIN_VERSION_DLL_MAJOR < 21
+#if defined (CYGWIN) && CYGWIN_VERSION_DLL_MAJOR < 21
#define LR_SHARED 0x8000
#endif
#endif
TO_EXTERNAL_FORMAT (LISP_STRING, file,
C_STRING_ALLOCA, f,
Qfile_name);
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
CYGWIN_WIN32_PATH (f, fname);
#else
fname = f;
provided then use the widget text to calculate sizes. */
static void
widget_query_geometry (Lisp_Object image_instance,
- unsigned int* width, unsigned int* height,
+ int* width, int* height,
enum image_instance_geometry disp, Lisp_Object domain)
{
Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
domain));
else
{
- unsigned int w, h;
+ int w, h;
/* Then if we are allowed to resize the widget, make the
size the same as the text dimensions. */
static int
widget_layout (Lisp_Object image_instance,
- unsigned int width, unsigned int height, Lisp_Object domain)
+ int width, int height, Lisp_Object domain)
{
Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
struct image_instantiator_methods* meths;
depending on the type of button. */
static void
button_query_geometry (Lisp_Object image_instance,
- unsigned int* width, unsigned int* height,
+ int* width, int* height,
enum image_instance_geometry disp, Lisp_Object domain)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
- unsigned int w, h;
+ int w, h;
query_string_geometry (IMAGE_INSTANCE_WIDGET_TEXT (ii),
IMAGE_INSTANCE_WIDGET_FACE (ii),
&w, &h, 0, domain);
/* tree-view geometry - get the height right */
static void
tree_view_query_geometry (Lisp_Object image_instance,
- unsigned int* width, unsigned int* height,
+ int* width, int* height,
enum image_instance_geometry disp, Lisp_Object domain)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
items and text therin in the tab control. */
static void
tab_control_query_geometry (Lisp_Object image_instance,
- unsigned int* width, unsigned int* height,
+ int* width, int* height,
enum image_instance_geometry disp, Lisp_Object domain)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
LIST_LOOP (rest, items)
{
- unsigned int h, w;
+ int h, w;
query_string_geometry (XGUI_ITEM (XCAR (rest))->name,
IMAGE_INSTANCE_WIDGET_FACE (ii),
/* Query the geometry of a layout widget. We assume that we can only
get here if the size is not already fixed. */
static void
-layout_query_geometry (Lisp_Object image_instance, unsigned int* width,
- unsigned int* height, enum image_instance_geometry disp,
+layout_query_geometry (Lisp_Object image_instance, int* width,
+ int* height, enum image_instance_geometry disp,
Lisp_Object domain)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii), rest;
int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0;
- unsigned int gheight, gwidth;
+ int gheight, gwidth;
/* If we are not initialized then we won't have any children. */
if (!IMAGE_INSTANCE_INITIALIZED (ii))
int
layout_layout (Lisp_Object image_instance,
- unsigned int width, unsigned int height, Lisp_Object domain)
+ int width, int height, Lisp_Object domain)
{
Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
Lisp_Object rest;
Lisp_Object items = IMAGE_INSTANCE_LAYOUT_CHILDREN (ii);
int x, y, maxph = 0, maxpw = 0, nitems = 0,
horiz_spacing, vert_spacing, ph_adjust = 0;
- unsigned int gheight, gwidth;
+ int gheight, gwidth;
/* If we are not initialized then we won't have any children. */
if (!IMAGE_INSTANCE_INITIALIZED (ii))
/* Layout subwindows if they are real subwindows. */
static int
native_layout_layout (Lisp_Object image_instance,
- unsigned int width, unsigned int height,
+ int width, int height,
Lisp_Object domain)
{
Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance);
{
Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
int i, stattis;
- char *p, *bits, *bp;
+ char *bits, *bp;
+ const char *p;
const char * volatile emsg = 0;
const char * volatile dstring;
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain)
{
- Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
-
x_widget_instantiate (image_instance, instantiator, pointer_fg,
pointer_bg, dest_mask, domain, "layout", 0);
}
IMAGE_GEOMETRY,
IMAGE_DESIRED_GEOMETRY,
IMAGE_MIN_GEOMETRY,
- IMAGE_MAX_GEOMETRY,
- IMAGE_UNSPECIFIED_GEOMETRY = ~0
+ IMAGE_MAX_GEOMETRY
};
+#define IMAGE_UNSPECIFIED_GEOMETRY -1
+
#define WIDGET_BORDER_HEIGHT 4
#define WIDGET_BORDER_WIDTH 4
instance. Actual geometry is stored in the appropriate slots in the
image instance. */
void (*query_geometry_method) (Lisp_Object image_instance,
- unsigned int* width, unsigned int* height,
+ int* width, int* height,
enum image_instance_geometry disp,
Lisp_Object domain);
/* Layout the instance and its children bounded by the provided
dimensions. Returns success or failure. */
int (*layout_method) (Lisp_Object image_instance,
- unsigned int width, unsigned int height,
- Lisp_Object domain);
+ int width, int height, Lisp_Object domain);
};
/***** Calling an image-instantiator method *****/
Lisp_Object pointer_fg, Lisp_Object pointer_bg,
int dest_mask, Lisp_Object domain);
void image_instance_query_geometry (Lisp_Object image_instance,
- unsigned int* width, unsigned int* height,
+ int* width, int* height,
enum image_instance_geometry disp,
Lisp_Object domain);
void image_instance_layout (Lisp_Object image_instance,
- unsigned int width, unsigned int height,
+ int width, int height,
Lisp_Object domain);
int layout_layout (Lisp_Object image_instance,
- unsigned int width, unsigned int height,
+ int width, int height,
Lisp_Object domain);
int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w);
Lisp_Object parent;
enum image_instance_type type;
unsigned int x_offset, y_offset; /* for layout purposes */
- unsigned int width, height, margin_width;
+ int width, height, margin_width;
unsigned long display_hash; /* Hash value representing the structure
of the image_instance when it was
last displayed. */
Lisp_Object property,
Lisp_Object locale));
void query_string_geometry ( Lisp_Object string, Lisp_Object face,
- unsigned int* width, unsigned int* height,
- unsigned int* descent, Lisp_Object domain);
+ int* width, int* height, int* descent,
+ Lisp_Object domain);
Lisp_Object query_string_font (Lisp_Object string,
Lisp_Object face, Lisp_Object domain);
Lisp_Object add_glyph_animated_timeout (EMACS_INT tickms, Lisp_Object device);
}
static Lisp_Object
-tty_selection_exists_p (Lisp_Object selection)
+tty_selection_exists_p (Lisp_Object selection, Lisp_Object selection_type)
{
return (Qt);
}
#if 0
static Lisp_Object
-tty_own_selection (Lisp_Object selection_name, Lisp_Object selection_value)
+tty_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
+ Lisp_Object how_to_add, Lisp_Object selection_type)
{
/* There is no way to do this cleanly - the GPM selection
** 'protocol' (actually the TIOCLINUX ioctl) requires a start and
TO_EXTERNAL_FORMAT (LISP_STRING, current_dir,
C_STRING_ALLOCA, f,
Qfile_name);
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
CYGWIN_WIN32_PATH (f, path);
#else
path = f;
TO_EXTERNAL_FORMAT (LISP_STRING, document,
C_STRING_ALLOCA, f,
Qfile_name);
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
CYGWIN_WIN32_PATH (f, doc);
#else
doc = f;
return h;
}
+unsigned long
+string_hash (const char *xv)
+{
+ unsigned int h = 0;
+ unsigned const char *x = (unsigned const char *) xv;
+
+ if (!x) return 0;
+
+ while (*x)
+ {
+ unsigned int g;
+ h = (h << 4) + *x++;
+ if ((g = h & 0xf0000000) != 0)
+ h = (h ^ (g >> 24)) ^ g;
+ }
+
+ return h;
+}
+
/* Return a suitable size for a hash table, with at least SIZE slots. */
static size_t
hash_table_size (size_t requested_size)
#endif
#ifdef HAVE_POSTGRESQL
-#include POSTGRES_INCLUDE (libpq-fe.h)
#include "postgresql.h"
#endif
#include <config.h>
#include "lisp.h"
-#include <limits.h>
#include "buffer.h"
#include "insdel.h"
#define TEXT_START 0
#endif /* USG */
-
-#ifdef MSDOS
-#define NO_REMAP
-#endif
-
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define VIRT_ADDR_VARIES
#define DATA_END get_data_end ()
#define DATA_START get_data_start ()
#define NO_REMAP
-/* Some really obscure 4.2-based systems (like Sequent DYNIX)
- * do not support asynchronous I/O (using SIGIO) on sockets,
- * even though it works fine on tty's. If you have one of
- * these systems, define the following, and then use it in
- * config.h (or elsewhere) to decide when (not) to use SIGIO.
- *
- * You'd think this would go in an operating-system description file,
- * but since it only occurs on some, but not all, BSD systems, the
- * reasonable place to select for it is in the machine description
- * file.
- */
-
-/* #define NO_SOCK_SIGIO */
-
\f
/* Machine specific stuff */
#define HAVE_PTYS
#endif /* USG */
#endif /* not XENIX */
-#ifdef MSDOS
-#define NO_REMAP
-#endif
-
#ifdef linux
/* libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared library, */
/* we cannot get the maximum address for brk */
code will not be sharable; but that's better than failing completely. */
#define NO_REMAP
-
-/* Some really obscure 4.2-based systems (like Sequent DYNIX)
- * do not support asynchronous I/O (using SIGIO) on sockets,
- * even though it works fine on tty's. If you have one of
- * these systems, define the following, and then use it in
- * config.h (or elsewhere) to decide when (not) to use SIGIO.
- *
- * You'd think this would go in an operating-system description file,
- * but since it only occurs on some, but not all, BSD systems, the
- * reasonable place to select for it is in the machine description
- * file.
- */
-
-/* #define NO_SOCK_SIGIO */
code will not be sharable; but that's better than failing completely. */
#define NO_REMAP
-
-/* Some really obscure 4.2-based systems (like Sequent DYNIX)
- * do not support asynchronous I/O (using SIGIO) on sockets,
- * even though it works fine on tty's. If you have one of
- * these systems, define the following, and then use it in
- * config.h (or elsewhere) to decide when (not) to use SIGIO.
- *
- * You'd think this would go in an operating-system description file,
- * but since it only occurs on some, but not all, BSD systems, the
- * reasonable place to select for it is in the machine description
- * file.
- */
-
-/* #define NO_SOCK_SIGIO */
* config.h (or elsewhere) to decide when (not) to use SIGIO.
*/
+/* Note: This definition not used under XEmacs */
#define NO_SOCK_SIGIO
/* Define how to search all pty names.
#define NO_REMAP
-/* Some really obscure 4.2-based systems (like Sequent DYNIX)
- * do not support asynchronous I/O (using SIGIO) on sockets,
- * even though it works fine on tty's. If you have one of
- * these systems, define the following, and then use it in
- * config.h (or elsewhere) to decide when (not) to use SIGIO.
- *
- * You'd think this would go in an operating-system description file,
- * but since it only occurs on some, but not all, BSD systems, the
- * reasonable place to select for it is in the machine description
- * file.
- */
-
-#define NO_SOCK_SIGIO
-
-
/* After adding support for a new system, modify the large case
statement in the `configure' script to recognize reasonable
configuration names, and add a description of the system to
/* #define NO_REMAP */
-/* Some really obscure 4.2-based systems (like Sequent DYNIX)
- * do not support asynchronous I/O (using SIGIO) on sockets,
- * even though it works fine on tty's. If you have one of
- * these systems, define the following, and then use it in
- * config.h (or elsewhere) to decide when (not) to use SIGIO.
- *
- * You'd think this would go in an operating-system description file,
- * but since it only occurs on some, but not all, BSD systems, the
- * reasonable place to select for it is in the machine description
- * file.
- */
-
-/* #define NO_SOCK_SIGIO */
-
/* After adding support for a new system, modify the large case
statement in the `configure' script to recognize reasonable
configuration names, and add a description of the system to
#include <ulimit.h>
#endif
-#ifdef MSDOS
-#include <dpmi.h>
-#endif
-
/* Some systems need this before <sys/resource.h>. */
#include <sys/types.h>
#ifndef BSD4_2
#ifndef USG
-#ifndef MSDOS
-#ifndef WINDOWSNT
-#ifndef __CYGWIN32__
+#ifndef WIN32_NATIVE
+#ifndef CYGWIN
#if defined(__linux__) && defined(powerpc) /*Added Kaoru Fukui*/
#else /*Added Kaoru Fukui*/
#include <sys/vlimit.h>
#endif /*Added by Fukui*/
-#endif /* not __CYGWIN32__ */
-#endif /* not WINDOWSNT */
-#endif /* not MSDOS */
+#endif /* not CYGWIN */
+#endif /* not WIN32_NATIVE */
#endif /* not USG */
#else /* if BSD4_2 */
#include <sys/time.h>
typedef char *POINTER;
#endif
-#ifndef __CYGWIN32__
+#ifndef CYGWIN
typedef unsigned long SIZE;
#endif
}
#else /* not USG */
-#if defined( WINDOWSNT )
+#if defined( WIN32_NATIVE )
static void
get_lim_data (void)
#else
#if !defined (BSD4_2) && !defined (__osf__)
-#ifdef MSDOS
-void
-get_lim_data (void)
-{
- _go32_dpmi_meminfo info;
-
- _go32_dpmi_get_free_memory_information (&info);
- lim_data = info.available_memory;
-}
-#else /* not MSDOS */
static void
get_lim_data (void)
{
lim_data = vlimit (LIM_DATA, -1);
}
-#endif /* not MSDOS */
#else /* BSD4_2 */
#endif
}
#endif /* BSD4_2 */
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
#endif /* not USG */
#endif /* not NO_LIM_DATA */
#endif /* not HEAP_IN_DATA */
#include <config.h>
#include "lisp.h"
-#include <limits.h>
#include "buffer.h"
#include "commands.h"
of not hitting an error, maxlen should be >= 2*len + 3. */
Bytecount
-msw_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
+mswindows_translate_menu_or_dialog_item (Bufbyte *item, Bytecount len,
Bytecount maxlen, Emchar *accel,
Lisp_Object error_name)
{
/* Left flush part of the string */
ll = gui_item_display_flush_left (gui_item, buf, MAX_MENUITEM_LENGTH);
- ll = msw_translate_menu_or_dialog_item ((Bufbyte *) buf, ll,
+ ll = mswindows_translate_menu_or_dialog_item ((Bufbyte *) buf, ll,
MAX_MENUITEM_LENGTH, accel,
XGUI_ITEM (gui_item)->name);
}
int
-msw_char_is_accelerator (struct frame *f, Emchar ch)
+mswindows_char_is_accelerator (struct frame *f, Emchar ch)
{
Lisp_Object hash = FRAME_MSWINDOWS_MENU_HASH_TABLE (f);
#define INCLUDED_ndir_h_
#define DIRBLKSIZ 512 /* size of directory block */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define MAXNAMLEN 255
-#else /* not WINDOWSNT */
+#else /* not WIN32_NATIVE */
#define MAXNAMLEN 15 /* maximum filename length */
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
/* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
struct direct /* data from readdir() */
/* Sync'ed with Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */
#include <config.h>
-
-#undef signal
#define getwd _getwd
#include "lisp.h"
#undef getwd
#include "syssignal.h"
#include "sysproc.h"
#include "sysfile.h"
-
-#include <ctype.h>
-#include <direct.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <io.h>
-#include <pwd.h>
-#include <signal.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include "syspwd.h"
+#include "sysdir.h"
#include "syswindows.h"
#include "nt.h"
-#include <sys/dir.h>
#include "ntheap.h"
return dirp;
}
-void
+int
closedir (DIR *dirp)
{
+ BOOL retval;
+
/* If we have a find-handle open, close it. */
if (dir_find_handle != INVALID_HANDLE_VALUE)
{
- FindClose (dir_find_handle);
+ retval = FindClose (dir_find_handle);
dir_find_handle = INVALID_HANDLE_VALUE;
}
xfree (dirp);
+ if (retval)
+ return 0;
+ else
+ return -1;
}
struct direct *
}
#else
-#if defined(__MINGW32__) && CYGWIN_VERSION_DLL_MAJOR <= 21
+#if defined(MINGW) && CYGWIN_VERSION_DLL_MAJOR <= 21
#define LowPart u.LowPart
#define HighPart u.HighPart
#endif
return ret;
}
#endif
-#if defined(__MINGW32__) && CYGWIN_VERSION_DLL_MAJOR <= 21
+#if defined(MINGW) && CYGWIN_VERSION_DLL_MAJOR <= 21
#undef LowPart
#undef HighPart
#endif
#endif
-/* stat has been fixed since MSVC 5.0.
- Oh, and do not encapsulater stat for non-MS compilers, too */
-/* #### popineau@ese-metz.fr says they still might be broken.
- Oh well... Let's add that `1 ||' condition.... --kkm */
/* #### aichner@ecf.teradyne.com reported that with the library
provided stat/fstat, (file-exist "d:\\tmp\\") =>> nil,
(file-exist "d:\\tmp") =>> t, when d:\tmp exists. Whenever
we opt to use non-encapsulated stat(), this should serve as
a compatibility test. --kkm */
-#if 1 || defined(_MSC_VER) && _MSC_VER < 1100
-
/* Since stat is encapsulated on Windows NT, we need to encapsulate
the equally broken fstat as well. */
-int _cdecl
-fstat (int handle, struct stat *buffer)
+int
+mswindows_fstat (int handle, struct stat *buffer)
{
int ret;
BY_HANDLE_FILE_INFORMATION lpFileInfo;
replace it with our own. This also allows us to calculate consistent
inode values without hacks in the main Emacs code. */
int
-stat (const char * path, struct stat * buf)
+mswindows_stat (const char * path, struct stat * buf)
{
char * name;
WIN32_FIND_DATA wfd;
return 0;
}
-#endif /* defined(_MSC_VER) && _MSC_VER < 1100 */
/* From callproc.c */
extern Lisp_Object Vbinary_process_input;
/* Signal pending mask: bit set to 1 means sig is pending */
unsigned signal_pending_mask = 0;
-msw_sighandler msw_sigset (int nsig, msw_sighandler handler)
+mswindows_sighandler mswindows_sigset (int nsig, mswindows_sighandler handler)
{
/* We delegate some signals to the system function */
if (nsig == SIGFPE || nsig == SIGABRT || nsig == SIGINT)
/* Store handler ptr */
{
- msw_sighandler old_handler = signal_handlers[nsig];
+ mswindows_sighandler old_handler = signal_handlers[nsig];
signal_handlers[nsig] = handler;
return old_handler;
}
}
-int msw_sighold (int nsig)
+int mswindows_sighold (int nsig)
{
if (nsig < 0 || nsig > SIG_MAX)
return errno = EINVAL;
return 0;
}
-int msw_sigrelse (int nsig)
+int mswindows_sigrelse (int nsig)
{
if (nsig < 0 || nsig > SIG_MAX)
return errno = EINVAL;
signal_block_mask &= ~sigmask(nsig);
if (signal_pending_mask & sigmask(nsig))
- msw_raise (nsig);
+ mswindows_raise (nsig);
return 0;
}
-int msw_sigpause (int nsig)
+int mswindows_sigpause (int nsig)
{
/* This is currently not called, because the only
call to sigpause inside XEmacs is with SIGCHLD
return 0;
}
-int msw_raise (int nsig)
+int mswindows_raise (int nsig)
{
/* We delegate some raises to the system routine */
if (nsig == SIGFPE || nsig == SIGABRT || nsig == SIGINT)
DWORD dw1, DWORD dw2)
{
/* Just raise a signal indicated by dwUser parameter */
- msw_raise (dwUser);
+ mswindows_raise (dwUser);
}
/* Divide time in ms specified by IT by DENOM. Return 1 ms
return TRUE;
}
-#if 1 /* !defined(__MINGW32__) */
+#if 1 /* !defined(MINGW) */
/* Return pointer to section header for section containing the given
relative virtual address. */
static IMAGE_SECTION_HEADER *
rva_to_section (DWORD rva, IMAGE_NT_HEADERS * nt_header)
{
- /* Synched with FSF 20.6. We added MINGW32 stuff. */
+ /* Synched with FSF 20.6. We added MINGW stuff. */
PIMAGE_SECTION_HEADER section;
int i;
mswindows_executable_type (const char * filename, int * is_dos_app,
int * is_cygnus_app)
{
- /* Synched with FSF 20.6. We added MINGW32 stuff and casts. */
+ /* Synched with FSF 20.6. We added MINGW stuff and casts. */
file_data executable;
char * p;
start with a DOS program stub. Note that 16-bit Windows
executables use the OS/2 1.x format. */
-#if 0 /* defined( __MINGW32__ ) */
+#if 0 /* defined( MINGW ) */
/* mingw32 doesn't have enough headers to detect cygwin
apps, just do what we can. */
FILHDR * exe_header;
#ifndef INCLUDED_nt_h_
#define INCLUDED_nt_h_
+#include "syswindows.h"
+
#ifdef DEBUG_XEMACS
#define DebPrint(stuff) _DebPrint stuff
#else
#define DebPrint(stuff)
#endif
-#define R_OK 4
-#define W_OK 2
-#ifdef X_OK
-#undef X_OK
-#endif
-#define X_OK 1
-#define F_OK 0
-
/* ------------------------------------------------------------------------- */
/* child_process.status values */
/* In process-nt.c */
extern int compare_env (const void *strp1, const void *strp2);
+void mswindows_set_errno (unsigned long win32_error);
+void mswindows_set_last_errno (void);
+
+void wait_for_termination (HANDLE pid);
+
+int mswindows_fstat (int handle, struct stat *buffer);
+int mswindows_stat (const char * path, struct stat * buf);
+
#endif /* INCLUDED_nt_h_ */
#ifndef INCLUDED_ntheap_h_
#define INCLUDED_ntheap_h_
-#include <windows.h>
+#include "syswindows.h"
/*
* Heap related stuff.
02111-1307, USA.*/
#include <config.h>
-#include <stdio.h>
-#include "sysfile.h"
-#include "syswindows.h"
#include "lisp.h"
+
+#include "sysfile.h"
+#include "nt.h"
#include "nativesound.h"
static int play_sound_data_1 (unsigned char *data, int length,
/* Adapted for XEmacs by David Hobley <david@spook-le0.cia.com.au> */
/* Synced with FSF Emacs 19.34.6 by Marc Paquette <marcpa@cam.org> */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <io.h>
-#include <fcntl.h>
-#include <signal.h>
-
-/* must include CRT headers *before* config.h */
-/* #### I don't believe it - martin */
#include <config.h>
#undef signal
#undef wait
#undef kill
#include <windows.h>
-#include <sys/socket.h>
#ifdef HAVE_A_OUT_H
#include <a.out.h>
#endif
#endif
}
-/* sys_signal moved to nt.c. It's now called msw_signal... */
+/* sys_signal moved to nt.c. It's now called mswindows_signal... */
/* Defined in <process.h> which conflicts with the local copy */
#define _P_NOWAIT 1
GetClassName (hwnd, window_class, sizeof (window_class));
if (strcmp (window_class,
- msw_windows9x_p()
+ mswindows_windows9x_p()
? "tty"
: "ConsoleWindowClass") == 0)
{
if (NILP (Vwin32_start_process_share_console) && cp && cp->hwnd)
{
#if 1
- if (msw_windows9x_p())
+ if (mswindows_windows9x_p())
{
/*
Another possibility is to try terminating the VDM out-right by
/* Some miscellaneous functions that are Windows specific, but not GUI
specific (ie. are applicable in terminal or batch mode as well). */
-/* lifted from fileio.c */
-#define CORRECT_DIR_SEPS(s) \
- do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
- else unixtodos_filename (s); \
- } while (0)
-
DEFUN ("win32-short-file-name", Fwin32_short_file_name, 1, 1, "", /*
Return the short file name version (8.3) of the full path of FILENAME.
If FILENAME does not exist, return nil.
#include <config.h>
#include "lisp.h"
-#include <limits.h>
#include "console-x.h"
#include "objects-x.h"
#include "insdel.h"
#include "lstream.h"
#include "sysfile.h"
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include "console-msw.h"
#endif
-#include <limits.h>
#include <float.h>
/* Define if not in float.h */
#ifndef DBL_DIG
int stdout_needs_newline;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
static int no_useful_stderr;
#endif
{
if (stream)
{
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
if (!no_useful_stderr)
no_useful_stderr = GetStdHandle (STD_ERROR_HANDLE) == 0 ? 1 : -1;
/* we typically have no useful stdout/stderr under windows if we're
being invoked graphically. */
if (!noninteractive || no_useful_stderr > 0)
- msw_output_console_string (extptr, extlen);
+ mswindows_output_console_string (extptr, extlen);
else
#endif
{
fwrite (extptr, 1, extlen, stream);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Q122442 says that pipes are "treated as files, not as
devices", and that this is a feature. Before I found that
article, I thought it was a bug. Thanks MS, I feel much
called from fatal_error_signal().
2) (to be really correct) make a new lstream that outputs using
- msw_output_console_string(). */
+ mswindows_output_console_string(). */
static int
std_handle_out_va (FILE *stream, const char *fmt, va_list args)
}
#endif /* LISP_FLOAT_TYPE */
-/* Print NUMBER to BUFFER. The digits are first written in reverse
- order (the least significant digit first), and are then reversed.
- This is equivalent to sprintf(buffer, "%ld", number), only much
- faster.
+/* Print NUMBER to BUFFER. This is equivalent to sprintf(buffer,
+ "%ld", number), only much faster.
BUFFER should accept 24 bytes. This should suffice for the longest
numbers on 64-bit machines, including the `-' sign and the trailing
Under MS Windows, this writes output to the console window (which is
created, if necessary), unless XEmacs is being run noninteractively
-(i.e. using the `-batch' argument).
+\(i.e. using the `-batch' argument).
If you have opened a termscript file (using `open-termscript'), then
the output also will be logged to this file.
#include "sysdep.h"
#include <shellapi.h>
-#ifdef __MINGW32__
#include <errno.h>
-#endif
#include <signal.h>
#ifdef HAVE_SOCKETS
#include <winsock.h>
HANDLE h_process;
DWORD dwProcessId;
HWND hwnd; /* console window */
- int need_enable_child_signals;
};
/* Control how args are quoted to ensure correct parsing by child
GetClassName (hwnd, window_class, sizeof (window_class));
if (strcmp (window_class,
- msw_windows9x_p ()
+ mswindows_windows9x_p ()
? "tty"
: "ConsoleWindowClass") == 0)
{
if (NILP (Vmswindows_start_process_share_console) && cp && cp->hwnd)
{
#if 1
- if (msw_windows9x_p ())
+ if (mswindows_windows9x_p ())
{
/*
Another possibility is to try terminating the VDM out-right by
static void
ensure_console_window_exists (void)
{
- if (msw_windows9x_p ())
- msw_hide_console ();
+ if (mswindows_windows9x_p ())
+ mswindows_hide_console ();
}
int
/* Duplicate the stdout handle for use as stderr */
DuplicateHandle(GetCurrentProcess(), hprocout, GetCurrentProcess(),
- &hprocerr, 0, TRUE, DUPLICATE_SAME_ACCESS);
+ &hprocerr, 0, TRUE, DUPLICATE_SAME_ACCESS);
/* Stupid Win32 allows to create a pipe with *both* ends either
inheritable or not. We need process ends inheritable, and local
int i;
Bufbyte **quoted_args;
int is_dos_app, is_cygnus_app;
+ int is_command_shell;
int do_quoting = 0;
char escape_char = 0;
mswindows_executable_type (XSTRING_DATA (program),
&is_dos_app, &is_cygnus_app);
+ {
+ /* #### Bleeeeeeeeeeeeeeeeech!!!! The command shells appear to
+ use '^' as a quote character, at least under NT. #### I haven't
+ tested 95. If it allows no quoting conventions at all, set
+ escape_char to 0 and the code below will work. (e.g. NT tolerates
+ no quoting -- this command
+
+ cmd /c "ls "/Program Files""
+
+ actually works.) */
+
+ struct gcpro gcpro1, gcpro2;
+ Lisp_Object progname = Qnil;
+
+ GCPRO2 (program, progname);
+ progname = Ffile_name_nondirectory (program);
+ progname = Fdowncase (progname, Qnil);
+
+ is_command_shell =
+ internal_equal (progname, build_string ("command.com"), 0)
+ || internal_equal (progname, build_string ("cmd.exe"), 0);
+ UNGCPRO;
+ }
+
#if 0
/* #### we need to port this. */
/* On Windows 95, if cmdname is a DOS app, we invoke a helper
if (INTP (Vmswindows_quote_process_args))
escape_char = (char) XINT (Vmswindows_quote_process_args);
else
- escape_char = is_cygnus_app ? '"' : '\\';
+ escape_char = is_command_shell ? '^' : is_cygnus_app ? '"' : '\\';
}
/* do argv... */
if (*p == '"')
{
/* allow for embedded quotes to be escaped */
- arglen++;
+ if (escape_char)
+ arglen++;
need_quotes = 1;
/* handle the case where the embedded quote is already escaped */
if (escape_char_run > 0)
need_quotes = 1;
}
- if (*p == escape_char && escape_char != '"')
+ if (escape_char && *p == escape_char && escape_char != '"')
escape_char_run++;
else
escape_char_run = 0;
#else
for ( ; *p; p++)
{
- if (*p == '"')
+ if (escape_char && *p == '"')
{
/* double preceding escape chars if any */
while (escape_char_run > 0)
}
*parg++ = *p;
- if (*p == escape_char && escape_char != '"')
+ if (escape_char && *p == escape_char && escape_char != '"')
escape_char_run++;
else
escape_char_run = 0;
}
flags = CREATE_SUSPENDED;
- if (msw_windows9x_p ())
+ if (mswindows_windows9x_p ())
flags |= (!NILP (Vmswindows_start_process_share_console)
? CREATE_NEW_PROCESS_GROUP
: CREATE_NEW_CONSOLE);
CloseHandle (pi.hProcess);
}
+ if (!windowed)
+ enable_child_signals (pi.hProcess);
+
ResumeThread (pi.hThread);
CloseHandle (pi.hThread);
- /* Remember to enable child signals later if this is not a windowed
- app. Can't do it right now because that screws up the MKS Toolkit
- shell. */
- if (!windowed)
- {
- NT_DATA(p)->need_enable_child_signals = 10;
- kick_status_notify ();
- }
-
return ((int)pi.dwProcessId);
}
}
nt_update_status_if_terminated (Lisp_Process* p)
{
DWORD exit_code;
-
- if (NT_DATA(p)->need_enable_child_signals > 1)
- {
- NT_DATA(p)->need_enable_child_signals -= 1;
- kick_status_notify ();
- }
- else if (NT_DATA(p)->need_enable_child_signals == 1)
- {
- enable_child_signals(NT_DATA(p)->h_process);
- NT_DATA(p)->need_enable_child_signals = 0;
- }
-
if (GetExitCodeProcess (NT_DATA(p)->h_process, &exit_code)
&& exit_code != STILL_ACTIVE)
{
{
Lisp_Process *p = XPROCESS (proc);
- /* Enable child signals if necessary. This may lose the first
- but it's better than nothing. */
- if (NT_DATA (p)->need_enable_child_signals > 0)
- {
- enable_child_signals (NT_DATA(p)->h_process);
- NT_DATA (p)->need_enable_child_signals = 0;
- }
-
/* Signal error if SIGNO cannot be sent */
validate_signal_number (signo);
UNIX_DATA(p)->subtty = forkin;
{
-#if !defined(__CYGWIN32__)
+#if !defined(CYGWIN)
/* child_setup must clobber environ on systems with true vfork.
Protect it from permanent change. */
char **save_environ = environ;
} /**** End of child code ****/
/**** Back in parent process ****/
-#if !defined(__CYGWIN32__)
+#if !defined(CYGWIN)
environ = save_environ;
#endif
}
imr.imr_multiaddr.s_addr = htonl (inet_addr ((char *) XSTRING_DATA (dest)));
imr.imr_interface.s_addr = htonl (INADDR_ANY);
if (setsockopt (rs, IPPROTO_IP, IP_ADD_MEMBERSHIP,
- (char *) &imr, sizeof (struct ip_mreq)) < 0)
+ &imr, sizeof (struct ip_mreq)) < 0)
{
close (ws);
close (rs);
/* scope */
if (setsockopt (ws, IPPROTO_IP, IP_MULTICAST_TTL,
- (char *) &thettl, sizeof (thettl)) < 0)
+ &thettl, sizeof (thettl)) < 0)
{
close (rs);
close (ws);
Lisp_Object Vprocess_list;
extern Lisp_Object Vlisp_EXEC_SUFFIXES;
+Lisp_Object Vnull_device;
\f
delete_exited_processes = 1;
+ DEFVAR_CONST_LISP ("null-device", &Vnull_device /*
+Name of the null device, which differs from system to system.
+The null device is a filename that acts as a sink for arbitrary amounts of
+data, which is discarded, or as a source for a zero-length file.
+It is available on all the systems that we currently support, but with
+different names (typically either `/dev/null' or `nul').
+
+Note that there is also a /dev/zero on most modern Unix versions (including
+Cygwin), which acts like /dev/null when used as a sink, but as a source
+it sends a non-ending stream of zero bytes. It's used most often along
+with memory-mapping. We don't provide a Lisp variable for this because
+the operations needing this are lower level than what ELisp programs
+typically do, and in any case no equivalent exists under native MS Windows.
+*/ );
+ Vnull_device = build_string (NULL_DEVICE);
+
DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /*
Control type of device used to communicate with subprocesses.
Values are nil to use a pipe, or t or `pty' to use a pty.
void deactivate_process (Lisp_Object proc);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
int
#else
void
#include <sys/param.h>
#endif
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <direct.h>
#endif
strcpy (copy_path, path);
path = copy_path;
max_path = copy_path + PATH_MAX - 2;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/*
** In NT we have two different cases: (1) the path name begins
** with a drive letter, e.g., "C:"; and (2) the path name begins
/* Building under cygwin
*
- * The approach I have taken with this port is to use primarily the UNIX
- * code base adding stuff that is MS-Windows specific. This works quite
- * well, and is in keeping with my perception of the cygwin philosophy.
- * Note that if you make changes to this file you do NOT want to define
- * WINDOWSNT, I repeat - do not define this, it will break everything
- * horribly. What does get defined is HAVE_MS_WINDOWS, but this is
- * done by configure and only applies to the window system.
+ * The approach I have taken with this port is to use primarily the
+ * UNIX code base adding stuff that is MS-Windows specific. This works
+ * quite well, and is in keeping with my perception of the cygwin
+ * philosophy. Note that if you make changes to this file you do NOT
+ * want to define WIN32_NATIVE (formerly "WINDOWSNT"), I repeat - do
+ * not define this, it will break everything horribly. What does get
+ * defined is HAVE_MS_WINDOWS, but this is done by configure and only
+ * applies to the window system.
*
* When building make sure your HOME path is unix style - i.e. without
* a drive letter.
* Andy Piper <andy@xemacs.org> 8/1/98
* http://www.xemacs.freeserve.co.uk/ */
+/* Identify ourselves */
+#define CYGWIN
+
/* cheesy way to determine cygwin version */
#ifndef NOT_C_CODE
# include <signal.h>
# endif
# endif
-extern void cygwin32_win32_to_posix_path_list(const char*, char*);
-extern int cygwin32_win32_to_posix_path_list_buf_size(const char*);
-extern void cygwin32_posix_to_win32_path_list(const char*, char*);
-extern int cygwin32_posix_to_win32_path_list_buf_size(const char*);
+void cygwin32_win32_to_posix_path_list (const char*, char*);
+int cygwin32_win32_to_posix_path_list_buf_size (const char*);
+void cygwin32_posix_to_win32_path_list (const char*, char*);
+int cygwin32_posix_to_win32_path_list_buf_size (const char*);
# if CYGWIN_VERSION_DLL_MAJOR < 20
struct timeval;
struct timezone;
struct itimerval;
struct stat;
-extern int gettimeofday(struct timeval *tp, struct timezone *tzp);
-extern int gethostname (char* name, int namelen);
-extern char* mktemp(char *);
-extern double logb(double);
-extern void sync();
-extern int ioctl(int, int, ...);
- /* sys/stat.h */
-extern int lstat(const char *path, struct stat *buf);
- /* unistd.h */
-extern int readlink(const char *path, void *buf, unsigned int bufsiz);
-extern int symlink(const char *name1, const char *name2);
- /* sys/time.h */
-extern int setitimer(int which, const struct itimerval *value,
- struct itimerval *ovalue);
-extern int utimes(char *file, struct timeval *tvp);
-
-extern int srandom( unsigned seed);
-extern long random();
-
-# endif
-#endif
+int gettimeofday (struct timeval *tp, struct timezone *tzp);
+int gethostname (char* name, int namelen);
+char* mktemp (char *);
+double logb (double);
+void sync (void);
+int ioctl (int, int, ...);
+ /* sys/stat.h */
+int lstat (const char *path, struct stat *buf);
+ /* unistd.h */
+int readlink (const char *path, void *buf, unsigned int bufsiz);
+int symlink (const char *name1, const char *name2);
+ /* sys/time.h */
+int setitimer (int which, const struct itimerval *value,
+ struct itimerval *ovalue);
+int utimes (char *file, struct timeval *tvp);
+
+int srandom (unsigned seed);
+long random (void);
+
+# endif /* CYGWIN_VERSION_DLL_MAJOR < 20 */
+
+# if CYGWIN_VERSION_DLL_MAJOR <= 20
+char *getpass (const char *prompt);
+double logb (double);
+# endif /* CYGWIN_VERSION_DLL_MAJOR <= 20 */
-#ifdef HAVE_MS_WINDOWS
-#define HAVE_NTGUI
-#define HAVE_FACES
#endif
#ifndef ORDINARY_LINK
#define HAVE_SOCKETS
#endif
#define OBJECTS_SYSTEM ntplay.o
-#define HAVE_NATIVE_SOUND
#undef MAIL_USE_SYSTEM_LOCK
-#define MAIL_USE_POP
/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
* group of arguments and treat it as an array of the arguments. */
#include "decosf3-2.h"
+/* etext and edata are only available when compiling in non-ANSI mode,
+ while _etext and _edata are always available, hence more portable.
+ This allows `configure --compiler=cc --cflags=-std1' to work. */
+#define etext _etext
+#define edata _edata
+
#ifndef NOT_C_CODE
-#include "/usr/include/sys/lc_core.h"
-#include "/usr/include/reg_types.h"
+#include "sys/lc_core.h"
+#include "reg_types.h"
#endif /* C code */
#define re_compile_pattern sys_re_compile_pattern
#define regoff_t sys_regoff_t
#define regmatch_t sys_regmatch_t
-/* A perfectly ordinary link wins again - martin
#undef C_SWITCH_SYSTEM
#undef LIBS_SYSTEM
#undef LIBS_DEBUG
-#define ORDINARY_LINK */
+/* #define ORDINARY_LINK */
#undef SYSTEM_MALLOC
#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
+#define INTERRUPTIBLE_OPEN
+
#define LIBS_DEBUG
/* FreeBSD 2.2 or later */
#ifndef __FreeBSD_version
-/* System description file for Windows NT.
+/* System description file for Windows 9x and NT.
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
This file is part of GNU Emacs.
/* Synched up with: FSF 19.31. */
-#ifndef WINDOWSNT
-#define WINDOWSNT
-#endif
-
-#ifndef DOS_NT
-#define DOS_NT /* MSDOS or WINDOWSNT */
+/* Capsule summary of different preprocessor flags:
+
+1. Keep in mind that there are two possible OS environments we are dealing
+ with -- Cygwin and Native Windows. Cygwin provides a POSIX emulation
+ layer on top of MS Windows -- in particular, providing the file-system,
+ process, tty, and signal semantics that are part of a modern, standard
+ Unix operating system. MS Windows also provides these services, but
+ through their own API, called Win32. When compiling in a Cygwin
+ environment, the Win32 API's are also available, and in fact are used
+ to do native GUI programming.
+
+2. There are two windowing environments we can target XEmacs for when
+ running under MS Windows -- Windows native, and X. (It may seem strange
+ to write an X application under Windows, but there are in fact many X
+ servers out there running on Windows, and as far as I know there is no
+ real (or at least, that works well) networking Window-system extension
+ under MS Windows. Furthermore, if you're porting a Unix application to
+ Windows and use Cygwin to assist you, it might seem natural to use an
+ X server to avoid having to port all the code to Windows.) For XEmacs,
+ there are various reasons people could come up with for why we would
+ want to keep maintaining X Windows under MS Windows support.
+
+That gives us four possible build environments. I (Ben) build
+regularly on fully-native-everything, Andy builds on Cygwin + MS
+Windows + X Windows for windowing.
+
+The build flags used for these divisions are:
+
+CYGWIN -- for Cygwin-only stuff.
+WIN32_NATIVE -- Win32 native OS-level stuff (files, process, etc.).
+HAVE_X_WINDOWS -- for X Windows (regardless of whether under MS Win)
+HAVE_MS_WINDOWS -- MS Windows native windowing system (anything related to
+ the appearance of the graphical screen).
+
+Finally, there's also the MINGW build environment, which uses GCC
+\(similar to Cygwin), but native MS Windows libraries rather than a
+POSIX emulation layer (the Cygwin approach). This environment defines
+WIN32_NATIVE, but also defines MINGW, which is used mostly because
+uses its own include files (related to Cygwin), which have a few
+things messed up.
+
+
+Formerly, we had a whole host of flags. Here's the conversion, for porting
+code from GNU Emacs and such:
+
+
+WINDOWSNT -> WIN32_NATIVE
+WIN32 -> WIN32_NATIVE
+_WIN32 -> WIN32_NATIVE
+HAVE_WIN32 -> WIN32_NATIVE
+DOS_NT -> WIN32_NATIVE
+HAVE_NTGUI -> WIN32_NATIVE, unless it ends up already bracketed by this
+HAVE_FACES -> always true
+MSDOS -> determine whether this code is really specific to MS-DOS (and not
+ Windows -- e.g. DJGPP code); if so, delete the code; otherwise,
+ convert to WIN32_NATIVE (we do not support MS-DOS w/DOS Extender
+ under XEmacs)
+
+__CYGWIN__ -> CYGWIN
+__CYGWIN32__ -> CYGWIN
+__MINGW32__ -> MINGW
+
+*/
+
+/* Identify ourselves */
+#ifndef WIN32_NATIVE
+#define WIN32_NATIVE
#endif
/* In case non-Microsoft compiler is used, we fake _MSC_VER */
#define HAVE_H_ERRNO
#define HAVE_STRUCT_UTIMBUF
-#ifdef HAVE_NTGUI
-#define HAVE_WINDOW_SYSTEM
-#define HAVE_FACES
-#endif
-
#define HAVE_STRCASECMP
/* Compatibility macros. Some used to be routines in nt.c */
/* We now have emulation for some signals */
#define HAVE_SIGHOLD
-#define sigset(s,h) msw_sigset(s,h)
-#define sighold(s) msw_sighold(s)
-#define sigrelse(s) msw_sigrelse(s)
-#define sigpause(s) msw_sigpause(s)
+#define sigset(s,h) mswindows_sigset(s,h)
+#define sighold(s) mswindows_sighold(s)
+#define sigrelse(s) mswindows_sigrelse(s)
+#define sigpause(s) mswindows_sigpause(s)
/* Defines that we need that aren't in the standard signal.h */
#define SIGHUP 1 /* Hang up */
#define SIGALRM 14 /* Alarm */
#define SIGPROF 29 /* Profiling timer exp */
-/* For integration with MSDOS support. */
-#define getdisk() (_getdrive () - 1)
-#define getdefdir(_drv, _buf) _getdcwd (_drv, _buf, MAXPATHLEN)
-
/* Defines size_t and alloca (). */
#include <malloc.h>
#define DECLARE_DOESNT_RETURN_GCC_ATTRIBUTE_SYNTAX_SUCKS(decl,str,idx) \
__declspec(noreturn) extern void decl PRINTF_ARGS(str,idx)
#endif /* MSVC 6.0 */
+
+#define CORRECT_DIR_SEPS(s) \
+ do { if ('/' == DIRECTORY_SEP) dostounix_filename (s); \
+ else unixtodos_filename (s); \
+ } while (0)
/* Synched up with: Not in FSF. */
#include <config.h>
-#include <limits.h>
#include "lisp.h"
#include "console-msw.h"
Written by Kevin Gallo for FSF Emacs.
Rewritten for mswindows by Jonathan Harris, December 1997 for 21.0.
- */
-
+ Hacked by Alastair Houghton, July 2000 for enhanced clipboard support.
+*/
#include <config.h>
#include "lisp.h"
#include "frame.h"
#include "select.h"
+#include "opaque.h"
+#include "file-coding.h"
+#include "buffer.h"
#include "console-msw.h"
+/* A list of handles that we must release. Not accessible from Lisp. */
+static Lisp_Object Vhandle_alist;
+
+/* Test if this is an X symbol that we understand */
+static int
+x_sym_p (Lisp_Object value)
+{
+ if (NILP (value) || INTP (value))
+ return 0;
+
+ /* Check for some of the X symbols */
+ if (EQ (value, QSTRING)) return 1;
+ if (EQ (value, QTEXT)) return 1;
+ if (EQ (value, QCOMPOUND_TEXT)) return 1;
+
+ return 0;
+}
+
+/* This converts a Lisp symbol to an MS-Windows clipboard format.
+ We have symbols for all predefined clipboard formats, but that
+ doesn't mean we support them all ;-)
+ The name of this function is actually a lie - it also knows about
+ integers and strings... */
+static UINT
+symbol_to_ms_cf (Lisp_Object value)
+{
+ /* If it's NIL, we're in trouble. */
+ if (NILP (value)) return 0;
+
+ /* If it's an integer, assume it's a format ID */
+ if (INTP (value)) return (UINT) (XINT (value));
+
+ /* If it's a string, register the format(!) */
+ if (STRINGP (value))
+ return RegisterClipboardFormat (XSTRING_DATA (value));
+
+ /* Check for Windows clipboard format symbols */
+ if (EQ (value, QCF_TEXT)) return CF_TEXT;
+ if (EQ (value, QCF_BITMAP)) return CF_BITMAP;
+ if (EQ (value, QCF_METAFILEPICT)) return CF_METAFILEPICT;
+ if (EQ (value, QCF_SYLK)) return CF_SYLK;
+ if (EQ (value, QCF_DIF)) return CF_DIF;
+ if (EQ (value, QCF_TIFF)) return CF_TIFF;
+ if (EQ (value, QCF_OEMTEXT)) return CF_OEMTEXT;
+ if (EQ (value, QCF_DIB)) return CF_DIB;
+ if (EQ (value, QCF_PALETTE)) return CF_PALETTE;
+ if (EQ (value, QCF_PENDATA)) return CF_PENDATA;
+ if (EQ (value, QCF_RIFF)) return CF_RIFF;
+ if (EQ (value, QCF_WAVE)) return CF_WAVE;
+ if (EQ (value, QCF_UNICODETEXT)) return CF_UNICODETEXT;
+ if (EQ (value, QCF_ENHMETAFILE)) return CF_ENHMETAFILE;
+ if (EQ (value, QCF_HDROP)) return CF_HDROP;
+ if (EQ (value, QCF_LOCALE)) return CF_LOCALE;
+ if (EQ (value, QCF_OWNERDISPLAY)) return CF_OWNERDISPLAY;
+ if (EQ (value, QCF_DSPTEXT)) return CF_DSPTEXT;
+ if (EQ (value, QCF_DSPBITMAP)) return CF_DSPBITMAP;
+ if (EQ (value, QCF_DSPMETAFILEPICT)) return CF_DSPMETAFILEPICT;
+ if (EQ (value, QCF_DSPENHMETAFILE)) return CF_DSPENHMETAFILE;
+
+ return 0;
+}
+
+/* This converts an MS-Windows clipboard format to its corresponding
+ Lisp symbol, or a Lisp integer otherwise. */
+static Lisp_Object
+ms_cf_to_symbol (UINT format)
+{
+ switch (format)
+ {
+ case CF_TEXT: return QCF_TEXT;
+ case CF_BITMAP: return QCF_BITMAP;
+ case CF_METAFILEPICT: return QCF_METAFILEPICT;
+ case CF_SYLK: return QCF_SYLK;
+ case CF_DIF: return QCF_DIF;
+ case CF_TIFF: return QCF_TIFF;
+ case CF_OEMTEXT: return QCF_OEMTEXT;
+ case CF_DIB: return QCF_DIB;
+ case CF_PALETTE: return QCF_PALETTE;
+ case CF_PENDATA: return QCF_PENDATA;
+ case CF_RIFF: return QCF_RIFF;
+ case CF_WAVE: return QCF_WAVE;
+ case CF_UNICODETEXT: return QCF_UNICODETEXT;
+ case CF_ENHMETAFILE: return QCF_ENHMETAFILE;
+ case CF_HDROP: return QCF_HDROP;
+ case CF_LOCALE: return QCF_LOCALE;
+ case CF_OWNERDISPLAY: return QCF_OWNERDISPLAY;
+ case CF_DSPTEXT: return QCF_DSPTEXT;
+ case CF_DSPBITMAP: return QCF_DSPBITMAP;
+ case CF_DSPMETAFILEPICT: return QCF_DSPMETAFILEPICT;
+ case CF_DSPENHMETAFILE: return QCF_DSPENHMETAFILE;
+ default: return make_int ((int) format);
+ }
+}
+
+/* Test if the specified clipboard format is auto-released by the OS. If
+ not, we must remember the handle on Vhandle_alist, and free it if
+ the clipboard is emptied or if we set data with the same format. */
+static int
+cf_is_autofreed (UINT format)
+{
+ switch (format)
+ {
+ /* This list comes from the SDK documentation */
+ case CF_DSPENHMETAFILE:
+ case CF_DSPMETAFILEPICT:
+ case CF_ENHMETAFILE:
+ case CF_BITMAP:
+ case CF_DSPBITMAP:
+ case CF_PALETTE:
+ case CF_DIB:
+ case CF_DSPTEXT:
+ case CF_OEMTEXT:
+ case CF_TEXT:
+ case CF_UNICODETEXT:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
+
+/* Do protocol to assert ourself as a selection owner.
+
+ Under mswindows, we:
-/* Do protocol to assert ourself as a selection owner. Under mswindows
-this is easy, we just set the clipboard. */
+ * Only set the clipboard if (eq selection-name 'CLIPBOARD)
+
+ * Check if an X atom name has been passed. If so, convert to CF_TEXT
+ (or CF_UNICODETEXT) remembering to perform LF -> CR-LF conversion.
+
+ * Otherwise assume the data is formatted appropriately for the data type
+ that was passed.
+
+ Then set the clipboard as necessary.
+*/
static Lisp_Object
mswindows_own_selection (Lisp_Object selection_name,
- Lisp_Object selection_value)
+ Lisp_Object selection_value,
+ Lisp_Object how_to_add,
+ Lisp_Object selection_type)
{
- Lisp_Object converted_value = get_local_selection (selection_name, QSTRING);
-
- if (!NILP (converted_value) &&
- CONSP (converted_value) &&
- EQ (XCAR (converted_value), QSTRING) &&
- /* pure mswindows behaviour only says we can own the selection
- if it is the clipboard */
- EQ (selection_name, QCLIPBOARD))
- {
- int rawsize, size, i;
- unsigned char *src, *dst, *next;
- HGLOBAL h = NULL;
- struct frame *f = NULL;
- struct gcpro gcpro1, gcpro2;
- Lisp_Object string = XCDR (converted_value);
-
- GCPRO2 (converted_value, string);
-
- CHECK_STRING (string);
-
- /* Calculate size with LFs converted to CRLFs because
- * CF_TEXT format uses CRLF delimited ASCIIZ */
- src = XSTRING_DATA (string);
- size = rawsize = XSTRING_LENGTH (string) + 1;
- for (i=0; i<rawsize; i++)
- if (src[i] == '\n')
- size++;
-
- f = selected_frame ();
- if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
- {
- UNGCPRO;
- return Qnil;
- }
+ HGLOBAL hValue = NULL;
+ UINT cfType;
+ int is_X_type = FALSE;
+ Lisp_Object cfObject;
+ Lisp_Object data = Qnil;
+ int size;
+ void *src, *dst;
+ struct frame *f = NULL;
+
+ /* Only continue if we're trying to set the clipboard - mswindows doesn't
+ use the same selection model as X */
+ if (!EQ (selection_name, QCLIPBOARD))
+ return Qnil;
- /* This call to EmptyClipboard may post an event back to us if
- we already own the clipboard (to tell us we lost it) and this
- event may execute random lisp code. Hence we must protect
- the string and get its address again after the call. */
- if (!EmptyClipboard () ||
- (h = GlobalAlloc (GMEM_MOVEABLE | GMEM_DDESHARE, size)) == NULL ||
- (dst = (unsigned char *) GlobalLock (h)) == NULL)
+ /* If this is one of the X-style atom name symbols, or NIL, convert it
+ as appropriate */
+ if (NILP (selection_type) || x_sym_p (selection_type))
+ {
+ /* Should COMPOUND_TEXT map to CF_UNICODETEXT? */
+ cfType = CF_TEXT;
+ cfObject = QCF_TEXT;
+ is_X_type = TRUE;
+ }
+ else
+ {
+ cfType = symbol_to_ms_cf (selection_type);
+
+ /* Only continue if we can figure out a clipboard type */
+ if (!cfType)
+ return Qnil;
+
+ cfObject = selection_type;
+ }
+
+ /* Convert things appropriately */
+ data = select_convert_out (selection_name,
+ cfObject,
+ selection_value);
+
+ if (NILP (data))
+ return Qnil;
+
+ if (CONSP (data))
+ {
+ if (!EQ (XCAR (data), cfObject))
+ cfType = symbol_to_ms_cf (XCAR (data));
+
+ if (!cfType)
+ return Qnil;
+
+ data = XCDR (data);
+ }
+
+ /* We support opaque or string values, but we only mention string
+ values for now... */
+ if (!OPAQUEP (data)
+ && !STRINGP (data))
+ return Qnil;
+
+ /* Compute the data length */
+ if (OPAQUEP (data))
+ size = XOPAQUE_SIZE (data);
+ else
+ size = XSTRING_LENGTH (data) + 1;
+
+ /* Find the frame */
+ f = selected_frame ();
+
+ /* Open the clipboard */
+ if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
+ return Qnil;
+
+ /* Allocate memory */
+ hValue = GlobalAlloc (GMEM_DDESHARE | GMEM_MOVEABLE, size);
+
+ if (!hValue)
+ {
+ CloseClipboard ();
+
+ return Qnil;
+ }
+
+ /* Copy the data */
+ if (OPAQUEP (data))
+ src = XOPAQUE_DATA (data);
+ else
+ src = XSTRING_DATA (data);
+
+ dst = GlobalLock (hValue);
+
+ if (!dst)
+ {
+ GlobalFree (hValue);
+ CloseClipboard ();
+
+ return Qnil;
+ }
+
+ memcpy (dst, src, size);
+
+ GlobalUnlock (hValue);
+
+ /* Empty the clipboard if we're replacing everything */
+ if (NILP (how_to_add) || EQ (how_to_add, Qreplace_all))
+ {
+ if (!EmptyClipboard ())
{
- if (h != NULL) GlobalFree (h);
CloseClipboard ();
- UNGCPRO;
+ GlobalFree (hValue);
+
return Qnil;
}
- src = XSTRING_DATA (string);
+ }
+
+ /* Append is currently handled in select.el; perhaps this should change,
+ but it only really makes sense for ordinary text in any case... */
- /* Convert LFs to CRLFs */
- do
+ SetClipboardData (cfType, hValue);
+
+ if (!cf_is_autofreed (cfType))
+ {
+ Lisp_Object alist_elt = Qnil, rest;
+ Lisp_Object cfType_int = make_int (cfType);
+
+ /* First check if there's an element in the alist for this type
+ already. */
+ alist_elt = assq_no_quit (cfType_int, Vhandle_alist);
+
+ /* Add an element to the alist */
+ Vhandle_alist = Fcons (Fcons (cfType_int, make_opaque_ptr (hValue)),
+ Vhandle_alist);
+
+ if (!NILP (alist_elt))
{
- /* copy next line or remaining bytes including '\0' */
- next = (char*) memccpy (dst, src, '\n', rawsize);
- if (next)
- {
- /* copied one line ending with '\n' */
- int copied = next - dst;
- rawsize -= copied;
- src += copied;
- /* insert '\r' before '\n' */
- next[-1] = '\r';
- next[0] = '\n';
- dst = next+1;
- }
+ /* Free the original handle */
+ GlobalFree ((HGLOBAL) get_opaque_ptr (XCDR (alist_elt)));
+
+ /* Remove the original one (adding first makes life easier, because
+ we don't have to special case this being the first element) */
+ for (rest = Vhandle_alist; !NILP (rest); rest = Fcdr (rest))
+ if (EQ (cfType_int, Fcar (XCDR (rest))))
+ {
+ XCDR (rest) = Fcdr (XCDR (rest));
+ break;
+ }
}
- while (next);
-
- GlobalUnlock (h);
+ }
- i = (SetClipboardData (CF_TEXT, h) != NULL);
+ CloseClipboard ();
+
+ /* #### Should really return a time, though this is because of the
+ X model (by the looks of things) */
+ return Qnil;
+}
+
+static Lisp_Object
+mswindows_available_selection_types (Lisp_Object selection_name)
+{
+ Lisp_Object types = Qnil;
+ UINT format = 0;
+ struct frame *f = NULL;
+
+ if (!EQ (selection_name, QCLIPBOARD))
+ return Qnil;
- CloseClipboard ();
+ /* Find the frame */
+ f = selected_frame ();
- UNGCPRO;
- /* #### we are supposed to return a time! */
- /* return i ? Qt : Qnil; */
- return Qnil;
- }
+ /* Open the clipboard */
+ if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
+ return Qnil;
+
+ /* #### ajh - Should there be an unwind-protect handler around this?
+ It could (well it probably won't, but it's always better to
+ be safe) run out of memory and leave the clipboard open... */
+
+ while ((format = EnumClipboardFormats (format)))
+ types = Fcons (ms_cf_to_symbol (format), types);
+
+ /* Close it */
+ CloseClipboard ();
+
+ return types;
+}
+
+static Lisp_Object
+mswindows_register_selection_data_type (Lisp_Object type_name)
+{
+ /* Type already checked in select.c */
+ const char *name = XSTRING_DATA (type_name);
+ UINT format;
+ format = RegisterClipboardFormat (name);
+
+ if (format)
+ return make_int ((int) format);
+ else
+ return Qnil;
+}
+
+static Lisp_Object
+mswindows_selection_data_type_name (Lisp_Object type_id)
+{
+ UINT format;
+ int numchars;
+ char name_buf[128];
+
+ /* If it's an integer, convert to a symbol if appropriate */
+ if (INTP (type_id))
+ type_id = ms_cf_to_symbol (XINT (type_id));
+
+ /* If this is a symbol, return it */
+ if (SYMBOLP (type_id))
+ return type_id;
+
+ /* Find the format code */
+ format = symbol_to_ms_cf (type_id);
+
+ if (!format)
+ return Qnil;
+
+ /* Microsoft, stupid Microsoft */
+ numchars = GetClipboardFormatName (format, name_buf, 128);
+
+ if (numchars)
+ {
+ Lisp_Object name;
+
+ /* Do this properly - though we could support UNICODE (UCS-2) if
+ MULE could hack it. */
+ name = make_ext_string (name_buf, numchars,
+ Fget_coding_system (Qraw_text));
+
+ return name;
+ }
+
return Qnil;
}
mswindows_get_foreign_selection (Lisp_Object selection_symbol,
Lisp_Object target_type)
{
- if (EQ (selection_symbol, QCLIPBOARD))
+ HGLOBAL hValue = NULL;
+ UINT cfType;
+ Lisp_Object cfObject = Qnil, ret = Qnil, value = Qnil;
+ int is_X_type = FALSE;
+ int size;
+ void *data;
+ struct frame *f = NULL;
+ struct gcpro gcpro1;
+
+ /* Only continue if we're trying to read the clipboard - mswindows doesn't
+ use the same selection model as X */
+ if (!EQ (selection_symbol, QCLIPBOARD))
+ return Qnil;
+
+ /* If this is one fo the X-style atom name symbols, or NIL, convert it
+ as appropriate */
+ if (NILP (target_type) || x_sym_p (target_type))
+ {
+ /* Should COMPOUND_TEXT map to CF_UNICODETEXT? */
+ cfType = CF_TEXT;
+ cfObject = QCF_TEXT;
+ is_X_type = TRUE;
+ }
+ else
{
- HANDLE h;
- unsigned char *src, *dst, *next;
- Lisp_Object ret = Qnil;
+ cfType = symbol_to_ms_cf (target_type);
- if (!OpenClipboard (NULL))
+ /* Only continue if we can figure out a clipboard type */
+ if (!cfType)
return Qnil;
- if ((h = GetClipboardData (CF_TEXT)) != NULL &&
- (src = (unsigned char *) GlobalLock (h)) != NULL)
- {
- int i;
- int size, rawsize;
- size = rawsize = strlen (src);
-
- for (i=0; i<rawsize; i++)
- if (src[i] == '\r' && src[i+1] == '\n')
- size--;
-
- /* Convert CRLFs to LFs */
- ret = make_uninit_string (size);
- dst = XSTRING_DATA (ret);
- do
- {
- /* copy next line or remaining bytes excluding '\0' */
- next = (unsigned char *) memccpy (dst, src, '\r', rawsize);
- if (next)
- {
- /* copied one line ending with '\r' */
- int copied = next - dst;
- rawsize -= copied;
- src += copied;
- if (*src == '\n')
- dst += copied - 1; /* overwrite '\r' */
- else
- dst += copied;
- }
- }
- while (next);
-
- GlobalUnlock (h);
- }
+ cfObject = ms_cf_to_symbol (cfType);
+ }
+ /* Find the frame */
+ f = selected_frame ();
+
+ /* Open the clipboard */
+ if (!OpenClipboard (FRAME_MSWINDOWS_HANDLE (f)))
+ return Qnil;
+
+ /* Read the clipboard */
+ hValue = GetClipboardData (cfType);
+
+ if (!hValue)
+ {
CloseClipboard ();
- return ret;
+ return Qnil;
}
+
+ /* Find the data */
+ size = GlobalSize (hValue);
+ data = GlobalLock (hValue);
+
+ if (!data)
+ {
+ CloseClipboard ();
+
+ return Qnil;
+ }
+
+ /* Place it in a Lisp string */
+ TO_INTERNAL_FORMAT (DATA, (data, size),
+ LISP_STRING, ret,
+ Qbinary);
+
+ GlobalUnlock (data);
+ CloseClipboard ();
+
+ GCPRO1 (ret);
+
+ /* Convert this to the appropriate type. If we can't find anything,
+ then we return a cons of the form (DATA-TYPE . STRING), where the
+ string contains the raw binary data. */
+ value = select_convert_in (selection_symbol,
+ cfObject,
+ ret);
+
+ UNGCPRO;
+
+ if (NILP (value))
+ return Fcons (cfObject, ret);
else
- return Qnil;
+ return value;
}
static void
}
}
+void
+mswindows_destroy_selection (Lisp_Object selection)
+{
+ Lisp_Object alist_elt;
+
+ /* Do nothing if this isn't for the clipboard. */
+ if (!EQ (selection, QCLIPBOARD))
+ return;
+
+ /* Right. We need to delete everything in Vhandle_alist. */
+ alist_elt = Vhandle_alist;
+
+ for (alist_elt; !NILP (alist_elt); alist_elt = Fcdr (alist_elt))
+ GlobalFree ((HGLOBAL) get_opaque_ptr (XCDR (alist_elt)));
+
+ Vhandle_alist = Qnil;
+}
+
static Lisp_Object
-mswindows_selection_exists_p (Lisp_Object selection)
+mswindows_selection_exists_p (Lisp_Object selection,
+ Lisp_Object selection_type)
{
+ /* We used to be picky about the format, but now we support anything. */
if (EQ (selection, QCLIPBOARD))
- return IsClipboardFormatAvailable (CF_TEXT) ? Qt : Qnil;
+ {
+ if (NILP (selection_type))
+ return CountClipboardFormats () ? Qt : Qnil;
+ else
+ return IsClipboardFormatAvailable (symbol_to_ms_cf (selection_type))
+ ? Qt : Qnil;
+ }
else
return Qnil;
}
CONSOLE_HAS_METHOD (mswindows, disown_selection);
CONSOLE_HAS_METHOD (mswindows, selection_exists_p);
CONSOLE_HAS_METHOD (mswindows, get_foreign_selection);
+ CONSOLE_HAS_METHOD (mswindows, available_selection_types);
+ CONSOLE_HAS_METHOD (mswindows, register_selection_data_type);
+ CONSOLE_HAS_METHOD (mswindows, selection_data_type_name);
}
void
void
vars_of_select_mswindows (void)
{
+ /* Initialise Vhandle_alist */
+ Vhandle_alist = Qnil;
+ staticpro (&Vhandle_alist);
}
02111-1307, USA.*/
#include <config.h>
-#include <stdio.h>
#include "lisp.h"
+
#include <unistd.h>
#include <sheap-adjust.h>
int static_heap_initialized=0;
int static_heap_dumped=0;
+void* more_static_core ( ptrdiff_t increment );
void* more_static_core ( ptrdiff_t increment )
{
int size = (int) increment;
static_heap_ptr=static_heap_base;
static_heap_size=STATIC_HEAP_SIZE -
(static_heap_base-static_heap_buffer);
-#ifdef __CYGWIN32__
+#ifdef CYGWIN
sbrk(BLOCKSIZE); /* force space for fork to work */
#endif
static_heap_initialized=1;
fclose (stream);
}
+void report_sheap_usage (int die_if_pure_storage_exceeded);
void
report_sheap_usage (int die_if_pure_storage_exceeded)
{
#include "syssignal.h"
#include "systime.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <errno.h>
+#include "sysfile.h"
/* Set to 1 when a quit-check signal (either a SIGIO interrupt or
the asynch. timeout for poll-for-quit) occurs. The QUITP
it needs to stay the way it is. */
quit_check_signal_happened = 1;
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
can_break_system_calls = 0;
#else
/* can_break_system_calls is set when we want to break out of
#include "redisplay.h"
#include "sysdep.h"
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
+#include "sysfile.h"
#ifdef HAVE_NATIVE_SOUND
-# include <netdb.h>
+# include "sysproc.h"
# include "nativesound.h"
#endif
/* variable `sound' is anything that can be a cdr in sound-alist */
Lisp_Object new_volume, pitch, duration, data;
int loop_count = 0;
- int vol, pit, dur, succes;
+ int vol, pit, dur;
struct device *d = decode_device (device);
/* NOTE! You'd better not signal an error in here. */
{
Extbyte *soundext;
Extcount soundextlen;
+ int succes;
TO_EXTERNAL_FORMAT (LISP_STRING, sound, ALLOCA, (soundext, soundextlen),
Qbinary);
{
const Extbyte *soundext;
Extcount soundextlen;
+ int succes;
TO_EXTERNAL_FORMAT (LISP_STRING, sound,
ALLOCA, (soundext, soundextlen),
#include "rangetab.h"
Lisp_Object Qspecifierp;
-Lisp_Object Qprepend, Qappend, Qremove_tag_set_prepend, Qremove_tag_set_append;
+Lisp_Object Qprepend, Qremove_tag_set_prepend, Qremove_tag_set_append;
Lisp_Object Qremove_locale, Qremove_locale_type, Qremove_all;
Lisp_Object Qfallback;
/* locales are defined in general.c. */
defsymbol (&Qprepend, "prepend");
- defsymbol (&Qappend, "append");
defsymbol (&Qremove_tag_set_prepend, "remove-tag-set-prepend");
defsymbol (&Qremove_tag_set_append, "remove-tag-set-append");
defsymbol (&Qremove_locale, "remove-locale");
time_t mktime ();
#endif
-#if defined(WINDOWSNT) || defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
#include <time.h>
#else
#if defined(HAVE_TZNAME)
extern char *tzname[2];
#endif
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#ifdef emacs
#define strftime emacs_strftime
}
#if !defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME)
+char *zone_name (const struct tm *tp);
char *
zone_name (const struct tm *tp)
{
#include <config.h>
-#ifdef WINDOWSNT
-#include <direct.h>
-#ifdef __MINGW32__
+#ifdef WIN32_NATIVE
+#ifdef MINGW
#include <mingw32/process.h>
#else
/* <process.h> should not conflict with "process.h", as per ANSI definition.
which will conflict with the macro defined in lisp.h
*/
#include <../include/process.h>
-#endif /* __MINGW32__ */
-#endif /* WINDOWSNT */
+#endif /* MINGW */
+#endif /* WIN32_NATIVE */
#include "lisp.h"
-#include <stdlib.h>
-
/* ------------------------------- */
/* basic includes */
/* ------------------------------- */
#include "syswait.h"
#include "sysdir.h"
#include "systime.h"
-#if defined(WINDOWSNT) || defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
#include "syssignal.h"
#endif
-#ifndef WINDOWSNT
+
+#include "sysproc.h"
+
+#ifndef WIN32_NATIVE
#include <sys/times.h>
#endif
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <sys/utime.h>
#include "ntheap.h"
+#include "nt.h"
#endif
/* ------------------------------- */
#endif /* NO_SUBPROCESSES */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
void wait_for_termination (HANDLE pHandle)
#else
void wait_for_termination (int pid)
Since implementations may add their own error indicators on top,
we ignore it by default. */
-#elif defined (WINDOWSNT)
+#elif defined (WIN32_NATIVE)
int ret = 0, status = 0;
if (pHandle == NULL)
{
Try defining BROKEN_WAIT_FOR_SIGNAL. */
EMACS_WAIT_FOR_SIGNAL (SIGCHLD);
}
-#else /* not HAVE_WAITPID and not WINDOWSNT and (not EMACS_BLOCK_SIGNAL or BROKEN_WAIT_FOR_SIGNAL) */
+#else /* not HAVE_WAITPID and not WIN32_NATIVE and (not EMACS_BLOCK_SIGNAL or BROKEN_WAIT_FOR_SIGNAL) */
/* This approach is kind of cheesy but is guaranteed(?!) to work
for all systems. */
while (1)
#endif
}
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
/* Set up the terminal at the other end of a pseudo-terminal that
we will be controlling an inferior through.
It should not echo or do line-editing, since that is done
}
#endif /* RTU */
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#endif /* not NO_SUBPROCESSES */
}
}
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
pid_t
sys_getpid (void)
return abs (getpid ());
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
/* Fork a subshell. */
static void
sys_subshell (void)
{
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
int pid;
#endif
struct save_signal saved_handlers[5];
str[len] = 0;
xyzzy:
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
pid = fork ();
if (pid == -1)
error ("Can't spawn subshell");
if (pid == 0)
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
{
char *sh = 0;
if (str)
sys_chdir (str);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Waits for process completion */
if (_spawnlp (_P_WAIT, sh, sh, NULL) != 0)
wait_for_termination (pid);
restore_signal_handlers (saved_handlers);
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
}
assert (DEVICE_TTY_P (d));
{
int input_fd = CONSOLE_TTY_DATA (con)->infd;
-#if defined (WINDOWSNT)
+#if defined (WIN32_NATIVE)
DEVICE_TTY_DATA (d)->ospeed = 15;
#elif defined (HAVE_TERMIOS)
struct termios sg;
/* It's wrong to encase these into #ifdef HAVE_TTY because we need
them for child TTY processes. */
/* However, this does break NT support while we don't do child TTY processes */
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
/* Set *TC to the parameters associated with the terminal FD.
Return zero if all's well, or -1 if we ran into an error we
if (ioctl (fd, TCGETA, &settings->main) < 0)
return -1;
-#elif !defined (WINDOWSNT)
+#elif !defined (WIN32_NATIVE)
/* I give up - I hope you have the BSD ioctls. */
if (ioctl (fd, TIOCGETP, &settings->main) < 0)
return -1;
if (ioctl (fd, flushp ? TCSETAF : TCSETAW, &settings->main) < 0)
return -1;
-#elif !defined (WINDOWSNT)
+#elif !defined (WIN32_NATIVE)
/* I give up - I hope you have the BSD ioctls. */
if (ioctl (fd, (flushp) ? TIOCSETP : TIOCSETN, &settings->main) < 0)
return -1;
return 0;
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
\f
/* ------------------------------------------------------ */
/* Initializing a device */
tty.main.c_iflag &= ~BRKINT;
#endif /* AIX */
#else /* if not HAVE_TERMIO */
-#if !defined (WINDOWSNT)
+#if !defined (WIN32_NATIVE)
con->tty_erase_char = make_char (tty.main.sg_erase);
tty.main.sg_flags &= ~(ECHO | CRMOD | XTABS);
if (TTY_FLAGS (con).meta_key)
tty.main.sg_flags |= ANYP;
/* #### should we be using RAW mode here? */
tty.main.sg_flags |= /* interrupt_input ? RAW : */ CBREAK;
-#endif /* not WINDOWSNT */
+#endif /* not WIN32_NATIVE */
#endif /* not HAVE_TERMIO */
/* If going to use CBREAK mode, we must request C-g to interrupt
#if !defined(HAVE_TEXT_START) && !defined(PDUMP)
-#ifdef __cplusplus
- extern "C" int _start (void);
-#else
- extern int _start (void);
-#endif
+EXTERN_C int _start (void);
char *
start_of_text (void)
{
#ifdef TEXT_START
- return ((char *) TEXT_START);
+ return (char *) TEXT_START;
#else
-#ifdef GOULD
- extern csrt ();
- return ((char *) csrt);
-#else /* not GOULD */
- return ((char *) _start);
-#endif /* GOULD */
+ return (char *) _start;
#endif /* TEXT_START */
}
#endif /* !defined(HAVE_TEXT_START) && !defined(PDUMP) */
*
*/
-#if defined(ORDINARY_LINK) && !defined(__MINGW32__)
+#if defined(ORDINARY_LINK) && !defined(MINGW)
extern char **environ;
#endif
extern Lisp_Object Vsystem_name;
-#ifdef HAVE_SOCKETS
-# include <sys/socket.h>
-# include <netdb.h>
-#endif /* HAVE_SOCKETS */
-
void
init_system_name (void)
{
-#if defined (WINDOWSNT)
+#if defined (WIN32_NATIVE)
char hostname [MAX_COMPUTERNAME_LENGTH + 1];
size_t size = sizeof (hostname);
GetComputerName (hostname, &size);
#endif /* ! HAVE_STRERROR */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
struct errentry {
unsigned long oscode; /* Win32 error */
mswindows_set_errno (GetLastError ());
}
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
\f
/************************************************************************/
PATHNAME_CONVERT_OUT (path);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Make all handles non-inheritable */
oflag |= _O_NOINHERIT;
#endif
PATHNAME_CONVERT_OUT (nonreloc);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Make all handles non-inheritable */
oflag |= _O_NOINHERIT;
#endif
sys_fopen (const char *path, const char *type)
{
PATHNAME_CONVERT_OUT (path);
-#if defined (WINDOWSNT)
+#if defined (WIN32_NATIVE)
{
int fd;
int oflag;
sys_mkdir (const char *path, mode_t mode)
{
PATHNAME_CONVERT_OUT (path);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
return mkdir (path);
#else
return mkdir (path, mode);
}
#endif /* ENCAPSULATE_READLINK */
-
#ifdef ENCAPSULATE_FSTAT
int
sys_fstat (int fd, struct stat *buf)
{
+#ifdef WIN32_NATIVE
+ return mswindows_fstat (fd, buf);
+#else
return fstat (fd, buf);
+#endif
}
#endif /* ENCAPSULATE_FSTAT */
-
#ifdef ENCAPSULATE_STAT
int
sys_stat (const char *path, struct stat *buf)
{
PATHNAME_CONVERT_OUT (path);
+#ifdef WIN32_NATIVE
+ return mswindows_stat (path, buf);
+#else
return stat (path, buf);
+#endif
}
#endif /* ENCAPSULATE_STAT */
-
/****************** file-manipulation calls *****************/
#ifdef ENCAPSULATE_CHMOD
{
PATHNAME_CONVERT_OUT (old);
PATHNAME_CONVERT_OUT (new);
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Windows rename fails if NEW exists */
if (rename (old, new) == 0)
return 0;
if (errno != EEXIST)
return -1;
unlink (new);
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
return rename (old, new);
}
#endif /* ENCAPSULATE_RENAME */
static int
get_process_times_1 (long *user_ticks, long *system_ticks)
{
-#if defined (_SC_CLK_TCK) || defined (CLK_TCK) && !defined(WINDOWSNT)
+#if defined (_SC_CLK_TCK) || defined (CLK_TCK) && !defined(WIN32_NATIVE)
/* We have the POSIX times() function available. */
struct tms tttt;
times (&tttt);
#if !defined (SYS_SIGLIST_DECLARED) && !defined (HAVE_SYS_SIGLIST)
-#if defined(WINDOWSNT) || defined(__CYGWIN32__)
+#if defined(WIN32_NATIVE) || defined(CYGWIN)
const char *sys_siglist[] =
{
"bum signal!!",
#include <setjmp.h>
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
extern char **environ;
#endif
/* Wait for subprocess with process id `pid' to terminate and
make sure it will get eliminated (not remain forever as a zombie) */
-#ifdef WINDOWSNT
-#include <windows.h>
-void wait_for_termination (HANDLE pid);
-#else
+#ifndef WIN32_NATIVE
void wait_for_termination (int pid);
#endif
const char *strerror (int);
#endif
-#ifdef WINDOWSNT
-void mswindows_set_errno (unsigned long win32_error);
-void mswindows_set_last_errno (void);
-#endif
-
int interruptible_open (const char *path, int oflag, int mode);
#ifndef HAVE_H_ERRNO
#ifdef SYSV_SYSTEM_DIR
# include <dirent.h>
+#elif defined (WIN32_NATIVE)
+# include <direct.h>
+# include "ndir.h"
#elif defined (NONSYSTEM_DIR_LIBRARY)
# include "ndir.h"
-#elif defined (MSDOS)
-# include <dirent.h>
#else
# include <sys/dir.h>
#endif /* not NONSYSTEM_DIR_LIBRARY */
Since applying strlen to the name always works, we'll just do that. */
#define NAMLEN(p) strlen (p->d_name)
-#ifdef MSDOS
-#define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
-#else
#define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
-#endif
/* encapsulation: directory calls */
{
return dld_get_symbol(n);
}
-#elif defined(_WINDOWS) || defined(WIN32)
+#elif defined (WIN32_NATIVE)
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef WIN32_LEAN_AND_MEAN
+
int
dll_init (const char *arg)
{
extern "C" {
#endif
-#if defined(WIN32)
+#if defined(WIN32_NATIVE)
#define DLLEXPORT __declspec(dllexport)
-#elif defined(_WINDOWS)
+#elif defined(WIN16)
#define DLLEXPORT FAR PASCAL _EXPORT
#else
#define DLLEXPORT
#define INCLUDED_sysfile_h_
#include <errno.h>
-#include <limits.h>
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#include <sys/errno.h> /* <errno.h> does not always imply this */
#endif
#ifndef makedev
#include <sys/types.h> /* some typedefs are used in sys/file.h */
#endif
+
+#ifndef WIN32_NATIVE
#include <sys/file.h>
+#endif
+
#include <sys/stat.h>
+
+#ifndef WIN32_NATIVE
#include <sys/param.h>
+#endif
-#if defined (NeXT) || defined(__CYGWIN32__)
+#if defined (NeXT) || defined(CYGWIN)
/* what is needed from here? Do others need it too?
O_BINARY is in here under cygwin. */
# include <sys/fcntl.h>
#endif /* NeXT */
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#include <io.h>
#include <direct.h>
#endif
#endif
#ifndef CREAT_MODE
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define CREAT_MODE (S_IREAD | S_IWRITE)
#else
#define CREAT_MODE (0666)
#endif
#endif
+#ifndef READ_PLUS_TEXT
+#ifdef O_TEXT
+#define READ_PLUS_TEXT "r+t"
+#else
+#define READ_PLUS_TEXT "r+"
+#endif
+#endif
+
+#ifndef READ_PLUS_BINARY
+#ifdef O_BINARY
+#define READ_PLUS_BINARY "r+b"
+#else
+#define READ_PLUS_BINARY "r+"
+#endif
+#endif
+
+#ifndef WRITE_TEXT
+#ifdef O_TEXT
+#define WRITE_TEXT "wt"
+#else
+#define WRITE_TEXT "w"
+#endif
+#endif
+
#ifndef WRITE_BINARY
#ifdef O_BINARY
#define WRITE_BINARY "wb"
# define MAXPATHLEN 1024
#endif
+/* The following definitions are needed under Windows, at least */
#ifndef X_OK
-# define X_OK 01
+# define X_OK 1
+#endif
+
+#ifndef R_OK
+# define R_OK 4
+#endif
+
+#ifndef W_OK
+# define W_OK 2
+#endif
+
+#ifndef F_OK
+# define F_OK 0
#endif
#ifndef FD_CLOEXEC
# define _NMAXLDBL THIS_FILENAME ## _nmaxldbl
# endif
-#if defined(MSDOS) || (defined(LINUX) && \
- !(defined (__GLIBC__) && (__GLIBC__ >= 2)))
+#if defined(LINUX) && !(defined (__GLIBC__) && (__GLIBC__ >= 2))
/* These are redefined (correctly, but differently) in values.h. */
#undef INTBITS
#undef LONGBITS
#include <math.h>
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* A quirky way to obtain logb prototype */
#include <float.h>
#define logb _logb
#include "systime.h" /* necessary for sys/resource.h; also gets the
FD_* defines on some systems. */
-#ifndef WINDOWSNT
+#ifndef WIN32_NATIVE
#include <sys/resource.h>
#endif
#ifdef HAVE_SOCKETS /* TCP connection support, if kernel can do it */
# include <sys/types.h> /* AJK */
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# include <arpa/inet.h>
-#ifdef NEED_NET_ERRNO_H
-#include <net/errno.h>
-#endif /* NEED_NET_ERRNO_H */
+# ifndef WIN32_NATIVE
+# include <sys/socket.h>
+# include <netdb.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+# endif
+# ifdef NEED_NET_ERRNO_H
+# include <net/errno.h>
+# endif /* NEED_NET_ERRNO_H */
#elif defined (SKTPAIR)
# include <sys/socket.h>
#endif /* HAVE_SOCKETS */
+#ifdef WIN32_NATIVE
+/* Note: winsock.h already included in systime.h above */
+/* map winsock error codes to standard names */
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EINPROGRESS WSAEINPROGRESS
+#define EALREADY WSAEALREADY
+#define ENOTSOCK WSAENOTSOCK
+#define EDESTADDRREQ WSAEDESTADDRREQ
+#define EMSGSIZE WSAEMSGSIZE
+#define EPROTOTYPE WSAEPROTOTYPE
+#define ENOPROTOOPT WSAENOPROTOOPT
+#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
+#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
+#define EOPNOTSUPP WSAEOPNOTSUPP
+#define EPFNOSUPPORT WSAEPFNOSUPPORT
+#define EAFNOSUPPORT WSAEAFNOSUPPORT
+#define EADDRINUSE WSAEADDRINUSE
+#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
+#define ENETDOWN WSAENETDOWN
+#define ENETUNREACH WSAENETUNREACH
+#define ENETRESET WSAENETRESET
+#define ECONNABORTED WSAECONNABORTED
+#define ECONNRESET WSAECONNRESET
+#define ENOBUFS WSAENOBUFS
+#define EISCONN WSAEISCONN
+#define ENOTCONN WSAENOTCONN
+#define ESHUTDOWN WSAESHUTDOWN
+#define ETOOMANYREFS WSAETOOMANYREFS
+#define ETIMEDOUT WSAETIMEDOUT
+#define ECONNREFUSED WSAECONNREFUSED
+#define ELOOP WSAELOOP
+/* #define ENAMETOOLONG WSAENAMETOOLONG */
+#define EHOSTDOWN WSAEHOSTDOWN
+#define EHOSTUNREACH WSAEHOSTUNREACH
+/* #define ENOTEMPTY WSAENOTEMPTY */
+#define EPROCLIM WSAEPROCLIM
+#define EUSERS WSAEUSERS
+#define EDQUOT WSAEDQUOT
+#define ESTALE WSAESTALE
+#define EREMOTE WSAEREMOTE
+#endif /* WIN32_NATIVE */
+
/* On some systems, e.g. DGUX, inet_addr returns a 'struct in_addr'. */
#ifdef HAVE_BROKEN_INET_ADDR
# define IN_ADDR struct in_addr
int poll_fds_for_input (SELECT_TYPE mask);
-#ifdef MSDOS
-/* #include <process.h> */
-/* Damn that local process.h! Instead we can define P_WAIT ourselves. */
-#define P_WAIT 1
-#endif
-
#endif /* INCLUDED_sysproc_h_ */
/* Synched up with: Not really in FSF. */
-#include <pwd.h>
+#ifndef WIN32_NATIVE
+# include <pwd.h>
+
+#else /* WIN32_NATIVE */
+
+struct passwd {
+ char *pw_name;
+ char *pw_passwd;
+ int pw_uid;
+ int pw_gid;
+ int pw_quota;
+ char *pw_gecos;
+ char *pw_dir;
+ char *pw_shell;
+};
+
+#endif /* WIN32_NATIVE */
#ifdef BSD
#define EMACS_KILLPG(gid, signo) killpg (gid, signo)
#else
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
#define EMACS_KILLPG(gid, signo) kill (gid, signo)
#else
#define EMACS_KILLPG(gid, signo) kill (-(gid), signo)
SIGTYPE memory_warning_signal (int sig);
#endif
-#ifdef WINDOWSNT
+#ifdef WIN32_NATIVE
/* Prototypes for signal functions, see nt.c */
-typedef void (__cdecl *msw_sighandler) (int);
-msw_sighandler msw_sigset (int sig, msw_sighandler handler);
-int msw_sighold (int nsig);
-int msw_sigrelse (int nsig);
-int msw_sigpause (int nsig);
-int msw_raise (int nsig);
-#endif /* _WIN32 */
+typedef void (__cdecl *mswindows_sighandler) (int);
+mswindows_sighandler mswindows_sigset (int sig, mswindows_sighandler handler);
+int mswindows_sighold (int nsig);
+int mswindows_sigrelse (int nsig);
+int mswindows_sigpause (int nsig);
+int mswindows_raise (int nsig);
+#endif /* WIN32_NATIVE */
#endif /* INCLUDED_syssignal_h_ */
#define INCLUDED_systime_h_
#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
+# include <sys/time.h>
+# include <time.h>
#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
#endif
/* select() is supposed to be (Unix98) defined in sys/time.h,
#include <unistd.h>
#endif
-#if defined(WINDOWSNT) && defined(HAVE_X_WINDOWS)
+#ifdef WIN32_NATIVE
+
+/* This defines struct timeval */
+#include <winsock.h>
+
+struct timezone
+ {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+ };
+
+#ifdef HAVE_X_WINDOWS
/* Provides gettimeofday etc */
#include <X11/Xw32defs.h>
#include <X11/Xos.h>
-#endif
+#else
+/* X11R6 on NT provides the single parameter version of this command */
+void gettimeofday (struct timeval *, struct timezone *);
+#endif /* HAVE_X_WINDOWS */
+
+#endif /* WIN32_NATIVE */
#ifdef HAVE_UTIME_H
# include <utime.h>
#endif
-#if defined(HAVE_TZNAME) && !defined(WINDOWSNT) && !defined(__CYGWIN32__)
+#if defined(HAVE_TZNAME) && !defined(WIN32_NATIVE) && !defined(CYGWIN)
#ifndef tzname /* For SGI. */
extern char *tzname[]; /* RS6000 and others want it this way. */
#endif
void get_process_times (double *user_time, double *system_time,
double *real_time);
-#if defined(WINDOWSNT) || defined(BROKEN_CYGWIN) || defined(__MINGW32__)
+#if defined(WIN32_NATIVE) || defined(BROKEN_CYGWIN)
/* setitimer emulation for Win32 (see nt.c) */
#define ITIMER_REAL 1
#define ITIMER_PROF 2
-#endif /* WINDOWSNT */
+#endif /* WIN32_NATIVE */
#endif /* INCLUDED_systime_h_ */
# include <fcntl.h>
# endif
-#elif defined (DOS_NT)
+#elif defined (WIN32_NATIVE)
-/***** (3) The MSDOS/NT way *****/
+/***** (3) The WIN32_NATIVE way *****/
/* Nothing doing */
/* Generally useful to include this file: */
/* But Sun OS has broken include files and doesn't want it included */
-#if !defined (DOS_NT) && !defined (WIN32) && !defined (SUNOS4)
+#if !defined (WIN32_NATIVE) && !defined (SUNOS4)
# include <sys/ioctl.h>
#endif
/* UNIPLUS systems may have FIONREAD. */
No big loss -- it just means that ^Z won't work right
if we're run from sh. */
# define EMACS_SET_PROCESS_GROUP(pg)
-#elif defined(__MINGW32__)
+#elif defined(MINGW)
# define EMACS_SEPARATE_PROCESS_GROUP()
#else
/* Under NeXTstep, a process group of 0 is not the same as specifying
#ifdef HAVE_TERMIO
struct termio main;
#else /* !HAVE_TERMIO */
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
int main;
-#else /* not DOS_NT */
+#else /* not WIN32_NATIVE */
struct sgttyb main;
-#endif /* not DOS_NT */
+#endif /* not WIN32_NATIVE */
#endif /* !HAVE_TERMIO */
#endif /* !HAVE_TCATTR */
#define EMACS_TTY_TABS_OK(p) (((p)->main.c_oflag & TABDLY) != TAB3)
#else /* neither HAVE_TERMIO nor HAVE_TERMIOS */
-#ifdef DOS_NT
+#ifdef WIN32_NATIVE
#define EMACS_TTY_TABS_OK(p) 0
-#else /* not DOS_NT */
+#else /* not WIN32_NATIVE */
#define EMACS_TTY_TABS_OK(p) (((p)->main.sg_flags & XTABS) != XTABS)
-#endif /* not DOS_NT */
+#endif /* not WIN32_NATIVE */
#endif /* not def HAVE_TERMIO */
#endif /* not def HAVE_TERMIOS */
if (lseek (_fd, _position, L_SET) != _position) \
fatal_unexec (_error_message, _error_arg);
-void *sbrk();
-
#define EEOF -1
static struct scnhdr *text_section;
};
-
/* Define name of label for entry point for the dumped executable. */
#ifndef DEFAULT_ENTRY_ADDRESS
#define DEFAULT_ENTRY_ADDRESS __start
#endif
+EXTERN_C int DEFAULT_ENTRY_ADDRESS (void);
+
\f
int
unexec (char *new_name, char *a_name,
nhdr.aout.bsize = 0;
if (entry_address == 0)
{
- extern int DEFAULT_ENTRY_ADDRESS (void);
nhdr.aout.entry = (unsigned long)DEFAULT_ENTRY_ADDRESS;
}
else
exit(-1); \
}
+void
+unexec (char *out_name, char *in_name, void *start_data,
+ void * d1, void * d2);
/* Dump out .data and .bss sections into a new executable. */
void unexec (char *out_name, char *in_name, void *start_data,
void * d1, void * d2)
int need_coff_header = 1;
#include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */
#else
-#ifdef MSDOS
-#if __DJGPP__ > 1
-#include <fcntl.h> /* for O_RDONLY, O_RDWR */
-#endif
-#include <coff.h>
-#define filehdr external_filehdr
-#define scnhdr external_scnhdr
-#define syment external_syment
-#define auxent external_auxent
-#define n_numaux e_numaux
-#define n_type e_type
-struct aouthdr
-{
- unsigned short magic; /* type of file */
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW bdry*/
- unsigned long dsize; /* initialized data " " */
- unsigned long bsize; /* uninitialized data " " */
- unsigned long entry; /* entry pt. */
- unsigned long text_start;/* base of text used for this file */
- unsigned long data_start;/* base of data used for this file */
-};
-
-
-#else /* not MSDOS */
#include <a.out.h>
-#endif /* not MSDOS */
#endif /* not COFF_ENCAPSULATE */
/* Define getpagesize if the system does not.
#else /* COFF, but not USG_SHARED_LIBRARIES */
-#ifdef MSDOS
-#if __DJGPP__ >= 2
- /* Dump the original table of exception handlers, not the one
- where our exception hooks are registered. */
- __djgpp_exception_toggle ();
-#endif
-#endif
-
lseek (new, (long) text_scnptr, 0);
ptr = (char *) f_ohdr.text_start;
#ifdef HEADER_INCL_IN_TEXT
end = ptr + f_ohdr.dsize;
write_segment (new, ptr, end);
-#ifdef MSDOS
-#if __DJGPP__ >= 2
- /* Restore our exception hooks. */
- __djgpp_exception_toggle ();
-#endif
-#endif
-
#endif /* USG_SHARED_LIBRARIES */
#else /* if not COFF */
if (!lnnoptr || !f_hdr.f_symptr)
return 0;
-#ifdef MSDOS
- if ((new = writedesc) < 0)
-#else
if ((new = open (new_name, O_RDWR)) < 0)
-#endif
{
PERROR (new_name);
return -1;
}
}
}
-#ifndef MSDOS
close (new);
-#endif
return 0;
}
PUCHAR bss_start = UNINIT_PTR;
DWORD bss_size = UNINIT_LONG;
-#ifdef HAVE_NTGUI
-HINSTANCE hinst = NULL;
-HINSTANCE hprevinst = NULL;
-LPSTR lpCmdLine = "";
-int nCmdShow = 0;
-#endif /* HAVE_NTGUI */
-
/* Startup code for running on NT. When we are running as the dumped
version, we need to bootstrap our heap and .bss section into our
address space before we can actually hand off control to the startup
hit and fix all the weirdities this causes us, the better --kkm */
#if 0
/* The default behavior is to treat files as binary and patch up
- text files appropriately, in accordance with the MSDOS code. */
+ text files appropriately. */
_fmode = O_BINARY;
#endif
SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE);
#endif
- /* Invoke the NT CRT startup routine now that our housecleaning
- is finished. */
-#ifdef HAVE_NTGUI
- /* determine WinMain args like crt0.c does */
- hinst = GetModuleHandle(NULL);
- lpCmdLine = GetCommandLine();
- nCmdShow = SW_SHOWDEFAULT;
-#endif
mainCRTStartup ();
}
POINTER cp;
unsigned long five_percent;
unsigned long data_size;
+ void (*save_warn_fun) (const char *);
if (lim_data == 0)
get_lim_data ();
data_size = (char *) cp - (char *) data_space_start;
if (warn_function)
- switch (warnlevel)
- {
- case 0:
- if (data_size > five_percent * 15)
- {
- warnlevel++;
- (*warn_function) ("Warning: past 75% of memory limit");
- }
- break;
-
- case 1:
- if (data_size > five_percent * 17)
- {
- warnlevel++;
- (*warn_function) ("Warning: past 85% of memory limit");
- }
- break;
-
- case 2:
- if (data_size > five_percent * 19)
- {
- warnlevel++;
- (*warn_function) ("Warning: past 95% of memory limit");
- }
- break;
-
- default:
- (*warn_function) ("Warning: past acceptable memory limits");
- break;
- }
+ {
+ /* temporarily reset the warn_function to 0 or we will get infinite
+ looping. */
+ save_warn_fun = warn_function;
+ warn_function = 0;
+ switch (warnlevel)
+ {
+ case 0:
+ if (data_size > five_percent * 15)
+ {
+ warnlevel++;
+ (*warn_function) ("Warning: past 75% of memory limit");
+ }
+ break;
+
+ case 1:
+ if (data_size > five_percent * 17)
+ {
+ warnlevel++;
+ (*warn_function) ("Warning: past 85% of memory limit");
+ }
+ break;
+
+ case 2:
+ if (data_size > five_percent * 19)
+ {
+ warnlevel++;
+ (*warn_function) ("Warning: past 95% of memory limit");
+ }
+ break;
+
+ default:
+ (*warn_function) ("Warning: past acceptable memory limits");
+ break;
+ }
+ warn_function = save_warn_fun;
+ }
/* If we go down below 70% full, issue another 75% warning
when we go up again. */
p->glyph_cachels = Dynarr_new (glyph_cachel);
p->line_start_cache = Dynarr_new (line_start_cache);
p->subwindow_instance_cache = make_lisp_hash_table (30,
- HASH_TABLE_KEY_WEAK,
+ HASH_TABLE_KEY_VALUE_WEAK,
HASH_TABLE_EQUAL);
p->line_cache_last_updated = Qzero;
INIT_DISP_VARIABLE (last_point_x, 0);
p->glyph_cachels = Dynarr_new (glyph_cachel);
p->subwindow_instance_cache =
make_lisp_hash_table (30,
- HASH_TABLE_KEY_WEAK,
+ HASH_TABLE_KEY_VALUE_WEAK,
HASH_TABLE_EQUAL);
/* Put new into window structure in place of window */
it up as needed. */
w->subwindow_instance_cache =
make_lisp_hash_table (30,
- HASH_TABLE_KEY_WEAK,
+ HASH_TABLE_KEY_VALUE_WEAK,
HASH_TABLE_EQUAL);
SET_LAST_MODIFIED (w, 1);
SET_LAST_FACECHANGE (w);
+2000-07-19 Martin Buchholz <martin@xemacs.org>
+
+ * XEmacs 21.2.35 is released.
+
+2000-06-17 Martin Buchholz <martin@xemacs.org>
+
+ * automated/database-tests.el: Remove any previous .pag, .dir files.
+
2000-05-28 Martin Buchholz <martin@xemacs.org>
* XEmacs 21.2.34 is released.
(require 'test-harness))))
(flet ((delete-database-files (filename)
- (dolist (fn (list filename (concat filename ".db")))
+ (dolist (fn (list filename
+ (concat filename ".db")
+ (concat filename ".pag")
+ (concat filename ".dir")))
(ignore-file-errors (delete-file fn))))
(test-database (db)
emacs_is_beta=t
emacs_major_version=21
emacs_minor_version=2
-emacs_beta_version=34
-xemacs_codename="Molpe"
+emacs_beta_version=35
+xemacs_codename="Nike"
infodock_major_version=4
infodock_minor_version=0
infodock_build_version=8