diff --git a/mbase/ROX-Filer b/mbase/ROX-Filer new file mode 100644 index 0000000..e69de29 diff --git a/mbase/alsa-lib b/mbase/alsa-lib new file mode 100644 index 0000000..e69de29 diff --git a/mbase/alsa-plugins b/mbase/alsa-plugins new file mode 100644 index 0000000..e69de29 diff --git a/mbase/alsa-utils b/mbase/alsa-utils new file mode 100644 index 0000000..e69de29 diff --git a/mbase/epic b/mbase/epic new file mode 100644 index 0000000..e69de29 diff --git a/mbase/fbv-git b/mbase/fbv-git new file mode 100644 index 0000000..e69de29 diff --git a/mbase/gnugrep/build b/mbase/gnugrep/build new file mode 100755 index 0000000..bfe5990 --- /dev/null +++ b/mbase/gnugrep/build @@ -0,0 +1,11 @@ +#!/bin/sh -e + +export CFLAGS="$CFLAGS -Wno-error -static" + +./configure \ + --prefix=/usr + +make +make DESTDIR="$1" install + +install -Dm755 src/grep "$1/usr/bin/ggrep" diff --git a/mbase/gnugrep/checksums b/mbase/gnugrep/checksums new file mode 100644 index 0000000..8ca1835 --- /dev/null +++ b/mbase/gnugrep/checksums @@ -0,0 +1 @@ +667e15e8afe189e93f9f21a7cd3a7b3f776202f417330b248c2ad4f997d9373e diff --git a/mbase/gnugrep/sources b/mbase/gnugrep/sources new file mode 100644 index 0000000..35d5bb3 --- /dev/null +++ b/mbase/gnugrep/sources @@ -0,0 +1 @@ +https://ftp.gnu.org/gnu/grep/grep-3.6.tar.xz diff --git a/mbase/gnugrep/version b/mbase/gnugrep/version new file mode 100644 index 0000000..8c2b20b --- /dev/null +++ b/mbase/gnugrep/version @@ -0,0 +1 @@ +3.6 1 diff --git a/mbase/liberation-fonts b/mbase/liberation-fonts new file mode 100644 index 0000000..e69de29 diff --git a/mbase/neXtaw b/mbase/neXtaw new file mode 120000 index 0000000..4ffc8e5 --- /dev/null +++ b/mbase/neXtaw @@ -0,0 +1 @@ +../ports/neXtaw \ No newline at end of file diff --git a/mbase/norm.txt b/mbase/norm.txt new file mode 100644 index 0000000..7d94a02 --- /dev/null +++ b/mbase/norm.txt @@ -0,0 +1 @@ +9base-mod 9wm ROX-Filer alsa-lib alsa-plugins alsa-utils atk autoconf automake axel baselayout bash binutils bison bzip2 cairo cmake curl cyrus-sasl diffutils dropbear dtach-git epic eudev expat fbv-git ffmpeg file flex fontconfig freetype-harfbuzz fribidi fvwm3-git gavin-bc-git gcc gccmakedep-git gdk-pixbuf gettext-tiny giblib giflib git glib gmp gnugrep gnutls gperf gtk+2 gtk2-engines-clearlooks gv gzip hicolor hummingbird-git iana-etc imake-git imlib2 inetutils intltool kiss-mod lame leafpad less libICE libSM libX11 libXScrnSaver libXau libXaw3d-git libXcomposite libXcursor libXdamage libXdmcp libXext libXfixes libXfont2 libXft libXi libXinerama libXmu libXpm libXrandr libXrender libXt libXtst libXxf86vm libarchive libass libbson-git libdrm libelf libepoxy liberation-fonts libevdev libevent libexif libffi libfontenc libgcrypt libgpg-error libinput libjpeg-turbo libmbim libmpc libnl libogg libpcap libpciaccess libpng libressl libtheora libtool libusb libvorbis libvpx libxcb libxkbfile libxml2 libxshmfence links2 linux-headers llvm lxtask lz4 m4 make man-pages-posix mandoc mesa meson mpfr mtdev mtm-git mtpaint-git nasm ncurses net-tools nettle nilfs-utils nmap oksh opus otawk-git pango patch pciutils pcre perl perl-xml pidgin pixman pkgconf procps-ng purple-discord-git python ruby samurai sbase-git-mod scrot sdl2 sed shadow shared-mime-info shellcheck-bin slock sqlite ssu stalonetray sxiv sysklogd-git syslinux sysmgr tabbed tcpdump tine-git tt++ tzdata ubase-git-mod usbutils util-linux x265 xbitmaps xcalc xcb-proto xcb-util xcb-util-image xcb-util-keysyms xcb-util-wm xcompmgr xdm xev xf86-input-libinput xf86-video-amdgpu xfsprogs xinit xinput xkbcomp xkeyboard-config xless xmessage xorg-cf xorg-fontutil xorg-server xorg-util-macros xorgproto xosview xrdb xset xsetroot xssstart xterm xtrans xvidcore xvkbd xwallpaper xz zlib zstd diff --git a/mbase/psmisc-git b/mbase/psmisc-git deleted file mode 120000 index 996aa7d..0000000 --- a/mbase/psmisc-git +++ /dev/null @@ -1 +0,0 @@ -../ports/psmisc-git \ No newline at end of file diff --git a/mbase/scrot b/mbase/scrot new file mode 100644 index 0000000..e69de29 diff --git a/mbase/sxiv b/mbase/sxiv new file mode 100644 index 0000000..e69de29 diff --git a/mbase/tzdata b/mbase/tzdata new file mode 100644 index 0000000..e69de29 diff --git a/mbase/xf86-input-libinput b/mbase/xf86-input-libinput new file mode 100644 index 0000000..e69de29 diff --git a/mbase/xorg-server b/mbase/xorg-server new file mode 100644 index 0000000..e69de29 diff --git a/mbase/xwallpaper b/mbase/xwallpaper new file mode 100644 index 0000000..e69de29 diff --git a/ports/ffmpeg/diffutils/build b/ports/ffmpeg/diffutils/build new file mode 100755 index 0000000..206a476 --- /dev/null +++ b/ports/ffmpeg/diffutils/build @@ -0,0 +1,9 @@ +#!/bin/sh -e + +export CFLAGS="$CFLAGS -static" + +./configure \ + --prefix=/usr + +make +make DESTDIR="$1" install diff --git a/ports/ffmpeg/diffutils/checksums b/ports/ffmpeg/diffutils/checksums new file mode 100644 index 0000000..785fdb3 --- /dev/null +++ b/ports/ffmpeg/diffutils/checksums @@ -0,0 +1 @@ +b3a7a6221c3dc916085f0d205abf6b8e1ba443d4dd965118da364a1dc1cb3a26 diffutils-3.7.tar.xz diff --git a/ports/ffmpeg/diffutils/sources b/ports/ffmpeg/diffutils/sources new file mode 100644 index 0000000..f0af8e7 --- /dev/null +++ b/ports/ffmpeg/diffutils/sources @@ -0,0 +1 @@ +https://ftp.gnu.org/gnu/diffutils/diffutils-3.7.tar.xz diff --git a/ports/ffmpeg/diffutils/version b/ports/ffmpeg/diffutils/version new file mode 100644 index 0000000..fa0ebc7 --- /dev/null +++ b/ports/ffmpeg/diffutils/version @@ -0,0 +1 @@ +3.7 1 diff --git a/ports/gtk2-engines-clearlooks/depends b/ports/gtk2-engines-clearlooks/depends index 203fd04..b6aadd6 100644 --- a/ports/gtk2-engines-clearlooks/depends +++ b/ports/gtk2-engines-clearlooks/depends @@ -1,2 +1,3 @@ +perl-xml make gtk+2 intltool make diff --git a/ports/gtk2-engines-murrine/depends b/ports/gtk2-engines-murrine/depends index 5109d24..007b953 100644 --- a/ports/gtk2-engines-murrine/depends +++ b/ports/gtk2-engines-murrine/depends @@ -1,3 +1,4 @@ +perl-xml make gettext-tiny make gtk+2 intltool make diff --git a/ports/gv/depends b/ports/gv/depends index 7fa336c..538506b 100644 --- a/ports/gv/depends +++ b/ports/gv/depends @@ -1,3 +1,4 @@ +ghostscript freetype-harfbuzz libICE libSM diff --git a/ports/libXaw3d-git/build b/ports/libXaw3d-git/build index b2f475e..dbd376c 100755 --- a/ports/libXaw3d-git/build +++ b/ports/libXaw3d-git/build @@ -5,3 +5,7 @@ make make DESTDIR="$1" install + +#ln -s "/usr/include/X11/Xaw3d" "$1/usr/include/X11/Xaw" +#ln -s "/usr/lib/pkgconfig/xaw3d.pc" "/usr/lib/pkgconfig/xaw7.pc" +#ln -s "/usr/lib/libXaw3d.so" "$1/usr/lib/libXaw7.so" diff --git a/ports/links2/build b/ports/links2-mod/build similarity index 100% rename from ports/links2/build rename to ports/links2-mod/build diff --git a/ports/links2/checksums b/ports/links2-mod/checksums similarity index 100% rename from ports/links2/checksums rename to ports/links2-mod/checksums diff --git a/ports/links2/depends b/ports/links2-mod/depends similarity index 100% rename from ports/links2/depends rename to ports/links2-mod/depends diff --git a/ports/links2/manifest b/ports/links2-mod/manifest similarity index 100% rename from ports/links2/manifest rename to ports/links2-mod/manifest diff --git a/ports/links2/patches/01-links-tabbed.patch b/ports/links2-mod/patches/01-links-tabbed.patch similarity index 100% rename from ports/links2/patches/01-links-tabbed.patch rename to ports/links2-mod/patches/01-links-tabbed.patch diff --git a/ports/links2/sources b/ports/links2-mod/sources similarity index 100% rename from ports/links2/sources rename to ports/links2-mod/sources diff --git a/ports/links2/version b/ports/links2-mod/version similarity index 100% rename from ports/links2/version rename to ports/links2-mod/version diff --git a/ports/neXtaw/build b/ports/neXtaw/build new file mode 100755 index 0000000..1295fe8 --- /dev/null +++ b/ports/neXtaw/build @@ -0,0 +1,8 @@ +#!/bin/sh -e + +./configure \ + --prefix=/usr \ + +make +make DESTDIR="$1" install +install -Dm644 nextaw.pc "$1/usr/lib/pkgconfig/nextaw.pc" diff --git a/ports/neXtaw/checksums b/ports/neXtaw/checksums new file mode 100644 index 0000000..e0c86a6 --- /dev/null +++ b/ports/neXtaw/checksums @@ -0,0 +1 @@ +7cfe6706b9a76620389e04a7a87f06786c8a6606829c3157c3e9e45a805bb584 diff --git a/ports/neXtaw/files/nextaw.pc b/ports/neXtaw/files/nextaw.pc new file mode 100644 index 0000000..7051f0e --- /dev/null +++ b/ports/neXtaw/files/nextaw.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: neXtaw +Description: Xaw with N*XTSTEP look and feel +Version: 1.0.13 +Requires: xproto xt +Requires.private: x11 xext xt xmu xpm +Cflags: -I${includedir} +Libs: -L${libdir} -lneXtaw diff --git a/ports/neXtaw/sources b/ports/neXtaw/sources new file mode 100644 index 0000000..356a9c1 --- /dev/null +++ b/ports/neXtaw/sources @@ -0,0 +1,2 @@ +http://siag.nu/pub/neXtaw/neXtaw-0.15.1.tar.gz +files/nextaw.pc diff --git a/ports/neXtaw/version b/ports/neXtaw/version new file mode 100644 index 0000000..a506fde --- /dev/null +++ b/ports/neXtaw/version @@ -0,0 +1 @@ +0.15.1 1 diff --git a/ports/neXtaw/xaw7.pc b/ports/neXtaw/xaw7.pc new file mode 100644 index 0000000..7470c4e --- /dev/null +++ b/ports/neXtaw/xaw7.pc @@ -0,0 +1,12 @@ +prefix=/usr +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir=${prefix}/include + +Name: Xaw +Description: X Athena Widgets Library, version 7 +Version: 1.0.13 +Requires: xproto xt +Requires.private: x11 xext xt xmu xpm +Cflags: -I${includedir} +Libs: -L${libdir} -lneXtaw diff --git a/ports/xclock/build b/ports/xclock/build index 036cfd3..27440f2 100755 --- a/ports/xclock/build +++ b/ports/xclock/build @@ -1,5 +1,8 @@ #!/bin/sh -e +# Patch Clock.c to compile with other Xaws +sed -e 's/XpmReadFileToPixmap(dpy, RootWindowOfScreen(screen), name, &pmap,//g' clock.c.new | sed -e 's/&shapemask, NULL);//g' > Clock.c.new ; mv Clock.c.new Clock.c + ./configure \ --prefix=/usr diff --git a/ports/xclock/depends b/ports/xclock/depends index 6fba80d..7787467 100644 --- a/ports/xclock/depends +++ b/ports/xclock/depends @@ -2,7 +2,6 @@ libICE libSM libX11 libXau -libXaw make libXext libXft libXmu diff --git a/ports/xedit/depends b/ports/xedit/depends index f42b144..131dbe9 100644 --- a/ports/xedit/depends +++ b/ports/xedit/depends @@ -1,4 +1,4 @@ libX11 -libXaw make libXmu +libXaw libXt diff --git a/ports/xsm/depends b/ports/xsm/depends index 3bf14c3..922ac30 100644 --- a/ports/xsm/depends +++ b/ports/xsm/depends @@ -3,6 +3,5 @@ automake make libICE libSM libX11 -libXaw libXt xorg-server diff --git a/ports/xterm/xterm-359.tgz b/ports/xterm/xterm-359.tgz new file mode 100644 index 0000000..f15e133 Binary files /dev/null and b/ports/xterm/xterm-359.tgz differ diff --git a/ports/xterm/xterm-359/256colres.h b/ports/xterm/xterm-359/256colres.h new file mode 100644 index 0000000..4b98391 --- /dev/null +++ b/ports/xterm/xterm-359/256colres.h @@ -0,0 +1,250 @@ +/* + * This header file was generated by ./256colres.pl + */ +/* $XTermId: 256colres.h,v 1.11 2007/06/12 00:44:23 tom Exp $ */ + +#ifndef included_256colres_h +#define included_256colres_h + +COLOR_RES("16", screen.Acolors[16], DFT_COLOR("rgb:00/00/00")), +COLOR_RES("17", screen.Acolors[17], DFT_COLOR("rgb:00/00/5f")), +COLOR_RES("18", screen.Acolors[18], DFT_COLOR("rgb:00/00/87")), +COLOR_RES("19", screen.Acolors[19], DFT_COLOR("rgb:00/00/af")), +COLOR_RES("20", screen.Acolors[20], DFT_COLOR("rgb:00/00/d7")), +COLOR_RES("21", screen.Acolors[21], DFT_COLOR("rgb:00/00/ff")), +COLOR_RES("22", screen.Acolors[22], DFT_COLOR("rgb:00/5f/00")), +COLOR_RES("23", screen.Acolors[23], DFT_COLOR("rgb:00/5f/5f")), +COLOR_RES("24", screen.Acolors[24], DFT_COLOR("rgb:00/5f/87")), +COLOR_RES("25", screen.Acolors[25], DFT_COLOR("rgb:00/5f/af")), +COLOR_RES("26", screen.Acolors[26], DFT_COLOR("rgb:00/5f/d7")), +COLOR_RES("27", screen.Acolors[27], DFT_COLOR("rgb:00/5f/ff")), +COLOR_RES("28", screen.Acolors[28], DFT_COLOR("rgb:00/87/00")), +COLOR_RES("29", screen.Acolors[29], DFT_COLOR("rgb:00/87/5f")), +COLOR_RES("30", screen.Acolors[30], DFT_COLOR("rgb:00/87/87")), +COLOR_RES("31", screen.Acolors[31], DFT_COLOR("rgb:00/87/af")), +COLOR_RES("32", screen.Acolors[32], DFT_COLOR("rgb:00/87/d7")), +COLOR_RES("33", screen.Acolors[33], DFT_COLOR("rgb:00/87/ff")), +COLOR_RES("34", screen.Acolors[34], DFT_COLOR("rgb:00/af/00")), +COLOR_RES("35", screen.Acolors[35], DFT_COLOR("rgb:00/af/5f")), +COLOR_RES("36", screen.Acolors[36], DFT_COLOR("rgb:00/af/87")), +COLOR_RES("37", screen.Acolors[37], DFT_COLOR("rgb:00/af/af")), +COLOR_RES("38", screen.Acolors[38], DFT_COLOR("rgb:00/af/d7")), +COLOR_RES("39", screen.Acolors[39], DFT_COLOR("rgb:00/af/ff")), +COLOR_RES("40", screen.Acolors[40], DFT_COLOR("rgb:00/d7/00")), +COLOR_RES("41", screen.Acolors[41], DFT_COLOR("rgb:00/d7/5f")), +COLOR_RES("42", screen.Acolors[42], DFT_COLOR("rgb:00/d7/87")), +COLOR_RES("43", screen.Acolors[43], DFT_COLOR("rgb:00/d7/af")), +COLOR_RES("44", screen.Acolors[44], DFT_COLOR("rgb:00/d7/d7")), +COLOR_RES("45", screen.Acolors[45], DFT_COLOR("rgb:00/d7/ff")), +COLOR_RES("46", screen.Acolors[46], DFT_COLOR("rgb:00/ff/00")), +COLOR_RES("47", screen.Acolors[47], DFT_COLOR("rgb:00/ff/5f")), +COLOR_RES("48", screen.Acolors[48], DFT_COLOR("rgb:00/ff/87")), +COLOR_RES("49", screen.Acolors[49], DFT_COLOR("rgb:00/ff/af")), +COLOR_RES("50", screen.Acolors[50], DFT_COLOR("rgb:00/ff/d7")), +COLOR_RES("51", screen.Acolors[51], DFT_COLOR("rgb:00/ff/ff")), +COLOR_RES("52", screen.Acolors[52], DFT_COLOR("rgb:5f/00/00")), +COLOR_RES("53", screen.Acolors[53], DFT_COLOR("rgb:5f/00/5f")), +COLOR_RES("54", screen.Acolors[54], DFT_COLOR("rgb:5f/00/87")), +COLOR_RES("55", screen.Acolors[55], DFT_COLOR("rgb:5f/00/af")), +COLOR_RES("56", screen.Acolors[56], DFT_COLOR("rgb:5f/00/d7")), +COLOR_RES("57", screen.Acolors[57], DFT_COLOR("rgb:5f/00/ff")), +COLOR_RES("58", screen.Acolors[58], DFT_COLOR("rgb:5f/5f/00")), +COLOR_RES("59", screen.Acolors[59], DFT_COLOR("rgb:5f/5f/5f")), +COLOR_RES("60", screen.Acolors[60], DFT_COLOR("rgb:5f/5f/87")), +COLOR_RES("61", screen.Acolors[61], DFT_COLOR("rgb:5f/5f/af")), +COLOR_RES("62", screen.Acolors[62], DFT_COLOR("rgb:5f/5f/d7")), +COLOR_RES("63", screen.Acolors[63], DFT_COLOR("rgb:5f/5f/ff")), +COLOR_RES("64", screen.Acolors[64], DFT_COLOR("rgb:5f/87/00")), +COLOR_RES("65", screen.Acolors[65], DFT_COLOR("rgb:5f/87/5f")), +COLOR_RES("66", screen.Acolors[66], DFT_COLOR("rgb:5f/87/87")), +COLOR_RES("67", screen.Acolors[67], DFT_COLOR("rgb:5f/87/af")), +COLOR_RES("68", screen.Acolors[68], DFT_COLOR("rgb:5f/87/d7")), +COLOR_RES("69", screen.Acolors[69], DFT_COLOR("rgb:5f/87/ff")), +COLOR_RES("70", screen.Acolors[70], DFT_COLOR("rgb:5f/af/00")), +COLOR_RES("71", screen.Acolors[71], DFT_COLOR("rgb:5f/af/5f")), +COLOR_RES("72", screen.Acolors[72], DFT_COLOR("rgb:5f/af/87")), +COLOR_RES("73", screen.Acolors[73], DFT_COLOR("rgb:5f/af/af")), +COLOR_RES("74", screen.Acolors[74], DFT_COLOR("rgb:5f/af/d7")), +COLOR_RES("75", screen.Acolors[75], DFT_COLOR("rgb:5f/af/ff")), +COLOR_RES("76", screen.Acolors[76], DFT_COLOR("rgb:5f/d7/00")), +COLOR_RES("77", screen.Acolors[77], DFT_COLOR("rgb:5f/d7/5f")), +COLOR_RES("78", screen.Acolors[78], DFT_COLOR("rgb:5f/d7/87")), +COLOR_RES("79", screen.Acolors[79], DFT_COLOR("rgb:5f/d7/af")), +COLOR_RES("80", screen.Acolors[80], DFT_COLOR("rgb:5f/d7/d7")), +COLOR_RES("81", screen.Acolors[81], DFT_COLOR("rgb:5f/d7/ff")), +COLOR_RES("82", screen.Acolors[82], DFT_COLOR("rgb:5f/ff/00")), +COLOR_RES("83", screen.Acolors[83], DFT_COLOR("rgb:5f/ff/5f")), +COLOR_RES("84", screen.Acolors[84], DFT_COLOR("rgb:5f/ff/87")), +COLOR_RES("85", screen.Acolors[85], DFT_COLOR("rgb:5f/ff/af")), +COLOR_RES("86", screen.Acolors[86], DFT_COLOR("rgb:5f/ff/d7")), +COLOR_RES("87", screen.Acolors[87], DFT_COLOR("rgb:5f/ff/ff")), +COLOR_RES("88", screen.Acolors[88], DFT_COLOR("rgb:87/00/00")), +COLOR_RES("89", screen.Acolors[89], DFT_COLOR("rgb:87/00/5f")), +COLOR_RES("90", screen.Acolors[90], DFT_COLOR("rgb:87/00/87")), +COLOR_RES("91", screen.Acolors[91], DFT_COLOR("rgb:87/00/af")), +COLOR_RES("92", screen.Acolors[92], DFT_COLOR("rgb:87/00/d7")), +COLOR_RES("93", screen.Acolors[93], DFT_COLOR("rgb:87/00/ff")), +COLOR_RES("94", screen.Acolors[94], DFT_COLOR("rgb:87/5f/00")), +COLOR_RES("95", screen.Acolors[95], DFT_COLOR("rgb:87/5f/5f")), +COLOR_RES("96", screen.Acolors[96], DFT_COLOR("rgb:87/5f/87")), +COLOR_RES("97", screen.Acolors[97], DFT_COLOR("rgb:87/5f/af")), +COLOR_RES("98", screen.Acolors[98], DFT_COLOR("rgb:87/5f/d7")), +COLOR_RES("99", screen.Acolors[99], DFT_COLOR("rgb:87/5f/ff")), +COLOR_RES("100", screen.Acolors[100], DFT_COLOR("rgb:87/87/00")), +COLOR_RES("101", screen.Acolors[101], DFT_COLOR("rgb:87/87/5f")), +COLOR_RES("102", screen.Acolors[102], DFT_COLOR("rgb:87/87/87")), +COLOR_RES("103", screen.Acolors[103], DFT_COLOR("rgb:87/87/af")), +COLOR_RES("104", screen.Acolors[104], DFT_COLOR("rgb:87/87/d7")), +COLOR_RES("105", screen.Acolors[105], DFT_COLOR("rgb:87/87/ff")), +COLOR_RES("106", screen.Acolors[106], DFT_COLOR("rgb:87/af/00")), +COLOR_RES("107", screen.Acolors[107], DFT_COLOR("rgb:87/af/5f")), +COLOR_RES("108", screen.Acolors[108], DFT_COLOR("rgb:87/af/87")), +COLOR_RES("109", screen.Acolors[109], DFT_COLOR("rgb:87/af/af")), +COLOR_RES("110", screen.Acolors[110], DFT_COLOR("rgb:87/af/d7")), +COLOR_RES("111", screen.Acolors[111], DFT_COLOR("rgb:87/af/ff")), +COLOR_RES("112", screen.Acolors[112], DFT_COLOR("rgb:87/d7/00")), +COLOR_RES("113", screen.Acolors[113], DFT_COLOR("rgb:87/d7/5f")), +COLOR_RES("114", screen.Acolors[114], DFT_COLOR("rgb:87/d7/87")), +COLOR_RES("115", screen.Acolors[115], DFT_COLOR("rgb:87/d7/af")), +COLOR_RES("116", screen.Acolors[116], DFT_COLOR("rgb:87/d7/d7")), +COLOR_RES("117", screen.Acolors[117], DFT_COLOR("rgb:87/d7/ff")), +COLOR_RES("118", screen.Acolors[118], DFT_COLOR("rgb:87/ff/00")), +COLOR_RES("119", screen.Acolors[119], DFT_COLOR("rgb:87/ff/5f")), +COLOR_RES("120", screen.Acolors[120], DFT_COLOR("rgb:87/ff/87")), +COLOR_RES("121", screen.Acolors[121], DFT_COLOR("rgb:87/ff/af")), +COLOR_RES("122", screen.Acolors[122], DFT_COLOR("rgb:87/ff/d7")), +COLOR_RES("123", screen.Acolors[123], DFT_COLOR("rgb:87/ff/ff")), +COLOR_RES("124", screen.Acolors[124], DFT_COLOR("rgb:af/00/00")), +COLOR_RES("125", screen.Acolors[125], DFT_COLOR("rgb:af/00/5f")), +COLOR_RES("126", screen.Acolors[126], DFT_COLOR("rgb:af/00/87")), +COLOR_RES("127", screen.Acolors[127], DFT_COLOR("rgb:af/00/af")), +COLOR_RES("128", screen.Acolors[128], DFT_COLOR("rgb:af/00/d7")), +COLOR_RES("129", screen.Acolors[129], DFT_COLOR("rgb:af/00/ff")), +COLOR_RES("130", screen.Acolors[130], DFT_COLOR("rgb:af/5f/00")), +COLOR_RES("131", screen.Acolors[131], DFT_COLOR("rgb:af/5f/5f")), +COLOR_RES("132", screen.Acolors[132], DFT_COLOR("rgb:af/5f/87")), +COLOR_RES("133", screen.Acolors[133], DFT_COLOR("rgb:af/5f/af")), +COLOR_RES("134", screen.Acolors[134], DFT_COLOR("rgb:af/5f/d7")), +COLOR_RES("135", screen.Acolors[135], DFT_COLOR("rgb:af/5f/ff")), +COLOR_RES("136", screen.Acolors[136], DFT_COLOR("rgb:af/87/00")), +COLOR_RES("137", screen.Acolors[137], DFT_COLOR("rgb:af/87/5f")), +COLOR_RES("138", screen.Acolors[138], DFT_COLOR("rgb:af/87/87")), +COLOR_RES("139", screen.Acolors[139], DFT_COLOR("rgb:af/87/af")), +COLOR_RES("140", screen.Acolors[140], DFT_COLOR("rgb:af/87/d7")), +COLOR_RES("141", screen.Acolors[141], DFT_COLOR("rgb:af/87/ff")), +COLOR_RES("142", screen.Acolors[142], DFT_COLOR("rgb:af/af/00")), +COLOR_RES("143", screen.Acolors[143], DFT_COLOR("rgb:af/af/5f")), +COLOR_RES("144", screen.Acolors[144], DFT_COLOR("rgb:af/af/87")), +COLOR_RES("145", screen.Acolors[145], DFT_COLOR("rgb:af/af/af")), +COLOR_RES("146", screen.Acolors[146], DFT_COLOR("rgb:af/af/d7")), +COLOR_RES("147", screen.Acolors[147], DFT_COLOR("rgb:af/af/ff")), +COLOR_RES("148", screen.Acolors[148], DFT_COLOR("rgb:af/d7/00")), +COLOR_RES("149", screen.Acolors[149], DFT_COLOR("rgb:af/d7/5f")), +COLOR_RES("150", screen.Acolors[150], DFT_COLOR("rgb:af/d7/87")), +COLOR_RES("151", screen.Acolors[151], DFT_COLOR("rgb:af/d7/af")), +COLOR_RES("152", screen.Acolors[152], DFT_COLOR("rgb:af/d7/d7")), +COLOR_RES("153", screen.Acolors[153], DFT_COLOR("rgb:af/d7/ff")), +COLOR_RES("154", screen.Acolors[154], DFT_COLOR("rgb:af/ff/00")), +COLOR_RES("155", screen.Acolors[155], DFT_COLOR("rgb:af/ff/5f")), +COLOR_RES("156", screen.Acolors[156], DFT_COLOR("rgb:af/ff/87")), +COLOR_RES("157", screen.Acolors[157], DFT_COLOR("rgb:af/ff/af")), +COLOR_RES("158", screen.Acolors[158], DFT_COLOR("rgb:af/ff/d7")), +COLOR_RES("159", screen.Acolors[159], DFT_COLOR("rgb:af/ff/ff")), +COLOR_RES("160", screen.Acolors[160], DFT_COLOR("rgb:d7/00/00")), +COLOR_RES("161", screen.Acolors[161], DFT_COLOR("rgb:d7/00/5f")), +COLOR_RES("162", screen.Acolors[162], DFT_COLOR("rgb:d7/00/87")), +COLOR_RES("163", screen.Acolors[163], DFT_COLOR("rgb:d7/00/af")), +COLOR_RES("164", screen.Acolors[164], DFT_COLOR("rgb:d7/00/d7")), +COLOR_RES("165", screen.Acolors[165], DFT_COLOR("rgb:d7/00/ff")), +COLOR_RES("166", screen.Acolors[166], DFT_COLOR("rgb:d7/5f/00")), +COLOR_RES("167", screen.Acolors[167], DFT_COLOR("rgb:d7/5f/5f")), +COLOR_RES("168", screen.Acolors[168], DFT_COLOR("rgb:d7/5f/87")), +COLOR_RES("169", screen.Acolors[169], DFT_COLOR("rgb:d7/5f/af")), +COLOR_RES("170", screen.Acolors[170], DFT_COLOR("rgb:d7/5f/d7")), +COLOR_RES("171", screen.Acolors[171], DFT_COLOR("rgb:d7/5f/ff")), +COLOR_RES("172", screen.Acolors[172], DFT_COLOR("rgb:d7/87/00")), +COLOR_RES("173", screen.Acolors[173], DFT_COLOR("rgb:d7/87/5f")), +COLOR_RES("174", screen.Acolors[174], DFT_COLOR("rgb:d7/87/87")), +COLOR_RES("175", screen.Acolors[175], DFT_COLOR("rgb:d7/87/af")), +COLOR_RES("176", screen.Acolors[176], DFT_COLOR("rgb:d7/87/d7")), +COLOR_RES("177", screen.Acolors[177], DFT_COLOR("rgb:d7/87/ff")), +COLOR_RES("178", screen.Acolors[178], DFT_COLOR("rgb:d7/af/00")), +COLOR_RES("179", screen.Acolors[179], DFT_COLOR("rgb:d7/af/5f")), +COLOR_RES("180", screen.Acolors[180], DFT_COLOR("rgb:d7/af/87")), +COLOR_RES("181", screen.Acolors[181], DFT_COLOR("rgb:d7/af/af")), +COLOR_RES("182", screen.Acolors[182], DFT_COLOR("rgb:d7/af/d7")), +COLOR_RES("183", screen.Acolors[183], DFT_COLOR("rgb:d7/af/ff")), +COLOR_RES("184", screen.Acolors[184], DFT_COLOR("rgb:d7/d7/00")), +COLOR_RES("185", screen.Acolors[185], DFT_COLOR("rgb:d7/d7/5f")), +COLOR_RES("186", screen.Acolors[186], DFT_COLOR("rgb:d7/d7/87")), +COLOR_RES("187", screen.Acolors[187], DFT_COLOR("rgb:d7/d7/af")), +COLOR_RES("188", screen.Acolors[188], DFT_COLOR("rgb:d7/d7/d7")), +COLOR_RES("189", screen.Acolors[189], DFT_COLOR("rgb:d7/d7/ff")), +COLOR_RES("190", screen.Acolors[190], DFT_COLOR("rgb:d7/ff/00")), +COLOR_RES("191", screen.Acolors[191], DFT_COLOR("rgb:d7/ff/5f")), +COLOR_RES("192", screen.Acolors[192], DFT_COLOR("rgb:d7/ff/87")), +COLOR_RES("193", screen.Acolors[193], DFT_COLOR("rgb:d7/ff/af")), +COLOR_RES("194", screen.Acolors[194], DFT_COLOR("rgb:d7/ff/d7")), +COLOR_RES("195", screen.Acolors[195], DFT_COLOR("rgb:d7/ff/ff")), +COLOR_RES("196", screen.Acolors[196], DFT_COLOR("rgb:ff/00/00")), +COLOR_RES("197", screen.Acolors[197], DFT_COLOR("rgb:ff/00/5f")), +COLOR_RES("198", screen.Acolors[198], DFT_COLOR("rgb:ff/00/87")), +COLOR_RES("199", screen.Acolors[199], DFT_COLOR("rgb:ff/00/af")), +COLOR_RES("200", screen.Acolors[200], DFT_COLOR("rgb:ff/00/d7")), +COLOR_RES("201", screen.Acolors[201], DFT_COLOR("rgb:ff/00/ff")), +COLOR_RES("202", screen.Acolors[202], DFT_COLOR("rgb:ff/5f/00")), +COLOR_RES("203", screen.Acolors[203], DFT_COLOR("rgb:ff/5f/5f")), +COLOR_RES("204", screen.Acolors[204], DFT_COLOR("rgb:ff/5f/87")), +COLOR_RES("205", screen.Acolors[205], DFT_COLOR("rgb:ff/5f/af")), +COLOR_RES("206", screen.Acolors[206], DFT_COLOR("rgb:ff/5f/d7")), +COLOR_RES("207", screen.Acolors[207], DFT_COLOR("rgb:ff/5f/ff")), +COLOR_RES("208", screen.Acolors[208], DFT_COLOR("rgb:ff/87/00")), +COLOR_RES("209", screen.Acolors[209], DFT_COLOR("rgb:ff/87/5f")), +COLOR_RES("210", screen.Acolors[210], DFT_COLOR("rgb:ff/87/87")), +COLOR_RES("211", screen.Acolors[211], DFT_COLOR("rgb:ff/87/af")), +COLOR_RES("212", screen.Acolors[212], DFT_COLOR("rgb:ff/87/d7")), +COLOR_RES("213", screen.Acolors[213], DFT_COLOR("rgb:ff/87/ff")), +COLOR_RES("214", screen.Acolors[214], DFT_COLOR("rgb:ff/af/00")), +COLOR_RES("215", screen.Acolors[215], DFT_COLOR("rgb:ff/af/5f")), +COLOR_RES("216", screen.Acolors[216], DFT_COLOR("rgb:ff/af/87")), +COLOR_RES("217", screen.Acolors[217], DFT_COLOR("rgb:ff/af/af")), +COLOR_RES("218", screen.Acolors[218], DFT_COLOR("rgb:ff/af/d7")), +COLOR_RES("219", screen.Acolors[219], DFT_COLOR("rgb:ff/af/ff")), +COLOR_RES("220", screen.Acolors[220], DFT_COLOR("rgb:ff/d7/00")), +COLOR_RES("221", screen.Acolors[221], DFT_COLOR("rgb:ff/d7/5f")), +COLOR_RES("222", screen.Acolors[222], DFT_COLOR("rgb:ff/d7/87")), +COLOR_RES("223", screen.Acolors[223], DFT_COLOR("rgb:ff/d7/af")), +COLOR_RES("224", screen.Acolors[224], DFT_COLOR("rgb:ff/d7/d7")), +COLOR_RES("225", screen.Acolors[225], DFT_COLOR("rgb:ff/d7/ff")), +COLOR_RES("226", screen.Acolors[226], DFT_COLOR("rgb:ff/ff/00")), +COLOR_RES("227", screen.Acolors[227], DFT_COLOR("rgb:ff/ff/5f")), +COLOR_RES("228", screen.Acolors[228], DFT_COLOR("rgb:ff/ff/87")), +COLOR_RES("229", screen.Acolors[229], DFT_COLOR("rgb:ff/ff/af")), +COLOR_RES("230", screen.Acolors[230], DFT_COLOR("rgb:ff/ff/d7")), +COLOR_RES("231", screen.Acolors[231], DFT_COLOR("rgb:ff/ff/ff")), +COLOR_RES("232", screen.Acolors[232], DFT_COLOR("rgb:08/08/08")), +COLOR_RES("233", screen.Acolors[233], DFT_COLOR("rgb:12/12/12")), +COLOR_RES("234", screen.Acolors[234], DFT_COLOR("rgb:1c/1c/1c")), +COLOR_RES("235", screen.Acolors[235], DFT_COLOR("rgb:26/26/26")), +COLOR_RES("236", screen.Acolors[236], DFT_COLOR("rgb:30/30/30")), +COLOR_RES("237", screen.Acolors[237], DFT_COLOR("rgb:3a/3a/3a")), +COLOR_RES("238", screen.Acolors[238], DFT_COLOR("rgb:44/44/44")), +COLOR_RES("239", screen.Acolors[239], DFT_COLOR("rgb:4e/4e/4e")), +COLOR_RES("240", screen.Acolors[240], DFT_COLOR("rgb:58/58/58")), +COLOR_RES("241", screen.Acolors[241], DFT_COLOR("rgb:62/62/62")), +COLOR_RES("242", screen.Acolors[242], DFT_COLOR("rgb:6c/6c/6c")), +COLOR_RES("243", screen.Acolors[243], DFT_COLOR("rgb:76/76/76")), +COLOR_RES("244", screen.Acolors[244], DFT_COLOR("rgb:80/80/80")), +COLOR_RES("245", screen.Acolors[245], DFT_COLOR("rgb:8a/8a/8a")), +COLOR_RES("246", screen.Acolors[246], DFT_COLOR("rgb:94/94/94")), +COLOR_RES("247", screen.Acolors[247], DFT_COLOR("rgb:9e/9e/9e")), +COLOR_RES("248", screen.Acolors[248], DFT_COLOR("rgb:a8/a8/a8")), +COLOR_RES("249", screen.Acolors[249], DFT_COLOR("rgb:b2/b2/b2")), +COLOR_RES("250", screen.Acolors[250], DFT_COLOR("rgb:bc/bc/bc")), +COLOR_RES("251", screen.Acolors[251], DFT_COLOR("rgb:c6/c6/c6")), +COLOR_RES("252", screen.Acolors[252], DFT_COLOR("rgb:d0/d0/d0")), +COLOR_RES("253", screen.Acolors[253], DFT_COLOR("rgb:da/da/da")), +COLOR_RES("254", screen.Acolors[254], DFT_COLOR("rgb:e4/e4/e4")), +COLOR_RES("255", screen.Acolors[255], DFT_COLOR("rgb:ee/ee/ee")), + +#endif /* included_256colres_h */ diff --git a/ports/xterm/xterm-359/256colres.pl b/ports/xterm/xterm-359/256colres.pl new file mode 100755 index 0000000..cf9673c --- /dev/null +++ b/ports/xterm/xterm-359/256colres.pl @@ -0,0 +1,93 @@ +#! /usr/bin/perl +# $XTermId: 256colres.pl,v 1.16 2007/06/08 23:58:37 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1999-2002,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- + +# Construct a header file defining default resources for the 256-color model +# of xterm. This is modeled after the 256colors2.pl script. + +# use the resources for colors 0-15 - usually more-or-less a +# reproduction of the standard ANSI colors, but possibly more +# pleasing shades + +use strict; + +our ( $line1, $line2, $line3 ); +our ( $red, $green, $blue, $gray ); +our ( $level, $code, @steps ); + +print < 0 ) { $level += 23.18181818; } + $code = 80 + $gray; + printf($line1, $code); + printf($line2, $code); + printf($line3, + int($level), int($level), int($level)); +} + +print < at the end of each line. + +27-JAN-2000. Discovered a bug when doing an X11 paste into an EDT session, +had to add a tt_start_read() in button.c after the paste to reenable the +read AST. Rearranged code in VMS.C to make the compiler happy and +eliminate warnings. + +David Mathog +mathog@seqaxp.bio.caltech.edu +Manager, sequence analysis facility, biology division, Caltech + + +$XFree86: xc/programs/xterm/AAA_README_VMS.txt,v 1.2 2000/06/13 02:28:37 dawes Exp $ diff --git a/ports/xterm/xterm-359/COPYING b/ports/xterm/xterm-359/COPYING new file mode 100644 index 0000000..0656380 --- /dev/null +++ b/ports/xterm/xterm-359/COPYING @@ -0,0 +1,75 @@ +--- $XTermId: COPYING,v 1.3 2020/01/12 22:53:35 tom Exp $ +------------------------------------------------------------------------------- + +Copyright 1996-2019,2020 by Thomas E. Dickey + + All Rights Reserved + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name(s) of the above copyright +holders shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization. + +Copyright 1987, 1988 X Consortium + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + +Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital Equipment +Corporation not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +-- vile: txtmode +------------------------------------------------------------------------------- diff --git a/ports/xterm/xterm-359/INSTALL b/ports/xterm/xterm-359/INSTALL new file mode 100644 index 0000000..be35e3a --- /dev/null +++ b/ports/xterm/xterm-359/INSTALL @@ -0,0 +1,875 @@ +-- $XTermId: INSTALL,v 1.184 2020/07/25 17:58:05 tom Exp $ +------------------------------------------------------------------------------- +-- Copyright 1997-2019,2020 by Thomas E. Dickey +-- +-- All Rights Reserved +-- +-- Permission is hereby granted, free of charge, to any person obtaining a +-- copy of this software and associated documentation files (the +-- "Software"), to deal in the Software without restriction, including +-- without limitation the rights to use, copy, modify, merge, publish, +-- distribute, sublicense, and/or sell copies of the Software, and to +-- permit persons to whom the Software is furnished to do so, subject to +-- the following conditions: +-- +-- The above copyright notice and this permission notice shall be included +-- in all copies or substantial portions of the Software. +-- +-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +-- IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +-- +-- Except as contained in this notice, the name(s) of the above copyright +-- holders shall not be used in advertising or otherwise to promote the +-- sale, use or other dealings in this Software without prior written +-- authorization. +------------------------------------------------------------------------------- + +Xterm was originally built as part of the X Window System source tree, using +imake to generate a Makefile from Imakefile. + +An example Imakefile is provided for legacy use. + +The preferred method uses the configure script to generate a Makefile from +Makefile.in + +Options: +------- + +Autoconf configure scripts recognize two types of application-defined +options, enable/disable and with/without. The latter, by convention, are +used for denoting inclusion of external packages, while the former denote +enabling/disabling of internal features. The configure --help option lists +the available options. This script uses "enable" and "disable" to indicate +the sense of the default behavior. + +The options (in alphabetic order): + + --disable-256-color disable 256-color support + + Do not compile-in code that interprets SGR 38 and 48 for 256-colors. + If this feature is disabled, the 88-color feature will be used. + + --disable-88-color disable 88-color support + + Do not compile-in code that interprets SGR 38 and 48 for 88-colors. + The 256-color option overrides this. + + --disable-16-color disable 16-color support + + Do not compile-in code to recognize aixterm-style control sequences + that support color values 8-15. + + Most color applications know only about 8 ANSI colors, but some + (e.g., ones built with ncurses) do. + + --disable-active-icon disable X11R6.3 active-icon feature + + Do not compile-in code to support the active-icon feature. This is + not configured on systems (e.g., X11R5) which lack the library + support needed. + + Xterms with an active icon continue to respond to input and update + their display when iconified. Not all window managers support + active icons. Those that do include fvwm, olvwm and mwm. + + --disable-ansi-color disable ANSI color + + Do not compile-in code for ANSI colors. + + --disable-blink-cursor disable support for blinking cursor + + Do not compile-in code that implements a blinking cursor. The blinking + cursor is enabled either by resource setting or by popup menu entry. + + --disable-bold-color disable PC-style mapping of bold colors + + Do not compile-in code that maps colors 8-15 to bold versions of + colors 0-7. + + Some applications have hardcoded logic that assumes this. It does + not interfere with the 16-color support. + + --disable-boxchars disable fallback-support for box chars + + Do not compile-in code to generate approximations for box/graphic + characters. + + Most fonts do not contain the vt100-style graphic characters in + positions 0-31. Many applications use the line-drawing characters, + e.g., to make boxes. When xterm loads a font, it checks if those + characters are present, and draws its own if they are missing. + + --disable-broken-st disallow broken string-terminators, + + Do not compile-in code that works around a bug in some ISDN routers + (and possibly other applications written by the same people): they + send an unterminated control string in their banner text, making xterm + freeze. + + The workaround tells xterm to stop processing the control string when + it receives one of the whitespace control characters such as newline. + That was the behavior before patch #171. + + See also --enable-broken-osc + + --disable-c1-print disallow -k8 option for printable 128-159, + + Use this option to suppress support for nonstandard use of codes + 128-159, which normally are considered control characters. Some users + have fonts which use those positions. The default value for the + allowC1Printable resource is false, so this feature does not impact + normal users. + + --disable-color-class disable color class resources + + Use this option to change most of the color resources to use Foreground + as the color class. This is the older (before patch #157) behavior + which has the drawback that setting the Foreground resource on most + platforms prevents use of color since the class is evaluated before + the instance. + + --disable-color-mode disable default colorMode resource + + Do not compile-in code that sets the default value of the colorMode + resource to ``true''. + + --disable-desktop disable install of xterm desktop files + + Do not install the xterm desktop files, used in menus. + These use the icons installed in the --with-icondir option. + Use the environment variable $DESKTOP_FLAGS to supply options + required by desktop-file-install. + + Note: If desktop-utils is not found they will not be installed anyway. + + --disable-direct-color disable direct color support + + Do not compile-in code that interprets SGR 38 and 48 for direct colors. + This feature extends the 256-color feature. + + --disable-doublechars disable support for double-size chars + + Do not compile-in code that supports font-manipulation needed to + implement vt100-style double-sized characters. + + --disable-echo test: display "compiling" commands + + Modify the generated Makefile so that most compiler options are + not shown. This makes it simpler to read a build log and see the + actual warning messages. + + --disable-fifo-lines enable FIFO-storage for saved-lines + + With patch #244, xterm by default stores saved-lines in a FIFO + (circular buffer), which improves performance when the number of saved + lines is large. Disable this option to revert to the pre-244 layout. + + --disable-freetype disable freetype library-support + + Do not use freetype libraries if they are found. Normally they will + be used automatically. + + --disable-full-tgetent disable check for termcap library + + Do not look for the tgetent() function specifically in the termcap + library, accept the first library (from termlib, ncurses and curses) + which contains this function rather than continuing to search for + a termcap implementation rather than terminfo. The former would + supply the complete $TERMCAP data needed for some legacy programs. + + --disable-highlighting disable support for color highlighting + + Do not compile-in code that allows the selected region to be a + different color than the reverse of foreground/background colors. + + See the discussion of highlightColor in the manual. + + --disable-i18n disable internationalization + + Do not compile-in code to handle multi-byte characters. This is + related to, but not identical with the input method logic. + + --disable-imake disable use of imake for definitions + + Do not attempt to use imake to determine compiler options. + + The main.c file has many ifdef's which rely on obscure combinations + known only to imake. The configure script implements only a + portion of the tests needed to supplant imake. + + --disable-initial-erase disable setup for stty erase + + Do not compile-in code which aligns the stty erase and the backarrow + key. When compiled-in, xterm will optionally use the pty's sense + of stty erase and apply that to the backarrow mode (sending 8 or 127), + or go the other way, setting stty erase to match xterm's configuration. + + --disable-input-method disable input-method + + Do not compile-in code for "input method". This is an X11R6 + feature which deals with translation of composite characters. + + Some users report problems with their configuration, e.g., messages + stating that there is no input method defined for the given preedit + type. If you do not need input method (and are troubled by the + warning messages), it is safe to disable this option. + + --disable-leaks test: free permanent memory, analyze leaks + + Compile-in code which frees memory which might confuse a leak-testing + tool. Normally these chunks of memory are retained as long as xterm + is running. + + --disable-luit disable support for luit filter (Unicode translation) + + Luit is a filter that can be run between an arbitrary application and a + UTF-8 terminal emulator. It will convert application output from the + locale's encoding into UTF-8, and convert terminal input from UTF-8 + into the locale's encoding. + + This is normally enabled, relying upon "--enable-wide-chars". + + --disable-maximize disable actions for iconify/deiconify/maximize/restore + + Do not compile-in code that implements runtime 'actions' for + iconifying, maximizing, etc. + + Most users will find that the window manager is more suitable for + this sort of manipulation than putting the capabilities into xterm. + + --disable-num-lock disable NumLock keypad support + + Do not compile-in code that looks for the actual NumLock key to + support vt100/vt220 keypad translation. + + This is used in xterm to simplify logic, and to workaround some + quirks of the keyboard tables. Use the ``numLock'' resource to + disable this feature if you must customize xterm in some other way. + + (The same ifdef controls the metaSendsEscape support). + + --disable-openpty disable openpty, prefer other interfaces + + Do not check for, or use openpty(). Instead, use other interfaces such + as posix_openpt(). Modern (sic) BSD systems should have a workable + openpty() interface. Older systems may not. + + --disable-paste64 disable support for bracketed paste mode + + Do not compile-in code to support bracketed paste mode, along with + functions for setting/getting the selection data, termed "paste64". + + (see ctlseqs.ms description of OSC 52, and DECSET 2004). + + --disable-pty-handshake disable support for pty handshakes + + This feature is used to ensure that the child process's terminal modes + match the parent's. In particular, it addresses a problem where the + terminal size is not defined in the stty settings. + + --disable-rectangles disable VT420 rectangle support + + Do not compile-in code to support VT420 rectangle control-sequences. + + --disable-regex disable regular-expression selections + + Do not compile-in code to support the "regex" option for multiple + mouse clicks. + + --disable-rightbar disable right-scrollbar support + + Do not compile-in code that supports a scrollbar on the right. + + Left/right scrollbars are a matter of taste. Some older libraries + (e.g., X11R5) do not perform the geometry computation correctly, + leaving the right scrollbar incorrectly positioned after changing + the font size. + + --disable-rpath-hack don't add rpath options for additional libraries + + By default, the configure script looks for libraries in unusual places + and adds an rpath linker option to help. + + --disable-samename disable check for redundant name-change + + Do not compile-in code that suppresses redundant updates to the + titlebar when the text has not changed. + + --disable-screen-dumps disable XHTML and SVG screen dumps + + Do not compile-in code that provides XHTML and SVG screen dumps. + + --disable-selection-ops disable selection operations + + Do not compile-in code to support the actions which allow users + to bind keys that use the selection or extract data from the screen. + + --disable-session-mgt enable support for session management + + Do not compile-in code which adds simple session management hooks + which are used when closing an xterm. Normally the code is + compiled-in, except for systems which do not support it. + + --disable-setgid disable setgid + + Do not install xterm using setuid/setgid permissions. Drop setgid + permissions on startup. + + --disable-setuid disable setuid + + Do not install xterm using setuid/setgid permissions. Drop setuid + permissions on startup. + + --disable-sixel-graphics disable support for sixel-graphics + + Do not compile-in code to support sixel-graphics + + --disable-sun-fkeys + + Do not compile-in code to support Sun-style function keys. + + --disable-tcap-fkeys disable termcap function-keys + + Do not compile-in code to support feature which allows xterm to use the + function-key definitions from the termcap/terminfo entry which it used + to set the $TERM variable on startup. + + --disable-tcap-query disable termcap query/report + + Do not compile-in code to support DCS '+' control sequence, which + allows an application to ask xterm what control sequences it would + transmit for specified function keys, given the termcap or terminfo + names. + + --disable-tek4014 disable tek4014 emulation + + Do not compile-in code to support Tektronix 4014 emulation. + + This reduces the executable size by 17% (checked 1999/3/13). + + Some people use the Tektronix emulation (which has been in xterm + for many years) as an example of code bloat, though this is not an + accurate impression. + + --disable-vt52 disable VT52 emulation + + Do not compile-in code to support vt52 emulation. + + A genuine vt100 emulates a vt52. + + --disable-wide-attrs disable wide-attribute support + + Xterm's base attributes include all of those used in DEC terminals. + ISO 6429 defines a few more which historically have found little use. + Some people find these amusing. + + This is normally enabled. The direct-colors feature relies upon it. + + --disable-wide-chars disable wide-character support + + The wide-character code supports Unicode and UTF-8. + + This is normally enabled. + + --disable-ziconbeep disable -ziconbeep option + + Do not compile-in code that modifies the icon's title and sounds a + beep when they receive output. + + --enable-16bit-chars enable 16-bit characters support + + Enable wide-character support, but store only 16-bits for each wide + character. Unicode values can be larger than 16-bits, up to 21-bits. + This uses less memory, but is less complete. However, most languages + are covered by the 16-bit encoding. + + --enable-alt-sends-esc set default altSendsEscape resource (default: no) + + This sets the default resource value, which is shown in the manpage. + + --enable-backarrow-key set default backarrowKey resource (default: true) + + This sets the default resource value, which is shown in the manpage. + + --enable-backarrow-is-erase set default backarrowKeyIsErase resource (default: false) + + This sets the default resource value, which is shown in the manpage. + + --enable-broken-osc allow broken Linux OSC-strings + + Compile-in code to accommodate scripts that write Linux's malformed + palette control strings without checking. The result makes xterm + appear to freeze. This workaround makes xterm ignore the strings, + and is compiled-in by default for Linux. + + --enable-builtin-xpms compile-in icon data + + Compile-in X pixmap data for these icons: + filled-xterm + mini.xterm + xterm-color + xterm + at these sizes + 16x16 + 32x32 + 48x48 + + --enable-dabbrev enable dynamic-abbreviation support + + Compile-in support for "dabbrev-expand()" action and related key + translation. + + --enable-dec-locator enable DECterm Locator support + Add support for DEC Locator control sequences for xterm: + + DECEFR - Enable Filter Rectangle + DECELR - Enable Locator Reports + DECSLE - Select Locator Events + DECRQLP - Request Locator Position + + This allows the xterm mouse to be used with applications that use the + DEC Locator sequences, such as VAX Tpu, or SMG$ based applications. + + --enable-delete-is-del set default deleteIsDEL resource (default: maybe) + + This sets the default resource value, which is shown in the manpage. + + --enable-double-buffer enable double-buffering + + Set the initial value of the "buffered" resource, which tells + xterm to use double-buffering for display to reduce flicker. + + --enable-env-terminfo setenv $TERMINFO if --with-own-terminfo gives value + + Use the custom terminfo directory specified in "--with-own-terminfo" + as the $TERMINFO variable for the shells spawned by xterm. Setting + this variable makes most curses (and termcap) applications look in + that directory for terminal descriptions. + + --enable-exec-xterm enable "spawn-new-terminal" action + + If your platform supports the process filesystem "cwd" link, + compile-in support for the "spawn-new-terminal" action, which + allows you to define a key translation that runs a new xterm + using the same working directory as the current process within + xterm. + + --enable-hp-fkeys enable support for HP-style function keys + + Compile-in code to support HP-style function keys. + + --enable-load-vt-fonts enable load-vt-fonts() action + + Compile-in code that allows user to define load different VT-font + definitions at runtime. + + --enable-logfile-exec enable exec'd logfile filter + + Compile-in code that allows logging piped via an external filter. + + --enable-logging enable logging + + Compile-in code that allows logging. + + Logging was disabled in X11R5 xterm because of security problems. + They were addressed in X11R6, but the feature was not reinstated + because of concerns (long past) about xterm running as root-setuid. + + --enable-meta-sends-esc set default metaSendsEscape resource (default: no) + + This sets the default resource value, which is shown in the manpage. + + --enable-mini-luit enable support for poor man's luit filter (Latin-9) + + Provide built-in support for Latin-9, relying on having specified + Unicode (ISO10646) fonts and setting the locale resource to "checkfont". + + This sets "--enable-luit" as a side-effect. + + --enable-narrowproto enable narrow prototypes for X libraries + + Originally xterm was built using imake rather than a configure script. + One feature of imake that is not possible to guess within the + configure script is the wide-prototype compile-time definition + NARROWPROTO. When this is not set properly, the Athena widget + scrollbars do not work properly. xterm's configure script has a + fallback case which allows disabling imake. However, this is moot + with the X.org "modular" build, whose compiler options are unrelated to + imake or older versions of any libraries that it may distribute. In + this case, the configure script needs some help. Use this option to + enable or disable NARROW proto (and disable imake with the + --disable-imake option) to match the whims of X.org hackers. + + For instance + + configure --disable-imake --disable-narrowproto + + --enable-pty-erase set default ptyInitialErase resource (default: false) + + This sets the default resource value, which is shown in the manpage. + + --enable-readline-mouse enable support for mouse in readline applications + + Compile-in code to support predecessor to bracketed paste mode, i.e., + provide functions for setting/getting the selection data. Essentially + this puts xterm into a mode that sends special function-key strings to + bracket the data. + + (The "paste64" feature, which fits xterm's protocol better, is + configured by default). + + --enable-sco-fkeys enable support for SCO-style function keys + + Compile-in code to support SCO-style function keys. + + --enable-regis-graphics enable support for ReGIS graphics + + Compile-in code to support experimental ReGIS graphics + + --enable-toolbar enable pulldown menus on toolbar + + Compile-in code that builds a toolbar with pulldown menus. The + normal popup menus are still available. + + This is an experimental option. As of patch #206, it is known to + work well with fvwm, but not as well with some other window managers, + e.g., KDE's Kwin and IceWM. + + In addition to isolated layout problems, it is reported that some + flavors of the Athena widget library perform badly with ISO-10646 + fonts. You can work around those by setting the menu fonts to + an ISO-8859 variant in your X resources. + + --enable-trace test: set to enable debugging traces + + Compile-in code to trace xterm's internal states. + + This is a debugging feature. It causes xterm to produce two files + (Trace-parent.out and Trace-child.out). + + --enable-warnings test: turn on GCC compiler warnings + + Modify the generate Makefile to turn on gcc compiler warnings. + + I use this option regularly, and correct all but a few (difficult) + problems. + + --enable-xmc-glitch test: enable xmc magic-cookie emulation + + Compile-in code that simulates the terminfo "magic cookie" glitch. + + This is for testing ncurses. + + --with-Xaw3d link with Xaw 3d library + + Look for, compile and link with the Xaw 3d widget library. + + --with-Xaw3dxft link with Xaw 3d xft library + + Look for, compile and link with the Xaw 3d xft widget library. + + --with-XawPlus link with Athena-Plus library + + Look for, compile and link with the Xaw Plus widget library. + + --with-app-class=XXX X resource class (default: XTerm) + + Rename the X resource class, e.g., for packaging a development version + of xterm with different result names. + + --with-app-defaults=DIR directory in which to install resource files (default: EPREFIX/lib/X11/app-defaults) + + autoconf scripts assume that all of the files should be installed + under the same top-level directory. But X applications defaults + must be installed into a special directory, e.g., + + /usr/X11/lib/app-defaults + + However, there is no standard for this pathname. The manual page + for X notes that the environment variable $XUSERFILESEARCHPATH can + specify a list of places where X searches for applications defaults. + Also, it may look in $XAPPLRESDIR, but that usually is not related + to where xterm might be installed. To keep it simple, the configure + script uses + + EPREFIX/lib/X11/app-defaults + + as the default (EPREFIX is --prefix). That makes it work normally + for most systems if --prefix is /usr. For other installs, e.g., to + /usr/local, you should use this option to customize the location to + match your system configuration. + + Use --with-app-defaults=auto to ask the configure script to look in + a list of well-known locations for an existing directory. + + Use --without-app-defaults or --with-app-defaults=no to disable the + feature. + + --with-dmalloc test: use Gray Watson's dmalloc library + + Check for and link with dmalloc. + + --with-dbmalloc test: use Conor Cahill's dbmalloc library + + Check for and link with dbmalloc. + + --with-desktop-category=XXX one or more desktop categories or auto + This is a list of names. The configure script maps blanks and commas + to semicolons (";") which are used by the desktop utilities as a + separator. + + The default value "auto" tells the configure script to look + at existing ".desktop" files for xterm and common terminal + emulators, to use those. If none are found, the script uses this + default: + System;TerminalEmulator; + + --with-freetype-config configure script to use for FreeType + + Use a specific option value to tell the configure script to try + just one of the variations: + + "pkg*", e.g., pkg-config or pkgconfig uses whatever pkg-config + script was found. + + otherwise, the parameter value is used as the name of the script + to try, using --cflags and --libs options. + + Use --without-freetype-config to enable the --with-freetype-cflags + and --with-freetype-libs options. + + The default value "auto" tells the configure script to try the + pkg-config script first, then freetype-config and finally xft-config. + + --with-freetype-cflags -D/-I options for compiling with FreeType library + + Override options provided by xft-config or freetype-config. + + --with-freetype-libs -L/-l options for linking with FreeType library + + Override options provided by xft-config or freetype-config. + + --with-icon-name=NAME override icon name (default: xterm-color) + + xterm comes with a choice of icons: + + xterm-color: depicts a conventional terminal image, and is the default + icon used for icon-themes. + + mini.xterm: a more iconic choice which is readily identifiable at + small sizes. This is used for window decoration, e.g., the + icon at the upper left corner in many window managers. + + --with-icon-symlink=NAME create symbolic links to icon name (default: NONE) + + This is a workaround for certain systems which translate icon names + containing "xterm", e.g., "xterm-color" into the single icon "xterm". + The option should also be harmless on a properly configured system. + + If the option is used, its default value is "xterm". For each icon, + the makefile will strip the suffix (e.g., ".png"), as well as the part + of the filename which denotes the size (e.g., "_32x32" in an xpm file), + and constructs a link with that name to the icon. + + If the option is unused, its default value is "NONE" (no link is made). + + --with-icondir=DIR directory in which to install icon files (default: no) + + The X libraries may automatically search these locations: + + $HOME/.icons + $XDG_DATA_DIRS/icons + /usr/share/pixmaps + + Alternatively, the last may be actually + /usr/X11R6/share/pixmaps + + Use --with-icondir=auto to tell the configure script to search for + an existing directory from its list of well-known system locations. + + See also + http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html + http://www.freedesktop.org/software/icon-theme/ + + By default, the option is disabled; it is useful only for the + --with-icon-theme option. + + --with-icon-theme=XXX install icons into desktop theme (hicolor) + + Install png and svg icons into the given desktop theme and customize + the .desktop files to use that theme. If no theme name is given, + the default is "hicolor". If this option is not given, the desktop + file will use the pixmap files. + + --with-man2html[=XXX] use XXX rather than groff + + Specify an alternative program to use for converting manpages and + control sequences document to html. The default value for the option + is "man2html". If the "man2html" script is not found, then "groff" is + used with groff's special options. + + The "man2html" script reads formatted nroff output from its standard + input, and writes html to its standard output. Other input/output + conventions are not currently supported. + + See + http://invisible-island.net/scripts + http://invisible-island.net/scripts/man2html.html + + for an up-to-date version of "man2html". + + --with-neXtaw link with neXT Athena library + + Look for, compile and link with the neXT Athena widget library. + + --with-own-terminfo=P set default $TERMINFO (default: from environment) + + Modify the generated Makefile to set the target for the 'install-ti' + rule to point to the given directory. + + If you have the $TERMINFO variable defined in your environment, the + configure script may use that value, if it matches an existing + directory. If no option and no variable are are given, the configure + script uses /usr/lib/terminfo, if it exists. + + You do not have to run "make install-ti", if there is already a + workable terminfo description. Be advised, however, that the + common variety of "xterm-color" is not suited for xterm, but is + directed to other variations (such as nxterm) which do not + support the background-color erase capability. + + --with-pixmapdir=DIR directory in which to install pixmaps (DATADIR/pixmaps) + + Specify directory in which to install ".xpm" files. + + --with-pcre use PCRE for regular-expressions + + If regular expressions are not disabled (--disable-regex), use PCRE + rather than the POSIX regular expressions. + + --with-pcre2 use PCRE2 for regular-expressions + + If regular expressions are not disabled (--disable-regex), use PCRE2 + rather than the POSIX regular expressions. + + --with-pkg-config{=path} enable/disable use of pkg-config + + The configure script looks for certain libraries which have well + established pkg-config scripts, and will use those settings if + available. Not all pkg-config scripts work; this option suppresses + the check and relies on normal library search paths. + + --with-reference=XXX program to use as permissions-reference + + To install xterm with setuid permissions, the scripts usually compare + it with a previous install. That works well for individual + maintainers, but can be a problem for packagers who may be + cross-compiling, etc. This option lets the package builder specify + the file used for permissions reference. + + --with-setuid=XXX use the given setuid user + + Install xterm setuid'd to the given user. If no parameter value + is given, assume it is root. + + See also --with-utmp-setgid and --with-utempter, which manipulate + the setgid group. + + --with-tty-group=XXX use XXX for the tty-group + + If xterm is installed setuid'd to root, change the group of the tty + device to the given value on startup. Three cases are possible: + + a) If this option is not given, the configure script will attempt to + find a suitable value (usually "tty"), and verify that it exists in + the group database. + + b) If the option value is given, it will use the value even if it does + not exist in the group database (allowing packagers to work about + deficient environments). + + c) If the option is disabled, e.g., --without-tty-group, the + permissions change will use the group-id of the process. + + If xterm is not installed setuid'd to root, this option is not needed, + since it cannot change the tty device's ownership. + + --with-valgrind test: use valgrind + + Activate the --disable-leaks option, and ensure that "-g" is added to + CFLAGS. + + --without-xinerama do not use Xinerama extension for multiple screens + + Xinerama is an X server extension that allows multiple physical + screens to behave as a single screen. If you do not need the feature + (or do not want the extra library dependency), use this option to + suppress it. + + --with-xpm=DIR use Xpm library for colored icon, may specify path + + Use Xpm library to show colored icon in window decoration, e.g., + title area. + + Use --without-xpm to suppress this feature. + + --with-xterm-symlink=XXX make symbolic link to installed xterm + + If any of the configure options to modify the program name i.e., + --program-prefix, --program-suffix or --program-transform-name + are given, this option allows the makefile to create a symbolic link, + e.g., to "xterm" on install. The option value gives the name for + the link, which defaults to "xterm". + + Use --without-xterm-symlink to disable a link to "xterm" if none + is wanted. + + Corresponding links are also made for "resize", "uxterm" and + "koi8rxterm", as well as the xterm manpage. + + --with-terminal-id[=V] set default decTerminalID (default: vt100) + + Set the default emulation level. + + DEC terminals vt52/vt100/vt220/etc form a series where succeeding + models emulate features of the older terminals. While most + features of these terminals are recognized by xterm at all levels, + a few behave differently according to the emulation level. + + You can always override this with the command-line option "-ti". + + --with-terminal-type=T set default $TERM (default: xterm) + + Set the default value for $TERM. Xterm supports legacy termcap + applications by constructing a modified version of the $TERMCAP + variable at initialization, which supplies the resulting screen + size. It also sets $TERM, if not already set, for use by programs + running within xterm. + + The default value "xterm", can be overridden to avoid conflict + with older versions of xterm, e.g., those that do not implement + vt220 emulation. + + You can always override this with the command-line option "-tn". + + --with-utempter use utempter library for access to utmp + + The utempter library is a set-uid wrapper for the utmp facility. + On systems with Unix98 pty's, xterm can use this library when + available so it need not be installed set-uid. + + --with-utmp-setgid=XXX use setgid for access to utmp + + The option value specifies a group to use when installing. + xterm will be installed with setgid privilege to this group. + At runtime, xterm will drop the setuid privilege immediately + after opening the pseudo-terminal, and will have only the + group privilege needed to access the utmp file. This relies + on having POSIX setuid behavior. + +-- vile:txtmode diff --git a/ports/xterm/xterm-359/Imakefile b/ports/xterm/xterm-359/Imakefile new file mode 100644 index 0000000..cb2297c --- /dev/null +++ b/ports/xterm/xterm-359/Imakefile @@ -0,0 +1,338 @@ +XCOMM $XTermId: Imakefile,v 1.123 2019/11/02 21:50:51 tom Exp $ +XCOMM +XCOMM Attention xterm porters +XCOMM +XCOMM +XCOMM Xterm assumes that bcopy can handle overlapping arguments. If your +XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in +XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. +XCOMM + +/* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ +SCROLLBAR_RIGHT = -DSCROLLBAR_RIGHT + +/* Define UTF8support to compile-in support for UTF-8 */ +#define UTF8support + +/* + * setgid mode works for systems that do not require setuid to open pty. + * + * This feature could also be applied to FreeBSD, but requires the installer + * to define a "utmp" group as well as chgrp the utmp file to match. + * + * Note: InstallXtermSetUID is always defined; InstallXtermSetGID is defined + * in newer imake configurations. + */ +#if !defined(InstallXtermSetGID) && !InstallXtermSetUID +#if defined(OpenBSDArchitecture) || \ + (defined(LinuxArchitecture) && \ + (LinuxCLibMajorVersion == 6)) +#define InstallXtermSetGID YES +#endif +#endif + +/* + * Override the set uid/gid flags to use the utempter library. + */ +#if defined(UseUtempter) +#undef InstallXtermSetUID /* imake sets this */ +#undef InstallXtermSetGID /* we set this */ +#define InstallXtermSetUID NO +#define InstallXtermSetGID NO + UTMPLIB = -lutempter +#endif + +/* + * Fixes to allow compile with X11R5, etc. + */ +#ifndef InstGidFlags +#define InstGidFlags -m 2755 -g utmp +#endif + +#ifndef InstUidFlags +#define InstUidFlags -m 4711 +#endif + +#ifndef XkbClientDefines +#define XkbClientDefines /**/ +#endif + +#ifndef InstallXtermSetUID +#define InstallXtermSetUID NO +#endif + +#ifndef InstallXtermSetGID +#define InstallXtermSetGID NO +#endif + +#ifndef XkbClientDepLibs +#define XkbClientDepLibs /**/ +#endif + +#ifndef XkbClientLibs +#define XkbClientLibs /**/ +#endif + +/* This must come before setting DEFINES */ +#if InstallXtermSetGID +CSGIDFLAGS = -DUSE_UTMP_SETGID +INSTSETIDFLAGS = InstGidFlags +#elif InstallXtermSetUID +INSTSETIDFLAGS = InstUidFlags +#else +INSTSETIDFLAGS = NullParameter +#endif + +/* + * Compensate for broken imake configuration. + */ +#ifdef LinuxGnuSourceDefines +# ifdef UseInstalled + IMAKEDEFINES = -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 +# endif +#endif + +#ifndef SpecialCObjectRule +#define SpecialCObjectRule(module,ignore,defines) \ +module.o: ; $(CC) -c defines $(CFLAGS) module.c +#endif + +#ifndef ProgramTargetName +#define ProgramTargetName(program) program +#endif + +/* + * add -DWTMP and -DLASTLOG if you want them; make sure that bcopy can + * handle overlapping copies before using it. + */ +#if SetTtyGroup /* turn on in config/machine.cf */ + TTYGROUPDEF = -DUSE_TTY_GROUP +#endif +#ifdef UsePUCCPtyd /* turn on in config/site.def */ + PUCCPTYDDEF = -DPUCC_PTYD /* does not need to be setuid */ + PTYLIB = -lpucc +#endif + +#if defined(NetBSDArchitecture) || \ + defined(OpenBSDArchitecture) || \ + defined(FreeBSDArchitecture) || \ + (defined(LinuxArchitecture) && \ + (LinuxCLibMajorVersion == 6) && (LinuxCLibMinorVersion < 1)) + PTYLIB = -lutil +#endif + +#ifdef DarwinArchitecture +/* dyld can deadlock if a signal comes in when it is looking up a symbol */ + LOCAL_LDFLAGS = -Wl,-bind_at_load +#endif + + OSMAJORVERSION = OSMajorVersion + OSMINORVERSION = OSMinorVersion + +/* none of these can be expected to use termcap unless emulated by terminfo */ +#if defined(NTOArchitecture) || \ + defined(OpenBSDArchitecture) || \ + defined(SGIArchitecture) || \ + defined(SunArchitecture) || \ + defined(NetBSDArchitecture) || \ + defined(OpenBSDArchitecture) || \ + defined(FreeBSDArchitecture) || \ + defined(LinuxArchitecture) +TERMCAPDEFINES=-DUSE_TERMINFO -DHAVE_TIGETSTR -DHAVE_TERM_H +#endif + +#if !defined(OS2Architecture) && !defined(__GNU__) && !defined(Minix3Architecture) +#if defined(UseUtempter) + UTMPDEF = -DUSE_UTEMPTER +#else + UTMPDEF = -DUTMP +#endif +#endif + +#ifdef UTF8support + UTF8_OPTION = -DOPT_WIDE_CHARS -DOPT_LUIT_PROG + UTF8SRC = charclass.c precompose.c wcwidth.c xutf8.c + UTF8OBJ = charclass.o precompose.o wcwidth.o xutf8.o +#endif +#if BuildXftLibrary +#define XRenderSupport +#endif +#ifdef XRenderSupport + XRFDEF = -DXRENDERFONT -DXFREE86_FT2 + XRFLIBS = XftClientLibs + XRFDEPLIBS = XftClientDepLibs + XRFINCLUDES = $(XFTINCLUDES) +#endif +#if !HasPutenv + PUTENVDEF = -DNOPUTENV +#endif +#ifdef RegisXTerm + SIXELDEF = -DOPT_REGIS_GRAPHICS=1 +#endif +#ifdef SixelXTerm + SIXELDEF = -DOPT_SIXEL_GRAPHICS=1 +#endif +#ifdef TraceXTerm + TRACEDEF = -DOPT_TRACE=1 +#endif + MAIN_DEFINES = $(UTMPDEF) $(TTYGROUPDEF) $(PUCCPTYDDEF) $(CSGIDFLAGS) \ + -DOSMAJORVERSION=$(OSMAJORVERSION) \ + -DOSMINORVERSION=$(OSMINORVERSION) + MISC_DEFINES = /* -DALLOWLOGGING -DALLOWLOGFILEEXEC */ + XKB_DEFINES = XkbClientDefines + PATH_DEFINES = -DPROJECTROOT=$(PROJECTROOT) + DEFINES = $(XKB_DEFINES) $(TERMCAPDEFINES) $(FEATURE_DEFINES) $(SCROLLBAR_RIGHT) $(UTF8_OPTION) $(XRFDEF) $(PATH_DEFINES) $(PUTENVDEF) $(IMAKEDEFINES) $(SIXELDEF) $(TRACEDEF) + INCLUDES = -I. $(XRFINCLUDES) + + MAINSRC = main.c + MAINOBJ = main.o + DUMPSSRC = html.c svg.c + DUMPSOBJ = html.o svg.o +#ifdef RegisXTerm + SIXELSRC = graphics_regis.c + SIXELOBJ = graphics_regis.o +#endif +#ifdef SixelXTerm + SIXELSRC = graphics_sixel.c + SIXELOBJ = graphics_sixel.o +#endif +#ifdef TraceXTerm + TRACESRC = trace.c + TRACEOBJ = trace.o +#endif + SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \ + data.c doublechr.c fontutils.c input.c \ + linedata.c menu.c misc.c print.c ptydata.c scrollback.c \ + screen.c scrollbar.c tabs.c util.c version.c xstrings.c \ + xtermcap.c TekPrsTbl.c Tekproc.c VTPrsTbl.c \ + $(MAINSRC) $(EXTRASRC) $(UTF8SRC) $(SIXELSRC) $(TRACESRC) $(DUMPSSRC) + OBJS1 = button.o cachedGCs.o charproc.o charsets.o cursor.o \ + data.o doublechr.o fontutils.o input.o \ + linedata.o menu.o misc.o print.o ptydata.o scrollback.o \ + screen.o scrollbar.o tabs.o util.o version.o xstrings.o \ + xtermcap.o TekPrsTbl.o Tekproc.o VTPrsTbl.o \ + $(MAINOBJ) $(EXTRAOBJ) $(UTF8OBJ) $(SIXELOBJ) $(TRACEOBJ) $(DUMPSOBJ) + SRCS2 = resize.c version.c xstrings.c + OBJS2 = resize.o version.o xstrings.o + SRCS = $(SRCS1) $(SRCS2) + OBJS = $(OBJS1) $(OBJS2) + PROGRAMS = ProgramTargetName(resize) ProgramTargetName(xterm) + DEPLIBS1 = XkbClientDepLibs XawClientDepLibs $(XRFDEPLIBS) + DEPLIBS2 = + +#ifndef TermcapLibrary +#if SystemV && !defined(MacIIArchitecture) +#if defined(CrayArchitecture) || \ + (defined(HPArchitecture) && (OSMajorVersion < 10)) || \ + defined(RsArchitecture) || \ + defined(SCOArchitecture) || \ + defined(USLArchitecture) +#define TermcapLibrary -lcurses /* special cases of System V */ +#else +#define TermcapLibrary -ltermlib /* usually in here */ +#endif +#else +#define TermcapLibrary -ltermcap /* bsd puts it here */ +#endif +#endif + + TERMCAPLIB = TermcapLibrary + +AllTarget($(PROGRAMS)) + +VTPARSE_H = VTparse.h VTparse.hin +TEKPARSE_H = Tekparse.h Tekparse.hin + +VTPARSE_C = VTparse.h VTparse.cin +TEKPARSE_C = Tekparse.h Tekparse.cin + +.SUFFIXES : .def .cin .hin +.def.cin : + awk '/^CASE_/{printf "{ %d, \"%s\" },\n", n++, $$1; }' < $< >$@ +.def.hin : + awk '/^CASE_/{printf "#define %s %d\n", $$1, n++}' < $< >$@ + +SpecialCObjectRule(main,$(_NOOP_),$(MAIN_DEFINES)) +SpecialCObjectRule(menu,$(_NOOP_),$(MISC_DEFINES)) +SpecialCObjectRule(misc,$(VTPARSE_H),$(MISC_DEFINES)) +SpecialCObjectRule(VTPrsTbl,$(VTPARSE_H),$(MISC_DEFINES)) +SpecialCObjectRule(charproc,$(VTPARSE_H),$(MISC_DEFINES)) +SpecialCObjectRule(data,$(_NOOP_),$(MISC_DEFINES)) +SpecialCObjectRule(TekPrsTbl,$(TEKPARSE_H),$(MISC_DEFINES)) +SpecialCObjectRule(TekProc,$(TEKPARSE_H),$(MISC_DEFINES)) +SpecialCObjectRule(trace,$(VTPARSE_C) $(TEKPARSE_C),$(MISC_DEFINES)) + +#if InstallXtermSetUID +SetUIDProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(PTYLIB)) +#else +NormalProgramTarget(xterm,$(OBJS1),$(DEPLIBS1),$(XRFLIBS) XkbClientLibs XawClientLibs,$(TERMCAPLIB) $(UTMPLIB) $(PTYLIB)) +#endif + +#if defined(OpenBSDArchitecture) || defined(MirBSDArchitecture) +/* On OpenBSD xterm is now setgid utmp */ +INSTUIDFLAGS= -m 2555 -g utmp +#endif + +#if InstallXtermSetUID && defined(SunArchitecture) && HasSharedLibraries && (OSMajorVersion < 5) +#if AlternateUsrLibDir +#if ((OSMajorVersion == 4) && (OSMinorVersion >= 1)) +LDOVERRIDE = -L$(DESTDIR)$(USRLIBDIR) +#else +#if HasGcc +LDOVERRIDE = -static -L$(DESTDIR)$(USRLIBDIR) +#else +LDOVERRIDE = -Bstatic -L$(DESTDIR)$(USRLIBDIR) +LDRESUME = -Bdynamic +#endif +#endif +#endif +install:: + MakeDir($(DESTDIR)$(BINDIR)) + RemoveFile(ProgramTargetName(xterm.inst)) + LinkRule(ProgramTargetName(xterm.inst),$(CDEBUGFLAGS) $(CCOPTIONS) + $(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS),$(OBJS1),$(LDOVERRIDE) + $(XRFLIBS) XawClientLibs $(LDRESUME) $(LDLIBS) $(TERMCAPLIB) + $(PTYLIB)) + $(INSTALL) -c $(INSTPGMFLAGS) $(INSTSETIDFLAGS) ProgramTargetName(xterm.inst) $(DESTDIR)$(BINDIR)/ProgramTargetName(xterm) + RemoveFile(ProgramTargetName(xterm.inst)) +#else +InstallProgramWithFlags(xterm,$(BINDIR),$(INSTSETIDFLAGS)) +#endif + +InstallNamedProg(uxterm,uxterm,$(BINDIR)) + +/* + * Link with the termcap library if USE_TERMCAP is defined in resize.c + */ +#if defined(NTOArchitecture) || \ + defined(LinuxArchitecture) || \ + defined(OpenBSDArchitecture) || \ + defined(SGIArchitecture) || \ + defined(SunArchitecture) +NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,NullParameter) +#else +NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB)) +#endif + +InstallProgramWithFlags(resize,$(BINDIR),NullParameter) + +/* + * termcap is a special name that does not install correctly with + * InstallNamedNonExec() + */ +install:: + MakeDir($(DESTDIR)$(LIBDIR)/etc) + $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) termcap \ + $(DESTDIR)$(LIBDIR)/etc/xterm.termcap +InstallNamedNonExec(terminfo,xterm.terminfo,$(LIBDIR)/etc) + +InstallAppDefaults(XTerm) +InstallAppDefaults(UXTerm) +InstallAppDefaultsLong(XTerm-col,XTerm-color) +InstallManPage(xterm,$(MANDIR)) +InstallManPage(resize,$(MANDIR)) + +cleandir:: + $(RM) *parse.hin *parse.cin + +DependTarget() diff --git a/ports/xterm/xterm-359/KOI8RXTerm.ad b/ports/xterm/xterm-359/KOI8RXTerm.ad new file mode 100644 index 0000000..acc82d2 --- /dev/null +++ b/ports/xterm/xterm-359/KOI8RXTerm.ad @@ -0,0 +1,50 @@ +! $XTermId: KOI8RXTerm.ad,v 1.4 2010/03/04 01:17:49 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 2007,2010 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- +! This is based on the UXTerm app-defaults file. +! ----------------------------------------------------------------------------- +! Use +! xterm -class KOI8RXTerm +! to set resources for KOI8-R mode with corresponding fonts. + +#include "XTerm" + +*fontMenu.Label: KOI8-R Fonts +*VT100*allowC1Printable: true + +! Use Cyrillic instead of Latin fonts. +*VT100.font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-koi8-r +*VT100.font2: -misc-fixed-medium-r-normal--8-80-75-75-c-50-koi8-r +*VT100.font3: -misc-fixed-medium-r-normal--14-130-75-75-c-70-koi8-r +*VT100.font4: -misc-fixed-medium-r-normal--13-120-75-75-c-80-koi8-r +*VT100.font5: -misc-fixed-medium-r-normal--18-120-100-100-c-90-koi8-r +*VT100.font6: -misc-fixed-medium-r-normal--20-200-75-75-c-100-koi8-r diff --git a/ports/xterm/xterm-359/MANIFEST b/ports/xterm/xterm-359/MANIFEST new file mode 100644 index 0000000..75d9382 --- /dev/null +++ b/ports/xterm/xterm-359/MANIFEST @@ -0,0 +1,228 @@ +MANIFEST for xterm-359, version xterm-359 +-------------------------------------------------------------------------------- +MANIFEST this file +256colres.h resource-definitions for 256-color mode +256colres.pl script to generate 256colres.h +88colres.h resource definitions for 88-color mode +88colres.pl script to generate 88colres.h +AAA_README_VMS.txt note for VMS port of 'xterm' +COPYING license for this program +INSTALL configure script: options and related install instructions +Imakefile imake template for Makefile +KOI8RXTerm.ad resources for koi8rxterm +Makefile.in configure script template for Makefile +README overview & caveats for 'xterm' +README.i18n i18n readme: +README.os390 overview for os390 (EBCDIC) port of 'xterm' +THANKS list of direct contributors +TekPrsTbl.c Tek4014 parser state tables +Tekparse.def template for generating Tekparse.h +Tekparse.h Tek4014 parser-state definitions +Tekproc.c Tek4014 parser-state functions +Tests Useful tests for xterm-developers +UXTerm.ad alternate resources for UTF-8 +VTPrsTbl.c VT100 parser state tables +VTparse.def template for generating VTparse.h +VTparse.h VT100 parser-state definitions +XTerm-col.ad color resource definitions for XTerm class +XTerm.ad resource definitions for XTerm class +aclocal.m4 configure script: custom macros +button.c mouse button and selection processing +cachedGCs.c maintain cache of GC's +charclass.c compact character-class module +charclass.h interface of charclass.c +charproc.c VT100 parser functions +charsets.c module to translate character-sets +config.guess configure script: guess the system type +config.sub configure script: validate system type +configure generated +configure.in template for generating configure script +ctlseqs.ms documentation: Xterm Control Sequences +ctlseqs.txt generated rendition of ctlseqs.ms +cursor.c VT100 low-level cursor movement +data.c global data declarations +data.h global data external-definitions +df-install.in utility script for desktop-files +doublechr.c VT100 double-size character support +error.h error-code definitions for 'xterm' +fontutils.c xterm functions for (re)loading fonts +fontutils.h interface of fontutils.c +gen-charsets.pl script to convert codepages into code +gen-pc-fkeys.pl script to generate extended function-key terminfo +graphics.c graphics support functions for 'xterm' +graphics.h interface of graphics.c +graphics_regis.c support for ReGIS +graphics_regis.h interface of graphics_regis.c +graphics_sixel.c support for Sixels +graphics_sixel.h interface of graphics_sixel.c +html.c format HTML-screendumps +input.c VT100 key-symbol and function-key translation +install-sh install-script (needed by configure) +keysym2ucs.c lookup-table for UTF-8 to keysyms +keysym2ucs.h interface of keysym2ucs.c +koi8rxterm KOI-8 wrapper from Debian (originally me) +koi8rxterm.man manpage for koi8rxterm +linedata.c manage all line-data for VT100 widget +link_axp.com build-script for VMS port of xterm +main.c main program of 'xterm' +main.h default definitions for 'xterm' +make.com build-script for VMS port of 'xterm' +menu.c popup/pulldown menus for 'xterm' +menu.h interface of menu.c +minstall.in script for installing manpages +misc.c miscellaneous utility functions for 'xterm' +plink.sh script to prune unneeded libraries from link +precompose.c table of precompose sequences +precompose.h interface of precompose.c +print.c VT100+ print support functions +ptydata.c functions to manipulate data read from pty +ptyx.h structure-definitions for 'xterm' +resize.c program to compute/modify xterm's window size +resize.man manual page for 'resize' +run-tic.sh run tic, filtering out harmless messages +screen.c VT100 screen update functions +scrollback.c manage scrollback (a big FIFO) +scrollbar.c VT100 scrollbar support functions +sinstall.sh install setuid if existing program was +svg.c format SVG-screendumps +tabs.c VT100 tabstop support-functions +termcap termcap entries for 'xterm' +terminfo terminfo entries for 'xterm' +testxmc.c testing: xmc/magic-cookies +trace.c debugging trace functions for 'xterm' +trace.h interface of trace.c +util.c miscellaneous utility functions for 'xterm' +uxterm wrapper script to make unicode-xterm +uxterm.desktop sample desktop file for uxterm +uxterm.man manpage for uxterm, from Debian +version.c xterm package version, used also in resize +version.h version of xterm +vms.c VMS version of xterm's spawn(), etc. +vms.h system headers and definitions for vms.c +wcwidth.c wide-character utility functions +wcwidth.h interface of wcwidth.c +xcharmouse.h Jason Bacon's mouse-defs, cleaned up a little +xstrings.c a few common string functions +xstrings.h interface of xstrings.c +xterm.appdata.xml sample "appdata.xml" file +xterm.dat application defaults for VMS port of 'xterm' +xterm.desktop sample desktop file for xterm. +xterm.h common includes, definitions and prototypes for 'xterm' +xterm.log.html changelog for xterm +xterm.man manual page for 'xterm' +xterm_axp.opt linker options file for VMS port of 'xterm' +xterm_io.h split-out definitions of termio/termios/sgtty and winsize from main.c, os2main.c, screen.c and resize.c +xtermcap.c termcap-related functions. +xtermcap.h interface of xtermcap.c +xtermcfg.hin configure script: template for xtermcfg.h +xutf8.c JC's cleanup of UTF8 +xutf8.h JC's cleanup of UTF8 +icons subdirectory +icons/filled-xterm.png filled-xterm variants +icons/filled-xterm.svg filled-xterm variants +icons/filled-xterm.xpms filled-xterm variants +icons/filled-xterm_16x16.xpm filled-xterm variants +icons/filled-xterm_32x32.xpm filled-xterm variants +icons/filled-xterm_48x48.xpm filled-xterm variants +icons/make-xpms script to make combined xpm-icons +icons/mini.xterm.svg svg format for mini-icon +icons/mini.xterm.xpms collection of mini-icons +icons/mini.xterm_16x16.png mini-icon 16x16 png +icons/mini.xterm_16x16.xpm mini-icon 16x16 pixmap +icons/mini.xterm_256x256.png mini-icon 256x256 png +icons/mini.xterm_32x32.png mini-icon 32x32 png +icons/mini.xterm_32x32.xpm mini-icon 32x32 pixmap +icons/mini.xterm_48x48.png mini-icon 48x48 png +icons/mini.xterm_48x48.xpm mini-icon 48x48 pixmap +icons/terminal_48x48.svg svg-format of "terminal" +icons/terminal_48x48.xpm xpm-format of "terminal" +icons/xterm-color.png xterm-color 48x48, in png-format +icons/xterm-color.svg xterm-color icon +icons/xterm-color.xpms collection of color icons +icons/xterm-color_16x16.xpm 16x16 color icon +icons/xterm-color_32x32.xpm 32x32 color icon +icons/xterm-color_48x48.xpm 48x48 color icon +icons/xterm.png xterm 48x48, in png-format +icons/xterm.svg xterm icon +icons/xterm.xpms collection of icons +icons/xterm_16x16.xpm normal icon 16x16 pixmap +icons/xterm_32x32.xpm 32x32 monochrome icon +icons/xterm_48x48.xpm 48x48 monochrome icon +package/debian subdirectory +package/debian/changelog build-script +package/debian/color.sed build-script +package/debian/compat build-script +package/debian/control build-script +package/debian/copyright build-script +package/debian/postinst post-install script for update-alternatives +package/debian/prerm pre-remove script for update-alternatives +package/debian/rules build-script +package/debian/source subdirectory +package/debian/source/format build-script +package/debian subdirectory +package/debian/watch build-script +package/debian/xterm-dev.docs build-script +package/debian/xterm-dev.lintian-overrides ignore useless warnings from lintian +package/debian/xterm-dev.menu Debian menu-file for xterm-dev package. +package/debian/xterm-xres.sed build-script +package/freebsd subdirectory +package/freebsd/Makefile build-script +package/freebsd/distinfo generated sums +package/freebsd/pkg-descr build-script +package/freebsd/pkg-message build-script +package/freebsd/pkg-message.wchar build-script +package/freebsd/pkg-plist build-script +package/pkgsrc subdirectory +package/pkgsrc/DESCR build-script +package/pkgsrc/Makefile build-script +package/pkgsrc/PLIST build-script +package/pkgsrc/distinfo build-script +package/pkgsrc/options.mk build-script +package subdirectory +package/xterm.spec build-script +tektests subdirectory +tektests/aitest.tek tek4014 demo: draw a globe +tektests/dmerc.tek tek4014 demo: draws a Mercator projection with orbit +tektests/fotest.tek tek4014 demo: draw a scatterplot on log scale +tektests/imtest.tek tek4014 demo: draw a test pattern +tektests/imtesth.tek tek4014 demo: draw a test pattern +tektests/ocpred.tek tek4014 demo: an occultation prediction +tektests/usmap.tek tek4014 demo: a US map +unicode subdirectory +unicode/README description of files in ./unicode +unicode/convmap.pl perl script for generating the lookup table for UTF-8 to keysym +unicode/keysym.map keysym mapping from UTF-8 +unicode/make-precompose.sh make precompose.c +unicode/precompose.c.head header of precompose.c +unicode/precompose.c.tail tail of precompose.c +vttests subdirectory +vttests/16colors.sh test-script to show 16-colors +vttests/256colors.pl script to illustrate 256-colors +vttests/256colors2.pl fancy test-script for 256-colors +vttests/88colors.pl sample script showing 88-colors +vttests/88colors2.pl sample script showing 88-colors +vttests/8colors.sh test-script to illustrate 8-colors +vttests/acolors.sh demonstrate changing the ANSI colors +vttests/closest-rgb.pl demo of color-distances +vttests/doublechars.sh test script to demonstrate doublesize chars +vttests/dynamic.pl demo for dynamic colors +vttests/dynamic.sh script to illustrate the dynamic colors control sequence +vttests/dynamic2.sh complete example of dynamic colors +vttests/fonts.sh script to demonstrate font-switching sequences +vttests/modify-keys.pl illustrate modifyOtherKeys with a table +vttests/mouse-codes demo script for mouse-codes +vttests/other-sgr.sh demonstrate non-VTxx SGRs +vttests/paste64.pl script to test base64-selection option +vttests/print-vt-chars.pl demo-script +vttests/query-color.pl demonstrate OSC 4 +vttests/query-dynamic.pl demonstrate OSC 10 to OSC 19 +vttests/query-fonts.pl script to demo/test font-querying +vttests/query-status.pl query DECRQSS status +vttests/query-xres.pl test/demo for DCS+Q +vttests/report-sgr.pl demonstrate report-sgr +vttests/resize.pl translated resize.sh to perl since it is easy to test, and I needed +vttests/resize.sh script to demonstrate resizing +vttests/sgrPushPop.pl demonstrate xterm SGR push/pop +vttests/sgrPushPop2.pl demonstrate xterm SGR push/pop for colors +vttests/tcapquery.pl script to test tcap-query option +vttests/title.sh test-script to show title of xterm in action diff --git a/ports/xterm/xterm-359/Makefile b/ports/xterm/xterm-359/Makefile new file mode 100644 index 0000000..172d7bf --- /dev/null +++ b/ports/xterm/xterm-359/Makefile @@ -0,0 +1,634 @@ +## $XTermId: Makefile.in,v 1.253 2020/08/02 19:12:41 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1997-2019,2020 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +srcdir = . + + +x = +o = .o + +CC = gcc +CPP = gcc -E +AWK = awk +LINK = $(CC) $(CFLAGS) + +CTAGS = +ETAGS = + +LN_S = ln -s +RM = rm -f +LINT = +LINT_OPTS = + +INSTALL = /bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +transform = s,x,x, + +EXTRA_CFLAGS = +EXTRA_CPPFLAGS = -DPROJECTROOT='"/usr"' -D__vendorversion__='"Version 7.7.0 X.Org"' +EXTRA_LOADFLAGS = + +CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 -DDEFCLASS=\"XTerm\" $(EXTRA_CPPFLAGS) +CFLAGS = -g -O2 $(EXTRA_CFLAGS) +LDFLAGS = +LIBS = -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses + +prefix = /usr/local +exec_prefix = ${prefix} +datarootdir = ${prefix}/share +datadir = ${datarootdir} + +manext = 1 +bindir = ${exec_prefix}/bin +libdir = ${exec_prefix}/lib +mandir = ${datarootdir}/man/man$(manext) +appsdir = ${exec_prefix}/lib/X11/app-defaults +icondir = no +pixmapdir = ${datadir}/pixmaps + +#### End of system configuration section. #### + +ICON_NAME = mini.xterm +ICON_SYMLINK = NONE + +DESTDIR = +BINDIR = $(DESTDIR)$(bindir) +LIBDIR = $(DESTDIR)$(libdir) +MANDIR = $(DESTDIR)$(mandir) +APPSDIR = $(DESTDIR)$(appsdir) + +#ICONDIR = $(DESTDIR)$(icondir) +PIXMAPDIR = $(DESTDIR)$(pixmapdir) + +INSTALL_DIRS = $(BINDIR) $(APPSDIR) $(ICONDIR) $(PIXMAPDIR) $(MANDIR) + +CLASS = XTerm +EXTRAHDR = 256colres.h Tekparse.h charclass.h precompose.h wcwidth.h graphics_sixel.h graphics.h +EXTRASRC = TekPrsTbl.c Tekproc.c charclass.c precompose.c wcwidth.c html.c svg.c graphics_sixel.c graphics.c +EXTRAOBJ = TekPrsTbl.o Tekproc.o charclass.o precompose.o wcwidth.o html.o svg.o graphics_sixel.o graphics.o + +AUTO_SOURCE = \ + builtin_icons.h \ + VTparse.cin \ + Tekparse.cin \ + VTparse.hin \ + Tekparse.hin + + SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \ + data.c doublechr.c fontutils.c input.c \ + linedata.c main.c menu.c misc.c \ + print.c ptydata.c scrollback.c \ + screen.c scrollbar.c tabs.c util.c version.c xstrings.c \ + xtermcap.c VTPrsTbl.c $(EXTRASRC) + OBJS1 = button$o cachedGCs$o charproc$o charsets$o cursor$o \ + data$o doublechr$o fontutils$o input$o \ + linedata$o main$o menu$o misc$o \ + print$o ptydata$o scrollback$o \ + screen$o scrollbar$o tabs$o util$o version$o xstrings$o \ + xtermcap$o VTPrsTbl$o $(EXTRAOBJ) + SRCS2 = resize.c version.c xstrings.c + OBJS2 = resize$o version$o xstrings$o + SRCS = $(SRCS1) $(SRCS2) + OBJS = $(OBJS1) $(OBJS2) + HDRS = VTparse.h data.h error.h fontutils.h main.h menu.h \ + ptyx.h version.h xstrings.h xterm.h xtermcap.h $(EXTRAHDR) + PROGRAMS = xterm$x resize$x + TEST_PROGRAMS = test_charclass$x test_ptydata$x test_wcwidth$x + +all : $(PROGRAMS) +################################################################################ +.SUFFIXES : .i .def .cin .hin .$(manext) .ms .man .txt .html .ps .pdf + +.c$o : + + $(CC) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/$*.c + +.c.i : + + $(CPP) -C $(CPPFLAGS) $*.c >$@ + +.def.cin : + @echo "making $@ from $<" + @$(AWK) 'BEGIN{printf "/* vile:cmode */\n";}/^CASE_/{printf "{ %d, \"%s\" },\n", n++, $$1; }' < $< >$@ + +.def.hin : + @echo "making $@ from $<" + @$(AWK) 'BEGIN{printf "/* vile:cmode */\n";}/^CASE_/{printf "#define %s %d\n", $$1, n++}' < $< >$@ + +.man.$(manext) : + $(SHELL) ./minstall "$(INSTALL_DATA)" $< $@ $(appsdir) $(CLASS) $* $* $(pixmapdir) + +#.$(manext).txt : +# $(SHELL) -c "tbl $*.$(manext) | nroff -man | col -bx" >$@ +# +#.ms.txt : +# $(SHELL) -c "tbl $*.$(manext) | nroff -ms | col -bx" >$@ +# + +.$(manext).html : + ./man2html.tmp $* $(manext) man >$@ + +.$(manext).ps : + $(SHELL) -c "tbl $*.$(manext) | groff -man" >$@ + +.$(manext).txt : + GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -Tascii -man | col -bx" >$@ + +.ms.html : + ./man2html.tmp $* ms ms >$@ + +.ms.ps : + $(SHELL) -c "tbl $< | groff -ms" >$@ + +.ms.txt : + GROFF_NO_SGR=stupid $(SHELL) -c "tbl $< | groff -Tascii -ms | col -bx" >$@ + +.ps.pdf : + ps2pdf $*.ps +################################################################################ + +VTPARSE_H = VTparse.h VTparse.hin +TEKPARSE_H = Tekparse.h Tekparse.hin + +main$o : main.h +misc$o : version.h + +$(OBJS1) : xterm.h ptyx.h xtermcfg.h +main$o resize$o screen$o : xterm_io.h + +xterm$x : $(OBJS1) + $(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS) $(EXTRA_LOADFLAGS) + +resize$x : $(OBJS2) + $(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(LIBS) + +256colres.h : + -$(RM) $@ + perl $(srcdir)/256colres.pl > $@ + +88colres.h : + -$(RM) $@ + perl $(srcdir)/88colres.pl > $@ + +charproc$o : $(VTPARSE_H) main.h 256colres.h +graphics_regis$o : $(VTPARSE_H) +graphics_sixel$o : $(VTPARSE_H) +misc$o : $(VTPARSE_H) +VTPrsTbl$o : $(VTPARSE_H) + +TekPrsTbl$o : $(TEKPARSE_H) +Tekproc$o : $(TEKPARSE_H) + +misc$o : builtin_icons.h + +trace$o : VTparse.cin Tekparse.cin + +# do this to quiet gcc -Wcast-qual warnings +builtin_icons.h : + @echo "#if OPT_BUILTIN_XPMS" >$@ + @echo "#include " >>$@ + @echo "#include " >>$@ + @echo "#include " >>$@ + @echo "#include " >>$@ + @echo "#else" >>$@ + @sed -e 's/static char \* /static const char * /' $(srcdir)/icons/mini.xterm_48x48.xpm >>$@ + @echo "#endif" >>$@ + @echo "made $@" + +################################################################################ +test_charclass$x : $(srcdir)/charclass.c + $(SHELL) $(srcdir)/plink.sh $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -DTEST_DRIVER $(srcdir)/charclass.c $(LDFLAGS) $(LIBS) + +################################################################################ +test_ptydata$x : $(srcdir)/ptydata.c + $(SHELL) $(srcdir)/plink.sh $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -DTEST_DRIVER $(srcdir)/ptydata.c $(LDFLAGS) $(LIBS) + +################################################################################ +test_wcwidth$x : $(srcdir)/wcwidth.c + $(SHELL) $(srcdir)/plink.sh $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -DTEST_DRIVER $(srcdir)/wcwidth.c $(LDFLAGS) $(LIBS) + +################################################################################ +actual_xterm = `echo xterm| sed '$(transform)'` +actual_resize = `echo resize| sed '$(transform)'` +actual_uxterm = `echo uxterm| sed '$(transform)'` +actual_k8term = `echo koi8rxterm| sed '$(transform)'` + +binary_xterm = $(actual_xterm)$x +binary_resize = $(actual_resize)$x +binary_uxterm = $(actual_uxterm) +binary_k8term = $(actual_k8term) + +install \ +install-bin \ +install-full :: xterm$x resize$x $(BINDIR) + $(SHELL) $(srcdir)/sinstall.sh "$(INSTALL_PROGRAM)" xterm$x /bin/xterm $(BINDIR)/$(binary_xterm) +# $(INSTALL_PROGRAM) xterm$x $(BINDIR)/$(binary_xterm) + $(INSTALL_PROGRAM) -m 755 resize$x $(BINDIR)/$(binary_resize) + +EDIT_SCRIPT = sed -e s,=xterm,=\$$name, -e s,XTerm,$(CLASS), + +InstallLink = \ + if test NONE != NONE \ + && test \$$source != NONE \ + && test \$$source != \$$target ; then \ + cd \$$TARGET && ( \ + $(RM) \$$source ; \ + $(LN_S) \$$target \$$source ; \ + echo \"... created symbolic link:\" ; \ + ls -l \$$target \$$source ) ; \ + fi + +InstallBinLink = TARGET=$(BINDIR); $(InstallLink) +InstallManLink = TARGET=$(MANDIR); $(InstallLink) + +InstallScript = \ + echo \"... installing $(BINDIR)/\$$target\"; \ + name=$(binary_xterm); \ + $(EDIT_SCRIPT) $(srcdir)/\$$source >\$$source.tmp; \ + $(INSTALL_SCRIPT) -m 755 \$$source.tmp $(BINDIR)/\$$target; \ + $(RM) \$$source.tmp + +install \ +install-bin \ +install-scripts \ +install-full :: $(BINDIR) + @$(SHELL) -c "source=\"NONE\"; \ + target=\"$(binary_xterm)\"; \ + $(InstallBinLink)" + @$(SHELL) -c "source=\"resize\"; \ + target=\"$(binary_resize)\"; \ + $(InstallBinLink)" + @$(SHELL) -c "source=\"uxterm\"; \ + target=\"$(binary_uxterm)\"; \ + $(InstallScript); \ + $(InstallBinLink)" + @$(SHELL) -c "source=\"koi8rxterm\"; \ + target=\"$(binary_k8term)\"; \ + $(InstallScript); \ + $(InstallBinLink)" + +install \ +install-man \ +install-full :: $(MANDIR) + @-$(SHELL) -c "for source in xterm resize uxterm koi8rxterm ; \ + do \ + target=\`echo \"\$$source\" | sed 's,x,x,'\`; \ + $(SHELL) ./minstall \"$(INSTALL_DATA)\" \ + $(srcdir)/\$$source.man \ + $(MANDIR)/\$$target.$(manext) \ + $(appsdir) \ + $(CLASS) \ + \$$source \ + \$$target \ + $(pixmapdir); \ + done" + @-$(SHELL) -c "if test NONE != NONE ; then \ + source=$(actual_xterm).$(manext); \ + target=NONE.$(manext); \ + cd $(MANDIR) && ( \ + $(RM) \$$target ; \ + $(LN_S) \$$source \$$target ; \ + echo '... created symbolic link:' ; \ + ls -l \$$source \$$target ; \ + ) \ + fi" + +APP_NAMES = XTerm UXTerm KOI8RXTerm + +install \ +install-app \ +install-full :: $(APPSDIR) + @-$(SHELL) -c 'for s in $(APP_NAMES); \ + do \ + echo "** $$s"; \ + d=`echo $$s | sed -e s/XTerm/$(CLASS)/`; \ + echo installing $(APPSDIR)/$$d; \ + sed -e s/XTerm/$(CLASS)/ $(srcdir)/$$s.ad >XTerm.tmp; \ + $(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$$d; \ + echo installing $(APPSDIR)/$$d-color; \ + sed -e s/XTerm/$$d/ $(srcdir)/XTerm-col.ad >XTerm.tmp; \ + $(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$$d-color; \ + done' + @$(RM) XTerm.tmp +# @echo "... installed app-defaults" + +#ICON_LIST = icons/mini.xterm_48x48.png icons/mini.xterm_48x48.xpm +#ICON_THEME = no +#install \ +#install-icon \ +#install-full :: $(ICONDIR) +# ACTUAL_XTERM=$(actual_xterm) $(SHELL) -c '\ +# h=$(ICONDIR)/$(ICON_THEME); \ +# for n in $(ICON_LIST); \ +# do \ +# x=$$ACTUAL_XTERM; \ +# l=`echo "$$n" | cut -f1 -d:`; \ +# r=`echo "$$n" | cut -f2 -d: |sed -e "s,xterm,$$ACTUAL_XTERM,"`; \ +# test -z "$$r" && continue; \ +# d=$$h/`echo "$$r" | sed -e "s,/[^/]*$$,,"`; \ +# test -d "$$d" || mkdir -p "$$d"; \ +# echo "installing icon $$h/$$r"; \ +# $(INSTALL_DATA) $$l $$h/$$r; \ +# s=`echo "$$r" | sed -e '"'s,^.*\.,.,'"'`; \ +# t=$(ICON_SYMLINK)$$s; \ +# b=`basename $$n $$s | sed -e "s,_[1-9][0-9]*x.*,,"`; \ +# if test "$(ICON_SYMLINK)" != NONE ; then \ +# if test "$$r" != "$$t" ; then \ +# if test "x$$b" = "x$(ICON_NAME)" ; then \ +# echo "linking $$r -> $$t"; \ +# ( cd $$h; $(RM) $$t; $(LN_S) $$r $$t; ) \ +# fi \ +# fi \ +# fi \ +# done' +# @echo "... installed icons" + +install \ +install-icon \ +install-full :: $(PIXMAPDIR) + ACTUAL_XTERM=$(actual_xterm) $(SHELL) -c '\ + h=$(PIXMAPDIR); \ + for n in $(srcdir)/icons/*xterm*_32x32.xpm $(srcdir)/icons/*xterm*_48x48.xpm; \ + do \ + l=`basename $$n`; \ + r=`echo "$$l" | sed -e "s,xterm,$$ACTUAL_XTERM,"`; \ + echo "installing pixmap $$h/$$r"; \ + $(INSTALL_DATA) $(srcdir)/icons/$$l $$h/$$r; \ + s=`echo "$$r" | sed -e '"'s,^.*\.,.,'"'`; \ + t=$(ICON_SYMLINK)$$s; \ + b=`basename $$n $$s | sed -e "s,_[1-9][0-9]*x.*,,"`; \ + if test "$(ICON_SYMLINK)" != NONE ; then \ + if test "x$$r" != "$$t" ; then \ + if test "x$$b" = "x$(ICON_NAME)" ; then \ + echo "linking $$r -> $$t"; \ + ( cd $$h; $(RM) $$t; $(LN_S) $$r $$t; ) \ + fi \ + fi \ + fi \ + done' + @echo "... installed icons" + +install :: + @echo 'Completed installation of executables and documentation.' + @echo 'Use "make install-ti" to install terminfo description.' + +TERMINFO_DIR = $(DESTDIR)/usr/lib/terminfo +SET_TERMINFO = TERMINFO=$(TERMINFO_DIR) + +install-full \ +install-ti :: $(TERMINFO_DIR) + @$(SHELL) -c "$(SET_TERMINFO) $(srcdir)/run-tic.sh $(srcdir)/terminfo" + @echo 'Completed installation of terminfo description.' + +install-full \ +install-tc :: + @-$(SHELL) -c "if test -f /etc/termcap ; then echo 'You must install the termcap entry manually by editing /etc/termcap'; fi" + +installdirs : $(INSTALL_DIRS) +################################################################################ + +UninstallLink = \ + if test NONE != NONE \ + && test \$$source != NONE \ + && test \$$source != \$$target \ + && test -h \$$TARGET/\$$source ; then \ + echo \"... removing \$$TARGET/\$$source\"; \ + cd \$$TARGET && \ + $(RM) \$$source; \ + fi + +UninstallBinLink = TARGET=$(BINDIR); $(UninstallLink) +UninstallManLink = TARGET=$(MANDIR); $(UninstallLink) + +UninstallBinary = \ + echo \"... removing $(BINDIR)/\$$target\"; \ + $(RM) $(BINDIR)/\$$target + +uninstall \ +uninstall-bin \ +uninstall-full :: + @-$(SHELL) -c "source=\"NONE\"; \ + target=\"$(binary_xterm)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + @-$(SHELL) -c "source=\"resize\"; \ + target=\"$(binary_resize)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + +uninstall \ +uninstall-bin \ +uninstall-scripts \ +uninstall-full :: + @-$(SHELL) -c "source=\"uxterm\"; \ + target=\"$(binary_uxterm)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + @-$(SHELL) -c "source=\"koi8rxterm\"; \ + target=\"$(binary_k8term)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + +uninstall \ +uninstall-man \ +uninstall-full :: + @-$(SHELL) -c "\ + source=NONE.$(manext); \ + target=$(actual_xterm).$(manext); \ + $(UninstallManLink)" + @-$(SHELL) -c "for source in \ + $(actual_xterm).$(manext) \ + $(actual_resize).$(manext) \ + $(actual_uxterm).$(manext) \ + $(actual_k8term).$(manext); \ + do \ + echo \"... removing $(MANDIR)/\$$source\"; \ + $(RM) $(MANDIR)/\$$source; \ + done" + +uninstall \ +uninstall-app \ +uninstall-full :: + -$(SHELL) -c 'for s in $(APP_NAMES); \ + do \ + echo "** $$s"; \ + d=`echo $$s | sed -e s/XTerm/$(CLASS)/`; \ + echo uninstalling $(APPSDIR)/$$d; \ + $(RM) $(APPSDIR)/$$d; \ + echo uninstalling $(APPSDIR)/$$d-color; \ + $(RM) $(APPSDIR)/$$d-color; \ + done' + +#uninstall \ +#uninstall-icon \ +#uninstall-full :: +# -$(SHELL) -c 'ACTUAL_XTERM=$(actual_xterm) ; \ +# for n in $(ICON_LIST); \ +# do \ +# r=`echo "$$n" | sed -e s,\^.\*:,, -e s,xterm,$$ACTUAL_XTERM,`; \ +# test -z "$$r" && continue; \ +# h=$(ICONDIR)/$(ICON_THEME); \ +# test -f $$h/$$r || continue; \ +# echo removing $$h/$$r; \ +# $(RM) $$h/$$r; \ +# done' +# @echo "... removed icons" + +uninstall \ +uninstall-icon \ +uninstall-full :: + -@$(SHELL) -c 'ACTUAL_XTERM=$(actual_xterm) ; \ + for n in $(srcdir)/icons/*xterm*_32x32.xpm $(srcdir)/icons/*xterm*_48x48.xpm; \ + do \ + l=`basename $$n`; \ + r=`echo "$$l" | sed -e "s,xterm,$$ACTUAL_XTERM,"`; \ + echo removing $(PIXMAPDIR)/$$r; \ + $(RM) $(PIXMAPDIR)/$$r; \ + done' + @echo "... removed icons" +################################################################################ +# Desktop-utils does not provide an uninstall, and is not uniformly available. +#DESKTOP_FILES = $(srcdir)/xterm.desktop $(srcdir)/uxterm.desktop +#DESKTOP_FLAGS = +#install-desktop \ +#install-full :: +# ACTUAL_XTERM=$(actual_xterm) \ +# $(SHELL) -c 'for n in $(DESKTOP_FILES); \ +# do $(SHELL) df-install $$ACTUAL_XTERM $(ICON_NAME) DESTDIR="$(DESTDIR)" $(DESKTOP_FLAGS) $$n; \ +# done' +################################################################################ +check : $(TEST_PROGRAMS) + @ echo "See demos in vttests/* (use vttest for system-level testing)" + @ $(SHELL) -c 'echo "** executing test_charclass"; \ + ./test_charclass' + @ $(SHELL) -c 'echo "** executing test_wcwidth"; \ + for range in 32-126 160-0xff00 0x10000-0x11000; \ + do echo ".. range $$range"; \ + ./test_wcwidth -s $$range; \ + ./test_wcwidth -s $$range -w; \ + done' +################################################################################ +mostlyclean : + -$(RM) *$o *.[is] XTerm[1-9]*.* Xterm.log.* XtermLog.* .pure core *~ *.bak *.BAK *.out *.tmp + +clean : mostlyclean + -$(RM) $(PROGRAMS) $(TEST_PROGRAMS) $(AUTO_SOURCE) + +sources : $(AUTO_SOURCE) + +distclean :: clean + -$(RM) Makefile config.status config.cache config.log xtermcfg.h + -$(RM) df-install minstall + +distclean \ +docs-clean :: + -$(RM) *.ps *.pdf *.png + -$(SHELL) -c 'for p in xterm resize uxterm koi8rxterm; \ + do \ + $(RM) $$p.html $$p.$(manext) $$p.txt; \ + done' + -$(RM) ctlseqs.html ctlseqs.$(manext) + +distclean :: + -$(RM) man2html.tmp + +realclean : distclean + -$(RM) tags TAGS + +maintainer-clean : realclean + -$(RM) 256colres.h 88colres.h +################################################################################ +terminfo.out : terminfo ; tic -a -I -1 terminfo >$@ +termcap.out : termcap ; tic -a -C -U termcap >$@ +################################################################################ +docs-ctlseqs \ +docs :: $(srcdir)/ctlseqs.txt ctlseqs.html ctlseqs.pdf ctlseqs.ps + +ctlseqs.html : $(srcdir)/ctlseqs.ms +ctlseqs.pdf : ctlseqs.ps +ctlseqs.ps : $(srcdir)/ctlseqs.ms +ctlseqs.txt : $(srcdir)/ctlseqs.ms +################################################################################ +docs-resize \ +docs :: resize.txt resize.html resize.pdf resize.ps +resize.html : resize.$(manext) +resize.pdf : resize.ps +resize.ps : resize.$(manext) +resize.txt : resize.$(manext) +################################################################################ +docs-xterm \ +docs :: xterm.txt xterm.html xterm.pdf xterm.ps +xterm.html : xterm.$(manext) +xterm.pdf : xterm.ps +xterm.ps : xterm.$(manext) +xterm.txt : xterm.$(manext) +################################################################################ +docs-uxterm \ +docs :: uxterm.txt uxterm.html uxterm.pdf uxterm.ps +uxterm.html : uxterm.$(manext) +uxterm.pdf : uxterm.ps +uxterm.ps : uxterm.$(manext) +uxterm.txt : uxterm.$(manext) +################################################################################ +docs-koi8rxterm \ +docs :: koi8rxterm.txt koi8rxterm.html koi8rxterm.pdf koi8rxterm.ps +koi8rxterm.html : koi8rxterm.$(manext) +koi8rxterm.pdf : koi8rxterm.ps +koi8rxterm.ps : koi8rxterm.$(manext) +koi8rxterm.txt : koi8rxterm.$(manext) +################################################################################ +lint : + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(SRCS1) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(SRCS2) + +tags : + $(CTAGS) $(SRCS) $(HDRS) + +TAGS : + $(ETAGS) $(SRCS) $(HDRS) + +$(TERMINFO_DIR) $(INSTALL_DIRS) : + mkdir -p $@ + +ALWAYS : + +depend : $(TABLES) + makedepend -- $(CPPFLAGS) -- $(SRCS) + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/ports/xterm/xterm-359/Makefile.in b/ports/xterm/xterm-359/Makefile.in new file mode 100644 index 0000000..faef657 --- /dev/null +++ b/ports/xterm/xterm-359/Makefile.in @@ -0,0 +1,634 @@ +## $XTermId: Makefile.in,v 1.253 2020/08/02 19:12:41 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1997-2019,2020 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +VPATH = @srcdir@ + +x = @EXEEXT@ +o = .@OBJEXT@ + +CC = @CC@ +CPP = @CPP@ +AWK = @AWK@ +LINK = $(CC) $(CFLAGS) + +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ + +LN_S = @LN_S@ +RM = rm -f +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_DATA = @INSTALL_DATA@ +transform = @program_transform_name@ + +EXTRA_CFLAGS = @EXTRA_CFLAGS@ +EXTRA_CPPFLAGS = @EXTRA_CPPFLAGS@ +EXTRA_LOADFLAGS = @IMAKE_LOADFLAGS@ + +CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ -DDEFCLASS=\"@APP_CLASS@\" $(EXTRA_CPPFLAGS) +CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS) +LDFLAGS = @LDFLAGS@ @EXTRA_LDFLAGS@ +LIBS = @LIBS@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datarootdir = @datarootdir@ +datadir = @datadir@ + +manext = 1 +bindir = @bindir@ +libdir = @libdir@ +mandir = @mandir@/man$(manext) +appsdir = @APPSDIR@ +icondir = @ICONDIR@ +pixmapdir = @PIXMAPDIR@ + +#### End of system configuration section. #### + +ICON_NAME = @ICON_NAME@ +ICON_SYMLINK = @ICON_SYMLINK@ + +DESTDIR = +BINDIR = $(DESTDIR)$(bindir) +LIBDIR = $(DESTDIR)$(libdir) +MANDIR = $(DESTDIR)$(mandir) +APPSDIR = $(DESTDIR)$(appsdir) + +@no_icondir@ICONDIR = $(DESTDIR)$(icondir) +@no_pixmapdir@PIXMAPDIR = $(DESTDIR)$(pixmapdir) + +INSTALL_DIRS = $(BINDIR) $(APPSDIR) $(ICONDIR) $(PIXMAPDIR) $(MANDIR) + +CLASS = @APP_CLASS@ +EXTRAHDR = @EXTRAHDRS@ +EXTRASRC = @EXTRASRCS@ +EXTRAOBJ = @EXTRAOBJS@ + +AUTO_SOURCE = \ + builtin_icons.h \ + VTparse.cin \ + Tekparse.cin \ + VTparse.hin \ + Tekparse.hin + + SRCS1 = button.c cachedGCs.c charproc.c charsets.c cursor.c \ + data.c doublechr.c fontutils.c input.c \ + linedata.c main.c menu.c misc.c \ + print.c ptydata.c scrollback.c \ + screen.c scrollbar.c tabs.c util.c version.c xstrings.c \ + xtermcap.c VTPrsTbl.c $(EXTRASRC) + OBJS1 = button$o cachedGCs$o charproc$o charsets$o cursor$o \ + data$o doublechr$o fontutils$o input$o \ + linedata$o main$o menu$o misc$o \ + print$o ptydata$o scrollback$o \ + screen$o scrollbar$o tabs$o util$o version$o xstrings$o \ + xtermcap$o VTPrsTbl$o $(EXTRAOBJ) + SRCS2 = resize.c version.c xstrings.c + OBJS2 = resize$o version$o xstrings$o + SRCS = $(SRCS1) $(SRCS2) + OBJS = $(OBJS1) $(OBJS2) + HDRS = VTparse.h data.h error.h fontutils.h main.h menu.h \ + ptyx.h version.h xstrings.h xterm.h xtermcap.h $(EXTRAHDR) + PROGRAMS = xterm$x resize$x + TEST_PROGRAMS = test_charclass$x test_ptydata$x test_wcwidth$x + +all : $(PROGRAMS) +################################################################################ +.SUFFIXES : .i .def .cin .hin .$(manext) .ms .man .txt @MAN2HTML_NOTE@ .html @GROFF_NOTE@ .ps .pdf + +.c$o : + @RULE_CC@ + @ECHO_CC@$(CC) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/$*.c + +.c.i : + @RULE_CC@ + @ECHO_CC@$(CPP) -C $(CPPFLAGS) $*.c >$@ + +.def.cin : + @echo "making $@ from $<" + @$(AWK) 'BEGIN{printf "/* vile:cmode */\n";}/^CASE_/{printf "{ %d, \"%s\" },\n", n++, $$1; }' < $< >$@ + +.def.hin : + @echo "making $@ from $<" + @$(AWK) 'BEGIN{printf "/* vile:cmode */\n";}/^CASE_/{printf "#define %s %d\n", $$1, n++}' < $< >$@ + +.man.$(manext) : + $(SHELL) ./minstall "$(INSTALL_DATA)" $< $@ $(appsdir) $(CLASS) $* $* $(pixmapdir) + +@NROFF_NOTE@.$(manext).txt : +@NROFF_NOTE@ $(SHELL) -c "tbl $*.$(manext) | nroff -man | col -bx" >$@ +@NROFF_NOTE@ +@NROFF_NOTE@.ms.txt : +@NROFF_NOTE@ $(SHELL) -c "tbl $*.$(manext) | nroff -ms | col -bx" >$@ +@NROFF_NOTE@ + +@MAN2HTML_NOTE@.$(manext).html : +@MAN2HTML_NOTE@ ./@MAN2HTML_TEMP@ $* $(manext) man >$@ +@MAN2HTML_NOTE@ +@GROFF_NOTE@.$(manext).ps : +@GROFF_NOTE@ $(SHELL) -c "tbl $*.$(manext) | groff -man" >$@ +@GROFF_NOTE@ +@GROFF_NOTE@.$(manext).txt : +@GROFF_NOTE@ GROFF_NO_SGR=stupid $(SHELL) -c "tbl $*.$(manext) | groff -Tascii -man | col -bx" >$@ +@GROFF_NOTE@ +@MAN2HTML_NOTE@.ms.html : +@MAN2HTML_NOTE@ ./@MAN2HTML_TEMP@ $* ms ms >$@ +@MAN2HTML_NOTE@ +@GROFF_NOTE@.ms.ps : +@GROFF_NOTE@ $(SHELL) -c "tbl $< | groff -ms" >$@ +@GROFF_NOTE@ +@GROFF_NOTE@.ms.txt : +@GROFF_NOTE@ GROFF_NO_SGR=stupid $(SHELL) -c "tbl $< | groff -Tascii -ms | col -bx" >$@ +@GROFF_NOTE@ +@GROFF_NOTE@.ps.pdf : +@GROFF_NOTE@ ps2pdf $*.ps +################################################################################ + +VTPARSE_H = VTparse.h VTparse.hin +TEKPARSE_H = Tekparse.h Tekparse.hin + +main$o : main.h +misc$o : version.h + +$(OBJS1) : xterm.h ptyx.h xtermcfg.h +main$o resize$o screen$o : xterm_io.h + +xterm$x : $(OBJS1) + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(LIBS) $(EXTRA_LOADFLAGS) + +resize$x : $(OBJS2) + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(LIBS) + +256colres.h : + -$(RM) $@ + perl $(srcdir)/256colres.pl > $@ + +88colres.h : + -$(RM) $@ + perl $(srcdir)/88colres.pl > $@ + +charproc$o : $(VTPARSE_H) main.h @CHARPROC_DEPS@ +graphics_regis$o : $(VTPARSE_H) +graphics_sixel$o : $(VTPARSE_H) +misc$o : $(VTPARSE_H) +VTPrsTbl$o : $(VTPARSE_H) + +TekPrsTbl$o : $(TEKPARSE_H) +Tekproc$o : $(TEKPARSE_H) + +misc$o : builtin_icons.h + +trace$o : VTparse.cin Tekparse.cin + +# do this to quiet gcc -Wcast-qual warnings +builtin_icons.h : + @echo "#if OPT_BUILTIN_XPMS" >$@ + @echo "#include " >>$@ + @echo "#include " >>$@ + @echo "#include " >>$@ + @echo "#include " >>$@ + @echo "#else" >>$@ + @sed -e 's/static char \* /static const char * /' $(srcdir)/icons/mini.xterm_48x48.xpm >>$@ + @echo "#endif" >>$@ + @echo "made $@" + +################################################################################ +test_charclass$x : $(srcdir)/charclass.c + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -DTEST_DRIVER $(srcdir)/charclass.c $(LDFLAGS) $(LIBS) + +################################################################################ +test_ptydata$x : $(srcdir)/ptydata.c + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -DTEST_DRIVER $(srcdir)/ptydata.c $(LDFLAGS) $(LIBS) + +################################################################################ +test_wcwidth$x : $(srcdir)/wcwidth.c + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(CC) -o $@ $(CFLAGS) $(CPPFLAGS) -DTEST_DRIVER $(srcdir)/wcwidth.c $(LDFLAGS) $(LIBS) + +################################################################################ +actual_xterm = `echo xterm| sed '$(transform)'` +actual_resize = `echo resize| sed '$(transform)'` +actual_uxterm = `echo uxterm| sed '$(transform)'` +actual_k8term = `echo koi8rxterm| sed '$(transform)'` + +binary_xterm = $(actual_xterm)$x +binary_resize = $(actual_resize)$x +binary_uxterm = $(actual_uxterm) +binary_k8term = $(actual_k8term) + +install \ +install-bin \ +install-full :: xterm$x resize$x $(BINDIR) +@MAY_SETUID@ $(SHELL) $(srcdir)/sinstall.sh @SINSTALL_OPTS@ "$(INSTALL_PROGRAM)" xterm$x @XTERM_PATH@ $(BINDIR)/$(binary_xterm) +@NOT_SETUID@ $(INSTALL_PROGRAM) xterm$x $(BINDIR)/$(binary_xterm) + $(INSTALL_PROGRAM) -m 755 resize$x $(BINDIR)/$(binary_resize) + +EDIT_SCRIPT = sed -e s,=xterm,=\$$name, -e s,XTerm,$(CLASS), + +InstallLink = \ + if test @XTERM_SYMLINK@ != NONE \ + && test \$$source != NONE \ + && test \$$source != \$$target ; then \ + cd \$$TARGET && ( \ + $(RM) \$$source ; \ + $(LN_S) \$$target \$$source ; \ + echo \"... created symbolic link:\" ; \ + ls -l \$$target \$$source ) ; \ + fi + +InstallBinLink = TARGET=$(BINDIR); $(InstallLink) +InstallManLink = TARGET=$(MANDIR); $(InstallLink) + +InstallScript = \ + echo \"... installing $(BINDIR)/\$$target\"; \ + name=$(binary_xterm); \ + $(EDIT_SCRIPT) $(srcdir)/\$$source >\$$source.tmp; \ + $(INSTALL_SCRIPT) -m 755 \$$source.tmp $(BINDIR)/\$$target; \ + $(RM) \$$source.tmp + +install \ +install-bin \ +install-scripts \ +install-full :: $(BINDIR) + @$(SHELL) -c "source=\"@XTERM_SYMLINK@\"; \ + target=\"$(binary_xterm)\"; \ + $(InstallBinLink)" + @$(SHELL) -c "source=\"resize\"; \ + target=\"$(binary_resize)\"; \ + $(InstallBinLink)" + @$(SHELL) -c "source=\"uxterm\"; \ + target=\"$(binary_uxterm)\"; \ + $(InstallScript); \ + $(InstallBinLink)" + @$(SHELL) -c "source=\"koi8rxterm\"; \ + target=\"$(binary_k8term)\"; \ + $(InstallScript); \ + $(InstallBinLink)" + +install \ +install-man \ +install-full :: $(MANDIR) + @-$(SHELL) -c "for source in xterm resize uxterm koi8rxterm ; \ + do \ + target=\`echo \"\$$source\" | sed '@program_transform_name@'\`; \ + $(SHELL) ./minstall \"$(INSTALL_DATA)\" \ + $(srcdir)/\$$source.man \ + $(MANDIR)/\$$target.$(manext) \ + $(appsdir) \ + $(CLASS) \ + \$$source \ + \$$target \ + $(pixmapdir); \ + done" + @-$(SHELL) -c "if test @XTERM_SYMLINK@ != NONE ; then \ + source=$(actual_xterm).$(manext); \ + target=@XTERM_SYMLINK@.$(manext); \ + cd $(MANDIR) && ( \ + $(RM) \$$target ; \ + $(LN_S) \$$source \$$target ; \ + echo '... created symbolic link:' ; \ + ls -l \$$source \$$target ; \ + ) \ + fi" + +APP_NAMES = XTerm UXTerm KOI8RXTerm + +@no_appsdir@install \ +@no_appsdir@install-app \ +@no_appsdir@install-full :: $(APPSDIR) +@no_appsdir@ @-$(SHELL) -c 'for s in $(APP_NAMES); \ +@no_appsdir@ do \ +@no_appsdir@ echo "** $$s"; \ +@no_appsdir@ d=`echo $$s | sed -e s/XTerm/$(CLASS)/`; \ +@no_appsdir@ echo installing $(APPSDIR)/$$d; \ +@no_appsdir@ sed -e s/XTerm/$(CLASS)/ $(srcdir)/$$s.ad >XTerm.tmp; \ +@no_appsdir@ $(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$$d; \ +@no_appsdir@ echo installing $(APPSDIR)/$$d-color; \ +@no_appsdir@ sed -e s/XTerm/$$d/ $(srcdir)/XTerm-col.ad >XTerm.tmp; \ +@no_appsdir@ $(INSTALL_DATA) XTerm.tmp $(APPSDIR)/$$d-color; \ +@no_appsdir@ done' +@no_appsdir@ @$(RM) XTerm.tmp +@no_icondir@ @echo "... installed app-defaults" + +@no_icondir@ICON_LIST = @ICON_LIST@ +@no_icondir@ICON_THEME = @ICON_THEME@ +@no_icondir@install \ +@no_icondir@install-icon \ +@no_icondir@install-full :: $(ICONDIR) +@no_icondir@ @ECHO_CC@ACTUAL_XTERM=$(actual_xterm) $(SHELL) -c '\ +@no_icondir@ h=$(ICONDIR)/$(ICON_THEME); \ +@no_icondir@ for n in $(ICON_LIST); \ +@no_icondir@ do \ +@no_icondir@ x=$$ACTUAL_XTERM; \ +@no_icondir@ l=`echo "$$n" | cut -f1 -d:`; \ +@no_icondir@ r=`echo "$$n" | cut -f2 -d: |sed -e "s,xterm,$$ACTUAL_XTERM,"`; \ +@no_icondir@ test -z "$$r" && continue; \ +@no_icondir@ d=$$h/`echo "$$r" | sed -e "s,/[^/]*$$,,"`; \ +@no_icondir@ test -d "$$d" || mkdir -p "$$d"; \ +@no_icondir@ echo "installing icon $$h/$$r"; \ +@no_icondir@ $(INSTALL_DATA) $$l $$h/$$r; \ +@no_icondir@ s=`echo "$$r" | sed -e '"'s,^.*\.,.,'"'`; \ +@no_icondir@ t=$(ICON_SYMLINK)$$s; \ +@no_icondir@ b=`basename $$n $$s | sed -e "s,_[1-9][0-9]*x.*,,"`; \ +@no_icondir@ if test "$(ICON_SYMLINK)" != NONE ; then \ +@no_icondir@ if test "$$r" != "$$t" ; then \ +@no_icondir@ if test "x$$b" = "x$(ICON_NAME)" ; then \ +@no_icondir@ echo "linking $$r -> $$t"; \ +@no_icondir@ ( cd $$h; $(RM) $$t; $(LN_S) $$r $$t; ) \ +@no_icondir@ fi \ +@no_icondir@ fi \ +@no_icondir@ fi \ +@no_icondir@ done' +@no_icondir@ @echo "... installed icons" + +@no_pixmapdir@install \ +@no_pixmapdir@install-icon \ +@no_pixmapdir@install-full :: $(PIXMAPDIR) +@no_pixmapdir@ @ECHO_CC@ACTUAL_XTERM=$(actual_xterm) $(SHELL) -c '\ +@no_pixmapdir@ h=$(PIXMAPDIR); \ +@no_pixmapdir@ for n in $(srcdir)/icons/*xterm*_32x32.xpm $(srcdir)/icons/*xterm*_48x48.xpm; \ +@no_pixmapdir@ do \ +@no_pixmapdir@ l=`basename $$n`; \ +@no_pixmapdir@ r=`echo "$$l" | sed -e "s,xterm,$$ACTUAL_XTERM,"`; \ +@no_pixmapdir@ echo "installing pixmap $$h/$$r"; \ +@no_pixmapdir@ $(INSTALL_DATA) $(srcdir)/icons/$$l $$h/$$r; \ +@no_pixmapdir@ s=`echo "$$r" | sed -e '"'s,^.*\.,.,'"'`; \ +@no_pixmapdir@ t=$(ICON_SYMLINK)$$s; \ +@no_pixmapdir@ b=`basename $$n $$s | sed -e "s,_[1-9][0-9]*x.*,,"`; \ +@no_pixmapdir@ if test "$(ICON_SYMLINK)" != NONE ; then \ +@no_pixmapdir@ if test "x$$r" != "$$t" ; then \ +@no_pixmapdir@ if test "x$$b" = "x$(ICON_NAME)" ; then \ +@no_pixmapdir@ echo "linking $$r -> $$t"; \ +@no_pixmapdir@ ( cd $$h; $(RM) $$t; $(LN_S) $$r $$t; ) \ +@no_pixmapdir@ fi \ +@no_pixmapdir@ fi \ +@no_pixmapdir@ fi \ +@no_pixmapdir@ done' +@no_pixmapdir@ @echo "... installed icons" + +install :: + @echo 'Completed installation of executables and documentation.' + @echo 'Use "make install-ti" to install terminfo description.' + +TERMINFO_DIR = @TERMINFO_DIR@ +SET_TERMINFO = @SET_TERMINFO@ + +@no_ticprog@install-full \ +@no_ticprog@install-ti :: $(TERMINFO_DIR) +@no_ticprog@ @$(SHELL) -c "$(SET_TERMINFO) $(srcdir)/run-tic.sh $(srcdir)/terminfo" +@no_ticprog@ @echo 'Completed installation of terminfo description.' + +install-full \ +install-tc :: + @-$(SHELL) -c "if test -f /etc/termcap ; then echo 'You must install the termcap entry manually by editing /etc/termcap'; fi" + +installdirs : $(INSTALL_DIRS) +################################################################################ + +UninstallLink = \ + if test @XTERM_SYMLINK@ != NONE \ + && test \$$source != NONE \ + && test \$$source != \$$target \ + && test -h \$$TARGET/\$$source ; then \ + echo \"... removing \$$TARGET/\$$source\"; \ + cd \$$TARGET && \ + $(RM) \$$source; \ + fi + +UninstallBinLink = TARGET=$(BINDIR); $(UninstallLink) +UninstallManLink = TARGET=$(MANDIR); $(UninstallLink) + +UninstallBinary = \ + echo \"... removing $(BINDIR)/\$$target\"; \ + $(RM) $(BINDIR)/\$$target + +uninstall \ +uninstall-bin \ +uninstall-full :: + @-$(SHELL) -c "source=\"@XTERM_SYMLINK@\"; \ + target=\"$(binary_xterm)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + @-$(SHELL) -c "source=\"resize\"; \ + target=\"$(binary_resize)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + +uninstall \ +uninstall-bin \ +uninstall-scripts \ +uninstall-full :: + @-$(SHELL) -c "source=\"uxterm\"; \ + target=\"$(binary_uxterm)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + @-$(SHELL) -c "source=\"koi8rxterm\"; \ + target=\"$(binary_k8term)\"; \ + $(UninstallBinLink); \ + $(UninstallBinary)" + +uninstall \ +uninstall-man \ +uninstall-full :: + @-$(SHELL) -c "\ + source=@XTERM_SYMLINK@.$(manext); \ + target=$(actual_xterm).$(manext); \ + $(UninstallManLink)" + @-$(SHELL) -c "for source in \ + $(actual_xterm).$(manext) \ + $(actual_resize).$(manext) \ + $(actual_uxterm).$(manext) \ + $(actual_k8term).$(manext); \ + do \ + echo \"... removing $(MANDIR)/\$$source\"; \ + $(RM) $(MANDIR)/\$$source; \ + done" + +@no_appsdir@uninstall \ +@no_appsdir@uninstall-app \ +@no_appsdir@uninstall-full :: +@no_appsdir@ -@ECHO_CC@$(SHELL) -c 'for s in $(APP_NAMES); \ +@no_appsdir@ do \ +@no_appsdir@ echo "** $$s"; \ +@no_appsdir@ d=`echo $$s | sed -e s/XTerm/$(CLASS)/`; \ +@no_appsdir@ echo uninstalling $(APPSDIR)/$$d; \ +@no_appsdir@ $(RM) $(APPSDIR)/$$d; \ +@no_appsdir@ echo uninstalling $(APPSDIR)/$$d-color; \ +@no_appsdir@ $(RM) $(APPSDIR)/$$d-color; \ +@no_appsdir@ done' + +@no_icondir@uninstall \ +@no_icondir@uninstall-icon \ +@no_icondir@uninstall-full :: +@no_icondir@ -@ECHO_CC@$(SHELL) -c 'ACTUAL_XTERM=$(actual_xterm) ; \ +@no_icondir@ for n in $(ICON_LIST); \ +@no_icondir@ do \ +@no_icondir@ r=`echo "$$n" | sed -e s,\^.\*:,, -e s,xterm,$$ACTUAL_XTERM,`; \ +@no_icondir@ test -z "$$r" && continue; \ +@no_icondir@ h=$(ICONDIR)/$(ICON_THEME); \ +@no_icondir@ test -f $$h/$$r || continue; \ +@no_icondir@ echo removing $$h/$$r; \ +@no_icondir@ $(RM) $$h/$$r; \ +@no_icondir@ done' +@no_icondir@ @echo "... removed icons" + +@no_pixmapdir@uninstall \ +@no_pixmapdir@uninstall-icon \ +@no_pixmapdir@uninstall-full :: +@no_pixmapdir@ -@$(SHELL) -c 'ACTUAL_XTERM=$(actual_xterm) ; \ +@no_pixmapdir@ for n in $(srcdir)/icons/*xterm*_32x32.xpm $(srcdir)/icons/*xterm*_48x48.xpm; \ +@no_pixmapdir@ do \ +@no_pixmapdir@ l=`basename $$n`; \ +@no_pixmapdir@ r=`echo "$$l" | sed -e "s,xterm,$$ACTUAL_XTERM,"`; \ +@no_pixmapdir@ echo removing $(PIXMAPDIR)/$$r; \ +@no_pixmapdir@ $(RM) $(PIXMAPDIR)/$$r; \ +@no_pixmapdir@ done' +@no_pixmapdir@ @echo "... removed icons" +################################################################################ +# Desktop-utils does not provide an uninstall, and is not uniformly available. +@desktop_utils@DESKTOP_FILES = $(srcdir)/xterm.desktop $(srcdir)/uxterm.desktop +@desktop_utils@DESKTOP_FLAGS = @DESKTOP_FLAGS@ +@desktop_utils@install-desktop \ +@desktop_utils@install-full :: +@desktop_utils@ ACTUAL_XTERM=$(actual_xterm) \ +@desktop_utils@ $(SHELL) -c 'for n in $(DESKTOP_FILES); \ +@desktop_utils@ do $(SHELL) df-install $$ACTUAL_XTERM $(ICON_NAME) DESTDIR="$(DESTDIR)" $(DESKTOP_FLAGS) $$n; \ +@desktop_utils@ done' +################################################################################ +check : $(TEST_PROGRAMS) + @ echo "See demos in vttests/* (use vttest for system-level testing)" + @ $(SHELL) -c 'echo "** executing test_charclass"; \ + ./test_charclass' + @ $(SHELL) -c 'echo "** executing test_wcwidth"; \ + for range in 32-126 160-0xff00 0x10000-0x11000; \ + do echo ".. range $$range"; \ + ./test_wcwidth -s $$range; \ + ./test_wcwidth -s $$range -w; \ + done' +################################################################################ +mostlyclean : + -$(RM) *$o *.[is] XTerm[1-9]*.* Xterm.log.* XtermLog.* .pure core *~ *.bak *.BAK *.out *.tmp + +clean : mostlyclean + -$(RM) $(PROGRAMS) $(TEST_PROGRAMS) $(AUTO_SOURCE) + +sources : $(AUTO_SOURCE) + +distclean :: clean + -$(RM) Makefile config.status config.cache config.log xtermcfg.h + -$(RM) df-install minstall + +distclean \ +docs-clean :: + -$(RM) *.ps *.pdf *.png + -$(SHELL) -c 'for p in xterm resize uxterm koi8rxterm; \ + do \ + $(RM) $$p.html $$p.$(manext) $$p.txt; \ + done' + -$(RM) ctlseqs.html ctlseqs.$(manext) + +distclean :: + -$(RM) man2html.tmp + +realclean : distclean + -$(RM) tags TAGS + +maintainer-clean : realclean + -$(RM) 256colres.h 88colres.h +################################################################################ +terminfo.out : terminfo ; tic -a -I -1 terminfo >$@ +termcap.out : termcap ; tic -a -C -U termcap >$@ +################################################################################ +docs-ctlseqs \ +docs :: $(srcdir)/ctlseqs.txt @MAN2HTML_NOTE@ ctlseqs.html @GROFF_NOTE@ ctlseqs.pdf ctlseqs.ps + +ctlseqs.html : $(srcdir)/ctlseqs.ms +ctlseqs.pdf : ctlseqs.ps +ctlseqs.ps : $(srcdir)/ctlseqs.ms +ctlseqs.txt : $(srcdir)/ctlseqs.ms +################################################################################ +docs-resize \ +docs :: resize.txt @MAN2HTML_NOTE@ resize.html @GROFF_NOTE@ resize.pdf resize.ps +resize.html : resize.$(manext) +resize.pdf : resize.ps +resize.ps : resize.$(manext) +resize.txt : resize.$(manext) +################################################################################ +docs-xterm \ +docs :: xterm.txt @MAN2HTML_NOTE@ xterm.html @GROFF_NOTE@ xterm.pdf xterm.ps +xterm.html : xterm.$(manext) +xterm.pdf : xterm.ps +xterm.ps : xterm.$(manext) +xterm.txt : xterm.$(manext) +################################################################################ +docs-uxterm \ +docs :: uxterm.txt @MAN2HTML_NOTE@ uxterm.html @GROFF_NOTE@ uxterm.pdf uxterm.ps +uxterm.html : uxterm.$(manext) +uxterm.pdf : uxterm.ps +uxterm.ps : uxterm.$(manext) +uxterm.txt : uxterm.$(manext) +################################################################################ +docs-koi8rxterm \ +docs :: koi8rxterm.txt @MAN2HTML_NOTE@ koi8rxterm.html @GROFF_NOTE@ koi8rxterm.pdf koi8rxterm.ps +koi8rxterm.html : koi8rxterm.$(manext) +koi8rxterm.pdf : koi8rxterm.ps +koi8rxterm.ps : koi8rxterm.$(manext) +koi8rxterm.txt : koi8rxterm.$(manext) +################################################################################ +lint : + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(SRCS1) + $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(SRCS2) + +tags : + $(CTAGS) $(SRCS) $(HDRS) + +TAGS : + $(ETAGS) $(SRCS) $(HDRS) + +$(TERMINFO_DIR) $(INSTALL_DIRS) : + mkdir -p $@ + +ALWAYS : + +depend : $(TABLES) + makedepend -- $(CPPFLAGS) -- $(SRCS) + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/ports/xterm/xterm-359/NEWS b/ports/xterm/xterm-359/NEWS new file mode 100644 index 0000000..6331d77 --- /dev/null +++ b/ports/xterm/xterm-359/NEWS @@ -0,0 +1,27 @@ +The NEWS file was generated from xterm.log.html, which serves as the changelog +for xterm. +-------------------------------------------------------------------------------- + Patch #359 - 2020/08/17 + + * add special case in WriteText to allow colors 8-15 to override + colorBDMode (patch by Ingo Brückl). + * add utf8Weblike resource, to provide an alternate scheme for + handling ill-formed UTF-8 sequences (adapted from patch by Dan + Gohman). + * improve computation for the number of lines needed to scroll-up a + SIXEL graphic (report/patch by Ben Wong). + * correct manpage description for default value of disallowWindowOps + from changes in xterm #331 (patch by Ben Wong). + * correct a loop starting-point in refresh_graphics from optimization + in patch #358 changes (report by Ben Wong). + * add a new mouse mode 1016, which uses the same format as mode 1006, + but sends the mouse's position in pixels (suggested by Igor van den + Hoven). + * fix an issue from patch #338 changes where only the first selection + buffer specified in the request would be updated using OSC 52 + (patch by Michael Gulick). + * modify makefile/scripts to allow DESTDIR to prefix the target + directory for desktop-file-install (report by Fred Heitkamp). + * enable SIXEL feature by default. + * update config.guess, config.sub + diff --git a/ports/xterm/xterm-359/README b/ports/xterm/xterm-359/README new file mode 100644 index 0000000..76328f4 --- /dev/null +++ b/ports/xterm/xterm-359/README @@ -0,0 +1,19 @@ +-- $XTermId: README,v 1.3 2007/05/24 19:49:19 tom Exp $ +-- Below is the original README for xterm from 1991, for your amusement. +-- For a better overview, see http://invisible-island.net/xterm/ +------------------------------------------------------------------------------- + Abandon All Hope, Ye Who Enter Here + + +This is undoubtedly the most ugly program in the distribution. It was one of +the first "serious" programs ported, and still has a lot of historical baggage. +Ideally, there would be a general tty widget and then vt102 and tek4014 +subwidgets so that they could be used in other programs. We are trying to +clean things up as we go, but there is still a lot of work to do. + +If you are porting this to a machine that has problems with overlapping +bcopy's, watch out! + +There are two documents on xterm: the man page, xterm.man, which describes +how to use it, and ctlseqs.ms, which describes the control sequences it +understands. diff --git a/ports/xterm/xterm-359/README.i18n b/ports/xterm/xterm-359/README.i18n new file mode 100644 index 0000000..511ee60 --- /dev/null +++ b/ports/xterm/xterm-359/README.i18n @@ -0,0 +1,199 @@ +-- $XFree86: xc/programs/xterm/README.i18n,v 1.1 2003/11/13 01:16:37 dickey Exp $ + +Using xterm in your language +============================ + +Since XFree86 version 4.0, the internationalization (i18n) feature of +xterm is gradually improved. Xterm is being improved even now. You +need only set the standard locale environment variables such as +LC_CTYPE, LC_ALL, LC_CTYPE, or LANG. Once the locale is set up you can +use xterm in your favorite character encoding. + +This document explains how the i18n feature is realized and how to +configure xterm for your character encoding. + +Refer to locale(7) for details of the locale mechanism. + + +Basic i18n-related settings and resources +========================================= + +These settings apply to XFree86 xterm patch #181, and the program luit +which is distributed with XFree86 4.4 + +1. Usage of "locale mode" + + On startup, xterm must be in "locale mode" to make it follow the + current locale. You can invoke xterm in locale mode in these ways: + + a. Set "vt100.locale" resource "true". This resource was + introduced since XFree86 4.3. The default value of the "locale" + resource is "medium", which means xterm follows the locale only + in Chinese, Japanese, Korean, or Thai locales. For example, + + XTerm*locale: true + + in your ~/.Xresources file. + + or + + b. Invoke xterm with the "-lc" option. + +2. Converter program "luit" + + The "luit" must be available in the standard XFree86 binary + directory. It is usually available because it is part of the + XFree86 distribution. The standard binary directory may differ from + system to system. /usr/X11R6/bin/luit is an example. + + "luit" is used to convert between Unicode and the character encoding + for your locale. When built for XFree86, xterm includes logic for + invoking luit. + +3. Locale setting + + Finally, you will need to configure your locale. We expect that you + have already configured your locale for other software. For example, + + LANG=de_DE@euro + export LANG + + in your ~/.xsession file. There are many ways to configure locale. + For example, your display manager may have a mechanism to invoke a + window manager in your favorite locale, or you may have system-wide + locale setting in /etc/environment. You may also have set the + LC_ALL variable instead of the LANG variable. + + +How to use xterm in different locale temporarily +================================================ + +You may sometimes need to invoke xterm in a different character encoding +than your current locale. For example, use xterm to login remote systems +in different locale. + +Do this by invoking xterm in the target locale. For example, + + $ LANG=ru_RU.KOI8-R xterm & + +Previously, font setting has been used in such cases. + + $ xterm -fn -misc-fixed-medium-r-normal--10-*-*-*-*-*-koi8-r & + +This does not work well in conjunction with the "locale" resource, +because luit and xterm combined rely upon Unicode fonts. + + +How to set fonts for UTF-8/locale modes +======================================= + +Since xterm patch #181, xterm can automatically use Unicode fonts in +UTF-8 mode and locale mode. Few of you will need to modify the default +setting to display your language. In particular, Unicode fonts in +combination with locale mode will satisfy the needs of not only +ISO-8859-1 users but also East Asian and other non-ISO-8859-1 users. + +If you want to set your favorite Unicode font for UTF-8 and locale +modes, you should add a line such as the following in your ~/.Xresources +file: + + XTerm*VT100.utf8Fonts.font: \ + -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1 + +The leading "XTerm*" pattern is more specific than the system's +app-defaults file, therefore it overrides the corresponding line +beginning with + + *VT100.utf8Fonts.font: + +Here is an additional note. If you want to display East Asian +doublewidth characters (CJK Ideogram, Hiragana, Katakana, Hangul, +and so on), we recommend using + + -misc-fixed-medium-r-semicondensed--13-*-*-*-*-*-iso10646-1 + +or + + -misc-fixed-medium-r-normal--18-*-*-*-*-*-iso10646-1 + +because these two fonts have corresponding doublewidth fonts. These +fonts are used as default font and default "Large" font, respectively. + + +The internals of xterm i18n +=========================== + +You do not need to read this section if you only want to configure your +xterm. Here we describe how xterm is implemented to support i18n. + +The original version of xterm does not support locale or character +encoding. Its I/O stream is interpreted as a mere 8-bit index for a +font. + +Beginning with XFree86 4.0, xterm supported UTF-8. It was implemented +as a separate UTF-8 mode from the conventional 8-bit mode. Character +encodings had no effect on the 8-bit mode. The UTF-8 mode has been +extended to support doublewidth characters (for East Asian characters) +and combining characters (such as accents for Latin alphabets and Thai +vowels/tone marks). + +Doublewidth characters are characters that occupy two continuing +columns on the terminal. Xterm uses separate fonts for normal +(singlewidth) characters and doublewidth characters. Though xterm has +configuration items for specifying doublewidth fonts, it will +automatically search for a font with exactly twice as wide and the same +name as the specified normal font. + +The default behavior of xterm was modified to use this UTF-8 mode in +UTF-8 locales. A command line option of "-u8" and a resource of "utf8" +were introduced to choose UTF-8 mode. + +"luit" was introduced to XFree86 at version 4.2. It converts between +UTF-8 and other encodings. When luit is invoked in a UTF-8 terminal, +the terminal acts as if it is really running in the other encoding. + +Since XFree86 version 4.3, xterm provides a new mode to invoke luit +automatically to support various encodings. The mode where xterm +invokes luit is called "locale mode". It is the third mode following +conventional 8-bit mode and UTF-8 mode. In the locale mode, xterm is +aware of the current locale and character encoding. Since locale mode +uses luit, it is based on the UTF-8 mode. That is, xterm works in UTF-8 +mode and luit works as a converter between UTF-8 and the character +encoding for your locale. This is why the locale mode always needs +Unicode fonts. The default behavior of xterm is modified so that the +"locale mode" will be adopted in Chinese (Big5 and GB2312), Japanese +(EUC-JP), Korean (EUC-KR), and Thai (ISO-8859-11, as known as TIS-620) +locales. Locale mode is chosen for these character encodings because +these encodings are not supported by conventional 8-bit mode even by +changing fonts (ISO-8859-11 needs combining characters and others need +doublewidth characters). + +To control the locale mode, command line options of "-lc" and "-en" and +a resource of "locale" were introduced. The command line option of +"-u8" and a resource of "utf8" were made obsolete by them, though +retained for compatibility. + +Since XFree86 version 4.4, xterm can have two sets of default fonts, +one for conventional 8-bit mode and another for UTF-8 and locale modes, +by introducing the "utf8Fonts" subresource. + + +Future TODO Items +================= + +We anticipate that xterm's locale mode will be used increasingly in the +future. Since the UTF-8 and locale modes use more resources than +conventional 8-bit mode (because it needs larger fonts and another +process "luit"), faster hardware may be needed to gain complete +acceptance by users. However, the locale mechanism allows users +to manipulate data in a standard form. Its usefulness compensates +in part for reduced performance. + +Xterm supports antialiased fonts ("-fa" and "-fs" command line options). +Currently UTF-8 nor locale modes do not work with antialiased fonts. + +Xterm does not support bi-directional or RTL languages such as Hebrew +and Arab. A simple standard how terminal should behave for these +languages is needed. + +Xterm does not support Unicode characters above U+10000. diff --git a/ports/xterm/xterm-359/README.os390 b/ports/xterm/xterm-359/README.os390 new file mode 100644 index 0000000..2fe50b6 --- /dev/null +++ b/ports/xterm/xterm-359/README.os390 @@ -0,0 +1,74 @@ +-- $XFree86: xc/programs/xterm/README.os390,v 1.3 2000/09/22 10:42:05 alanh Exp $ + +Below are install instructions for os/390 2.5 & below and +for os/390 2.6 & above. The basic reasons for exporting +the LIBS and CFLAGS variables is to get the configure +script to run properly under os/390. configure, when +checking for X, attempts to compile a program something like + + int main() { + XtMalloc() + ; return 0; } + +using 'cc -o conftest conftest.c -lXt'. However this results +in a number of linkedit messages such as: + + IEW2456E 9207 SYMBOL xcatd UNRESOLVED. MEMBER COULD NOT BE INCLUDED FROM THE + DESIGNATED CALL LIBRARY. NAME SPACE = 3 + IEW2456E 9207 SYMBOL XrmQGetResource UNRESOLVED. MEMBER COULD NOT BE INCLUDED + FROM THE DESIGNATED CALL LIBRARY. + IEW2456E 9207 SYMBOL XrmGetDatabase UNRESOLVED. MEMBER COULD NOT BE INCLUDED + FROM THE DESIGNATED CALL LIBRARY. + +The only way I can get this program to compile and link is to +use 'cc -o conftest conftest.c -lXt -lX11 -lSM -lICE'. +With os/390 2.6 and above, IBM has provided X functions in dlls; +this is the reason for the separate install steps. In fact, +trying to use the X archive files (eg -lX11) when linking xterm +results in an abend0C1 in low storage when X tries to call the +initialize function (at least on my system). This has something +to do with the calling X routine thinking it has a function pointer +descriptor (c++) when it actually has just a function pointer (c). +Unfortunately, I have been unable to recreate the problem in a +simple testcase, so I haven't reported it to IBM. Anyway, for os/390 +2.6 and above, configure will build a Makefile with the following line: + + LIBS = -lXaw -lXext -lXmu -lXt -lSM -lICE -lX11 /usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x -lcurses + +The '-lXaw -lXext -lXmu -lXt -lSM -lICE -lX11' should be manually removed; +this isn't strictly necessary, but will reduce the size of the executable +by about 4M. + +The '-Wl,EDIT=NO' causes the Binder to produce a non-editable executable, +dramatically reducing the size of the executable file. + +Good Luck!! +Greg Smith +rys@trex.rtpnc.epa.gov + + + +Install instructions for os/390 2.5 and *below*: +------------------------------------------------ + gunzip xterm.tar.gz + pax -o from=ISO8859-1,to=IBM-1047 -rf xterm.tar + cd xterm + export LIBS='-lXt -lX11 -lSM -lICE' + export CFLAGS='-D_ALL_SOURCE -Wl,EDIT=NO' + ./configure + make + export DISPLAY=my.xserver.name:0 + ./xterm + + +Install instructions for os/390 2.6 and *above*: +------------------------------------------------ + gunzip xterm.tar.gz + pax -o from=ISO8859-1,to=IBM-1047 -rf xterm.tar + cd xterm + ./configure # LIBS, CFLAGS, and CC are defined by configure for os/390 2.6. + [optional: edit the Makefile and remove '-lXaw -lXext -lXmu -lXt -lSM -lICE -lX11' + from the LIBS assignment] + make + export DISPLAY=my.xserver.name:0 + ./xterm diff --git a/ports/xterm/xterm-359/THANKS b/ports/xterm/xterm-359/THANKS new file mode 100644 index 0000000..fd24256 --- /dev/null +++ b/ports/xterm/xterm-359/THANKS @@ -0,0 +1,241 @@ +-- $XTermId: THANKS,v 1.26 2020/07/03 17:42:57 tom Exp $ +-- vile:txtmode fk=utf-8 +There's no AUTHORS file in this distribution; it would be redundant since +I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996. + +There is no reliable history before that point. +For some insight, see + + https://invisible-island.net/xterm/xterm.faq.html#who_did_it + https://invisible-island.net/personal/changelogs.html#categories + +Here is a list from xterm.log.html of people who have contributed changes, +or whose suggested change could be adapted: + +Adam M Costello +Adam Sulmicki +Ailin Nemui +Al Poole +Alan Coopersmith +Alex Hornung +Alexander Pohoyda +Alexander V Lukyanov +Andrea Odetti +Andreas Jaeger +Andreas Schwab +Andres Perera +Andrew Sumner +Andrew Tipton +Andrey Panov +Andries E Brouwer +Anton Kovalenko +Balazs Kezes +Ben Wiley Sittler +Ben Wong +Ben Yoshino +Bernhard R Link +Bernhard Rosenkraenzer +Bertram Felgenhauer +Bill Nottingham +Bjarni Ingi Gislason +Bob Maynard +Brad Town +Bradd W Szonye +Bram Moolenaar +Branden Robinson +Bruno Haible +Cade Foster +Caetano Jimenez Carezzato +Chris Adams +Chris Clayton +Christian Biere +Christian Weisgerber +Chuck Blake +Chuck Silvers +Colum Paget +D Roland Walker +Dan Church +Dan Gohman +Dan Thompson +Daniel Colascione +Daniel Drake +Daniel Jacobowitz +Dave Coffin +Dave Simmons +David Dawes +David Krause +David Madore +David Martínez Moreno +David Mathog +David Michael +David Wolfskill +David Wood +David Yeo +Denis Zaitsev +Dennis Preiser +Dennis Schneider +Dimitrios Christidis +Ed Schouten +Eddy De Greef +Edward S Arthur +Egbert Eich +Egmont Koblinger +Emanuele Giaquinta +Eugene Konev +Fabrice Bellard +Frank Giessler +Frank Guangxin Liu +Frank Liu +Gael Roualland +George Kouryachy +George Nachman +George Peter Staplin +Gertjan Halkes +Greg Badros +Greg Klanderman +Greg Smith +H Merijn Brand +Hasso Tepper +Holger Veit +Ilya Zakharevich +Ingo Brückl +Iwamoto Kouichi +James Armstrong +Jan Engelhardt +Jason Bacon +Jason Vas Dias +Jeff Chua +Jeff Uphoff +Jens Schweikhardt +Jeremy Buhler +Jeremy Huddleston +Jeroen Ruigrok +Jess Thrysoee +Jim Paris +Jimmy Aguilar Mena +Jochen Voss +Joe Allen +Joe Peterson +Johnny Billquist +Jonathan Irwin +Julien Cristau +Juliusz Chroboczek +Jungshik Shin +Jürgen Keil +KUGA Tsutomu +Kean Johnston +Keith Packard +Ken Martin +Kevin Buhr +Kevin Ryde +Kevin Schoedel +Kiyokazu Suto +Larry Hynes +Larry Riedel +Lauri Tirkkonen +Lee Olsen +Loïc Minier +Marc Bevand +Marc La France +Marco Peereboom +Marius Tolzmann +Mark Waggoner +Markus Kuhn +Martin Hostettler +Martin Pirker +Martin Tournoij +Matthew Green +Matthias Baake +Matthias Scheler +Matthieu Herrb +Matthieu Lagouge +Mattias Engdegård +Max Mikhanosha +Michael Riepe +Michael Rohleder +Michael Schroeder +Mike Castle +Mike Fabian +Mike Frysinger +Mike Hopkirk +Mike Thornburg +Mikulas Patocka +Milan Mehner +Min Sik Kim +Miroslav Lichvar +Nam SungHyun +Nelson Beebe +Nicholas Marriott +Nicolas George +Németh Márton +Olaf Rogalsky +Ovidiu Gheorghioiu +Paul Bolle +Paul Gilmartin +Paul Giordano +Paul Lampert +Paul Maier +Paul Szabo +Paul Vojta +Paul Williams +Pavel Roskin +Peder Stray +Per Hedeland +Peter Berg Larsen +Phil Sidler +Pierre Lombard +Pierre Pronchery +Quinn Strahl +Rajesh Mandalemula +Richard Braakman +Richard Griswold +Richard Tollerton +Rob Braun +Robert Brady +Robert Earl +Robert Ross +Robin Cutshaw +Romain Francoise +Ross Combs +Ross Paterson +Ryan Johnson +Sam Stephenson +Samuel Thibault +Scott Sewall +Semen A Ustimenko +Sergei Laskavy +Sergey Vlasov +Slava Semushin +Stefan Assmann +Stefan Dirsch +Stephen P Wall +Stuart Lissaman +Sven Joachim +Sven Verdoolaege +Taketo Kabe +Taneli Huuskonen +Ted Phelps +Thierry Reding +Thomas Wolff +Thorsten Glaser +Tim Adye +Tim Pope +Tobias Stoeckmann +Todd Eigenschink +Todd Larason +Todd Miller +Tomas Vanhala +Tomasz Cholewo +Tomohiro Kubota +Tor Lillqvist +Torrey Lyons +Victor Stinner +Victor Vaile +Vincent Lefèvre +Walter Harms +Werner Fink +Werner Lemberg +Will Day +YOKOTA Hiroshi +Zarick Lau +Zdenek Sekera diff --git a/ports/xterm/xterm-359/TekPrsTbl.c b/ports/xterm/xterm-359/TekPrsTbl.c new file mode 100644 index 0000000..a16d18d --- /dev/null +++ b/ports/xterm/xterm-359/TekPrsTbl.c @@ -0,0 +1,2648 @@ +/* $XTermId: TekPrsTbl.c,v 1.9 2006/02/13 01:14:57 tom Exp $ */ + +/* + * Copyright 1998-2001,2006 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +/* $XFree86: xc/programs/xterm/TekPrsTbl.c,v 3.5 2006/02/13 01:14:57 dickey Exp $ */ + +#include + +Const int Talptable[] = /* US (^_) normal alpha mode */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_LF, +CASE_UP, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC_STATE, +/* FS GS RS US */ +CASE_PT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_SP, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* $ % & ' */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ( ) * + */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* , - . / */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 0 1 2 3 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 4 5 6 7 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 8 9 : ; */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* < = > ? */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* @ A B C */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* D E F G */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* H I J K */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* L M N O */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* P Q R S */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* T U V W */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* X Y Z [ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* \ ] ^ _ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ` a b c */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* d e f g */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* h i j k */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* l m n o */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* p q r s */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* t u v w */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* x y z { */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* | } ~ DEL */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* currency yen brokenbar section */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* notsign hyphen registered macron */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* degree plusminus twosuperior threesuperior */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* acute mu paragraph periodcentered */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* cedilla onesuperior masculine guillemotright */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* onequarter onehalf threequarters questiondown */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Agrave Aacute Acircumflex Atilde */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Adiaeresis Aring AE Ccedilla */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Eth Ntilde Ograve Oacute */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* agrave aacute acircumflex atilde */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* adiaeresis aring ae ccedilla */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* egrave eacute ecircumflex ediaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* igrave iacute icircumflex idiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* eth ntilde ograve oacute */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ocircumflex otilde odiaeresis division */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* oslash ugrave uacute ucircumflex */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +}; + +Const int Tbestable[] = /* ESC while in bypass state */ +{ +/* NUL SOH STX ETX */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_VT_MODE, +/* EOT ENQ ACK BEL */ +CASE_BYP_STATE, +CASE_REPORT, +CASE_BYP_STATE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_IGNORE, +CASE_UP, +/* NP CR SO SI */ +CASE_PAGE, +CASE_IGNORE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* DLE DC1 DC2 DC3 */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* DC4 NAK SYN ETB */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_COPY, +/* CAN EM SUB ESC */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_GIN, +CASE_IGNORE, +/* FS GS RS US */ +CASE_SPT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* $ % & ' */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* ( ) * + */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* , - . / */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* 0 1 2 3 */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* 4 5 6 7 */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* 8 9 : ; */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* < = > ? */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* @ A B C */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* D E F G */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* H I J K */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* L M N O */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* P Q R S */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* T U V W */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* X Y Z [ */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* \ ] ^ _ */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* ` a b c */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* d e f g */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* h i j k */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* l m n o */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* p q r s */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* t u v w */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* x y z { */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* | } ~ DEL */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_IGNORE, +CASE_BYP_STATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* currency yen brokenbar section */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* notsign hyphen registered macron */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* acute mu paragraph periodcentered */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* agrave aacute acircumflex atilde */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* eth ntilde ograve oacute */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +CASE_BYP_STATE, +}; + +Const int Tbyptable[] = /* ESC CAN (^X) bypass state */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_LF, +CASE_UP, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BES_STATE, +/* FS GS RS US */ +CASE_PT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 4 5 6 7 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 8 9 : ; */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* < = > ? */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* @ A B C */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* D E F G */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* H I J K */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* L M N O */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* P Q R S */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* T U V W */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* X Y Z [ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* \ ] ^ _ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ` a b c */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* d e f g */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* h i j k */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* l m n o */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* p q r s */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* t u v w */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* x y z { */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* | } ~ DEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const int Tesctable[] = /* ESC */ +{ +/* NUL SOH STX ETX */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_VT_MODE, +/* EOT ENQ ACK BEL */ +CASE_CURSTATE, +CASE_REPORT, +CASE_CURSTATE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_IGNORE, +CASE_UP, +/* NP CR SO SI */ +CASE_PAGE, +CASE_IGNORE, +CASE_APL, +CASE_ASCII, +/* DLE DC1 DC2 DC3 */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* DC4 NAK SYN ETB */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_COPY, +/* CAN EM SUB ESC */ +CASE_BYP_STATE, +CASE_CURSTATE, +CASE_GIN, +CASE_IGNORE, +/* FS GS RS US */ +CASE_SPT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* $ % & ' */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* ( ) * + */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* , - . / */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* 0 1 2 3 */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* 4 5 6 7 */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* 8 9 : ; */ +CASE_CHAR_SIZE, +CASE_CHAR_SIZE, +CASE_CHAR_SIZE, +CASE_CHAR_SIZE, +/* < = > ? */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* @ A B C */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* D E F G */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* H I J K */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* L M N O */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* P Q R S */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* T U V W */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* X Y Z [ */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* \ ] ^ _ */ +CASE_CURSTATE, +CASE_OSC, +CASE_CURSTATE, +CASE_CURSTATE, +/* ` a b c */ +CASE_BEAM_VEC, +CASE_BEAM_VEC, +CASE_BEAM_VEC, +CASE_BEAM_VEC, +/* d e f g */ +CASE_BEAM_VEC, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_BEAM_VEC, +/* h i j k */ +CASE_BEAM_VEC, +CASE_BEAM_VEC, +CASE_BEAM_VEC, +CASE_BEAM_VEC, +/* l m n o */ +CASE_BEAM_VEC, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_BEAM_VEC, +/* p q r s */ +CASE_BEAM_VEC, +CASE_BEAM_VEC, +CASE_BEAM_VEC, +CASE_BEAM_VEC, +/* t u v w */ +CASE_BEAM_VEC, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_BEAM_VEC, +/* x y z { */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +CASE_CURSTATE, +/* | } ~ DEL */ +CASE_CURSTATE, +CASE_CURSTATE, +CASE_IGNORE, +CASE_CURSTATE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const int Tipltable[] = /* RS (^^) incremental plot */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_LF, +CASE_UP, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC_STATE, +/* FS GS RS US */ +CASE_PT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_PENUP, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 4 5 6 7 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 8 9 : ; */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* < = > ? */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* @ A B C */ +CASE_IGNORE, +CASE_IPL_POINT, +CASE_IPL_POINT, +CASE_IGNORE, +/* D E F G */ +CASE_IPL_POINT, +CASE_IPL_POINT, +CASE_IPL_POINT, +CASE_IGNORE, +/* H I J K */ +CASE_IPL_POINT, +CASE_IPL_POINT, +CASE_IPL_POINT, +CASE_IGNORE, +/* L M N O */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* P Q R S */ +CASE_PENDOWN, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* T U V W */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* X Y Z [ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* \ ] ^ _ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ` a b c */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* d e f g */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* h i j k */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* l m n o */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* p q r s */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* t u v w */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* x y z { */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* | } ~ DEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const int Tplttable[] = /* GS (^]) graph (plot) mode */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_LF, +CASE_UP, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC_STATE, +/* FS GS RS US */ +CASE_PT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* $ % & ' */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* ( ) * + */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* , - . / */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* 0 1 2 3 */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* 4 5 6 7 */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* 8 9 : ; */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* < = > ? */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* @ A B C */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* D E F G */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* H I J K */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* L M N O */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* P Q R S */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* T U V W */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* X Y Z [ */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* \ ] ^ _ */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* ` a b c */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* d e f g */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* h i j k */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* l m n o */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* p q r s */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* t u v w */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* x y z { */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* | } ~ DEL */ +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +CASE_PLT_VEC, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const int Tpttable[] = /* FS (^\) point plot mode */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_LF, +CASE_UP, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC_STATE, +/* FS GS RS US */ +CASE_PT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* $ % & ' */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* ( ) * + */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* , - . / */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* 0 1 2 3 */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* 4 5 6 7 */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* 8 9 : ; */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* < = > ? */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* @ A B C */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* D E F G */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* H I J K */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* L M N O */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* P Q R S */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* T U V W */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* X Y Z [ */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* \ ] ^ _ */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* ` a b c */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* d e f g */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* h i j k */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* l m n o */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* p q r s */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* t u v w */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* x y z { */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* | } ~ DEL */ +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +CASE_PT_POINT, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const int Tspttable[] = /* ESC FS (^\) special point plot */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BEL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_LF, +CASE_UP, +/* NP CR SO SI */ +CASE_IGNORE, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_ESC_STATE, +/* FS GS RS US */ +CASE_PT_STATE, +CASE_PLT_STATE, +CASE_IPL_STATE, +CASE_ALP_STATE, +/* SP ! " # */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* $ % & ' */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* ( ) * + */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* , - . / */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* 0 1 2 3 */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* 4 5 6 7 */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* 8 9 : ; */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* < = > ? */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* @ A B C */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* D E F G */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* H I J K */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* L M N O */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* P Q R S */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* T U V W */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* X Y Z [ */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* \ ] ^ _ */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* ` a b c */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* d e f g */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* h i j k */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* l m n o */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* p q r s */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* t u v w */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* x y z { */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* | } ~ DEL */ +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +CASE_SPT_POINT, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x99 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; diff --git a/ports/xterm/xterm-359/TekPrsTbl.o b/ports/xterm/xterm-359/TekPrsTbl.o new file mode 100644 index 0000000..0b52ceb Binary files /dev/null and b/ports/xterm/xterm-359/TekPrsTbl.o differ diff --git a/ports/xterm/xterm-359/Tekparse.def b/ports/xterm/xterm-359/Tekparse.def new file mode 100644 index 0000000..d4a0b8e --- /dev/null +++ b/ports/xterm/xterm-359/Tekparse.def @@ -0,0 +1,74 @@ +# $XTermId: Tekparse.def,v 1.4 2006/02/12 22:43:56 tom Exp $ +# +# vile:confmode rs=lf +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2002,2006 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# List of symbols that need to be defined for Tekparse.h. If you need to +# change any of the CASE_ macros, make the change here and rerun the command +# shown in Tekparse.h. +# + +CASE_REPORT +CASE_VT_MODE +CASE_SPT_STATE +CASE_GIN +CASE_BEL +CASE_BS +CASE_PT_STATE +CASE_PLT_STATE +CASE_TAB +CASE_IPL_STATE +CASE_ALP_STATE +CASE_UP +CASE_COPY +CASE_PAGE +CASE_BES_STATE +CASE_BYP_STATE +CASE_IGNORE +CASE_ASCII +CASE_APL +CASE_CHAR_SIZE +CASE_BEAM_VEC +CASE_CURSTATE +CASE_PENUP +CASE_PENDOWN +CASE_IPL_POINT +CASE_PLT_VEC +CASE_PT_POINT +CASE_SPT_POINT +CASE_CR +CASE_ESC_STATE +CASE_LF +CASE_SP +CASE_PRINT +CASE_OSC diff --git a/ports/xterm/xterm-359/Tekparse.h b/ports/xterm/xterm-359/Tekparse.h new file mode 100644 index 0000000..aac9851 --- /dev/null +++ b/ports/xterm/xterm-359/Tekparse.h @@ -0,0 +1,55 @@ +/* $XTermId: Tekparse.h,v 1.8 2016/10/06 00:32:30 tom Exp $ */ + +/* + * Copyright 1998-2006,2016 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#ifndef included_Tekparse_h +#define included_Tekparse_h 1 + +#ifndef Const +# if defined(__STDC__) && !defined(__cplusplus) +# define Const const +# else +# define Const /**/ +# endif +#endif + +extern Const int Talptable[]; +extern Const int Tbestable[]; +extern Const int Tbyptable[]; +extern Const int Tesctable[]; +extern Const int Tipltable[]; +extern Const int Tplttable[]; +extern Const int Tpttable[]; +extern Const int Tspttable[]; + +#include + +#endif /* included_Tekparse_h */ diff --git a/ports/xterm/xterm-359/Tekparse.hin b/ports/xterm/xterm-359/Tekparse.hin new file mode 100644 index 0000000..b793e15 --- /dev/null +++ b/ports/xterm/xterm-359/Tekparse.hin @@ -0,0 +1,35 @@ +/* vile:cmode */ +#define CASE_REPORT 0 +#define CASE_VT_MODE 1 +#define CASE_SPT_STATE 2 +#define CASE_GIN 3 +#define CASE_BEL 4 +#define CASE_BS 5 +#define CASE_PT_STATE 6 +#define CASE_PLT_STATE 7 +#define CASE_TAB 8 +#define CASE_IPL_STATE 9 +#define CASE_ALP_STATE 10 +#define CASE_UP 11 +#define CASE_COPY 12 +#define CASE_PAGE 13 +#define CASE_BES_STATE 14 +#define CASE_BYP_STATE 15 +#define CASE_IGNORE 16 +#define CASE_ASCII 17 +#define CASE_APL 18 +#define CASE_CHAR_SIZE 19 +#define CASE_BEAM_VEC 20 +#define CASE_CURSTATE 21 +#define CASE_PENUP 22 +#define CASE_PENDOWN 23 +#define CASE_IPL_POINT 24 +#define CASE_PLT_VEC 25 +#define CASE_PT_POINT 26 +#define CASE_SPT_POINT 27 +#define CASE_CR 28 +#define CASE_ESC_STATE 29 +#define CASE_LF 30 +#define CASE_SP 31 +#define CASE_PRINT 32 +#define CASE_OSC 33 diff --git a/ports/xterm/xterm-359/Tekproc.c b/ports/xterm/xterm-359/Tekproc.c new file mode 100644 index 0000000..d83970c --- /dev/null +++ b/ports/xterm/xterm-359/Tekproc.c @@ -0,0 +1,2103 @@ +/* $XTermId: Tekproc.c,v 1.239 2020/06/02 23:12:04 tom Exp $ */ + +/* + * Copyright 2001-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1988 X Consortium + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the X Consortium shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from the X Consortium. + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* Tekproc.c */ + +#define RES_OFFSET(field) XtOffsetOf(TekWidgetRec, field) + +#include + +#include +#include +#include +#include + +#if OPT_TOOLBAR + +#if defined(HAVE_LIB_XAW) +#include +#elif defined(HAVE_LIB_XAW3D) +#include +#elif defined(HAVE_LIB_XAW3DXFT) +#include +#elif defined(HAVE_LIB_NEXTAW) +#include +#elif defined(HAVE_LIB_XAWPLUS) +#include +#endif + +#endif /* OPT_TOOLBAR */ + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#define DefaultGCID(tw) \ + XGContextFromGC(DefaultGC(XtDisplay(tw), \ + DefaultScreen(XtDisplay(tw)))) + +/* Tek defines */ + +#define MY_CLASS "Tek4014" +#define MY_NAME "tek4014" + +#define SOLIDLINE 0 +#define DOTTEDLINE 1 +#define DOTDASHEDLINE 2 +#define SHORTDASHEDLINE 3 +#define LONGDASHEDLINE 4 + +#define EAST 001 +#define WEST 002 +#define NORTH 004 +#define SOUTH 010 + +#define LINEMASK 07 +#define MARGIN1 0 +#define MARGIN2 1 +#define MAX_PTS 150 +#define MAX_VTX 300 +#define PENDOWN 1 +#define PENUP 0 +#define TEKBOTTOMPAD 23 +#define TEKDEFHEIGHT 565 +#define TEKDEFWIDTH 750 +#define TEKHEIGHT 3072 +#define TEKHOME ( (TekChar[tekscr->page.fontsize].nlines - 1) \ + * TekChar[tekscr->page.fontsize].vsize) +#define TEKMINHEIGHT 452 +#define TEKMINWIDTH 600 +#define TEKTOPPAD 34 +#define TEKWIDTH 4096 + +#define FULL_HEIGHT (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD) + +#define BottomY(y) (TEKHEIGHT + TEKTOPPAD - (y)) +#define BorderOf(tw) (TScreenOf((tw)->vt)->border) +#define ScaleOf(tw) TekScale(TekScreenOf(tw)) +#define ScaledX(tw,x) (((x) * ScaleOf(tw)) + BorderOf(tw)) +#define ScaledY(tw,y) ((BottomY(y) * ScaleOf(tw)) + BorderOf(tw)) + +#define TekMove(tw,x,y) do { tekscr->cur_X = x; tekscr->cur_Y = y; } while (0) +#define input() Tinput(tw) +#define unput(c) *Tpushback++ = (Char) c +/* *INDENT-OFF* */ +static const struct Tek_Char { + int hsize; /* in Tek units */ + int vsize; /* in Tek units */ + int charsperline; + int nlines; +} TekChar[TEKNUMFONTS] = { + {56, 88, 74, 35}, /* large */ + {51, 82, 81, 38}, /* #2 */ + {34, 53, 121, 58}, /* #3 */ + {31, 48, 133, 64}, /* small */ +}; +/* *INDENT-ON* */ + +static Cursor GINcursor; +static XSegment *line_pt; +static int nplot; +static TekLink Tek0; +static jmp_buf Tekjump; +static TekLink *TekRecord; +static XSegment *Tline; + +static Const int *curstate = Talptable; +static Const int *Tparsestate = Talptable; + +static char defaultTranslations[] = "\ + ~Meta: insert-seven-bit() \n\ + Meta: insert-eight-bit() \n\ + !Ctrl : popup-menu(mainMenu) \n\ + !Lock Ctrl : popup-menu(mainMenu) \n\ +!Lock Ctrl @Num_Lock : popup-menu(mainMenu) \n\ + !Ctrl @Num_Lock : popup-menu(mainMenu) \n\ + !Ctrl : popup-menu(tekMenu) \n\ + !Lock Ctrl : popup-menu(tekMenu) \n\ +!Lock Ctrl @Num_Lock : popup-menu(tekMenu) \n\ + !Ctrl @Num_Lock : popup-menu(tekMenu) \n\ + Shift ~Meta: gin-press(L) \n\ + ~Meta: gin-press(l) \n\ + Shift ~Meta: gin-press(M) \n\ + ~Meta: gin-press(m) \n\ + Shift ~Meta: gin-press(R) \n\ + ~Meta: gin-press(r)"; +/* *INDENT-OFF* */ +static XtActionsRec actionsList[] = { + { "string", HandleStringEvent }, + { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */ + { "insert-seven-bit", HandleKeyPressed }, + { "insert-eight-bit", HandleEightBitKeyPressed }, + { "gin-press", HandleGINInput }, + { "secure", HandleSecure }, + { "create-menu", HandleCreateMenu }, + { "popup-menu", HandlePopupMenu }, + /* menu actions */ + { "allow-send-events", HandleAllowSends }, + { "set-visual-bell", HandleSetVisualBell }, +#ifdef ALLOWLOGGING + { "set-logging", HandleLogging }, +#endif + { "redraw", HandleRedraw }, + { "send-signal", HandleSendSignal }, + { "quit", HandleQuit }, + { "set-scrollbar", HandleScrollbar }, + { "set-jumpscroll", HandleJumpscroll }, + { "set-reverse-video", HandleReverseVideo }, + { "set-autowrap", HandleAutoWrap }, + { "set-reversewrap", HandleReverseWrap }, + { "set-autolinefeed", HandleAutoLineFeed }, + { "set-appcursor", HandleAppCursor }, + { "set-appkeypad", HandleAppKeypad }, + { "set-scroll-on-key", HandleScrollKey }, + { "set-scroll-on-tty-output", HandleScrollTtyOutput }, + { "set-allow132", HandleAllow132 }, + { "set-cursesemul", HandleCursesEmul }, + { "set-marginbell", HandleMarginBell }, + { "set-altscreen", HandleAltScreen }, + { "soft-reset", HandleSoftReset }, + { "hard-reset", HandleHardReset }, + { "set-terminal-type", HandleSetTerminalType }, + { "set-visibility", HandleVisibility }, + { "set-tek-text", HandleSetTekText }, + { "tek-page", HandleTekPage }, + { "tek-reset", HandleTekReset }, + { "tek-copy", HandleTekCopy }, +#if OPT_TOOLBAR + { "set-toolbar", HandleToolbar }, +#endif +}; +/* *INDENT-ON* */ + +static Dimension defOne = 1; + +#define GIN_TERM_NONE_STR "none" +#define GIN_TERM_CR_STR "CRonly" +#define GIN_TERM_EOT_STR "CR&EOT" + +#define GIN_TERM_NONE 0 +#define GIN_TERM_CR 1 +#define GIN_TERM_EOT 2 + +#ifdef VMS +#define DFT_FONT_SMALL "FIXED" +#else +#define DFT_FONT_SMALL "6x10" +#endif + +static XtResource resources[] = +{ + {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), + XtOffsetOf(CoreRec, core.width), XtRDimension, (caddr_t) & defOne}, + {XtNheight, XtCHeight, XtRDimension, sizeof(Dimension), + XtOffsetOf(CoreRec, core.height), XtRDimension, (caddr_t) & defOne}, + Fres("fontLarge", XtCFont, tek.Tfont[TEK_FONT_LARGE], "9x15"), + Fres("font2", XtCFont, tek.Tfont[TEK_FONT_2], "6x13"), + Fres("font3", XtCFont, tek.Tfont[TEK_FONT_3], "8x13"), + Fres("fontSmall", XtCFont, tek.Tfont[TEK_FONT_SMALL], DFT_FONT_SMALL), + Sres(XtNinitialFont, XtCInitialFont, tek.initial_font, "large"), + Sres("ginTerminator", "GinTerminator", tek.gin_terminator_str, GIN_TERM_NONE_STR), +#if OPT_TOOLBAR + Wres(XtNmenuBar, XtCMenuBar, tek.tb_info.menu_bar, 0), + Ires(XtNmenuHeight, XtCMenuHeight, tek.tb_info.menu_height, 25), +#endif +}; + +static IChar Tinput(TekWidget /* tw */ ); +static int getpoint(TekWidget /* tw */ ); +static void TCursorBack(TekWidget /* tw */ ); +static void TCursorDown(TekWidget /* tw */ ); +static void TCursorForward(TekWidget /* tw */ ); +static void TCursorUp(TekWidget /* tw */ ); +static void TekBackground(TekWidget /* tw */ , + TScreen * /* screen */ ); +static void TekResize(Widget /* w */ ); +static void TekDraw(TekWidget /* tw */ , + int /* x */ , + int /* y */ ); +static void TekEnq(TekWidget /* tw */ , + unsigned /* status */ , + int /* x */ , + int /* y */ ); +static void TekFlush(TekWidget /* tw */ ); +static void TekInitialize(Widget /* request */ , + Widget /* wnew */ , + ArgList /* args */ , + Cardinal * /* num_args */ ); +static void TekPage(TekWidget /* tw */ ); +static void TekRealize(Widget /* gw */ , + XtValueMask * /* valuemaskp */ , + XSetWindowAttributes * /* values */ ); + +static WidgetClassRec tekClassRec = +{ + { +/* core_class fields */ + (WidgetClass) & widgetClassRec, /* superclass */ + MY_CLASS, /* class_name */ + sizeof(TekWidgetRec), /* widget_size */ + NULL, /* class_initialize */ + NULL, /* class_part_initialize */ + False, /* class_inited */ + TekInitialize, /* initialize */ + NULL, /* initialize_hook */ + TekRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + True, /* compress_motion */ + True, /* compress_exposure */ + True, /* compress_enterleave */ + False, /* visible_interest */ + NULL, /* destroy */ + TekResize, /* resize */ + TekExpose, /* expose */ + NULL, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_offsets */ + defaultTranslations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + } +}; +WidgetClass tekWidgetClass = (WidgetClass) & tekClassRec; + +static Bool Tfailed = False; + +/* + * TekInit/TekRun are called after the VT100 widget has been initialized, but + * may be before VT100 is realized, depending upon whether Tek4014 is the + * first window to be shown. + */ +int +TekInit(void) +{ + Widget form_top, menu_top; + Dimension menu_high; + + if (!Tfailed + && tekWidget == 0) { + Cardinal nargs = 0; + Arg myArgs[3]; + Boolean iconic = 0; + + TRACE(("TekInit\n")); + XtSetArg(myArgs[nargs], XtNiconic, &iconic); + ++nargs; + XtGetValues(toplevel, myArgs, nargs); + + nargs = 0; + XtSetArg(myArgs[nargs], XtNiconic, iconic); + ++nargs; + XtSetArg(myArgs[nargs], XtNallowShellResize, True); + ++nargs; + XtSetArg(myArgs[nargs], XtNinput, True); + ++nargs; + + /* this causes the Initialize method to be called */ + tekshellwidget = + XtCreatePopupShell("tektronix", topLevelShellWidgetClass, + toplevel, myArgs, nargs); + + SetupMenus(tekshellwidget, &form_top, &menu_top, &menu_high); + + /* this causes the Realize method to be called */ + tekWidget = (TekWidget) + XtVaCreateManagedWidget(MY_NAME, + tekWidgetClass, form_top, +#if OPT_TOOLBAR + XtNmenuBar, menu_top, + XtNresizable, True, + XtNfromVert, menu_top, + XtNtop, XawChainTop, + XtNleft, XawChainLeft, + XtNright, XawChainRight, + XtNbottom, XawChainBottom, + XtNmenuHeight, menu_high, +#endif + (XtPointer) 0); +#if OPT_TOOLBAR + ShowToolbar(resource.toolBar); +#endif + } + return (!Tfailed); +} + +/* + * If we haven't allocated the PtyData struct, do so. + */ +static int +TekPtyData(void) +{ + if (Tpushb == 0 && !Tfailed) { + if ((Tpushb = TypeMallocN(Char, 10)) == NULL + || (Tline = TypeMallocN(XSegment, MAX_VTX)) == NULL) { + xtermWarning("Not enough core for Tek mode\n"); + free(Tpushb); + Tfailed = True; + } + } + return (Tfailed ? 0 : 1); +} + +static void +Tekparse(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(tw->vt); + int x, y; + IChar ch; + int nextstate; + + for (;;) { + IChar c = input(); + /* + * The parsing tables all have 256 entries. If we're supporting + * wide characters, we handle them by treating them the same as + * printing characters. + */ +#if OPT_WIDE_CHARS + if (c > 255) { + nextstate = (Tparsestate == Talptable) + ? CASE_PRINT + : CASE_IGNORE; + } else +#endif + nextstate = Tparsestate[c]; + TRACE(("Tekparse %04X -> %d\n", c, nextstate)); + + switch (nextstate) { + case CASE_REPORT: + TRACE(("case: report address\n")); + if (tekscr->TekGIN) { + TekGINoff(tw); + TekEnqMouse(tw, 0); + } else { + c = 064; /* has hard copy unit */ + if (tekscr->margin == MARGIN2) + c |= 02; + TekEnq(tw, c, tekscr->cur_X, tekscr->cur_Y); + } + TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ + Tparsestate = curstate; + break; + + case CASE_VT_MODE: + TRACE(("case: special return to vt102 mode\n")); + Tparsestate = curstate; + TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ + FlushLog(tw->vt); + return; + + case CASE_SPT_STATE: + TRACE(("case: Enter Special Point Plot mode\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate = Tspttable; + break; + + case CASE_GIN: + TRACE(("case: Do Tek GIN mode\n")); + tekscr->TekGIN = &TekRecord->ptr[-1]; + /* Set cross-hair cursor raster array */ + if ((GINcursor = + make_colored_cursor(XC_tcross, + T_COLOR(screen, MOUSE_FG), + T_COLOR(screen, MOUSE_BG))) != 0) { + XDefineCursor(XtDisplay(tw), TWindow(tekscr), + GINcursor); + } + Tparsestate = Tbyptable; /* Bypass mode */ + break; + + case CASE_BEL: + TRACE(("case: BEL\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + if (!tekRefreshList) + Bell(tw->vt, XkbBI_TerminalBell, 0); + Tparsestate = curstate; /* clear bypass condition */ + break; + + case CASE_BS: + TRACE(("case: BS\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate; /* clear bypass condition */ + TCursorBack(tw); + break; + + case CASE_PT_STATE: + TRACE(("case: Enter Tek Point Plot mode\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate = Tpttable; + break; + + case CASE_PLT_STATE: + TRACE(("case: Enter Tek Plot mode\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate = Tplttable; + if ((c = input()) == ANSI_BEL) + tekscr->pen = PENDOWN; + else { + unput(c); + tekscr->pen = PENUP; + } + break; + + case CASE_TAB: + TRACE(("case: HT\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate; /* clear bypass condition */ + TCursorForward(tw); + break; + + case CASE_IPL_STATE: + TRACE(("case: Enter Tek Incremental Plot mode\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate = Tipltable; + break; + + case CASE_ALP_STATE: + TRACE(("case: Enter Tek Alpha mode from any other mode\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + /* if in one of graphics states, move alpha cursor */ + if (nplot > 0) /* flush line VTbuffer */ + TekFlush(tw); + Tparsestate = curstate = Talptable; + break; + + case CASE_UP: + TRACE(("case: cursor up\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + Tparsestate = curstate; /* clear bypass condition */ + TCursorUp(tw); + break; + + case CASE_COPY: + TRACE(("case: make copy\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + TekCopy(tw); + TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ + Tparsestate = curstate; /* clear bypass condition */ + break; + + case CASE_PAGE: + TRACE(("case: Page Function\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + TekPage(tw); /* clear bypass condition */ + break; + + case CASE_BES_STATE: + TRACE(("case: Byp: an escape char\n")); + Tparsestate = Tbestable; + break; + + case CASE_BYP_STATE: + TRACE(("case: set bypass condition\n")); + Tparsestate = Tbyptable; + break; + + case CASE_IGNORE: + TRACE(("case: Esc: totally ignore CR, ESC, LF, ~\n")); + break; + + case CASE_ASCII: + TRACE(("case: Select ASCII char set\n")); + /* ignore for now */ + Tparsestate = curstate; + break; + + case CASE_APL: + TRACE(("case: Select APL char set\n")); + /* ignore for now */ + Tparsestate = curstate; + break; + + case CASE_CHAR_SIZE: + TRACE(("case: character size selector\n")); + TekSetFontSize(tw, False, (int) (c & 03)); + Tparsestate = curstate; + break; + + case CASE_BEAM_VEC: + TRACE(("case: beam and vector selector\n")); + /* only line types */ + c = (IChar) (c & LINEMASK); + if (c != tekscr->cur.linetype) { + if (nplot > 0) + TekFlush(tw); + if (c <= TEKNUMLINES) + tekscr->cur.linetype = c; + } + Tparsestate = curstate; + break; + + case CASE_CURSTATE: + Tparsestate = curstate; + break; + + case CASE_PENUP: + TRACE(("case: Ipl: penup\n")); + tekscr->pen = PENUP; + break; + + case CASE_PENDOWN: + TRACE(("case: Ipl: pendown\n")); + tekscr->pen = PENDOWN; + break; + + case CASE_IPL_POINT: + TRACE(("case: Ipl: point\n")); + x = tekscr->cur_X; + y = tekscr->cur_Y; + if (c & NORTH) + y++; + else if (c & SOUTH) + y--; + if (c & EAST) + x++; + else if (c & WEST) + x--; + if (tekscr->pen == PENDOWN) + TekDraw(tw, x, y); + else + TekMove(tw, x, y); + break; + + case CASE_PLT_VEC: + TRACE(("case: Plt: vector\n")); + unput(c); + if (getpoint(tw)) { + if (tekscr->pen == PENDOWN) { + TekDraw(tw, tekscr->cur.x, tekscr->cur.y); + } else { + TekMove(tw, tekscr->cur.x, tekscr->cur.y); + } + tekscr->pen = PENDOWN; + } + break; + + case CASE_PT_POINT: + TRACE(("case: Pt: point\n")); + unput(c); + if (getpoint(tw)) { + TekMove(tw, tekscr->cur.x, tekscr->cur.y); + TekDraw(tw, tekscr->cur.x, tekscr->cur.y); + } + break; + + case CASE_SPT_POINT: + TRACE(("case: Spt: point\n")); + /* ignore intensity character in c */ + if (getpoint(tw)) { + TekMove(tw, tekscr->cur.x, tekscr->cur.y); + TekDraw(tw, tekscr->cur.x, tekscr->cur.y); + } + break; + + case CASE_CR: + TRACE(("case: CR\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + if (nplot > 0) /* flush line VTbuffer */ + TekFlush(tw); + tekscr->cur_X = tekscr->margin == MARGIN1 ? 0 : + TEKWIDTH / 2; + Tparsestate = curstate = Talptable; + break; + + case CASE_ESC_STATE: + TRACE(("case: ESC\n")); + Tparsestate = Tesctable; + break; + + case CASE_LF: + TRACE(("case: LF\n")); + if (tekscr->TekGIN) + TekGINoff(tw); + TCursorDown(tw); + if (!tekRefreshList) + do_xevents(tw->vt); + break; + + case CASE_SP: + TRACE(("case: SP\n")); + TCursorForward(tw); + break; + + case CASE_PRINT: + TRACE(("case: printable character\n")); + ch = c; + x = (int) ScaledX(tw, tekscr->cur_X); + y = (int) ScaledY(tw, tekscr->cur_Y); + +#if OPT_WIDE_CHARS + if (screen->wide_chars + && (ch > 255)) { + XChar2b sbuf; + sbuf.byte2 = LO_BYTE(ch); + sbuf.byte1 = HI_BYTE(ch); + XDrawImageString16(XtDisplay(tw), + TWindow(tekscr), + tekscr->TnormalGC, + x, + y, + &sbuf, + 1); + } else +#endif + { + char ch2 = (char) ch; + XDrawString(XtDisplay(tw), + TWindow(tekscr), + tekscr->TnormalGC, + x, + y, + &ch2, + 1); + } + TCursorForward(tw); + break; + case CASE_OSC: + /* FIXME: someone should disentangle the input queues + * of this code so that it can be state-driven. + */ + TRACE(("case: do osc escape\n")); + { + /* + * do_osc() can call TekExpose(), which calls TekRefresh(), + * and sends us recurring here - don't do that... + */ + static int nested; + + Char buf2[512]; + IChar c2; + size_t len = 0; + while ((c2 = input()) != ANSI_BEL) { + if (!isprint((int) (c2 & 0x7f)) + || len + 2 >= (int) sizeof(buf2)) + break; + buf2[len++] = (Char) c2; + } + buf2[len] = 0; + if (!nested++) { + if (c2 == ANSI_BEL) + do_osc(tw->vt, buf2, len, ANSI_BEL); + } + --nested; + } + Tparsestate = curstate; + break; + } + } +} + +static int rcnt; +static char *rptr; +static PtySelect Tselect_mask; + +static IChar +Tinput(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(tw->vt); + TekLink *tek; + + if (Tpushback > Tpushb) + return (*--Tpushback); + if (tekRefreshList) { + if (rcnt-- > 0) + return (IChar) (*rptr++); + if ((tek = tekRefreshList->next) != 0) { + tekRefreshList = tek; + rptr = tek->data; + rcnt = tek->count - 1; + TekSetFontSize(tw, False, tek->fontsize); + return (IChar) (*rptr++); + } + tekRefreshList = (TekLink *) 0; + longjmp(Tekjump, 1); + } + again: + if (VTbuffer->next >= VTbuffer->last) { + int update = VTbuffer->update; + + if (nplot > 0) /* flush line */ + TekFlush(tw); +#ifdef VMS + Tselect_mask = pty_mask; /* force a read */ +#else /* VMS */ + XFD_COPYSET(&pty_mask, &Tselect_mask); +#endif /* VMS */ + for (;;) { +#ifdef CRAY + struct timeval crocktimeout; + crocktimeout.tv_sec = 0; + crocktimeout.tv_usec = 0; + (void) Select(max_plus1, + &Tselect_mask, NULL, NULL, + &crocktimeout); +#endif + if (readPtyData(tw->vt, &Tselect_mask, VTbuffer)) { + break; + } + if (Ttoggled && curstate == Talptable) { + TCursorToggle(tw, TOGGLE); + Ttoggled = False; + } + if (xtermAppPending() & XtIMXEvent) { +#ifdef VMS + Tselect_mask = X_mask; +#else /* VMS */ + XFD_COPYSET(&X_mask, &Tselect_mask); +#endif /* VMS */ + } else { + XFlush(XtDisplay(tw)); +#ifdef VMS + Tselect_mask = Select_mask; + +#else /* VMS */ + XFD_COPYSET(&Select_mask, &Tselect_mask); + if (Select(max_plus1, &Tselect_mask, NULL, NULL, NULL) < 0) { + if (errno != EINTR) + SysError(ERROR_TSELECT); + continue; + } +#endif /* VMS */ + } +#ifdef VMS + if (Tselect_mask & X_mask) { + xevents(tw->vt); + if (VTbuffer->update != update) + goto again; + } +#else /* VMS */ + if (FD_ISSET(ConnectionNumber(XtDisplay(tw)), &Tselect_mask)) { + xevents(tw->vt); + if (VTbuffer->update != update) + goto again; + } +#endif /* VMS */ + } + if (!Ttoggled && curstate == Talptable) { + TCursorToggle(tw, TOGGLE); + Ttoggled = True; + } + } + tek = TekRecord; + if (tek->count >= TEK_LINK_BLOCK_SIZE + || tek->fontsize != tekscr->cur.fontsize) { + if ((TekRecord = tek->next = CastMalloc(TekLink)) == 0) { + Panic("Tinput: malloc error (%d)\n", errno); + } else { + tek = tek->next; + tek->next = (TekLink *) 0; + tek->fontsize = (unsigned short) tekscr->cur.fontsize; + tek->count = 0; + tek->ptr = tek->data; + } + } + tek->count++; + + (void) morePtyData(screen, VTbuffer); + return (IChar) (*tek->ptr++ = (char) nextPtyData(screen, VTbuffer)); +} + +static void +TekClear(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + + TRACE(("TekClear\n")); + nplot = 0; + line_pt = Tline; + if (TWindow(tekscr)) + XClearWindow(XtDisplay(tw), TWindow(tekscr)); +} + +void +TekSetWinSize(TekWidget tw) +{ + if (TEK4014_ACTIVE(tw->vt)) { + TekScreen *tekscr = TekScreenOf(tw); + const struct Tek_Char *t = &TekChar[tekscr->cur.fontsize]; + int rows = THeight(tekscr) / (int) (ScaleOf(tw) * t->vsize); + int cols = TWidth(tekscr) / (int) (ScaleOf(tw) * t->hsize); + + update_winsize(TScreenOf(tw->vt)->respond, + rows, cols, + TFullHeight(tekscr), + TFullWidth(tekscr)); + } +} + +static void +compute_sizes(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + int border = 2 * BorderOf(tw); + double d; +#if OPT_TRACE + const struct Tek_Char *t = &TekChar[tekscr->cur.fontsize]; + const XFontStruct *fs = tw->tek.Tfont[tekscr->cur.fontsize]; +#endif + + /* *INDENT-EQLS* */ + TWidth(tekscr) = tw->core.width - border; + THeight(tekscr) = tw->core.height - border; + ScaleOf(tw) = (double) TWidth(tekscr) / TEKWIDTH; + + if ((d = (double) THeight(tekscr) / FULL_HEIGHT) < ScaleOf(tw)) + ScaleOf(tw) = d; + + TFullWidth(tekscr) = tw->core.width; + TFullHeight(tekscr) = tw->core.height; + + TRACE(("%s size %dx%d full %dx%d scale %.2f\n", MY_NAME, + THeight(tekscr), TWidth(tekscr), + TFullHeight(tekscr), TFullWidth(tekscr), + ScaleOf(tw))); + + /* The tek4014 fonts always look odd since their spacing is overridden to + * get the "same" size as a real Tektronix terminal. TrueType fonts for + * these small sizes would be no better... + */ + TRACE(("unscaled font %dx%d\n", t->vsize, t->hsize)); + TRACE(("scaled font %.1fx%.1f\n", d * t->vsize, d * t->hsize)); + TRACE(("actual font %dx%d\n", + fs->max_bounds.ascent + fs->max_bounds.descent, + fs->max_bounds.width)); + + TekSetWinSize(tw); +} + +static void +TekResize(Widget w) +{ + TekWidget tw = getTekWidget(w); + if (tw != 0) { + + TRACE(("TekResize {{\n")); + TekClear(tw); + + compute_sizes(tw); + + TRACE(("}} TekResize\n")); + } +} + +/*ARGSUSED*/ +void +TekExpose(Widget w, + XEvent *event GCC_UNUSED, + Region region GCC_UNUSED) +{ + TekWidget tw = getTekWidget(w); + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + + TRACE(("TekExpose {{\n")); + +#ifdef lint + region = region; +#endif + if (!Ttoggled) + TCursorToggle(tw, CLEAR); + Ttoggled = True; + Tpushback = Tpushb; + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; + tekscr->cur = tekscr->page; + TekSetFontSize(tw, False, tekscr->cur.fontsize); + tekscr->margin = MARGIN1; + if (tekscr->TekGIN) { + tekscr->TekGIN = NULL; + TekGINoff(tw); + } + tekRefreshList = &Tek0; + rptr = tekRefreshList->data; + rcnt = tekRefreshList->count; + Tparsestate = curstate = Talptable; + TRACE(("TekExpose resets data to replay %d bytes\n", rcnt)); + first_map_occurred(); + if (!tekscr->waitrefresh) + TekRefresh(tw); + TRACE(("}} TekExpose\n")); + } +} + +void +TekRefresh(TekWidget tw) +{ + if (tw != 0) { + TScreen *screen = TScreenOf(tw->vt); + TekScreen *tekscr = TekScreenOf(tw); + static Cursor wait_cursor = None; + + if (wait_cursor == None) + wait_cursor = make_colored_cursor(XC_watch, + T_COLOR(screen, MOUSE_FG), + T_COLOR(screen, MOUSE_BG)); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), wait_cursor); + XFlush(XtDisplay(tw)); + if (!setjmp(Tekjump)) + Tekparse(tw); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), + (tekscr->TekGIN && GINcursor) ? GINcursor : tekscr->arrow); + } +} + +void +TekRepaint(TekWidget tw) +{ + TRACE(("TekRepaint\n")); + TekClear(tw); + TekExpose((Widget) tw, (XEvent *) NULL, (Region) NULL); +} + +static void +TekPage(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + TekLink *tek; + + TRACE(("TekPage\n")); + TekClear(tw); + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; + tekscr->margin = MARGIN1; + tekscr->page = tekscr->cur; + if (tekscr->TekGIN) + TekGINoff(tw); + tek = TekRecord = &Tek0; + tek->fontsize = (unsigned short) tekscr->cur.fontsize; + tek->count = 0; + tek->ptr = tek->data; + tek = tek->next; + if (tek) + do { + TekLink *tek2 = tek->next; + + free(tek); + tek = tek2; + } while (tek); + TekRecord->next = (TekLink *) 0; + tekRefreshList = (TekLink *) 0; + Ttoggled = True; + Tparsestate = curstate = Talptable; /* Tek Alpha mode */ +} + +#define EXTRABITS 017 +#define FIVEBITS 037 +#define HIBITS (FIVEBITS << SHIFTHI) +#define LOBITS (FIVEBITS << SHIFTLO) +#define SHIFTHI 7 +#define SHIFTLO 2 +#define TWOBITS 03 + +static int +getpoint(TekWidget tw) +{ + int x, y, e, lo_y = 0; + TekScreen *tekscr = TekScreenOf(tw); + + x = tekscr->cur.x; + y = tekscr->cur.y; + + for (;;) { + int c; + + if ((c = (int) input()) < ' ') { /* control character */ + unput(c); + return (0); + } + if (c < '@') { /* Hi X or Hi Y */ + if (lo_y) { /* seen a Lo Y, so this must be Hi X */ + x &= ~HIBITS; + x |= (c & FIVEBITS) << SHIFTHI; + continue; + } + /* else Hi Y */ + y &= ~HIBITS; + y |= (c & FIVEBITS) << SHIFTHI; + continue; + } + if (c < '`') { /* Lo X */ + x &= ~LOBITS; + x |= (c & FIVEBITS) << SHIFTLO; + tekscr->cur.x = x; + tekscr->cur.y = y; + return (1); /* OK */ + } + /* else Lo Y */ + if (lo_y) { /* seen a Lo Y, so other must be extra bits */ + e = (y >> SHIFTLO) & EXTRABITS; + x &= ~TWOBITS; + x |= e & TWOBITS; + y &= ~TWOBITS; + y |= (e >> SHIFTLO) & TWOBITS; + } + y &= ~LOBITS; + y |= (c & FIVEBITS) << SHIFTLO; + lo_y++; + } +} + +static void +TCursorBack(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + const struct Tek_Char *t; + int x = (tekscr->cur_X -= (t = &TekChar[tekscr->cur.fontsize])->hsize); + + if (((tekscr->margin == MARGIN1) && (x < 0)) + || ((tekscr->margin == MARGIN2) && (x < TEKWIDTH / 2))) { + int l = ((tekscr->cur_Y + (t->vsize - 1)) / t->vsize + 1); + if (l >= t->nlines) { + tekscr->margin = !tekscr->margin; + l = 0; + } + tekscr->cur_Y = l * t->vsize; + tekscr->cur_X = (t->charsperline - 1) * t->hsize; + } +} + +static void +TCursorForward(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + const struct Tek_Char *t = &TekChar[tekscr->cur.fontsize]; + + if ((tekscr->cur_X += t->hsize) > TEKWIDTH) { + int l = (tekscr->cur_Y / t->vsize - 1); + if (l < 0) { + tekscr->margin = !tekscr->margin; + l = t->nlines - 1; + } + tekscr->cur_Y = l * t->vsize; + tekscr->cur_X = tekscr->margin == MARGIN1 ? 0 : TEKWIDTH / 2; + } +} + +static void +TCursorUp(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + const struct Tek_Char *t; + int l; + + t = &TekChar[tekscr->cur.fontsize]; + + if ((l = (tekscr->cur_Y + (t->vsize - 1)) / t->vsize + 1) >= t->nlines) { + l = 0; + if ((tekscr->margin = !tekscr->margin) != MARGIN1) { + if (tekscr->cur_X < TEKWIDTH / 2) + tekscr->cur_X += TEKWIDTH / 2; + } else if (tekscr->cur_X >= TEKWIDTH / 2) + tekscr->cur_X -= TEKWIDTH / 2; + } + tekscr->cur_Y = l * t->vsize; +} + +static void +TCursorDown(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + const struct Tek_Char *t; + int l; + + t = &TekChar[tekscr->cur.fontsize]; + + if ((l = tekscr->cur_Y / t->vsize - 1) < 0) { + l = t->nlines - 1; + if ((tekscr->margin = !tekscr->margin) != MARGIN1) { + if (tekscr->cur_X < TEKWIDTH / 2) + tekscr->cur_X += TEKWIDTH / 2; + } else if (tekscr->cur_X >= TEKWIDTH / 2) + tekscr->cur_X -= TEKWIDTH / 2; + } + tekscr->cur_Y = l * t->vsize; +} + +static void +AddToDraw(TekWidget tw, int x1, int y1, int x2, int y2) +{ + XSegment *lp; + + TRACE(("AddToDraw (%d,%d) (%d,%d)\n", x1, y1, x2, y2)); + if (nplot >= MAX_PTS) { + TekFlush(tw); + } + lp = line_pt++; + lp->x1 = (short) ScaledX(tw, x1); + lp->y1 = (short) ScaledY(tw, y1); + lp->x2 = (short) ScaledX(tw, x2); + lp->y2 = (short) ScaledY(tw, y2); + nplot++; + TRACE(("...AddToDraw %d points\n", nplot)); +} + +static void +TekDraw(TekWidget tw, int x, int y) +{ + TekScreen *tekscr = TekScreenOf(tw); + + if (nplot == 0 || T_lastx != tekscr->cur_X || T_lasty != tekscr->cur_Y) { + /* + * We flush on each unconnected line segment if the line + * type is not solid. This solves a bug in X when drawing + * points while the line type is not solid. + */ + if (nplot > 0 && tekscr->cur.linetype != SOLIDLINE) + TekFlush(tw); + } + AddToDraw(tw, tekscr->cur_X, tekscr->cur_Y, x, y); + T_lastx = tekscr->cur_X = x; + T_lasty = tekscr->cur_Y = y; +} + +static void +TekFlush(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + + TRACE(("TekFlush\n")); + XDrawSegments(XtDisplay(tw), TWindow(tekscr), + ((tekscr->cur.linetype == SOLIDLINE) + ? tekscr->TnormalGC + : tekscr->linepat[tekscr->cur.linetype - 1]), + Tline, nplot); + nplot = 0; + line_pt = Tline; +} + +void +TekGINoff(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + + TRACE(("TekGINoff\n")); + XDefineCursor(XtDisplay(tw), TWindow(tekscr), tekscr->arrow); + if (GINcursor) + XFreeCursor(XtDisplay(tw), GINcursor); + if (tekscr->TekGIN) { + *tekscr->TekGIN = ANSI_CAN; /* modify recording */ + tekscr->TekGIN = NULL; + } +} + +void +TekEnqMouse(TekWidget tw, int c) /* character pressed */ +{ + TekScreen *tekscr = TekScreenOf(tw); + int mousex, mousey, rootx, rooty; + unsigned int mask; /* XQueryPointer */ + Window root, subw; + + TRACE(("TekEnqMouse\n")); + XQueryPointer( + XtDisplay(tw), TWindow(tekscr), + &root, &subw, + &rootx, &rooty, + &mousex, &mousey, + &mask); + if ((mousex = (int) ((mousex - BorderOf(tw)) / ScaleOf(tw))) < 0) + mousex = 0; + else if (mousex >= TEKWIDTH) + mousex = TEKWIDTH - 1; + if ((mousey = (int) BottomY((mousey - BorderOf(tw)) / ScaleOf(tw))) < 0) + mousey = 0; + else if (mousey >= TEKHEIGHT) + mousey = TEKHEIGHT - 1; + TekEnq(tw, (unsigned) c, mousex, mousey); +} + +static void +TekEnq(TekWidget tw, + unsigned status, + int x, + int y) +{ + TScreen *screen = TScreenOf(tw->vt); + TekScreen *tekscr = TekScreenOf(tw); + Char cplot[7]; + int len = 5; + int adj = (status != 0) ? 0 : 1; + + TRACE(("TekEnq\n")); + cplot[0] = (Char) status; + /* Translate x and y to Tektronix code */ + cplot[1] = (Char) (040 | ((x >> SHIFTHI) & FIVEBITS)); + cplot[2] = (Char) (040 | ((x >> SHIFTLO) & FIVEBITS)); + cplot[3] = (Char) (040 | ((y >> SHIFTHI) & FIVEBITS)); + cplot[4] = (Char) (040 | ((y >> SHIFTLO) & FIVEBITS)); + + if (tekscr->gin_terminator != GIN_TERM_NONE) + cplot[len++] = '\r'; + if (tekscr->gin_terminator == GIN_TERM_EOT) + cplot[len++] = '\004'; +#ifdef VMS + tt_write(cplot + adj, len - adj); +#else /* VMS */ + v_write(screen->respond, cplot + adj, (unsigned) (len - adj)); +#endif /* VMS */ +} + +void +TekRun(void) +{ + XtermWidget xw = term; + + assert(xw != 0); + if (tekWidget == 0) { + TekInit(); + } + if (tekWidget != 0) { + TRACE(("TekRun ...\n")); + + if (!TEK4014_SHOWN(xw)) { + set_tek_visibility(True); + } + update_vttekmode(); + update_vtshow(); + update_tekshow(); + set_tekhide_sensitivity(); + + Tpushback = Tpushb; + Ttoggled = True; + if (!setjmp(Tekend)) + Tekparse(tekWidget); + if (!Ttoggled) { + TCursorToggle(tekWidget, TOGGLE); + Ttoggled = True; + } + TEK4014_ACTIVE(xw) = False; + xtermSetWinSize(xw); + } else { + TEK4014_ACTIVE(xw) = False; + if (VWindow(TScreenOf(xw)) == 0) { + Exit(ERROR_TINIT); + } + } +} + +#define DOTTED_LENGTH 2 +#define DOT_DASHED_LENGTH 4 +#define SHORT_DASHED_LENGTH 2 +#define LONG_DASHED_LENGTH 2 + +static const int dash_length[TEKNUMLINES] = +{ + DOTTED_LENGTH, + DOT_DASHED_LENGTH, + SHORT_DASHED_LENGTH, + LONG_DASHED_LENGTH, +}; + +static _Xconst char dotted[DOTTED_LENGTH] = +{3, 1}; +static _Xconst char dot_dashed[DOT_DASHED_LENGTH] = +{3, 4, 3, 1}; +static _Xconst char short_dashed[SHORT_DASHED_LENGTH] = +{4, 4}; +static _Xconst char long_dashed[LONG_DASHED_LENGTH] = +{4, 7}; + +static _Xconst char *dashes[TEKNUMLINES] = +{ + dotted, + dot_dashed, + short_dashed, + long_dashed, +}; + +/* + * The following functions are called to initialize and realize the tekWidget + */ +static void +TekInitialize(Widget wrequest, + Widget new_arg, + ArgList args, + Cardinal *num_args) +{ + XtermWidget xw = term; + TScreen *vtscr = TScreenOf(xw); + + TekWidget request = (TekWidget) wrequest; + TekWidget wnew = (TekWidget) new_arg; + + Widget tekparent = SHELL_OF(wnew); + TekScreen *tekscr = TekScreenOf((TekWidget) wnew); + + int i; + int border; + int pr; + int winX, winY; + unsigned min_width, min_height; + unsigned width, height; + char Tdefault[32]; + + (void) args; + (void) num_args; + + TRACE(("TekInitialize {{\n")); + memset(tekscr, 0, sizeof(*tekscr)); + + /* + * Eliminate 'term' as global from other functions. + */ + wnew->vt = xw; + border = 2 * BorderOf(wnew); + TRACE(("... border*2: %d\n", border)); + + /* look for focus related events on the shell, because we need + * to care about the shell's border being part of our focus. + */ + XtAddEventHandler(tekparent, EnterWindowMask, False, + HandleEnterWindow, (Opaque) 0); + XtAddEventHandler(tekparent, LeaveWindowMask, False, + HandleLeaveWindow, (Opaque) 0); + XtAddEventHandler(tekparent, FocusChangeMask, False, + HandleFocusChange, (Opaque) 0); + XtAddEventHandler(new_arg, PropertyChangeMask, False, + HandleBellPropertyChange, (Opaque) 0); + +#ifndef NO_ACTIVE_ICON + tekscr->whichTwin = &(tekscr->fullTwin); +#endif /* NO_ACTIVE_ICON */ + + init_Sres(tek.initial_font); + init_Sres(tek.gin_terminator_str); +#if OPT_TOOLBAR + init_Ires(tek.tb_info.menu_height); + wnew->tek.tb_info.menu_bar = request->tek.tb_info.menu_bar; +#endif + + BorderPixel(wnew) = BorderPixel(xw); + + tekscr->arrow = make_colored_cursor(XC_left_ptr, + T_COLOR(vtscr, MOUSE_FG), + T_COLOR(vtscr, MOUSE_BG)); + + for (i = 0; i < TEKNUMFONTS; i++) { + if (!wnew->tek.Tfont[i]) { + wnew->tek.Tfont[i] = XQueryFont(XtDisplay(wnew), DefaultGCID(wnew)); + } + if (wnew->tek.Tfont[i]) { + TRACE(("Tfont[%d] %dx%d\n", + i, + wnew->tek.Tfont[i]->max_bounds.width, + wnew->tek.Tfont[i]->ascent + + wnew->tek.Tfont[i]->descent)); + wnew->tek.tobaseline[i] = wnew->tek.Tfont[i]->ascent; + } else { + TRACE(("Tfont[%d] disabled\n", i)); + SetItemSensitivity(tekMenuEntries[i].widget, False); + } + } + + if (xw->misc.T_geometry == NULL) { + int def_width, def_height; + + if (xw->misc.tekSmall) { + def_width = TEKMINWIDTH; + def_height = TEKMINHEIGHT; + } else { + def_width = TEKDEFWIDTH; + def_height = TEKDEFHEIGHT; + } + sprintf(Tdefault, "=%dx%d", def_width + border, def_height + border); + xw->misc.T_geometry = Tdefault; + } + + winX = 1; + winY = 1; + width = (unsigned) (TEKDEFWIDTH + border); + height = (unsigned) (TEKDEFHEIGHT + border); + min_width = (unsigned) (TEKMINWIDTH + border); + min_height = (unsigned) (TEKMINHEIGHT + border); + + TRACE(("parsing T_geometry %s\n", NonNull(xw->misc.T_geometry))); + pr = XParseGeometry(xw->misc.T_geometry, + &winX, + &winY, + &width, + &height); + + /* window-manager hints will do this anyway... */ + if (height < min_height) { + TRACE(("... override height from %d to %d\n", height, min_height)); + height = min_height; + } + if (width < min_width) { + TRACE(("... override width from %d to %d\n", width, min_width)); + width = min_width; + } + + TRACE(("... position %d,%d size %dx%d\n", winY, winX, height, width)); + if ((pr & XValue) && (pr & XNegative)) { + winX += DisplayWidth(XtDisplay(wnew), DefaultScreen(XtDisplay(wnew))) + - (int) width - (BorderWidth(SHELL_OF(xw)) * 2); + } + if ((pr & YValue) && (pr & YNegative)) { + winY += DisplayHeight(XtDisplay(wnew), DefaultScreen(XtDisplay(wnew))) + - (int) height - (BorderWidth(SHELL_OF(xw)) * 2); + } + + /* set up size hints */ + + /* *INDENT-EQLS* */ + wnew->hints.min_width = (int) min_width; + wnew->hints.min_height = (int) min_height; + wnew->hints.width_inc = 1; + wnew->hints.height_inc = 1; + wnew->hints.flags = PMinSize | PResizeInc; + wnew->hints.x = winX; + wnew->hints.y = winY; + + if ((XValue & pr) || (YValue & pr)) { + wnew->hints.flags |= USSize | USPosition; + wnew->hints.flags |= PWinGravity; + switch (pr & (XNegative | YNegative)) { + case 0: + wnew->hints.win_gravity = NorthWestGravity; + break; + case XNegative: + wnew->hints.win_gravity = NorthEastGravity; + break; + case YNegative: + wnew->hints.win_gravity = SouthWestGravity; + break; + default: + wnew->hints.win_gravity = SouthEastGravity; + break; + } + } else { + /* set a default size, but do *not* set position */ + wnew->hints.flags |= PSize; + } + wnew->hints.width = (int) width; + wnew->hints.height = (int) height; + if ((WidthValue & pr) || (HeightValue & pr)) + wnew->hints.flags |= USSize; + else + wnew->hints.flags |= PSize; + + tekscr->cur.fontsize = TEK_FONT_LARGE; + if (wnew->tek.initial_font) { + int result = TekGetFontSize(wnew->tek.initial_font); + if (result >= 0) + tekscr->cur.fontsize = result; + } + TRACE(("Tek cur.fontsize=%d\n", tekscr->cur.fontsize)); + +#define TestGIN(s) XmuCompareISOLatin1(wnew->tek.gin_terminator_str, s) + + if (TestGIN(GIN_TERM_NONE_STR) == 0) + tekscr->gin_terminator = GIN_TERM_NONE; + else if (TestGIN(GIN_TERM_CR_STR) == 0) + tekscr->gin_terminator = GIN_TERM_CR; + else if (TestGIN(GIN_TERM_EOT_STR) == 0) + tekscr->gin_terminator = GIN_TERM_EOT; + else + xtermWarning("illegal GIN terminator setting \"%s\"\n", + wnew->tek.gin_terminator_str); + TRACE(("Tek gin_terminator=%d\n", tekscr->gin_terminator)); + + TRACE(("}} TekInitialize\n")); +} + +static void +TekRealize(Widget gw, + XtValueMask * valuemaskp, + XSetWindowAttributes * values) +{ + TekWidget tw = (TekWidget) gw; + TekScreen *tekscr = TekScreenOf(tw); + TScreen *vtscr = TScreenOf(tw->vt); + + int i; + TekLink *tek; + XGCValues gcv; + unsigned width, height; + unsigned long TEKgcFontMask; + + TRACE(("TekRealize {{\n")); + + if (!TekPtyData()) + return; + + /* use values from TekInitialize... */ + height = (unsigned) tw->hints.height; + width = (unsigned) tw->hints.width; + + (void) REQ_RESIZE((Widget) tw, + (Dimension) width, (Dimension) height, + &tw->core.width, &tw->core.height); + + /* XXX This is bogus. We are parsing geometries too late. This + * is information that the shell widget ought to have before we get + * realized, so that it can do the right thing. + */ + if (tw->hints.flags & USPosition) + XMoveWindow(XtDisplay(tw), TShellWindow, tw->hints.x, tw->hints.y); + + XSetWMNormalHints(XtDisplay(tw), TShellWindow, &tw->hints); + XFlush(XtDisplay(tw)); /* get it out to window manager */ + + values->win_gravity = NorthWestGravity; + values->background_pixel = T_COLOR(vtscr, TEK_BG); + + XtWindow(tw) = TWindow(tekscr) = + XCreateWindow(XtDisplay(tw), + VShellWindow(tw), + tw->core.x, tw->core.y, + tw->core.width, tw->core.height, + BorderWidth(tw), + (int) tw->core.depth, + InputOutput, CopyFromParent, + ((*valuemaskp) | CWBackPixel | CWWinGravity), + values); + + compute_sizes(tw); + + gcv.graphics_exposures = True; /* default */ + gcv.font = tw->tek.Tfont[tekscr->cur.fontsize]->fid; + gcv.foreground = T_COLOR(vtscr, TEK_FG); + gcv.background = T_COLOR(vtscr, TEK_BG); + + /* if font wasn't successfully opened, then gcv.font will contain + the Default GC's ID, meaning that we must use the server default font. + */ + TEKgcFontMask = (unsigned long) ((gcv.font == DefaultGCID(tw)) + ? 0 + : GCFont); + tekscr->TnormalGC = XCreateGC(XtDisplay(tw), TWindow(tekscr), + (TEKgcFontMask | GCGraphicsExposures | + GCForeground | GCBackground), + &gcv); + + gcv.function = GXinvert; + gcv.plane_mask = (T_COLOR(vtscr, TEK_BG) ^ + T_COLOR(vtscr, TEK_CURSOR)); + gcv.join_style = JoinMiter; /* default */ + gcv.line_width = 1; + tekscr->TcursorGC = XCreateGC(XtDisplay(tw), TWindow(tekscr), + (GCFunction | GCPlaneMask), &gcv); + + gcv.foreground = T_COLOR(vtscr, TEK_FG); + gcv.line_style = LineOnOffDash; + gcv.line_width = 0; + for (i = 0; i < TEKNUMLINES; i++) { + tekscr->linepat[i] = XCreateGC(XtDisplay(tw), TWindow(tekscr), + (GCForeground | GCLineStyle), &gcv); + XSetDashes(XtDisplay(tw), tekscr->linepat[i], 0, + dashes[i], dash_length[i]); + } + + TekBackground(tw, vtscr); + + tekscr->margin = MARGIN1; /* Margin 1 */ + tekscr->TekGIN = False; /* GIN off */ + + XDefineCursor(XtDisplay(tw), TWindow(tekscr), tekscr->arrow); + + { /* there's gotta be a better way... */ + static char empty_string[1]; + static Arg args[] = + { + {XtNtitle, (XtArgVal) NULL}, + {XtNiconName, (XtArgVal) NULL}, + }; + char *icon_name = NULL; + char *title = NULL; + char *tek_icon_name = NULL; + char *tek_title = NULL; + + args[0].value = (XtArgVal) & icon_name; + args[1].value = (XtArgVal) & title; + XtGetValues(SHELL_OF(tw), args, 2); + + if (IsEmpty(title)) { + title = empty_string; + } + + if (IsEmpty(icon_name)) { + icon_name = empty_string; + } + + TRACE(("TekShell title='%s', iconName='%s'\n", title, icon_name)); + tek_icon_name = XtMalloc((Cardinal) strlen(icon_name) + 7); + strcpy(tek_icon_name, icon_name); + strcat(tek_icon_name, "(Tek)"); + tek_title = XtMalloc((Cardinal) strlen(title) + 7); + strcpy(tek_title, title); + strcat(tek_title, "(Tek)"); + args[0].value = (XtArgVal) tek_icon_name; + args[1].value = (XtArgVal) tek_title; + TRACE(("Tek title='%s', iconName='%s'\n", tek_title, tek_icon_name)); + XtSetValues(SHELL_OF(tw), args, 2); + XtFree(tek_icon_name); + XtFree(tek_title); + } + + /* *INDENT-EQLS* */ + tek = TekRecord = &Tek0; + tek->next = (TekLink *) 0; + tek->fontsize = (unsigned short) tekscr->cur.fontsize; + tek->count = 0; + tek->ptr = tek->data; + Tpushback = Tpushb; + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; + line_pt = Tline; + Ttoggled = True; + tekscr->page = tekscr->cur; + + TRACE(("}} TekRealize\n")); +} + +int +TekGetFontSize(const char *param) +{ + int result; + + if (XmuCompareISOLatin1(param, "l") == 0 || + XmuCompareISOLatin1(param, "large") == 0) + result = TEK_FONT_LARGE; + else if (XmuCompareISOLatin1(param, "2") == 0 || + XmuCompareISOLatin1(param, "two") == 0) + result = TEK_FONT_2; + else if (XmuCompareISOLatin1(param, "3") == 0 || + XmuCompareISOLatin1(param, "three") == 0) + result = TEK_FONT_3; + else if (XmuCompareISOLatin1(param, "s") == 0 || + XmuCompareISOLatin1(param, "small") == 0) + result = TEK_FONT_SMALL; + else + result = -1; + + return result; +} + +void +TekSetFontSize(TekWidget tw, Bool fromMenu, int newitem) +{ + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + int oldsize = tekscr->cur.fontsize; + int newsize = MI2FS(newitem); + Font fid; + + TRACE(("TekSetFontSize(%d) size %d ->%d\n", newitem, oldsize, newsize)); + if (newsize < 0 || newsize >= TEKNUMFONTS) { + Bell(tw->vt, XkbBI_MinorError, 0); + } else if (oldsize != newsize) { + if (!Ttoggled) + TCursorToggle(tw, TOGGLE); + set_tekfont_menu_item(oldsize, False); + + tekscr->cur.fontsize = newsize; + TekSetWinSize(tw); + if (fromMenu) + tekscr->page.fontsize = newsize; + + fid = tw->tek.Tfont[newsize]->fid; + if (fid == DefaultGCID(tw)) { + /* we didn't succeed in opening a real font + for this size. Instead, use server default. */ + XCopyGC(XtDisplay(tw), + DefaultGC(XtDisplay(tw), DefaultScreen(XtDisplay(tw))), + GCFont, tekscr->TnormalGC); + } else { + XSetFont(XtDisplay(tw), tekscr->TnormalGC, fid); + } + + set_tekfont_menu_item(newsize, True); + if (!Ttoggled) + TCursorToggle(tw, TOGGLE); + + if (fromMenu) { + /* we'll get an exposure event after changing fontsize, so we + * have to clear the screen to avoid painting over the previous + * text. + */ + TekClear(tw); + } + } + } +} + +void +ChangeTekColors(TekWidget tw, TScreen *screen, ScrnColors * pNew) +{ + if (tw && screen) { + TekScreen *tekscr = TekScreenOf(tw); + XGCValues gcv; + int i; + + if (COLOR_DEFINED(pNew, TEK_FG)) { + T_COLOR(screen, TEK_FG) = COLOR_VALUE(pNew, TEK_FG); + TRACE(("... TEK_FG: %#lx\n", T_COLOR(screen, TEK_FG))); + } + if (COLOR_DEFINED(pNew, TEK_BG)) { + T_COLOR(screen, TEK_BG) = COLOR_VALUE(pNew, TEK_BG); + TRACE(("... TEK_BG: %#lx\n", T_COLOR(screen, TEK_BG))); + } + if (COLOR_DEFINED(pNew, TEK_CURSOR)) { + T_COLOR(screen, TEK_CURSOR) = COLOR_VALUE(pNew, TEK_CURSOR); + TRACE(("... TEK_CURSOR: %#lx\n", T_COLOR(screen, TEK_CURSOR))); + } else { + T_COLOR(screen, TEK_CURSOR) = T_COLOR(screen, TEK_FG); + TRACE(("... TEK_CURSOR: %#lx\n", T_COLOR(screen, TEK_CURSOR))); + } + + XSetForeground(XtDisplay(tw), tekscr->TnormalGC, + T_COLOR(screen, TEK_FG)); + XSetBackground(XtDisplay(tw), tekscr->TnormalGC, + T_COLOR(screen, TEK_BG)); + if (BorderPixel(tw) == T_COLOR(screen, TEK_BG)) { + BorderPixel(tw) = T_COLOR(screen, TEK_FG); + BorderPixel(XtParent(tw)) = T_COLOR(screen, TEK_FG); + if (XtWindow(XtParent(tw))) + XSetWindowBorder(XtDisplay(tw), + XtWindow(XtParent(tw)), + BorderPixel(tw)); + } + + for (i = 0; i < TEKNUMLINES; i++) { + XSetForeground(XtDisplay(tw), tekscr->linepat[i], + T_COLOR(screen, TEK_FG)); + } + + gcv.plane_mask = (T_COLOR(screen, TEK_BG) ^ + T_COLOR(screen, TEK_CURSOR)); + XChangeGC(XtDisplay(tw), tekscr->TcursorGC, GCPlaneMask, &gcv); + TekBackground(tw, screen); + } + return; +} + +void +TekReverseVideo(XtermWidget xw, TekWidget tw) +{ + if (tw) { + TScreen *screen = TScreenOf(xw); + TekScreen *tekscr = TekScreenOf(tw); + Pixel tmp; + XGCValues gcv; + int i; + + EXCHANGE(T_COLOR(screen, TEK_FG), T_COLOR(screen, TEK_BG), tmp); + + T_COLOR(screen, TEK_CURSOR) = T_COLOR(screen, TEK_FG); + + XSetForeground(XtDisplay(tw), tekscr->TnormalGC, T_COLOR(screen, TEK_FG)); + XSetBackground(XtDisplay(tw), tekscr->TnormalGC, T_COLOR(screen, TEK_BG)); + + if (BorderPixel(tw) == T_COLOR(screen, TEK_BG)) { + BorderPixel(tw) = T_COLOR(screen, TEK_FG); + BorderPixel(XtParent(tw)) = T_COLOR(screen, TEK_FG); + if (XtWindow(XtParent(tw))) + XSetWindowBorder(XtDisplay(tw), + XtWindow(XtParent(tw)), + BorderPixel(tw)); + } + + for (i = 0; i < TEKNUMLINES; i++) { + XSetForeground(XtDisplay(tw), tekscr->linepat[i], + T_COLOR(screen, TEK_FG)); + } + + gcv.plane_mask = (T_COLOR(screen, TEK_BG) ^ + T_COLOR(screen, TEK_CURSOR)); + XChangeGC(XtDisplay(tw), tekscr->TcursorGC, GCPlaneMask, &gcv); + TekBackground(tw, screen); + } +} + +static void +TekBackground(TekWidget tw, TScreen *screen) +{ + TekScreen *tekscr = TekScreenOf(tw); + + if (TWindow(tekscr)) + XSetWindowBackground(XtDisplay(tw), TWindow(tekscr), + T_COLOR(screen, TEK_BG)); +} + +/* + * Toggles cursor on or off at cursor position in screen. + */ +void +TCursorToggle(TekWidget tw, int toggle) /* TOGGLE or CLEAR */ +{ + TekScreen *tekscr; + XtermWidget xw; + int c, x, y; + unsigned cellwidth, cellheight; + + if (tw == 0) + return; + if ((tekscr = TekScreenOf(tw)) == 0) + return; + if ((xw = tw->vt) == 0) + return; + if (!TEK4014_SHOWN(xw)) + return; + + TRACE(("TCursorToggle %s\n", (toggle == TOGGLE) ? "toggle" : "clear")); + c = tekscr->cur.fontsize; + cellwidth = (unsigned) tw->tek.Tfont[c]->max_bounds.width; + cellheight = (unsigned) (tw->tek.Tfont[c]->ascent + + tw->tek.Tfont[c]->descent); + + x = (int) ScaledX(tw, tekscr->cur_X); + y = (int) ScaledY(tw, tekscr->cur_Y) - tw->tek.tobaseline[c]; + + if (toggle == TOGGLE) { + TScreen *screen = TScreenOf(xw); + if (screen->select || screen->always_highlight) + XFillRectangle(XtDisplay(tw), TWindow(tekscr), + tekscr->TcursorGC, x, y, + cellwidth, cellheight); + else { /* fix to use different GC! */ + XDrawRectangle(XtDisplay(tw), TWindow(tekscr), + tekscr->TcursorGC, x, y, + cellwidth - 1, cellheight - 1); + } + } else { + /* Clear the entire rectangle, even though we may only + * have drawn an outline. This fits with our refresh + * scheme of redrawing the entire window on any expose + * event and is easier than trying to figure out exactly + * which part of the cursor needs to be erased. + */ + XClearArea(XtDisplay(tw), TWindow(tekscr), x, y, + cellwidth, cellheight, False); + } +} + +/* + * The Tektronix manual describes the PAGE/RESET button. For PAGE: + * Erases the display, resets to Alpha Mode and home position; + * resets to Margin 1 and cancels Bypass condition. + * For the RESET function: + * Entered with SHIFT held down; creates a "home" function, + * resetting the Terminal to initial status; does not erase. + * + * The reset done here is different, changing the modes (which changes + * the line-type and font to default values) as well as erasing the screen + * (like PAGE). + */ +void +TekSimulatePageButton(TekWidget tw, Bool reset) +{ + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + + if (reset) { + memset(&tekscr->cur, 0, sizeof tekscr->cur); + } + tekRefreshList = (TekLink *) 0; + TekPage(tw); + tekscr->cur_X = 0; + tekscr->cur_Y = TEKHOME; + } +} + +/* write copy of screen to a file */ + +void +TekCopy(TekWidget tw) +{ + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(tw->vt); + + TekLink *Tp; + char buf[TIMESTAMP_LEN + 10]; + int tekcopyfd; + + timestamp_filename(buf, "COPY"); + if (access(buf, F_OK) >= 0 + && access(buf, W_OK) < 0) { + Bell(tw->vt, XkbBI_MinorError, 0); + return; + } +#ifndef VMS + if (access(".", W_OK) < 0) { /* can't write in directory */ + Bell(tw->vt, XkbBI_MinorError, 0); + return; + } +#endif + + tekcopyfd = open_userfile(screen->uid, screen->gid, buf, False); + if (tekcopyfd >= 0) { + char initbuf[5]; + + sprintf(initbuf, "%c%c%c%c", + ANSI_ESC, (char) (tekscr->page.fontsize + '8'), + ANSI_ESC, (char) (tekscr->page.linetype + '`')); + IGNORE_RC(write(tekcopyfd, initbuf, (size_t) 4)); + Tp = &Tek0; + do { + IGNORE_RC(write(tekcopyfd, Tp->data, (size_t) Tp->count)); + Tp = Tp->next; + } while (Tp); + close(tekcopyfd); + } + } +} + +/*ARGSUSED*/ +void +HandleGINInput(Widget w, + XEvent *event GCC_UNUSED, + String *param_list, + Cardinal *nparamsp) +{ + TekWidget tw = getTekWidget(w); + + if (tw != 0) { + TekScreen *tekscr = TekScreenOf(tw); + + if (tekscr->TekGIN && *nparamsp == 1) { + int c = param_list[0][0]; + switch (c) { + case 'l': + case 'm': + case 'r': + case 'L': + case 'M': + case 'R': + break; + default: + Bell(tw->vt, XkbBI_MinorError, 0); /* let them know they goofed */ + c = 'l'; /* provide a default */ + } + TekEnqMouse(tw, c | 0x80); + TekGINoff(tw); + } else { + Bell(tw->vt, XkbBI_MinorError, 0); + } + } +} + +/* + * Check if the current widget, or any parent, is the "tek4014" widget. + */ +TekWidget +getTekWidget(Widget w) +{ + TekWidget tw; + + if (w == 0) { + tw = (TekWidget) CURRENT_EMU(); + if (!IsTekWidget(tw)) { + tw = 0; + } + } else if (IsTekWidget(w)) { + tw = (TekWidget) w; + } else { + tw = getTekWidget(XtParent(w)); + } + TRACE2(("getTekWidget %p -> %p\n", w, tw)); + return tw; +} diff --git a/ports/xterm/xterm-359/Tekproc.o b/ports/xterm/xterm-359/Tekproc.o new file mode 100644 index 0000000..495b567 Binary files /dev/null and b/ports/xterm/xterm-359/Tekproc.o differ diff --git a/ports/xterm/xterm-359/Tests b/ports/xterm/xterm-359/Tests new file mode 100644 index 0000000..0c6c889 --- /dev/null +++ b/ports/xterm/xterm-359/Tests @@ -0,0 +1,42 @@ +Tests for xterm: + +If system supports window size (i.e., some combination of SIGWINCH, +TIOCSSIZE, TIOCSWINSZ), start a full-screen program (e.g., Emacs, +Jove, vi) and resize the xterm window. The program must immediately +update its screen image for the new size. + +If compiled with -DUTMP, starting a new xterm should create a new utmp +entry. ("who" will show this info.) Exiting xterm should remove the +entry. Killing the xterm window (or other unnatural exit) should also +remove the entry. When should entries be made in the wtmp file? + +Process group stuff should be correct. + +Should work without access to /dev/tty, say started from an xdm +started from a boot-time script. + +If "xterm -help" offers the -C option, it should work. + +echo "test" > /dev/tty + +vi with lines that wrap. + +Exec'ing things other than shells. + +Another thing that has caused problems in the past is process groups, +especially w.r.t. signal propagation to the child. + +Popup menu signals: running only a shell, click on "Send INT Signal." +Do you get a new prompt from the shell? (Same as typing ^C at it.) + +Should scroll *fast* with jumpScroll enabled. + +While a mouse button is down tracing out a selection, output to the +screen should be suspended. + +Selections more than one screen long. + +start xterm running only Tek widget: "xterm -t" + + +Please add to this list if you find xterm failing in some way. diff --git a/ports/xterm/xterm-359/UXTerm.ad b/ports/xterm/xterm-359/UXTerm.ad new file mode 100644 index 0000000..a2cca85 --- /dev/null +++ b/ports/xterm/xterm-359/UXTerm.ad @@ -0,0 +1,76 @@ +! $XTermId: UXTerm.ad,v 1.13 2010/03/04 01:17:07 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 2000-2006,2010 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- +! Use +! xterm -class UXTerm +! to set resources for UTF-8 mode with corresponding fonts. +! See the uxterm script for an example. + +#include "XTerm" + +*fontMenu.Label: Unicode Fonts +*VT100.utf8: 1 + +! This includes "XTerm-color" which includes "XTerm", which defines fonts. +! Why set them here? +! +! Here is a simple description. A technically precise one would be very long. +! When xterm starts up, it uses the +! +! *VT100.font +! +! resource, and if it is told to switch to wide-character (UTF-8) mode, it +! checks if the given font is "wide", and if not looks for the +! +! *VT100.utf8Fonts.font +! +! to obtain a wide font. A "wide" font has more than 256 glyphs. Typical +! wide fonts have 10,000 glyphs. If the original "*VT100.font" is not wide, +! and xterm can load the *VT100.utf8Fonts.font, it will use that. +! +! Making the wide fonts associated with *VT100.font in this file allows uxterm +! to skip that step. It will use the fonts that the XTerm file gives for the +! *VT100.uft8Fonts.font pattern. +*VT100.font2: -misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1 +*VT100.font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1 +*VT100.font3: -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1 +*VT100.font4: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso10646-1 +*VT100.font5: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 +*VT100.font6: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1 + +! Here is an alternate set of fonts with better support for bold: +!*VT100.font2: -efont-biwidth-medium-r-normal--10-100-75-75-p-50-iso10646-1 +!*VT100.font: -efont-biwidth-medium-r-normal--10-100-75-75-p-50-iso10646-1 +!*VT100.font3: -efont-biwidth-medium-r-normal--12-120-75-75-p-60-iso10646-1 +!*VT100.font4: -efont-biwidth-medium-r-normal--14-140-75-75-p-70-iso10646-1 +!*VT100.font5: -efont-biwidth-medium-r-normal--16-160-75-75-p-80-iso10646-1 +!*VT100.font6: -efont-biwidth-medium-r-normal--24-240-75-75-p-120-iso10646-1 diff --git a/ports/xterm/xterm-359/VTPrsTbl.c b/ports/xterm/xterm-359/VTPrsTbl.c new file mode 100644 index 0000000..f78b26f --- /dev/null +++ b/ports/xterm/xterm-359/VTPrsTbl.c @@ -0,0 +1,9507 @@ +/* $XTermId: VTPrsTbl.c,v 1.101 2020/06/28 23:48:39 tom Exp $ */ + +/* + * Copyright 1999-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include +/* *INDENT-OFF* */ + +#if !OPT_BLINK_CURS +#undef CASE_CSI_SPACE_STATE +#define CASE_CSI_SPACE_STATE CASE_CSI_IGNORE +#endif + +#if !OPT_DEC_LOCATOR +#undef CASE_DECEFR +#define CASE_DECEFR CASE_CSI_IGNORE +#undef CASE_DECELR +#define CASE_DECELR CASE_CSI_IGNORE +#undef CASE_DECSLE +#define CASE_DECSLE CASE_CSI_IGNORE +#undef CASE_DECRQLP +#define CASE_DECRQLP CASE_CSI_IGNORE +#endif + +#if !OPT_WIDE_CHARS +#undef CASE_ESC_PERCENT +#define CASE_ESC_PERCENT CASE_ESC_IGNORE +#endif + +#if !OPT_MOD_FKEYS +#undef CASE_SET_MOD_FKEYS +#define CASE_SET_MOD_FKEYS CASE_GROUND_STATE +#undef CASE_SET_MOD_FKEYS0 +#define CASE_SET_MOD_FKEYS0 CASE_GROUND_STATE +#endif + +#if !OPT_XTERM_SGR +#undef CASE_CSI_HASH_STATE +#define CASE_CSI_HASH_STATE CASE_CSI_IGNORE +#endif + +/* + * Stupid Apollo C preprocessor can't handle long lines. So... To keep + * it happy, we put each onto a separate line.... Sigh... + */ + +Const PARSE_T ansi_table[] = +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* $ % & ' */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ( ) * + */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* , - . / */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 0 1 2 3 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 4 5 6 7 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 8 9 : ; */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* < = > ? */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* @ A B C */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* D E F G */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* H I J K */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* L M N O */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* P Q R S */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* T U V W */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* X Y Z [ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* \ ] ^ _ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ` a b c */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* d e f g */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* h i j k */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* l m n o */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* p q r s */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* t u v w */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* x y z { */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* | } ~ DEL */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* currency yen brokenbar section */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* notsign hyphen registered macron */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* degree plusminus twosuperior threesuperior */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* acute mu paragraph periodcentered */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* cedilla onesuperior masculine guillemotright */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* onequarter onehalf threequarters questiondown */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Agrave Aacute Acircumflex Atilde */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Adiaeresis Aring AE Ccedilla */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Eth Ntilde Ograve Oacute */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* agrave aacute acircumflex atilde */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* adiaeresis aring ae ccedilla */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* egrave eacute ecircumflex ediaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* igrave iacute icircumflex idiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* eth ntilde ograve oacute */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ocircumflex otilde odiaeresis division */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* oslash ugrave uacute ucircumflex */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +}; + +Const PARSE_T csi_table[] = /* CSI */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_SPACE_STATE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_HASH_STATE, +/* $ % & ' */ +CASE_CSI_DOLLAR_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_DEC3_STATE, +CASE_DEC2_STATE, +CASE_DEC_STATE, +/* @ A B C */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* D E F G */ +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, +/* H I J K */ +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, +/* L M N O */ +CASE_IL, +CASE_DL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_DCH, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SU, +/* T U V W */ +CASE_TRACK_MOUSE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_ECH, +CASE_GROUND_STATE, +CASE_CBT, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SD, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_HPA, +CASE_HPR, +CASE_REP, +CASE_DA1, +/* d e f g */ +CASE_VPA, +CASE_VPR, +CASE_CUP, +CASE_TBC, +/* h i j k */ +CASE_SET, +CASE_MC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_RST, +CASE_SGR, +CASE_CPR, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_DECLL, +CASE_DECSTBM, +CASE_ANSI_SC, +/* t u v w */ +CASE_XTERM_WINOPS, +CASE_ANSI_RC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_DECREQTPARM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_SPACE_STATE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_HASH_STATE, +/* currency yen brokenbar section */ +CASE_CSI_DOLLAR_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_DEC3_STATE, +CASE_DEC2_STATE, +CASE_DEC_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* Adiaeresis Aring AE Ccedilla */ +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IL, +CASE_DL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_DCH, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SU, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_TRACK_MOUSE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_ECH, +CASE_GROUND_STATE, +CASE_CBT, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SD, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_HPA, +CASE_HPR, +CASE_REP, +CASE_DA1, +/* adiaeresis aring ae ccedilla */ +CASE_VPA, +CASE_VPR, +CASE_CUP, +CASE_TBC, +/* egrave eacute ecircumflex ediaeresis */ +CASE_SET, +CASE_MC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_RST, +CASE_SGR, +CASE_CPR, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_DECLL, +CASE_DECSTBM, +CASE_ANSI_SC, +/* ocircumflex otilde odiaeresis division */ +CASE_XTERM_WINOPS, +CASE_ANSI_RC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_DECREQTPARM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T csi2_table[] = /* CSI */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_SPACE_STATE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_HASH_STATE, +/* $ % & ' */ +CASE_CSI_DOLLAR_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_STAR_STATE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* D E F G */ +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, +/* H I J K */ +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, +/* L M N O */ +CASE_IL, +CASE_DL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_DCH, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SU, +/* T U V W */ +CASE_TRACK_MOUSE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_ECH, +CASE_GROUND_STATE, +CASE_CBT, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SD, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_HPA, +CASE_HPR, +CASE_REP, +CASE_DA1, +/* d e f g */ +CASE_VPA, +CASE_VPR, +CASE_CUP, +CASE_TBC, +/* h i j k */ +CASE_SET, +CASE_MC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_RST, +CASE_SGR, +CASE_CPR, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_DECLL, +CASE_DECSTBM, +CASE_ANSI_SC, +/* t u v w */ +CASE_XTERM_WINOPS, +CASE_ANSI_RC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_DECREQTPARM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_SPACE_STATE, +CASE_CSI_EX_STATE, +CASE_CSI_QUOTE_STATE, +CASE_CSI_HASH_STATE, +/* currency yen brokenbar section */ +CASE_CSI_DOLLAR_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_TICK_STATE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_STAR_STATE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_ICH, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* Adiaeresis Aring AE Ccedilla */ +CASE_CUB, +CASE_CNL, +CASE_CPL, +CASE_HPA, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_CUP, +CASE_CHT, +CASE_ED, +CASE_EL, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IL, +CASE_DL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_DCH, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SU, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_TRACK_MOUSE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_ECH, +CASE_GROUND_STATE, +CASE_CBT, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SD, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_HPA, +CASE_HPR, +CASE_REP, +CASE_DA1, +/* adiaeresis aring ae ccedilla */ +CASE_VPA, +CASE_VPR, +CASE_CUP, +CASE_TBC, +/* egrave eacute ecircumflex ediaeresis */ +CASE_SET, +CASE_MC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_RST, +CASE_SGR, +CASE_CPR, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_DECLL, +CASE_DECSTBM, +CASE_ANSI_SC, +/* ocircumflex otilde odiaeresis division */ +CASE_XTERM_WINOPS, +CASE_ANSI_RC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_DECREQTPARM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T csi_ex_table[] = /* CSI ! */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_DECSTR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_DECSTR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T csi_quo_table[] = /* CSI ... " */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_DECSCL, +CASE_DECSCA, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_DECSCL, +CASE_DECSCA, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +#if OPT_BLINK_CURS +Const PARSE_T csi_sp_table[] = /* CSI ... SP */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_SL, +CASE_SR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_DECSCUSR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_DECSWBV, +CASE_DECSMBV, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_SL, +CASE_SR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_DECSCUSR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_DECSWBV, +CASE_DECSMBV, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; +#endif + +Const PARSE_T csi_tick_table[] = /* CSI ... ' */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECEFR, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECELR, +CASE_DECSLE, +/* | } ~ DEL */ +CASE_DECRQLP, +CASE_DECIC, +CASE_DECDC, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECEFR, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECELR, +CASE_DECSLE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_DECRQLP, +CASE_DECIC, +CASE_DECDC, +CASE_IGNORE, +}; + +#if OPT_XTERM_SGR +Const PARSE_T csi_hash_table[] = /* CSI ... # */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_XTERM_PUSH_COLORS, +CASE_XTERM_POP_COLORS, +CASE_XTERM_REPORT_COLORS, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_XTERM_PUSH_SGR, +CASE_XTERM_POP_SGR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_XTERM_CHECKSUM, +CASE_GROUND_STATE, +CASE_XTERM_PUSH_SGR, +/* | } ~ DEL */ +CASE_XTERM_REPORT_SGR, +CASE_XTERM_POP_SGR, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_XTERM_PUSH_COLORS, +CASE_XTERM_POP_COLORS, +CASE_XTERM_REPORT_COLORS, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_XTERM_PUSH_SGR, +CASE_XTERM_POP_SGR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_XTERM_CHECKSUM, +CASE_GROUND_STATE, +CASE_XTERM_PUSH_SGR, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_XTERM_REPORT_SGR, +CASE_XTERM_POP_SGR, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; +#endif + +#if OPT_DEC_RECTOPS +Const PARSE_T csi_dollar_table[] = /* CSI ... $ */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_RQM, +CASE_GROUND_STATE, +CASE_DECCARA, +CASE_GROUND_STATE, +/* t u v w */ +CASE_DECRARA, +CASE_GROUND_STATE, +CASE_DECCRA, +CASE_DECRQPSR, +/* x y z { */ +CASE_DECFRA, +CASE_GROUND_STATE, +CASE_DECERA, +CASE_DECSERA, +/* | } ~ DEL */ +CASE_DECSCPP, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_RQM, +CASE_GROUND_STATE, +CASE_DECCARA, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_DECRARA, +CASE_GROUND_STATE, +CASE_DECCRA, +CASE_DECRQPSR, +/* oslash ugrave uacute ucircumflex */ +CASE_DECFRA, +CASE_GROUND_STATE, +CASE_DECERA, +CASE_DECSERA, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_DECSCPP, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; + +Const PARSE_T csi_star_table[] = /* CSI ... * */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_DECSACE, +CASE_DECRQCRA, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_DECSNLS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_DECSACE, +CASE_DECRQCRA, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_DECSNLS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; +#endif /* OPT_DEC_RECTOPS */ + +Const PARSE_T dec_table[] = /* CSI ? */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_DEC_DOLLAR_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECSED, +CASE_DECSEL, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GRAPHICS_ATTRIBUTES, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_DECSET, +CASE_DEC_MC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_DECRST, +CASE_GROUND_STATE, +CASE_DSR, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_XTERM_RESTORE, +CASE_XTERM_SAVE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_DEC_DOLLAR_STATE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECSED, +CASE_DECSEL, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GRAPHICS_ATTRIBUTES, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_DECSET, +CASE_DEC_MC, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_DECRST, +CASE_GROUND_STATE, +CASE_DSR, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_XTERM_RESTORE, +CASE_XTERM_SAVE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +#if OPT_DEC_RECTOPS +Const PARSE_T csi_dec_dollar_table[] = /* CSI ?... $ */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 4 5 6 7 */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 8 9 : ; */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_DECRQM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_DECRQM, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +}; +#endif /* OPT_DEC_RECTOPS */ + +Const PARSE_T dec2_table[] = /* CSI > */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_XTERM_RM_TITLE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DA2, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_SET_MOD_FKEYS, +CASE_SET_MOD_FKEYS0, +CASE_GROUND_STATE, +/* p q r s */ +CASE_HIDE_POINTER, +CASE_REPORT_VERSION, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_XTERM_SM_TITLE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_XTERM_RM_TITLE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DA2, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_SET_MOD_FKEYS, +CASE_SET_MOD_FKEYS0, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_HIDE_POINTER, +CASE_REPORT_VERSION, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_XTERM_SM_TITLE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T dec3_table[] = /* CSI = */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* $ % & ' */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* ( ) * + */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* , - . / */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* 0 1 2 3 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 4 5 6 7 */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* 8 9 : ; */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* < = > ? */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECRPTUI, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* currency yen brokenbar section */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* notsign hyphen registered macron */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* acute mu paragraph periodcentered */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +/* cedilla onesuperior masculine guillemotright */ +CASE_ESC_DIGIT, +CASE_ESC_DIGIT, +CASE_ESC_COLON, +CASE_ESC_SEMI, +/* onequarter onehalf threequarters questiondown */ +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +CASE_CSI_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECRPTUI, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T cigtable[] = /* CASE_CSI_IGNORE */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 4 5 6 7 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 8 9 : ; */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* < = > ? */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T eigtable[] = /* CASE_ESC_IGNORE */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T esc_table[] = /* ESC */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_SP_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_SCR_STATE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_PERCENT, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_SCS0_STATE, +CASE_SCS1_STATE, +CASE_SCS2_STATE, +CASE_SCS3_STATE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_SCS1A_STATE, +CASE_SCS2A_STATE, +CASE_SCS3A_STATE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECBI, +CASE_DECSC, +/* 8 9 : ; */ +CASE_DECRC, +CASE_DECFI, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_DECKPAM, +CASE_DECKPNM, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_IND, +CASE_NEL, +CASE_HP_BUGGY_LL, +CASE_GROUND_STATE, +/* H I J K */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* P Q R S */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* X Y Z [ */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* \ ] ^ _ */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_RIS, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_HP_MEM_LOCK, +CASE_HP_MEM_UNLOCK, +CASE_LS2, +CASE_LS3, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_LS3R, +CASE_LS2R, +CASE_LS1R, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_SP_STATE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_SCR_STATE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_PERCENT, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_SCS0_STATE, +CASE_SCS1_STATE, +CASE_SCS2_STATE, +CASE_SCS3_STATE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_SCS1A_STATE, +CASE_SCS2A_STATE, +CASE_SCS3A_STATE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECBI, +CASE_DECSC, +/* cedilla onesuperior masculine guillemotright */ +CASE_DECRC, +CASE_DECFI, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_DECKPAM, +CASE_DECKPNM, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IND, +CASE_NEL, +CASE_HP_BUGGY_LL, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* Eth Ntilde Ograve Oacute */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_RIS, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_HP_MEM_LOCK, +CASE_HP_MEM_UNLOCK, +CASE_LS2, +CASE_LS3, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_LS3R, +CASE_LS2R, +CASE_LS1R, +CASE_IGNORE, +}; + +Const PARSE_T esc_sp_table[] = /* ESC SP */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_S7C1T, +CASE_S8C1T, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_ANSI_LEVEL_1, +CASE_ANSI_LEVEL_2, +CASE_ANSI_LEVEL_3, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_S7C1T, +CASE_S8C1T, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_ANSI_LEVEL_1, +CASE_ANSI_LEVEL_2, +CASE_ANSI_LEVEL_3, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T scrtable[] = /* ESC # */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECDHL, +/* 4 5 6 7 */ +CASE_DECDHL, +CASE_DECSWL, +CASE_DECDWL, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_DECALN, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_DECDHL, +/* acute mu paragraph periodcentered */ +CASE_DECDHL, +CASE_DECSWL, +CASE_DECDWL, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_DECALN, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T scstable[] = /* ESC ( etc. */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_SCS_DQUOTE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_SCS_PERCENT, +CASE_SCS_AMPRSND, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GSETS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS3, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GSETS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GSETS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_SCS_DQUOTE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_SCS_PERCENT, +CASE_SCS_AMPRSND, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GSETS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GSETS, +CASE_GSETS, +CASE_GSETS3, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GSETS, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GSETS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GSETS, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GSETS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T scs96table[] = /* ESC - etc. */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GSETS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS5, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GSETS5, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GSETS5, +CASE_GSETS5, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GSETS3, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS5, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GSETS5, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GSETS5, +CASE_GSETS5, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +/* + * This table is treated specially. The CASE_IGNORE entries correspond to the + * characters that can be accumulated for the string function (e.g., OSC). + */ +Const PARSE_T sos_table[] = /* OSC, DCS, etc. */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* FF CR SO SI */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 4 5 6 7 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 8 9 : ; */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* < = > ? */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* @ A B C */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* D E F G */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* H I J K */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* L M N O */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* P Q R S */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* T U V W */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* X Y Z [ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* \ ] ^ _ */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ` a b c */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* d e f g */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* h i j k */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* l m n o */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* p q r s */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* t u v w */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* x y z { */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* | } ~ DEL */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +#if OPT_WIDE_CHARS +Const PARSE_T esc_pct_table[] = /* ESC % */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GSETS5, +CASE_GROUND_STATE, +CASE_GSETS5, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_UTF8, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_UTF8, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GSETS5, +CASE_GROUND_STATE, +CASE_GSETS5, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_UTF8, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_UTF8, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T scs_2qt_table[] = /* SCS " */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GSETS_DQUOTE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS_DQUOTE, +CASE_GSETS_DQUOTE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GSETS_DQUOTE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GSETS_DQUOTE, +CASE_GSETS_DQUOTE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T scs_amp_table[] = /* SCS & */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GSETS_AMPRSND, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* acute mu paragraph periodcentered */ +CASE_GSETS_AMPRSND, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; + +Const PARSE_T scs_pct_table[] = /* SCS % */ +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_SO, +CASE_SI, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* $ % & ' */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* ( ) * + */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* , - . / */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* 0 1 2 3 */ +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IND, +CASE_NEL, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_HTS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_GROUND_STATE, +CASE_RI, +CASE_SS2, +CASE_SS3, +/* 0x90 0x91 0x92 0x93 */ +CASE_DCS, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 0x94 0x95 0x96 0x97 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_SPA, +CASE_EPA, +/* 0x98 0x99 0x9a 0x9b */ +CASE_SOS, +CASE_GROUND_STATE, +CASE_DECID, +CASE_CSI_STATE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_ST, +CASE_OSC, +CASE_PM, +CASE_APC, +/* nobreakspace exclamdown cent sterling */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* currency yen brokenbar section */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* notsign hyphen registered macron */ +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +CASE_ESC_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +/* acute mu paragraph periodcentered */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +/* cedilla onesuperior masculine guillemotright */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* onequarter onehalf threequarters questiondown */ +CASE_GROUND_STATE, +CASE_GSETS_PERCENT, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Eth Ntilde Ograve Oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* agrave aacute acircumflex atilde */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* adiaeresis aring ae ccedilla */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* igrave iacute icircumflex idiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* eth ntilde ograve oacute */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ocircumflex otilde odiaeresis division */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* oslash ugrave uacute ucircumflex */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +}; +#endif /* OPT_WIDE_CHARS */ + +#if OPT_VT52_MODE +Const PARSE_T vt52_table[] = +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* $ % & ' */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ( ) * + */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* , - . / */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 0 1 2 3 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 4 5 6 7 */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* 8 9 : ; */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* < = > ? */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* @ A B C */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* D E F G */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* H I J K */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* L M N O */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* P Q R S */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* T U V W */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* X Y Z [ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* \ ] ^ _ */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* ` a b c */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* d e f g */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* h i j k */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* l m n o */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* p q r s */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* t u v w */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* x y z { */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +/* | } ~ DEL */ +CASE_PRINT, +CASE_PRINT, +CASE_PRINT, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x98 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const PARSE_T vt52_esc_table[] = +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +/* $ % & ' */ +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +/* ( ) * + */ +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +/* , - . / */ +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +CASE_VT52_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_VT52_FINISH, +CASE_DECKPAM, +CASE_DECKPNM, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_CUU, +CASE_CUD, +CASE_CUF, +/* D E F G */ +CASE_CUB, +CASE_GROUND_STATE, +CASE_SO, +CASE_SI, +/* H I J K */ +CASE_CUP, +CASE_RI, +CASE_ED, +CASE_EL, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_VT52_CUP, +CASE_DECID, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x98 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; + +Const PARSE_T vt52_ignore_table[] = +{ +/* NUL SOH STX ETX */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* EOT ENQ ACK BEL */ +CASE_IGNORE, +CASE_ENQ, +CASE_IGNORE, +CASE_BELL, +/* BS HT NL VT */ +CASE_BS, +CASE_TAB, +CASE_VMOT, +CASE_VMOT, +/* FF CR SO SI */ +CASE_VMOT, +CASE_CR, +CASE_IGNORE, +CASE_IGNORE, +/* DLE DC1 DC2 DC3 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* DC4 NAK SYN ETB */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* CAN EM SUB ESC */ +CASE_GROUND_STATE, +CASE_IGNORE, +CASE_GROUND_STATE, +CASE_ESC, +/* FS GS RS US */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* SP ! " # */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* $ % & ' */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ( ) * + */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* , - . / */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0 1 2 3 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 4 5 6 7 */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* 8 9 : ; */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* < = > ? */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* @ A B C */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* D E F G */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* H I J K */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* L M N O */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* P Q R S */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* T U V W */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* X Y Z [ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* \ ] ^ _ */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* ` a b c */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* d e f g */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* h i j k */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* l m n o */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* p q r s */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* t u v w */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* x y z { */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +/* | } ~ DEL */ +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_GROUND_STATE, +CASE_IGNORE, +/* 0x80 0x81 0x82 0x83 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x84 0x85 0x86 0x87 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x88 0x89 0x8a 0x8b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x8c 0x8d 0x8e 0x8f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x90 0x91 0x92 0x93 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x94 0x95 0x96 0x97 */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x98 0x99 0x9a 0x9b */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* 0x9c 0x9d 0x9e 0x9f */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* nobreakspace exclamdown cent sterling */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* currency yen brokenbar section */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* diaeresis copyright ordfeminine guillemotleft */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* notsign hyphen registered macron */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* degree plusminus twosuperior threesuperior */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* acute mu paragraph periodcentered */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* cedilla onesuperior masculine guillemotright */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* onequarter onehalf threequarters questiondown */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Agrave Aacute Acircumflex Atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Adiaeresis Aring AE Ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Egrave Eacute Ecircumflex Ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Igrave Iacute Icircumflex Idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Eth Ntilde Ograve Oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ocircumflex Otilde Odiaeresis multiply */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Ooblique Ugrave Uacute Ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* Udiaeresis Yacute Thorn ssharp */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* agrave aacute acircumflex atilde */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* adiaeresis aring ae ccedilla */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* egrave eacute ecircumflex ediaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* igrave iacute icircumflex idiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* eth ntilde ograve oacute */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* ocircumflex otilde odiaeresis division */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* oslash ugrave uacute ucircumflex */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +/* udiaeresis yacute thorn ydiaeresis */ +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +CASE_IGNORE, +}; +#endif /* OPT_VT52_MODE */ +/* *INDENT-ON* */ diff --git a/ports/xterm/xterm-359/VTPrsTbl.o b/ports/xterm/xterm-359/VTPrsTbl.o new file mode 100644 index 0000000..4e28ead Binary files /dev/null and b/ports/xterm/xterm-359/VTPrsTbl.o differ diff --git a/ports/xterm/xterm-359/VTparse.def b/ports/xterm/xterm-359/VTparse.def new file mode 100644 index 0000000..16cca82 --- /dev/null +++ b/ports/xterm/xterm-359/VTparse.def @@ -0,0 +1,219 @@ +# $XTermId: VTparse.def,v 1.63 2020/06/23 20:17:35 tom Exp $ +# +# vile:confmode rs=lf +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 1996-2019,2020 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# List of symbols that need to be defined for VTparse.h. If you need to +# change any of the CASE_ macros, make the change here and rerun the command +# shown in VTparse.h. +# + +CASE_GROUND_STATE +CASE_IGNORE +CASE_BELL +CASE_BS +CASE_CR +CASE_ESC +CASE_VMOT +CASE_TAB +CASE_SI +CASE_SO +CASE_SCR_STATE +CASE_SCS0_STATE +CASE_SCS1_STATE +CASE_SCS2_STATE +CASE_SCS3_STATE +CASE_ESC_IGNORE +CASE_ESC_DIGIT +CASE_ESC_SEMI +CASE_DEC_STATE +CASE_ICH +CASE_CUU +CASE_CUD +CASE_CUF +CASE_CUB +CASE_CUP +CASE_ED +CASE_EL +CASE_IL +CASE_DL +CASE_DCH +CASE_DA1 +CASE_TRACK_MOUSE # XTHIMOUSE +CASE_TBC +CASE_SET +CASE_RST +CASE_SGR +CASE_CPR +CASE_DECSTBM +CASE_DECREQTPARM +CASE_DECSET +CASE_DECRST +CASE_DECALN +CASE_GSETS +CASE_DECSC +CASE_DECRC +CASE_DECKPAM +CASE_DECKPNM +CASE_IND +CASE_NEL +CASE_HTS +CASE_RI +CASE_SS2 +CASE_SS3 +CASE_CSI_STATE +CASE_OSC +CASE_RIS +CASE_LS2 +CASE_LS3 +CASE_LS3R +CASE_LS2R +CASE_LS1R +CASE_PRINT +CASE_XTERM_SAVE # XTSAVE +CASE_XTERM_RESTORE # XTRESTORE +CASE_DECID +CASE_HP_MEM_LOCK # HPMEMLOCK +CASE_HP_MEM_UNLOCK # HPMEMUNLOCK +CASE_HP_BUGGY_LL # HPBUGGYLL +CASE_HPA +CASE_VPA +CASE_XTERM_WINOPS # XTWINOPS +CASE_ECH +CASE_CHT +CASE_CPL +CASE_CNL +CASE_CBT +CASE_SU +CASE_SD +CASE_S7C1T +CASE_S8C1T +CASE_ESC_SP_STATE +CASE_ENQ +CASE_DECSCL +CASE_DECSCA +CASE_DECSED +CASE_DECSEL +CASE_DCS +CASE_PM +CASE_SOS +CASE_ST +CASE_APC +CASE_EPA +CASE_SPA +CASE_CSI_QUOTE_STATE +CASE_DSR +CASE_ANSI_LEVEL_1 +CASE_ANSI_LEVEL_2 +CASE_ANSI_LEVEL_3 +CASE_MC +CASE_DEC2_STATE +CASE_DA2 +CASE_DEC3_STATE +CASE_DECRPTUI +CASE_VT52_CUP +CASE_REP +CASE_CSI_EX_STATE +CASE_DECSTR +CASE_DECDHL +CASE_DECSWL +CASE_DECDWL +CASE_DEC_MC +CASE_ESC_PERCENT +CASE_UTF8 +CASE_CSI_TICK_STATE +CASE_DECELR +CASE_DECRQLP +CASE_DECEFR +CASE_DECSLE +CASE_CSI_IGNORE +CASE_VT52_IGNORE +CASE_VT52_FINISH +CASE_CSI_DOLLAR_STATE +CASE_DECCRA +CASE_DECERA +CASE_DECFRA +CASE_DECSERA +CASE_DECSACE +CASE_DECCARA +CASE_DECRARA +CASE_CSI_STAR_STATE +CASE_SET_MOD_FKEYS # XTMODKEYS +CASE_SET_MOD_FKEYS0 +CASE_HIDE_POINTER # XTSMPOINTER +CASE_SCS1A_STATE +CASE_SCS2A_STATE +CASE_SCS3A_STATE +CASE_CSI_SPACE_STATE +CASE_DECSCUSR +CASE_XTERM_SM_TITLE # XTSMTITLE +CASE_XTERM_RM_TITLE # XTRMTITLE +CASE_DECSMBV +CASE_DECSWBV +CASE_DECLL +CASE_DECRQM +CASE_RQM +CASE_CSI_DEC_DOLLAR_STATE +CASE_SL +CASE_SR +CASE_DECDC +CASE_DECIC +CASE_DECBI +CASE_DECFI +CASE_DECRQCRA +CASE_HPR +CASE_VPR +CASE_ANSI_SC +CASE_ANSI_RC +CASE_ESC_COLON +CASE_SCS_PERCENT +CASE_GSETS_PERCENT +CASE_GRAPHICS_ATTRIBUTES # XTSMGRAPHICS +CASE_DECRQPSR +CASE_DECSCPP +CASE_DECSNLS +CASE_CSI_HASH_STATE +CASE_XTERM_PUSH_SGR # XTPUSHSGR +CASE_XTERM_REPORT_SGR # XTREPORTSGR +CASE_XTERM_POP_SGR # XTPOPSGR +CASE_XTERM_CHECKSUM # XTCHECKSUM +CASE_GSETS3 +CASE_GSETS5 +CASE_SCS_DQUOTE +CASE_GSETS_DQUOTE +CASE_SCS_AMPRSND +CASE_GSETS_AMPRSND +CASE_REPORT_VERSION # XTVERSION +CASE_XTERM_PUSH_COLORS # XTPUSHCOLORS +CASE_XTERM_REPORT_COLORS # XTREPORTCOLORS +CASE_XTERM_POP_COLORS # XTPOPCOLORS diff --git a/ports/xterm/xterm-359/VTparse.h b/ports/xterm/xterm-359/VTparse.h new file mode 100644 index 0000000..4670bfd --- /dev/null +++ b/ports/xterm/xterm-359/VTparse.h @@ -0,0 +1,95 @@ +/* $XTermId: VTparse.h,v 1.69 2019/02/10 23:34:21 tom Exp $ */ + +/* + * Copyright 1996-2018,2019 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#ifndef included_VTparse_h +#define included_VTparse_h 1 + +#include + +#ifndef Const +# if defined(__STDC__) && !defined(__cplusplus) +# define Const const +# else +# define Const /**/ +# endif +#endif + +/* + * PARSE_T has to be large enough to handle the number of cases enumerated here. + */ +typedef unsigned char PARSE_T; + +extern Const PARSE_T ansi_table[]; +extern Const PARSE_T cigtable[]; +extern Const PARSE_T csi2_table[]; +extern Const PARSE_T csi_ex_table[]; +extern Const PARSE_T csi_quo_table[]; +extern Const PARSE_T csi_sp_table[]; +extern Const PARSE_T csi_table[]; +extern Const PARSE_T dec2_table[]; +extern Const PARSE_T dec3_table[]; +extern Const PARSE_T dec_table[]; +extern Const PARSE_T eigtable[]; +extern Const PARSE_T esc_sp_table[]; +extern Const PARSE_T esc_table[]; +extern Const PARSE_T scrtable[]; +extern Const PARSE_T scs96table[]; +extern Const PARSE_T scstable[]; +extern Const PARSE_T sos_table[]; +extern Const PARSE_T csi_dec_dollar_table[]; +extern Const PARSE_T csi_tick_table[]; + +#if OPT_DEC_RECTOPS +extern Const PARSE_T csi_dollar_table[]; +extern Const PARSE_T csi_star_table[]; +#endif /* OPT_DEC_LOCATOR */ + +#if OPT_VT52_MODE +extern Const PARSE_T vt52_table[]; +extern Const PARSE_T vt52_esc_table[]; +extern Const PARSE_T vt52_ignore_table[]; +#endif + +#if OPT_WIDE_CHARS +extern Const PARSE_T esc_pct_table[]; +extern Const PARSE_T scs_amp_table[]; +extern Const PARSE_T scs_pct_table[]; +extern Const PARSE_T scs_2qt_table[]; +#endif + +#if OPT_XTERM_SGR +extern Const PARSE_T csi_hash_table[]; +#endif + +#include + +#endif /* included_VTparse_h */ diff --git a/ports/xterm/xterm-359/VTparse.hin b/ports/xterm/xterm-359/VTparse.hin new file mode 100644 index 0000000..8b49c0a --- /dev/null +++ b/ports/xterm/xterm-359/VTparse.hin @@ -0,0 +1,180 @@ +/* vile:cmode */ +#define CASE_GROUND_STATE 0 +#define CASE_IGNORE 1 +#define CASE_BELL 2 +#define CASE_BS 3 +#define CASE_CR 4 +#define CASE_ESC 5 +#define CASE_VMOT 6 +#define CASE_TAB 7 +#define CASE_SI 8 +#define CASE_SO 9 +#define CASE_SCR_STATE 10 +#define CASE_SCS0_STATE 11 +#define CASE_SCS1_STATE 12 +#define CASE_SCS2_STATE 13 +#define CASE_SCS3_STATE 14 +#define CASE_ESC_IGNORE 15 +#define CASE_ESC_DIGIT 16 +#define CASE_ESC_SEMI 17 +#define CASE_DEC_STATE 18 +#define CASE_ICH 19 +#define CASE_CUU 20 +#define CASE_CUD 21 +#define CASE_CUF 22 +#define CASE_CUB 23 +#define CASE_CUP 24 +#define CASE_ED 25 +#define CASE_EL 26 +#define CASE_IL 27 +#define CASE_DL 28 +#define CASE_DCH 29 +#define CASE_DA1 30 +#define CASE_TRACK_MOUSE 31 +#define CASE_TBC 32 +#define CASE_SET 33 +#define CASE_RST 34 +#define CASE_SGR 35 +#define CASE_CPR 36 +#define CASE_DECSTBM 37 +#define CASE_DECREQTPARM 38 +#define CASE_DECSET 39 +#define CASE_DECRST 40 +#define CASE_DECALN 41 +#define CASE_GSETS 42 +#define CASE_DECSC 43 +#define CASE_DECRC 44 +#define CASE_DECKPAM 45 +#define CASE_DECKPNM 46 +#define CASE_IND 47 +#define CASE_NEL 48 +#define CASE_HTS 49 +#define CASE_RI 50 +#define CASE_SS2 51 +#define CASE_SS3 52 +#define CASE_CSI_STATE 53 +#define CASE_OSC 54 +#define CASE_RIS 55 +#define CASE_LS2 56 +#define CASE_LS3 57 +#define CASE_LS3R 58 +#define CASE_LS2R 59 +#define CASE_LS1R 60 +#define CASE_PRINT 61 +#define CASE_XTERM_SAVE 62 +#define CASE_XTERM_RESTORE 63 +#define CASE_DECID 64 +#define CASE_HP_MEM_LOCK 65 +#define CASE_HP_MEM_UNLOCK 66 +#define CASE_HP_BUGGY_LL 67 +#define CASE_HPA 68 +#define CASE_VPA 69 +#define CASE_XTERM_WINOPS 70 +#define CASE_ECH 71 +#define CASE_CHT 72 +#define CASE_CPL 73 +#define CASE_CNL 74 +#define CASE_CBT 75 +#define CASE_SU 76 +#define CASE_SD 77 +#define CASE_S7C1T 78 +#define CASE_S8C1T 79 +#define CASE_ESC_SP_STATE 80 +#define CASE_ENQ 81 +#define CASE_DECSCL 82 +#define CASE_DECSCA 83 +#define CASE_DECSED 84 +#define CASE_DECSEL 85 +#define CASE_DCS 86 +#define CASE_PM 87 +#define CASE_SOS 88 +#define CASE_ST 89 +#define CASE_APC 90 +#define CASE_EPA 91 +#define CASE_SPA 92 +#define CASE_CSI_QUOTE_STATE 93 +#define CASE_DSR 94 +#define CASE_ANSI_LEVEL_1 95 +#define CASE_ANSI_LEVEL_2 96 +#define CASE_ANSI_LEVEL_3 97 +#define CASE_MC 98 +#define CASE_DEC2_STATE 99 +#define CASE_DA2 100 +#define CASE_DEC3_STATE 101 +#define CASE_DECRPTUI 102 +#define CASE_VT52_CUP 103 +#define CASE_REP 104 +#define CASE_CSI_EX_STATE 105 +#define CASE_DECSTR 106 +#define CASE_DECDHL 107 +#define CASE_DECSWL 108 +#define CASE_DECDWL 109 +#define CASE_DEC_MC 110 +#define CASE_ESC_PERCENT 111 +#define CASE_UTF8 112 +#define CASE_CSI_TICK_STATE 113 +#define CASE_DECELR 114 +#define CASE_DECRQLP 115 +#define CASE_DECEFR 116 +#define CASE_DECSLE 117 +#define CASE_CSI_IGNORE 118 +#define CASE_VT52_IGNORE 119 +#define CASE_VT52_FINISH 120 +#define CASE_CSI_DOLLAR_STATE 121 +#define CASE_DECCRA 122 +#define CASE_DECERA 123 +#define CASE_DECFRA 124 +#define CASE_DECSERA 125 +#define CASE_DECSACE 126 +#define CASE_DECCARA 127 +#define CASE_DECRARA 128 +#define CASE_CSI_STAR_STATE 129 +#define CASE_SET_MOD_FKEYS 130 +#define CASE_SET_MOD_FKEYS0 131 +#define CASE_HIDE_POINTER 132 +#define CASE_SCS1A_STATE 133 +#define CASE_SCS2A_STATE 134 +#define CASE_SCS3A_STATE 135 +#define CASE_CSI_SPACE_STATE 136 +#define CASE_DECSCUSR 137 +#define CASE_XTERM_SM_TITLE 138 +#define CASE_XTERM_RM_TITLE 139 +#define CASE_DECSMBV 140 +#define CASE_DECSWBV 141 +#define CASE_DECLL 142 +#define CASE_DECRQM 143 +#define CASE_RQM 144 +#define CASE_CSI_DEC_DOLLAR_STATE 145 +#define CASE_SL 146 +#define CASE_SR 147 +#define CASE_DECDC 148 +#define CASE_DECIC 149 +#define CASE_DECBI 150 +#define CASE_DECFI 151 +#define CASE_DECRQCRA 152 +#define CASE_HPR 153 +#define CASE_VPR 154 +#define CASE_ANSI_SC 155 +#define CASE_ANSI_RC 156 +#define CASE_ESC_COLON 157 +#define CASE_SCS_PERCENT 158 +#define CASE_GSETS_PERCENT 159 +#define CASE_GRAPHICS_ATTRIBUTES 160 +#define CASE_DECRQPSR 161 +#define CASE_DECSCPP 162 +#define CASE_DECSNLS 163 +#define CASE_CSI_HASH_STATE 164 +#define CASE_XTERM_PUSH_SGR 165 +#define CASE_XTERM_REPORT_SGR 166 +#define CASE_XTERM_POP_SGR 167 +#define CASE_XTERM_CHECKSUM 168 +#define CASE_GSETS3 169 +#define CASE_GSETS5 170 +#define CASE_SCS_DQUOTE 171 +#define CASE_GSETS_DQUOTE 172 +#define CASE_SCS_AMPRSND 173 +#define CASE_GSETS_AMPRSND 174 +#define CASE_REPORT_VERSION 175 +#define CASE_XTERM_PUSH_COLORS 176 +#define CASE_XTERM_REPORT_COLORS 177 +#define CASE_XTERM_POP_COLORS 178 diff --git a/ports/xterm/xterm-359/XTerm-col.ad b/ports/xterm/xterm-359/XTerm-col.ad new file mode 100644 index 0000000..c157e9f --- /dev/null +++ b/ports/xterm/xterm-359/XTerm-col.ad @@ -0,0 +1,163 @@ +! $XTermId: XTerm-col.ad,v 1.22 2009/08/15 15:56:29 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 2002-2006,2009 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- + +#include "XTerm" + +*VT100*colorMode: on +*VT100*boldColors: on +*VT100*dynamicColors: on + +! Uncomment this for "white" text on a dark background. +!*VT100*foreground: gray90 +!*VT100*background: black + +! - OR - +! Uncomment this for black text on a "white" background. +!*VT100*foreground: black +!*VT100*background: gray90 + +! - OR - +! leave the foreground/background colors alone (at the mercy of your desktop +! designer). + +! Color the popup/pulldown menu border to match the text widget foreground. +!*SimpleMenu*borderColor: gray15 + +! Uncomment this to use color for underline attribute +!*VT100*colorULMode: on +*VT100*colorUL: yellow + +!*VT100*italicULMode: on + +! Uncomment this to disable underlining, e.g., if colorULMode is set. +!*VT100*underLine: off + +! Uncomment this to use color for the bold attribute +!*VT100*colorBDMode: on +*VT100*colorBD: white + +! Uncomment this to use the bold/underline colors in preference to other colors +!*VT100*colorAttrMode: on + +! These are the 8 ANSI colors and their bright equivalents. Depending on +! other resource settings, xterm may use the bright colors when displaying +! bold text (see the boldColors resource). +*VT100*color0: black +*VT100*color1: red3 +*VT100*color2: green3 +*VT100*color3: yellow3 +*VT100*color4: blue2 +*VT100*color5: magenta3 +*VT100*color6: cyan3 +*VT100*color7: gray90 +*VT100*color8: gray50 +*VT100*color9: red +*VT100*color10: green +*VT100*color11: yellow +*VT100*color12: rgb:5c/5c/ff +*VT100*color13: magenta +*VT100*color14: cyan +*VT100*color15: white + +! Disclaimer: there are no standard colors used in terminal emulation. +! +! The choice for color4 and color12 is a tradeoff between contrast, depending +! on whether they are used for text or backgrounds. Note that either color4 or +! color12 would be used for text, while only color4 would be used for a +! background. These are treated specially, since the luminosity of blue is +! only about half that of red/green, and is typically not accounted for in the +! RGB scheme. +! +! Blue text on a black background should be readable. +! Blue backgrounds should not be "too" bright. +! +! Originally color4/color12 were set to the names blue3/blue +!*VT100*color4: blue3 +!*VT100*color12: blue +! +! They are from rgb.txt respectively: +! 0 0 205 blue3 +! 0 0 255 blue +! However, blue3 is not readable on a black background. +! +! Another choice was from the Debian settings: +!*VT100*color4: DodgerBlue1 +!*VT100*color12: SteelBlue1 +! +! From rgb.txt: +! 30 144 255 DodgerBlue1 +! 99 184 255 SteelBlue1 +! +! Some users object to this choice because the background (color4) is brighter +! than they are accustomed. Others point out that the different weights for +! the red/green components make it appear to be not really blue. Finally, it +! provides poor contrast against color13 and color14. +! +! The current choice uses equal weights for red/green (effectively adding a +! gray to the result). It is brighter than the original choice, and provides +! more contrast between color12 and color13, color14 than SteelBlue1 did. +! Contrast of color4 against black is slightly improved over the original. +! +! Some refinement is certainly possible (you are welcome to try) -TD + + +#if PLANES > 8 +! Color the popup menus and the menubar to match: +*SimpleMenu*background: AntiqueWhite +*SimpleMenu*foreground: gray15 + +! Color the menubar to match: +*Form.menubar.background: AntiqueWhite +*Form.menubar*background: AntiqueWhite +*Form.menubar.foreground: gray15 +*Form.menubar*foreground: gray15 +*Form.background: AntiqueWhite +*form.background: AntiqueWhite + +! The following two sections take advantage of new features in version 7 +! of the Athena widget library. Comment them out if you have a shallow +! color depth. +!*SimpleMenu*backgroundPixmap: gradient:vertical?dimension=350&start=gray90&end=gray60 +!*SimpleMenu*foreground: gray15 + +!*VT100.scrollbar.thumb: vlines2 +!*VT100.scrollbar.width: 14 +!*VT100.scrollbar.background: gray60 +!*VT100.scrollbar.foreground: rgb:a/5/5 +!*VT100.scrollbar.borderWidth: 0 +!*VT100.scrollbar.displayList:\ +!foreground gray90;\ +!lines 1,-1,-1,-1,-1,1;\ +!foreground gray60;\ +!lines -1,0,0,0,0,-1 +#endif diff --git a/ports/xterm/xterm-359/XTerm.ad b/ports/xterm/xterm-359/XTerm.ad new file mode 100644 index 0000000..78ee0c1 --- /dev/null +++ b/ports/xterm/xterm-359/XTerm.ad @@ -0,0 +1,261 @@ +! $XTermId: XTerm.ad,v 1.102 2016/12/22 02:07:39 tom Exp $ +! ----------------------------------------------------------------------------- +! this file is part of xterm +! +! Copyright 1996-2011,2016 by Thomas E. Dickey +! +! All Rights Reserved +! +! Permission is hereby granted, free of charge, to any person obtaining a +! copy of this software and associated documentation files (the +! "Software"), to deal in the Software without restriction, including +! without limitation the rights to use, copy, modify, merge, publish, +! distribute, sublicense, and/or sell copies of the Software, and to +! permit persons to whom the Software is furnished to do so, subject to +! the following conditions: +! +! The above copyright notice and this permission notice shall be included +! in all copies or substantial portions of the Software. +! +! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +! MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +! IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +! CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +! TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +! +! Except as contained in this notice, the name(s) of the above copyright +! holders shall not be used in advertising or otherwise to promote the +! sale, use or other dealings in this Software without prior written +! authorization. +! ----------------------------------------------------------------------------- + +*saveLines: 1024 + +*SimpleMenu*BackingStore: NotUseful +*SimpleMenu*menuLabel.font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-* +*SimpleMenu*menuLabel.vertSpace: 100 +*SimpleMenu*HorizontalMargins: 16 +*SimpleMenu*Sme.height: 16 + +*SimpleMenu*Cursor: left_ptr + +*mainMenu.Label: Main Options +*mainMenu*toolbar*Label: Toolbar +*mainMenu*fullscreen*Label: Full Screen +*mainMenu*securekbd*Label: Secure Keyboard +*mainMenu*allowsends*Label: Allow SendEvents +*mainMenu*redraw*Label: Redraw Window +*mainMenu*logging*Label: Log to File +*mainMenu*print-immediate*Label: Print-All Immediately +*mainMenu*print-on-error*Label: Print-All on Error +*mainMenu*print*Label: Print Window +*mainMenu*print-redir*Label: Redirect to Printer +*mainMenu*dump-html*Label: XHTML Screen Dump +*mainMenu*dump-svg*Label: SVG Screen Dump +*mainMenu*8-bit control*Label: 8-Bit Controls +*mainMenu*backarrow key*Label: Backarrow Key (BS/DEL) +*mainMenu*num-lock*Label: Alt/NumLock Modifiers +*mainMenu*alt-esc*Label: Alt Sends Escape +*mainMenu*meta-esc*Label: Meta Sends Escape +*mainMenu*delete-is-del*Label: Delete is DEL +*mainMenu*oldFunctionKeys*Label: Old Function-Keys +*mainMenu*sunFunctionKeys*Label: Sun Function-Keys +*mainMenu*sunKeyboard*Label: VT220 Keyboard +*mainMenu*hpFunctionKeys*Label: HP Function-Keys +*mainMenu*scoFunctionKeys*Label: SCO Function-Keys +*mainMenu*tcapFunctionKeys*Label: Termcap Function-Keys +*mainMenu*suspend*Label: Send STOP Signal +*mainMenu*continue*Label: Send CONT Signal +*mainMenu*interrupt*Label: Send INT Signal +*mainMenu*hangup*Label: Send HUP Signal +*mainMenu*terminate*Label: Send TERM Signal +*mainMenu*kill*Label: Send KILL Signal +*mainMenu*quit*Label: Quit + +*vtMenu.Label: VT Options +*vtMenu*scrollbar*Label: Enable Scrollbar +*vtMenu*jumpscroll*Label: Enable Jump Scroll +*vtMenu*reversevideo*Label: Enable Reverse Video +*vtMenu*autowrap*Label: Enable Auto Wraparound +*vtMenu*reversewrap*Label: Enable Reverse Wraparound +*vtMenu*autolinefeed*Label: Enable Auto Linefeed +*vtMenu*appcursor*Label: Enable Application Cursor Keys +*vtMenu*appkeypad*Label: Enable Application Keypad +*vtMenu*scrollkey*Label: Scroll to Bottom on Key Press +*vtMenu*scrollttyoutput*Label: Scroll to Bottom on Tty Output +*vtMenu*allow132*Label: Allow 80/132 Column Switching +*vtMenu*keepSelection*Label: Keep Selection +*vtMenu*selectToClipboard*Label: Select to Clipboard +*vtMenu*cursesemul*Label: Enable Curses Emulation +*vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*bellIsUrgent*Label: Enable Bell Urgency +*vtMenu*poponbell*Label: Enable Pop on Bell +*vtMenu*cursorblink*Label: Enable Blinking Cursor +*vtMenu*titeInhibit*Label: Enable Alternate Screen Switching +*vtMenu*activeicon*Label: Enable Active Icon +*vtMenu*softreset*Label: Do Soft Reset +*vtMenu*hardreset*Label: Do Full Reset +*vtMenu*clearsavedlines*Label: Reset and Clear Saved Lines +*vtMenu*tekshow*Label: Show Tek Window +*vtMenu*tekmode*Label: Switch to Tek Mode +*vtMenu*vthide*Label: Hide VT Window +*vtMenu*altscreen*Label: Show Alternate Screen +*vtMenu*sixelScrolling*Label: Sixel Scrolling +*vtMenu*privateColorRegisters*Label: Private Color Registers + +*fontMenu.Label: VT Fonts +*fontMenu*fontdefault*Label: Default +*fontMenu*font1*Label: Unreadable +*VT100.font1: nil2 +*IconFont: nil2 +*fontMenu*font2*Label: Tiny +*VT100.font2: 5x7 +*fontMenu*font3*Label: Small +*VT100.font3: 6x10 +*fontMenu*font4*Label: Medium +*VT100.font4: 7x13 +*fontMenu*font5*Label: Large +*VT100.font5: 9x15 +*fontMenu*font6*Label: Huge +*VT100.font6: 10x20 +*fontMenu*fontescape*Label: Escape Sequence +*fontMenu*fontsel*Label: Selection +!fontescape and fontsel overridden by application +*fontMenu*allow-bold-fonts*Label: Bold Fonts +*fontMenu*font-linedrawing*Label: Line-Drawing Characters +*fontMenu*font-doublesize*Label: Doublesized Characters +*fontMenu*font-loadable*Label: VT220 Soft Fonts +*fontMenu*font-packed*Label: Packed Font +*fontMenu*render-font*Label: TrueType Fonts +*fontMenu*utf8-mode*Label: UTF-8 Encoding +*fontMenu*utf8-fonts*Label: UTF-8 Fonts +*fontMenu*utf8-title*Label: UTF-8 Titles + +*fontMenu*allow-color-ops*Label: Allow Color Ops +*fontMenu*allow-font-ops*Label: Allow Font Ops +*fontMenu*allow-mouse-ops*Label: Allow Mouse Ops +*fontMenu*allow-tcap-ops*Label: Allow Termcap Ops +*fontMenu*allow-title-ops*Label: Allow Title Ops +*fontMenu*allow-window-ops*Label: Allow Window Ops + +*VT100.utf8Fonts.font2: -misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1 +*VT100.utf8Fonts.font: -misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1 +*VT100.utf8Fonts.font3: -misc-fixed-medium-r-normal--14-130-75-75-c-70-iso10646-1 +*VT100.utf8Fonts.font4: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso10646-1 +*VT100.utf8Fonts.font5: -misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1 +*VT100.utf8Fonts.font6: -misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1 + +*tekMenu.Label: Tek Options +*tekMenu*tektextlarge*Label: Large Characters +*tekMenu*tektext2*Label: #2 Size Characters +*tekMenu*tektext3*Label: #3 Size Characters +*tekMenu*tektextsmall*Label: Small Characters +*tekMenu*tekpage*Label: PAGE +*tekMenu*tekreset*Label: RESET +*tekMenu*tekcopy*Label: COPY +*tekMenu*vtshow*Label: Show VT Window +*tekMenu*vtmode*Label: Switch to VT Mode +*tekMenu*tekhide*Label: Hide Tek Window + +*tek4014*fontLarge: 9x15 +*tek4014*font2: 8x13 +*tek4014*font3: 6x13 +*tek4014*fontSmall: 6x10 + +! If xterm is built with a toolbar, the widget hierarchy looks like this, +! showing widget name / class names. The complete menu hierarchy is built +! at startup because it is needed to make the layout work for the menubar: +! +! xterm/XTerm +! form/Form +! menubar/Box +! mainMenuButton/MenuButton +! mainMenu/SimpleMenu +! menuLabel/SmeBSB +! toolbar/SmeBSB +! ... +! vtMenu/SimpleMenu +! menuLabel/SmeBSB +! scrollbar/SmeBSB +! ... +! fontMenu/SimpleMenu +! menuLabel/SmeBSB +! fontdefault/SmeBSB +! ... +! tekMenu/SimpleMenu +! menuLabel/SmeBSB +! fontdefault/SmeBSB +! ... +! vt100/VT100 +! tektronix/TopLevelShell +! shellext/VendorShellExt +! tek4014/Tek4014 +! +! If built without a toolbar, the widget hierarchy is simpler, because there +! is no form, and the popup menu widgets are created only when they are first +! used. +! +! xterm/XTerm +! shellext/VendorShellExt +! mainMenu/SimpleMenu +! menuLabel/SmeBSB +! ... +! ... +! vt100/VT100 +! tektronix/TopLevelShell +! shellext/VendorShellExt +! tek4014/Tek4014 +! +! A more complete list of the widget/class names can be obtained using editres +! to dump a file. Some widget names are not available until the corresponding +! menu has been created. + +! These resources reduce space around the menubar, by eliminating padding in +! the enclosing form (Thickness) and the border of the Box which represents +! the menubar widget. +*form.Thickness: 0 +*menubar.borderWidth: 0 + +! If we wanted to eliminate the border of the popup menus, we could do this +! instead, since they are children of the menubar: +!*menubar*borderWidth: 0 + +! Eliminate the border of the buttons in the menubar, so the only line around +! the text is for the highlighted button: +*MenuButton*borderWidth: 0 + +! Set a border for the menus to make them simpler to distinguish against the +! vt100 widget: +*SimpleMenu*borderWidth: 2 + +! xterm can switch at runtime between bitmap (default) and TrueType fonts. +! The "faceSize" resource controls the size of the latter. However, it was +! originally given with a size that makes the two types of fonts different +! sizes. Uncomment this line to use the same size as "fixed". +!*faceSize: 8 + +! Here is a pattern that is useful for double-clicking on a URL: +!*charClass: 33:48,35:48,37-38:48,43-47:48,58:48,61:48,63-64:48,95:48,126:48 +! +! Alternatively, +!*on2Clicks: regex [[:alpha:]]+://([[:alnum:]!#+,./=?@_~-]|(%[[:xdigit:]][[:xdigit:]]))+ + +! VT100s and similar terminals recognize escape sequences and control +! characters to which they reply to the host with other escape sequences, +! to provide information. The "resize" program uses this feature. +! +! In addition, xterm recognizes several escape sequences which can be used to +! set fonts, window properties, return settings via escape sequences. Some +! find these useful; others are concerned with the possibility of unexpected +! inputs. +! +! All of these features can be enabled or disabled via menus. +! +! Depending on your environment, you may wish to disable those by default by +! uncommenting one or more of the resource settings below: +!*allowFontOps: false +!*allowTcapOps: false +!*allowTitleOps: false +!*allowWindowOps: false diff --git a/ports/xterm/xterm-359/aclocal.m4 b/ports/xterm/xterm-359/aclocal.m4 new file mode 100644 index 0000000..cae7a39 --- /dev/null +++ b/ports/xterm/xterm-359/aclocal.m4 @@ -0,0 +1,5159 @@ +dnl $XTermId: aclocal.m4,v 1.461 2020/07/11 23:09:29 tom Exp $ +dnl +dnl --------------------------------------------------------------------------- +dnl +dnl Copyright 1997-2019,2020 by Thomas E. Dickey +dnl +dnl All Rights Reserved +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the +dnl "Software"), to deal in the Software without restriction, including +dnl without limitation the rights to use, copy, modify, merge, publish, +dnl distribute, sublicense, and/or sell copies of the Software, and to +dnl permit persons to whom the Software is furnished to do so, subject to +dnl the following conditions: +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name(s) of the above copyright +dnl holders shall not be used in advertising or otherwise to promote the +dnl sale, use or other dealings in this Software without prior written +dnl authorization. +dnl +dnl --------------------------------------------------------------------------- +dnl See +dnl https://invisible-island.net/autoconf/autoconf.html +dnl https://invisible-island.net/autoconf/my-autoconf.html +dnl --------------------------------------------------------------------------- +dnl --------------------------------------------------------------------------- +dnl AM_LANGINFO_CODESET version: 5 updated: 2020/03/10 18:53:47 +dnl ------------------- +dnl Inserted as requested by gettext 0.10.40 +dnl File from /usr/share/aclocal +dnl codeset.m4 +dnl ==================== +dnl serial AM1 +dnl +dnl From Bruno Haible. +AC_DEFUN([AM_LANGINFO_CODESET], +[ +AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET); (void)cs], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ACVERSION_CHECK version: 5 updated: 2014/06/04 19:11:49 +dnl ------------------ +dnl Conditionally generate script according to whether we're using a given autoconf. +dnl +dnl $1 = version to compare against +dnl $2 = code to use if AC_ACVERSION is at least as high as $1. +dnl $3 = code to use if AC_ACVERSION is older than $1. +define([CF_ACVERSION_CHECK], +[ +ifdef([AC_ACVERSION], ,[ifdef([AC_AUTOCONF_VERSION],[m4_copy([AC_AUTOCONF_VERSION],[AC_ACVERSION])],[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])])dnl +ifdef([m4_version_compare], +[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])], +[CF_ACVERSION_COMPARE( +AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), +AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53 +dnl -------------------- +dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1, +dnl MAJOR2, MINOR2, TERNARY2, +dnl PRINTABLE2, not FOUND, FOUND) +define([CF_ACVERSION_COMPARE], +[ifelse(builtin([eval], [$2 < $5]), 1, +[ifelse([$8], , ,[$8])], +[ifelse([$9], , ,[$9])])])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_CFLAGS version: 14 updated: 2020/04/04 16:16:13 +dnl ------------- +dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS +dnl $1 = flags to add +dnl $2 = if given makes this macro verbose. +dnl +dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, +dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily +dnl confused by the quotes (which require backslashes to keep them usable). +AC_DEFUN([CF_ADD_CFLAGS], +[ +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $1 +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) + ;; + esac + CF_APPEND_TEXT(cf_new_cppflags,$cf_add_cflags) + ;; + esac + ;; + (*) + CF_APPEND_TEXT(cf_new_cflags,$cf_add_cflags) + ;; + esac + ;; +(yes) + CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) + CF_APPEND_TEXT(CFLAGS,$cf_new_cflags) +fi + +if test -n "$cf_new_cppflags" ; then + ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) + CF_APPEND_TEXT(CPPFLAGS,$cf_new_cppflags) +fi + +if test -n "$cf_new_extra_cppflags" ; then + ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) + CF_APPEND_TEXT(EXTRA_CPPFLAGS,$cf_new_extra_cppflags) +fi + +AC_SUBST(EXTRA_CPPFLAGS) + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05 +dnl ---------- +dnl Add a library, used to enforce consistency. +dnl +dnl $1 = library to add, without the "-l" +dnl $2 = variable to update (default $LIBS) +AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIBS version: 3 updated: 2019/11/02 16:47:33 +dnl ----------- +dnl Add one or more libraries, used to enforce consistency. Libraries are +dnl prepended to an existing list, since their dependencies are assumed to +dnl already exist in the list. +dnl +dnl $1 = libraries to add, with the "-l", etc. +dnl $2 = variable to update (default $LIBS) +AC_DEFUN([CF_ADD_LIBS],[ +cf_add_libs="[$]ifelse($2,,LIBS,[$2])" +# reverse order +cf_add_0lib= +for cf_add_1lib in $1; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +ifelse($2,,LIBS,[$2])="$cf_add_libs" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22 +dnl ---------------- +dnl Add a given library after another, e.g., following the one it satisfies a +dnl dependency for. +dnl +dnl $1 = the first library +dnl $2 = its dependency +AC_DEFUN([CF_ADD_LIB_AFTER],[ +CF_VERBOSE(...before $LIBS) +LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'` +CF_VERBOSE(...after $LIBS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_APPEND_TEXT version: 1 updated: 2017/02/25 18:58:55 +dnl -------------- +dnl use this macro for appending text without introducing an extra blank at +dnl the beginning +define([CF_APPEND_TEXT], +[ + test -n "[$]$1" && $1="[$]$1 " + $1="[$]{$1}$2" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31 +dnl -------------- +dnl Allow user to disable a normally-on option. +AC_DEFUN([CF_ARG_DISABLE], +[CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31 +dnl ------------- +dnl Allow user to enable a normally-off option. +AC_DEFUN([CF_ARG_ENABLE], +[CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ARG_OPTION version: 5 updated: 2015/05/10 19:52:14 +dnl ------------- +dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus +dnl values. +dnl +dnl Parameters: +dnl $1 = option name +dnl $2 = help-string +dnl $3 = action to perform if option is not default +dnl $4 = action if perform if option is default +dnl $5 = default option value (either 'yes' or 'no') +AC_DEFUN([CF_ARG_OPTION], +[AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes) + if test "$enableval" != "$5" ; then +ifelse([$3],,[ :]dnl +,[ $3]) ifelse([$4],,,[ + else + $4]) + fi],[enableval=$5 ifelse([$4],,,[ + $4 +])dnl +])])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26 +dnl --------------- +dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content +dnl into CC. This will not help with broken scripts that wrap the compiler +dnl with options, but eliminates a more common category of user confusion. +dnl +dnl In particular, it addresses the problem of being able to run the C +dnl preprocessor in a consistent manner. +dnl +dnl Caveat: this also disallows blanks in the pathname for the compiler, but +dnl the nuisance of having inconsistent settings for compiler and preprocessor +dnl outweighs that limitation. +AC_DEFUN([CF_CC_ENV_FLAGS], +[ +# This should have been defined by AC_PROG_CC +: ${CC:=cc} + +AC_MSG_CHECKING(\$CFLAGS variable) +case "x$CFLAGS" in +(*-[[IUD]]*) + AC_MSG_RESULT(broken) + AC_MSG_WARN(your environment uses the CFLAGS variable to hold CPPFLAGS options) + cf_flags="$CFLAGS" + CFLAGS= + for cf_arg in $cf_flags + do + CF_ADD_CFLAGS($cf_arg) + done + ;; +(*) + AC_MSG_RESULT(ok) + ;; +esac + +AC_MSG_CHECKING(\$CC variable) +case "$CC" in +(*[[\ \ ]]-*) + AC_MSG_RESULT(broken) + AC_MSG_WARN(your environment uses the CC variable to hold CFLAGS/CPPFLAGS options) + # humor him... + cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[[ ]]* / /g' -e 's/[[ ]]*[[ ]]-[[^ ]].*//'` + cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", [substr]([$]0,1+length(prog))); }'` + CC="$cf_prog" + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[[IUDfgOW]]*) + CF_ADD_CFLAGS($cf_arg) + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + CF_VERBOSE(resulting CC: '$CC') + CF_VERBOSE(resulting CFLAGS: '$CFLAGS') + CF_VERBOSE(resulting CPPFLAGS: '$CPPFLAGS') + ;; +(*) + AC_MSG_RESULT(ok) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 +dnl -------------- +dnl Check if we're accidentally using a cache from a different machine. +dnl Derive the system name, as a check for reusing the autoconf cache. +dnl +dnl If we've packaged config.guess and config.sub, run that (since it does a +dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow +dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM +dnl which is useful in cross-compiles. +dnl +dnl Note: we would use $ac_config_sub, but that is one of the places where +dnl autoconf 2.5x broke compatibility with autoconf 2.13 +AC_DEFUN([CF_CHECK_CACHE], +[ +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then + ifelse([$1],,[AC_CANONICAL_HOST],[$1]) + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.]) +AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name) + +if test ".$system_name" != ".$cf_cv_system_name" ; then + AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)) + AC_MSG_ERROR("Please remove config.cache and try again.") +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CFLAGS version: 3 updated: 2014/07/22 05:32:57 +dnl --------------- +dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from +dnl a build-configuration such as imake. These have the pitfall that they +dnl often contain compiler-specific options which we cannot use, mixed with +dnl preprocessor options that we usually can. +AC_DEFUN([CF_CHECK_CFLAGS], +[ +CF_VERBOSE(checking additions to CFLAGS) +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" +CF_ADD_CFLAGS($1,yes) +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +AC_TRY_LINK([#include ],[printf("Hello world");],, + [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS) + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + CF_VERBOSE(but keeping change to \$CPPFLAGS) + fi + CFLAGS="$cf_check_flags"]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_ERRNO version: 13 updated: 2020/03/10 18:53:47 +dnl -------------- +dnl Check for data that is usually declared in or , e.g., +dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it +dnl ourselves. +dnl +dnl $1 = the name to check +dnl $2 = the assumed type +AC_DEFUN([CF_CHECK_ERRNO], +[ +AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ + AC_TRY_COMPILE([ +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include ], + ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, + [cf_cv_dcl_$1=yes], + [cf_cv_dcl_$1=no]) +]) + +if test "$cf_cv_dcl_$1" = no ; then + CF_UPPER(cf_result,decl_$1) + AC_DEFINE_UNQUOTED($cf_result) +fi + +# It's possible (for near-UNIX clones) that the data doesn't exist +CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_EXTERN_DATA version: 4 updated: 2015/04/18 08:56:57 +dnl -------------------- +dnl Check for existence of external data in the current set of libraries. If +dnl we can modify it, it's real enough. +dnl $1 = the name to check +dnl $2 = its type +AC_DEFUN([CF_CHECK_EXTERN_DATA], +[ +AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[ + AC_TRY_LINK([ +#undef $1 +extern $2 $1; +], + [$1 = 2], + [cf_cv_have_$1=yes], + [cf_cv_have_$1=no]) +]) + +if test "$cf_cv_have_$1" = yes ; then + CF_UPPER(cf_result,have_$1) + AC_DEFINE_UNQUOTED($cf_result) +fi + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 +dnl ----------------- +dnl Check if the given compiler is really clang. clang's C driver defines +dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does +dnl not ignore some gcc options. +dnl +dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to +dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from +dnl the wrappers for gcc and g++ warnings. +dnl +dnl $1 = GCC (default) or GXX +dnl $2 = CLANG_COMPILER (default) +dnl $3 = CFLAGS (default) or CXXFLAGS +AC_DEFUN([CF_CLANG_COMPILER],[ +ifelse([$2],,CLANG_COMPILER,[$2])=no + +if test "$ifelse([$1],,[$1],GCC)" = yes ; then + AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) + cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" + ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" + AC_TRY_COMPILE([],[ +#ifdef __clang__ +#else +make an error +#endif +],[ifelse([$2],,CLANG_COMPILER,[$2])=yes +cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" +],[]) + ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" + AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_CONST_X_STRING version: 4 updated: 2020/03/10 18:53:47 +dnl ----------------- +dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most +dnl character-strings. +dnl +dnl It is ambiguous because the specification accommodated the pre-ANSI +dnl compilers bundled by more than one vendor in lieu of providing a standard C +dnl compiler other than by costly add-ons. Because of this, the specification +dnl did not take into account the use of const for telling the compiler that +dnl string literals would be in readonly memory. +dnl +dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to +dnl let the compiler decide how to represent Xt's strings which were #define'd. +dnl That does not solve the problem of using the block of Xt's strings which +dnl are compiled into the library (and is less efficient than one might want). +dnl +dnl Xt specification 7 introduces the _CONST_X_STRING symbol which is used both +dnl when compiling the library and compiling using the library, to tell the +dnl compiler that String is const. +AC_DEFUN([CF_CONST_X_STRING], +[ +AC_REQUIRE([AC_PATH_XTRA]) + +CF_SAVE_XTRA_FLAGS([CF_CONST_X_STRING]) + +AC_TRY_COMPILE( +[ +#include +#include +], +[String foo = malloc(1); (void)foo],[ + +AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ + AC_TRY_COMPILE( + [ +#define _CONST_X_STRING /* X11R7.8 (perhaps) */ +#undef XTSTRINGDEFINES /* X11R5 and later */ +#include +#include + ],[String foo = malloc(1); *foo = 0],[ + cf_cv_const_x_string=no + ],[ + cf_cv_const_x_string=yes + ]) +]) + +CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) + +case $cf_cv_const_x_string in +(no) + CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) + ;; +(*) + CF_APPEND_TEXT(CPPFLAGS,-D_CONST_X_STRING) + ;; +esac + +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_DESKTOP version: 2 updated: 2011/04/22 05:17:37 +dnl ------------------ +dnl Handle a configure option "--disable-desktop", which sets a shell +dnl variable $desktop_utils to a "#" if the feature is not wanted, or to an +dnl empty string if enabled. The variable is used to substitute in front of +dnl corresponding makefile-rules. +dnl +dnl It also tells the configure script to substitute the environment variable +dnl $DESKTOP_FLAGS, which can be used by external scripts to customize the +dnl invocation of desktop-file-util. +dnl +dnl $1 = program name +AC_DEFUN([CF_DISABLE_DESKTOP],[ +# Comment-out the install-desktop rule if the desktop-utils are not found. +AC_MSG_CHECKING(if you want to install desktop files) +CF_ARG_OPTION(desktop, + [ --disable-desktop disable install of $1 desktop files], + [enable_desktop=$enableval], + [enable_desktop=$enableval],yes) +AC_MSG_RESULT($enable_desktop) + +desktop_utils= +if test "$enable_desktop" = yes ; then +AC_CHECK_PROG(desktop_utils,desktop-file-install,yes,no) +fi + +test "$desktop_utils" = yes && desktop_utils= || desktop_utils="#" +AC_SUBST(DESKTOP_FLAGS) +]) +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_ECHO version: 13 updated: 2015/04/18 08:56:57 +dnl --------------- +dnl You can always use "make -n" to see the actual options, but it's hard to +dnl pick out/analyze warning messages when the compile-line is long. +dnl +dnl Sets: +dnl ECHO_LT - symbol to control if libtool is verbose +dnl ECHO_LD - symbol to prefix "cc -o" lines +dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o) +dnl SHOW_CC - symbol to put before explicit "cc -c" lines +dnl ECHO_CC - symbol to put before any "cc" line +dnl +AC_DEFUN([CF_DISABLE_ECHO],[ +AC_MSG_CHECKING(if you want to see long compiling messages) +CF_ARG_DISABLE(echo, + [ --disable-echo do not display "compiling" commands], + [ + ECHO_LT='--silent' + ECHO_LD='@echo linking [$]@;' + RULE_CC='@echo compiling [$]<' + SHOW_CC='@echo compiling [$]@' + ECHO_CC='@' +],[ + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' +]) +AC_MSG_RESULT($enableval) +AC_SUBST(ECHO_LT) +AC_SUBST(ECHO_LD) +AC_SUBST(RULE_CC) +AC_SUBST(SHOW_CC) +AC_SUBST(ECHO_CC) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 +dnl ---------------- +dnl Combine no-leak checks with the libraries or tools that are used for the +dnl checks. +AC_DEFUN([CF_DISABLE_LEAKS],[ + +AC_REQUIRE([CF_WITH_DMALLOC]) +AC_REQUIRE([CF_WITH_DBMALLOC]) +AC_REQUIRE([CF_WITH_VALGRIND]) + +AC_MSG_CHECKING(if you want to perform memory-leak testing) +AC_ARG_ENABLE(leaks, + [ --disable-leaks test: free permanent memory, analyze leaks], + [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], + : ${with_no_leaks:=no}) +AC_MSG_RESULT($with_no_leaks) + +if test "$with_no_leaks" = yes ; then + AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) + AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 +dnl --------------------- +dnl The rpath-hack makes it simpler to build programs, particularly with the +dnl *BSD ports which may have essential libraries in unusual places. But it +dnl can interfere with building an executable for the base system. Use this +dnl option in that case. +AC_DEFUN([CF_DISABLE_RPATH_HACK], +[ +AC_MSG_CHECKING(if rpath-hack should be disabled) +CF_ARG_DISABLE(rpath-hack, + [ --disable-rpath-hack don't add rpath options for additional libraries], + [cf_disable_rpath_hack=yes], + [cf_disable_rpath_hack=no]) +AC_MSG_RESULT($cf_disable_rpath_hack) +if test "$cf_disable_rpath_hack" = no ; then + CF_RPATH_HACK +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_NARROWPROTO version: 5 updated: 2015/04/12 15:39:00 +dnl --------------------- +dnl If this is not set properly, Xaw's scrollbars will not work. +dnl The so-called "modular" configuration for X.org omits most of the +dnl configure checks that would be needed to provide compatibility with +dnl older X builds. This one breaks things noticeably. +AC_DEFUN([CF_ENABLE_NARROWPROTO], +[ +AC_MSG_CHECKING(if you want narrow prototypes for X libraries) + +case `$ac_config_guess` in +(*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) + cf_default_narrowproto=yes + ;; +(*) + cf_default_narrowproto=no + ;; +esac + +CF_ARG_OPTION(narrowproto, + [ --enable-narrowproto enable narrow prototypes for X libraries], + [enable_narrowproto=$enableval], + [enable_narrowproto=$cf_default_narrowproto], + [$cf_default_narrowproto]) +AC_MSG_RESULT($enable_narrowproto) +]) +dnl --------------------------------------------------------------------------- +dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 +dnl -------- +dnl Check if 'errno' is declared in +AC_DEFUN([CF_ERRNO], +[ +CF_CHECK_ERRNO(errno) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FUNC_GRANTPT version: 14 updated: 2018/08/12 04:58:46 +dnl --------------- +dnl Check for grantpt versus openpty, as well as functions that "should" be +dnl available if grantpt is available. +AC_DEFUN([CF_FUNC_GRANTPT],[ + +AC_CHECK_HEADERS( \ +stropts.h \ +) + +cf_func_grantpt="grantpt ptsname" +cf_prefer_openpt=no +case $host_os in +(darwin[[0-9]].*) + ;; +(openbsd[[0-9]].*) + # The POSIX entrypoints exist, but have never worked. + ;; +(linux*) + cf_func_grantpt="$cf_func_grantpt posix_openpt" + cf_prefer_openpt=yes + ;; +(*) + cf_func_grantpt="$cf_func_grantpt posix_openpt" + ;; +esac + +AC_CHECK_FUNCS($cf_func_grantpt) + +cf_grantpt_opts= +if test "x$ac_cv_func_grantpt" = "xyes" ; then + AC_MSG_CHECKING(if grantpt really works) + AC_TRY_LINK(CF__GRANTPT_HEAD,CF__GRANTPT_BODY,[ + AC_TRY_RUN(CF__GRANTPT_HEAD +int main(void) +{ +CF__GRANTPT_BODY +} +, +,ac_cv_func_grantpt=no +,ac_cv_func_grantpt=maybe) + ],ac_cv_func_grantpt=no) + AC_MSG_RESULT($ac_cv_func_grantpt) + + if test "x$ac_cv_func_grantpt" != "xno" ; then + + if test "x$ac_cv_func_grantpt" = "xyes" ; then + AC_MSG_CHECKING(for pty features) +dnl if we have no stropts.h, skip the checks for streams modules + if test "x$ac_cv_header_stropts_h" = xyes + then + cf_pty_this=0 + else + cf_pty_this=3 + fi + + cf_pty_defines= + while test $cf_pty_this != 6 + do + + cf_pty_feature= + cf_pty_next=`expr $cf_pty_this + 1` + CF_MSG_LOG(pty feature test $cf_pty_next:5) + AC_TRY_RUN(#define CONFTEST $cf_pty_this +$cf_pty_defines +CF__GRANTPT_HEAD +int main(void) +{ +CF__GRANTPT_BODY +} +, +[ + case $cf_pty_next in + (1) # - streams + cf_pty_feature=ptem + ;; + (2) # - streams + cf_pty_feature=ldterm + ;; + (3) # - streams + cf_pty_feature=ttcompat + ;; + (4) + cf_pty_feature=pty_isatty + ;; + (5) + cf_pty_feature=pty_tcsetattr + ;; + (6) + cf_pty_feature=tty_tcsetattr + ;; + esac +],[ + case $cf_pty_next in + (1|2|3) + CF_MSG_LOG(skipping remaining streams features $cf_pty_this..2) + cf_pty_next=3 + ;; + esac +]) + if test -n "$cf_pty_feature" + then + cf_pty_defines="$cf_pty_defines +#define CONFTEST_$cf_pty_feature 1 +" + cf_grantpt_opts="$cf_grantpt_opts $cf_pty_feature" + fi + + cf_pty_this=$cf_pty_next + done + AC_MSG_RESULT($cf_grantpt_opts) + cf_grantpt_opts=`echo "$cf_grantpt_opts" | sed -e 's/ isatty//'` + fi + fi +fi + +dnl If we found grantpt, but no features, e.g., for streams or if we are not +dnl able to use tcsetattr, then give openpty a try. In particular, Darwin 10.7 +dnl has a more functional openpty than posix_openpt. +dnl +dnl There is no configure run-test for openpty, since older implementations do +dnl not always run properly as a non-root user. For that reason, we also allow +dnl the configure script to suppress this check entirely with $disable_openpty. +if test "x$cf_prefer_posix_openpt" = "xyes" && test "x$ac_cv_func_posix_openpt" = "xyes" ; then + CF_VERBOSE(prefer posix_openpt over openpty) +elif test "x$disable_openpty" != "xyes" || test -z "$cf_grantpt_opts" ; then + AC_CHECK_LIB(util, openpty, [cf_have_openpty=yes],[cf_have_openpty=no]) + if test "$cf_have_openpty" = yes ; then + ac_cv_func_grantpt=no + LIBS="-lutil $LIBS" + AC_DEFINE(HAVE_OPENPTY,1,[Define to 1 if you have the openpty function]) + AC_CHECK_HEADERS( \ + util.h \ + libutil.h \ + pty.h \ + ) + fi +fi + +dnl If we did not settle on using openpty, fill in the definitions for grantpt. +if test "x$ac_cv_func_grantpt" != xno +then + CF_VERBOSE(will rely upon grantpt) + AC_DEFINE(HAVE_WORKING_GRANTPT,1,[Define to 1 if the grantpt function seems to work]) + for cf_feature in $cf_grantpt_opts + do + cf_feature=`echo "$cf_feature" | sed -e 's/ //g'` + CF_UPPER(cf_FEATURE,$cf_feature) + AC_DEFINE_UNQUOTED(HAVE_GRANTPT_$cf_FEATURE) + done +elif test "x$cf_have_openpty" = xno +then + CF_VERBOSE(will rely upon BSD-pseudoterminals) +else + CF_VERBOSE(will rely upon openpty) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_FUNC_TGETENT version: 23 updated: 2020/06/02 20:17:00 +dnl --------------- +dnl Check for tgetent function in termcap library. If we cannot find this, +dnl we'll use the $LINES and $COLUMNS environment variables to pass screen +dnl size information to subprocesses. (We cannot use terminfo's compatibility +dnl function, since it cannot provide the termcap-format data). +dnl +dnl If the --disable-full-tgetent option is given, we'll settle for the first +dnl tgetent function we find. Since the search list in that case does not +dnl include the termcap library, that allows us to default to terminfo. +AC_DEFUN([CF_FUNC_TGETENT], +[ +# compute a reasonable value for $TERM to give tgetent(), since we may be +# running in 'screen', which sets $TERMCAP to a specific entry that is not +# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply +# discard $TERMCAP. +cf_TERMVAR=vt100 +if test -n "$TERMCAP" +then + cf_TERMCAP=`echo "$TERMCAP" | tr '\n' ' ' | sed -e 's/^..|//' -e 's/|.*//'` + case "$cf_TERMCAP" in + (screen*.*) + ;; + (*) + cf_TERMVAR="$cf_TERMCAP" + ;; + esac +fi +test -z "$cf_TERMVAR" && cf_TERMVAR=vt100 + +# BSD termcap used no header file +# SVr4 provided termcap prototypes as a legacy feature in term.h +# GNU termcap provided termcap prototypes in termcap.h +# ncurses provides termcap prototypes in both term.h and termcap.h +# +# The terminfo-based termcap interfaces do not provide a full tgetent (i.e., do +# not return the text of the termcap entry in the buffer), but as a special +# case, FreeBSD provides ncurses' termcap.h with a modified termcap reader that +# returns the termcap text. +AC_CHECK_HEADERS(termcap.h) + +AC_MSG_CHECKING(if we want full tgetent function) +CF_ARG_DISABLE(full-tgetent, + [ --disable-full-tgetent disable check for full tgetent function], + cf_full_tgetent=no, + cf_full_tgetent=yes,yes) +AC_MSG_RESULT($cf_full_tgetent) + +if test "$cf_full_tgetent" = yes ; then + cf_test_message="full tgetent" +else + cf_test_message="tgetent" +fi + +AC_CACHE_CHECK(for $cf_test_message function,cf_cv_lib_tgetent,[ +cf_save_LIBS="$LIBS" +cf_cv_lib_tgetent=no +if test "$cf_full_tgetent" = yes ; then + cf_TERMLIB="otermcap termcap termlib ncurses curses" + cf_TERMTST="buffer[[0]] == 0" +else + cf_TERMLIB="termlib ncurses curses" + cf_TERMTST="0" +fi +for cf_termlib in '' $cf_TERMLIB ; do + LIBS="$cf_save_LIBS" + test -n "$cf_termlib" && { CF_ADD_LIB($cf_termlib) } + AC_TRY_RUN([ +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "$cf_TERMVAR"); + ${cf_cv_main_return:-return} ($cf_TERMTST); }], + [echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&AC_FD_CC + if test -n "$cf_termlib" ; then + cf_cv_lib_tgetent="-l$cf_termlib" + else + cf_cv_lib_tgetent=yes + fi + break], + [echo "no, there is no termcap/tgetent in $cf_termlib" 1>&AC_FD_CC], + [echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&AC_FD_CC]) +done +LIBS="$cf_save_LIBS" +]) + +# If we found a working tgetent(), set LIBS and check for termcap.h. +# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should +# not have side effects other than setting the cache variable, because +# they are not executed when a cached value exists.) +if test "x$cf_cv_lib_tgetent" != xno ; then + test "x$cf_cv_lib_tgetent" != xyes && { CF_ADD_LIBS($cf_cv_lib_tgetent) } + AC_DEFINE(USE_TERMCAP,1,[Define 1 to indicate that working tgetent is found]) + if test "$cf_full_tgetent" = no ; then + AC_TRY_COMPILE([ +#include ],[ +#ifdef NCURSES_VERSION +make an error +#endif],[AC_DEFINE(HAVE_TERMCAP_H)]) + else + AC_CHECK_HEADERS(termcap.h) + fi +else + # If we didn't find a tgetent() that supports the buffer + # argument, look again to see whether we can find even + # a crippled one. A crippled tgetent() is still useful to + # validate values for the TERM environment variable given to + # child processes. + AC_CACHE_CHECK(for partial tgetent function,cf_cv_lib_part_tgetent,[ + cf_cv_lib_part_tgetent=no + for cf_termlib in $cf_TERMLIB ; do + LIBS="$cf_save_LIBS -l$cf_termlib" + AC_TRY_LINK([],[tgetent(0, "$cf_TERMVAR")], + [echo "there is a terminfo/tgetent in $cf_termlib" 1>&AC_FD_CC + cf_cv_lib_part_tgetent="-l$cf_termlib" + break]) + done + LIBS="$cf_save_LIBS" + ]) + + if test "$cf_cv_lib_part_tgetent" != no ; then + CF_ADD_LIBS($cf_cv_lib_part_tgetent) + AC_CHECK_HEADERS(termcap.h) + + # If this is linking against ncurses, we'll trigger the + # ifdef in resize.c that turns the termcap stuff back off. + AC_DEFINE(USE_TERMINFO,1,[Define to 1 to indicate that terminfo provides the tgetent interface]) + fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_ATTRIBUTES version: 18 updated: 2020/03/10 18:53:47 +dnl ----------------- +dnl Test for availability of useful gcc __attribute__ directives to quiet +dnl compiler warnings. Though useful, not all are supported -- and contrary +dnl to documentation, unrecognized directives cause older compilers to barf. +AC_DEFUN([CF_GCC_ATTRIBUTES], +[ +if test "$GCC" = yes +then +cat > conftest.i < conftest.$ac_ext <&AC_FD_CC + + case $cf_attribute in + (printf) + cf_printf_attribute=yes + cat >conftest.h <conftest.h <conftest.h <>confdefs.h + case $cf_attribute in + (noreturn) + AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) + ;; + (printf) + cf_value='/* nothing */' + if test "$cf_printf_attribute" != no ; then + cf_value='__attribute__((format(printf,fmt,var)))' + AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.]) + fi + AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc]) + ;; + (scanf) + cf_value='/* nothing */' + if test "$cf_scanf_attribute" != no ; then + cf_value='__attribute__((format(scanf,fmt,var)))' + AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.]) + fi + AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc]) + ;; + (unused) + AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc]) + ;; + esac + fi + done +else + fgrep define conftest.i >>confdefs.h +fi +rm -rf conftest* +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_VERSION version: 8 updated: 2019/09/07 13:38:36 +dnl -------------- +dnl Find version of gcc, and (because icc/clang pretend to be gcc without being +dnl compatible), attempt to determine if icc/clang is actually used. +AC_DEFUN([CF_GCC_VERSION],[ +AC_REQUIRE([AC_PROG_CC]) +GCC_VERSION=none +if test "$GCC" = yes ; then + AC_MSG_CHECKING(version of $CC) + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" + test -z "$GCC_VERSION" && GCC_VERSION=unknown + AC_MSG_RESULT($GCC_VERSION) +fi +CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) +CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GCC_WARNINGS version: 37 updated: 2020/01/05 20:04:12 +dnl --------------- +dnl Check if the compiler supports useful warning options. There's a few that +dnl we don't use, simply because they're too noisy: +dnl +dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x) +dnl -Winline (usually not worthwhile) +dnl -Wredundant-decls (system headers make this too noisy) +dnl -Wtraditional (combines too many unrelated messages, only a few useful) +dnl -Wwrite-strings (too noisy, but should review occasionally). This +dnl is enabled for ncurses using "--enable-const". +dnl -pedantic +dnl +dnl Parameter: +dnl $1 is an optional list of gcc warning flags that a particular +dnl application might want to use, e.g., "no-unused" for +dnl -Wno-unused +dnl Special: +dnl If $with_ext_const is "yes", add a check for -Wwrite-strings +dnl +AC_DEFUN([CF_GCC_WARNINGS], +[ +AC_REQUIRE([CF_GCC_VERSION]) +if test "x$have_x" = xyes; then CF_CONST_X_STRING fi +cat > conftest.$ac_ext <],[ + #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 + return 0; + #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 + return 0; + #else + # error not GNU C library + #endif], + [cf_cv_gnu_library=yes], + [cf_cv_gnu_library=no]) +]) + +if test x$cf_cv_gnu_library = xyes; then + + # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE + # was changed to help a little. newlib incorporated the change about 4 + # years later. + AC_CACHE_CHECK(if _DEFAULT_SOURCE can be used as a basis,cf_cv_gnu_library_219,[ + cf_save="$CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) + AC_TRY_COMPILE([#include ],[ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) + return 0; + #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) + return 0; + #else + # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old + #endif], + [cf_cv_gnu_library_219=yes], + [cf_cv_gnu_library_219=no]) + CPPFLAGS="$cf_save" + ]) + + if test "x$cf_cv_gnu_library_219" = xyes; then + cf_save="$CPPFLAGS" + AC_CACHE_CHECK(if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE,cf_cv_gnu_dftsrc_219,[ + CF_ADD_CFLAGS(-D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source) + AC_TRY_COMPILE([ + #include + #include + ],[ + #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) + return 0; + #else + # error GNU C library is too old + #endif], + [cf_cv_gnu_dftsrc_219=yes], + [cf_cv_gnu_dftsrc_219=no]) + ]) + test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" + else + cf_cv_gnu_dftsrc_219=maybe + fi + + if test "x$cf_cv_gnu_dftsrc_219" != xyes; then + + AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ + AC_TRY_COMPILE([#include ],[ + #ifndef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be defined + #endif], + [cf_cv_gnu_source=no], + [cf_save="$CPPFLAGS" + CF_ADD_CFLAGS(-D_GNU_SOURCE) + AC_TRY_COMPILE([#include ],[ + #ifdef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be undefined + #endif], + [cf_cv_gnu_source=no], + [cf_cv_gnu_source=yes]) + CPPFLAGS="$cf_save" + ]) + ]) + + if test "$cf_cv_gnu_source" = yes + then + AC_CACHE_CHECK(if we should also define _DEFAULT_SOURCE,cf_cv_default_source,[ + CF_APPEND_TEXT(CPPFLAGS,-D_GNU_SOURCE) + AC_TRY_COMPILE([#include ],[ + #ifdef _DEFAULT_SOURCE + #error expected _DEFAULT_SOURCE to be undefined + #endif], + [cf_cv_default_source=no], + [cf_cv_default_source=yes]) + ]) + if test "$cf_cv_default_source" = yes + then + CF_APPEND_TEXT(CPPFLAGS,-D_DEFAULT_SOURCE) + fi + fi + fi + +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_HELP_MESSAGE version: 4 updated: 2019/12/31 08:53:54 +dnl --------------- +dnl Insert text into the help-message, for readability, from AC_ARG_WITH. +AC_DEFUN([CF_HELP_MESSAGE], +[CF_ACVERSION_CHECK(2.53,[],[ +AC_DIVERT_HELP($1)])dnl +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_IMAKE_CFLAGS version: 32 updated: 2015/04/12 15:39:00 +dnl --------------- +dnl Use imake to obtain compiler flags. We could, in principle, write tests to +dnl get these, but if imake is properly configured there is no point in doing +dnl this. +dnl +dnl Parameters (used in constructing a sample Imakefile): +dnl $1 = optional value to append to $IMAKE_CFLAGS +dnl $2 = optional value to append to $IMAKE_LOADFLAGS +AC_DEFUN([CF_IMAKE_CFLAGS], +[ +AC_PATH_PROGS(IMAKE,xmkmf imake) + +if test -n "$IMAKE" ; then + +case $IMAKE in +(*/imake) + cf_imake_opts="-DUseInstalled=YES" + ;; +(*/util/xmkmf) + # A single parameter tells xmkmf where the config-files are: + cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" + ;; +(*) + cf_imake_opts= + ;; +esac + +# If it's installed properly, imake (or its wrapper, xmkmf) will point to the +# config directory. +if mkdir conftestdir; then + CDPATH=; export CDPATH + cf_makefile=`cd $srcdir;pwd`/Imakefile + cd conftestdir + + cat >fix_cflags.sed <<'CF_EOF' +s/\\//g +s/[[ ]][[ ]]*/ /g +s/"//g +:pack +s/\(=[[^ ]][[^ ]]*\) \([[^-]]\)/\1 \2/g +t pack +s/\(-D[[a-zA-Z0-9_]][[a-zA-Z0-9_]]*\)=\([[^\'0-9 ]][[^ ]]*\)/\1='\\"\2\\"'/g +s/^IMAKE[[ ]]/IMAKE_CFLAGS="/ +s/ / /g +s/$/"/ +CF_EOF + + cat >fix_lflags.sed <<'CF_EOF' +s/^IMAKE[[ ]]*/IMAKE_LOADFLAGS="/ +s/$/"/ +CF_EOF + + echo >./Imakefile + test -f $cf_makefile && cat $cf_makefile >>./Imakefile + + cat >> ./Imakefile <<'CF_EOF' +findstddefs: + @echo IMAKE ${ALLDEFINES}ifelse([$1],,,[ $1]) | sed -f fix_cflags.sed + @echo IMAKE ${EXTRA_LOAD_FLAGS}ifelse([$2],,,[ $2]) | sed -f fix_lflags.sed +CF_EOF + + if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile) + then + CF_VERBOSE(Using $IMAKE $cf_imake_opts) + else + # sometimes imake doesn't have the config path compiled in. Find it. + cf_config= + for cf_libpath in $X_LIBS $LIBS ; do + case $cf_libpath in + (-L*) + cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'` + cf_libpath=$cf_libpath/X11/config + if test -d $cf_libpath ; then + cf_config=$cf_libpath + break + fi + ;; + esac + done + if test -z "$cf_config" ; then + AC_MSG_WARN(Could not find imake config-directory) + else + cf_imake_opts="$cf_imake_opts -I$cf_config" + if ( $IMAKE -v $cf_imake_opts 2>&AC_FD_CC) + then + CF_VERBOSE(Using $IMAKE $cf_config) + else + AC_MSG_WARN(Cannot run $IMAKE) + fi + fi + fi + + # GNU make sometimes prints "make[1]: Entering...", which + # would confuse us. + eval `make findstddefs 2>/dev/null | grep -v make` + + cd .. + rm -rf conftestdir + + # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former + # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have + # modified it to support site.cf, adding a kludge for the /usr/include + # directory. Try to filter that out, otherwise gcc won't find its + # headers. + if test -n "$GCC" ; then + if test -n "$IMAKE_CFLAGS" ; then + cf_nostdinc="" + cf_std_incl="" + cf_cpp_opts="" + for cf_opt in $IMAKE_CFLAGS + do + case "$cf_opt" in + (-nostdinc) + cf_nostdinc="$cf_opt" + ;; + (-I/usr/include) + cf_std_incl="$cf_opt" + ;; + (*) + cf_cpp_opts="$cf_cpp_opts $cf_opt" + ;; + esac + done + if test -z "$cf_nostdinc" ; then + IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" + elif test -z "$cf_std_incl" ; then + IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" + else + CF_VERBOSE(suppressed \"$cf_nostdinc\" and \"$cf_std_incl\") + IMAKE_CFLAGS="$cf_cpp_opts" + fi + fi + fi +fi + +# Some imake configurations define PROJECTROOT with an empty value. Remove +# the empty definition. +case $IMAKE_CFLAGS in +(*-DPROJECTROOT=/*) + ;; +(*) + IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[[ ]], ,"` + ;; +esac + +fi + +CF_VERBOSE(IMAKE_CFLAGS $IMAKE_CFLAGS) +CF_VERBOSE(IMAKE_LOADFLAGS $IMAKE_LOADFLAGS) + +AC_SUBST(IMAKE_CFLAGS) +AC_SUBST(IMAKE_LOADFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INPUT_METHOD version: 4 updated: 2020/03/10 18:53:47 +dnl --------------- +dnl Check if the X libraries support input-method +AC_DEFUN([CF_INPUT_METHOD], +[ +AC_CACHE_CHECK([if X libraries support input-method],cf_cv_input_method,[ +AC_TRY_LINK([ +#include +#include +#include +#include +#include +#include +],[ +{ + XIM xim; + XIMStyles *xim_styles = 0; + XIMStyle input_style; + Widget w = 0; + + XSetLocaleModifiers("@im=none"); + xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); + XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); + XCloseIM(xim); + input_style = (XIMPreeditNothing | XIMStatusNothing); + (void)xim_styles; + (void)input_style; +} +], +[cf_cv_input_method=yes], +[cf_cv_input_method=no])]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 +dnl ----------------- +dnl Check if the given compiler is really the Intel compiler for Linux. It +dnl tries to imitate gcc, but does not return an error when it finds a mismatch +dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK. +dnl +dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to +dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from +dnl the wrappers for gcc and g++ warnings. +dnl +dnl $1 = GCC (default) or GXX +dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS +dnl $3 = CFLAGS (default) or CXXFLAGS +AC_DEFUN([CF_INTEL_COMPILER],[ +AC_REQUIRE([AC_CANONICAL_HOST]) +ifelse([$2],,INTEL_COMPILER,[$2])=no + +if test "$ifelse([$1],,[$1],GCC)" = yes ; then + case $host_os in + (linux*|gnu*) + AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) + cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" + ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc" + AC_TRY_COMPILE([],[ +#ifdef __INTEL_COMPILER +#else +make an error +#endif +],[ifelse([$2],,INTEL_COMPILER,[$2])=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147" +],[]) + ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" + AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2])) + ;; + esac +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LASTLOG version: 6 updated: 2020/03/10 18:53:47 +dnl ---------- +dnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog +dnl file exists. +AC_DEFUN([CF_LASTLOG], +[ +AC_CHECK_HEADERS(lastlog.h paths.h) +AC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[ +AC_TRY_COMPILE([ +#include +#ifdef HAVE_LASTLOG_H +#include +#else +#ifdef HAVE_PATHS_H +#include +#endif +#endif],[char *path = _PATH_LASTLOG; (void)path], + [cf_cv_path_lastlog="_PATH_LASTLOG"], + [if test -f /usr/adm/lastlog ; then + cf_cv_path_lastlog=/usr/adm/lastlog + else + cf_cv_path_lastlog=no + fi]) +]) +test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG,1,[Define to 1 if we can define lastlog pathname]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35 +dnl --------------- +dnl For the given system and compiler, find the compiler flags to pass to the +dnl loader to use the "rpath" feature. +AC_DEFUN([CF_LD_RPATH_OPT], +[ +AC_REQUIRE([CF_CHECK_CACHE]) + +LD_RPATH_OPT= +if test "x$cf_cv_enable_rpath" != xno +then + AC_MSG_CHECKING(for an rpath option) + case $cf_cv_system_name in + (irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; + (linux*|gnu*|k*bsd*-gnu|freebsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (openbsd[[2-9]].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (dragonfly*) + LD_RPATH_OPT="-rpath " + ;; + (netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; + (solaris2*) + LD_RPATH_OPT="-R" + ;; + (*) + ;; + esac + AC_MSG_RESULT($LD_RPATH_OPT) + + case "x$LD_RPATH_OPT" in + (x-R*) + AC_MSG_CHECKING(if we need a space after rpath option) + cf_save_LIBS="$LIBS" + CF_ADD_LIBS(${LD_RPATH_OPT}$libdir) + AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes) + LIBS="$cf_save_LIBS" + AC_MSG_RESULT($cf_rpath_space) + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; + esac +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32 +dnl ------------ +dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have +dnl a monocase filesystem. +AC_DEFUN([CF_MAKE_TAGS],[ +AC_REQUIRE([CF_MIXEDCASE_FILENAMES]) + +AC_CHECK_PROGS(CTAGS, exctags ctags) +AC_CHECK_PROGS(ETAGS, exetags etags) + +AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no) + +if test "$cf_cv_mixedcase" = yes ; then + AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no) +else + MAKE_UPPER_TAGS=no +fi + +if test "$MAKE_UPPER_TAGS" = yes ; then + MAKE_UPPER_TAGS= +else + MAKE_UPPER_TAGS="#" +fi + +if test "$MAKE_LOWER_TAGS" = yes ; then + MAKE_LOWER_TAGS= +else + MAKE_LOWER_TAGS="#" +fi + +AC_SUBST(CTAGS) +AC_SUBST(ETAGS) + +AC_SUBST(MAKE_UPPER_TAGS) +AC_SUBST(MAKE_LOWER_TAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MATH_LIB version: 9 updated: 2017/01/21 11:06:25 +dnl ----------- +dnl Checks for libraries. At least one UNIX system, Apple Macintosh +dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler +dnl AC_CHECK_LIB(m,sin), because that fails for C++. +AC_DEFUN([CF_MATH_LIB], +[ +AC_CACHE_CHECK(if -lm needed for math functions, + cf_cv_need_libm,[ + AC_TRY_LINK([ + #include + #include + #include + ], + [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)], + [cf_cv_need_libm=no], + [cf_cv_need_libm=yes])]) +if test "$cf_cv_need_libm" = yes +then +ifelse($1,,[ + CF_ADD_LIB(m) +],[$1=-lm]) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 +dnl ---------------------- +dnl Check if the file-system supports mixed-case filenames. If we're able to +dnl create a lowercase name and see it as uppercase, it doesn't support that. +AC_DEFUN([CF_MIXEDCASE_FILENAMES], +[ +AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ +if test "$cross_compiling" = yes ; then + case $target_alias in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) + cf_cv_mixedcase=no + ;; + (*) + cf_cv_mixedcase=yes + ;; + esac +else + rm -f conftest CONFTEST + echo test >conftest + if test -f CONFTEST ; then + cf_cv_mixedcase=no + else + cf_cv_mixedcase=yes + fi + rm -f conftest CONFTEST +fi +]) +test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32 +dnl ---------- +dnl Write a debug message to config.log, along with the line number in the +dnl configure script. +AC_DEFUN([CF_MSG_LOG],[ +echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 +dnl ------------------ +dnl see CF_WITH_NO_LEAKS +AC_DEFUN([CF_NO_LEAKS_OPTION],[ +AC_MSG_CHECKING(if you want to use $1 for testing) +AC_ARG_WITH($1, + [$2], + [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ + $4 +]) + : ${with_cflags:=-g} + : ${with_no_leaks:=yes} + with_$1=yes], + [with_$1=]) +AC_MSG_RESULT(${with_$1:-no}) + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + CF_ADD_CFLAGS([-g]) + ;; + esac + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00 +dnl ---------- +dnl Provide a value for the $PATH and similar separator (or amend the value +dnl as provided in autoconf 2.5x). +AC_DEFUN([CF_PATHSEP], +[ + AC_MSG_CHECKING(for PATH separator) + case $cf_cv_system_name in + (os2*) PATH_SEPARATOR=';' ;; + (*) ${PATH_SEPARATOR:=':'} ;; + esac +ifelse([$1],,,[$1=$PATH_SEPARATOR]) + AC_SUBST(PATH_SEPARATOR) + AC_MSG_RESULT($PATH_SEPARATOR) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PATH_PROG version: 10 updated: 2019/06/30 19:44:43 +dnl ------------ +dnl Check for a given program, defining corresponding symbol. +dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. +dnl $2 = program name to find. +dnl $3 = optional list of additional program names to test. +dnl $4 = $PATH +dnl +dnl If there is more than one token in the result, #define the remaining tokens +dnl to $1_ARGS. We need this for 'install' in particular. +dnl +dnl FIXME: we should allow this to be overridden by environment variables +dnl +AC_DEFUN([CF_PATH_PROG],[ +AC_REQUIRE([CF_PATHSEP]) +test -z "[$]$1" && $1=$2 +AC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4)) + +cf_path_prog="" +cf_path_args="" +IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" +for cf_temp in $ac_cv_path_$1 +do + if test -z "$cf_path_prog" ; then + if test "$with_full_paths" = yes ; then + CF_PATH_SYNTAX(cf_temp,break) + cf_path_prog="$cf_temp" + else + cf_path_prog="`basename $cf_temp`" + fi + elif test -z "$cf_path_args" ; then + cf_path_args="$cf_temp" + else + cf_path_args="$cf_path_args $cf_temp" + fi +done +IFS="$cf_save_ifs" + +if test -n "$cf_path_prog" ; then + CF_MSG_LOG(defining path for ${cf_path_prog}) + AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1) + test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 +dnl -------------- +dnl Check the argument to see that it looks like a pathname. Rewrite it if it +dnl begins with one of the prefix/exec_prefix variables, and then again if the +dnl result begins with 'NONE'. This is necessary to work around autoconf's +dnl delayed evaluation of those symbols. +AC_DEFUN([CF_PATH_SYNTAX],[ +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".[$]$1" in +(.\[$]\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX + ;; +(.\[$]{*prefix}*|.\[$]{*dir}*) + eval $1="[$]$1" + case ".[$]$1" in + (.NONE/*) + $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) + ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 +dnl ------------- +dnl Check for the package-config program, unless disabled by command-line. +AC_DEFUN([CF_PKG_CONFIG], +[ +AC_MSG_CHECKING(if you want to use pkg-config) +AC_ARG_WITH(pkg-config, + [ --with-pkg-config{=path} enable/disable use of pkg-config], + [cf_pkg_config=$withval], + [cf_pkg_config=yes]) +AC_MSG_RESULT($cf_pkg_config) + +case $cf_pkg_config in +(no) + PKG_CONFIG=none + ;; +(yes) + CF_ACVERSION_CHECK(2.52, + [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)], + [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)]) + ;; +(*) + PKG_CONFIG=$withval + ;; +esac + +test -z "$PKG_CONFIG" && PKG_CONFIG=none +if test "$PKG_CONFIG" != none ; then + CF_PATH_SYNTAX(PKG_CONFIG) +elif test "x$cf_pkg_config" != xno ; then + AC_MSG_WARN(pkg-config is not installed) +fi + +AC_SUBST(PKG_CONFIG) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_C_SOURCE version: 11 updated: 2018/12/31 20:46:17 +dnl ----------------- +dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. +dnl +dnl POSIX.1-1990 _POSIX_SOURCE +dnl POSIX.1-1990 and _POSIX_SOURCE and +dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 +dnl Bindings Option +dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L +dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L +dnl X/Open 2000 _POSIX_C_SOURCE=200112L +dnl +dnl Parameters: +dnl $1 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_POSIX_C_SOURCE], +[AC_REQUIRE([CF_POSIX_VISIBLE])dnl + +if test "$cf_cv_posix_visible" = no; then + +cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1]) + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) +CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) + +AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ + CF_MSG_LOG(if the symbol is already defined go no further) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif], + [cf_cv_posix_c_source=no], + [cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[[12]]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + AC_TRY_COMPILE([#include ],[ +#ifdef _POSIX_SOURCE +make an error +#endif],[], + cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") + fi + CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,$cf_cv_posix_c_source) + CF_MSG_LOG(if the second compile does not leave our definition intact error) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif],, + [cf_cv_posix_c_source=no]) + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + ]) +]) + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + CF_ADD_CFLAGS($cf_cv_posix_c_source) +fi + +fi # cf_cv_posix_visible + +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_SAVED_IDS version: 9 updated: 2020/03/10 18:53:47 +dnl ------------------ +dnl +dnl Check first if saved-ids are always supported. Some systems +dnl may require runtime checks. +AC_DEFUN([CF_POSIX_SAVED_IDS], +[ +AC_CHECK_HEADERS( \ +sys/param.h \ +) + +AC_CACHE_CHECK(if POSIX saved-ids are supported,cf_cv_posix_saved_ids,[ +AC_TRY_LINK( +[ +#include +#ifdef HAVE_SYS_PARAM_H +#include /* this may define "BSD" */ +#endif +],[ +#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) + void *p = (void *) seteuid; + int x = seteuid(geteuid()); + (void)p; + (void)x; +#elif defined(BSD) && (BSD >= 199103) +/* The BSD's may implement the runtime check - and it fails. + * However, saved-ids work almost like POSIX (close enough for most uses). + */ +#else +make an error +#endif +],[cf_cv_posix_saved_ids=yes +],[ +AC_TRY_RUN([ +#ifdef HAVE_STDLIB_H +#include +#endif +#include +int main(void) +{ + void *p = (void *) seteuid; + long code = sysconf(_SC_SAVED_IDS); + (void)p; + ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); +}], + cf_cv_posix_saved_ids=yes, + cf_cv_posix_saved_ids=no, + cf_cv_posix_saved_ids=unknown) +]) +]) + +test "$cf_cv_posix_saved_ids" = yes && AC_DEFINE(HAVE_POSIX_SAVED_IDS,1,[Define to 1 if POSIX saved-ids are supported]) +]) +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_VISIBLE version: 1 updated: 2018/12/31 20:46:17 +dnl ---------------- +dnl POSIX documents test-macros which an application may set before any system +dnl headers are included to make features available. +dnl +dnl Some BSD platforms (originally FreeBSD, but copied by a few others) +dnl diverged from POSIX in 2002 by setting symbols which make all of the most +dnl recent features visible in the system header files unless the application +dnl overrides the corresponding test-macros. Doing that introduces portability +dnl problems. +dnl +dnl This macro makes a special check for the symbols used for this, to avoid a +dnl conflicting definition. +AC_DEFUN([CF_POSIX_VISIBLE], +[ +AC_CACHE_CHECK(if the POSIX test-macros are already defined,cf_cv_posix_visible,[ +AC_TRY_COMPILE([#include ],[ +#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ + && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ + && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ + && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) +#error conflicting symbols found +#endif +],[cf_cv_posix_visible=no],[cf_cv_posix_visible=yes]) +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_WAIT version: 4 updated: 2020/03/10 18:53:47 +dnl ------------- +dnl Check for POSIX wait support +AC_DEFUN([CF_POSIX_WAIT], +[ +AC_REQUIRE([AC_HEADER_SYS_WAIT]) +AC_CACHE_CHECK(for POSIX wait functions,cf_cv_posix_wait,[ +AC_TRY_LINK([ +#include +#include +#include +#ifdef HAVE_SYS_WAIT_H +#include +#endif +],[ + int stat_loc; + pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); + pid_t pid2 = wait(&stat_loc); + (void)pid; + (void)pid2; +], +[cf_cv_posix_wait=yes], +[cf_cv_posix_wait=no]) +]) +test "$cf_cv_posix_wait" = yes && AC_DEFINE(USE_POSIX_WAIT,1,[Define to 1 if we have POSIX wait functions]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROCFS_CWD version: 2 updated: 2007/03/12 20:39:04 +dnl ------------- +dnl Find /proc tree (may be in a different place) which implements the "cwd" +dnl link. +AC_DEFUN([CF_PROCFS_CWD],[ +AC_CACHE_CHECK(for proc tree with cwd-support,cf_cv_procfs_cwd,[ +cf_cv_procfs_cwd=no +for cf_path in /proc /compat/linux/proc /usr/compat/linux/proc +do + if test -d $cf_path && \ + test -d $cf_path/$$ && \ + ( test -d $cf_path/$$/cwd || \ + test -L $cf_path/$$/cwd ); then + cf_cv_procfs_cwd=$cf_path + break + fi +done +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_CC version: 5 updated: 2019/12/31 08:53:54 +dnl ---------- +dnl standard check for CC, plus followup sanity checks +dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name +AC_DEFUN([CF_PROG_CC],[ +CF_ACVERSION_CHECK(2.53, + [AC_MSG_WARN(this will incorrectly handle gnatgcc choice) + AC_REQUIRE([AC_PROG_CC])], + []) +ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)]) +CF_GCC_VERSION +CF_ACVERSION_CHECK(2.52, + [AC_PROG_CC_STDC], + [CF_ANSI_CC_REQD]) +CF_CC_ENV_FLAGS +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_GROFF version: 3 updated: 2018/01/07 13:16:19 +dnl ------------- +dnl Check if groff is available, for cases (such as html output) where nroff +dnl is not enough. +AC_DEFUN([CF_PROG_GROFF],[ +AC_PATH_PROG(GROFF_PATH,groff,no) +AC_PATH_PROGS(NROFF_PATH,nroff mandoc,no) +AC_PATH_PROG(TBL_PATH,tbl,cat) +if test "x$GROFF_PATH" = xno +then + NROFF_NOTE= + GROFF_NOTE="#" +else + NROFF_NOTE="#" + GROFF_NOTE= +fi +AC_SUBST(GROFF_NOTE) +AC_SUBST(NROFF_NOTE) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_LINT version: 4 updated: 2019/11/20 18:55:37 +dnl ------------ +AC_DEFUN([CF_PROG_LINT], +[ +AC_CHECK_PROGS(LINT, lint cppcheck splint) +case "x$LINT" in +(xcppcheck|x*/cppcheck) + test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" + ;; +esac +AC_SUBST(LINT_OPTS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_REGEX version: 14 updated: 2020/07/11 19:09:29 +dnl -------- +dnl Attempt to determine if we've got one of the flavors of regular-expression +dnl code that we can support. +AC_DEFUN([CF_REGEX], +[ + +cf_regex_func=no + +cf_regex_libs="regex re" +case $host_os in +(mingw*) + cf_regex_libs="systre gnurx $cf_regex_libs" + ;; +esac + +AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ + for cf_regex_lib in $cf_regex_libs + do + AC_CHECK_LIB($cf_regex_lib,regcomp,[ + CF_ADD_LIB($cf_regex_lib) + cf_regex_func=regcomp + break]) + done +]) + +if test "$cf_regex_func" = no ; then + AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ + AC_CHECK_LIB(gen,compile,[ + CF_ADD_LIB(gen) + cf_regex_func=compile])]) +fi + +if test "$cf_regex_func" = no ; then + AC_MSG_WARN(cannot find regular expression library) +fi + +AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ + +cf_cv_regex_hdrs=no +case $cf_regex_func in +(compile) + for cf_regex_hdr in regexp.h regexpr.h + do + AC_TRY_LINK([#include <$cf_regex_hdr>],[ + char *p = compile("", "", "", 0); + int x = step("", ""); + (void)p; + (void)x; + ],[ + cf_cv_regex_hdrs=$cf_regex_hdr + break + ]) + done + ;; +(*) + for cf_regex_hdr in regex.h + do + AC_TRY_LINK([#include +#include <$cf_regex_hdr>],[ + regex_t *p = 0; + int x = regcomp(p, "", 0); + int y = regexec(p, "", 0, 0, 0); + (void)x; + (void)y; + regfree(p); + ],[ + cf_cv_regex_hdrs=$cf_regex_hdr + break + ]) + done + ;; +esac + +]) + +case $cf_cv_regex_hdrs in + (no) AC_MSG_WARN(no regular expression header found) ;; + (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; + (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; + (regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS,1,[Define to 1 to include regexpr.h for regular expressions]) ;; +esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50 +dnl ---------------- +dnl Remove all -U and -D options that refer to the given symbol from a list +dnl of C compiler options. This works around the problem that not all +dnl compilers process -U and -D options from left-to-right, so a -U option +dnl cannot be used to cancel the effect of a preceding -D option. +dnl +dnl $1 = target (which could be the same as the source variable) +dnl $2 = source (including '$') +dnl $3 = symbol to remove +define([CF_REMOVE_DEFINE], +[ +$1=`echo "$2" | \ + sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \ + -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'` +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_RESTORE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:47:45 +dnl --------------------- +dnl Restore flags saved in CF_SAVE_XTRA_FLAGS +dnl $1 = name of current macro +define([CF_RESTORE_XTRA_FLAGS], +[ +LIBS="$cf_save_LIBS_$1" +CFLAGS="$cf_save_CFLAGS_$1" +CPPFLAGS="$cf_save_CPPFLAGS_$1" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 +dnl ------------- +AC_DEFUN([CF_RPATH_HACK], +[ +AC_REQUIRE([CF_LD_RPATH_OPT]) +AC_MSG_CHECKING(for updated LDFLAGS) +if test -n "$LD_RPATH_OPT" ; then + AC_MSG_RESULT(maybe) + + AC_CHECK_PROGS(cf_ldd_prog,ldd,no) + cf_rpath_list="/usr/lib /lib" + if test "$cf_ldd_prog" != no + then + cf_rpath_oops= + +AC_TRY_LINK([#include ], + [printf("Hello");], + [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` + cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) + + # If we passed the link-test, but get a "not found" on a given library, + # this could be due to inept reconfiguration of gcc to make it only + # partly honor /usr/local/lib (or whatever). Sometimes this behavior + # is intentional, e.g., installing gcc in /usr/bin and suppressing the + # /usr/local libraries. + if test -n "$cf_rpath_oops" + then + for cf_rpath_src in $cf_rpath_oops + do + for cf_rpath_dir in \ + /usr/local \ + /usr/pkg \ + /opt/sfw + do + if test -f $cf_rpath_dir/lib/$cf_rpath_src + then + CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) + LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" + break + fi + done + done + fi + fi + + CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS) + + CF_RPATH_HACK_2(LDFLAGS) + CF_RPATH_HACK_2(LIBS) + + CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(EXTRA_LDFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00 +dnl --------------- +dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to +dnl EXTRA_LDFLAGS for each -L option found. +dnl +dnl $cf_rpath_list contains a list of directories to ignore. +dnl +dnl $1 = variable name to update. The LDFLAGS variable should be the only one, +dnl but LIBS often has misplaced -L options. +AC_DEFUN([CF_RPATH_HACK_2], +[ +CF_VERBOSE(...checking $1 [$]$1) + +cf_rpath_dst= +for cf_rpath_src in [$]$1 +do + case $cf_rpath_src in + (-L*) + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp) + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +$1=$cf_rpath_dst + +CF_VERBOSE(...checked $1 [$]$1) +AC_SUBST(EXTRA_LDFLAGS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SAVE_XTRA_FLAGS version: 1 updated: 2020/01/11 16:46:44 +dnl ------------------ +dnl Use this macro to save CFLAGS/CPPFLAGS/LIBS before checks against X headers +dnl and libraries which do not update those variables. +dnl +dnl $1 = name of current macro +define([CF_SAVE_XTRA_FLAGS], +[ +cf_save_LIBS_$1="$LIBS" +cf_save_CFLAGS_$1="$CFLAGS" +cf_save_CPPFLAGS_$1="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[[IUD]]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SIGWINCH version: 3 updated: 2020/03/10 18:53:47 +dnl ----------- +dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all +dnl programs need this test). +dnl +dnl This is really a Mac OS X 10.4.3 workaround. Defining _POSIX_C_SOURCE +dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct +dnl winsize declaration is left alone - we may revisit this if Apple choose to +dnl break that part of the interface as well. +AC_DEFUN([CF_SIGWINCH], +[ +AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ + AC_TRY_COMPILE([ +#include +#include +],[int x = SIGWINCH; (void)x], + [cf_cv_define_sigwinch=yes], + [AC_TRY_COMPILE([ +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include +],[int x = SIGWINCH; (void)x], + [cf_cv_define_sigwinch=maybe], + [cf_cv_define_sigwinch=no]) +]) +]) + +if test "$cf_cv_define_sigwinch" = maybe ; then +AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ +cf_cv_fixup_sigwinch=unknown +cf_sigwinch=32 +while test $cf_sigwinch != 1 +do + AC_TRY_COMPILE([ +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include +],[ +#if SIGWINCH != $cf_sigwinch +make an error +#endif +int x = SIGWINCH; (void)x], + [cf_cv_fixup_sigwinch=$cf_sigwinch + break]) + +cf_sigwinch=`expr $cf_sigwinch - 1` +done +]) + + if test "$cf_cv_fixup_sigwinch" != unknown ; then + CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" + fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SIG_ATOMIC_T version: 5 updated: 2020/03/10 18:53:47 +dnl --------------- +dnl signal handler, but there are some gcc dependencies in that recommendation. +dnl Try anyway. +AC_DEFUN([CF_SIG_ATOMIC_T], +[ +AC_MSG_CHECKING(for signal global datatype) +AC_CACHE_VAL(cf_cv_sig_atomic_t,[ + for cf_type in \ + "volatile sig_atomic_t" \ + "sig_atomic_t" \ + "int" + do + AC_TRY_COMPILE([ +#include +#include +#include + +extern $cf_type x; +$cf_type x; +static void handler(int sig) +{ + (void)sig; + x = 5; +}], + [signal(SIGINT, handler); + x = 1], + [cf_cv_sig_atomic_t=$cf_type], + [cf_cv_sig_atomic_t=no]) + test "$cf_cv_sig_atomic_t" != no && break + done + ]) +AC_MSG_RESULT($cf_cv_sig_atomic_t) +test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_STRUCT_LASTLOG version: 3 updated: 2020/03/10 18:53:47 +dnl ----------------- +dnl Check for header defining struct lastlog, ensure that its .ll_time member +dnl is compatible with time(). +AC_DEFUN([CF_STRUCT_LASTLOG], +[ +AC_CHECK_HEADERS(lastlog.h) +AC_CACHE_CHECK(for struct lastlog,cf_cv_struct_lastlog,[ +AC_TRY_RUN([ +#include +#include +#include + +int main(void) +{ + struct lastlog data; + return (sizeof(data.ll_time) != sizeof(time_t)); +}],[ +cf_cv_struct_lastlog=yes],[ +cf_cv_struct_lastlog=no],[ +cf_cv_struct_lastlog=unknown])]) + +test $cf_cv_struct_lastlog != no && AC_DEFINE(USE_STRUCT_LASTLOG,1,[Define to 1 if we have struct lastlog]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SVR4 version: 5 updated: 2012/10/04 05:24:07 +dnl ------- +dnl Check if this is an SVR4 system. We need the definition for xterm +AC_DEFUN([CF_SVR4], +[ +AC_CHECK_LIB(elf, elf_begin,[ +AC_CACHE_CHECK(if this is an SVR4 system, cf_cv_svr4,[ +AC_TRY_COMPILE([ +#if defined(__CYGWIN__) +make an error +#endif +#include +#include +],[ +static struct termio d_tio; + d_tio.c_cc[VINTR] = 0; + d_tio.c_cc[VQUIT] = 0; + d_tio.c_cc[VERASE] = 0; + d_tio.c_cc[VKILL] = 0; + d_tio.c_cc[VEOF] = 0; + d_tio.c_cc[VEOL] = 0; + d_tio.c_cc[VMIN] = 0; + d_tio.c_cc[VTIME] = 0; + d_tio.c_cc[VLNEXT] = 0; +], +[cf_cv_svr4=yes], +[cf_cv_svr4=no]) +]) +]) +test "$cf_cv_svr4" = yes && AC_DEFINE(SVR4,1,[Define to 1 if this is an SVR4 system]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SYSV version: 16 updated: 2020/01/11 16:46:44 +dnl ------- +dnl Check if this is a SYSV platform, e.g., as used in , and whether +dnl defining it will be helpful. The following features are used to check: +dnl +dnl a) bona-fide SVSV doesn't use const for sys_errlist[]. Since this is a +dnl legacy (pre-ANSI) feature, const should not apply. Modern systems only +dnl declare strerror(). Xos.h declares the legacy form of str_errlist[], and +dnl a compile-time error will result from trying to assign to a const array. +dnl +dnl b) compile with headers that exist on SYSV hosts. +dnl +dnl c) compile with type definitions that differ on SYSV hosts from standard C. +AC_DEFUN([CF_SYSV], +[ +AC_REQUIRE([AC_PATH_XTRA]) + +CF_SAVE_XTRA_FLAGS([CF_SYSV]) + +AC_CHECK_HEADERS( \ +termios.h \ +stdlib.h \ +X11/Intrinsic.h \ +) + +AC_REQUIRE([CF_SYS_ERRLIST]) + +AC_CACHE_CHECK(if we should define SYSV,cf_cv_sysv,[ +AC_TRY_COMPILE([ +#undef SYSV +#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ +#ifdef HAVE_STDLIB_H +#include /* look for wchar_t */ +#endif +#ifdef HAVE_X11_INTRINSIC_H +#include /* Intrinsic.h has other traps... */ +#endif +#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ +#include +#define STRUCT_TERMIOS struct termios +#else +#define STRUCT_TERMIOS struct termio +#endif +#include +#include /* eliminate most BSD hacks */ +#include /* declare sys_errlist on older systems */ +#include /* eliminate most of the remaining ones */ +],[ +static STRUCT_TERMIOS d_tio; + d_tio.c_cc[VINTR] = 0; + d_tio.c_cc[VQUIT] = 0; + d_tio.c_cc[VERASE] = 0; + d_tio.c_cc[VKILL] = 0; + d_tio.c_cc[VEOF] = 0; + d_tio.c_cc[VEOL] = 0; + d_tio.c_cc[VMIN] = 0; + d_tio.c_cc[VTIME] = 0; +#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) +sys_errlist[0] = ""; /* Cygwin mis-declares this */ +#endif +], +[cf_cv_sysv=yes], +[cf_cv_sysv=no]) +]) +test "$cf_cv_sysv" = yes && AC_DEFINE(SYSV,1,[Define to 1 if this is an SYSV system]) + +CF_RESTORE_XTRA_FLAGS([CF_SYSV]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SYSV_UTMP version: 6 updated: 2012/10/04 20:12:20 +dnl ------------ +dnl Check if this is a SYSV flavor of UTMP +AC_DEFUN([CF_SYSV_UTMP], +[ +AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[ +test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" +AC_TRY_LINK([ +#include +#include <${cf_cv_have_utmp}.h>],[ +struct $cf_cv_have_utmp x; + set${cf_prefix}ent (); + get${cf_prefix}id(&x); + put${cf_prefix}line(&x); + end${cf_prefix}ent();], + [cf_cv_sysv_utmp=yes], + [cf_cv_sysv_utmp=no]) +]) +test $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP,1,[Define to 1 if utmp is SYSV flavor]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23 +dnl -------------- +dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and +dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our +dnl declaration. Reported by Keith Bostic. +AC_DEFUN([CF_SYS_ERRLIST], +[ + CF_CHECK_ERRNO(sys_nerr) + CF_CHECK_ERRNO(sys_errlist) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TERMIOS_TYPES version: 2 updated: 2020/03/10 18:53:47 +dnl ---------------- +dnl https://pubs.opengroup.org/onlinepubs/009695399/basedefs/termios.h.html +dnl says that tcflag_t, speed_t and cc_t are typedef'd. If they are not, +dnl fallback to historical values. +AC_DEFUN([CF_TERMIOS_TYPES],[ + +AC_CACHE_CHECK(for termios type tcflag_t, cf_cv_havetype_tcflag_t,[ + AC_TRY_COMPILE([#include ],[ + tcflag_t x = 0; (void)x], + [cf_cv_havetype_tcflag_t=yes], + [cf_cv_havetype_tcflag_t=no]) +]) +test "$cf_cv_havetype_tcflag_t" = no && AC_DEFINE(tcflag_t,unsigned long,[Define usable value of tcflag_t if not declared]) + +AC_CACHE_CHECK(for termios type speed_t, cf_cv_havetype_speed_t,[ + AC_TRY_COMPILE([#include ],[ + speed_t x = 0; (void)x], + [cf_cv_havetype_speed_t=yes], + [cf_cv_havetype_speed_t=no]) +]) +test "$cf_cv_havetype_speed_t" = no && AC_DEFINE(speed_t,unsigned short,[Define usable value of speed_t if not declared]) + +AC_CACHE_CHECK(for termios type cc_t, cf_cv_havetype_cc_t,[ + AC_TRY_COMPILE([#include ],[ + cc_t x = 0; (void)x], + [cf_cv_havetype_cc_t=yes], + [cf_cv_havetype_cc_t=no]) +]) +test "$cf_cv_havetype_cc_t" = no && AC_DEFINE(cc_t,unsigned char,[Define usable value of cc_t if not declared]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TERMIO_C_ISPEED version: 4 updated: 2020/03/10 18:53:47 +dnl ------------------ +dnl Check for SGI's broken redefinition of baud rates introduced in IRIX 6.5 +dnl (there doesn't appear to be a useful predefined symbol). +AC_DEFUN([CF_TERMIO_C_ISPEED], +[ +AC_CACHE_CHECK(for IRIX 6.5 baud-rate redefinitions,cf_cv_termio_c_ispeed,[ +AC_TRY_COMPILE([ +#include +#include ],[ +struct termio foo; +foo.c_ispeed = B38400; +foo.c_ospeed = B9600; +(void)foo; +],[cf_cv_termio_c_ispeed=yes +],[cf_cv_termio_c_ispeed=no]) +]) +test "$cf_cv_termio_c_ispeed" = yes && AC_DEFINE(HAVE_TERMIO_C_ISPEED,1,[define 1 if we have IRIX 6.5 baud-rate redefinitions]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TRIM_X_LIBS version: 3 updated: 2015/04/12 15:39:00 +dnl -------------- +dnl Trim extra base X libraries added as a workaround for inconsistent library +dnl dependencies returned by "new" pkg-config files. +AC_DEFUN([CF_TRIM_X_LIBS],[ + for cf_trim_lib in Xmu Xt X11 + do + case "$LIBS" in + (*-l$cf_trim_lib\ *-l$cf_trim_lib*) + LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` + CF_VERBOSE(..trimmed $LIBS) + ;; + esac + done +]) +dnl --------------------------------------------------------------------------- +dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 +dnl ----------------- +dnl This is a simple wrapper to use for pkg-config, for libraries which may be +dnl available in that form. +dnl +dnl $1 = package name +dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS +dnl $3 = logic to use if pkg-config does not have the package +AC_DEFUN([CF_TRY_PKG_CONFIG],[ +AC_REQUIRE([CF_PKG_CONFIG]) + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then + CF_VERBOSE(found package $1) + cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" + CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) + CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) + CF_ADD_CFLAGS($cf_pkgconfig_incs) + CF_ADD_LIBS($cf_pkgconfig_libs) + ifelse([$2],,:,[$2]) +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + ifelse([$3],,:,[$3]) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_TRY_XOPEN_SOURCE version: 2 updated: 2018/06/20 20:23:13 +dnl ------------------- +dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we +dnl can define it successfully. +AC_DEFUN([CF_TRY_XOPEN_SOURCE],[ +AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ + AC_TRY_COMPILE([ +#include +#include +#include +],[ +#ifndef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_xopen_source=no], + [cf_save="$CPPFLAGS" + CF_APPEND_TEXT(CPPFLAGS,-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE) + AC_TRY_COMPILE([ +#include +#include +#include +],[ +#ifdef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_xopen_source=no], + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) + CPPFLAGS="$cf_save" + ]) +]) + +if test "$cf_cv_xopen_source" != no ; then + CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) + CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + CF_ADD_CFLAGS($cf_temp_xopen_source) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_TTY_GROUP version: 10 updated: 2020/03/10 18:53:47 +dnl ------------ +dnl Check if the system has a tty-group defined. This is used in xterm when +dnl setting pty ownership. +AC_DEFUN([CF_TTY_GROUP], +[ +AC_MSG_CHECKING(for explicit tty group name) +AC_ARG_WITH(tty-group, + [ --with-tty-group=XXX use XXX for the tty-group], + [cf_tty_group=$withval], + [cf_tty_group=auto...]) +test -z "$cf_tty_group" && cf_tty_group=auto... +test "$cf_tty_group" = yes && cf_tty_group=auto... +AC_MSG_RESULT($cf_tty_group) + +if test "$cf_tty_group" = "auto..." ; then +AC_CACHE_CHECK(for tty group name,cf_cv_tty_group_name,[ + +# If we are configuring as root, it is hard to get a clue about the tty group. +# But we'll guess based on how our connection is set up - assuming it is done +# properly. + +cf_uid=`id | sed -e 's/^[^=]*=//' -e 's/(.*$//'` +# )vi +if test "$cf_uid" != 0 ; then +cf_cv_tty_group_name= +cf_tty_name=`tty` +test "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty +test -z "$cf_tty_name" && cf_tty_name=/dev/tty +if test -c "$cf_tty_name" +then + cf_option="-l -L" + + # Expect listing to have fields like this: + #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname + ls $cf_option $cf_tty_name >conftest.out + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest conftest.out + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest /dev/null 1>/dev/null ) then + cf_cv_tty_group_name="tty" + fi + ;; +esac +fi +]) +cf_tty_group="$cf_cv_tty_group_name" +else + # if configure option, always do this + AC_DEFINE(USE_TTY_GROUP,1,[Define to 1 if we have a tty groupname]) +fi + +AC_DEFINE_UNQUOTED(TTY_GROUP_NAME,"$cf_tty_group",[Define to the name use for tty group]) + +# This is only a double-check that the group-name we obtained above really +# does apply to the device. We cannot perform this test if we are in batch +# mode, or if we are cross-compiling. + +AC_CACHE_CHECK(if we may use the $cf_tty_group group,cf_cv_tty_group,[ +cf_tty_name=`tty` +if test "$cf_tty_name" != "not a tty" +then +AC_TRY_RUN([ +#include +#include +#include +#include +int main(void) +{ + struct stat sb; + struct group *ttygrp = getgrnam(TTY_GROUP_NAME); + char *name = ttyname(0); + + endgrent(); + if (ttygrp != 0 + && name != 0 + && stat(name, &sb) == 0 + && sb.st_gid != getgid() + && sb.st_gid == ttygrp->gr_gid) { + ${cf_cv_main_return:-return} (0); + } + ${cf_cv_main_return:-return} (1); +} + ], + [cf_cv_tty_group=yes], + [cf_cv_tty_group=no], + [cf_cv_tty_group=unknown]) +elif test "$cross_compiling" = yes; then + cf_cv_tty_group=unknown +else + cf_cv_tty_group=yes +fi +]) + +if test $cf_cv_tty_group = no ; then + AC_MSG_WARN(Cannot use $cf_tty_group group) +else + AC_DEFINE(USE_TTY_GROUP) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TYPE_CC_T version: 3 updated: 2020/03/10 18:53:47 +dnl ------------ +dnl Check for cc_t type, used in termio. +AC_DEFUN([CF_TYPE_CC_T], +[ +AC_MSG_CHECKING(for cc_t in or ) +AC_CACHE_VAL(cf_cv_type_cc_t,[ + AC_TRY_COMPILE([ +#include +#if defined(HAVE_TERMIOS_H) +#include +#else +#include +#include +#endif +], + [cc_t x; (void)x], + [cf_cv_type_cc_t=yes], + [cf_cv_type_cc_t=no]) + ]) +AC_MSG_RESULT($cf_cv_type_cc_t) +test $cf_cv_type_cc_t = no && AC_DEFINE(cc_t, unsigned char,[Define to cc_t type used in termio]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TYPE_FD_MASK version: 3 updated: 2012/10/04 06:57:36 +dnl --------------- +dnl Check for the declaration of fd_mask, which is like fd_set, associated +dnl with select(). The check for fd_set should have pulled in this as well, +dnl but there is a special case for Mac OS X, possibly other BSD-derived +dnl platforms. +AC_DEFUN([CF_TYPE_FD_MASK], +[ +AC_REQUIRE([CF_TYPE_FD_SET]) + +AC_CACHE_CHECK(for declaration of fd_mask,cf_cv_type_fd_mask,[ + if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then + AC_TRY_COMPILE([ +#include ],[fd_mask x],, + [CF_MSG_LOG(if we must define CSRG_BASED) +# Xosdefs.h on Mac OS X may not define this (but it should). + AC_TRY_COMPILE([ +#define CSRG_BASED +#include ],[fd_mask x], + cf_cv_type_fd_mask=CSRG_BASED)]) + else + cf_cv_type_fd_mask=$cf_cv_type_fd_set + fi +]) +if test x$cf_cv_type_fd_mask = xCSRG_BASED ; then + AC_DEFINE(CSRG_BASED,1,[Define to 1 if needed for declaring fd_mask()]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_TYPE_FD_SET version: 6 updated: 2020/03/10 18:53:47 +dnl -------------- +dnl Check for the declaration of fd_set. Some platforms declare it in +dnl , and some in , which requires . +dnl Finally, if we are using this for an X application, Xpoll.h may include +dnl , so we don't want to do it twice. +AC_DEFUN([CF_TYPE_FD_SET], +[ +AC_CHECK_HEADERS(X11/Xpoll.h) + +AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set, + [CF_MSG_LOG(sys/types alone) +AC_TRY_COMPILE([ +#include ], + [fd_set x; (void)x], + [cf_cv_type_fd_set=sys/types.h], + [CF_MSG_LOG(X11/Xpoll.h) +AC_TRY_COMPILE([ +#ifdef HAVE_X11_XPOLL_H +#include +#endif], + [fd_set x; (void)x], + [cf_cv_type_fd_set=X11/Xpoll.h], + [CF_MSG_LOG(sys/select.h) +AC_TRY_COMPILE([ +#include +#include ], + [fd_set x; (void)x], + [cf_cv_type_fd_set=sys/select.h], + [cf_cv_type_fd_set=unknown])])])]) +if test $cf_cv_type_fd_set = sys/select.h ; then + AC_DEFINE(USE_SYS_SELECT_H,1,[Define to 1 to include sys/select.h to declare fd_set]) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_UNDO_CFLAGS version: 1 updated: 2011/07/02 09:27:51 +dnl -------------- +dnl Remove flags from $CFLAGS or similar shell variable using sed. +dnl $1 = variable +dnl $2 = message +dnl $3 = pattern to remove +AC_DEFUN([CF_UNDO_CFLAGS], +[ + CF_VERBOSE(removing $2 flags from $1) + $1=`echo "[$]$1" | sed -e 's/$3//'` + CF_VERBOSE(...result [$]$1) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59 +dnl -------- +dnl Make an uppercase version of a variable +dnl $1=uppercase($2) +AC_DEFUN([CF_UPPER], +[ +$1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTEMPTER version: 4 updated: 2012/10/04 20:12:20 +dnl ----------- +dnl Try to link with utempter library +AC_DEFUN([CF_UTEMPTER], +[ +AC_CACHE_CHECK(if we can link with utempter library,cf_cv_have_utempter,[ +cf_save_LIBS="$LIBS" +CF_ADD_LIB(utempter) +AC_TRY_LINK([ +#include +],[ + addToUtmp("/dev/tty", 0, 1); + removeFromUtmp(); +],[ + cf_cv_have_utempter=yes],[ + cf_cv_have_utempter=no]) +LIBS="$cf_save_LIBS" +]) +if test "$cf_cv_have_utempter" = yes ; then + AC_DEFINE(USE_UTEMPTER,1,[Define to 1 if we can/should link with utempter]) + CF_ADD_LIB(utempter) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP version: 11 updated: 2020/03/10 18:53:47 +dnl ------- +dnl Check for UTMP/UTMPX headers +AC_DEFUN([CF_UTMP], +[ +AC_REQUIRE([CF_LASTLOG]) + +AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[ + cf_cv_have_utmp=no +for cf_header in utmpx utmp ; do +cf_utmp_includes=" +#include +#include <${cf_header}.h> +#define getutent getutxent +#ifdef USE_LASTLOG +#include /* may conflict with utmpx.h on Linux */ +#endif +" + AC_TRY_COMPILE([$cf_utmp_includes], + [struct $cf_header x; + char *name = x.ut_name; /* utmp.h and compatible definitions */ + (void)x; + (void)name; + ], + [cf_cv_have_utmp=$cf_header + break], + [ + AC_TRY_COMPILE([$cf_utmp_includes], + [struct $cf_header x; + char *name = x.ut_user; /* utmpx.h must declare this */ + (void)x; + (void)name; + ], + [cf_cv_have_utmp=$cf_header + break + ])]) +done +]) + +if test $cf_cv_have_utmp != no ; then + AC_DEFINE(HAVE_UTMP,1,[Define to 1 if the utmp interface is available]) + test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP,1,[Define if we have utmpx interface]) + CF_UTMP_UT_HOST + CF_UTMP_UT_SYSLEN + CF_UTMP_UT_NAME + CF_UTMP_UT_XSTATUS + CF_UTMP_UT_XTIME + CF_UTMP_UT_SESSION + CF_SYSV_UTMP +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP_GROUP version: 1 updated: 2005/10/06 20:29:29 +dnl ------------- +dnl Find the utmp/utmpx file and determine its group to allow setgid programs +dnl to manipulate it, e.g., when there is no intermediary. +AC_DEFUN([CF_UTMP_GROUP],[ +AC_REQUIRE([CF_UTMP]) +if test $cf_cv_have_utmp != no ; then +AC_CACHE_CHECK(for utmp/utmpx group,cf_cv_utmp_group,[ +for cf_utmp_path in /var/adm /var/run +do + for cf_utmp_file in utmpx utmp + do + if test -f $cf_utmp_path/$cf_utmp_file + then + cf_cv_utmp_group=root + + cf_option="-l -L" + + # Expect listing to have fields like this: + #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname + ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest conftest + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest +#include <${cf_cv_have_utmp}.h>], + [struct $cf_cv_have_utmp x; + char *y = &x.ut_host[0]; + (void)x; + (void)y], + [cf_cv_have_utmp_ut_host=yes], + [cf_cv_have_utmp_ut_host=no]) + ]) +AC_MSG_RESULT($cf_cv_have_utmp_ut_host) +test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST,1,[Define to 1 if UTMP/UTMPX struct defines ut_host member]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP_UT_NAME version: 7 updated: 2020/03/10 18:53:47 +dnl --------------- +dnl Check if UTMP/UTMPX struct defines ut_name member +AC_DEFUN([CF_UTMP_UT_NAME], +[ +if test $cf_cv_have_utmp != no ; then +AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[ + cf_cv_have_utmp_ut_name=no +cf_utmp_includes=" +#include +#include <${cf_cv_have_utmp}.h> +#define getutent getutxent +#ifdef USE_LASTLOG +#include /* may conflict with utmpx.h on Linux */ +#endif +" +for cf_header in ut_name ut_user ; do + AC_TRY_COMPILE([$cf_utmp_includes], + [struct $cf_cv_have_utmp x; + char *name = x.$cf_header; + (void)x; + (void)name; + ], + [cf_cv_have_utmp_ut_name=$cf_header + break]) +done +]) + +case $cf_cv_have_utmp_ut_name in +(no) + AC_MSG_ERROR(Cannot find declaration for ut.ut_name) + ;; +(ut_user) + AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member]) + ;; +esac +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP_UT_SESSION version: 7 updated: 2020/03/10 18:53:47 +dnl ------------------ +dnl Check if UTMP/UTMPX struct defines ut_session member +AC_DEFUN([CF_UTMP_UT_SESSION], +[ +if test $cf_cv_have_utmp != no ; then +AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[ + AC_TRY_COMPILE([ +#include +#include <${cf_cv_have_utmp}.h>], + [struct $cf_cv_have_utmp x; + long y = x.ut_session; + (void)x; + (void)y], + [cf_cv_have_utmp_ut_session=yes], + [cf_cv_have_utmp_ut_session=no]) +]) +if test $cf_cv_have_utmp_ut_session != no ; then + AC_DEFINE(HAVE_UTMP_UT_SESSION,1,[Define to 1 if UTMP/UTMPX struct defines ut_session member]) +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP_UT_SYSLEN version: 3 updated: 2020/03/10 18:53:47 +dnl ----------------- +dnl Check if UTMP/UTMPX struct defines ut_syslen member +AC_DEFUN([CF_UTMP_UT_SYSLEN], +[ +if test $cf_cv_have_utmp != no ; then +AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared) +AC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[ + AC_TRY_COMPILE([ +#include +#include <${cf_cv_have_utmp}.h>], + [struct $cf_cv_have_utmp x; + int y = x.ut_syslen; + (void)x; + (void)y], + [cf_cv_have_utmp_ut_syslen=yes], + [cf_cv_have_utmp_ut_syslen=no]) + ]) +AC_MSG_RESULT($cf_cv_have_utmp_ut_syslen) +test $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN,1,[Define to 1 if UTMP/UTMPX struct defines ut_syslen member]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP_UT_XSTATUS version: 5 updated: 2020/03/10 18:53:47 +dnl ------------------ +dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported +dnl by various people: +dnl +dnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2) +dnl ut_exit.e_exit (SVR4) +dnl ut_exit.ut_e_exit (os390 - Greg Smith) +dnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala) +dnl +dnl Note: utmp_xstatus is not a conventional compatibility definition in the +dnl system header files. +AC_DEFUN([CF_UTMP_UT_XSTATUS], +[ +if test $cf_cv_have_utmp != no ; then +AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[ +for cf_result in \ + ut_exit.__e_exit \ + ut_exit.e_exit \ + ut_exit.ut_e_exit \ + ut_exit.ut_exit +do +AC_TRY_COMPILE([ +#include +#include <${cf_cv_have_utmp}.h>], + [struct $cf_cv_have_utmp x; + long y = x.$cf_result = 0; + (void)x; + (void)y], + [cf_cv_have_utmp_ut_xstatus=$cf_result + break], + [cf_cv_have_utmp_ut_xstatus=no]) +done +]) +if test $cf_cv_have_utmp_ut_xstatus != no ; then + AC_DEFINE(HAVE_UTMP_UT_XSTATUS,1,[Define to 1 if UTMP/UTMPX has exit-status member]) + AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus,[Define if needed to rename member ut_xstatus of UTMP/UTMPX]) +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_UTMP_UT_XTIME version: 10 updated: 2020/03/10 18:53:47 +dnl ---------------- +dnl Check if UTMP/UTMPX struct defines ut_xtime member +AC_DEFUN([CF_UTMP_UT_XTIME], +[ +if test $cf_cv_have_utmp != no ; then +AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[ + AC_TRY_COMPILE([ +#include +#include <${cf_cv_have_utmp}.h>], + [struct $cf_cv_have_utmp x; + long y = x.ut_xtime = 0; + (void)x; + (void)y], + [cf_cv_have_utmp_ut_xtime=yes], + [AC_TRY_COMPILE([ +#include +#include <${cf_cv_have_utmp}.h>], + [struct $cf_cv_have_utmp x; + long y = x.ut_tv.tv_sec; + (void)x; + (void)y], + [cf_cv_have_utmp_ut_xtime=define], + [cf_cv_have_utmp_ut_xtime=no]) + ]) +]) +if test $cf_cv_have_utmp_ut_xtime != no ; then + AC_DEFINE(HAVE_UTMP_UT_XTIME,1,[Define to 1 if UTMP/UTMPX struct defines ut_xtime member]) + if test $cf_cv_have_utmp_ut_xtime = define ; then + AC_DEFINE(ut_xtime,ut_tv.tv_sec,[Define if needed to alternate name for utmpx.ut_xtime member]) + fi +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12 +dnl ---------- +dnl Use AC_VERBOSE w/o the warnings +AC_DEFUN([CF_VERBOSE], +[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG +CF_MSG_LOG([$1]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_APP_CLASS version: 3 updated: 2015/04/12 15:39:00 +dnl ----------------- +dnl Handle configure option "--with-app-class", setting the $APP_CLASS +dnl variable, used for X resources. +dnl +dnl $1 = default value. +AC_DEFUN([CF_WITH_APP_CLASS],[ +AC_MSG_CHECKING(for X applications class) +AC_ARG_WITH(app-class, + [ --with-app-class=XXX override X applications class (default $1)], + [APP_CLASS=$withval], + [APP_CLASS=$1]) + +case x$APP_CLASS in +(*[[/@,%]]*) + AC_MSG_WARN(X applications class cannot contain punctuation) + APP_CLASS=$1 + ;; +(x[[A-Z]]*) + ;; +(*) + AC_MSG_WARN([X applications class must start with capital, ignoring $APP_CLASS]) + APP_CLASS=$1 + ;; +esac + +AC_MSG_RESULT($APP_CLASS) + +AC_SUBST(APP_CLASS) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_APP_DEFAULTS version: 6 updated: 2015/01/02 09:05:50 +dnl -------------------- +dnl Handle configure option "--with-app-defaults", setting these shell +dnl variables: +dnl +dnl $APPSDIR is the option value, used for installing app-defaults files. +dnl $no_appsdir is a "#" (comment) if "--without-app-defaults" is given. +dnl +dnl Most Linux's use this: +dnl /usr/share/X11/app-defaults +dnl Debian uses this: +dnl /etc/X11/app-defaults +dnl DragonFlyBSD ports uses this: +dnl /usr/pkg/lib/X11/app-defaults +dnl FreeBSD ports use these: +dnl /usr/local/lib/X11/app-defaults +dnl /usr/local/share/X11/app-defaults +dnl Mandriva has these: +dnl /usr/lib/X11/app-defaults +dnl /usr/lib64/X11/app-defaults +dnl NetBSD has these +dnl /usr/X11R7/lib/X11/app-defaults +dnl OpenSolaris uses +dnl 32-bit: +dnl /usr/X11/etc/X11/app-defaults +dnl /usr/X11/share/X11/app-defaults +dnl /usr/X11/lib/X11/app-defaults +dnl OSX uses +dnl /opt/local/share/X11/app-defaults (MacPorts) +dnl /opt/X11/share/X11/app-defaults (non-ports) +dnl 64-bit: +dnl /usr/X11/etc/X11/app-defaults +dnl /usr/X11/share/X11/app-defaults (I mkdir'd this) +dnl /usr/X11/lib/amd64/X11/app-defaults +dnl Solaris10 uses (in this order): +dnl /usr/openwin/lib/X11/app-defaults +dnl /usr/X11/lib/X11/app-defaults +AC_DEFUN([CF_WITH_APP_DEFAULTS],[ +AC_MSG_CHECKING(for directory to install resource files) +AC_ARG_WITH(app-defaults, + [ --with-app-defaults=DIR directory in which to install resource files (EPREFIX/lib/X11/app-defaults)], + [APPSDIR=$withval], + [APPSDIR='${exec_prefix}/lib/X11/app-defaults']) + +if test "x[$]APPSDIR" = xauto +then + APPSDIR='${exec_prefix}/lib/X11/app-defaults' + for cf_path in \ + /opt/local/share/X11/app-defaults \ + /opt/X11/share/X11/app-defaults \ + /usr/share/X11/app-defaults \ + /usr/X11/share/X11/app-defaults \ + /usr/X11/lib/X11/app-defaults \ + /usr/lib/X11/app-defaults \ + /etc/X11/app-defaults \ + /usr/pkg/lib/X11/app-defaults \ + /usr/X11R7/lib/X11/app-defaults \ + /usr/X11R6/lib/X11/app-defaults \ + /usr/X11R5/lib/X11/app-defaults \ + /usr/X11R4/lib/X11/app-defaults \ + /usr/local/lib/X11/app-defaults \ + /usr/local/share/X11/app-defaults \ + /usr/lib64/X11/app-defaults + do + if test -d "$cf_path" ; then + APPSDIR="$cf_path" + break + fi + done +else + cf_path=$APPSDIR + CF_PATH_SYNTAX(cf_path) +fi + +AC_MSG_RESULT($APPSDIR) +AC_SUBST(APPSDIR) + +no_appsdir= +if test "$APPSDIR" = no +then + no_appsdir="#" +else + EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(APPSDIR)" +fi +AC_SUBST(no_appsdir) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47 +dnl ---------------- +dnl Configure-option for dbmalloc. The optional parameter is used to override +dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. +AC_DEFUN([CF_WITH_DBMALLOC],[ +CF_NO_LEAKS_OPTION(dbmalloc, + [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], + [USE_DBMALLOC]) + +if test "$with_dbmalloc" = yes ; then + AC_CHECK_HEADER(dbmalloc.h, + [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_DESKTOP_CATEGORY version: 5 updated: 2015/04/12 15:39:00 +dnl ------------------------ +dnl Taking into account the absence of standardization of desktop categories +dnl take a look to see whether other applications on the current system are +dnl assigned any/all of a set of suggested categories. +dnl +dnl $1 = program name +dnl $2 = case-pattern to match comparable desktop files to obtain category +dnl This pattern may contain wildcards. +dnl $3 = suggested categories, also a case-pattern but without wildcards, +dnl since it doubles as a default value for a shell case-statement. +dnl $4 = categories to use if no match is found on the build-machine for the +dnl --with-desktop-category "auto" setting. +dnl +dnl The macro tells the configure script to substitute the $DESKTOP_CATEGORY +dnl value. +AC_DEFUN([CF_WITH_DESKTOP_CATEGORY],[ +AC_REQUIRE([CF_DISABLE_DESKTOP]) + +if test -z "$desktop_utils" +then + AC_MSG_CHECKING(for requested desktop-category) + AC_ARG_WITH(desktop-category, + [ --with-desktop-category=XXX one or more desktop catgories or auto], + [cf_desktop_want=$withval], + [cf_desktop_want=auto]) + AC_MSG_RESULT($cf_desktop_want) + + if test "$cf_desktop_want" = auto + then + rm -rf conftest* + cf_desktop_also= + for cf_desktop_dir in \ + /usr/share/app-install \ + /usr/share/applications + do + if test -d $cf_desktop_dir + then + find $cf_desktop_dir -name '*.desktop' | \ + while true + do + read cf_desktop_path + test -z "$cf_desktop_path" && break + cf_desktop_name=`basename $cf_desktop_path .desktop` + case $cf_desktop_name in + ($1|*-$1|$2) + CF_VERBOSE(inspect $cf_desktop_path) + egrep '^Categories=' $cf_desktop_path | \ + tr ';' '\n' | \ + sed -e 's%^.*=%%' -e '/^$/d' >>conftest.1 + ;; + esac + done + fi + done + if test -s conftest.1 + then + cf_desktop_last= + sort conftest.1 | \ + while true + do + read cf_desktop_this + test -z "$cf_desktop_this" && break + case $cf_desktop_this in + (Qt*|GTK*|KDE*|GNOME*|*XFCE*|*Xfce*) + ;; + ($3) + test "x$cf_desktop_last" != "x$cf_desktop_this" && echo $cf_desktop_this >>conftest.2 + ;; + esac + cf_desktop_last=$cf_desktop_this + done + cf_desktop_want=`cat conftest.2 | tr '\n' ';'` + fi + if test -n "$cf_desktop_want" + then + if test "$cf_desktop_want" = auto + then + cf_desktop_want= + else + # do a sanity check on the semicolon-separated list, ignore on failure + cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/[[^;]]//g'` + test -z "$cf_desktop_test" && cf_desktop_want= + cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/^.*;$/./g'` + test -z "$cf_desktop_test" && cf_desktop_want= + fi + fi + if test -z "$cf_desktop_want" + then + cf_desktop_want="ifelse([$4],,ifelse([$3],,[Application;],[`echo "$3" | sed -e 's/\*//g' -e 's/|/;/g' -e 's/[[;]]*$/;/g'`]),[$4])" + CF_VERBOSE(no usable value found for desktop category, using $cf_desktop_want) + fi + fi + DESKTOP_CATEGORY=`echo "$cf_desktop_want" | sed -e 's/[[ ,]]/;/g'` + CF_VERBOSE(will use Categories=$DESKTOP_CATEGORY) + AC_SUBST(DESKTOP_CATEGORY) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47 +dnl --------------- +dnl Configure-option for dmalloc. The optional parameter is used to override +dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. +AC_DEFUN([CF_WITH_DMALLOC],[ +CF_NO_LEAKS_OPTION(dmalloc, + [ --with-dmalloc test: use Gray Watson's dmalloc library], + [USE_DMALLOC]) + +if test "$with_dmalloc" = yes ; then + AC_CHECK_HEADER(dmalloc.h, + [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_ICONDIR version: 5 updated: 2012/07/22 09:18:02 +dnl --------------- +dnl Handle configure option "--with-icondir", setting these shell variables: +dnl +dnl $ICONDIR is the option value, used for installing icon files. +dnl $no_icondir is a "#" (comment) if "--without-icondir" is given. +AC_DEFUN([CF_WITH_ICONDIR],[ +AC_MSG_CHECKING(for directory to install icons) +AC_ARG_WITH(icondir, + [ --with-icondir=DIR directory in which to install icons for desktop], + [ICONDIR=$withval], + [test -z "$ICONDIR" && ICONDIR=no]) + +if test "x[$]ICONDIR" = xauto +then + ICONDIR='${datadir}/icons' + for cf_path in \ + /usr/share/icons \ + /usr/X11R6/share/icons + do + if test -d "$cf_path" ; then + ICONDIR="$cf_path" + break + fi + done +else + cf_path=$ICONDIR + CF_PATH_SYNTAX(cf_path) +fi +AC_MSG_RESULT($ICONDIR) +AC_SUBST(ICONDIR) + +no_icondir= +if test "$ICONDIR" = no +then + no_icondir="#" +else + EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(ICONDIR)" +fi +AC_SUBST(no_icondir) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_ICON_NAME version: 3 updated: 2015/04/12 15:39:00 +dnl ----------------- +dnl Allow a default icon-name to be overridden. +dnl $1 = default icon name +AC_DEFUN([CF_WITH_ICON_NAME],[ +AC_MSG_CHECKING(for the icon name) +AC_ARG_WITH(icon-name, + [ --with-icon-name=XXXX override icon name (default: $1)], + [ICON_NAME="$withval"], + [ICON_NAME=$1]) +case "x$ICON_NAME" in +(xyes|xno|x) + ICON_NAME=$1 + ;; +esac +AC_SUBST(ICON_NAME) +AC_MSG_RESULT($ICON_NAME) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_ICON_SYMLINK version: 2 updated: 2015/04/12 15:39:00 +dnl -------------------- +dnl Workaround for systems which are (mis)configured to map all icon references +dnl for xterm into "xterm" name. For instance, recent (2013) KDE ignores both +dnl the name given in the .desktop file (xterm-color) and the application name +dnl (xterm-dev). +dnl +dnl $1 = default icon name to use if symlink is wanted +AC_DEFUN([CF_WITH_ICON_SYMLINK],[ +AC_MSG_CHECKING(for icon symlink to use) +AC_ARG_WITH(icon-symlink, + [ --with-icon-symlink=XXX make symbolic link for icon name (default: $1)], + [ICON_SYMLINK="$withval"], + [ICON_SYMLINK=NONE]) +case "x$ICON_SYMLINK" in +(xyes) + ICON_SYMLINK=$1 + ;; +(xno|x) + ICON_SYMLINK=NONE + ;; +esac +AC_SUBST(ICON_SYMLINK) +AC_MSG_RESULT($ICON_SYMLINK) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_ICON_THEME version: 12 updated: 2018/04/30 19:37:35 +dnl ------------------ +dnl If asked, check for prerequisites and setup symbols to permit installing +dnl one or more application icons in the Red Hat icon-theme directory +dnl hierarchy. +dnl +dnl If the prerequisites are missing, give a warning and revert to the long- +dnl standing pixmaps directory. +dnl +dnl Parameters: +dnl +dnl $1 = application icon. This can be a list, and is not optional. +dnl $2 = default theme (defaults to hicolor) +dnl $3 = formats (defaults to list [.svg .png .xpm]) +dnl $4 = alternate icon if no theme is used (defaults to $1). +dnl +dnl Result: +dnl ICON_NAME = basename of first item in $1, unless already set +dnl ICON_LIST = reprocessed $1 +dnl ICON_THEME = reprocessed $2 +dnl ICON_FORMAT = reprocessed $3 +AC_DEFUN([CF_WITH_ICON_THEME], +[ +ifelse([$1],,[ + AC_MSG_ERROR([macro [CF_WITH_ICON_THEME] requires application-icon name]) +],[ + +CF_WITH_PIXMAPDIR +CF_WITH_ICONDIR + +AC_MSG_CHECKING(if icon theme should be used) +AC_ARG_WITH(icon-theme, + [ --with-icon-theme=XXX install icons into desktop theme (hicolor)], + [ICON_THEME=$withval], + [ICON_THEME=no]) + +case "x$ICON_THEME" in +(xno) + ;; +(x|xyes) + ICON_THEME=ifelse([$2],,hicolor,$2) + ;; +esac +AC_MSG_RESULT($ICON_THEME) + +if test "x$ICON_THEME" = xno +then + if test "x$ICONDIR" != xno + then + CF_VERBOSE(ignoring icondir without theme) + no_icondir="#" + fi +else + if test "x$ICONDIR" = xno + then + AC_MSG_ERROR(icondir must be set for icon theme) + fi +fi + +: ${ICON_FORMAT:=ifelse([$3],,[".svg .png .xpm"],[$3])} + +ICON_LIST= + +ifelse([$4],,[cf_icon_list=$1],[ +if test "x$ICON_THEME" != xno +then + cf_icon_list="$1" +else + cf_icon_list="$4" +fi +]) + +AC_MSG_CHECKING([for icon(s) to install]) +for cf_name in $cf_icon_list +do + CF_VERBOSE(using $ICON_FORMAT) + for cf_suffix in $ICON_FORMAT + do + cf_icon="${cf_name}${cf_suffix}" + cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` + if test ! -f "${cf_left}" + then + if test "x$srcdir" != "x." + then + cf_icon="${srcdir}/${cf_left}" + cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` + if test ! -f "${cf_left}" + then + continue + fi + else + continue + fi + fi + if test "x$ICON_THEME" != xno + then + cf_base=`basename $cf_left` + cf_trim=`echo "$cf_base" | sed -e 's/_[[0-9]][[0-9]]x[[0-9]][[0-9]]\././'` + case "x${cf_base}" in + (*:*) + cf_next=$cf_base + # user-defined mapping + ;; + (*.png) + cf_size=`file "$cf_left"|sed -e 's/^[[^:]]*://' -e 's/^.*[[^0-9]]\([[0-9]][[0-9]]* x [[0-9]][[0-9]]*\)[[^0-9]].*$/\1/' -e 's/ //g'` + if test -z "$cf_size" + then + AC_MSG_WARN(cannot determine size of $cf_left) + continue + fi + cf_next="$cf_size/apps/$cf_trim" + ;; + (*.svg) + cf_next="scalable/apps/$cf_trim" + ;; + (*.xpm) + CF_VERBOSE(ignored XPM file in icon theme) + continue + ;; + (*_[[0-9]][[0-9]]*x[[0-9]][[0-9]]*.*) + cf_size=`echo "$cf_left"|sed -e 's/^.*_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\..*$/\1/'` + cf_left=`echo "$cf_left"|sed -e 's/^\(.*\)_\([[0-9]][[0-9]]*x[[0-9]][[0-9]]*\)\(\..*\)$/\1\3/'` + cf_next="$cf_size/apps/$cf_base" + ;; + esac + CF_VERBOSE(adding $cf_next) + cf_icon="${cf_icon}:${cf_next}" + fi + test -n "$ICON_LIST" && ICON_LIST="$ICON_LIST " + ICON_LIST="$ICON_LIST${cf_icon}" + if test -z "$ICON_NAME" + then + ICON_NAME=`basename $cf_icon | sed -e 's/[[.:]].*//'` + fi + done +done + +if test -n "$verbose" +then + AC_MSG_CHECKING(result) +fi +AC_MSG_RESULT($ICON_LIST) + +if test -z "$ICON_LIST" +then + AC_MSG_ERROR(no icons found) +fi +]) + +AC_MSG_CHECKING(for icon name) +AC_MSG_RESULT($ICON_NAME) + +AC_SUBST(ICON_FORMAT) +AC_SUBST(ICON_THEME) +AC_SUBST(ICON_LIST) +AC_SUBST(ICON_NAME) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_IMAKE_CFLAGS version: 10 updated: 2015/04/12 15:39:00 +dnl -------------------- +dnl xterm and similar programs build more readily when propped up with imake's +dnl hand-tuned definitions. If we do not use imake, provide fallbacks for the +dnl most common definitions that we're not likely to do by autoconf tests. +AC_DEFUN([CF_WITH_IMAKE_CFLAGS],[ +AC_REQUIRE([CF_ENABLE_NARROWPROTO]) + +AC_MSG_CHECKING(if we should use imake to help) +CF_ARG_DISABLE(imake, + [ --disable-imake disable use of imake for definitions], + [enable_imake=no], + [enable_imake=yes]) +AC_MSG_RESULT($enable_imake) + +if test "$enable_imake" = yes ; then + CF_IMAKE_CFLAGS(ifelse([$1],,,[$1])) +fi + +if test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then + CF_ADD_CFLAGS($IMAKE_CFLAGS) +else + IMAKE_CFLAGS= + IMAKE_LOADFLAGS= + CF_VERBOSE(make fallback definitions) + + # We prefer config.guess' values when we can get them, to avoid + # inconsistent results with uname (AIX for instance). However, + # config.guess is not always consistent either. + case $host_os in + (*[[0-9]].[[0-9]]*) + UNAME_RELEASE="$host_os" + ;; + (*) + UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown + ;; + esac + + case .$UNAME_RELEASE in + (*[[0-9]].[[0-9]]*) + OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/\..*//'` + OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[[^0-9]]*//' -e 's/^[[^.]]*\.//' -e 's/\..*//' -e 's/[[^0-9]].*//' ` + test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 + test -z "$OSMINORVERSION" && OSMINORVERSION=0 + IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" + ;; + esac + + # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some + # fallback/fragments for NeedPrototypes, etc. + IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" + + # If this is not set properly, Xaw's scrollbars will not work + if test "$enable_narrowproto" = yes ; then + IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" + fi + + # Other special definitions: + case $host_os in + (aix*) + # imake on AIX 5.1 defines AIXV3. really. + IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" + ;; + (irix[[56]].*) + # these are needed to make SIGWINCH work in xterm + IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" + ;; + esac + + CF_ADD_CFLAGS($IMAKE_CFLAGS) + + AC_SUBST(IMAKE_CFLAGS) + AC_SUBST(IMAKE_LOADFLAGS) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_MAN2HTML version: 8 updated: 2018/06/27 18:44:03 +dnl ---------------- +dnl Check for man2html and groff. Prefer man2html over groff, but use groff +dnl as a fallback. See +dnl +dnl http://invisible-island.net/scripts/man2html.html +dnl +dnl Generate a shell script which hides the differences between the two. +dnl +dnl We name that "man2html.tmp". +dnl +dnl The shell script can be removed later, e.g., using "make distclean". +AC_DEFUN([CF_WITH_MAN2HTML],[ +AC_REQUIRE([CF_PROG_GROFF]) + +case "x${with_man2html}" in +(xno) + cf_man2html=no + ;; +(x|xyes) + AC_PATH_PROG(cf_man2html,man2html,no) + case "x$cf_man2html" in + (x/*) + AC_MSG_CHECKING(for the modified Earl Hood script) + if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) + then + cf_man2html_ok=yes + else + cf_man2html=no + cf_man2html_ok=no + fi + AC_MSG_RESULT($cf_man2html_ok) + ;; + (*) + cf_man2html=no + ;; + esac +esac + +AC_MSG_CHECKING(for program to convert manpage to html) +AC_ARG_WITH(man2html, + [ --with-man2html=XXX use XXX rather than groff], + [cf_man2html=$withval], + [cf_man2html=$cf_man2html]) + +cf_with_groff=no + +case $cf_man2html in +(yes) + AC_MSG_RESULT(man2html) + AC_PATH_PROG(cf_man2html,man2html,no) + ;; +(no|groff|*/groff*) + cf_with_groff=yes + cf_man2html=$GROFF_PATH + AC_MSG_RESULT($cf_man2html) + ;; +(*) + AC_MSG_RESULT($cf_man2html) + ;; +esac + +MAN2HTML_TEMP="man2html.tmp" + cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <conftest.in <conftest.out + + cf_man2html_1st=`fgrep -n MARKER conftest.out |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'` + cf_man2html_top=`expr $cf_man2html_1st - 2` + cf_man2html_bot=`wc -l conftest.out |sed -e 's/[[^0-9]]//g'` + cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top` + cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" + + AC_MSG_RESULT($cf_man2html_top_bot) + + AC_MSG_CHECKING(for pagesize to use) + for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 + do + cat >>conftest.in <conftest.out + cf_man2html_page=`fgrep -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[[^0-9]]*://' -e 's/:.*//'` + test -z "$cf_man2html_page" && cf_man2html_page=99999 + test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 + + rm -rf conftest* + AC_MSG_RESULT($cf_man2html_page) + + cat >>$MAN2HTML_TEMP < +#include /* has the prototype */ +#include /* has the XkbBI_xxx definitions */ +],[ + int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); + Atom y = 0; + (void)x; + XkbBell((Display *)0, (Widget)0, 0, y); +],[cf_cv_xkb_bell_ext=yes],[cf_cv_xkb_bell_ext=no]) +]) +test "$cf_cv_xkb_bell_ext" = yes && AC_DEFINE(HAVE_XKB_BELL_EXT,1,[Define 1 if we have XKB Bell extension]) + +CF_RESTORE_XTRA_FLAGS([CF_XKB_BELL_EXT]) +]) +dnl --------------------------------------------------------------------------- +dnl CF_XKB_KEYCODE_TO_KEYSYM version: 3 updated: 2020/03/10 18:53:47 +dnl ------------------------ +dnl Some older vendor-unix systems made a practice of delivering fragments of +dnl Xkb, requiring test-compiles. +AC_DEFUN([CF_XKB_KEYCODE_TO_KEYSYM],[ +AC_CACHE_CHECK(if we can use XkbKeycodeToKeysym, cf_cv_xkb_keycode_to_keysym,[ +AC_TRY_COMPILE([ +#include +#include +],[ + KeySym keysym = XkbKeycodeToKeysym((Display *)0, 0, 0, 0); + (void)keysym; +],[ +cf_cv_xkb_keycode_to_keysym=yes +],[ +cf_cv_xkb_keycode_to_keysym=no +]) +]) + +if test $cf_cv_xkb_keycode_to_keysym = yes +then + AC_CHECK_FUNCS(XkbKeycodeToKeysym) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_XKB_QUERY_EXTENSION version: 2 updated: 2012/09/28 20:23:46 +dnl ---------------------- +dnl see ifdef in scrollbar.c - iron out here +AC_DEFUN([CF_XKB_QUERY_EXTENSION],[ +AC_CACHE_CHECK(if we can use XkbQueryExtension, cf_cv_xkb_query_extension,[ +AC_TRY_COMPILE([ +#include +#include +#include +],[ + int xkbmajor = XkbMajorVersion; + int xkbminor = XkbMinorVersion; + int xkbopcode, xkbevent, xkberror; + + if (XkbLibraryVersion(&xkbmajor, &xkbminor) + && XkbQueryExtension((Display *)0, + &xkbopcode, + &xkbevent, + &xkberror, + &xkbmajor, + &xkbminor)) + return 0; +],[ +cf_cv_xkb_query_extension=yes +],[ +cf_cv_xkb_query_extension=no +]) +]) + +if test $cf_cv_xkb_query_extension = yes +then + AC_CHECK_FUNCS(XkbQueryExtension) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17 +dnl --------------- +dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, +dnl or adapt to the vendor's definitions to get equivalent functionality, +dnl without losing the common non-POSIX features. +dnl +dnl Parameters: +dnl $1 is the nominal value for _XOPEN_SOURCE +dnl $2 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_XOPEN_SOURCE],[ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([CF_POSIX_VISIBLE]) + +if test "$cf_cv_posix_visible" = no; then + +cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) +cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) +cf_xopen_source= + +case $host_os in +(aix[[4-7]]*) + cf_xopen_source="-D_ALL_SOURCE" + ;; +(msys) + cf_XOPEN_SOURCE=600 + ;; +(darwin[[0-8]].*) + cf_xopen_source="-D_APPLE_C_SOURCE" + ;; +(darwin*) + cf_xopen_source="-D_DARWIN_C_SOURCE" + cf_XOPEN_SOURCE= + ;; +(freebsd*|dragonfly*|midnightbsd*) + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +(hpux11*) + cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" + ;; +(hpux*) + cf_xopen_source="-D_HPUX_SOURCE" + ;; +(irix[[56]].*) + cf_xopen_source="-D_SGI_SOURCE" + cf_XOPEN_SOURCE= + ;; +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) + CF_GNU_SOURCE($cf_XOPEN_SOURCE) + ;; +(minix*) + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; +(mirbsd*) + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types + cf_XOPEN_SOURCE= + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + ;; +(netbsd*) + cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +(openbsd[[4-9]]*) + # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw + cf_xopen_source="-D_BSD_SOURCE" + cf_XOPEN_SOURCE=600 + ;; +(openbsd*) + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +(osf[[45]]*) + cf_xopen_source="-D_OSF_SOURCE" + ;; +(nto-qnx*) + cf_xopen_source="-D_QNX_SOURCE" + ;; +(sco*) + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +(solaris2.*) + cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken + ;; +(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; +(*) + CF_TRY_XOPEN_SOURCE + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + ;; +esac + +if test -n "$cf_xopen_source" ; then + CF_ADD_CFLAGS($cf_xopen_source,true) +fi + +dnl In anything but the default case, we may have system-specific setting +dnl which is still not guaranteed to provide all of the entrypoints that +dnl _XOPEN_SOURCE would yield. +if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then + AC_MSG_CHECKING(if _XOPEN_SOURCE really is set) + AC_TRY_COMPILE([#include ],[ +#ifndef _XOPEN_SOURCE +make an error +#endif], + [cf_XOPEN_SOURCE_set=yes], + [cf_XOPEN_SOURCE_set=no]) + AC_MSG_RESULT($cf_XOPEN_SOURCE_set) + if test $cf_XOPEN_SOURCE_set = yes + then + AC_TRY_COMPILE([#include ],[ +#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE +make an error +#endif], + [cf_XOPEN_SOURCE_set_ok=yes], + [cf_XOPEN_SOURCE_set_ok=no]) + if test $cf_XOPEN_SOURCE_set_ok = no + then + AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) + fi + else + CF_TRY_XOPEN_SOURCE + fi +fi +fi # cf_cv_posix_visible +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_ATHENA version: 24 updated: 2020/03/10 18:53:47 +dnl ----------- +dnl Check for Xaw (Athena) libraries +dnl +dnl Sets $cf_x_athena according to the flavor of Xaw which is used. +AC_DEFUN([CF_X_ATHENA], +[ +cf_x_athena=${cf_x_athena:-Xaw} + +AC_MSG_CHECKING(if you want to link with Xaw 3d library) +withval= +AC_ARG_WITH(Xaw3d, + [ --with-Xaw3d link with Xaw 3d library]) +if test "$withval" = yes ; then + cf_x_athena=Xaw3d + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(if you want to link with Xaw 3d xft library) +withval= +AC_ARG_WITH(Xaw3dxft, + [ --with-Xaw3dxft link with Xaw 3d xft library]) +if test "$withval" = yes ; then + cf_x_athena=Xaw3dxft + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(if you want to link with neXT Athena library) +withval= +AC_ARG_WITH(neXtaw, + [ --with-neXtaw link with neXT Athena library]) +if test "$withval" = yes ; then + cf_x_athena=neXtaw + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +AC_MSG_CHECKING(if you want to link with Athena-Plus library) +withval= +AC_ARG_WITH(XawPlus, + [ --with-XawPlus link with Athena-Plus library]) +if test "$withval" = yes ; then + cf_x_athena=XawPlus + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi + +cf_x_athena_lib="" + +if test "$PKG_CONFIG" != none ; then + cf_athena_list= + test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" + for cf_athena_pkg in \ + $cf_athena_list \ + ${cf_x_athena} \ + ${cf_x_athena}-devel \ + lib${cf_x_athena} \ + lib${cf_x_athena}-devel + do + CF_TRY_PKG_CONFIG($cf_athena_pkg,[ + cf_x_athena_lib="$cf_pkgconfig_libs" + CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) + AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) + + CF_TRIM_X_LIBS + +AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[ +AC_TRY_LINK([ +#include +],[ +int check = XmuCompareISOLatin1("big", "small"); +(void)check; +],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])]) + + if test "$cf_cv_xaw_compat" = no + then + # workaround for broken ".pc" files... + case "$cf_x_athena_lib" in + (*-lXmu*) + ;; + (*) + CF_VERBOSE(work around broken package) + cf_save_xmu="$LIBS" + cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'` + CF_TRY_PKG_CONFIG(xmu,[ + LIBS="$cf_save_xmu" + CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs) + ],[ + CF_ADD_LIB_AFTER($cf_first_lib,-lXmu) + ]) + CF_TRIM_X_LIBS + ;; + esac + fi + + break]) + done +fi + +if test -z "$cf_x_athena_lib" ; then + CF_X_EXT + CF_X_TOOLKIT + CF_X_ATHENA_CPPFLAGS($cf_x_athena) + CF_X_ATHENA_LIBS($cf_x_athena) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_X_ATHENA_CPPFLAGS version: 8 updated: 2020/01/16 05:21:56 +dnl -------------------- +dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of +dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. +AC_DEFUN([CF_X_ATHENA_CPPFLAGS], +[ +AC_REQUIRE([AC_PATH_XTRA]) +cf_x_athena_root=ifelse([$1],,Xaw,[$1]) +cf_x_athena_inc="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + if test -z "$cf_x_athena_inc" ; then + CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) + cf_test=X11/$cf_x_athena_root/SimpleMenu.h + if test $cf_path != default ; then + CF_APPEND_TEXT(CPPFLAGS,-I$cf_path/include) + AC_MSG_CHECKING(for $cf_test in $cf_path) + else + AC_MSG_CHECKING(for $cf_test) + fi + AC_TRY_COMPILE([ +#include +#include <$cf_test>],[], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_CPPFLAGS]) + if test "$cf_result" = yes ; then + test "$cf_path" = default && cf_x_athena_inc=default + test "$cf_path" != default && cf_x_athena_inc=$cf_path/include + break + fi + fi +done + +if test -z "$cf_x_athena_inc" ; then + AC_MSG_WARN([Unable to find Athena header files]) +elif test "$cf_x_athena_inc" != default ; then + CF_APPEND_TEXT(CPPFLAGS,-I$cf_x_athena_inc) +fi +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_ATHENA_LIBS version: 13 updated: 2020/01/11 18:16:10 +dnl ---------------- +dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of +dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw. +AC_DEFUN([CF_X_ATHENA_LIBS], +[AC_REQUIRE([CF_X_TOOLKIT]) +cf_x_athena_root=ifelse([$1],,Xaw,[$1]) +cf_x_athena_lib="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + ${cf_x_athena_root} \ + ${cf_x_athena_root}7 \ + ${cf_x_athena_root}6 + do + for cf_libs in \ + "-l$cf_lib -lXmu" \ + "-l$cf_lib -lXpm -lXmu" \ + "-l${cf_lib}_s -lXmu_s" + do + test -n "$cf_x_athena_lib" && break + + CF_SAVE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) + cf_test=XawSimpleMenuAddGlobalActions + test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" + CF_ADD_LIBS($cf_libs) + AC_MSG_CHECKING(for $cf_test in $cf_libs) + AC_TRY_LINK([ +#include +#include +],[ +$cf_test((XtAppContext) 0)], + [cf_result=yes], + [cf_result=no]) + AC_MSG_RESULT($cf_result) + CF_RESTORE_XTRA_FLAGS([CF_X_ATHENA_LIBS]) + + if test "$cf_result" = yes ; then + cf_x_athena_lib="$cf_libs" + break + fi + done # cf_libs + test -n "$cf_x_athena_lib" && break + done # cf_lib +done + +if test -z "$cf_x_athena_lib" ; then + AC_MSG_ERROR( +[Unable to successfully link Athena library (-l$cf_x_athena_root) with test program]) +fi + +CF_ADD_LIBS($cf_x_athena_lib) +CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena) +AC_DEFINE_UNQUOTED($cf_x_athena_LIBS) +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05 +dnl -------- +AC_DEFUN([CF_X_EXT],[ +CF_TRY_PKG_CONFIG(Xext,,[ + AC_CHECK_LIB(Xext,XextCreateExtension, + [CF_ADD_LIB(Xext)])]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_X_EXT_DOUBLE_BUFFER version: 1 updated: 2019/07/18 21:09:40 +dnl ---------------------- +AC_DEFUN([CF_X_EXT_DOUBLE_BUFFER],[ +AC_REQUIRE([CF_X_EXT]) +AC_CHECK_HEADER(X11/extensions/Xdbe.h, + AC_DEFINE(HAVE_X11_EXTENSIONS_XDBE_H,1,[Define to 1 if we have X11/extensions/Xdbe.h]) + AC_CHECK_FUNC(XdbeSwapBuffers, + [AC_DEFINE(HAVE_XDBESWAPBUFFERS,1,[Define to 1 if we have XdbeSwapBuffers]) + cf_x_ext_double_buffer=yes])) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_X_FONTCONFIG version: 7 updated: 2020/03/10 18:53:47 +dnl --------------- +dnl Check for fontconfig library, a dependency of the X FreeType library. +AC_DEFUN([CF_X_FONTCONFIG], +[ +AC_REQUIRE([CF_X_FREETYPE]) + +if test "$cf_cv_found_freetype" = yes ; then +AC_CACHE_CHECK(for usable Xft/fontconfig package,cf_cv_xft_compat,[ +AC_TRY_LINK([ +#include +],[ + XftPattern *pat = 0; + XftPatternBuild(pat, + XFT_FAMILY, XftTypeString, "mono", + (void *) 0); +],[cf_cv_xft_compat=yes],[cf_cv_xft_compat=no]) +]) + +if test "$cf_cv_xft_compat" = no +then + # workaround for broken ".pc" files used for Xft. + case "$cf_cv_x_freetype_libs" in + (*-lfontconfig*) + ;; + (*) + CF_VERBOSE(work around broken package) + cf_save_fontconfig="$LIBS" + CF_TRY_PKG_CONFIG(fontconfig,[ + CF_ADD_CFLAGS($cf_pkgconfig_incs) + LIBS="$cf_save_fontconfig" + CF_ADD_LIB_AFTER(-lXft,$cf_pkgconfig_libs) + ],[ + CF_ADD_LIB_AFTER(-lXft,-lfontconfig) + ]) + ;; + esac +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_X_FREETYPE version: 28 updated: 2020/03/10 18:53:47 +dnl ------------- +dnl Check for X FreeType headers and libraries (XFree86 4.x, etc). +dnl +dnl First check for the appropriate config program, since the developers for +dnl these libraries change their configuration (and config program) more or +dnl less randomly. If we cannot find the config program, do not bother trying +dnl to guess the latest variation of include/lib directories. +dnl +dnl If either or both of these configure-script options are not given, rely on +dnl the output of the config program to provide the cflags/libs options: +dnl --with-freetype-cflags +dnl --with-freetype-libs +AC_DEFUN([CF_X_FREETYPE], +[ +AC_REQUIRE([CF_PKG_CONFIG]) + +cf_cv_x_freetype_incs=no +cf_cv_x_freetype_libs=no +cf_extra_freetype_libs= +FREETYPE_CONFIG=none +FREETYPE_PARAMS= + +AC_MSG_CHECKING(for FreeType configuration script) +AC_ARG_WITH(freetype-config, + [ --with-freetype-config configure script to use for FreeType], + [cf_cv_x_freetype_cfgs="$withval"], + [cf_cv_x_freetype_cfgs=auto]) +test -z $cf_cv_x_freetype_cfgs && cf_cv_x_freetype_cfgs=auto +test $cf_cv_x_freetype_cfgs = no && cf_cv_x_freetype_cfgs=none +AC_MSG_RESULT($cf_cv_x_freetype_cfgs) + +case $cf_cv_x_freetype_cfgs in +(none) + AC_MSG_CHECKING(if you specified -D/-I options for FreeType) + AC_ARG_WITH(freetype-cflags, + [ --with-freetype-cflags -D/-I options for compiling with FreeType], + [cf_cv_x_freetype_incs="$with_freetype_cflags"], + [cf_cv_x_freetype_incs=no]) + AC_MSG_RESULT($cf_cv_x_freetype_incs) + + AC_MSG_CHECKING(if you specified -L/-l options for FreeType) + AC_ARG_WITH(freetype-libs, + [ --with-freetype-libs -L/-l options to link FreeType], + [cf_cv_x_freetype_libs="$with_freetype_libs"], + [cf_cv_x_freetype_libs=no]) + AC_MSG_RESULT($cf_cv_x_freetype_libs) + ;; +(auto) + if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then + FREETYPE_CONFIG=$PKG_CONFIG + FREETYPE_PARAMS=xft + else + AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, none) + if test "$FREETYPE_CONFIG" != none; then + FREETYPE_CONFIG=$FREETYPE_CONFIG + cf_extra_freetype_libs="-lXft" + else + AC_PATH_PROG(FREETYPE_OLD_CONFIG, xft-config, none) + if test "$FREETYPE_OLD_CONFIG" != none; then + FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG + fi + fi + fi + ;; +(pkg*) + if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then + FREETYPE_CONFIG=$cf_cv_x_freetype_cfgs + FREETYPE_PARAMS=xft + else + AC_MSG_WARN(cannot find pkg-config for Xft) + fi + ;; +(*) + AC_PATH_PROG(FREETYPE_XFT_CONFIG, $cf_cv_x_freetype_cfgs, none) + if test "$FREETYPE_XFT_CONFIG" != none; then + FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG + else + AC_MSG_WARN(cannot find config script for Xft) + fi + ;; +esac + +if test "$FREETYPE_CONFIG" != none ; then + AC_MSG_CHECKING(for FreeType config) + AC_MSG_RESULT($FREETYPE_CONFIG $FREETYPE_PARAMS) + + if test "$cf_cv_x_freetype_incs" = no ; then + AC_MSG_CHECKING(for $FREETYPE_CONFIG cflags) + cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" + AC_MSG_RESULT($cf_cv_x_freetype_incs) + fi + + if test "$cf_cv_x_freetype_libs" = no ; then + AC_MSG_CHECKING(for $FREETYPE_CONFIG libs) + cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" + AC_MSG_RESULT($cf_cv_x_freetype_libs) + fi +fi + +if test "$cf_cv_x_freetype_incs" = no ; then + cf_cv_x_freetype_incs= +fi + +if test "$cf_cv_x_freetype_libs" = no ; then + cf_cv_x_freetype_libs=-lXft +fi + +AC_MSG_CHECKING(if we can link with FreeType libraries) + +cf_save_LIBS="$LIBS" +cf_save_INCS="$CPPFLAGS" + +CF_ADD_LIBS($cf_cv_x_freetype_libs) +CPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" + +AC_TRY_LINK([ +#include +#include +#include ],[ + XftPattern *pat = XftNameParse ("name"); (void)pat], + [cf_cv_found_freetype=yes], + [cf_cv_found_freetype=no]) +AC_MSG_RESULT($cf_cv_found_freetype) + +LIBS="$cf_save_LIBS" +CPPFLAGS="$cf_save_INCS" + +if test "$cf_cv_found_freetype" = yes ; then + CF_ADD_LIBS($cf_cv_x_freetype_libs) + CF_ADD_CFLAGS($cf_cv_x_freetype_incs) + AC_DEFINE(XRENDERFONT,1,[Define to 1 if we can/should link with FreeType libraries]) + +AC_CHECK_FUNCS( \ + XftDrawCharSpec \ + XftDrawSetClip \ + XftDrawSetClipRectangles \ +) + +else + AC_MSG_WARN(No libraries found for FreeType) + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + +# FIXME: revisit this if needed +AC_SUBST(HAVE_TYPE_FCCHAR32) +AC_SUBST(HAVE_TYPE_XFTCHARSPEC) +]) +dnl --------------------------------------------------------------------------- +dnl CF_X_TOOLKIT version: 25 updated: 2020/03/10 17:26:15 +dnl ------------ +dnl Check for X Toolkit libraries +AC_DEFUN([CF_X_TOOLKIT], +[ +AC_REQUIRE([AC_PATH_XTRA]) +AC_REQUIRE([CF_CHECK_CACHE]) + +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + CF_TRY_PKG_CONFIG(x11,,[AC_MSG_WARN(unable to find X11 library)]) + CF_TRY_PKG_CONFIG(ice,,[AC_MSG_WARN(unable to find ICE library)]) + CF_TRY_PKG_CONFIG(sm,,[AC_MSG_WARN(unable to find SM library)]) + CF_TRY_PKG_CONFIG(xt,,[AC_MSG_WARN(unable to find Xt library)]) +else + LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS" +fi + +cf_have_X_LIBS=no + +CF_TRY_PKG_CONFIG(xt,[ + + case "x$LIBS" in + (*-lX11*) + ;; + (*) +# we have an "xt" package, but it may omit Xt's dependency on X11 +AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[ +AC_TRY_LINK([ +#include +],[ + int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); + int rc2 = XClearWindow((Display*) 0, (Window) 0); + int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); + int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); +],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])]) + if test "$cf_cv_xt_x11_compat" = no + then + CF_VERBOSE(work around broken X11 dependency) + # 2010/11/19 - good enough until a working Xt on Xcb is delivered. + CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)]) + fi + ;; + esac + +AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[ +AC_TRY_LINK([ +#include +],[int num = IceConnectionNumber(0); (void) num +],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])]) + + if test "$cf_cv_xt_ice_compat" = no + then + # workaround for broken ".pc" files used for X Toolkit. + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) + ;; + (*) + CF_VERBOSE(work around broken ICE dependency) + CF_TRY_PKG_CONFIG(ice, + [CF_TRY_PKG_CONFIG(sm)], + [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)]) + ;; + esac + ;; + esac + fi + + cf_have_X_LIBS=yes +],[ + + LDFLAGS="$X_LIBS $LDFLAGS" + CF_CHECK_CFLAGS($X_CFLAGS) + + AC_CHECK_FUNC(XOpenDisplay,,[ + AC_CHECK_LIB(X11,XOpenDisplay, + [CF_ADD_LIB(X11)])]) + + AC_CHECK_FUNC(XtAppInitialize,,[ + AC_CHECK_LIB(Xt, XtAppInitialize, + [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library]) + cf_have_X_LIBS=Xt + LIBS="-lXt $LIBS"])]) +]) + +if test $cf_have_X_LIBS = no ; then + AC_MSG_WARN( +[Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile.]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF__GRANTPT_BODY version: 5 updated: 2020/03/10 18:53:47 +dnl ---------------- +dnl Body for workability check of grantpt. +define([CF__GRANTPT_BODY],[ + int code = 0; + int rc; + int pty; + int tty; + char *slave; + struct termios tio; + + (void)tio; + signal(SIGALRM, my_timeout); + + if (alarm(2) == 9) + failed(9); + else if ((pty = posix_openpt(O_RDWR)) < 0) + failed(1); + else if ((rc = grantpt(pty)) < 0) + failed(2); + else if ((rc = unlockpt(pty)) < 0) + failed(3); + else if ((slave = ptsname(pty)) == 0) + failed(4); +#if (CONFTEST == 3) || defined(CONFTEST_isatty) + else if (!isatty(pty)) + failed(4); +#endif +#if CONFTEST >= 4 + else if ((rc = tcgetattr(pty, &tio)) < 0) + failed(20); + else if ((rc = tcsetattr(pty, TCSAFLUSH, &tio)) < 0) + failed(21); +#endif + /* BSD posix_openpt does not treat pty as a terminal until slave is opened. + * Linux does treat it that way. + */ + else if ((tty = open(slave, O_RDWR)) < 0) + failed(5); +#ifdef CONFTEST +#ifdef I_PUSH +#if (CONFTEST == 0) || defined(CONFTEST_ptem) + else if ((rc = ioctl(tty, I_PUSH, "ptem")) < 0) + failed(10); +#endif +#if (CONFTEST == 1) || defined(CONFTEST_ldterm) + else if ((rc = ioctl(tty, I_PUSH, "ldterm")) < 0) + failed(11); +#endif +#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) + else if ((rc = ioctl(tty, I_PUSH, "ttcompat")) < 0) + failed(12); +#endif +#endif /* I_PUSH */ +#if CONFTEST >= 5 + else if ((rc = tcgetattr(tty, &tio)) < 0) + failed(30); + else if ((rc = tcsetattr(tty, TCSAFLUSH, &tio)) < 0) + failed(31); +#endif +#endif /* CONFTEST */ + + ${cf_cv_main_return:-return}(code); +]) +dnl --------------------------------------------------------------------------- +dnl CF__GRANTPT_HEAD version: 4 updated: 2020/03/10 18:53:47 +dnl ---------------- +dnl Headers for workability check of grantpt. +define([CF__GRANTPT_HEAD],[ +#include +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_POSIX_OPENPT +#undef posix_openpt +#define posix_openpt(mode) open("/dev/ptmx", mode) +#endif + +#ifdef HAVE_STROPTS_H +#include +#endif + +static void failed(int code) +{ + perror("conftest"); + exit(code); +} + +static void my_timeout(int sig) +{ + (void)sig; + exit(99); +} +]) diff --git a/ports/xterm/xterm-359/builtin_icons.h b/ports/xterm/xterm-359/builtin_icons.h new file mode 100644 index 0000000..da6751b --- /dev/null +++ b/ports/xterm/xterm-359/builtin_icons.h @@ -0,0 +1,271 @@ +#if OPT_BUILTIN_XPMS +#include +#include +#include +#include +#else +/* XPM */ +static const char * mini_xterm_48x48_xpm[] = { +"48 48 213 2", +" c None", +". c #FF0000", +"+ c #FF5300", +"@ c #FF5E00", +"# c #FF4800", +"$ c #FF4200", +"% c #FF4000", +"& c #FF4B00", +"* c #FF5200", +"= c #FF5400", +"- c #FF3500", +"; c #FF5100", +"> c #FF5C00", +", c #FF3000", +"' c #FF4500", +") c #FF2000", +"! c #FF0300", +"~ c #FF1600", +"{ c #FF5D00", +"] c #FF3800", +"^ c #FF0200", +"/ c #FF0900", +"( c #FF2B00", +"_ c #FF3300", +": c #FF1A00", +"< c #FF1300", +"[ c #FF1200", +"} c #FF5700", +"| c #4577BA", +"1 c #874E78", +"2 c #887577", +"3 c #887E77", +"4 c #887977", +"5 c #875078", +"6 c #566CA9", +"7 c #5E70A1", +"8 c #884E77", +"9 c #887677", +"0 c #7C5B83", +"a c #795686", +"b c #008DFE", +"c c #0012F3", +"d c #000BF2", +"e c #008FFE", +"f c #006CFA", +"g c #0000F1", +"h c #0001F1", +"i c #0020F4", +"j c #0040F6", +"k c #0959F0", +"l c #1158E8", +"m c #1159E8", +"n c #0058F9", +"o c #001DF4", +"p c #0023F4", +"q c #005BFA", +"r c #0060FA", +"s c #0E58EB", +"t c #0651F3", +"u c #0033F5", +"v c #000EF2", +"w c #006EFA", +"x c #0092FF", +"y c #001FF4", +"z c #000FF2", +"A c #0C51EC", +"B c #326AC9", +"C c #7A6583", +"D c #CA6234", +"E c #FC5F03", +"F c #FF5800", +"G c #FF0800", +"H c #F4060B", +"I c #007CFB", +"J c #0013F3", +"K c #007EFB", +"L c #FF1800", +"M c #F3590C", +"N c #AB6152", +"O c #4F4EAD", +"P c #175CE4", +"Q c #0036F5", +"R c #0022F4", +"S c #0095FD", +"T c #0084FD", +"U c #0004F1", +"V c #0051F8", +"W c #345AC7", +"X c #E61519", +"Y c #FF5900", +"Z c #FF4600", +"` c #FF0100", +" . c #446EB9", +".. c #0034F6", +"+. c #0032F5", +"@. c #FF2200", +"#. c #006FFA", +"$. c #002DF5", +"%. c #0086FD", +"&. c #0046F7", +"*. c #0015F3", +"=. c #0076FC", +"-. c #FF0400", +";. c #FF2300", +">. c #FF2900", +",. c #9E3E61", +"'. c #0039F6", +"). c #FF2A00", +"!. c #FF4300", +"~. c #0071FB", +"{. c #005EF9", +"]. c #004DF7", +"^. c #008CFE", +"/. c #0008F2", +"(. c #001DF3", +"_. c #007DFB", +":. c #FF4100", +"<. c #FF5B00", +"[. c #A3425C", +"}. c #994C66", +"|. c #FF1100", +"1. c #0072FB", +"2. c #000AF2", +"3. c #006EFC", +"4. c #0017F3", +"5. c #007FFB", +"6. c #FF0600", +"7. c #FF5600", +"8. c #A56A5A", +"9. c #A53B5A", +"0. c #FF4F00", +"a. c #0076FB", +"b. c #0076FA", +"c. c #0093FF", +"d. c #007DFC", +"e. c #FF1C00", +"f. c #A5765A", +"g. c #A55D5A", +"h. c #006FFB", +"i. c #002CF5", +"j. c #008AFD", +"k. c #006BF9", +"l. c #FF3A00", +"m. c #FF5000", +"n. c #007BFB", +"o. c #008BFD", +"p. c #A5755A", +"q. c #9A5565", +"r. c #A43A5B", +"s. c #FF4D00", +"t. c #80507F", +"u. c #FF0F00", +"v. c #7A5485", +"w. c #A5555A", +"x. c #FF0A00", +"y. c #A53D5A", +"z. c #A4515B", +"A. c #A5685A", +"B. c #A5735A", +"C. c #FF0700", +"D. c #FF2E00", +"E. c #FF1500", +"F. c #A3705C", +"G. c #FF0500", +"H. c #9A4965", +"I. c #FF0E00", +"J. c #FF3B00", +"K. c #FF2D00", +"L. c #A13C5E", +"M. c #FF4C00", +"N. c #62649D", +"O. c #FF0B00", +"P. c #FF4700", +"Q. c #FF1D00", +"R. c #A56D5A", +"S. c #FF2C00", +"T. c #A4465B", +"U. c #FF1400", +"V. c #A03E61", +"W. c #FF3100", +"X. c #FF1B00", +"Y. c #FF1000", +"Z. c #0029F5", +"`. c #0027F4", +" + c #4571BA", +".+ c #FF3900", +"++ c #FF3200", +"@+ c #008EFD", +"#+ c #0019F3", +"$+ c #0090FD", +"%+ c #FF0D00", +"&+ c #FF1E00", +"*+ c #FF4E00", +"=+ c #0088FC", +"-+ c #0087FC", +";+ c #FF1900", +">+ c #0036F6", +",+ c #FF2100", +"'+ c #0073FB", +")+ c #0062FA", +"!+ c #001AF3", +"~+ c #2463D8", +"{+ c #3E58BE", +"]+ c #2A7FD3", +"^+ c #807B7F", +"/+ c #008EFB", +"(+ c #006AFA", +"_+ c #004CF8", +":+ c #717B8D", +"<+ c #EE0B11", +"[+ c #F73E08", +"}+ c #FF1F00", +"|+ c #FF5500", +" ", +" ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . + @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ . . # @ @ @ @ @ @ @ @ @ @ @ @ $ . ", +" . % & & & * @ @ @ @ @ = & & & & & . . - & & & & & ; @ > & & & & , . ", +" . . . . . . * @ @ @ @ ; . . . . . . . . . . . . . ' @ ) . . . . . . ", +" ! ~ { @ @ @ @ ] ^ / ( @ $ . ", +" ^ _ @ @ @ @ @ : ! < [ > } ^ . ", +" | 1 2 3 3 3 3 4 5 6 7 8 9 3 0 a ", +" b c d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d c e ", +" f g g g g g g h i j k l m n o g g g g g g p q r s t u v g g g g g g g w ", +" x y g g g g z A B C D E F G H I c g g g g J K L / M N O P Q h g g g g R S ", +" T g g g U V W X Y @ @ @ @ Z ` ...g g g g +. ` ' @ @.. #.$.g g g g %. ", +" &.g g *.=. -.;.@ @ @ @ @ >.,.'.g g g g '. / ).@ !.. ~.{.U g g ]. ", +" ^./.g (._. ` :.@ @ @ @ <.[.'.g g g g '.}.|.<.} ^ . 1.2.g d e ", +" 3.g 4.5. 6.7.@ @ @ @ 8.'.g g g g '.9.0.@ [ . a./.g b. ", +" c.R /.d. -.e.@ @ @ @ f.'.g g g g '.g.@ - . h.h i. ", +" j.k.%. ^ l.@ @ @ f.'.g g g g '.f.m.` n.f o. ", +" ! * @ @ f.'.g g g g '.p.G . ", +" ! ~ { @ f.'.g g g g '.q.. ", +" ^ _ @ f.'.g g g g '.r. ", +" ^ s.f.'.g g g g '.t. ", +" ^ u.p.'.g g g g '.v. ", +" ^ w.'.g g g g '.r. ", +" x.y.'.g g g g '.z.^ ", +" ` A.'.g g g g '.B.x.. ", +" C.D.f.'.g g g g '.f.# ` ", +" < E.{ F.'.g g g g '.f.@ ( ^ ", +" : G.; @ H.'.g g g g '.f.@ <.I.^ ", +" -.J.@ K.L.'.g g g g '.f.@ @ s.` ", +" I.) @ M.. N.'.g g g g '.f.@ @ @ _ ^ ", +" L O.F <.6.. '.g g g g '.f.@ @ @ { E.! ", +" ^ P.@ Q.. '.g g g g '.R.@ @ @ @ * ! ", +" G S.@ % . '.g g g g '.T.{ @ @ @ @ l.^ ", +" < U.> 7.^ ..g g g g u V.W.@ @ @ @ @ e.! ", +" X.-.m.@ Y.. Z.g g g g `. +` M.@ @ @ @ 7.6. ", +" -..+@ ++. @+#+g g g g #+$+^ %+<.@ @ @ @ :.` ", +" I.&+@ *+. =+h g g g g h -+ ! >.@ @ @ @ @ ;.^ ", +" ;+x.} > C.. >+g g g g g g >+ ` Z @ @ @ @ Y / . ", +" ` ' @ ,+. %.1.'+)+!+g g g g g g g g #+)+~+{+]+^+@ @ @ P.` ", +" / ).@ !.. /+(+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+(+:+@ @ @ @ ).^ ", +" I.[ > F . . <+[+@ @ @ @ <.I.` ", +" . . . . . . 0.@ }+. . . . . . . . . . . . . |+@ @ @ @ s.. . . . . . ", +" O.@ @ @ @ @ @ @ @ @ @ @ @ @ ^ ! $ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ $ . ", +" . & & & & & & & & & & & & & . . , & & & & & & & & & & & & & & & , . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" ", +" "}; +#endif diff --git a/ports/xterm/xterm-359/button.c b/ports/xterm/xterm-359/button.c new file mode 100644 index 0000000..33020b4 --- /dev/null +++ b/ports/xterm/xterm-359/button.c @@ -0,0 +1,5658 @@ +/* $XTermId: button.c,v 1.585 2020/08/04 08:10:25 tom Exp $ */ + +/* + * Copyright 1999-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* +button.c Handles button events in the terminal emulator. + does cut/paste operations, change modes via menu, + passes button events through to some applications. + J. Gettys. +*/ + +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#if OPT_SELECT_REGEX +#ifdef HAVE_PCRE2POSIX_H +#include +#else +#ifdef HAVE_PCREPOSIX_H +#include +#else /* POSIX regex.h */ +#include +#include +#endif +#endif +#endif + +#define PRIMARY_NAME "PRIMARY" +#define CLIPBOARD_NAME "CLIPBOARD" +#define SECONDARY_NAME "SECONDARY" + +#define AtomToSelection(d,n) \ + (((n) == XA_CLIPBOARD(d)) \ + ? CLIPBOARD_CODE \ + : (((n) == XA_SECONDARY) \ + ? SECONDARY_CODE \ + : PRIMARY_CODE)) + +#define isSelectionCode(n) ((n) >= PRIMARY_CODE) +#define CutBufferToCode(n) ((n) + MAX_SELECTION_CODES) +#define okSelectionCode(n) (isSelectionCode(n) ? (n) : PRIMARY_CODE) + +#if OPT_WIDE_CHARS +#include +#include +#else +#define CharacterClass(value) \ + charClass[(value) & (int)((sizeof(charClass)/sizeof(charClass[0]))-1)] +#endif + + /* + * We'll generally map rows to indices when doing selection. + * Simplify that with a macro. + * + * Note that ROW2INX() is safe to use with auto increment/decrement for + * the row expression since that is evaluated once. + */ +#define GET_LINEDATA(screen, row) \ + getLineData(screen, ROW2INX(screen, row)) + + /* + * We reserve shift modifier for cut/paste operations. + * + * In principle we can pass through control and meta modifiers, but in + * practice, the popup menu uses control, and the window manager is likely + * to use meta, so those events usually are not delivered to + * SendMousePosition. + */ +#define OurModifiers (ShiftMask) +#define AllModifiers (ShiftMask | LockMask | ControlMask | Mod1Mask | \ + Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask) + +#define BtnModifiers(event) (event->state & OurModifiers) +#define KeyModifiers(event) (event->xbutton.state & OurModifiers) + +#define IsBtnEvent(event) ((event)->type == ButtonPress || (event)->type == ButtonRelease) +#define IsKeyEvent(event) ((event)->type == KeyPress || (event)->type == KeyRelease) + +#define KeyState(x) (((int) ((x) & (ShiftMask|ControlMask))) \ + + (((x) & Mod1Mask) ? 2 : 0)) + /* adds together the bits: + shift key -> 1 + meta key -> 2 + control key -> 4 */ + +#define Coordinate(s,c) ((c)->row * MaxCols(s) + (c)->col) + +static const CELL zeroCELL = +{0, 0}; + +#if OPT_DEC_LOCATOR +static Bool SendLocatorPosition(XtermWidget xw, XButtonEvent *event); +static void CheckLocatorPosition(XtermWidget xw, XButtonEvent *event); +#endif /* OPT_DEC_LOCATOR */ + +/* Multi-click handling */ +#if OPT_READLINE +static Time lastButtonDownTime = 0; +static int ExtendingSelection = 0; +static Time lastButton3UpTime = 0; +static Time lastButton3DoubleDownTime = 0; +static CELL lastButton3; /* At the release time */ +#endif /* OPT_READLINE */ + +static Char *SaveText(TScreen *screen, int row, int scol, int ecol, + Char *lp, int *eol); +static int Length(TScreen *screen, int row, int scol, int ecol); +static void ComputeSelect(XtermWidget xw, CELL *startc, CELL *endc, Bool extend); +static void EditorButton(XtermWidget xw, XButtonEvent *event); +static void EndExtend(XtermWidget w, XEvent *event, String *params, Cardinal + num_params, Bool use_cursor_loc); +static void ExtendExtend(XtermWidget xw, const CELL *cell); +static void PointToCELL(TScreen *screen, int y, int x, CELL *cell); +static void ReHiliteText(XtermWidget xw, CELL *first, CELL *last); +static void SaltTextAway(XtermWidget xw, int which, CELL *cellc, CELL *cell); +static void SelectSet(XtermWidget xw, XEvent *event, String *params, Cardinal num_params); +static void SelectionReceived PROTO_XT_SEL_CB_ARGS; +static void StartSelect(XtermWidget xw, const CELL *cell); +static void TrackDown(XtermWidget xw, XButtonEvent *event); +static void TrackText(XtermWidget xw, const CELL *first, const CELL *last); +static void UnHiliteText(XtermWidget xw); +static void _OwnSelection(XtermWidget xw, String *selections, Cardinal count); +static void do_select_end(XtermWidget xw, XEvent *event, String *params, + Cardinal *num_params, Bool use_cursor_loc); + +#define MOUSE_LIMIT (255 - 32) + +/* Send SET_EXT_SIZE_MOUSE to enable offsets up to EXT_MOUSE_LIMIT */ +#define EXT_MOUSE_LIMIT (2047 - 32) +#define EXT_MOUSE_START (127 - 32) + +static int +MouseLimit(TScreen *screen) +{ + int mouse_limit; + + switch (screen->extend_coords) { + default: + mouse_limit = MOUSE_LIMIT; + break; + case SET_EXT_MODE_MOUSE: + mouse_limit = EXT_MOUSE_LIMIT; + break; + case SET_SGR_EXT_MODE_MOUSE: + case SET_URXVT_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + mouse_limit = -1; + break; + } + return mouse_limit; +} + +static unsigned +EmitMousePosition(TScreen *screen, Char line[], unsigned count, int value) +{ + int mouse_limit = MouseLimit(screen); + + /* + * Add pointer position to key sequence + * + * In extended mode we encode large positions as two-byte UTF-8. + * + * NOTE: historically, it was possible to emit 256, which became + * zero by truncation to 8 bits. While this was arguably a bug, + * it's also somewhat useful as a past-end marker. We preserve + * this behavior for both normal and extended mouse modes. + */ + switch (screen->extend_coords) { + default: + if (value == mouse_limit) { + line[count++] = CharOf(0); + } else { + line[count++] = CharOf(' ' + value + 1); + } + break; + case SET_EXT_MODE_MOUSE: + if (value == mouse_limit) { + line[count++] = CharOf(0); + } else if (value < EXT_MOUSE_START) { + line[count++] = CharOf(' ' + value + 1); + } else { + value += ' ' + 1; + line[count++] = CharOf(0xC0 + (value >> 6)); + line[count++] = CharOf(0x80 + (value & 0x3F)); + } + break; + case SET_SGR_EXT_MODE_MOUSE: + case SET_URXVT_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + count += (unsigned) sprintf((char *) line + count, "%d", value + 1); + break; + } + return count; +} + +static unsigned +EmitMousePositionSeparator(TScreen *screen, Char line[], unsigned count) +{ + switch (screen->extend_coords) { + case SET_SGR_EXT_MODE_MOUSE: + case SET_URXVT_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = ';'; + break; + } + return count; +} + +Bool +SendMousePosition(XtermWidget xw, XEvent *event) +{ + XButtonEvent *my_event = (XButtonEvent *) event; + Bool result = False; + + switch (okSendMousePos(xw)) { + case MOUSE_OFF: + /* If send_mouse_pos mode isn't on, we shouldn't be here */ + break; + + case BTN_EVENT_MOUSE: + case ANY_EVENT_MOUSE: + if (KeyModifiers(event) == 0) { + /* xterm extension for motion reporting. June 1998 */ + /* EditorButton() will distinguish between the modes */ + switch (event->type) { + case MotionNotify: + my_event->button = 0; + /* FALLTHRU */ + case ButtonPress: + /* FALLTHRU */ + case ButtonRelease: + EditorButton(xw, my_event); + result = True; + break; + } + } + break; + + case X10_MOUSE: /* X10 compatibility sequences */ + if (IsBtnEvent(event)) { + if (BtnModifiers(my_event) == 0) { + if (my_event->type == ButtonPress) + EditorButton(xw, my_event); + result = True; + } + } + break; + + case VT200_HIGHLIGHT_MOUSE: /* DEC vt200 hilite tracking */ + if (IsBtnEvent(event)) { + if (my_event->type == ButtonPress && + BtnModifiers(my_event) == 0 && + my_event->button == Button1) { + TrackDown(xw, my_event); + result = True; + } else if (BtnModifiers(my_event) == 0) { + EditorButton(xw, my_event); + result = True; + } + } + break; + + case VT200_MOUSE: /* DEC vt200 compatible */ + if (IsBtnEvent(event)) { + if (BtnModifiers(my_event) == 0) { + EditorButton(xw, my_event); + result = True; + } + } + break; + + case DEC_LOCATOR: +#if OPT_DEC_LOCATOR + if (IsBtnEvent(event) || event->type == MotionNotify) { + result = SendLocatorPosition(xw, my_event); + } +#endif /* OPT_DEC_LOCATOR */ + break; + } + return result; +} + +#if OPT_DEC_LOCATOR + +#define LocatorCoords( row, col, x, y, oor ) \ + if( screen->locator_pixels ) { \ + (oor)=False; (row) = (y)+1; (col) = (x)+1; \ + /* Limit to screen dimensions */ \ + if ((row) < 1) (row) = 1,(oor)=True; \ + else if ((row) > screen->border*2+Height(screen)) \ + (row) = screen->border*2+Height(screen),(oor)=True; \ + if ((col) < 1) (col) = 1,(oor)=True; \ + else if ((col) > OriginX(screen)*2+Width(screen)) \ + (col) = OriginX(screen)*2+Width(screen),(oor)=True; \ + } else { \ + (oor)=False; \ + /* Compute character position of mouse pointer */ \ + (row) = ((y) - screen->border) / FontHeight(screen); \ + (col) = ((x) - OriginX(screen)) / FontWidth(screen); \ + /* Limit to screen dimensions */ \ + if ((row) < 0) (row) = 0,(oor)=True; \ + else if ((row) > screen->max_row) \ + (row) = screen->max_row,(oor)=True; \ + if ((col) < 0) (col) = 0,(oor)=True; \ + else if ((col) > screen->max_col) \ + (col) = screen->max_col,(oor)=True; \ + (row)++; (col)++; \ + } + +static Bool +SendLocatorPosition(XtermWidget xw, XButtonEvent *event) +{ + ANSI reply; + TScreen *screen = TScreenOf(xw); + int row, col; + Bool oor; + int button; + unsigned state; + + /* Make sure the event is an appropriate type */ + if ((!IsBtnEvent(event) && + !screen->loc_filter) || + (BtnModifiers(event) != 0)) + return (False); + + if ((event->type == ButtonPress && + !(screen->locator_events & LOC_BTNS_DN)) || + (event->type == ButtonRelease && + !(screen->locator_events & LOC_BTNS_UP))) + return (True); + + if (event->type == MotionNotify) { + CheckLocatorPosition(xw, event); + return (True); + } + + /* get button # */ + button = (int) event->button - 1; + + LocatorCoords(row, col, event->x, event->y, oor); + + /* + * DECterm mouse: + * + * ESCAPE '[' event ; mask ; row ; column '&' 'w' + */ + memset(&reply, 0, sizeof(reply)); + reply.a_type = ANSI_CSI; + + if (oor) { + reply.a_nparam = 1; + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_inters = '&'; + reply.a_final = 'w'; + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } + return (True); + } + + /* + * event: + * 1 no buttons + * 2 left button down + * 3 left button up + * 4 middle button down + * 5 middle button up + * 6 right button down + * 7 right button up + * 8 M4 down + * 9 M4 up + */ + reply.a_nparam = 4; + switch (event->type) { + case ButtonPress: + reply.a_param[0] = (ParmType) (2 + (button << 1)); + break; + case ButtonRelease: + reply.a_param[0] = (ParmType) (3 + (button << 1)); + break; + default: + return (True); + } + /* + * mask: + * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 + * M4 down left down middle down right down + * + * Notice that Button1 (left) and Button3 (right) are swapped in the mask. + * Also, mask should be the state after the button press/release, + * X provides the state not including the button press/release. + */ + state = (event->state + & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8; + /* update mask to "after" state */ + state ^= ((unsigned) (1 << button)); + /* swap Button1 & Button3 */ + state = ((state & (unsigned) ~(4 | 1)) + | ((state & 1) ? 4 : 0) + | ((state & 4) ? 1 : 0)); + + reply.a_param[1] = (ParmType) state; + reply.a_param[2] = (ParmType) row; + reply.a_param[3] = (ParmType) col; + reply.a_inters = '&'; + reply.a_final = 'w'; + + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } + + /* + * DECterm turns the Locator off if a button is pressed while a filter + * rectangle is active. This might be a bug, but I don't know, so I'll + * emulate it anyway. + */ + if (screen->loc_filter) { + screen->send_mouse_pos = MOUSE_OFF; + screen->loc_filter = False; + screen->locator_events = 0; + MotionOff(screen, xw); + } + + return (True); +} + +/* + * mask: + * bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 + * M4 down left down middle down right down + * + * Button1 (left) and Button3 (right) are swapped in the mask relative to X. + */ +#define ButtonState(state, mask) \ +{ int stemp = (int) (((mask) & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8); \ + /* swap Button1 & Button3 */ \ + (state) = (stemp & ~(4|1)) | ((stemp & 1) ? 4 : 0) | ((stemp & 4) ? 1 : 0); \ +} + +void +GetLocatorPosition(XtermWidget xw) +{ + ANSI reply; + TScreen *screen = TScreenOf(xw); + Window root, child; + int rx, ry, x, y; + unsigned int mask = 0; + int row = 0, col = 0; + Bool oor = False; + Bool ret = False; + int state; + + /* + * DECterm turns the Locator off if the position is requested while a + * filter rectangle is active. This might be a bug, but I don't know, so + * I'll emulate it anyways. + */ + if (screen->loc_filter) { + screen->send_mouse_pos = MOUSE_OFF; + screen->loc_filter = False; + screen->locator_events = 0; + MotionOff(screen, xw); + } + + memset(&reply, 0, sizeof(reply)); + reply.a_type = ANSI_CSI; + + if (okSendMousePos(xw) == DEC_LOCATOR) { + ret = XQueryPointer(screen->display, VWindow(screen), &root, + &child, &rx, &ry, &x, &y, &mask); + if (ret) { + LocatorCoords(row, col, x, y, oor); + } + } + if (ret == False || oor) { + reply.a_nparam = 1; + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_inters = '&'; + reply.a_final = 'w'; + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } + return; + } + + ButtonState(state, mask); + + reply.a_nparam = 4; + reply.a_param[0] = 1; /* Event - 1 = response to locator request */ + reply.a_param[1] = (ParmType) state; + reply.a_param[2] = (ParmType) row; + reply.a_param[3] = (ParmType) col; + reply.a_inters = '&'; + reply.a_final = 'w'; + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } +} + +void +InitLocatorFilter(XtermWidget xw) +{ + ANSI reply; + TScreen *screen = TScreenOf(xw); + Window root, child; + int rx, ry, x, y; + unsigned int mask; + int row = 0, col = 0; + Bool oor = 0; + Bool ret; + + ret = XQueryPointer(screen->display, VWindow(screen), + &root, &child, &rx, &ry, &x, &y, &mask); + if (ret) { + LocatorCoords(row, col, x, y, oor); + } + if (ret == False || oor) { + /* Locator is unavailable */ + + if (screen->loc_filter_top != LOC_FILTER_POS || + screen->loc_filter_left != LOC_FILTER_POS || + screen->loc_filter_bottom != LOC_FILTER_POS || + screen->loc_filter_right != LOC_FILTER_POS) { + /* + * If any explicit coordinates were received, + * report immediately with no coordinates. + */ + memset(&reply, 0, sizeof(reply)); + reply.a_type = ANSI_CSI; + reply.a_nparam = 1; + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + reply.a_inters = '&'; + reply.a_final = 'w'; + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } + } else { + /* + * No explicit coordinates were received, and the pointer is + * unavailable. Report when the pointer re-enters the window. + */ + screen->loc_filter = True; + MotionOn(screen, xw); + } + return; + } + + /* + * Adjust rectangle coordinates: + * 1. Replace "LOC_FILTER_POS" with current coordinates + * 2. Limit coordinates to screen size + * 3. make sure top and left are less than bottom and right, resp. + */ + if (screen->locator_pixels) { + rx = OriginX(screen) * 2 + Width(screen); + ry = screen->border * 2 + Height(screen); + } else { + rx = screen->max_col; + ry = screen->max_row; + } + +#define Adjust( coord, def, max ) \ + if( (coord) == LOC_FILTER_POS ) (coord) = (def); \ + else if ((coord) < 1) (coord) = 1; \ + else if ((coord) > (max)) (coord) = (max) + + Adjust(screen->loc_filter_top, row, ry); + Adjust(screen->loc_filter_left, col, rx); + Adjust(screen->loc_filter_bottom, row, ry); + Adjust(screen->loc_filter_right, col, rx); + + if (screen->loc_filter_top > screen->loc_filter_bottom) { + ry = screen->loc_filter_top; + screen->loc_filter_top = screen->loc_filter_bottom; + screen->loc_filter_bottom = ry; + } + + if (screen->loc_filter_left > screen->loc_filter_right) { + rx = screen->loc_filter_left; + screen->loc_filter_left = screen->loc_filter_right; + screen->loc_filter_right = rx; + } + + if ((col < screen->loc_filter_left) || + (col > screen->loc_filter_right) || + (row < screen->loc_filter_top) || + (row > screen->loc_filter_bottom)) { + int state; + + /* Pointer is already outside the rectangle - report immediately */ + ButtonState(state, mask); + + memset(&reply, 0, sizeof(reply)); + reply.a_type = ANSI_CSI; + reply.a_nparam = 4; + reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ + reply.a_param[1] = (ParmType) state; + reply.a_param[2] = (ParmType) row; + reply.a_param[3] = (ParmType) col; + reply.a_inters = '&'; + reply.a_final = 'w'; + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } + return; + } + + /* + * Rectangle is set up. Allow pointer tracking + * to detect if the mouse leaves the rectangle. + */ + screen->loc_filter = True; + MotionOn(screen, xw); +} + +static void +CheckLocatorPosition(XtermWidget xw, XButtonEvent *event) +{ + ANSI reply; + TScreen *screen = TScreenOf(xw); + int row, col; + Bool oor; + + LocatorCoords(row, col, event->x, event->y, oor); + + /* + * Send report if the pointer left the filter rectangle, if + * the pointer left the window, or if the filter rectangle + * had no coordinates and the pointer re-entered the window. + */ + if (oor || (screen->loc_filter_top == LOC_FILTER_POS) || + (col < screen->loc_filter_left) || + (col > screen->loc_filter_right) || + (row < screen->loc_filter_top) || + (row > screen->loc_filter_bottom)) { + /* Filter triggered - disable it */ + screen->loc_filter = False; + MotionOff(screen, xw); + + memset(&reply, 0, sizeof(reply)); + reply.a_type = ANSI_CSI; + if (oor) { + reply.a_nparam = 1; + reply.a_param[0] = 0; /* Event - 0 = locator unavailable */ + } else { + int state; + + ButtonState(state, event->state); + + reply.a_nparam = 4; + reply.a_param[0] = 10; /* Event - 10 = locator outside filter */ + reply.a_param[1] = (ParmType) state; + reply.a_param[2] = (ParmType) row; + reply.a_param[3] = (ParmType) col; + } + + reply.a_inters = '&'; + reply.a_final = 'w'; + unparseseq(xw, &reply); + + if (screen->locator_reset) { + MotionOff(screen, xw); + screen->send_mouse_pos = MOUSE_OFF; + } + } +} +#endif /* OPT_DEC_LOCATOR */ + +#if OPT_READLINE +static int +isClick1_clean(XtermWidget xw, XButtonEvent *event) +{ + TScreen *screen = TScreenOf(xw); + int delta; + + if (!IsBtnEvent(event) + /* Disable on Shift-Click-1, including the application-mouse modes */ + || (BtnModifiers(event) & ShiftMask) + || (okSendMousePos(xw) != MOUSE_OFF) /* Kinda duplicate... */ + ||ExtendingSelection) /* Was moved */ + return 0; + + if (event->type != ButtonRelease) + return 0; + + if (lastButtonDownTime == (Time) 0) { + /* first time or once in a blue moon */ + delta = screen->multiClickTime + 1; + } else if (event->time > lastButtonDownTime) { + /* most of the time */ + delta = (int) (event->time - lastButtonDownTime); + } else { + /* time has rolled over since lastButtonUpTime */ + delta = (int) ((((Time) ~ 0) - lastButtonDownTime) + event->time); + } + + return delta <= screen->multiClickTime; +} + +static int +isDoubleClick3(TScreen *screen, XButtonEvent *event) +{ + int delta; + + if (event->type != ButtonRelease + || (BtnModifiers(event) & ShiftMask) + || event->button != Button3) { + lastButton3UpTime = 0; /* Disable the cached info */ + return 0; + } + /* Process Btn3Release. */ + if (lastButton3DoubleDownTime == (Time) 0) { + /* No previous click or once in a blue moon */ + delta = screen->multiClickTime + 1; + } else if (event->time > lastButton3DoubleDownTime) { + /* most of the time */ + delta = (int) (event->time - lastButton3DoubleDownTime); + } else { + /* time has rolled over since lastButton3DoubleDownTime */ + delta = (int) ((((Time) ~ 0) - lastButton3DoubleDownTime) + event->time); + } + if (delta <= screen->multiClickTime) { + /* Double click */ + CELL cell; + + /* Cannot check ExtendingSelection, since mouse-3 always sets it */ + PointToCELL(screen, event->y, event->x, &cell); + if (isSameCELL(&cell, &lastButton3)) { + lastButton3DoubleDownTime = 0; /* Disable the third click */ + return 1; + } + } + /* Not a double click, memorize for future check. */ + lastButton3UpTime = event->time; + PointToCELL(screen, event->y, event->x, &lastButton3); + return 0; +} + +static int +CheckSecondPress3(TScreen *screen, XEvent *event) +{ + int delta; + + if (event->type != ButtonPress + || (KeyModifiers(event) & ShiftMask) + || event->xbutton.button != Button3) { + lastButton3DoubleDownTime = 0; /* Disable the cached info */ + return 0; + } + /* Process Btn3Press. */ + if (lastButton3UpTime == (Time) 0) { + /* No previous click or once in a blue moon */ + delta = screen->multiClickTime + 1; + } else if (event->xbutton.time > lastButton3UpTime) { + /* most of the time */ + delta = (int) (event->xbutton.time - lastButton3UpTime); + } else { + /* time has rolled over since lastButton3UpTime */ + delta = (int) ((((Time) ~ 0) - lastButton3UpTime) + event->xbutton.time); + } + if (delta <= screen->multiClickTime) { + CELL cell; + + PointToCELL(screen, event->xbutton.y, event->xbutton.x, &cell); + if (isSameCELL(&cell, &lastButton3)) { + /* A candidate for a double-click */ + lastButton3DoubleDownTime = event->xbutton.time; + PointToCELL(screen, event->xbutton.y, event->xbutton.x, &lastButton3); + return 1; + } + lastButton3UpTime = 0; /* Disable the info about the previous click */ + } + /* Either too long, or moved, disable. */ + lastButton3DoubleDownTime = 0; + return 0; +} + +static int +rowOnCurrentLine(TScreen *screen, + int line, + int *deltap) /* must be XButtonEvent */ +{ + int result = 1; + + *deltap = 0; + + if (line != screen->cur_row) { + int l1, l2; + + if (line < screen->cur_row) { + l1 = line; + l2 = screen->cur_row; + } else { + l2 = line; + l1 = screen->cur_row; + } + l1--; + while (++l1 < l2) { + LineData *ld = GET_LINEDATA(screen, l1); + if (!LineTstWrapped(ld)) { + result = 0; + break; + } + } + if (result) { + /* Everything is on one "wrapped line" now */ + *deltap = line - screen->cur_row; + } + } + return result; +} + +static int +eventRow(TScreen *screen, XEvent *event) /* must be XButtonEvent */ +{ + return (event->xbutton.y - screen->border) / FontHeight(screen); +} + +static int +eventColBetween(TScreen *screen, XEvent *event) /* must be XButtonEvent */ +{ + /* Correct by half a width - we are acting on a boundary, not on a cell. */ + return ((event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) / 2) + / FontWidth(screen)); +} + +static int +ReadLineMovePoint(TScreen *screen, int col, int ldelta) +{ + Char line[6]; + unsigned count = 0; + + col += ldelta * MaxCols(screen) - screen->cur_col; + if (col == 0) + return 0; + if (screen->control_eight_bits) { + line[count++] = ANSI_CSI; + } else { + line[count++] = ANSI_ESC; + line[count++] = '['; /* XXX maybe sometimes O is better? */ + } + line[count] = CharOf(col > 0 ? 'C' : 'D'); + if (col < 0) + col = -col; + while (col--) + v_write(screen->respond, line, 3); + return 1; +} + +static int +ReadLineDelete(TScreen *screen, CELL *cell1, CELL *cell2) +{ + int del; + + del = (cell2->col - cell1->col) + ((cell2->row - cell1->row) * MaxCols(screen)); + if (del <= 0) /* Just in case... */ + return 0; + while (del--) + v_write(screen->respond, (const Char *) "\177", 1); + return 1; +} + +static void +readlineExtend(XtermWidget xw, XEvent *event) +{ + TScreen *screen = TScreenOf(xw); + int ldelta1, ldelta2; + + if (IsBtnEvent(event)) { + XButtonEvent *my_event = (XButtonEvent *) event; + if (isClick1_clean(xw, my_event) + && SCREEN_FLAG(screen, click1_moves) + && rowOnCurrentLine(screen, eventRow(screen, event), &ldelta1)) { + ReadLineMovePoint(screen, eventColBetween(screen, event), ldelta1); + } + if (isDoubleClick3(screen, my_event) + && SCREEN_FLAG(screen, dclick3_deletes) + && rowOnCurrentLine(screen, screen->startSel.row, &ldelta1) + && rowOnCurrentLine(screen, screen->endSel.row, &ldelta2)) { + ReadLineMovePoint(screen, screen->endSel.col, ldelta2); + ReadLineDelete(screen, &screen->startSel, &(screen->endSel)); + } + } +} +#endif /* OPT_READLINE */ + +/* ^XM-G */ +void +DiredButton(Widget w, + XEvent *event, /* must be XButtonEvent */ + String *params GCC_UNUSED, /* selections */ + Cardinal *num_params GCC_UNUSED) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + + if (IsBtnEvent(event) + && (event->xbutton.y >= screen->border) + && (event->xbutton.x >= OriginX(screen))) { + Char Line[6]; + unsigned line, col; + + line = (unsigned) ((event->xbutton.y - screen->border) + / FontHeight(screen)); + col = (unsigned) ((event->xbutton.x - OriginX(screen)) + / FontWidth(screen)); + Line[0] = CONTROL('X'); + Line[1] = ANSI_ESC; + Line[2] = 'G'; + Line[3] = CharOf(' ' + col); + Line[4] = CharOf(' ' + line); + v_write(screen->respond, Line, 5); + } + } +} + +#if OPT_READLINE +void +ReadLineButton(Widget w, + XEvent *event, /* must be XButtonEvent */ + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + Char Line[6]; + int line, col, ldelta = 0; + + if (!IsBtnEvent(event) + || (okSendMousePos(xw) != MOUSE_OFF) || ExtendingSelection) + goto finish; + if (event->type == ButtonRelease) { + int delta; + + if (lastButtonDownTime == (Time) 0) { + /* first time and once in a blue moon */ + delta = screen->multiClickTime + 1; + } else if (event->xbutton.time > lastButtonDownTime) { + /* most of the time */ + delta = (int) (event->xbutton.time - lastButtonDownTime); + } else { + /* time has rolled over since lastButtonUpTime */ + delta = (int) ((((Time) ~ 0) - lastButtonDownTime) + event->xbutton.time); + } + if (delta > screen->multiClickTime) + goto finish; /* All this work for this... */ + } + line = (event->xbutton.y - screen->border) / FontHeight(screen); + if (!rowOnCurrentLine(screen, line, &ldelta)) + goto finish; + /* Correct by half a width - we are acting on a boundary, not on a cell. */ + col = (event->xbutton.x - OriginX(screen) + (FontWidth(screen) - 1) + / 2) + / FontWidth(screen) - screen->cur_col + ldelta * MaxCols(screen); + if (col == 0) + goto finish; + Line[0] = ANSI_ESC; + /* XXX: sometimes it is better to send '['? */ + Line[1] = 'O'; + Line[2] = CharOf(col > 0 ? 'C' : 'D'); + if (col < 0) + col = -col; + while (col--) + v_write(screen->respond, Line, 3); + finish: + if (event->type == ButtonRelease) + do_select_end(xw, event, params, num_params, False); + } +} +#endif /* OPT_READLINE */ + +/* repeats n or p */ +void +ViButton(Widget w, + XEvent *event, /* must be XButtonEvent */ + String *params GCC_UNUSED, /* selections */ + Cardinal *num_params GCC_UNUSED) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + int pty = screen->respond; + + if (IsBtnEvent(event)) { + int line; + + line = screen->cur_row - + ((event->xbutton.y - screen->border) / FontHeight(screen)); + + if (line != 0) { + Char Line[6]; + + Line[0] = ANSI_ESC; /* force an exit from insert-mode */ + v_write(pty, Line, 1); + + if (line < 0) { + line = -line; + Line[0] = CONTROL('n'); + } else { + Line[0] = CONTROL('p'); + } + while (--line >= 0) + v_write(pty, Line, 1); + } + } + } +} + +/* + * This function handles button-motion events + */ +/*ARGSUSED*/ +void +HandleSelectExtend(Widget w, + XEvent *event, /* must be XMotionEvent */ + String *params GCC_UNUSED, + Cardinal *num_params GCC_UNUSED) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + CELL cell; + + TRACE_EVENT("HandleSelectExtend", event, params, num_params); + + screen->selection_time = event->xmotion.time; + switch (screen->eventMode) { + /* If not in one of the DEC mouse-reporting modes */ + case LEFTEXTENSION: + case RIGHTEXTENSION: + PointToCELL(screen, event->xmotion.y, event->xmotion.x, &cell); + ExtendExtend(xw, &cell); + break; + + /* If in motion reporting mode, send mouse position to + character process as a key sequence \E[M... */ + case NORMAL: + /* will get here if send_mouse_pos != MOUSE_OFF */ + if (okSendMousePos(xw) == BTN_EVENT_MOUSE + || okSendMousePos(xw) == ANY_EVENT_MOUSE) { + (void) SendMousePosition(xw, event); + } + break; + } + } +} + +void +HandleKeyboardSelectExtend(Widget w, + XEvent *event GCC_UNUSED, /* must be XButtonEvent */ + String *params GCC_UNUSED, + Cardinal *num_params GCC_UNUSED) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + + TRACE_EVENT("HandleKeyboardSelectExtend", event, params, num_params); + ExtendExtend(xw, &screen->cursorp); + } +} + +static void +do_select_end(XtermWidget xw, + XEvent *event, /* must be XButtonEvent */ + String *params, /* selections */ + Cardinal *num_params, + Bool use_cursor_loc) +{ + TScreen *screen = TScreenOf(xw); + + screen->selection_time = event->xbutton.time; + + TRACE(("do_select_end %s @%ld\n", + visibleEventMode(screen->eventMode), + screen->selection_time)); + + switch (screen->eventMode) { + case NORMAL: + (void) SendMousePosition(xw, event); + break; + case LEFTEXTENSION: + case RIGHTEXTENSION: + EndExtend(xw, event, params, *num_params, use_cursor_loc); +#if OPT_READLINE + readlineExtend(xw, event); +#endif /* OPT_READLINE */ + break; + } +} + +void +HandleSelectEnd(Widget w, + XEvent *event, /* must be XButtonEvent */ + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE(("HandleSelectEnd\n")); + do_select_end(xw, event, params, num_params, False); + } +} + +void +HandleKeyboardSelectEnd(Widget w, + XEvent *event, /* must be XButtonEvent */ + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE(("HandleKeyboardSelectEnd\n")); + do_select_end(xw, event, params, num_params, True); + } +} + +/* + * Copy the selection data to the given target(s). + */ +void +HandleCopySelection(Widget w, + XEvent *event, + String *params, /* list of targets */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleCopySelection", event, params, num_params); + SelectSet(xw, event, params, *num_params); + } +} + +struct _SelectionList { + String *params; + Cardinal count; + Atom *targets; + Time time; +}; + +static unsigned +DECtoASCII(unsigned ch) +{ + if (xtermIsDecGraphic(ch)) { + ch = CharOf("###########+++++##-##++++|######"[ch]); + /* 01234567890123456789012345678901 */ + } + return ch; +} + +#if OPT_WIDE_CHARS +static Cardinal +addXtermChar(Char **buffer, Cardinal *used, Cardinal offset, unsigned value) +{ + if (offset + 1 >= *used) { + *used = 1 + (2 * (offset + 1)); + allocXtermChars(buffer, *used); + } + (*buffer)[offset++] = (Char) value; + return offset; +} +#define AddChar(buffer, used, offset, value) \ + offset = addXtermChar(buffer, used, offset, (unsigned) value) + +/* + * Convert a UTF-8 string to Latin-1, replacing non Latin-1 characters by `#', + * or ASCII/Latin-1 equivalents for special cases. + */ +static Char * +UTF8toLatin1(TScreen *screen, Char *s, unsigned long len, unsigned long *result) +{ + static Char *buffer; + static Cardinal used; + + Cardinal offset = 0; + + if (len != 0) { + PtyData data; + + fakePtyData(&data, s, s + len); + while (decodeUtf8(screen, &data)) { + Bool fails = False; + Bool extra = False; + IChar value; + skipPtyData(&data, value); + if (value == UCS_REPL) { + fails = True; + } else if (value < 256) { + AddChar(&buffer, &used, offset, CharOf(value)); + } else { + unsigned eqv = ucs2dec(screen, value); + if (xtermIsDecGraphic(eqv)) { + AddChar(&buffer, &used, offset, DECtoASCII(eqv)); + } else { + eqv = AsciiEquivs(value); + if (eqv == value) { + fails = True; + } else { + AddChar(&buffer, &used, offset, eqv); + } + if (isWide((wchar_t) value)) + extra = True; + } + } + + /* + * If we're not able to plug in a single-byte result, insert the + * defaultString (which normally is a single "#", but could be + * whatever the user wants). + */ + if (fails) { + const Char *p; + + for (p = (const Char *) screen->default_string; *p != '\0'; ++p) { + AddChar(&buffer, &used, offset, *p); + } + } + if (extra) + AddChar(&buffer, &used, offset, ' '); + } + AddChar(&buffer, &used, offset, '\0'); + *result = (unsigned long) (offset - 1); + } else { + *result = 0; + } + return buffer; +} + +int +xtermUtf8ToTextList(XtermWidget xw, + XTextProperty * text_prop, + char ***text_list, + int *text_list_count) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + int rc = -1; + + if (text_prop->format == 8 + && (rc = Xutf8TextPropertyToTextList(dpy, text_prop, + text_list, + text_list_count)) >= 0) { + if (*text_list != NULL && *text_list_count != 0) { + int i; + Char *data; + char **new_text_list, *tmp; + unsigned long size, new_size; + + TRACE(("xtermUtf8ToTextList size %d\n", *text_list_count)); + + /* + * XLib StringList actually uses only two pointers, one for the + * list itself, and one for the data. Pointer to the data is the + * first element of the list, the rest (if any) list elements point + * to the same memory block as the first element + */ + new_size = 0; + for (i = 0; i < *text_list_count; ++i) { + data = (Char *) (*text_list)[i]; + size = strlen((*text_list)[i]) + 1; + (void) UTF8toLatin1(screen, data, size, &size); + new_size += size + 1; + } + new_text_list = TypeXtMallocN(char *, *text_list_count); + new_text_list[0] = tmp = XtMalloc((Cardinal) new_size); + for (i = 0; i < (*text_list_count); ++i) { + data = (Char *) (*text_list)[i]; + size = strlen((*text_list)[i]) + 1; + if ((data = UTF8toLatin1(screen, data, size, &size)) != 0) { + memcpy(tmp, data, size + 1); + new_text_list[i] = tmp; + tmp += size + 1; + } + } + XFreeStringList((*text_list)); + *text_list = new_text_list; + } else { + rc = -1; + } + } + return rc; +} +#endif /* OPT_WIDE_CHARS */ + +static char * +parseItem(char *value, char *nextc) +{ + char *nextp = value; + while (*nextp != '\0' && *nextp != ',') { + *nextp = x_toupper(*nextp); + ++nextp; + } + *nextc = *nextp; + *nextp = '\0'; + + return nextp; +} + +/* + * All of the wanted strings are unique in the first character, so we can + * use simple abbreviations. + */ +static Bool +sameItem(const char *actual, const char *wanted) +{ + Bool result = False; + size_t have = strlen(actual); + size_t need = strlen(wanted); + + if (have != 0 && have <= need) { + if (!strncmp(actual, wanted, have)) { + TRACE(("...matched \"%s\"\n", wanted)); + result = True; + } + } + + return result; +} + +/* + * Handle the eightBitSelectTypes or utf8SelectTypes resource values. + */ +static Bool +overrideTargets(Widget w, String value, Atom **resultp) +{ + Bool override = False; + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + + if (!IsEmpty(value)) { + char *copied = x_strdup(value); + if (copied != 0) { + Atom *result = 0; + Cardinal count = 1; + int n; + + TRACE(("decoding SelectTypes \"%s\"\n", value)); + for (n = 0; copied[n] != '\0'; ++n) { + if (copied[n] == ',') + ++count; + } + result = TypeXtMallocN(Atom, (2 * count) + 1); + if (result == NULL) { + TRACE(("Couldn't allocate selection types\n")); + } else { + char nextc = '?'; + char *listp = (char *) copied; + count = 0; + do { + char *nextp = parseItem(listp, &nextc); + char *item = x_strtrim(listp); + size_t len = (item ? strlen(item) : 0); + + if (len == 0) { + /* EMPTY */ ; + } +#if OPT_WIDE_CHARS + else if (sameItem(item, "UTF8")) { + result[count++] = XA_UTF8_STRING(XtDisplay(w)); + } +#endif + else if (sameItem(item, "I18N")) { + if (screen->i18nSelections) { + result[count++] = XA_TEXT(XtDisplay(w)); + result[count++] = XA_COMPOUND_TEXT(XtDisplay(w)); + } + } else if (sameItem(item, "TEXT")) { + result[count++] = XA_TEXT(XtDisplay(w)); + } else if (sameItem(item, "COMPOUND_TEXT")) { + result[count++] = XA_COMPOUND_TEXT(XtDisplay(w)); + } else if (sameItem(item, "STRING")) { + result[count++] = XA_STRING; + } + *nextp++ = nextc; + listp = nextp; + free(item); + } while (nextc != '\0'); + if (count) { + result[count] = None; + override = True; + *resultp = result; + } else { + XtFree((char *) result); + } + } + free(copied); + } else { + TRACE(("Couldn't allocate copy of selection types\n")); + } + } + } + return override; +} + +#if OPT_WIDE_CHARS +static Atom * +allocUtf8Targets(Widget w, TScreen *screen) +{ + Atom **resultp = &(screen->selection_targets_utf8); + + if (*resultp == 0) { + Atom *result; + + if (!overrideTargets(w, screen->utf8_select_types, &result)) { + result = TypeXtMallocN(Atom, 5); + if (result == NULL) { + TRACE(("Couldn't allocate utf-8 selection targets\n")); + } else { + int n = 0; + + if (XSupportsLocale()) { + result[n++] = XA_UTF8_STRING(XtDisplay(w)); +#ifdef X_HAVE_UTF8_STRING + if (screen->i18nSelections) { + result[n++] = XA_TEXT(XtDisplay(w)); + result[n++] = XA_COMPOUND_TEXT(XtDisplay(w)); + } +#endif + } + result[n++] = XA_STRING; + result[n] = None; + } + } + + *resultp = result; + } + + return *resultp; +} +#endif + +static Atom * +alloc8bitTargets(Widget w, TScreen *screen) +{ + Atom **resultp = &(screen->selection_targets_8bit); + + if (*resultp == 0) { + Atom *result = 0; + + if (!overrideTargets(w, screen->eightbit_select_types, &result)) { + result = TypeXtMallocN(Atom, 5); + if (result == NULL) { + TRACE(("Couldn't allocate 8bit selection targets\n")); + } else { + int n = 0; + + if (XSupportsLocale()) { +#ifdef X_HAVE_UTF8_STRING + result[n++] = XA_UTF8_STRING(XtDisplay(w)); +#endif + if (screen->i18nSelections) { + result[n++] = XA_TEXT(XtDisplay(w)); + result[n++] = XA_COMPOUND_TEXT(XtDisplay(w)); + } + } + result[n++] = XA_STRING; + result[n] = None; + } + } + + *resultp = result; + } + + return *resultp; +} + +static Atom * +_SelectionTargets(Widget w) +{ + Atom *result; + XtermWidget xw; + + if ((xw = getXtermWidget(w)) == 0) { + result = NULL; + } else { + TScreen *screen = TScreenOf(xw); + +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + result = allocUtf8Targets(w, screen); + } else +#endif + { + /* not screen->wide_chars */ + result = alloc8bitTargets(w, screen); + } + } + + return result; +} + +#define isSELECT(value) (!strcmp(value, "SELECT")) + +static int +DefaultSelection(TScreen *screen) +{ + return (screen->selectToClipboard ? 1 : 0); +} + +static int +TargetToSelection(TScreen *screen, String name) +{ + int result = -1; + int cutb; + + if (isSELECT(name)) { + result = DefaultSelection(screen); + } else if (!strcmp(name, PRIMARY_NAME)) { + result = PRIMARY_CODE; + } else if (!strcmp(name, CLIPBOARD_NAME)) { + result = CLIPBOARD_CODE; + } else if (!strcmp(name, SECONDARY_NAME)) { + result = SECONDARY_CODE; + } else if (sscanf(name, "CUT_BUFFER%d", &cutb) == 1) { + if (cutb >= 0 && cutb < MAX_CUT_BUFFER) { + result = CutBufferToCode(cutb); + } else { + xtermWarning("unexpected cut-buffer code: %d\n", cutb); + } + } else { + xtermWarning("unexpected selection target: %s\n", name); + } + TRACE2(("TargetToSelection(%s) ->%d\n", name, result)); + return result; +} + +static void +UnmapSelections(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Cardinal n; + + if (screen->mappedSelect) { + for (n = 0; screen->mappedSelect[n] != 0; ++n) + free((void *) screen->mappedSelect[n]); + free(screen->mappedSelect); + screen->mappedSelect = 0; + } +} + +/* + * xterm generally uses the primary selection. Some applications prefer + * (or are limited to) the clipboard. Since the translations resource is + * complicated, users seldom change the way it affects selection. But it + * is simple to remap the choice between primary and clipboard before the + * call to XmuInternStrings(). + */ +static String * +MapSelections(XtermWidget xw, String *params, Cardinal num_params) +{ + String *result = params; + + if (params != 0 && num_params > 0) { + Cardinal j; + Boolean map = False; + + for (j = 0; j < num_params; ++j) { + TRACE(("param[%d]:%s\n", j, params[j])); + if (isSELECT(params[j])) { + map = True; + break; + } + } + if (map) { + TScreen *screen = TScreenOf(xw); + const char *mapTo = (screen->selectToClipboard + ? CLIPBOARD_NAME + : PRIMARY_NAME); + + UnmapSelections(xw); + if ((result = TypeMallocN(String, num_params + 1)) != 0) { + result[num_params] = 0; + for (j = 0; j < num_params; ++j) { + result[j] = x_strdup((isSELECT(params[j]) + ? mapTo + : params[j])); + if (result[j] == 0) { + UnmapSelections(xw); + while (j != 0) { + free((void *) result[--j]); + } + free(result); + result = 0; + break; + } + } + screen->mappedSelect = result; + } + } + } + return result; +} + +/* + * Lookup the cut-buffer number, which will be in the range 0-7. + * If it is not a cut-buffer, it is a type of selection, e.g., primary. + */ +static int +CutBuffer(Atom code) +{ + int cutbuffer; + switch ((unsigned) code) { + case XA_CUT_BUFFER0: + cutbuffer = 0; + break; + case XA_CUT_BUFFER1: + cutbuffer = 1; + break; + case XA_CUT_BUFFER2: + cutbuffer = 2; + break; + case XA_CUT_BUFFER3: + cutbuffer = 3; + break; + case XA_CUT_BUFFER4: + cutbuffer = 4; + break; + case XA_CUT_BUFFER5: + cutbuffer = 5; + break; + case XA_CUT_BUFFER6: + cutbuffer = 6; + break; + case XA_CUT_BUFFER7: + cutbuffer = 7; + break; + default: + cutbuffer = -1; + break; + } + TRACE2(("CutBuffer(%d) = %d\n", (int) code, cutbuffer)); + return cutbuffer; +} + +#if OPT_PASTE64 +static void +FinishPaste64(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + TRACE(("FinishPaste64(%d)\n", screen->base64_paste)); + if (screen->base64_paste) { + screen->base64_paste = 0; + unparseputc1(xw, screen->base64_final); + unparse_end(xw); + } +} +#endif + +#if !OPT_PASTE64 +static +#endif +void +xtermGetSelection(Widget w, + Time ev_time, + String *params, /* selections in precedence order */ + Cardinal num_params, + Atom *targets) +{ + Atom selection; + int cutbuffer; + Atom target; + + XtermWidget xw; + + if (num_params == 0) + return; + if ((xw = getXtermWidget(w)) == 0) + return; + + TRACE(("xtermGetSelection num_params %d @%ld\n", num_params, ev_time)); + params = MapSelections(xw, params, num_params); + + XmuInternStrings(XtDisplay(w), params, (Cardinal) 1, &selection); + cutbuffer = CutBuffer(selection); + + TRACE(("Cutbuffer: %d, target: %s\n", cutbuffer, + (targets + ? visibleSelectionTarget(XtDisplay(w), targets[0]) + : "None"))); + + if (cutbuffer >= 0) { + int inbytes; + unsigned long nbytes; + int fmt8 = 8; + Atom type = XA_STRING; + char *line; + + /* 'line' is freed in SelectionReceived */ + line = XFetchBuffer(XtDisplay(w), &inbytes, cutbuffer); + nbytes = (unsigned long) inbytes; + + if (nbytes > 0) { + SelectionReceived(w, NULL, &selection, &type, (XtPointer) line, + &nbytes, &fmt8); + } else if (num_params > 1) { + xtermGetSelection(w, ev_time, params + 1, num_params - 1, NULL); + } +#if OPT_PASTE64 + else { + FinishPaste64(xw); + } +#endif + } else { + + if (targets == NULL || targets[0] == None) { + targets = _SelectionTargets(w); + } + + if (targets != 0) { + struct _SelectionList *list; + + target = targets[0]; + + if (targets[1] == None) { /* last target in list */ + params++; + num_params--; + targets = _SelectionTargets(w); + } else { + targets = &(targets[1]); + } + + if (num_params) { + /* 'list' is freed in SelectionReceived */ + list = TypeXtMalloc(struct _SelectionList); + if (list != 0) { + list->params = params; + list->count = num_params; + list->targets = targets; + list->time = ev_time; + } + } else { + list = NULL; + } + + XtGetSelectionValue(w, selection, + target, + SelectionReceived, + (XtPointer) list, ev_time); + } + } +} + +#if OPT_TRACE && OPT_WIDE_CHARS +static void +GettingSelection(Display *dpy, Atom type, Char *line, unsigned long len) +{ + Char *cp; + const char *name = TraceAtomName(dpy, type); + + TRACE(("Getting %s (type=%ld, length=%ld)\n", name, (long int) type, len)); + for (cp = line; cp < line + len; cp++) { + TRACE(("[%d:%lu]", (int) (cp + 1 - line), len)); + if (isprint(*cp)) { + TRACE(("%c\n", *cp)); + } else { + TRACE(("\\x%02x\n", *cp)); + } + } +} +#else +#define GettingSelection(dpy,type,line,len) /* nothing */ +#endif + +#ifdef VMS +# define tty_vwrite(pty,lag,l) tt_write(lag,l) +#else /* !( VMS ) */ +# define tty_vwrite(pty,lag,l) v_write(pty,lag,l) +#endif /* defined VMS */ + +#if OPT_PASTE64 +/* Return base64 code character given 6-bit number */ +static const char base64_code[] = "\ +ABCDEFGHIJKLMNOPQRSTUVWXYZ\ +abcdefghijklmnopqrstuvwxyz\ +0123456789+/"; +static void +base64_flush(TScreen *screen) +{ + Char x; + + TRACE(("base64_flush count %d, pad %d (%d)\n", + screen->base64_count, + screen->base64_pad, + screen->base64_pad & 3)); + + switch (screen->base64_count) { + case 0: + break; + case 2: + x = CharOf(base64_code[screen->base64_accu << 4]); + tty_vwrite(screen->respond, &x, 1); + break; + case 4: + x = CharOf(base64_code[screen->base64_accu << 2]); + tty_vwrite(screen->respond, &x, 1); + break; + } + if (screen->base64_pad & 3) { + tty_vwrite(screen->respond, + (const Char *) "===", + (unsigned) (3 - (screen->base64_pad & 3))); + } + screen->base64_count = 0; + screen->base64_accu = 0; + screen->base64_pad = 0; +} +#endif /* OPT_PASTE64 */ + +/* + * Translate ISO-8859-1 or UTF-8 data to NRCS. + */ +static void +ToNational(XtermWidget xw, Char *buffer, unsigned *length) +{ + TScreen *screen = TScreenOf(xw); + DECNRCM_codes gsetL = screen->gsets[screen->curgl]; + DECNRCM_codes gsetR = screen->gsets[screen->curgr]; + +#if OPT_WIDE_CHARS + if ((screen->utf8_nrc_mode | screen->utf8_mode) != uFalse) { + Char *p; + PtyData *data = TypeXtMallocX(PtyData, *length); + + memset(data, 0, sizeof(*data)); + data->next = data->buffer; + data->last = data->buffer + *length; + memcpy(data->buffer, buffer, (size_t) *length); + p = buffer; + while (data->next < data->last) { + unsigned chr, out, gl, gr; + + if (!decodeUtf8(screen, data)) { + data->utf_size = 1; + data->utf_data = data->next[0]; + } + data->next += data->utf_size; + chr = data->utf_data; + out = chr; + if ((gl = xtermCharSetIn(xw, chr, gsetL)) != chr) { + out = gl; + } else if ((gr = xtermCharSetIn(xw, chr, gsetR)) != chr) { + out = gr; + } + *p++ = (Char) ((out < 256) ? out : ' '); + } + *length = (unsigned) (p - buffer); + free(data); + } else +#endif + { + Char *p; + + for (p = buffer; (int) (p - buffer) < (int) *length; ++p) { + unsigned gl, gr; + unsigned chr = *p; + unsigned out = chr; + if ((gl = xtermCharSetIn(xw, chr, gsetL)) != chr) { + out = gl; + } else if ((gr = xtermCharSetIn(xw, chr, gsetR)) != chr) { + out = gr; + } + *p = (Char) out; + } + } +} + +static void +_qWriteSelectionData(XtermWidget xw, Char *lag, unsigned length) +{ + TScreen *screen = TScreenOf(xw); + + /* + * If we are pasting into a window which is using NRCS, we want to map + * the text from the normal encoding (ISO-8859-1 or UTF-8) into the coding + * that an application would use to write characters with NRCS. + * + * TODO: handle conversion from UTF-8, and adjust length. This can be done + * in the same buffer because the target is always 8-bit. + */ + if ((xw->flags & NATIONAL) && (length != 0)) { + ToNational(xw, lag, &length); + } +#if OPT_PASTE64 + if (screen->base64_paste) { + /* Send data as base64 */ + Char *p = lag; + Char buf[64]; + unsigned x = 0; + + TRACE(("convert to base64 %d:%s\n", length, visibleChars(p, length))); + + /* + * Handle the case where the selection is from _this_ xterm, which + * puts part of the reply in the buffer before the selection callback + * happens. + */ + if (screen->base64_paste && screen->unparse_len) { + unparse_end(xw); + } + while (length--) { + switch (screen->base64_count) { + case 0: + buf[x++] = CharOf(base64_code[*p >> 2]); + screen->base64_accu = (unsigned) (*p & 0x3); + screen->base64_count = 2; + ++p; + break; + case 2: + buf[x++] = CharOf(base64_code[(screen->base64_accu << 4) + + (*p >> 4)]); + screen->base64_accu = (unsigned) (*p & 0xF); + screen->base64_count = 4; + ++p; + break; + case 4: + buf[x++] = CharOf(base64_code[(screen->base64_accu << 2) + + (*p >> 6)]); + buf[x++] = CharOf(base64_code[*p & 0x3F]); + screen->base64_accu = 0; + screen->base64_count = 0; + ++p; + break; + } + if (x >= 63) { + /* Write 63 or 64 characters */ + screen->base64_pad += x; + TRACE(("writing base64 interim %s\n", visibleChars(buf, x))); + tty_vwrite(screen->respond, buf, x); + x = 0; + } + } + if (x != 0) { + screen->base64_pad += x; + TRACE(("writing base64 finish %s\n", visibleChars(buf, x))); + tty_vwrite(screen->respond, buf, x); + } + } else +#endif /* OPT_PASTE64 */ +#if OPT_READLINE + if (SCREEN_FLAG(screen, paste_quotes)) { + while (length--) { + tty_vwrite(screen->respond, (const Char *) "\026", 1); /* Control-V */ + tty_vwrite(screen->respond, lag++, 1); + } + } else +#endif + { + TRACE(("writing base64 padding %s\n", visibleChars(lag, length))); + tty_vwrite(screen->respond, lag, length); + } +} + +static void +_WriteSelectionData(XtermWidget xw, Char *line, size_t length) +{ + /* Write data to pty a line at a time. */ + /* Doing this one line at a time may no longer be necessary + because v_write has been re-written. */ + +#if OPT_PASTE64 + TScreen *screen = TScreenOf(xw); +#endif + Char *lag, *end; + + /* in the VMS version, if tt_pasting isn't set to True then qio + reads aren't blocked and an infinite loop is entered, where the + pasted text shows up as new input, goes in again, shows up + again, ad nauseum. */ +#ifdef VMS + tt_pasting = True; +#endif + + end = &line[length]; + lag = line; + +#if OPT_PASTE64 + if (screen->base64_paste) { + _qWriteSelectionData(xw, lag, (unsigned) (end - lag)); + base64_flush(screen); + } else +#endif + { + if (!SCREEN_FLAG(screen, paste_literal_nl)) { + Char *cp; + for (cp = line; cp != end; cp++) { + if (*cp == '\n') { + *cp = '\r'; + _qWriteSelectionData(xw, lag, (unsigned) (cp - lag + 1)); + lag = cp + 1; + } + } + } + + if (lag != end) { + _qWriteSelectionData(xw, lag, (unsigned) (end - lag)); + } + } +#ifdef VMS + tt_pasting = False; + tt_start_read(); /* reenable reads or a character may be lost */ +#endif +} + +#if OPT_PASTE64 || OPT_READLINE +static void +_WriteKey(TScreen *screen, const Char *in) +{ + Char line[16]; + unsigned count = 0; + size_t length = strlen((const char *) in); + + if (screen->control_eight_bits) { + line[count++] = ANSI_CSI; + } else { + line[count++] = ANSI_ESC; + line[count++] = '['; + } + while (length--) + line[count++] = *in++; + line[count++] = '~'; + tty_vwrite(screen->respond, line, count); +} +#endif /* OPT_READLINE */ + +/* + * Unless enabled by the user, strip control characters other than formatting. + */ +static size_t +removeControls(XtermWidget xw, char *value) +{ + TScreen *screen = TScreenOf(xw); + size_t dst = 0; + + if (screen->allowPasteControls) { + dst = strlen(value); + } else { + size_t src = 0; + while ((value[dst] = value[src]) != '\0') { + int ch = CharOf(value[src++]); + +#define ReplacePaste(n) \ + if (screen->disallow_paste_controls[n]) \ + value[dst] = ' ' + + if (ch < 32) { + ReplacePaste(epC0); + switch (ch) { + case ANSI_BS: + ReplacePaste(epBS); + break; + case ANSI_CR: + ReplacePaste(epCR); + break; + case ANSI_ESC: + ReplacePaste(epESC); + break; + case ANSI_FF: + ReplacePaste(epFF); + break; + case ANSI_HT: + ReplacePaste(epHT); + break; + case ANSI_LF: + ReplacePaste(epNL); + break; + default: + continue; + } + ++dst; + } else if (ch == ANSI_DEL) { + ReplacePaste(epDEL); + ++dst; + } +#if OPT_WIDE_CHARS + else if (screen->utf8_inparse || screen->utf8_nrc_mode) + ++dst; +#endif +#if OPT_C1_PRINT || OPT_WIDE_CHARS + else if (screen->c1_printable) + ++dst; +#endif + else if (ch >= 128 && ch < 160) + continue; + else + ++dst; + } + } + return dst; +} + +#if OPT_SELECTION_OPS +static void +beginInternalSelect(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + InternalSelect *mydata = &(screen->internal_select); + + (void) mydata; + /* override flags so that SelectionReceived only updates a buffer */ +#if OPT_PASTE64 + mydata->base64_paste = screen->base64_paste; + screen->base64_paste = 0; +#endif +#if OPT_PASTE64 || OPT_READLINE + mydata->paste_brackets = screen->paste_brackets; + SCREEN_FLAG_unset(screen, paste_brackets); +#endif +} + +static void +finishInternalSelect(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + InternalSelect *mydata = &(screen->internal_select); + + (void) mydata; +#if OPT_PASTE64 + screen->base64_paste = mydata->base64_paste; +#endif +#if OPT_PASTE64 || OPT_READLINE + screen->paste_brackets = mydata->paste_brackets; +#endif +} + +#else +#define finishInternalSelect(xw) /* nothing */ +#endif /* OPT_SELECTION_OPS */ + +/* SelectionReceived: stuff received selection text into pty */ + +/* ARGSUSED */ +static void +SelectionReceived(Widget w, + XtPointer client_data, + Atom *selection GCC_UNUSED, + Atom *type, + XtPointer value, + unsigned long *length, + int *format) +{ + char **text_list = NULL; + int text_list_count = 0; + XTextProperty text_prop; + TScreen *screen; + Display *dpy; +#if OPT_TRACE && OPT_WIDE_CHARS + Char *line = (Char *) value; +#endif + + XtermWidget xw; + + if ((xw = getXtermWidget(w)) == 0) + return; + + screen = TScreenOf(xw); + dpy = XtDisplay(w); + + if (*type == 0 /*XT_CONVERT_FAIL */ + || *length == 0 + || value == NULL) { + TRACE(("...no data to convert\n")); + goto fail; + } + + text_prop.value = (unsigned char *) value; + text_prop.encoding = *type; + text_prop.format = *format; + text_prop.nitems = *length; + + TRACE(("SelectionReceived %s %s format %d, nitems %ld\n", + TraceAtomName(screen->display, *selection), + visibleSelectionTarget(dpy, text_prop.encoding), + text_prop.format, + text_prop.nitems)); + +#if OPT_WIDE_CHARS + if (XSupportsLocale() && screen->wide_chars) { + if (*type == XA_UTF8_STRING(dpy) || + *type == XA_STRING || + *type == XA_COMPOUND_TEXT(dpy)) { + GettingSelection(dpy, *type, line, *length); + if (Xutf8TextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count) < 0) { + TRACE(("default Xutf8 Conversion failed\n")); + text_list = NULL; + } + } + } else +#endif /* OPT_WIDE_CHARS */ + { + /* Convert the selection to locale's multibyte encoding. */ + + if (*type == XA_UTF8_STRING(dpy) || + *type == XA_STRING || + *type == XA_COMPOUND_TEXT(dpy)) { + Status rc; + + GettingSelection(dpy, *type, line, *length); + +#if OPT_WIDE_CHARS + if (*type == XA_UTF8_STRING(dpy) && + !(screen->wide_chars || screen->c1_printable)) { + rc = xtermUtf8ToTextList(xw, &text_prop, + &text_list, &text_list_count); + } else +#endif + if (*type == XA_STRING && (!XSupportsLocale() || screen->brokenSelections)) { + rc = XTextPropertyToStringList(&text_prop, + &text_list, &text_list_count); + } else { + rc = XmbTextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count); + } + if (rc < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } + } + } + + if (text_list != NULL && text_list_count != 0) { + int i; + +#if OPT_PASTE64 + if (screen->base64_paste) { + /* EMPTY */ ; + } else +#endif +#if OPT_PASTE64 || OPT_READLINE + if (SCREEN_FLAG(screen, paste_brackets) && !screen->selectToBuffer) { + _WriteKey(screen, (const Char *) "200"); + } +#endif + for (i = 0; i < text_list_count; i++) { + size_t len = removeControls(xw, text_list[i]); + + if (screen->selectToBuffer) { + InternalSelect *mydata = &(screen->internal_select); + if (!mydata->done) { + size_t have = (mydata->buffer + ? strlen(mydata->buffer) + : 0); + size_t need = have + len + 1; + char *buffer = realloc(mydata->buffer, need); + + if (buffer != 0) { + strcpy(buffer + have, text_list[i]); + mydata->buffer = buffer; + } + TRACE(("FormatSelect %d.%d .. %d.%d %s\n", + screen->startSel.row, + screen->startSel.col, + screen->endSel.row, + screen->endSel.col, + mydata->buffer)); + mydata->format_select(w, mydata->format, mydata->buffer, + &(screen->startSel), + &(screen->endSel)); + mydata->done = True; + } + + } else { + _WriteSelectionData(xw, (Char *) text_list[i], len); + } + } +#if OPT_PASTE64 + if (screen->base64_paste) { + FinishPaste64(xw); + } else +#endif +#if OPT_PASTE64 || OPT_READLINE + if (SCREEN_FLAG(screen, paste_brackets) && !screen->selectToBuffer) { + _WriteKey(screen, (const Char *) "201"); + } +#endif + if (screen->selectToBuffer) { + InternalSelect *mydata = &(screen->internal_select); + finishInternalSelect(xw); + if (mydata->done) { + free(mydata->format); + free(mydata->buffer); + memset(mydata, 0, sizeof(*mydata)); + } + screen->selectToBuffer = False; + } + XFreeStringList(text_list); + } else { + TRACE(("...empty text-list\n")); + goto fail; + } + + XtFree((char *) client_data); + XtFree((char *) value); + + return; + + fail: + if (client_data != 0) { + struct _SelectionList *list = (struct _SelectionList *) client_data; + + TRACE(("SelectionReceived ->xtermGetSelection\n")); + xtermGetSelection(w, list->time, + list->params, list->count, list->targets); + XtFree((char *) client_data); +#if OPT_PASTE64 + } else { + FinishPaste64(xw); +#endif + } + return; +} + +void +HandleInsertSelection(Widget w, + XEvent *event, /* assumed to be XButtonEvent* */ + String *params, /* selections in precedence order */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleInsertSelection", event, params, num_params); + if (!SendMousePosition(xw, event)) { +#if OPT_READLINE + int ldelta; + TScreen *screen = TScreenOf(xw); + if (IsBtnEvent(event) + /* Disable on Shift-mouse, including the application-mouse modes */ + && !(KeyModifiers(event) & ShiftMask) + && (okSendMousePos(xw) == MOUSE_OFF) + && SCREEN_FLAG(screen, paste_moves) + && rowOnCurrentLine(screen, eventRow(screen, event), &ldelta)) + ReadLineMovePoint(screen, eventColBetween(screen, event), ldelta); +#endif /* OPT_READLINE */ + + xtermGetSelection(w, event->xbutton.time, params, *num_params, NULL); + } + } +} + +static SelectUnit +EvalSelectUnit(XtermWidget xw, + Time buttonDownTime, + SelectUnit defaultUnit, + unsigned int button) +{ + TScreen *screen = TScreenOf(xw); + SelectUnit result; + int delta; + + if (button != screen->lastButton) { + delta = screen->multiClickTime + 1; + } else if (screen->lastButtonUpTime == (Time) 0) { + /* first time and once in a blue moon */ + delta = screen->multiClickTime + 1; + } else if (buttonDownTime > screen->lastButtonUpTime) { + /* most of the time */ + delta = (int) (buttonDownTime - screen->lastButtonUpTime); + } else { + /* time has rolled over since lastButtonUpTime */ + delta = (int) ((((Time) ~ 0) - screen->lastButtonUpTime) + buttonDownTime); + } + + if (delta > screen->multiClickTime) { + screen->numberOfClicks = 1; + result = defaultUnit; + } else { + result = screen->selectMap[screen->numberOfClicks % screen->maxClicks]; + screen->numberOfClicks += 1; + } + TRACE(("EvalSelectUnit(%d) = %d\n", screen->numberOfClicks, result)); + return result; +} + +static void +do_select_start(XtermWidget xw, + XEvent *event, /* must be XButtonEvent* */ + CELL *cell) +{ + TScreen *screen = TScreenOf(xw); + + if (SendMousePosition(xw, event)) + return; + screen->selectUnit = EvalSelectUnit(xw, + event->xbutton.time, + Select_CHAR, + event->xbutton.button); + screen->replyToEmacs = False; + +#if OPT_READLINE + lastButtonDownTime = event->xbutton.time; +#endif + + StartSelect(xw, cell); +} + +/* ARGSUSED */ +void +HandleSelectStart(Widget w, + XEvent *event, /* must be XButtonEvent* */ + String *params GCC_UNUSED, + Cardinal *num_params GCC_UNUSED) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + CELL cell; + + TRACE_EVENT("HandleSelectStart", event, params, num_params); + screen->firstValidRow = 0; + screen->lastValidRow = screen->max_row; + PointToCELL(screen, event->xbutton.y, event->xbutton.x, &cell); + +#if OPT_READLINE + ExtendingSelection = 0; +#endif + + do_select_start(xw, event, &cell); + } +} + +/* ARGSUSED */ +void +HandleKeyboardSelectStart(Widget w, + XEvent *event, /* must be XButtonEvent* */ + String *params GCC_UNUSED, + Cardinal *num_params GCC_UNUSED) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TScreen *screen = TScreenOf(xw); + + TRACE_EVENT("HandleKeyboardSelectStart", event, params, num_params); + do_select_start(xw, event, &screen->cursorp); + } +} + +static void +TrackDown(XtermWidget xw, XButtonEvent *event) +{ + TScreen *screen = TScreenOf(xw); + CELL cell; + + screen->selectUnit = EvalSelectUnit(xw, + event->time, + Select_CHAR, + event->button); + if (screen->numberOfClicks > 1) { + PointToCELL(screen, event->y, event->x, &cell); + screen->replyToEmacs = True; + StartSelect(xw, &cell); + } else { + screen->waitingForTrackInfo = True; + EditorButton(xw, event); + } +} + +#define boundsCheck(x) if (x < 0) \ + x = 0; \ + else if (x >= screen->max_row) \ + x = screen->max_row + +void +TrackMouse(XtermWidget xw, + int func, + CELL *start, + int firstrow, + int lastrow) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->waitingForTrackInfo) { /* if Timed, ignore */ + screen->waitingForTrackInfo = False; + + if (func != 0) { + CELL first = *start; + + boundsCheck(first.row); + boundsCheck(firstrow); + boundsCheck(lastrow); + screen->firstValidRow = firstrow; + screen->lastValidRow = lastrow; + screen->replyToEmacs = True; + StartSelect(xw, &first); + } + } +} + +static void +StartSelect(XtermWidget xw, const CELL *cell) +{ + TScreen *screen = TScreenOf(xw); + + TRACE(("StartSelect row=%d, col=%d\n", cell->row, cell->col)); + if (screen->cursor_state) + HideCursor(); + if (screen->numberOfClicks == 1) { + /* set start of selection */ + screen->rawPos = *cell; + } + /* else use old values in rawPos */ + screen->saveStartR = screen->startExt = screen->rawPos; + screen->saveEndR = screen->endExt = screen->rawPos; + if (Coordinate(screen, cell) < Coordinate(screen, &(screen->rawPos))) { + screen->eventMode = LEFTEXTENSION; + screen->startExt = *cell; + } else { + screen->eventMode = RIGHTEXTENSION; + screen->endExt = *cell; + } + ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False); +} + +static void +EndExtend(XtermWidget xw, + XEvent *event, /* must be XButtonEvent */ + String *params, /* selections */ + Cardinal num_params, + Bool use_cursor_loc) +{ + CELL cell; + TScreen *screen = TScreenOf(xw); + + TRACE_EVENT("EndExtend", event, params, &num_params); + if (use_cursor_loc) { + cell = screen->cursorp; + } else { + PointToCELL(screen, event->xbutton.y, event->xbutton.x, &cell); + } + ExtendExtend(xw, &cell); + + screen->lastButtonUpTime = event->xbutton.time; + screen->lastButton = event->xbutton.button; + + if (!isSameCELL(&(screen->startSel), &(screen->endSel))) { + if (screen->replyToEmacs) { + Char line[64]; + unsigned count = 0; + + if (screen->control_eight_bits) { + line[count++] = ANSI_CSI; + } else { + line[count++] = ANSI_ESC; + line[count++] = '['; + } + if (isSameCELL(&(screen->rawPos), &(screen->startSel)) + && isSameCELL(&cell, &(screen->endSel))) { + /* Use short-form emacs select */ + + switch (screen->extend_coords) { + case 0: + case SET_EXT_MODE_MOUSE: + line[count++] = 't'; + break; + case SET_SGR_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = '<'; + break; + } + + count = EmitMousePosition(screen, line, count, screen->endSel.col); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, screen->endSel.row); + + switch (screen->extend_coords) { + case SET_SGR_EXT_MODE_MOUSE: + case SET_URXVT_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = 't'; + break; + } + } else { + /* long-form, specify everything */ + + switch (screen->extend_coords) { + case 0: + case SET_EXT_MODE_MOUSE: + line[count++] = 'T'; + break; + case SET_SGR_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = '<'; + break; + } + + count = EmitMousePosition(screen, line, count, screen->startSel.col); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, screen->startSel.row); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, screen->endSel.col); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, screen->endSel.row); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, cell.col); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, cell.row); + + switch (screen->extend_coords) { + case SET_SGR_EXT_MODE_MOUSE: + case SET_URXVT_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = 'T'; + break; + } + } + v_write(screen->respond, line, count); + UnHiliteText(xw); + } + } + SelectSet(xw, event, params, num_params); + screen->eventMode = NORMAL; +} + +void +HandleSelectSet(Widget w, + XEvent *event, + String *params, + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleSelectSet", event, params, num_params); + SelectSet(xw, event, params, *num_params); + } +} + +/* ARGSUSED */ +static void +SelectSet(XtermWidget xw, + XEvent *event GCC_UNUSED, + String *params, + Cardinal num_params) +{ + TScreen *screen = TScreenOf(xw); + + TRACE(("SelectSet\n")); + /* Only do select stuff if non-null select */ + if (!isSameCELL(&(screen->startSel), &(screen->endSel))) { + Cardinal n; + for (n = 0; n < num_params; ++n) { + SaltTextAway(xw, + TargetToSelection(screen, params[n]), + &(screen->startSel), &(screen->endSel)); + } + _OwnSelection(xw, params, num_params); + } else { + ScrnDisownSelection(xw); + } +} + +#define Abs(x) ((x) < 0 ? -(x) : (x)) + +/* ARGSUSED */ +static void +do_start_extend(XtermWidget xw, + XEvent *event, /* must be XButtonEvent* */ + String *params GCC_UNUSED, + Cardinal *num_params GCC_UNUSED, + Bool use_cursor_loc) +{ + TScreen *screen = TScreenOf(xw); + int coord; + CELL cell; + + if (SendMousePosition(xw, event)) + return; + + screen->firstValidRow = 0; + screen->lastValidRow = screen->max_row; +#if OPT_READLINE + if ((KeyModifiers(event) & ShiftMask) + || event->xbutton.button != Button3 + || !(SCREEN_FLAG(screen, dclick3_deletes))) +#endif + screen->selectUnit = EvalSelectUnit(xw, + event->xbutton.time, + screen->selectUnit, + event->xbutton.button); + screen->replyToEmacs = False; + +#if OPT_READLINE + CheckSecondPress3(screen, event); +#endif + + if (screen->numberOfClicks == 1 + || (SCREEN_FLAG(screen, dclick3_deletes) /* Dclick special */ + &&!(KeyModifiers(event) & ShiftMask))) { + /* Save existing selection so we can reestablish it if the guy + extends past the other end of the selection */ + screen->saveStartR = screen->startExt = screen->startRaw; + screen->saveEndR = screen->endExt = screen->endRaw; + } else { + /* He just needed the selection mode changed, use old values. */ + screen->startExt = screen->startRaw = screen->saveStartR; + screen->endExt = screen->endRaw = screen->saveEndR; + } + if (use_cursor_loc) { + cell = screen->cursorp; + } else { + PointToCELL(screen, event->xbutton.y, event->xbutton.x, &cell); + } + coord = Coordinate(screen, &cell); + + if (Abs(coord - Coordinate(screen, &(screen->startSel))) + < Abs(coord - Coordinate(screen, &(screen->endSel))) + || coord < Coordinate(screen, &(screen->startSel))) { + /* point is close to left side of selection */ + screen->eventMode = LEFTEXTENSION; + screen->startExt = cell; + } else { + /* point is close to left side of selection */ + screen->eventMode = RIGHTEXTENSION; + screen->endExt = cell; + } + ComputeSelect(xw, &(screen->startExt), &(screen->endExt), True); + +#if OPT_READLINE + if (!isSameCELL(&(screen->startSel), &(screen->endSel))) + ExtendingSelection = 1; +#endif +} + +static void +ExtendExtend(XtermWidget xw, const CELL *cell) +{ + TScreen *screen = TScreenOf(xw); + int coord = Coordinate(screen, cell); + + TRACE(("ExtendExtend row=%d, col=%d\n", cell->row, cell->col)); + if (screen->eventMode == LEFTEXTENSION + && ((coord + (screen->selectUnit != Select_CHAR)) + > Coordinate(screen, &(screen->endSel)))) { + /* Whoops, he's changed his mind. Do RIGHTEXTENSION */ + screen->eventMode = RIGHTEXTENSION; + screen->startExt = screen->saveStartR; + } else if (screen->eventMode == RIGHTEXTENSION + && coord < Coordinate(screen, &(screen->startSel))) { + /* Whoops, he's changed his mind. Do LEFTEXTENSION */ + screen->eventMode = LEFTEXTENSION; + screen->endExt = screen->saveEndR; + } + if (screen->eventMode == LEFTEXTENSION) { + screen->startExt = *cell; + } else { + screen->endExt = *cell; + } + ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False); + +#if OPT_READLINE + if (!isSameCELL(&(screen->startSel), &(screen->endSel))) + ExtendingSelection = 1; +#endif +} + +void +HandleStartExtend(Widget w, + XEvent *event, /* must be XButtonEvent* */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleStartExtend", event, params, num_params); + do_start_extend(xw, event, params, num_params, False); + } +} + +void +HandleKeyboardStartExtend(Widget w, + XEvent *event, /* must be XButtonEvent* */ + String *params, /* unused */ + Cardinal *num_params) /* unused */ +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleKeyboardStartExtend", event, params, num_params); + do_start_extend(xw, event, params, num_params, True); + } +} + +void +ScrollSelection(TScreen *screen, int amount, Bool always) +{ + int minrow = INX2ROW(screen, -screen->savedlines); + int maxrow = INX2ROW(screen, screen->max_row); + int maxcol = screen->max_col; + +#define scroll_update_one(cell) \ + (cell)->row += amount; \ + if ((cell)->row < minrow) { \ + (cell)->row = minrow; \ + (cell)->col = 0; \ + } \ + if ((cell)->row > maxrow) { \ + (cell)->row = maxrow; \ + (cell)->col = maxcol; \ + } + + scroll_update_one(&(screen->startRaw)); + scroll_update_one(&(screen->endRaw)); + scroll_update_one(&(screen->startSel)); + scroll_update_one(&(screen->endSel)); + + scroll_update_one(&(screen->rawPos)); + + /* + * If we are told to scroll the selection but it lies outside the scrolling + * margins, then that could cause the selection to move (bad). It is not + * simple to fix, because this function is called both for the scrollbar + * actions as well as application scrolling. The 'always' flag is set in + * the former case. The rest of the logic handles the latter. + */ + if (ScrnHaveSelection(screen)) { + int adjust; + + adjust = ROW2INX(screen, screen->startH.row); + if (always + || !ScrnHaveRowMargins(screen) + || ScrnIsRowInMargins(screen, adjust)) { + scroll_update_one(&screen->startH); + } + adjust = ROW2INX(screen, screen->endH.row); + if (always + || !ScrnHaveRowMargins(screen) + || ScrnIsRowInMargins(screen, adjust)) { + scroll_update_one(&screen->endH); + } + } + + screen->startHCoord = Coordinate(screen, &screen->startH); + screen->endHCoord = Coordinate(screen, &screen->endH); +} + +/*ARGSUSED*/ +void +ResizeSelection(TScreen *screen, int rows, int cols) +{ + rows--; /* decr to get 0-max */ + cols--; + + if (screen->startRaw.row > rows) + screen->startRaw.row = rows; + if (screen->startSel.row > rows) + screen->startSel.row = rows; + if (screen->endRaw.row > rows) + screen->endRaw.row = rows; + if (screen->endSel.row > rows) + screen->endSel.row = rows; + if (screen->rawPos.row > rows) + screen->rawPos.row = rows; + + if (screen->startRaw.col > cols) + screen->startRaw.col = cols; + if (screen->startSel.col > cols) + screen->startSel.col = cols; + if (screen->endRaw.col > cols) + screen->endRaw.col = cols; + if (screen->endSel.col > cols) + screen->endSel.col = cols; + if (screen->rawPos.col > cols) + screen->rawPos.col = cols; +} + +#if OPT_WIDE_CHARS +#define isWideCell(row, col) isWideFrg((int)XTERM_CELL(row, col)) +#endif + +static void +PointToCELL(TScreen *screen, + int y, + int x, + CELL *cell) +/* Convert pixel coordinates to character coordinates. + Rows are clipped between firstValidRow and lastValidRow. + Columns are clipped between to be 0 or greater, but are not clipped to some + maximum value. */ +{ + cell->row = (y - screen->border) / FontHeight(screen); + if (cell->row < screen->firstValidRow) + cell->row = screen->firstValidRow; + else if (cell->row > screen->lastValidRow) + cell->row = screen->lastValidRow; + cell->col = (x - OriginX(screen)) / FontWidth(screen); + if (cell->col < 0) + cell->col = 0; + else if (cell->col > MaxCols(screen)) { + cell->col = MaxCols(screen); + } +#if OPT_WIDE_CHARS + /* + * If we got a click on the right half of a doublewidth character, + * pretend it happened on the left half. + */ + if (cell->col > 0 + && isWideCell(cell->row, cell->col - 1) + && (XTERM_CELL(cell->row, cell->col) == HIDDEN_CHAR)) { + cell->col -= 1; + } +#endif +} + +/* + * Find the last column at which text was drawn on the given row. + */ +static int +LastTextCol(TScreen *screen, CLineData *ld, int row) +{ + int i = -1; + + if (ld != 0) { + if (okScrnRow(screen, row)) { + const IAttr *ch; + for (i = screen->max_col, + ch = ld->attribs + i; + i >= 0 && !(*ch & CHARDRAWN); + ch--, i--) { + ; + } +#if OPT_DEC_CHRSET + if (CSET_DOUBLE(GetLineDblCS(ld))) { + i *= 2; + } +#endif + } + } + return (i); +} + +#if !OPT_WIDE_CHARS +/* +** double click table for cut and paste in 8 bits +** +** This table is divided in four parts : +** +** - control characters [0,0x1f] U [0x80,0x9f] +** - separators [0x20,0x3f] U [0xa0,0xb9] +** - binding characters [0x40,0x7f] U [0xc0,0xff] +** - exceptions +*/ +/* *INDENT-OFF* */ +static int charClass[256] = +{ +/* NUL SOH STX ETX EOT ENQ ACK BEL */ + 32, 1, 1, 1, 1, 1, 1, 1, +/* BS HT NL VT FF CR SO SI */ + 1, 32, 1, 1, 1, 1, 1, 1, +/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* CAN EM SUB ESC FS GS RS US */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* SP ! " # $ % & ' */ + 32, 33, 34, 35, 36, 37, 38, 39, +/* ( ) * + , - . / */ + 40, 41, 42, 43, 44, 45, 46, 47, +/* 0 1 2 3 4 5 6 7 */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* 8 9 : ; < = > ? */ + 48, 48, 58, 59, 60, 61, 62, 63, +/* @ A B C D E F G */ + 64, 48, 48, 48, 48, 48, 48, 48, +/* H I J K L M N O */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* P Q R S T U V W */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* X Y Z [ \ ] ^ _ */ + 48, 48, 48, 91, 92, 93, 94, 48, +/* ` a b c d e f g */ + 96, 48, 48, 48, 48, 48, 48, 48, +/* h i j k l m n o */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* p q r s t u v w */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* x y z { | } ~ DEL */ + 48, 48, 48, 123, 124, 125, 126, 1, +/* x80 x81 x82 x83 IND NEL SSA ESA */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* HTS HTJ VTS PLD PLU RI SS2 SS3 */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* DCS PU1 PU2 STS CCH MW SPA EPA */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* x98 x99 x9A CSI ST OSC PM APC */ + 1, 1, 1, 1, 1, 1, 1, 1, +/* - i c/ L ox Y- | So */ + 160, 161, 162, 163, 164, 165, 166, 167, +/* .. c0 ip << _ R0 - */ + 168, 169, 170, 171, 172, 173, 174, 175, +/* o +- 2 3 ' u q| . */ + 176, 177, 178, 179, 180, 181, 182, 183, +/* , 1 2 >> 1/4 1/2 3/4 ? */ + 184, 185, 186, 187, 188, 189, 190, 191, +/* A` A' A^ A~ A: Ao AE C, */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* E` E' E^ E: I` I' I^ I: */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* D- N~ O` O' O^ O~ O: X */ + 48, 48, 48, 48, 48, 48, 48, 215, +/* O/ U` U' U^ U: Y' P B */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* a` a' a^ a~ a: ao ae c, */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* e` e' e^ e: i` i' i^ i: */ + 48, 48, 48, 48, 48, 48, 48, 48, +/* d n~ o` o' o^ o~ o: -: */ + 48, 48, 48, 48, 48, 48, 48, 247, +/* o/ u` u' u^ u: y' P y: */ + 48, 48, 48, 48, 48, 48, 48, 48}; +/* *INDENT-ON* */ + +int +SetCharacterClassRange(int low, /* in range of [0..255] */ + int high, + int value) /* arbitrary */ +{ + + if (low < 0 || high > 255 || high < low) + return (-1); + + for (; low <= high; low++) + charClass[low] = value; + + return (0); +} +#endif + +static int +class_of(LineData *ld, CELL *cell) +{ + CELL temp = *cell; + int result = 0; + +#if OPT_DEC_CHRSET + if (CSET_DOUBLE(GetLineDblCS(ld))) { + temp.col /= 2; + } +#endif + if (temp.col < (int) ld->lineSize) + result = CharacterClass((int) (ld->charData[temp.col])); + return result; +} + +#if OPT_WIDE_CHARS +#define CClassSelects(name, cclass) \ + (CClassOf(name) == cclass \ + || XTERM_CELL(screen->name.row, screen->name.col) == HIDDEN_CHAR) +#else +#define CClassSelects(name, cclass) \ + (class_of(ld.name, &((screen->name))) == cclass) +#endif + +#define CClassOf(name) class_of(ld.name, &((screen->name))) + +#if OPT_REPORT_CCLASS +static int +show_cclass_range(int lo, int hi) +{ + int cclass = CharacterClass(lo); + int ident = (cclass == lo); + int more = 0; + if (ident) { + int ch; + for (ch = lo + 1; ch <= hi; ch++) { + if (CharacterClass(ch) != ch) { + ident = 0; + break; + } + } + if (ident && (hi < 255)) { + ch = hi + 1; + if (CharacterClass(ch) == ch) { + if (ch >= 255 || CharacterClass(ch + 1) != ch) { + more = 1; + } + } + } + } + if (!more) { + if (lo == hi) { + printf("\t%d", lo); + } else { + printf("\t%d-%d", lo, hi); + } + if (!ident) + printf(":%d", cclass); + if (hi < 255) + printf(", \\"); + printf("\n"); + } + return !more; +} + +void +report_char_class(XtermWidget xw) +{ + /* simple table, to match documentation */ + static const char charnames[] = + "NUL\0" "SOH\0" "STX\0" "ETX\0" "EOT\0" "ENQ\0" "ACK\0" "BEL\0" + " BS\0" " HT\0" " NL\0" " VT\0" " NP\0" " CR\0" " SO\0" " SI\0" + "DLE\0" "DC1\0" "DC2\0" "DC3\0" "DC4\0" "NAK\0" "SYN\0" "ETB\0" + "CAN\0" " EM\0" "SUB\0" "ESC\0" " FS\0" " GS\0" " RS\0" " US\0" + " SP\0" " !\0" " \"\0" " #\0" " $\0" " %\0" " &\0" " '\0" + " (\0" " )\0" " *\0" " +\0" " ,\0" " -\0" " .\0" " /\0" + " 0\0" " 1\0" " 2\0" " 3\0" " 4\0" " 5\0" " 6\0" " 7\0" + " 8\0" " 9\0" " :\0" " ;\0" " <\0" " =\0" " >\0" " ?\0" + " @\0" " A\0" " B\0" " C\0" " D\0" " E\0" " F\0" " G\0" + " H\0" " I\0" " J\0" " K\0" " L\0" " M\0" " N\0" " O\0" + " P\0" " Q\0" " R\0" " S\0" " T\0" " U\0" " V\0" " W\0" + " X\0" " Y\0" " Z\0" " [\0" " \\\0" " ]\0" " ^\0" " _\0" + " `\0" " a\0" " b\0" " c\0" " d\0" " e\0" " f\0" " g\0" + " h\0" " i\0" " j\0" " k\0" " l\0" " m\0" " n\0" " o\0" + " p\0" " q\0" " r\0" " s\0" " t\0" " u\0" " v\0" " w\0" + " x\0" " y\0" " z\0" " {\0" " |\0" " }\0" " ~\0" "DEL\0" + "x80\0" "x81\0" "x82\0" "x83\0" "IND\0" "NEL\0" "SSA\0" "ESA\0" + "HTS\0" "HTJ\0" "VTS\0" "PLD\0" "PLU\0" " RI\0" "SS2\0" "SS3\0" + "DCS\0" "PU1\0" "PU2\0" "STS\0" "CCH\0" " MW\0" "SPA\0" "EPA\0" + "x98\0" "x99\0" "x9A\0" "CSI\0" " ST\0" "OSC\0" " PM\0" "APC\0" + " -\0" " i\0" " c/\0" " L\0" " ox\0" " Y-\0" " |\0" " So\0" + " ..\0" " c0\0" " ip\0" " <<\0" " _\0" " \0" " R0\0" " -\0" + " o\0" " +-\0" " 2\0" " 3\0" " '\0" " u\0" " q|\0" " .\0" + " ,\0" " 1\0" " 2\0" " >>\0" "1/4\0" "1/2\0" "3/4\0" " ?\0" + " A`\0" " A'\0" " A^\0" " A~\0" " A:\0" " Ao\0" " AE\0" " C,\0" + " E`\0" " E'\0" " E^\0" " E:\0" " I`\0" " I'\0" " I^\0" " I:\0" + " D-\0" " N~\0" " O`\0" " O'\0" " O^\0" " O~\0" " O:\0" " X\0" + " O/\0" " U`\0" " U'\0" " U^\0" " U:\0" " Y'\0" " P\0" " B\0" + " a`\0" " a'\0" " a^\0" " a~\0" " a:\0" " ao\0" " ae\0" " c,\0" + " e`\0" " e'\0" " e^\0" " e:\0" " i`\0" " i'\0" " i^\0" " i:\0" + " d\0" " n~\0" " o`\0" " o'\0" " o^\0" " o~\0" " o:\0" " -:\0" + " o/\0" " u`\0" " u'\0" " u^\0" " u:\0" " y'\0" " P\0" " y:\0"; + int ch, dh; + int class_p; + + (void) xw; + + printf("static int charClass[256] = {\n"); + for (ch = 0; ch < 256; ++ch) { + const char *s = charnames + (ch * 4); + if ((ch & 7) == 0) + printf("/*"); + printf(" %s ", s); + if (((ch + 1) & 7) == 0) { + printf("*/\n "); + for (dh = ch - 7; dh <= ch; ++dh) { + printf(" %3d%s", CharacterClass(dh), dh == 255 ? "};" : ","); + } + printf("\n"); + } + } + + /* print the table as if it were the charClass resource */ + printf("\n"); + printf("The table is equivalent to this \"charClass\" resource:\n"); + class_p = CharacterClass(dh = 0); + for (ch = 0; ch < 256; ++ch) { + int class_c = CharacterClass(ch); + if (class_c != class_p) { + if (show_cclass_range(dh, ch - 1)) { + dh = ch; + class_p = class_c; + } + } + } + if (dh < 255) { + show_cclass_range(dh, 255); + } + + if_OPT_WIDE_CHARS(TScreenOf(xw), { + /* if this is a wide-character configuration, print all intervals */ + report_wide_char_class(); + }); +} +#endif + +/* + * If the given column is past the end of text on the given row, bump to the + * beginning of the next line. + */ +static Boolean +okPosition(TScreen *screen, + LineData **ld, + CELL *cell) +{ + Boolean result = True; + + if (cell->row > screen->max_row) { + result = False; + } else if (cell->col > (LastTextCol(screen, *ld, cell->row) + 1)) { + if (cell->row < screen->max_row) { + cell->col = 0; + *ld = GET_LINEDATA(screen, ++cell->row); + result = False; + } + } + return result; +} + +static void +trimLastLine(TScreen *screen, + LineData **ld, + CELL *last) +{ + if (screen->cutNewline && last->row < screen->max_row) { + last->col = 0; + *ld = GET_LINEDATA(screen, ++last->row); + } else { + last->col = LastTextCol(screen, *ld, last->row) + 1; + } +} + +#if OPT_SELECT_REGEX +/* + * Returns the first row of a wrapped line. + */ +static int +firstRowOfLine(TScreen *screen, int row, Bool visible) +{ + LineData *ld = 0; + int limit = visible ? 0 : -screen->savedlines; + + while (row > limit && + (ld = GET_LINEDATA(screen, row - 1)) != 0 && + LineTstWrapped(ld)) { + --row; + } + return row; +} + +/* + * Returns the last row of a wrapped line. + */ +static int +lastRowOfLine(TScreen *screen, int row) +{ + LineData *ld; + + while (row < screen->max_row && + (ld = GET_LINEDATA(screen, row)) != 0 && + LineTstWrapped(ld)) { + ++row; + } + return row; +} + +/* + * Returns the number of cells on the range of rows. + */ +static unsigned +lengthOfLines(TScreen *screen, int firstRow, int lastRow) +{ + unsigned length = 0; + int n; + + for (n = firstRow; n <= lastRow; ++n) { + LineData *ld = GET_LINEDATA(screen, n); + int value = LastTextCol(screen, ld, n); + if (value >= 0) + length += (unsigned) (value + 1); + } + return length; +} + +/* + * Make a copy of the wrapped-line which corresponds to the given row as a + * string of bytes. Construct an index for the columns from the beginning of + * the line. + */ +static char * +make_indexed_text(TScreen *screen, int row, unsigned length, int *indexed) +{ + Char *result = 0; + size_t need = (length + 1); + + /* + * Get a quick upper bound to the number of bytes needed, if the whole + * string were UTF-8. + */ + if_OPT_WIDE_CHARS(screen, { + need *= ((screen->lineExtra + 1) * 6); + }); + + if ((result = TypeCallocN(Char, need + 1)) != 0) { + LineData *ld = GET_LINEDATA(screen, row); + unsigned used = 0; + Char *last = result; + + do { + int col = 0; + int limit = LastTextCol(screen, ld, row); + + while (col <= limit) { + Char *next = last; + unsigned data = ld->charData[col]; + + assert(col < (int) ld->lineSize); + /* some internal points may not be drawn */ + if (data == 0) + data = ' '; + + if_WIDE_OR_NARROW(screen, { + next = convertToUTF8(last, data); + } + , { + *next++ = CharOf(data); + }); + + if_OPT_WIDE_CHARS(screen, { + size_t off; + for_each_combData(off, ld) { + data = ld->combData[off][col]; + if (data == 0) + break; + next = convertToUTF8(next, data); + } + }); + + indexed[used] = (int) (last - result); + *next = 0; + /* TRACE(("index[%d.%d] %d:%s\n", row, used, indexed[used], last)); */ + last = next; + ++used; + ++col; + indexed[used] = (int) (next - result); + } + } while (used < length && + LineTstWrapped(ld) && + (ld = GET_LINEDATA(screen, ++row)) != 0 && + row < screen->max_row); + } + /* TRACE(("result:%s\n", result)); */ + return (char *) result; +} + +/* + * Find the column given an offset into the character string by using the + * index constructed in make_indexed_text(). + */ +static int +indexToCol(int *indexed, int len, int off) +{ + int col = 0; + while (indexed[col] < len) { + if (indexed[col] >= off) + break; + ++col; + } + return col; +} + +/* + * Given a row number, and a column offset from that (which may be wrapped), + * set the cell to the actual row/column values. + */ +static void +columnToCell(TScreen *screen, int row, int col, CELL *cell) +{ + while (row < screen->max_row) { + CLineData *ld = GET_LINEDATA(screen, row); + int last = LastTextCol(screen, ld, row); + + /* TRACE(("last(%d) = %d, have %d\n", row, last, col)); */ + if (col <= last) { + break; + } + /* + * Stop if the current row does not wrap (does not continue the current + * line). + */ + if (!LineTstWrapped(ld)) { + col = last + 1; + break; + } + col -= (last + 1); + ++row; + } + if (col < 0) + col = 0; + cell->row = row; + cell->col = col; +} + +/* + * Given a cell, find the corresponding column offset. + */ +static int +cellToColumn(TScreen *screen, CELL *cell) +{ + CLineData *ld = 0; + int col = cell->col; + int row = firstRowOfLine(screen, cell->row, False); + while (row < cell->row) { + ld = GET_LINEDATA(screen, row); + col += LastTextCol(screen, ld, row++); + } +#if OPT_DEC_CHRSET + if (ld == 0) + ld = GET_LINEDATA(screen, row); + if (CSET_DOUBLE(GetLineDblCS(ld))) + col /= 2; +#endif + return col; +} + +static void +do_select_regex(TScreen *screen, CELL *startc, CELL *endc) +{ + LineData *ld = GET_LINEDATA(screen, startc->row); + int inx = ((screen->numberOfClicks - 1) % screen->maxClicks); + char *expr = screen->selectExpr[inx]; + regex_t preg; + regmatch_t match; + + TRACE(("Select_REGEX[%d]:%s\n", inx, NonNull(expr))); + if (okPosition(screen, &ld, startc) && expr != 0) { + if (regcomp(&preg, expr, REG_EXTENDED) == 0) { + int firstRow = firstRowOfLine(screen, startc->row, True); + int lastRow = lastRowOfLine(screen, firstRow); + unsigned size = lengthOfLines(screen, firstRow, lastRow); + int actual = cellToColumn(screen, startc); + int *indexed; + + TRACE(("regcomp ok rows %d..%d bytes %d\n", + firstRow, lastRow, size)); + + if ((indexed = TypeCallocN(int, size + 1)) != 0) { + char *search; + if ((search = make_indexed_text(screen, + firstRow, + size, + indexed)) != 0) { + int len = (int) strlen(search); + int col; + int best_col = -1; + int best_len = -1; + + startc->row = 0; + startc->col = 0; + endc->row = 0; + endc->col = 0; + + for (col = 0; indexed[col] < len; ++col) { + if (regexec(&preg, + search + indexed[col], + (size_t) 1, &match, 0) == 0) { + int start_inx = (int) (match.rm_so + indexed[col]); + int finis_inx = (int) (match.rm_eo + indexed[col]); + int start_col = indexToCol(indexed, len, start_inx); + int finis_col = indexToCol(indexed, len, finis_inx); + + if (start_col <= actual && + actual <= finis_col) { + int test = finis_col - start_col; + if (best_len < test) { + best_len = test; + best_col = start_col; + TRACE(("match column %d len %d\n", + best_col, + best_len)); + } + } + } + } + if (best_col >= 0) { + int best_nxt = best_col + best_len; + columnToCell(screen, firstRow, best_col, startc); + columnToCell(screen, firstRow, best_nxt, endc); + TRACE(("search::%s\n", search)); + TRACE(("indexed:%d..%d -> %d..%d\n", + best_col, best_nxt, + indexed[best_col], + indexed[best_nxt])); + TRACE(("matched:%d:%s\n", + indexed[best_nxt] + 1 - + indexed[best_col], + visibleChars((Char *) (search + indexed[best_col]), + (unsigned) (indexed[best_nxt] + + 1 - + indexed[best_col])))); + } + free(search); + } + free(indexed); +#if OPT_DEC_CHRSET + if ((ld = GET_LINEDATA(screen, startc->row)) != 0) { + if (CSET_DOUBLE(GetLineDblCS(ld))) + startc->col *= 2; + } + if ((ld = GET_LINEDATA(screen, endc->row)) != 0) { + if (CSET_DOUBLE(GetLineDblCS(ld))) + endc->col *= 2; + } +#endif + } + regfree(&preg); + } + } +} +#endif /* OPT_SELECT_REGEX */ + +#define InitRow(name) \ + ld.name = GET_LINEDATA(screen, screen->name.row) + +#define NextRow(name) \ + ld.name = GET_LINEDATA(screen, ++screen->name.row) + +#define PrevRow(name) \ + ld.name = GET_LINEDATA(screen, --screen->name.row) + +#define MoreRows(name) \ + (screen->name.row < screen->max_row) + +#define isPrevWrapped(name) \ + (screen->name.row > 0 \ + && (ltmp = GET_LINEDATA(screen, screen->name.row - 1)) != 0 \ + && LineTstWrapped(ltmp)) + +/* + * sets startSel endSel + * ensuring that they have legal values + */ +static void +ComputeSelect(XtermWidget xw, + CELL *startc, + CELL *endc, + Bool extend) +{ + TScreen *screen = TScreenOf(xw); + + int cclass; + CELL first = *startc; + CELL last = *endc; + Boolean ignored = False; + + struct { + LineData *startSel; + LineData *endSel; + } ld; + LineData *ltmp; + + TRACE(("ComputeSelect(startRow=%d, startCol=%d, endRow=%d, endCol=%d, %sextend)\n", + first.row, first.col, + last.row, last.col, + extend ? "" : "no")); + +#if OPT_WIDE_CHARS + if (first.col > 1 + && isWideCell(first.row, first.col - 1) + && XTERM_CELL(first.row, first.col - 0) == HIDDEN_CHAR) { + TRACE(("Adjusting start. Changing downwards from %i.\n", first.col)); + first.col -= 1; + if (last.col == (first.col + 1)) + last.col--; + } + + if (last.col > 1 + && isWideCell(last.row, last.col - 1) + && XTERM_CELL(last.row, last.col) == HIDDEN_CHAR) { + last.col += 1; + } +#endif + + if (Coordinate(screen, &first) <= Coordinate(screen, &last)) { + screen->startSel = screen->startRaw = first; + screen->endSel = screen->endRaw = last; + } else { /* Swap them */ + screen->startSel = screen->startRaw = last; + screen->endSel = screen->endRaw = first; + } + + InitRow(startSel); + InitRow(endSel); + + switch (screen->selectUnit) { + case Select_CHAR: + (void) okPosition(screen, &(ld.startSel), &(screen->startSel)); + (void) okPosition(screen, &(ld.endSel), &(screen->endSel)); + break; + + case Select_WORD: + TRACE(("Select_WORD\n")); + if (okPosition(screen, &(ld.startSel), &(screen->startSel))) { + cclass = CClassOf(startSel); + do { + --screen->startSel.col; + if (screen->startSel.col < 0 + && isPrevWrapped(startSel)) { + PrevRow(startSel); + screen->startSel.col = LastTextCol(screen, ld.startSel, screen->startSel.row); + } + } while (screen->startSel.col >= 0 + && CClassSelects(startSel, cclass)); + ++screen->startSel.col; + } +#if OPT_WIDE_CHARS + if (screen->startSel.col + && XTERM_CELL(screen->startSel.row, + screen->startSel.col) == HIDDEN_CHAR) + screen->startSel.col++; +#endif + + if (okPosition(screen, &(ld.endSel), &(screen->endSel))) { + int length = LastTextCol(screen, ld.endSel, screen->endSel.row); + cclass = CClassOf(endSel); + do { + ++screen->endSel.col; + if (screen->endSel.col > length + && LineTstWrapped(ld.endSel)) { + if (!MoreRows(endSel)) + break; + screen->endSel.col = 0; + NextRow(endSel); + length = LastTextCol(screen, ld.endSel, screen->endSel.row); + } + } while (screen->endSel.col <= length + && CClassSelects(endSel, cclass)); + /* Word-select selects if pointing to any char in "word", + * especially note that it includes the last character in a word. + * So we do no --endSel.col and do special eol handling. + */ + if (screen->endSel.col > length + 1 + && MoreRows(endSel)) { + screen->endSel.col = 0; + NextRow(endSel); + } + } +#if OPT_WIDE_CHARS + if (screen->endSel.col + && XTERM_CELL(screen->endSel.row, + screen->endSel.col) == HIDDEN_CHAR) + screen->endSel.col++; +#endif + + screen->saveStartW = screen->startSel; + break; + + case Select_LINE: + TRACE(("Select_LINE\n")); + while (LineTstWrapped(ld.endSel) + && MoreRows(endSel)) { + NextRow(endSel); + } + if (screen->cutToBeginningOfLine + || screen->startSel.row < screen->saveStartW.row) { + screen->startSel.col = 0; + while (isPrevWrapped(startSel)) { + PrevRow(startSel); + } + } else if (!extend) { + if ((first.row < screen->saveStartW.row) + || (isSameRow(&first, &(screen->saveStartW)) + && first.col < screen->saveStartW.col)) { + screen->startSel.col = 0; + while (isPrevWrapped(startSel)) { + PrevRow(startSel); + } + } else { + screen->startSel = screen->saveStartW; + } + } + trimLastLine(screen, &(ld.endSel), &(screen->endSel)); + break; + + case Select_GROUP: /* paragraph */ + TRACE(("Select_GROUP\n")); + if (okPosition(screen, &(ld.startSel), &(screen->startSel))) { + /* scan backward for beginning of group */ + while (screen->startSel.row > 0 && + (LastTextCol(screen, ld.startSel, screen->startSel.row - + 1) > 0 || + isPrevWrapped(startSel))) { + PrevRow(startSel); + } + screen->startSel.col = 0; + /* scan forward for end of group */ + while (MoreRows(endSel) && + (LastTextCol(screen, ld.endSel, screen->endSel.row + 1) > + 0 || + LineTstWrapped(ld.endSel))) { + NextRow(endSel); + } + trimLastLine(screen, &(ld.endSel), &(screen->endSel)); + } + break; + + case Select_PAGE: /* everything one can see */ + TRACE(("Select_PAGE\n")); + screen->startSel.row = 0; + screen->startSel.col = 0; + screen->endSel.row = MaxRows(screen); + screen->endSel.col = 0; + break; + + case Select_ALL: /* counts scrollback if in normal screen */ + TRACE(("Select_ALL\n")); + screen->startSel.row = -screen->savedlines; + screen->startSel.col = 0; + screen->endSel.row = MaxRows(screen); + screen->endSel.col = 0; + break; + +#if OPT_SELECT_REGEX + case Select_REGEX: + do_select_regex(screen, &(screen->startSel), &(screen->endSel)); + break; +#endif + + case NSELECTUNITS: /* always ignore */ + ignored = True; + break; + } + + if (!ignored) { + /* check boundaries */ + ScrollSelection(screen, 0, False); + TrackText(xw, &(screen->startSel), &(screen->endSel)); + } + + return; +} + +/* Guaranteed (first.row, first.col) <= (last.row, last.col) */ +static void +TrackText(XtermWidget xw, + const CELL *firstp, + const CELL *lastp) +{ + TScreen *screen = TScreenOf(xw); + int from, to; + CELL old_start, old_end; + CELL first = *firstp; + CELL last = *lastp; + + TRACE(("TrackText(first=%d,%d, last=%d,%d)\n", + first.row, first.col, last.row, last.col)); + + old_start = screen->startH; + old_end = screen->endH; + TRACE(("...previous(first=%d,%d, last=%d,%d)\n", + old_start.row, old_start.col, + old_end.row, old_end.col)); + if (isSameCELL(&first, &old_start) && + isSameCELL(&last, &old_end)) { + return; + } + + screen->startH = first; + screen->endH = last; + from = Coordinate(screen, &screen->startH); + to = Coordinate(screen, &screen->endH); + if (to <= screen->startHCoord || from > screen->endHCoord) { + /* No overlap whatsoever between old and new hilite */ + ReHiliteText(xw, &old_start, &old_end); + ReHiliteText(xw, &first, &last); + } else { + if (from < screen->startHCoord) { + /* Extend left end */ + ReHiliteText(xw, &first, &old_start); + } else if (from > screen->startHCoord) { + /* Shorten left end */ + ReHiliteText(xw, &old_start, &first); + } + if (to > screen->endHCoord) { + /* Extend right end */ + ReHiliteText(xw, &old_end, &last); + } else if (to < screen->endHCoord) { + /* Shorten right end */ + ReHiliteText(xw, &last, &old_end); + } + } + screen->startHCoord = from; + screen->endHCoord = to; +} + +static void +UnHiliteText(XtermWidget xw) +{ + TrackText(xw, &zeroCELL, &zeroCELL); +} + +/* Guaranteed that (first->row, first->col) <= (last->row, last->col) */ +static void +ReHiliteText(XtermWidget xw, + CELL *firstp, + CELL *lastp) +{ + TScreen *screen = TScreenOf(xw); + CELL first = *firstp; + CELL last = *lastp; + + TRACE(("ReHiliteText from %d.%d to %d.%d\n", + first.row, first.col, last.row, last.col)); + + if (first.row < 0) + first.row = first.col = 0; + else if (first.row > screen->max_row) + return; /* nothing to do, since last.row >= first.row */ + + if (last.row < 0) + return; /* nothing to do, since first.row <= last.row */ + else if (last.row > screen->max_row) { + last.row = screen->max_row; + last.col = MaxCols(screen); + } + if (isSameCELL(&first, &last)) + return; + + if (!isSameRow(&first, &last)) { /* do multiple rows */ + int i; + if ((i = screen->max_col - first.col + 1) > 0) { /* first row */ + ScrnRefresh(xw, first.row, first.col, 1, i, True); + } + if ((i = last.row - first.row - 1) > 0) { /* middle rows */ + ScrnRefresh(xw, first.row + 1, 0, i, MaxCols(screen), True); + } + if (last.col > 0 && last.row <= screen->max_row) { /* last row */ + ScrnRefresh(xw, last.row, 0, 1, last.col, True); + } + } else { /* do single row */ + ScrnRefresh(xw, first.row, first.col, 1, last.col - first.col, True); + } +} + +/* + * Guaranteed that (cellc->row, cellc->col) <= (cell->row, cell->col), + * and that both points are valid + * (may have cell->row = screen->max_row+1, cell->col = 0). + */ +static void +SaltTextAway(XtermWidget xw, + int which, + CELL *cellc, + CELL *cell) +{ + TScreen *screen = TScreenOf(xw); + SelectedCells *scp; + int i; + int eol; + int need = 0; + Char *line; + Char *lp; + CELL first = *cellc; + CELL last = *cell; + + if (which < 0 || which >= MAX_SELECTIONS) { + TRACE(("SaltTextAway - which selection?\n")); + return; + } + scp = &(screen->selected_cells[which]); + + TRACE(("SaltTextAway which=%d, first=%d,%d, last=%d,%d\n", + which, first.row, first.col, last.row, last.col)); + + if (isSameRow(&first, &last) && first.col > last.col) { + int tmp; + EXCHANGE(first.col, last.col, tmp); + } + + --last.col; + /* first we need to know how long the string is before we can save it */ + + if (isSameRow(&last, &first)) { + need = Length(screen, first.row, first.col, last.col); + } else { /* two cases, cut is on same line, cut spans multiple lines */ + need += Length(screen, first.row, first.col, screen->max_col) + 1; + for (i = first.row + 1; i < last.row; i++) + need += Length(screen, i, 0, screen->max_col) + 1; + if (last.col >= 0) + need += Length(screen, last.row, 0, last.col); + } + + /* UTF-8 may require more space */ + if_OPT_WIDE_CHARS(screen, { + need *= 4; + }); + + /* now get some memory to save it in */ + if (need < 0) + return; + + if (scp->data_limit <= (unsigned) need) { + if ((line = (Char *) malloc((size_t) need + 1)) == 0) + SysError(ERROR_BMALLOC2); + free(scp->data_buffer); + scp->data_buffer = line; + scp->data_limit = (size_t) (need + 1); + } else { + line = scp->data_buffer; + } + + if (line == 0) + return; + + line[need] = '\0'; /* make sure it is null terminated */ + lp = line; /* lp points to where to save the text */ + if (isSameRow(&last, &first)) { + lp = SaveText(screen, last.row, first.col, last.col, lp, &eol); + } else { + lp = SaveText(screen, first.row, first.col, screen->max_col, lp, &eol); + if (eol) + *lp++ = '\n'; /* put in newline at end of line */ + for (i = first.row + 1; i < last.row; i++) { + lp = SaveText(screen, i, 0, screen->max_col, lp, &eol); + if (eol) + *lp++ = '\n'; + } + if (last.col >= 0) + lp = SaveText(screen, last.row, 0, last.col, lp, &eol); + } + *lp = '\0'; /* make sure we have end marked */ + + TRACE(("Salted TEXT:%u:%s\n", (unsigned) (lp - line), + visibleChars(line, (unsigned) (lp - line)))); + + scp->data_length = (size_t) (lp - line); +} + +#if OPT_PASTE64 +void +ClearSelectionBuffer(TScreen *screen, String selection) +{ + int which = TargetToSelection(screen, selection); + SelectedCells *scp = &(screen->selected_cells[okSelectionCode(which)]); + free(scp->data_buffer); + scp->data_buffer = 0; + scp->data_limit = 0; + scp->data_length = 0; + screen->base64_count = 0; +} + +static void +AppendStrToSelectionBuffer(SelectedCells * scp, Char *text, size_t len) +{ + if (len != 0) { + size_t j = (scp->data_length + len); + size_t k = j + (j >> 2) + 80; + if (j + 1 >= scp->data_limit) { + Char *line; + if (!scp->data_length) { + line = (Char *) malloc(k); + } else { + line = (Char *) realloc(scp->data_buffer, k); + } + if (line == 0) + SysError(ERROR_BMALLOC2); + scp->data_buffer = line; + scp->data_limit = k; + } + if (scp->data_buffer != 0) { + memcpy(scp->data_buffer + scp->data_length, text, len); + scp->data_length += len; + scp->data_buffer[scp->data_length] = 0; + } + } +} + +void +AppendToSelectionBuffer(TScreen *screen, unsigned c, String selection) +{ + int which = TargetToSelection(screen, selection); + SelectedCells *scp = &(screen->selected_cells[okSelectionCode(which)]); + unsigned six; + Char ch; + + /* Decode base64 character */ + if (c >= 'A' && c <= 'Z') + six = c - 'A'; + else if (c >= 'a' && c <= 'z') + six = c - 'a' + 26; + else if (c >= '0' && c <= '9') + six = c - '0' + 52; + else if (c == '+') + six = 62; + else if (c == '/') + six = 63; + else + return; + + /* Accumulate bytes */ + switch (screen->base64_count) { + case 0: + screen->base64_accu = six; + screen->base64_count = 6; + break; + + case 2: + ch = CharOf((screen->base64_accu << 6) + six); + screen->base64_count = 0; + AppendStrToSelectionBuffer(scp, &ch, (size_t) 1); + break; + + case 4: + ch = CharOf((screen->base64_accu << 4) + (six >> 2)); + screen->base64_accu = (six & 0x3); + screen->base64_count = 2; + AppendStrToSelectionBuffer(scp, &ch, (size_t) 1); + break; + + case 6: + ch = CharOf((screen->base64_accu << 2) + (six >> 4)); + screen->base64_accu = (six & 0xF); + screen->base64_count = 4; + AppendStrToSelectionBuffer(scp, &ch, (size_t) 1); + break; + } +} + +void +CompleteSelection(XtermWidget xw, String *args, Cardinal len) +{ + TScreen *screen = TScreenOf(xw); + + screen->base64_count = 0; + screen->base64_accu = 0; + _OwnSelection(xw, args, len); +} +#endif /* OPT_PASTE64 */ + +static Bool +_ConvertSelectionHelper(Widget w, + SelectedCells * scp, + Atom *type, + XtPointer *value, + unsigned long *length, + int *format, + int (*conversion_function) (Display *, + char **, int, + XICCEncodingStyle, + XTextProperty *), + XICCEncodingStyle conversion_style) +{ + XtermWidget xw; + + *value = 0; + *length = 0; + *type = 0; + *format = 0; + + if ((xw = getXtermWidget(w)) != 0) { + Display *dpy = XtDisplay(w); + XTextProperty textprop; + int out_n = 0; + char *result = 0; + char *the_data = (char *) scp->data_buffer; + char *the_next; + unsigned long remaining = scp->data_length; + + TRACE(("converting %ld:'%s'\n", + (long) scp->data_length, + visibleChars(scp->data_buffer, (unsigned) scp->data_length))); + /* + * For most selections, we can convert in one pass. It is possible + * that some applications contain embedded nulls, e.g., using xterm's + * paste64 feature. For those cases, we will build up the result in + * parts. + */ + if (memchr(the_data, 0, scp->data_length) != 0) { + TRACE(("selection contains embedded nulls\n")); + result = calloc(scp->data_length + 1, sizeof(char)); + } + + next_try: + memset(&textprop, 0, sizeof(textprop)); + if (conversion_function(dpy, &the_data, 1, + conversion_style, + &textprop) >= Success) { + if ((result != 0) + && (textprop.value != 0) + && (textprop.format == 8)) { + char *text_values = (char *) textprop.value; + unsigned long in_n; + + if (out_n == 0) { + *value = result; + *type = textprop.encoding; + *format = textprop.format; + } + for (in_n = 0; in_n < textprop.nitems; ++in_n) { + result[out_n++] = text_values[in_n]; + } + *length += textprop.nitems; + if ((the_next = memchr(the_data, 0, remaining)) != 0) { + unsigned long this_was = (unsigned long) (the_next - the_data); + this_was++; + the_data += this_was; + remaining -= this_was; + result[out_n++] = 0; + *length += 1; + if (remaining) + goto next_try; + } + return True; + } else { + free(result); + *value = (XtPointer) textprop.value; + *length = textprop.nitems; + *type = textprop.encoding; + *format = textprop.format; + return True; + } + } + free(result); + } + return False; +} + +static Boolean +SaveConvertedLength(XtPointer *target, unsigned long source) +{ + Boolean result = False; + + *target = XtMalloc(4); + if (*target != 0) { + result = True; + if (sizeof(unsigned long) == 4) { + *(unsigned long *) *target = source; + } else if (sizeof(unsigned) == 4) { + *(unsigned *) *target = (unsigned) source; + } else if (sizeof(unsigned short) == 4) { + *(unsigned short *) *target = (unsigned short) source; + } else { + /* FIXME - does this depend on byte-order? */ + unsigned long temp = source; + memcpy((char *) *target, + ((char *) &temp) + sizeof(temp) - 4, + (size_t) 4); + } + } + return result; +} + +#define keepClipboard(d,atom) ((screen->keepClipboard) && \ + (atom == XA_CLIPBOARD(d))) + +static Boolean +ConvertSelection(Widget w, + Atom *selection, + Atom *target, + Atom *type, + XtPointer *value, + unsigned long *length, + int *format) +{ + Display *dpy = XtDisplay(w); + TScreen *screen; + SelectedCells *scp; + Bool result = False; + + Char *data; + unsigned long data_length; + + XtermWidget xw; + + if ((xw = getXtermWidget(w)) == 0) + return False; + + screen = TScreenOf(xw); + + TRACE(("ConvertSelection %s -> %s\n", + TraceAtomName(screen->display, *selection), + visibleSelectionTarget(dpy, *target))); + + if (keepClipboard(dpy, *selection)) { + TRACE(("asked for clipboard\n")); + scp = &(screen->clipboard_data); + } else { + TRACE(("asked for selection\n")); + scp = &(screen->selected_cells[AtomToSelection(dpy, *selection)]); + } + + data = scp->data_buffer; + data_length = scp->data_length; + if (data == NULL) { + TRACE(("...no selection-data\n")); + return False; + } + + if (*target == XA_TARGETS(dpy)) { + Atom *targetP; + XPointer std_return = 0; + unsigned long std_length; + + if (XmuConvertStandardSelection(w, screen->selection_time, selection, + target, type, &std_return, + &std_length, format)) { + Atom *my_targets = _SelectionTargets(w); + Atom *allocP; + Atom *std_targets; + + TRACE(("XmuConvertStandardSelection - success\n")); + std_targets = (Atom *) (void *) (std_return); + *length = std_length + 6; + + targetP = TypeXtMallocN(Atom, *length); + allocP = targetP; + + *value = (XtPointer) targetP; + + if (my_targets != 0) { + while (*my_targets != None) { + *targetP++ = *my_targets++; + } + } + *targetP++ = XA_LENGTH(dpy); + *targetP++ = XA_LIST_LENGTH(dpy); + + *length = std_length + (unsigned long) (targetP - allocP); + + memcpy(targetP, std_targets, sizeof(Atom) * std_length); + XtFree((char *) std_targets); + *type = XA_ATOM; + *format = 32; + result = True; + } else { + TRACE(("XmuConvertStandardSelection - failed\n")); + } + } +#if OPT_WIDE_CHARS + else if (screen->wide_chars && *target == XA_STRING) { + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + Xutf8TextListToTextProperty, + XStringStyle); + TRACE(("...Xutf8TextListToTextProperty:%d\n", result)); + } else if (screen->wide_chars && *target == XA_UTF8_STRING(dpy)) { + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + Xutf8TextListToTextProperty, + XUTF8StringStyle); + TRACE(("...Xutf8TextListToTextProperty:%d\n", result)); + } else if (screen->wide_chars && *target == XA_TEXT(dpy)) { + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + Xutf8TextListToTextProperty, + XStdICCTextStyle); + TRACE(("...Xutf8TextListToTextProperty:%d\n", result)); + } else if (screen->wide_chars && *target == XA_COMPOUND_TEXT(dpy)) { + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + Xutf8TextListToTextProperty, + XCompoundTextStyle); + TRACE(("...Xutf8TextListToTextProperty:%d\n", result)); + } +#endif + + else if (*target == XA_STRING) { /* not wide_chars */ + /* We can only reach this point if the selection requestor + requested STRING before any of TEXT, COMPOUND_TEXT or + UTF8_STRING. We therefore assume that the requestor is not + properly internationalised, and dump raw eight-bit data + with no conversion into the selection. Yes, this breaks + the ICCCM in non-Latin-1 locales. */ + *type = XA_STRING; + *value = (XtPointer) data; + *length = data_length; + *format = 8; + result = True; + TRACE(("...raw 8-bit data:%d\n", result)); + } else if (*target == XA_TEXT(dpy)) { /* not wide_chars */ + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + XmbTextListToTextProperty, + XStdICCTextStyle); + TRACE(("...XmbTextListToTextProperty(StdICC):%d\n", result)); + } else if (*target == XA_COMPOUND_TEXT(dpy)) { /* not wide_chars */ + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + XmbTextListToTextProperty, + XCompoundTextStyle); + TRACE(("...XmbTextListToTextProperty(Compound):%d\n", result)); + } +#ifdef X_HAVE_UTF8_STRING + else if (*target == XA_UTF8_STRING(dpy)) { /* not wide_chars */ + result = + _ConvertSelectionHelper(w, scp, + type, value, length, format, + XmbTextListToTextProperty, + XUTF8StringStyle); + TRACE(("...XmbTextListToTextProperty(UTF8):%d\n", result)); + } +#endif + else if (*target == XA_LIST_LENGTH(dpy)) { + result = SaveConvertedLength(value, (unsigned long) 1); + *type = XA_INTEGER; + *length = 1; + *format = 32; + TRACE(("...list of values:%d\n", result)); + } else if (*target == XA_LENGTH(dpy)) { + /* This value is wrong if we have UTF-8 text */ + result = SaveConvertedLength(value, scp->data_length); + *type = XA_INTEGER; + *length = 1; + *format = 32; + TRACE(("...list of values:%d\n", result)); + } else if (XmuConvertStandardSelection(w, + screen->selection_time, selection, + target, type, (XPointer *) value, + length, format)) { + result = True; + TRACE(("...XmuConvertStandardSelection:%d\n", result)); + } + + /* else */ + return (Boolean) result; +} + +static void +LoseSelection(Widget w, Atom *selection) +{ + TScreen *screen; + Atom *atomP; + Cardinal i; + + XtermWidget xw; + + if ((xw = getXtermWidget(w)) == 0) + return; + + screen = TScreenOf(xw); + TRACE(("LoseSelection %s\n", TraceAtomName(screen->display, *selection))); + + for (i = 0, atomP = screen->selection_atoms; + i < screen->selection_count; i++, atomP++) { + if (*selection == *atomP) + *atomP = (Atom) 0; + if (CutBuffer(*atomP) >= 0) { + *atomP = (Atom) 0; + } + } + + for (i = screen->selection_count; i; i--) { + if (screen->selection_atoms[i - 1] != 0) + break; + } + screen->selection_count = i; + + for (i = 0, atomP = screen->selection_atoms; + i < screen->selection_count; i++, atomP++) { + if (*atomP == (Atom) 0) { + *atomP = screen->selection_atoms[--screen->selection_count]; + } + } + + if (screen->selection_count == 0) + UnHiliteText(xw); +} + +/* ARGSUSED */ +static void +SelectionDone(Widget w GCC_UNUSED, + Atom *selection GCC_UNUSED, + Atom *target GCC_UNUSED) +{ + /* empty proc so Intrinsics know we want to keep storage */ + TRACE(("SelectionDone\n")); +} + +static void +_OwnSelection(XtermWidget xw, + String *selections, + Cardinal count) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + Atom *atoms = screen->selection_atoms; + Cardinal i; + Bool have_selection = False; + SelectedCells *scp; + + if (count == 0) + return; + + TRACE(("_OwnSelection count %d\n", count)); + selections = MapSelections(xw, selections, count); + + if (count > screen->sel_atoms_size) { + XtFree((char *) atoms); + atoms = TypeXtMallocN(Atom, count); + screen->selection_atoms = atoms; + screen->sel_atoms_size = count; + } + XmuInternStrings(dpy, selections, count, atoms); + for (i = 0; i < count; i++) { + int cutbuffer = CutBuffer(atoms[i]); + if (cutbuffer >= 0) { + unsigned long limit = + (unsigned long) (4 * XMaxRequestSize(dpy) - 32); + scp = &(screen->selected_cells[CutBufferToCode(cutbuffer)]); + if (scp->data_length > limit) { + TRACE(("selection too big (%lu bytes), not storing in CUT_BUFFER%d\n", + scp->data_length, cutbuffer)); + xtermWarning("selection too big (%lu bytes), not storing in CUT_BUFFER%d\n", + (unsigned long) scp->data_length, cutbuffer); + } else { + /* This used to just use the UTF-8 data, which was totally + * broken as not even the corresponding paste code in xterm + * understood this! So now it converts to Latin1 first. + * Robert Brady, 2000-09-05 + */ + unsigned long length = scp->data_length; + Char *data = scp->data_buffer; + if_OPT_WIDE_CHARS((screen), { + data = UTF8toLatin1(screen, data, length, &length); + }); + TRACE(("XStoreBuffer(%d)\n", cutbuffer)); + XStoreBuffer(dpy, + (char *) data, + (int) length, + cutbuffer); + } + } else { + int which = AtomToSelection(dpy, atoms[i]); + if (keepClipboard(dpy, atoms[i])) { + Char *buf; + SelectedCells *tcp = &(screen->clipboard_data); + TRACE(("saving selection to clipboard buffer\n")); + scp = &(screen->selected_cells[CLIPBOARD_CODE]); + if ((buf = (Char *) malloc((size_t) scp->data_length)) == 0) + SysError(ERROR_BMALLOC2); + + free(tcp->data_buffer); + memcpy(buf, scp->data_buffer, scp->data_length); + tcp->data_buffer = buf; + tcp->data_limit = scp->data_length; + tcp->data_length = scp->data_length; + } + scp = &(screen->selected_cells[which]); + if (scp->data_length == 0) { + TRACE(("XtDisownSelection(%s, @%ld)\n", + TraceAtomName(screen->display, atoms[i]), + (long) screen->selection_time)); + XtDisownSelection((Widget) xw, + atoms[i], + screen->selection_time); + } else if (!screen->replyToEmacs && atoms[i] != 0) { + TRACE(("XtOwnSelection(%s, @%ld)\n", + TraceAtomName(screen->display, atoms[i]), + (long) screen->selection_time)); + have_selection |= + XtOwnSelection((Widget) xw, atoms[i], + screen->selection_time, + ConvertSelection, + LoseSelection, + SelectionDone); + } + } + TRACE(("... _OwnSelection used length %ld value %s\n", + scp->data_length, + visibleChars(scp->data_buffer, + (unsigned) scp->data_length))); + } + if (!screen->replyToEmacs) + screen->selection_count = count; + if (!have_selection) + UnHiliteText(xw); +} + +static void +ResetSelectionState(TScreen *screen) +{ + screen->selection_count = 0; + screen->startH = zeroCELL; + screen->endH = zeroCELL; +} + +void +DisownSelection(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Atom *atoms = screen->selection_atoms; + Cardinal count = screen->selection_count; + Cardinal i; + + TRACE(("DisownSelection count %d, start %d.%d, end %d.%d\n", + count, + screen->startH.row, + screen->startH.col, + screen->endH.row, + screen->endH.col)); + + for (i = 0; i < count; i++) { + int cutbuffer = CutBuffer(atoms[i]); + if (cutbuffer < 0) { + XtDisownSelection((Widget) xw, atoms[i], + screen->selection_time); + } + } + /* + * If none of the callbacks via XtDisownSelection() reset highlighting + * do it now. + */ + if (ScrnHaveSelection(screen)) { + /* save data which will be reset */ + CELL first = screen->startH; + CELL last = screen->endH; + + ResetSelectionState(screen); + ReHiliteText(xw, &first, &last); + } else { + ResetSelectionState(screen); + } +} + +void +UnhiliteSelection(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (ScrnHaveSelection(screen)) { + CELL first = screen->startH; + CELL last = screen->endH; + + screen->startH = zeroCELL; + screen->endH = zeroCELL; + ReHiliteText(xw, &first, &last); + } +} + +/* returns number of chars in line from scol to ecol out */ +/* ARGSUSED */ +static int +Length(TScreen *screen, + int row, + int scol, + int ecol) +{ + CLineData *ld = GET_LINEDATA(screen, row); + const int lastcol = LastTextCol(screen, ld, row); + + if (ecol > lastcol) + ecol = lastcol; + return (ecol - scol + 1); +} + +/* copies text into line, preallocated */ +static Char * +SaveText(TScreen *screen, + int row, + int scol, + int ecol, + Char *lp, /* pointer to where to put the text */ + int *eol) +{ + LineData *ld; + int i = 0; + Char *result = lp; +#if OPT_WIDE_CHARS + unsigned previous = 0; +#endif + + ld = GET_LINEDATA(screen, row); + i = Length(screen, row, scol, ecol); + ecol = scol + i; +#if OPT_DEC_CHRSET + if (CSET_DOUBLE(GetLineDblCS(ld))) { + scol = (scol + 0) / 2; + ecol = (ecol + 1) / 2; + } +#endif + *eol = !LineTstWrapped(ld); + for (i = scol; i < ecol; i++) { + unsigned c; + assert(i < (int) ld->lineSize); + c = E2A(ld->charData[i]); +#if OPT_WIDE_CHARS + /* We want to strip out every occurrence of HIDDEN_CHAR AFTER a + * wide character. + */ + if (c == HIDDEN_CHAR) { + if (isWide((int) previous)) { + previous = c; + /* Combining characters attached to double-width characters + are in memory attached to the HIDDEN_CHAR */ + if_OPT_WIDE_CHARS(screen, { + if ((screen->utf8_nrc_mode | screen->utf8_mode) != uFalse) { + size_t off; + for_each_combData(off, ld) { + unsigned ch = ld->combData[off][i]; + if (ch == 0) + break; + lp = convertToUTF8(lp, ch); + } + } + }); + continue; + } else { + c = ' '; /* should not happen, but just in case... */ + } + } + previous = c; + if ((screen->utf8_nrc_mode | screen->utf8_mode) != uFalse) { + lp = convertToUTF8(lp, (c != 0) ? c : ' '); + if_OPT_WIDE_CHARS(screen, { + size_t off; + for_each_combData(off, ld) { + unsigned ch = ld->combData[off][i]; + if (ch == 0) + break; + lp = convertToUTF8(lp, ch); + } + }); + } else +#endif + { + if (c == 0) { + c = E2A(' '); + } else if (c < E2A(' ')) { + c = DECtoASCII(c); + } else if (c == 0x7f) { + c = 0x5f; + } + *lp++ = CharOf(A2E(c)); + } + if (c != E2A(' ')) + result = lp; + } + + /* + * If requested, trim trailing blanks from selected lines. Do not do this + * if the line is wrapped. + */ + if (!*eol || !screen->trim_selection) + result = lp; + + return (result); +} + +/* 32 + following 8-bit word: + + 1:0 Button no: 0, 1, 2. 3=release. + 2 shift + 3 meta + 4 ctrl + 5 set for motion notify + 6 set for wheel (and button 6 and 7) + 7 set for buttons 8 to 11 +*/ + +/* Position: 32 - 255. */ +static int +BtnCode(XButtonEvent *event, int button) +{ + int result = (int) (32 + (KeyState(event->state) << 2)); + + if (event->type == MotionNotify) + result += 32; + + if (button < 0) { + result += 3; + } else { + result += button & 3; + if (button & 4) + result += 64; + if (button & 8) + result += 128; + } + TRACE(("BtnCode button %d, %s state " FMT_MODIFIER_NAMES " ->%#x\n", + button, + visibleEventType(event->type), + ARG_MODIFIER_NAMES(event->state), + result)); + return result; +} + +static unsigned +EmitButtonCode(XtermWidget xw, + Char *line, + unsigned count, + XButtonEvent *event, + int button) +{ + TScreen *screen = TScreenOf(xw); + int value; + + if (okSendMousePos(xw) == X10_MOUSE) { + value = CharOf(' ' + button); + } else { + value = BtnCode(event, button); + } + + switch (screen->extend_coords) { + default: + line[count++] = CharOf(value); + break; + case SET_SGR_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + value -= 32; /* encoding starts at zero */ + /* FALLTHRU */ + case SET_URXVT_EXT_MODE_MOUSE: + count += (unsigned) sprintf((char *) line + count, "%d", value); + break; + case SET_EXT_MODE_MOUSE: + if (value < 128) { + line[count++] = CharOf(value); + } else { + line[count++] = CharOf(0xC0 + (value >> 6)); + line[count++] = CharOf(0x80 + (value & 0x3F)); + } + break; + } + return count; +} + +static int +FirstBitN(int bits) +{ + int result = -1; + if (bits > 0) { + result = 0; + while (!(bits & 1)) { + bits /= 2; + ++result; + } + } + return result; +} + +#define ButtonBit(button) ((button >= 0) ? (1 << (button)) : 0) + +#define EMIT_BUTTON(button) EmitButtonCode(xw, line, count, event, button) + +static void +EditorButton(XtermWidget xw, XButtonEvent *event) +{ + TScreen *screen = TScreenOf(xw); + int pty = screen->respond; + int mouse_limit = MouseLimit(screen); + Char line[32]; + Char final = 'M'; + int row, col; + int button; + unsigned count = 0; + Boolean changed = True; + + /* If button event, get button # adjusted for DEC compatibility */ + button = (int) (event->button - 1); + if (button >= 3) + button++; + + /* Ignore buttons that cannot be encoded */ + if (screen->send_mouse_pos == X10_MOUSE) { + if (button > 3) + return; + } else if (screen->extend_coords == SET_SGR_EXT_MODE_MOUSE + || screen->extend_coords == SET_URXVT_EXT_MODE_MOUSE + || screen->extend_coords == SET_PIXEL_POSITION_MOUSE) { + if (button > 15) { + return; + } + } else { + if (button > 11) { + return; + } + } + + if (screen->extend_coords == SET_PIXEL_POSITION_MOUSE) { + row = event->y; + col = event->x; + } else { + /* Compute character position of mouse pointer */ + row = (event->y - screen->border) / FontHeight(screen); + col = (event->x - OriginX(screen)) / FontWidth(screen); + + /* Limit to screen dimensions */ + if (row < 0) + row = 0; + else if (row > screen->max_row) + row = screen->max_row; + + if (col < 0) + col = 0; + else if (col > screen->max_col) + col = screen->max_col; + + if (mouse_limit > 0) { + /* Limit to representable mouse dimensions */ + if (row > mouse_limit) + row = mouse_limit; + if (col > mouse_limit) + col = mouse_limit; + } + } + + /* Build key sequence starting with \E[M */ + if (screen->control_eight_bits) { + line[count++] = ANSI_CSI; + } else { + line[count++] = ANSI_ESC; + line[count++] = '['; + } + switch (screen->extend_coords) { + case 0: + case SET_EXT_MODE_MOUSE: +#if OPT_SCO_FUNC_KEYS + if (xw->keyboard.type == keyboardIsSCO) { + /* + * SCO function key F1 is \E[M, which would conflict with xterm's + * normal kmous. + */ + line[count++] = '>'; + } +#endif + line[count++] = final; + break; + case SET_SGR_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = '<'; + break; + } + + /* Add event code to key sequence */ + if (okSendMousePos(xw) == X10_MOUSE) { + count = EMIT_BUTTON(button); + } else { + /* Button-Motion events */ + switch (event->type) { + case ButtonPress: + screen->mouse_button |= ButtonBit(button); + count = EMIT_BUTTON(button); + break; + case ButtonRelease: + /* + * The (vertical) wheel mouse interface generates release-events + * for buttons 4 and 5. + * + * The X10/X11 xterm protocol maps the release for buttons 1..3 to + * a -1, which will be later mapped into a "0" (some button was + * released), At this point, buttons 1..3 are encoded 0..2 (the + * code 3 is unused). + * + * The SGR (extended) xterm mouse protocol keeps the button number + * and uses a "m" to indicate button release. + * + * The behavior for mice with more buttons is unclear, and may be + * revised -TD + */ + screen->mouse_button &= ~ButtonBit(button); + if (button < 3 || button > 5) { + switch (screen->extend_coords) { + case SET_SGR_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + final = 'm'; + break; + default: + button = -1; + break; + } + } + count = EMIT_BUTTON(button); + break; + case MotionNotify: + /* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion + * events only if character cell has changed. + */ + if ((row == screen->mouse_row) + && (col == screen->mouse_col)) { + changed = False; + } else { + count = EMIT_BUTTON(FirstBitN(screen->mouse_button)); + } + break; + default: + changed = False; + break; + } + } + + if (changed) { + screen->mouse_row = row; + screen->mouse_col = col; + + TRACE(("mouse at %d,%d button+mask = %#x\n", row, col, line[count - 1])); + + /* Add pointer position to key sequence */ + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, col); + count = EmitMousePositionSeparator(screen, line, count); + count = EmitMousePosition(screen, line, count, row); + + switch (screen->extend_coords) { + case SET_SGR_EXT_MODE_MOUSE: + case SET_URXVT_EXT_MODE_MOUSE: + case SET_PIXEL_POSITION_MOUSE: + line[count++] = final; + break; + } + + /* Transmit key sequence to process running under xterm */ + TRACE(("EditorButton -> %s\n", visibleChars(line, count))); + v_write(pty, line, count); + } + return; +} + +/* + * Check the current send_mouse_pos against allowed mouse-operations, returning + * none if it is disallowed. + */ +XtermMouseModes +okSendMousePos(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + XtermMouseModes result = screen->send_mouse_pos; + + switch (result) { + case MOUSE_OFF: + break; + case X10_MOUSE: + if (!AllowMouseOps(xw, emX10)) + result = MOUSE_OFF; + break; + case VT200_MOUSE: + if (!AllowMouseOps(xw, emVT200Click)) + result = MOUSE_OFF; + break; + case VT200_HIGHLIGHT_MOUSE: + if (!AllowMouseOps(xw, emVT200Hilite)) + result = MOUSE_OFF; + break; + case BTN_EVENT_MOUSE: + if (!AllowMouseOps(xw, emAnyButton)) + result = MOUSE_OFF; + break; + case ANY_EVENT_MOUSE: + if (!AllowMouseOps(xw, emAnyEvent)) + result = MOUSE_OFF; + break; + case DEC_LOCATOR: + if (!AllowMouseOps(xw, emLocator)) + result = MOUSE_OFF; + break; + } + return result; +} + +#if OPT_FOCUS_EVENT +/* + * Check the current send_focus_pos against allowed mouse-operations, returning + * none if it is disallowed. + */ +static int +okSendFocusPos(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int result = screen->send_focus_pos; + + if (!AllowMouseOps(xw, emFocusEvent)) { + result = False; + } + return result; +} + +void +SendFocusButton(XtermWidget xw, XFocusChangeEvent *event) +{ + if (okSendFocusPos(xw)) { + ANSI reply; + + memset(&reply, 0, sizeof(reply)); + reply.a_type = ANSI_CSI; + +#if OPT_SCO_FUNC_KEYS + if (xw->keyboard.type == keyboardIsSCO) { + reply.a_pintro = '>'; + } +#endif + reply.a_final = CharOf((event->type == FocusIn) ? 'I' : 'O'); + unparseseq(xw, &reply); + } + return; +} +#endif /* OPT_FOCUS_EVENT */ + +#if OPT_SELECTION_OPS +/* + * Get the event-time, needed to process selections. + */ +static Time +getEventTime(XEvent *event) +{ + Time result; + + if (IsBtnEvent(event)) { + result = ((XButtonEvent *) event)->time; + } else if (IsKeyEvent(event)) { + result = ((XKeyEvent *) event)->time; + } else { + result = 0; + } + + return result; +} + +/* obtain the selection string, passing the endpoints to caller's parameters */ +static void +doSelectionFormat(XtermWidget xw, + Widget w, + XEvent *event, + String *params, + Cardinal *num_params, + FormatSelect format_select) +{ + TScreen *screen = TScreenOf(xw); + InternalSelect *mydata = &(screen->internal_select); + + memset(mydata, 0, sizeof(*mydata)); + mydata->format = x_strdup(params[0]); + mydata->format_select = format_select; + + screen->selectToBuffer = True; + beginInternalSelect(xw); + + xtermGetSelection(w, getEventTime(event), params + 1, *num_params - 1, NULL); + + if (screen->selectToBuffer) + finishInternalSelect(xw); +} + +/* obtain data from the screen, passing the endpoints to caller's parameters */ +static char * +getDataFromScreen(XtermWidget xw, XEvent *event, String method, CELL *start, CELL *finish) +{ + TScreen *screen = TScreenOf(xw); + + CELL save_old_start = screen->startH; + CELL save_old_end = screen->endH; + + CELL save_startSel = screen->startSel; + CELL save_startRaw = screen->startRaw; + CELL save_finishSel = screen->endSel; + CELL save_finishRaw = screen->endRaw; + + int save_firstValidRow = screen->firstValidRow; + int save_lastValidRow = screen->lastValidRow; + + const Cardinal noClick = 0; + int save_numberOfClicks = screen->numberOfClicks; + + SelectUnit saveUnits = screen->selectUnit; + SelectUnit saveMap = screen->selectMap[noClick]; +#if OPT_SELECT_REGEX + char *saveExpr = screen->selectExpr[noClick]; +#endif + SelectedCells *scp = &(screen->selected_cells[PRIMARY_CODE]); + SelectedCells save_selection = *scp; + + char *result = 0; + + TRACE(("getDataFromScreen %s\n", method)); + + memset(scp, 0, sizeof(*scp)); + + screen->numberOfClicks = 1; + lookupSelectUnit(xw, noClick, method); + screen->selectUnit = screen->selectMap[noClick]; + + memset(start, 0, sizeof(*start)); + if (IsBtnEvent(event)) { + XButtonEvent *btn_event = (XButtonEvent *) event; + CELL cell; + screen->firstValidRow = 0; + screen->lastValidRow = screen->max_row; + PointToCELL(screen, btn_event->y, btn_event->x, &cell); + start->row = cell.row; + start->col = cell.col; + finish->row = cell.row; + finish->col = screen->max_col; + } else { + start->row = screen->cur_row; + start->col = screen->cur_col; + finish->row = screen->cur_row; + finish->col = screen->max_col; + } + + ComputeSelect(xw, start, finish, False); + SaltTextAway(xw, + TargetToSelection(screen, PRIMARY_NAME), + &(screen->startSel), &(screen->endSel)); + + if (scp->data_limit && scp->data_buffer) { + TRACE(("...getDataFromScreen selection-data %.*s\n", + (int) scp->data_limit, + scp->data_buffer)); + result = malloc(scp->data_limit + 1); + if (result) { + memcpy(result, scp->data_buffer, scp->data_limit); + result[scp->data_limit] = 0; + } + free(scp->data_buffer); + scp->data_limit = 0; + } + + TRACE(("...getDataFromScreen restoring previous selection\n")); + + screen->startSel = save_startSel; + screen->startRaw = save_startRaw; + screen->endSel = save_finishSel; + screen->endRaw = save_finishRaw; + + screen->firstValidRow = save_firstValidRow; + screen->lastValidRow = save_lastValidRow; + + screen->numberOfClicks = save_numberOfClicks; + screen->selectUnit = saveUnits; + screen->selectMap[noClick] = saveMap; +#if OPT_SELECT_REGEX + screen->selectExpr[noClick] = saveExpr; +#endif + + screen->selected_cells[0] = save_selection; + + TrackText(xw, &save_old_start, &save_old_end); + + TRACE(("...getDataFromScreen done\n")); + return result; +} + +/* + * Split-up the format before substituting data, to avoid quoting issues. + * The resource mechanism has a limited ability to handle escapes. We take + * the result as if it were an sh-type string and parse it into a regular + * argv array. + */ +static char ** +tokenizeFormat(String format) +{ + char **result = 0; + + format = x_skip_blanks(format); + if (*format != '\0') { + char *blob = x_strdup(format); + int pass; + + for (pass = 0; pass < 2; ++pass) { + int used = 0; + int first = 1; + int escaped = 0; + int squoted = 0; + int dquoted = 0; + int n; + int argc = 0; + + for (n = 0; format[n] != '\0'; ++n) { + if (escaped) { + blob[used++] = format[n]; + escaped = 0; + } else if (format[n] == '"') { + if (!squoted) { + if (!dquoted) + blob[used++] = format[n]; + dquoted = !dquoted; + } + } else if (format[n] == '\'') { + if (!dquoted) { + if (!squoted) + blob[used++] = format[n]; + squoted = !squoted; + } + } else if (format[n] == '\\') { + blob[used++] = format[n]; + escaped = 1; + } else { + if (first) { + first = 0; + if (pass) { + result[argc] = &blob[n]; + } + ++argc; + } + if (isspace((Char) format[n])) { + first = !isspace((Char) format[n + 1]); + if (squoted || dquoted) { + blob[used++] = format[n]; + } else if (first) { + blob[used++] = '\0'; + } + } else { + blob[used++] = format[n]; + } + } + } + blob[used] = '\0'; + assert(strlen(blob) <= strlen(format)); + if (!pass) { + result = TypeCallocN(char *, argc + 1); + if (result == 0) { + free(blob); + break; + } + } + } + } +#if OPT_TRACE + if (result) { + int n; + TRACE(("tokenizeFormat %s\n", format)); + for (n = 0; result[n]; ++n) { + TRACE(("argv[%d] = %s\n", n, result[n])); + } + } +#endif + + return result; +} + +static void +formatVideoAttrs(XtermWidget xw, char *buffer, CELL *cell) +{ + TScreen *screen = TScreenOf(xw); + LineData *ld = GET_LINEDATA(screen, cell->row); + + *buffer = '\0'; + if (ld != 0 && cell->col < (int) ld->lineSize) { + IAttr attribs = ld->attribs[cell->col]; + const char *delim = ""; + + if (attribs & INVERSE) { + buffer += sprintf(buffer, "7"); + delim = ";"; + } + if (attribs & UNDERLINE) { + buffer += sprintf(buffer, "%s4", delim); + delim = ";"; + } + if (attribs & BOLD) { + buffer += sprintf(buffer, "%s1", delim); + delim = ";"; + } + if (attribs & BLINK) { + buffer += sprintf(buffer, "%s5", delim); + delim = ";"; + } +#if OPT_ISO_COLORS + if (attribs & FG_COLOR) { + Pixel fg = extract_fg(xw, ld->color[cell->col], attribs); + if (fg < 8) { + fg += 30; + } else if (fg < 16) { + fg += 90; + } else { + buffer += sprintf(buffer, "%s38;5", delim); + delim = ";"; + } + buffer += sprintf(buffer, "%s%lu", delim, fg); + delim = ";"; + } + if (attribs & BG_COLOR) { + Pixel bg = extract_bg(xw, ld->color[cell->col], attribs); + if (bg < 8) { + bg += 40; + } else if (bg < 16) { + bg += 100; + } else { + buffer += sprintf(buffer, "%s48;5", delim); + delim = ";"; + } + (void) sprintf(buffer, "%s%lu", delim, bg); + } +#endif + } +} + +static char * +formatStrlen(char *target, char *source, int freeit) +{ + if (source != 0) { + sprintf(target, "%u", (unsigned) strlen(source)); + if (freeit) { + free(source); + } + } else { + strcpy(target, "0"); + } + return target; +} + +/* substitute data into format, reallocating the result */ +static char * +expandFormat(XtermWidget xw, + const char *format, + char *data, + CELL *start, + CELL *finish) +{ + char *result = 0; + if (!IsEmpty(format)) { + static char empty[1]; + int pass; + int n; + char numbers[80]; + + if (data == 0) + data = empty; + + for (pass = 0; pass < 2; ++pass) { + size_t need = 0; + + for (n = 0; format[n] != '\0'; ++n) { + + if (format[n] == '%') { + char *value = 0; + + switch (format[++n]) { + case '%': + if (pass) { + result[need] = format[n]; + } + ++need; + break; + case 'P': + sprintf(numbers, "%d;%d", + TScreenOf(xw)->topline + start->row + 1, + start->col + 1); + value = numbers; + break; + case 'p': + sprintf(numbers, "%d;%d", + TScreenOf(xw)->topline + finish->row + 1, + finish->col + 1); + value = numbers; + break; + case 'R': + value = formatStrlen(numbers, x_strrtrim(data), 1); + break; + case 'r': + value = x_strrtrim(data); + break; + case 'S': + value = formatStrlen(numbers, data, 0); + break; + case 's': + value = data; + break; + case 'T': + value = formatStrlen(numbers, x_strtrim(data), 1); + break; + case 't': + value = x_strtrim(data); + break; + case 'V': + formatVideoAttrs(xw, numbers, start); + value = numbers; + break; + case 'v': + formatVideoAttrs(xw, numbers, finish); + value = numbers; + break; + default: + if (pass) { + result[need] = format[n]; + } + --n; + ++need; + break; + } + if (value != 0) { + if (pass) { + strcpy(result + need, value); + } + need += strlen(value); + if (value != numbers && value != data) { + free(value); + } + } + } else { + if (pass) { + result[need] = format[n]; + } + ++need; + } + } + if (pass) { + result[need] = '\0'; + } else { + ++need; + result = malloc(need); + if (result == 0) { + break; + } + } + } + } + TRACE(("expandFormat(%s) = %s\n", NonNull(format), NonNull(result))); + return result; +} + +/* execute the command after forking. The main process frees its data */ +static void +executeCommand(pid_t pid, char **argv) +{ + (void) pid; + if (argv != 0 && argv[0] != 0) { + char *child_cwd = ProcGetCWD(pid); + + if (fork() == 0) { + if (child_cwd) { + IGNORE_RC(chdir(child_cwd)); /* We don't care if this fails */ + } + execvp(argv[0], argv); + exit(EXIT_FAILURE); + } + free(child_cwd); + } +} + +static void +freeArgv(char *blob, char **argv) +{ + if (blob) { + free(blob); + if (argv) { + int n; + for (n = 0; argv[n]; ++n) + free(argv[n]); + free(argv); + } + } +} + +static void +reallyExecFormatted(Widget w, char *format, char *data, CELL *start, CELL *finish) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + char **argv; + + if ((argv = tokenizeFormat(format)) != 0) { + char *blob = argv[0]; + int argc; + + for (argc = 0; argv[argc] != 0; ++argc) { + argv[argc] = expandFormat(xw, argv[argc], data, start, finish); + } + executeCommand(TScreenOf(xw)->pid, argv); + freeArgv(blob, argv); + } + } +} + +void +HandleExecFormatted(Widget w, + XEvent *event, + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + TRACE_EVENT("HandleExecFormatted", event, params, num_params); + if ((xw = getXtermWidget(w)) != 0 && + (*num_params > 1)) { + doSelectionFormat(xw, w, event, params, num_params, reallyExecFormatted); + } +} + +void +HandleExecSelectable(Widget w, + XEvent *event, + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleExecSelectable", event, params, num_params); + + if (*num_params == 2) { + CELL start, finish; + char *data; + char **argv; + + data = getDataFromScreen(xw, event, params[1], &start, &finish); + if (data != 0) { + if ((argv = tokenizeFormat(params[0])) != 0) { + char *blob = argv[0]; + int argc; + + for (argc = 0; argv[argc] != 0; ++argc) { + argv[argc] = expandFormat(xw, argv[argc], data, + &start, &finish); + } + executeCommand(TScreenOf(xw)->pid, argv); + freeArgv(blob, argv); + } + free(data); + } + } + } +} + +static void +reallyInsertFormatted(Widget w, char *format, char *data, CELL *start, CELL *finish) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + char *exps; + + if ((exps = expandFormat(xw, format, data, start, finish)) != 0) { + unparseputs(xw, exps); + unparse_end(xw); + free(exps); + } + } +} + +void +HandleInsertFormatted(Widget w, + XEvent *event, + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + TRACE_EVENT("HandleInsertFormatted", event, params, num_params); + if ((xw = getXtermWidget(w)) != 0 && + (*num_params > 1)) { + doSelectionFormat(xw, w, event, params, num_params, reallyInsertFormatted); + } +} + +void +HandleInsertSelectable(Widget w, + XEvent *event, + String *params, /* selections */ + Cardinal *num_params) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + TRACE_EVENT("HandleInsertSelectable", event, params, num_params); + + if (*num_params == 2) { + CELL start, finish; + char *data; + char *temp = x_strdup(params[0]); + + data = getDataFromScreen(xw, event, params[1], &start, &finish); + if (data != 0) { + char *exps = expandFormat(xw, temp, data, &start, &finish); + if (exps != 0) { + unparseputs(xw, exps); + unparse_end(xw); + free(exps); + } + free(data); + } + free(temp); + } + } +} +#endif /* OPT_SELECTION_OPS */ diff --git a/ports/xterm/xterm-359/button.o b/ports/xterm/xterm-359/button.o new file mode 100644 index 0000000..bc4be88 Binary files /dev/null and b/ports/xterm/xterm-359/button.o differ diff --git a/ports/xterm/xterm-359/cachedGCs.c b/ports/xterm/xterm-359/cachedGCs.c new file mode 100644 index 0000000..9126f17 --- /dev/null +++ b/ports/xterm/xterm-359/cachedGCs.c @@ -0,0 +1,888 @@ +/* $XTermId: cachedGCs.c,v 1.79 2019/11/13 23:07:08 tom Exp $ */ + +/* + * Copyright 2007-2018,2019 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#include +#include +#include + +#include + +/* + * hide (or eliminate) calls to + * XCreateGC() + * XFreeGC() + * XGetGCValues() + * XSetBackground() + * XSetFont() + * XSetForeground() + * XtGetGC() + * XtReleaseGC() + * by associating an integer with each GC, maintaining a cache which + * reflects frequency of use rather than most recent usage. + * + * FIXME: XTermFonts should hold gc, font, fs. + */ +typedef struct { + GC gc; + unsigned used; + unsigned cset; + XTermFonts *font; + Pixel tile; + Pixel fg; + Pixel bg; +} CgsCacheData; + +#define DEPTH 8 +#define ITEM() (int) (me->data - me->list) +#define LIST(item) me->list[item] +#define LINK(item) me->data = (me->list + (item)) +#define THIS(field) me->data->field +#define NEXT(field) me->next.field + +#define HaveFont(font) (Boolean) ((font) != 0 && (font)->fs != 0) + +#define GC_CSet GCFunction + +typedef struct { + CgsCacheData list[DEPTH]; + CgsCacheData *data; /* points to current list[] entry */ + XtGCMask mask; /* changes since the last getCgsGC() */ + CgsCacheData next; /* updated values, apply in getCgsGC() */ +} CgsCache; + +#if OPT_TRACE +#define CASE(name) case gc##name: result = #name; break +static const char * +traceCgsEnum(CgsEnum value) +{ + const char *result = "?"; + switch (value) { + CASE(Norm); + CASE(Bold); + CASE(NormReverse); + CASE(BoldReverse); + CASE(Border); + CASE(Filler); +#if OPT_BOX_CHARS + CASE(Line); + CASE(Dots); +#endif +#if OPT_DEC_CHRSET + CASE(CNorm); + CASE(CBold); +#endif +#if OPT_WIDE_CHARS + CASE(Wide); + CASE(WBold); + CASE(WideReverse); + CASE(WBoldReverse); +#endif + CASE(VTcursNormal); + CASE(VTcursFilled); + CASE(VTcursReverse); + CASE(VTcursOutline); +#if OPT_TEK4014 + CASE(TKcurs); +#endif + CASE(MAX); + } + return result; +} + +#undef CASE + +static const char * +traceVTwin(XtermWidget xw, VTwin *value) +{ + const char *result = "?"; + if (value == 0) + result = "null"; + else if (value == &(TScreenOf(xw)->fullVwin)) + result = "fullVwin"; +#ifndef NO_ACTIVE_ICON + else if (value == &(TScreenOf(xw)->iconVwin)) + result = "iconVwin"; +#endif + return result; +} + +#if OPT_TRACE > 1 +static String +traceCSet(unsigned cset) +{ + static char result[80]; + switch (cset) { + case CSET_SWL: + strcpy(result, "SWL"); + break; + case CSET_DHL_TOP: + strcpy(result, "DHL_TOP"); + break; + case CSET_DHL_BOT: + strcpy(result, "DHL_BOT"); + break; + case CSET_DWL: + strcpy(result, "DWL"); + break; + default: + sprintf(result, "%#x", cset); + break; + } + return result; +} + +static String +traceFont(XTermFonts * font) +{ + static char result[80]; + + if (HaveFont(font)) { + XFontStruct *fs = font->fs; + sprintf(result, "%p(%dx%d %d %#lx)", + fs, + fs->max_bounds.width, + fs->max_bounds.ascent + fs->max_bounds.descent, + fs->max_bounds.descent, + (unsigned long) (fs->fid)); + } else { + strcpy(result, "null"); + } + return result; +} + +static String +tracePixel(XtermWidget xw, Pixel value) +{ +#define CASE(name) { name, #name } + static struct { + TermColors code; + String name; + } t_colors[] = { + CASE(TEXT_FG), + CASE(TEXT_BG), + CASE(TEXT_CURSOR), + CASE(MOUSE_FG), + CASE(MOUSE_BG), +#if OPT_TEK4014 + CASE(TEK_FG), + CASE(TEK_BG), +#endif +#if OPT_HIGHLIGHT_COLOR + CASE(HIGHLIGHT_BG), + CASE(HIGHLIGHT_FG), +#endif +#if OPT_TEK4014 + CASE(TEK_CURSOR), +#endif + }; + TScreen *screen = TScreenOf(xw); + String result = 0; + int n; + + for (n = 0; n < NCOLORS; ++n) { + if (value == T_COLOR(screen, t_colors[n].code)) { + result = t_colors[n].name; + break; + } + } + + if (result == 0) { + for (n = 0; n < MAXCOLORS; ++n) { +#if OPT_COLOR_RES + if (screen->Acolors[n].mode > 0 + && value == screen->Acolors[n].value) { + result = screen->Acolors[n].resource; + break; + } +#else + if (value == screen->Acolors[n]) { + char temp[80]; + sprintf(temp, "Acolors[%d]", n); + result = x_strdup(temp); + break; + } +#endif + } + } + + if (result == 0) { + char temp[80]; + sprintf(temp, "%#lx", value); + result = x_strdup(temp); + } + + return result; +} + +#undef CASE + +#endif /* OPT_TRACE > 1 */ +#endif /* OPT_TRACE */ + +static CgsCache * +allocCache(void **cache_pointer) +{ + if (*cache_pointer == 0) { + *cache_pointer = TypeCallocN(CgsCache, gcMAX); + TRACE(("allocCache %p\n", *cache_pointer)); + } + return *((CgsCache **) cache_pointer); +} + +#define ALLOC_CACHE(p) ((*(p) == 0) ? allocCache(p) : *(p)) + +static int +dataIndex(CgsCache * me) +{ + return ITEM(); +} + +static void +relinkData(CgsCache * me, int item) +{ + LINK(item); +} + +/* + * Returns the appropriate cache pointer. + */ +static CgsCache * +myCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId) +{ + CgsCache *result = 0; + + if ((int) cgsId >= 0 && cgsId < gcMAX) { +#ifdef NO_ACTIVE_ICON + (void) xw; + (void) cgsWin; +#else + if (cgsWin == &(TScreenOf(xw)->iconVwin)) + result = ALLOC_CACHE(&(TScreenOf(xw)->icon_cgs_cache)); + else +#endif + result = ALLOC_CACHE(&(TScreenOf(xw)->main_cgs_cache)); + + result += cgsId; + if (result->data == 0) { + result->data = result->list; + } + } + + return result; +} + +static Display * +myDisplay(XtermWidget xw) +{ + return TScreenOf(xw)->display; +} + +static Drawable +myDrawable(XtermWidget xw, VTwin *cgsWin) +{ + Drawable drawable = 0; + + if (cgsWin != 0 && cgsWin->window != 0) + drawable = cgsWin->window; + if (drawable == 0) + drawable = RootWindowOfScreen(XtScreen(xw)); + return drawable; +} + +static GC +newCache(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, CgsCache * me) +{ + XGCValues xgcv; + XtGCMask mask; + + THIS(font) = NEXT(font); + THIS(cset) = NEXT(cset); + THIS(fg) = NEXT(fg); + THIS(bg) = NEXT(bg); + + memset(&xgcv, 0, sizeof(xgcv)); + xgcv.font = NEXT(font)->fs->fid; + mask = (GCForeground | GCBackground | GCFont); + + switch (cgsId) { + case gcFiller: + case gcBorder: + mask &= (XtGCMask) ~ GCFont; + /* FALLTHRU */ + case gcNorm: + case gcBold: + case gcNormReverse: + case gcBoldReverse: +#if OPT_WIDE_CHARS + case gcWide: + case gcWBold: + case gcWideReverse: + case gcWBoldReverse: +#endif + mask |= (GCGraphicsExposures | GCFunction); + xgcv.graphics_exposures = True; /* default */ + xgcv.function = GXcopy; + break; +#if OPT_BOX_CHARS + case gcLine: + mask |= (GCGraphicsExposures | GCFunction); + xgcv.graphics_exposures = True; /* default */ + xgcv.function = GXcopy; + break; + case gcDots: + xgcv.fill_style = FillTiled; + xgcv.tile = + XmuCreateStippledPixmap(XtScreen((Widget) xw), + THIS(fg), + THIS(bg), + xw->core.depth); + THIS(tile) = xgcv.tile; + mask = (GCForeground | GCBackground); + mask |= (GCGraphicsExposures | GCFunction | GCTile | GCFillStyle); + xgcv.graphics_exposures = True; /* default */ + xgcv.function = GXcopy; + break; +#endif +#if OPT_DEC_CHRSET + case gcCNorm: + case gcCBold: + break; +#endif + case gcVTcursNormal: /* FALLTHRU */ + case gcVTcursFilled: /* FALLTHRU */ + case gcVTcursReverse: /* FALLTHRU */ + case gcVTcursOutline: /* FALLTHRU */ + break; +#if OPT_TEK4014 + case gcTKcurs: /* FALLTHRU */ + /* FIXME */ +#endif + case gcMAX: /* should not happen */ + return 0; + } + xgcv.foreground = NEXT(fg); + xgcv.background = NEXT(bg); + + THIS(gc) = XCreateGC(myDisplay(xw), myDrawable(xw, cgsWin), mask, &xgcv); + TRACE(("getCgsGC(%s) created gc %p(%d)\n", + traceCgsEnum(cgsId), (void *) THIS(gc), ITEM())); + + THIS(used) = 0; + return THIS(gc); +} + +#define SameFont(a, b) \ + (Boolean) (HaveFont(a) \ + && HaveFont(b) \ + && (((a)->fs == (b)->fs) \ + || !memcmp((a)->fs, (b)->fs, sizeof(*((a)->fs))))) + +#define SameColor(a,b) ((a) == (b)) +#define SameCSet(a,b) ((a) == (b)) + +static GC +chgCache(XtermWidget xw, CgsEnum cgsId GCC_UNUSED, CgsCache * me, Bool both) +{ + XGCValues xgcv; + XtGCMask mask = (GCForeground | GCBackground | GCFont); + + memset(&xgcv, 0, sizeof(xgcv)); + + TRACE2(("chgCache(%s) old data fg=%s, bg=%s, font=%s cset %s\n", + traceCgsEnum(cgsId), + tracePixel(xw, THIS(fg)), + tracePixel(xw, THIS(bg)), + traceFont(THIS(font)), + traceCSet(THIS(cset)))); +#if OPT_TRACE > 1 + if (!SameFont(THIS(font), NEXT(font))) + TRACE2(("...chgCache new font=%s\n", traceFont(NEXT(font)))); + if (!SameCSet(THIS(cset), NEXT(cset))) + TRACE2(("...chgCache new cset=%s\n", traceCSet(NEXT(cset)))); + if (!SameColor(THIS(fg), NEXT(fg))) + TRACE2(("...chgCache new fg=%s\n", tracePixel(xw, NEXT(fg)))); + if (!SameColor(THIS(bg), NEXT(bg))) + TRACE2(("...chgCache new bg=%s\n", tracePixel(xw, NEXT(bg)))); +#endif + + if (both) { + THIS(font) = NEXT(font); + THIS(cset) = NEXT(cset); + } + THIS(fg) = NEXT(fg); + THIS(bg) = NEXT(bg); + + xgcv.font = THIS(font)->fs->fid; + xgcv.foreground = THIS(fg); + xgcv.background = THIS(bg); + + XChangeGC(myDisplay(xw), THIS(gc), mask, &xgcv); + TRACE2(("...chgCache(%s) updated gc %p(%d)\n", + traceCgsEnum(cgsId), THIS(gc), ITEM())); + + THIS(used) = 0; + return THIS(gc); +} + +/* + * Use the "setCgsXXXX()" calls to initialize parameters for a new GC. + */ +void +setCgsFore(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, Pixel fg) +{ + CgsCache *me; + + if ((me = myCache(xw, cgsWin, cgsId)) != 0) { + NEXT(fg) = fg; + me->mask |= GCForeground; + TRACE2(("setCgsFore(%s) %s\n", + traceCgsEnum(cgsId), + tracePixel(xw, NEXT(fg)))); + } +} + +void +setCgsBack(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, Pixel bg) +{ + CgsCache *me; + + if ((me = myCache(xw, cgsWin, cgsId)) != 0) { + NEXT(bg) = bg; + me->mask |= GCBackground; + TRACE2(("setCgsBack(%s) %s\n", + traceCgsEnum(cgsId), + tracePixel(xw, NEXT(bg)))); + } +} + +#if OPT_DEC_CHRSET +void +setCgsCSet(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, unsigned cset) +{ + CgsCache *me; + + if ((me = myCache(xw, cgsWin, cgsId)) != 0) { + NEXT(cset) = cset; + me->mask |= GC_CSet; + } +} +#else +#define setCgsCSet(xw, cgsWin, dstCgsId, cset) /* nothing */ +#endif + +void +setCgsFont2(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, XTermFonts * font, unsigned which) +{ + CgsCache *me; + + if ((me = myCache(xw, cgsWin, cgsId)) != 0) { + TScreen *screen = TScreenOf(xw); + if (!HaveFont(font)) { + if (cgsId != gcNorm) + (void) getCgsGC(xw, cgsWin, gcNorm); +#ifndef NO_ACTIVE_ICON + if (cgsWin == &(TScreenOf(xw)->iconVwin)) + font = getIconicFont(screen); + else +#endif + font = GetNormalFont(screen, which); + } + if (HaveFont(font) && okFont(font->fs)) { + TRACE2(("setCgsFont next: %s for %s slot %p, gc %p\n", + traceFont(font), traceCgsEnum(cgsId), + me, THIS(gc))); + TRACE2(("...next font was %s\n", traceFont(NEXT(font)))); + NEXT(font) = font; + me->mask |= GCFont; + } else { + /* EMPTY */ + TRACE2(("...NOT updated font for %s\n", + traceCgsEnum(cgsId))); + } + } +} + +void +setCgsFont(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId, XTermFonts * font) +{ + setCgsFont2(xw, cgsWin, cgsId, font, fNorm); +} + +/* + * Discard all of the font information, e.g., we are resizing the font. + * Keep the GC's so we can simply change them rather than creating new ones. + */ +void +clrCgsFonts(XtermWidget xw, VTwin *cgsWin, XTermFonts * font) +{ + if (HaveFont(font)) { + int j; + for_each_gc(j) { + CgsCache *me; + if ((me = myCache(xw, cgsWin, (CgsEnum) j)) != 0) { + int k; + for (k = 0; k < DEPTH; ++k) { + if (SameFont(LIST(k).font, font)) { + TRACE2(("clrCgsFonts %s gc %p(%d) %s\n", + traceCgsEnum((CgsEnum) j), + LIST(k).gc, + k, + traceFont(font))); + LIST(k).font = 0; + LIST(k).cset = 0; + } + } + if (SameFont(NEXT(font), font)) { + TRACE2(("clrCgsFonts %s next %s\n", + traceCgsEnum((CgsEnum) j), + traceFont(font))); + NEXT(font) = 0; + NEXT(cset) = 0; + me->mask &= (unsigned) ~(GCFont | GC_CSet); + } + } + } + } +} + +/* + * Return a GC associated with the given id, allocating if needed. + */ +GC +getCgsGC(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId) +{ + CgsCache *me; + GC result = 0; + + if ((me = myCache(xw, cgsWin, cgsId)) != 0) { + TRACE2(("getCgsGC(%s, %s)\n", + traceVTwin(xw, cgsWin), traceCgsEnum(cgsId))); + if (me->mask != 0) { + int j; + unsigned used = 0; + + /* fill in the unchanged fields */ + if (!(me->mask & GC_CSet)) + NEXT(cset) = 0; /* OPT_DEC_CHRSET */ + if (!(me->mask & GCFont)) + NEXT(font) = THIS(font); + if (!(me->mask & GCForeground)) + NEXT(fg) = THIS(fg); + if (!(me->mask & GCBackground)) + NEXT(bg) = THIS(bg); + + if (NEXT(font) == 0) { + setCgsFont(xw, cgsWin, cgsId, 0); + } + + TRACE2(("...Cgs new data fg=%s, bg=%s, font=%s cset %s\n", + tracePixel(xw, NEXT(fg)), + tracePixel(xw, NEXT(bg)), + traceFont(NEXT(font)), + traceCSet(NEXT(cset)))); + + /* try to find the given data in an already-created GC */ + for (j = 0; j < DEPTH; ++j) { + if (LIST(j).gc != 0 + && SameFont(LIST(j).font, NEXT(font)) + && SameCSet(LIST(j).cset, NEXT(cset)) + && SameColor(LIST(j).fg, NEXT(fg)) + && SameColor(LIST(j).bg, NEXT(bg))) { + LINK(j); + result = THIS(gc); + TRACE2(("getCgsGC existing %p(%d)\n", result, ITEM())); + break; + } + } + + if (result == 0) { + /* try to find an empty slot, to create a new GC */ + used = 0; + for (j = 0; j < DEPTH; ++j) { + if (LIST(j).gc == 0) { + LINK(j); + result = newCache(xw, cgsWin, cgsId, me); + break; + } + if (used < LIST(j).used) + used = LIST(j).used; + } + } + + if (result == 0) { + int k; + /* if none were empty, pick the least-used slot, to modify */ + for (j = 0, k = -1; j < DEPTH; ++j) { + if (used >= LIST(j).used) { + used = LIST(j).used; + k = j; + } + } + if (k >= 0) { + LINK(k); + TRACE2(("...getCgsGC least-used(%d) was %d\n", k, THIS(used))); + result = chgCache(xw, cgsId, me, True); + } + } + me->next = *(me->data); + } else { + result = THIS(gc); + } + me->mask = 0; + THIS(used) += 1; + TRACE2(("...getCgsGC(%s, %s) gc %p(%d), used %d\n", + traceVTwin(xw, cgsWin), + traceCgsEnum(cgsId), result, ITEM(), THIS(used))); + } + return result; +} + +/* + * Return the font for the given GC. + */ +CgsEnum +getCgsId(XtermWidget xw, VTwin *cgsWin, GC gc) +{ + int n; + CgsEnum result = gcNorm; + + for_each_gc(n) { + CgsCache *me; + + if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) { + if (THIS(gc) == gc) { + result = (CgsEnum) n; + break; + } + } + } + return result; +} + +/* + * Return the font for the given GC. + */ +XTermFonts * +getCgsFont(XtermWidget xw, VTwin *cgsWin, GC gc) +{ + int n; + XTermFonts *result = 0; + + for_each_gc(n) { + CgsCache *me; + + if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) { + if (THIS(gc) == gc) { + result = THIS(font); + break; + } + } + } + return result; +} + +/* + * Return the foreground color for the given GC. + */ +Pixel +getCgsFore(XtermWidget xw, VTwin *cgsWin, GC gc) +{ + int n; + Pixel result = 0; + + for_each_gc(n) { + CgsCache *me; + + if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) { + if (THIS(gc) == gc) { + result = THIS(fg); + break; + } + } + } + return result; +} + +/* + * Return the background color for the given GC. + */ +Pixel +getCgsBack(XtermWidget xw, VTwin *cgsWin, GC gc) +{ + int n; + Pixel result = 0; + + for_each_gc(n) { + CgsCache *me; + + if ((me = myCache(xw, cgsWin, (CgsEnum) n)) != 0) { + if (THIS(gc) == gc) { + result = THIS(bg); + break; + } + } + } + return result; +} + +/* + * Copy the parameters (except GC of course) from one cache record to another. + */ +void +copyCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId) +{ + if (dstCgsId != srcCgsId) { + CgsCache *me; + + if ((me = myCache(xw, cgsWin, srcCgsId)) != 0) { + TRACE(("copyCgs from %s to %s\n", + traceCgsEnum(srcCgsId), + traceCgsEnum(dstCgsId))); + TRACE2(("copyCgs from %s (me %p, fg %s, bg %s, cset %s) to %s {{\n", + traceCgsEnum(srcCgsId), + me, + tracePixel(xw, THIS(fg)), + tracePixel(xw, THIS(bg)), + traceCSet(THIS(cset)), + traceCgsEnum(dstCgsId))); + setCgsCSet(xw, cgsWin, dstCgsId, THIS(cset)); + setCgsFore(xw, cgsWin, dstCgsId, THIS(fg)); + setCgsBack(xw, cgsWin, dstCgsId, THIS(bg)); + setCgsFont(xw, cgsWin, dstCgsId, THIS(font)); + TRACE2(("...copyCgs }}\n")); + } + } +} + +/* + * Interchange colors in the cache, e.g., for reverse-video. + */ +void +redoCgs(XtermWidget xw, Pixel fg, Pixel bg, CgsEnum cgsId) +{ + VTwin *cgsWin = WhichVWin(TScreenOf(xw)); + CgsCache *me = myCache(xw, cgsWin, cgsId); + + if (me != 0) { + CgsCacheData *save_data = me->data; + int n; + + for (n = 0; n < DEPTH; ++n) { + if (LIST(n).gc != 0 && HaveFont(LIST(n).font)) { + LINK(n); + + if (LIST(n).fg == fg + && LIST(n).bg == bg) { + setCgsFore(xw, cgsWin, cgsId, bg); + setCgsBack(xw, cgsWin, cgsId, fg); + } else if (LIST(n).fg == bg + && LIST(n).bg == fg) { + setCgsFore(xw, cgsWin, cgsId, fg); + setCgsBack(xw, cgsWin, cgsId, bg); + } else { + continue; + } + + (void) chgCache(xw, cgsId, me, False); + } + } + me->data = save_data; + } +} + +/* + * Swap the cache records, e.g., when doing reverse-video. + */ +void +swapCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum dstCgsId, CgsEnum srcCgsId) +{ + if (dstCgsId != srcCgsId) { + CgsCache *src; + + if ((src = myCache(xw, cgsWin, srcCgsId)) != 0) { + CgsCache *dst; + + if ((dst = myCache(xw, cgsWin, dstCgsId)) != 0) { + CgsCache tmp; + int srcIndex = dataIndex(src); + int dstIndex = dataIndex(dst); + + EXCHANGE(*src, *dst, tmp); + + relinkData(src, dstIndex); + relinkData(dst, srcIndex); + } + } + } +} + +/* + * Free any GC associated with the given id. + */ +GC +freeCgs(XtermWidget xw, VTwin *cgsWin, CgsEnum cgsId) +{ + CgsCache *me; + + if ((me = myCache(xw, cgsWin, cgsId)) != 0) { + int j; + + for (j = 0; j < DEPTH; ++j) { + if (LIST(j).gc != 0) { + TRACE(("freeCgs(%s, %s) gc %p(%d)\n", + traceVTwin(xw, cgsWin), + traceCgsEnum(cgsId), (void *) LIST(j).gc, j)); + clrCgsFonts(xw, cgsWin, LIST(j).font); +#if OPT_BOX_CHARS + if (cgsId == gcDots) { + XmuReleaseStippledPixmap(XtScreen((Widget) xw), LIST(j).tile); + } +#endif + XFreeGC(TScreenOf(xw)->display, LIST(j).gc); + memset(&LIST(j), 0, sizeof(LIST(j))); + } + LINK(0); + } + } + return 0; +} + +#ifdef NO_LEAKS +void +noleaks_cachedCgs(XtermWidget xw) +{ +#ifndef NO_ACTIVE_ICON + free(TScreenOf(xw)->icon_cgs_cache); +#endif + free(TScreenOf(xw)->main_cgs_cache); +} +#endif diff --git a/ports/xterm/xterm-359/cachedGCs.o b/ports/xterm/xterm-359/cachedGCs.o new file mode 100644 index 0000000..3b18e44 Binary files /dev/null and b/ports/xterm/xterm-359/cachedGCs.o differ diff --git a/ports/xterm/xterm-359/charclass.c b/ports/xterm/xterm-359/charclass.c new file mode 100644 index 0000000..9b258c2 --- /dev/null +++ b/ports/xterm/xterm-359/charclass.c @@ -0,0 +1,514 @@ +/* $XTermId: charclass.c,v 1.41 2020/07/06 20:00:12 tom Exp $ */ + +/* + * Copyright 2002-2017,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + *---------------------------------------------------------------------------- + * Compact and efficient reimplementation of the + * xterm character class mechanism for large character sets + * + * Markus Kuhn -- mkuhn@acm.org -- 2000-07-03 + * + * xterm allows users to select entire words with a double-click on the left + * mouse button. Opinions might differ on what type of characters are part of + * separate words, therefore xterm allows users to configure a class code for + * each 8-bit character. Words are maximum length sequences of neighboring + * characters with identical class code. Extending this mechanism to Unicode + * naively would create an at least 2^16 entries (128 kB) long class code + * table. + * + * Instead, we transform the character class table into a list of intervals, + * that will be accessed via a linear search. Changes made to the table by the + * user will be appended. A special class code IDENT (default) marks + * characters who have their code number as the class code. + * + * We could alternatively use a sorted table of non-overlapping intervals that + * can be accessed via binary search, but merging in new intervals is + * significantly more hassle and not worth the effort here. + */ + +#include +#include + +#if OPT_WIDE_CHARS + +#ifdef TEST_DRIVER + +#include +#include +#include + +#if OPT_TRACE +#define Trace if (opt_v) printf +#endif + +#undef OPT_REPORT_CCLASS +#define OPT_REPORT_CCLASS 1 +#endif /* TEST_DRIVER */ + +static struct classentry { + int cclass; + int first; + int last; +} *classtab; + +typedef enum { + IDENT = -1, + OTHER = 0, + CNTRL = 1, + ALNUM = 48, + BLANK = 32, + U_CJK = 0x4e00, + U_SUP = 0x2070, + U_SUB = 0x2080, + U_HIR = 0x3040, + U_KAT = 0x30a0, + U_HAN = 0xac00 +} Classes; + +#ifdef TEST_DRIVER +static int opt_all; +static int opt_check; +static int opt_quiet; +static int opt_v; +#endif + +void +init_classtab(void) +{ + const int size = 50; + + TRACE(("init_classtab {{\n")); + + classtab = TypeMallocN(struct classentry, (unsigned) size); + if (!classtab) + abort(); + classtab[0].cclass = size; + classtab[0].first = 1; + classtab[0].last = 0; + + /* old xterm default classes */ + SetCharacterClassRange(0, 0, BLANK); + SetCharacterClassRange(1, 31, CNTRL); + SetCharacterClassRange('\t', '\t', BLANK); + SetCharacterClassRange('0', '9', ALNUM); + SetCharacterClassRange('A', 'Z', ALNUM); + SetCharacterClassRange('_', '_', ALNUM); + SetCharacterClassRange('a', 'z', ALNUM); + SetCharacterClassRange(127, 159, CNTRL); + SetCharacterClassRange(160, 191, IDENT); + SetCharacterClassRange(192, 255, ALNUM); + SetCharacterClassRange(215, 215, IDENT); + SetCharacterClassRange(247, 247, IDENT); + + /* added Unicode classes */ + SetCharacterClassRange(0x0100, 0xffdf, ALNUM); /* mostly characters */ + SetCharacterClassRange(0x037e, 0x037e, IDENT); /* Greek question mark */ + SetCharacterClassRange(0x0387, 0x0387, IDENT); /* Greek ano teleia */ + SetCharacterClassRange(0x055a, 0x055f, IDENT); /* Armenian punctuation */ + SetCharacterClassRange(0x0589, 0x0589, IDENT); /* Armenian full stop */ + SetCharacterClassRange(0x0700, 0x070d, IDENT); /* Syriac punctuation */ + SetCharacterClassRange(0x104a, 0x104f, IDENT); /* Myanmar punctuation */ + SetCharacterClassRange(0x10fb, 0x10fb, IDENT); /* Georgian punctuation */ + SetCharacterClassRange(0x1361, 0x1368, IDENT); /* Ethiopic punctuation */ + SetCharacterClassRange(0x166d, 0x166e, IDENT); /* Canadian Syl. punctuation */ + SetCharacterClassRange(0x17d4, 0x17dc, IDENT); /* Khmer punctuation */ + SetCharacterClassRange(0x1800, 0x180a, IDENT); /* Mongolian punctuation */ + SetCharacterClassRange(0x2000, 0x200a, BLANK); /* spaces */ + SetCharacterClassRange(0x200b, 0x27ff, IDENT); /* punctuation and symbols */ + SetCharacterClassRange(0x2070, 0x207f, U_SUP); /* superscript */ + SetCharacterClassRange(0x2080, 0x208f, U_SUB); /* subscript */ + SetCharacterClassRange(0x3000, 0x3000, BLANK); /* ideographic space */ + SetCharacterClassRange(0x3001, 0x3020, IDENT); /* ideographic punctuation */ + SetCharacterClassRange(0x3040, 0x309f, U_HIR); /* Hiragana */ + SetCharacterClassRange(0x30a0, 0x30ff, U_KAT); /* Katakana */ + SetCharacterClassRange(0x3300, 0x9fff, U_CJK); /* CJK Ideographs */ + SetCharacterClassRange(0xac00, 0xd7a3, U_HAN); /* Hangul Syllables */ + SetCharacterClassRange(0xf900, 0xfaff, U_CJK); /* CJK Ideographs */ + SetCharacterClassRange(0xfe30, 0xfe6b, IDENT); /* punctuation forms */ + SetCharacterClassRange(0xff00, 0xff0f, IDENT); /* half/fullwidth ASCII */ + SetCharacterClassRange(0xff1a, 0xff20, IDENT); /* half/fullwidth ASCII */ + SetCharacterClassRange(0xff3b, 0xff40, IDENT); /* half/fullwidth ASCII */ + SetCharacterClassRange(0xff5b, 0xff64, IDENT); /* half/fullwidth ASCII */ + + TRACE(("}} init_classtab\n")); + return; +} + +int +CharacterClass(int c) +{ + int i, cclass = IDENT; + + for (i = classtab[0].first; i <= classtab[0].last; i++) + if (classtab[i].first <= c && classtab[i].last >= c) + cclass = classtab[i].cclass; + + if (cclass < 0) + cclass = c; + + return cclass; +} + +#if OPT_REPORT_CCLASS +#define charFormat(code) ((code) > 255 ? "0x%04X" : "%d") +static const char * +class_name(Classes code) +{ + static char buffer[80]; + const char *result = "?"; + switch (code) { + case ALNUM: + result = "ALNUM"; + break; + case BLANK: + result = "BLANK"; + break; + case CNTRL: + result = "CNTRL"; + break; + case OTHER: + result = "OTHER"; + break; + case IDENT: + result = "IDENT"; + break; + case U_SUP: + result = "superscript"; + break; + case U_SUB: + result = "subscript"; + break; + case U_CJK: + result = "CJK Ideographs"; + break; + case U_HIR: + result = "Hiragana"; + break; + case U_KAT: + result = "Katakana"; + break; + case U_HAN: + result = "Hangul Syllables"; + break; + default: + sprintf(buffer, charFormat(code), code); + result = buffer; + break; + } + return result; +} + +/* + * Special convention for classtab[0]: + * - classtab[0].cclass is the allocated number of entries in classtab + * - classtab[0].first = 1 (first used entry in classtab) + * - classtab[0].last is the last used entry in classtab + */ + +int +SetCharacterClassRange(int low, int high, int value) +{ + TRACE(("...SetCharacterClassRange (U+%04X .. U+%04X) = %s\n", + low, high, class_name(value))); + + if (high < low) + return -1; /* nothing to do */ + + /* make sure we have at least one free entry left at table end */ + if (classtab[0].last > classtab[0].cclass - 2) { + classtab[0].cclass += 5 + classtab[0].cclass / 4; + classtab = TypeRealloc(struct classentry, + (unsigned) classtab[0].cclass, classtab); + if (!classtab) + abort(); + } + + /* simply append new interval to end of interval array */ + classtab[0].last++; + classtab[classtab[0].last].first = low; + classtab[classtab[0].last].last = high; + classtab[classtab[0].last].cclass = value; + + return 0; +} + +void +report_wide_char_class(void) +{ + static const Classes known_classes[] = + {IDENT, ALNUM, CNTRL, BLANK, U_SUP, U_SUB, U_HIR, U_KAT, U_CJK, U_HAN}; + int i; + + printf("\n"); + printf("Unicode charClass data uses the last match\n"); + printf("from these overlapping intervals of character codes:\n"); + for (i = classtab[0].first; i <= classtab[0].last; i++) { + printf("\tU+%04X .. U+%04X %s\n", + classtab[i].first, + classtab[i].last, + class_name(classtab[i].cclass)); + } + printf("\n"); + printf("These class-names are used internally (the first character code in a class):\n"); + for (i = 0; i < (int) XtNumber(known_classes); ++i) { + printf("\t"); + printf(charFormat(known_classes[i]), known_classes[i]); + printf(" = %s\n", class_name(known_classes[i])); + } +} +#endif /* OPT_REPORT_CCLASS */ + +#ifdef NO_LEAKS +void +noleaks_CharacterClass(void) +{ + if (classtab != 0) { + free(classtab); + classtab = 0; + } +} +#endif +#endif /* OPT_WIDE_CHARS */ + +#ifdef TEST_DRIVER +#if OPT_WIDE_CHARS +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: test_charclass [options] [c1[-c1b] [c2-[c2b] [...]]]", + "", + "Options:", + " -a show all data", + " -s show only summary", + " -v verbose" + }; + size_t n; + for (n = 0; n < sizeof(msg) / sizeof(msg[0]); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + exit(EXIT_FAILURE); +} + +static int +expected_class(int wch) +{ + int result = wch; + wint_t ch = (wint_t) wch; + if (ch == '\0' || ch == '\t') { + result = BLANK; + } else if (iswcntrl(ch)) { + result = CNTRL; + } else if (iswspace(ch)) { + result = BLANK; + } else if (ch < 127) { + if (isalnum(ch) || ch == '_') { + result = ALNUM; + } + } else if (ch == 170 || ch == 181 || ch == 186) { + ; + } else if (iswalnum(ch)) { + result = ALNUM; + } + return result; +} + +static int +show_cclass_range(int lo, int hi) +{ + int cclass = CharacterClass(lo); + int ident = (cclass == lo); + int more = 0; + if (ident) { + int ch; + for (ch = lo + 1; ch <= hi; ch++) { + if (CharacterClass(ch) != ch) { + ident = 0; + break; + } + } + if (ident && (hi < 255)) { + ch = hi + 1; + if (CharacterClass(ch) == ch) { + if (ch >= 255 || CharacterClass(ch + 1) != ch) { + more = 1; + } + } + } + } + if (!more) { + if (lo == hi) { + printf("\t%d", lo); + } else { + printf("\t%d-%d", lo, hi); + } + if (!ident) + printf(":%d", cclass); + if (hi < 255) + printf(", \\"); + printf("\n"); + } + return !more; +} + +static void +report_resource(int first, int last) +{ + int class_p; + int ch; + int dh; + + class_p = CharacterClass(dh = first); + for (ch = first; ch < last; ++ch) { + int class_c = CharacterClass(ch); + if (class_c != class_p) { + if (show_cclass_range(dh, ch - 1)) { + dh = ch; + class_p = class_c; + } + } + } + if (dh < last - 1) { + show_cclass_range(dh, last - 1); + } +} + +static int +decode_one(const char *source, char **target) +{ + int result = -1; + long check; + int radix = 0; + if ((source[0] == 'u' || source[0] == 'U') && source[1] == '+') { + source += 2; + radix = 16; + } + check = strtol(source, target, radix); + if (*target != NULL && *target != source) + result = (int) check; + return result; +} + +static int +decode_range(const char *source, int *lo, int *hi) +{ + int result = 0; + char *after1; + char *after2; + if ((*lo = decode_one(source, &after1)) >= 0) { + after1 += strspn(after1, ":-.\t "); + if ((*hi = decode_one(after1, &after2)) < 0) { + *hi = *lo; + } + result = 1; + } + return result; +} + +static void +do_range(const char *source) +{ + int lo, hi; + if (decode_range(source, &lo, &hi)) { + if (opt_all) { + while (lo <= hi) { + int other_rc = CharacterClass(lo); + if (!opt_quiet) + printf("U+%04X\t%s\n", lo, class_name(other_rc)); + ++lo; + } + } else if (opt_check) { + while (lo <= hi) { + int expect = expected_class(lo); + int actual = CharacterClass(lo); + if (actual != expect) + printf("U+%04X\t%s ->%s\n", lo, + class_name(expect), + class_name(actual)); + ++lo; + } + } else { + printf("\"charClass\" resource for [%d..%d]:\n", lo, hi); + report_resource(lo, hi + 1); + } + } +} +#endif /* OPT_WIDE_CHARS */ + +/* + * TODO: add option to show do_range in hex + */ +int +main(int argc, char **argv ENVP_ARG) +{ +#if OPT_WIDE_CHARS + int ch; +#endif + + (void) argc; + (void) argv; + +#if OPT_WIDE_CHARS + setlocale(LC_ALL, ""); + while ((ch = getopt(argc, argv, "acsv")) != -1) { + switch (ch) { + case 'a': + opt_all = 1; + break; + case 'c': + opt_check = 1; + break; + case 's': + opt_quiet = 1; + break; + case 'v': + opt_v = 1; + break; + default: + usage(); + } + } + init_classtab(); + + if (optind >= argc) { + do_range("0-255"); + } else { + while (optind < argc) { + do_range(argv[optind++]); + } + } + report_wide_char_class(); +#else + printf("wide-character support is not configured\n"); +#endif /* OPT_WIDE_CHARS */ + return 0; +} +#endif /* TEST_DRIVER */ diff --git a/ports/xterm/xterm-359/charclass.h b/ports/xterm/xterm-359/charclass.h new file mode 100644 index 0000000..34dca08 --- /dev/null +++ b/ports/xterm/xterm-359/charclass.h @@ -0,0 +1,23 @@ +/* $XTermId: charclass.h,v 1.8 2020/01/18 18:29:41 tom Exp $ */ + +/* $XFree86: xc/programs/xterm/charclass.h,v 1.3 2006/02/13 01:14:58 dickey Exp $ */ + +#ifndef CHARCLASS_H +#define CHARCLASS_H + +extern void init_classtab(void); +/* initialise the table. needs calling before either of the + others. */ + +extern int SetCharacterClassRange(int low, int high, int value); +extern int CharacterClass(int c); + +#if OPT_REPORT_CCLASS +extern void report_wide_char_class(void); +#endif + +#ifdef NO_LEAKS +extern void noleaks_CharacterClass(void); +#endif + +#endif diff --git a/ports/xterm/xterm-359/charclass.o b/ports/xterm/xterm-359/charclass.o new file mode 100644 index 0000000..bb081de Binary files /dev/null and b/ports/xterm/xterm-359/charclass.o differ diff --git a/ports/xterm/xterm-359/charproc.c b/ports/xterm/xterm-359/charproc.c new file mode 100644 index 0000000..e3d68c3 --- /dev/null +++ b/ports/xterm/xterm-359/charproc.c @@ -0,0 +1,13071 @@ +/* $XTermId: charproc.c,v 1.1772 2020/08/10 09:07:11 tom Exp $ */ + +/* + * Copyright 1999-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * + * Copyright 1988 X Consortium + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the X Consortium shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from the X Consortium. + * + */ +/* + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* charproc.c */ + +#include +#include + +#include +#include +#include +#include +#include +#include + +#if OPT_INPUT_METHOD + +#if defined(HAVE_LIB_XAW) +#include +#elif defined(HAVE_LIB_XAW3D) +#include +#elif defined(HAVE_LIB_XAW3DXFT) +#include +#elif defined(HAVE_LIB_NEXTAW) +#include +#elif defined(HAVE_LIB_XAWPLUS) +#include +#endif + +#endif + +#if OPT_WIDE_CHARS +#include +#include +#include +#ifdef HAVE_LANGINFO_CODESET +#include +#endif +#endif + +#if USE_DOUBLE_BUFFER +#include +#endif + +#include +#include +#include + +#if defined(HAVE_SCHED_YIELD) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef NO_LEAKS +#include +#endif + +typedef int (*BitFunc) (unsigned * /* p */ , + unsigned /* mask */ ); + +static IChar doinput(XtermWidget /* xw */ ); +static int set_character_class(char * /*s */ ); +static void FromAlternate(XtermWidget /* xw */ ); +static void ReallyReset(XtermWidget /* xw */ , + Bool /* full */ , + Bool /* saved */ ); +static void RequestResize(XtermWidget /* xw */ , + int /* rows */ , + int /* cols */ , + Bool /* text */ ); +static void SwitchBufs(XtermWidget /* xw */ , + int /* toBuf */ , + Bool /* clearFirst */ ); +static void ToAlternate(XtermWidget /* xw */ , + Bool /* clearFirst */ ); +static void ansi_modes(XtermWidget /* xw */ , + BitFunc /* func */ ); +static int bitclr(unsigned *p, unsigned mask); +static int bitcpy(unsigned *p, unsigned q, unsigned mask); +static int bitset(unsigned *p, unsigned mask); +static void dpmodes(XtermWidget /* xw */ , + BitFunc /* func */ ); +static void restoremodes(XtermWidget /* xw */ ); +static void savemodes(XtermWidget /* xw */ ); +static void window_ops(XtermWidget /* xw */ ); + +#if OPT_BLINK_CURS || OPT_BLINK_TEXT +#define SettableCursorBlink(screen) \ + (((screen)->cursor_blink != cbAlways) && \ + ((screen)->cursor_blink != cbNever)) +#define UpdateCursorBlink(xw) \ + SetCursorBlink(xw, TScreenOf(xw)->cursor_blink) +static void SetCursorBlink(XtermWidget /* xw */ , + BlinkOps /* enable */ ); +static void HandleBlinking(XtPointer /* closure */ , + XtIntervalId * /* id */ ); +static void StartBlinking(XtermWidget /* xw */ ); +static void StopBlinking(XtermWidget /* xw */ ); +#else +#define StartBlinking(xw) /* nothing */ +#define StopBlinking(xw) /* nothing */ +#endif + +#ifndef NO_ACTIVE_ICON +static Boolean discount_frame_extents(XtermWidget /* xw */ , + int * /* height */ , + int * /* width */ ); +#else +#define discount_frame_extents(xw, height, width) False +#endif + +#if OPT_INPUT_METHOD +static void PreeditPosition(XtermWidget /* xw */ ); +#endif + +#define DEFAULT -1 +#define BELLSUPPRESSMSEC 200 + +static ANSI reply; +static PARAMS parms; + +#define nparam parms.count + +#define InitParams() init_params() +#define GetParam(n) parms.params[(n)] +#define SetParam(n,v) parms.params[(n)] = v +#define ParamPair(n) nparam - (n), parms.params + (n) + +static jmp_buf vtjmpbuf; + +/* event handlers */ +static void HandleBell PROTO_XT_ACTIONS_ARGS; +static void HandleIgnore PROTO_XT_ACTIONS_ARGS; +static void HandleKeymapChange PROTO_XT_ACTIONS_ARGS; +static void HandleVisualBell PROTO_XT_ACTIONS_ARGS; +#if HANDLE_STRUCT_NOTIFY +static void HandleStructNotify PROTO_XT_EV_HANDLER_ARGS; +#endif + +/* + * NOTE: VTInitialize zeros out the entire ".screen" component of the + * XtermWidget, so make sure to add an assignment statement in VTInitialize() + * for each new ".screen" field added to this resource list. + */ + +/* Defaults */ +#if OPT_ISO_COLORS + +/* + * If we default to colorMode enabled, compile-in defaults for the ANSI colors. + */ +#if DFT_COLORMODE +#define DFT_COLOR(name) name +#else +#define DFT_COLOR(name) XtDefaultForeground +#endif +#endif + +static char _Font_Selected_[] = "yes"; /* string is arbitrary */ + +static const char *defaultTranslations; +/* *INDENT-OFF* */ +static XtActionsRec actionsList[] = { + { "allow-bold-fonts", HandleAllowBoldFonts }, + { "allow-send-events", HandleAllowSends }, + { "bell", HandleBell }, + { "clear-saved-lines", HandleClearSavedLines }, + { "copy-selection", HandleCopySelection }, + { "create-menu", HandleCreateMenu }, + { "delete-is-del", HandleDeleteIsDEL }, + { "dired-button", DiredButton }, + { "hard-reset", HandleHardReset }, + { "ignore", HandleIgnore }, + { "insert", HandleKeyPressed }, /* alias for insert-seven-bit */ + { "insert-eight-bit", HandleEightBitKeyPressed }, + { "insert-selection", HandleInsertSelection }, + { "insert-seven-bit", HandleKeyPressed }, + { "interpret", HandleInterpret }, + { "keymap", HandleKeymapChange }, + { "popup-menu", HandlePopupMenu }, + { "print", HandlePrintScreen }, + { "print-everything", HandlePrintEverything }, + { "print-redir", HandlePrintControlMode }, + { "quit", HandleQuit }, + { "redraw", HandleRedraw }, + { "scroll-back", HandleScrollBack }, + { "scroll-forw", HandleScrollForward }, + { "scroll-to", HandleScrollTo }, + { "secure", HandleSecure }, + { "select-cursor-end", HandleKeyboardSelectEnd }, + { "select-cursor-extend", HandleKeyboardSelectExtend }, + { "select-cursor-start", HandleKeyboardSelectStart }, + { "select-end", HandleSelectEnd }, + { "select-extend", HandleSelectExtend }, + { "select-set", HandleSelectSet }, + { "select-start", HandleSelectStart }, + { "send-signal", HandleSendSignal }, + { "set-8-bit-control", Handle8BitControl }, + { "set-allow132", HandleAllow132 }, + { "set-altscreen", HandleAltScreen }, + { "set-appcursor", HandleAppCursor }, + { "set-appkeypad", HandleAppKeypad }, + { "set-autolinefeed", HandleAutoLineFeed }, + { "set-autowrap", HandleAutoWrap }, + { "set-backarrow", HandleBackarrow }, + { "set-bellIsUrgent", HandleBellIsUrgent }, + { "set-cursesemul", HandleCursesEmul }, + { "set-jumpscroll", HandleJumpscroll }, + { "set-keep-clipboard", HandleKeepClipboard }, + { "set-keep-selection", HandleKeepSelection }, + { "set-marginbell", HandleMarginBell }, + { "set-old-function-keys", HandleOldFunctionKeys }, + { "set-pop-on-bell", HandleSetPopOnBell }, + { "set-reverse-video", HandleReverseVideo }, + { "set-reversewrap", HandleReverseWrap }, + { "set-scroll-on-key", HandleScrollKey }, + { "set-scroll-on-tty-output", HandleScrollTtyOutput }, + { "set-scrollbar", HandleScrollbar }, + { "set-select", HandleSetSelect }, + { "set-sun-keyboard", HandleSunKeyboard }, + { "set-titeInhibit", HandleTiteInhibit }, + { "set-visual-bell", HandleSetVisualBell }, + { "set-vt-font", HandleSetFont }, + { "soft-reset", HandleSoftReset }, + { "start-cursor-extend", HandleKeyboardStartExtend }, + { "start-extend", HandleStartExtend }, + { "string", HandleStringEvent }, + { "vi-button", ViButton }, + { "visual-bell", HandleVisualBell }, +#ifdef ALLOWLOGGING + { "set-logging", HandleLogging }, +#endif +#if OPT_ALLOW_XXX_OPS + { "allow-color-ops", HandleAllowColorOps }, + { "allow-font-ops", HandleAllowFontOps }, + { "allow-mouse-ops", HandleAllowMouseOps }, + { "allow-tcap-ops", HandleAllowTcapOps }, + { "allow-title-ops", HandleAllowTitleOps }, + { "allow-window-ops", HandleAllowWindowOps }, +#endif +#if OPT_BLINK_CURS + { "set-cursorblink", HandleCursorBlink }, +#endif +#if OPT_BOX_CHARS + { "set-font-linedrawing", HandleFontBoxChars }, + { "set-font-packed", HandleFontPacked }, +#endif +#if OPT_DABBREV + { "dabbrev-expand", HandleDabbrevExpand }, +#endif +#if OPT_DEC_CHRSET + { "set-font-doublesize", HandleFontDoublesize }, +#endif +#if OPT_DEC_SOFTFONT + { "set-font-loading", HandleFontLoading }, +#endif +#if OPT_SCREEN_DUMPS + { "dump-html", HandleDumpHtml }, + { "dump-svg", HandleDumpSvg }, +#endif +#if OPT_EXEC_XTERM + { "spawn-new-terminal", HandleSpawnTerminal }, +#endif +#if OPT_HP_FUNC_KEYS + { "set-hp-function-keys", HandleHpFunctionKeys }, +#endif +#if OPT_LOAD_VTFONTS + { "load-vt-fonts", HandleLoadVTFonts }, +#endif +#if OPT_MAXIMIZE + { "deiconify", HandleDeIconify }, + { "fullscreen", HandleFullscreen }, + { "iconify", HandleIconify }, + { "maximize", HandleMaximize }, + { "restore", HandleRestoreSize }, +#endif +#if OPT_NUM_LOCK + { "alt-sends-escape", HandleAltEsc }, + { "meta-sends-escape", HandleMetaEsc }, + { "set-num-lock", HandleNumLock }, +#endif +#ifdef OPT_PRINT_ON_EXIT + { "print-immediate", HandlePrintImmediate }, + { "print-on-error", HandlePrintOnError }, +#endif +#if OPT_READLINE + { "readline-button", ReadLineButton }, +#endif +#if OPT_RENDERFONT + { "set-render-font", HandleRenderFont }, +#endif +#if OPT_SCO_FUNC_KEYS + { "set-sco-function-keys", HandleScoFunctionKeys }, +#endif +#if OPT_SCROLL_LOCK + { "scroll-lock", HandleScrollLock }, +#endif +#if OPT_SELECTION_OPS + { "exec-formatted", HandleExecFormatted }, + { "exec-selectable", HandleExecSelectable }, + { "insert-formatted", HandleInsertFormatted }, + { "insert-selectable", HandleInsertSelectable }, +#endif +#if OPT_SHIFT_FONTS + { "larger-vt-font", HandleLargerFont }, + { "smaller-vt-font", HandleSmallerFont }, +#endif +#if OPT_SIXEL_GRAPHICS + { "set-sixel-scrolling", HandleSixelScrolling }, +#endif +#if OPT_GRAPHICS + { "set-private-colors", HandleSetPrivateColorRegisters }, +#endif +#if OPT_SUN_FUNC_KEYS + { "set-sun-function-keys", HandleSunFunctionKeys }, +#endif +#if OPT_TEK4014 + { "set-terminal-type", HandleSetTerminalType }, + { "set-visibility", HandleVisibility }, + { "set-tek-text", HandleSetTekText }, + { "tek-page", HandleTekPage }, + { "tek-reset", HandleTekReset }, + { "tek-copy", HandleTekCopy }, +#endif +#if OPT_TOOLBAR + { "set-toolbar", HandleToolbar }, +#endif +#if OPT_WIDE_CHARS + { "set-utf8-mode", HandleUTF8Mode }, + { "set-utf8-fonts", HandleUTF8Fonts }, + { "set-utf8-title", HandleUTF8Title }, +#endif +}; +/* *INDENT-ON* */ + +#define SPS screen.printer_state + +static XtResource xterm_resources[] = +{ + Bres(XtNallowPasteControls, XtCAllowPasteControls, + screen.allowPasteControl0, False), + Bres(XtNallowSendEvents, XtCAllowSendEvents, screen.allowSendEvent0, False), + Bres(XtNallowColorOps, XtCAllowColorOps, screen.allowColorOp0, DEF_ALLOW_COLOR), + Bres(XtNallowFontOps, XtCAllowFontOps, screen.allowFontOp0, DEF_ALLOW_FONT), + Bres(XtNallowMouseOps, XtCAllowMouseOps, screen.allowMouseOp0, DEF_ALLOW_MOUSE), + Bres(XtNallowTcapOps, XtCAllowTcapOps, screen.allowTcapOp0, DEF_ALLOW_TCAP), + Bres(XtNallowTitleOps, XtCAllowTitleOps, screen.allowTitleOp0, DEF_ALLOW_TITLE), + Bres(XtNallowWindowOps, XtCAllowWindowOps, screen.allowWindowOp0, DEF_ALLOW_WINDOW), + Bres(XtNaltIsNotMeta, XtCAltIsNotMeta, screen.alt_is_not_meta, False), + Bres(XtNaltSendsEscape, XtCAltSendsEscape, screen.alt_sends_esc, DEF_ALT_SENDS_ESC), + Bres(XtNallowBoldFonts, XtCAllowBoldFonts, screen.allowBoldFonts, True), + Bres(XtNalwaysBoldMode, XtCAlwaysBoldMode, screen.always_bold_mode, False), + Bres(XtNalwaysHighlight, XtCAlwaysHighlight, screen.always_highlight, False), + Bres(XtNappcursorDefault, XtCAppcursorDefault, misc.appcursorDefault, False), + Bres(XtNappkeypadDefault, XtCAppkeypadDefault, misc.appkeypadDefault, False), + Bres(XtNalternateScroll, XtCScrollCond, screen.alternateScroll, False), + Bres(XtNautoWrap, XtCAutoWrap, misc.autoWrap, True), + Bres(XtNawaitInput, XtCAwaitInput, screen.awaitInput, False), + Bres(XtNfreeBoldBox, XtCFreeBoldBox, screen.free_bold_box, False), + Bres(XtNbackarrowKey, XtCBackarrowKey, screen.backarrow_key, DEF_BACKARO_BS), + Bres(XtNbellIsUrgent, XtCBellIsUrgent, screen.bellIsUrgent, False), + Bres(XtNbellOnReset, XtCBellOnReset, screen.bellOnReset, True), + Bres(XtNboldMode, XtCBoldMode, screen.bold_mode, True), + Bres(XtNbrokenSelections, XtCBrokenSelections, screen.brokenSelections, False), + Bres(XtNc132, XtCC132, screen.c132, False), + Bres(XtNcdXtraScroll, XtCCdXtraScroll, misc.cdXtraScroll, False), + Bres(XtNcolorInnerBorder, XtCColorInnerBorder, misc.color_inner_border, False), + Bres(XtNcurses, XtCCurses, screen.curses, False), + Bres(XtNcutNewline, XtCCutNewline, screen.cutNewline, True), + Bres(XtNcutToBeginningOfLine, XtCCutToBeginningOfLine, + screen.cutToBeginningOfLine, True), + Bres(XtNdeleteIsDEL, XtCDeleteIsDEL, screen.delete_is_del, DEFDELETE_DEL), + Bres(XtNdynamicColors, XtCDynamicColors, misc.dynamicColors, True), + Bres(XtNeightBitControl, XtCEightBitControl, screen.control_eight_bits, False), + Bres(XtNeightBitInput, XtCEightBitInput, screen.input_eight_bits, True), + Bres(XtNeightBitOutput, XtCEightBitOutput, screen.output_eight_bits, True), + Bres(XtNeraseSavedLines, XtCEraseSavedLines, screen.eraseSavedLines0, True), + Bres(XtNhighlightSelection, XtCHighlightSelection, + screen.highlight_selection, False), + Bres(XtNshowWrapMarks, XtCShowWrapMarks, screen.show_wrap_marks, False), + Bres(XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, screen.hp_ll_bc, False), + Bres(XtNi18nSelections, XtCI18nSelections, screen.i18nSelections, True), + Bres(XtNfastScroll, XtCFastScroll, screen.fastscroll, False), + Bres(XtNjumpScroll, XtCJumpScroll, screen.jumpscroll, True), + Bres(XtNkeepClipboard, XtCKeepClipboard, screen.keepClipboard, False), + Bres(XtNkeepSelection, XtCKeepSelection, screen.keepSelection, True), + Bres(XtNloginShell, XtCLoginShell, misc.login_shell, False), + Bres(XtNmarginBell, XtCMarginBell, screen.marginbell, False), + Bres(XtNmetaSendsEscape, XtCMetaSendsEscape, screen.meta_sends_esc, DEF_META_SENDS_ESC), + Bres(XtNmultiScroll, XtCMultiScroll, screen.multiscroll, False), + Bres(XtNoldXtermFKeys, XtCOldXtermFKeys, screen.old_fkeys, False), + Bres(XtNpopOnBell, XtCPopOnBell, screen.poponbell, False), + Bres(XtNprinterAutoClose, XtCPrinterAutoClose, SPS.printer_autoclose, False), + Bres(XtNprinterExtent, XtCPrinterExtent, SPS.printer_extent, False), + Bres(XtNprinterFormFeed, XtCPrinterFormFeed, SPS.printer_formfeed, False), + Bres(XtNprinterNewLine, XtCPrinterNewLine, SPS.printer_newline, True), + Bres(XtNquietGrab, XtCQuietGrab, screen.quiet_grab, False), + Bres(XtNreverseVideo, XtCReverseVideo, misc.re_verse, False), + Bres(XtNreverseWrap, XtCReverseWrap, misc.reverseWrap, False), + Bres(XtNscrollBar, XtCScrollBar, misc.scrollbar, False), + Bres(XtNscrollKey, XtCScrollCond, screen.scrollkey, False), + Bres(XtNscrollTtyOutput, XtCScrollCond, screen.scrollttyoutput, True), + Bres(XtNselectToClipboard, XtCSelectToClipboard, + screen.selectToClipboard, False), + Bres(XtNsignalInhibit, XtCSignalInhibit, misc.signalInhibit, False), + Bres(XtNtiteInhibit, XtCTiteInhibit, misc.titeInhibit, False), + Bres(XtNtiXtraScroll, XtCTiXtraScroll, misc.tiXtraScroll, False), + Bres(XtNtrimSelection, XtCTrimSelection, screen.trim_selection, False), + Bres(XtNunderLine, XtCUnderLine, screen.underline, True), + Bres(XtNvisualBell, XtCVisualBell, screen.visualbell, False), + Bres(XtNvisualBellLine, XtCVisualBellLine, screen.flash_line, False), + + Dres(XtNscaleHeight, XtCScaleHeight, screen.scale_height, "1.0"), + + Ires(XtNbellSuppressTime, XtCBellSuppressTime, screen.bellSuppressTime, BELLSUPPRESSMSEC), + Ires(XtNfontWarnings, XtCFontWarnings, misc.fontWarnings, fwResource), + Ires(XtNinternalBorder, XtCBorderWidth, screen.border, DEFBORDER), + Ires(XtNlimitResize, XtCLimitResize, misc.limit_resize, 1), + Ires(XtNlimitResponse, XtCLimitResponse, screen.unparse_max, DEF_LIMIT_RESPONSE), + Ires(XtNmultiClickTime, XtCMultiClickTime, screen.multiClickTime, MULTICLICKTIME), + Ires(XtNnMarginBell, XtCColumn, screen.nmarginbell, N_MARGINBELL), + Ires(XtNpointerMode, XtCPointerMode, screen.pointer_mode, DEF_POINTER_MODE), + Ires(XtNprinterControlMode, XtCPrinterControlMode, + SPS.printer_controlmode, 0), + Ires(XtNtitleModes, XtCTitleModes, screen.title_modes, DEF_TITLE_MODES), + Ires(XtNnextEventDelay, XtCNextEventDelay, screen.nextEventDelay, 1), + Ires(XtNvisualBellDelay, XtCVisualBellDelay, screen.visualBellDelay, 100), + Ires(XtNsaveLines, XtCSaveLines, screen.savelines, DEF_SAVE_LINES), + Ires(XtNscrollBarBorder, XtCScrollBarBorder, screen.scrollBarBorder, 1), + Ires(XtNscrollLines, XtCScrollLines, screen.scrolllines, DEF_SCROLL_LINES), + + Sres(XtNinitialFont, XtCInitialFont, screen.initial_font, NULL), + Sres(XtNfont1, XtCFont1, screen.MenuFontName(fontMenu_font1), NULL), + Sres(XtNfont2, XtCFont2, screen.MenuFontName(fontMenu_font2), NULL), + Sres(XtNfont3, XtCFont3, screen.MenuFontName(fontMenu_font3), NULL), + Sres(XtNfont4, XtCFont4, screen.MenuFontName(fontMenu_font4), NULL), + Sres(XtNfont5, XtCFont5, screen.MenuFontName(fontMenu_font5), NULL), + Sres(XtNfont6, XtCFont6, screen.MenuFontName(fontMenu_font6), NULL), + + Sres(XtNanswerbackString, XtCAnswerbackString, screen.answer_back, ""), + Sres(XtNboldFont, XtCBoldFont, misc.default_font.f_b, DEFBOLDFONT), + Sres(XtNcharClass, XtCCharClass, screen.charClass, NULL), + Sres(XtNdecTerminalID, XtCDecTerminalID, screen.term_id, DFT_DECID), + Sres(XtNdefaultString, XtCDefaultString, screen.default_string, "#"), + Sres(XtNdisallowedColorOps, XtCDisallowedColorOps, + screen.disallowedColorOps, DEF_DISALLOWED_COLOR), + Sres(XtNdisallowedFontOps, XtCDisallowedFontOps, + screen.disallowedFontOps, DEF_DISALLOWED_FONT), + Sres(XtNdisallowedMouseOps, XtCDisallowedMouseOps, + screen.disallowedMouseOps, DEF_DISALLOWED_MOUSE), + Sres(XtNdisallowedPasteControls, XtCDisallowedPasteControls, + screen.disallowedPasteControls, DEF_DISALLOWED_PASTE_CONTROLS), + Sres(XtNdisallowedTcapOps, XtCDisallowedTcapOps, + screen.disallowedTcapOps, DEF_DISALLOWED_TCAP), + Sres(XtNdisallowedWindowOps, XtCDisallowedWindowOps, + screen.disallowedWinOps, DEF_DISALLOWED_WINDOW), + Sres(XtNeightBitMeta, XtCEightBitMeta, screen.eight_bit_meta_s, DEF_8BIT_META), + Sres(XtNeightBitSelectTypes, XtCEightBitSelectTypes, + screen.eightbit_select_types, NULL), + Sres(XtNfont, XtCFont, misc.default_font.f_n, DEFFONT), + Sres(XtNgeometry, XtCGeometry, misc.geo_metry, NULL), + Sres(XtNkeyboardDialect, XtCKeyboardDialect, screen.keyboard_dialect, DFT_KBD_DIALECT), + Sres(XtNprinterCommand, XtCPrinterCommand, SPS.printer_command, ""), + Sres(XtNtekGeometry, XtCGeometry, misc.T_geometry, NULL), + + Tres(XtNcursorColor, XtCCursorColor, TEXT_CURSOR, XtDefaultForeground), + Tres(XtNforeground, XtCForeground, TEXT_FG, XtDefaultForeground), + Tres(XtNpointerColor, XtCPointerColor, MOUSE_FG, XtDefaultForeground), + Tres(XtNbackground, XtCBackground, TEXT_BG, XtDefaultBackground), + Tres(XtNpointerColorBackground, XtCBackground, MOUSE_BG, XtDefaultBackground), + + {XtNresizeGravity, XtCResizeGravity, XtRGravity, sizeof(XtGravity), + XtOffsetOf(XtermWidgetRec, misc.resizeGravity), + XtRImmediate, (XtPointer) SouthWestGravity}, + + {XtNpointerShape, XtCCursor, XtRCursor, sizeof(Cursor), + XtOffsetOf(XtermWidgetRec, screen.pointer_cursor), + XtRString, (XtPointer) "xterm"}, + +#ifdef ALLOWLOGGING + Bres(XtNlogInhibit, XtCLogInhibit, misc.logInhibit, False), + Bres(XtNlogging, XtCLogging, misc.log_on, False), + Sres(XtNlogFile, XtCLogfile, screen.logfile, NULL), +#endif + +#ifndef NO_ACTIVE_ICON + Sres("activeIcon", "ActiveIcon", misc.active_icon_s, "default"), + Ires("iconBorderWidth", XtCBorderWidth, misc.icon_border_width, 2), + Sres("iconFont", "IconFont", screen.icon_fontname, "nil2"), + Cres("iconBorderColor", XtCBorderColor, misc.icon_border_pixel, XtDefaultBackground), +#endif /* NO_ACTIVE_ICON */ + +#if OPT_BLINK_CURS + Bres(XtNcursorBlinkXOR, XtCCursorBlinkXOR, screen.cursor_blink_xor, True), + Sres(XtNcursorBlink, XtCCursorBlink, screen.cursor_blink_s, "false"), +#endif + Bres(XtNcursorUnderLine, XtCCursorUnderLine, screen.cursor_underline, False), + +#if OPT_BLINK_TEXT + Bres(XtNshowBlinkAsBold, XtCCursorBlink, screen.blink_as_bold, DEFBLINKASBOLD), +#endif + +#if OPT_BLINK_CURS || OPT_BLINK_TEXT + Ires(XtNcursorOnTime, XtCCursorOnTime, screen.blink_on, 600), + Ires(XtNcursorOffTime, XtCCursorOffTime, screen.blink_off, 300), +#endif + +#if OPT_BOX_CHARS + Bres(XtNforceBoxChars, XtCForceBoxChars, screen.force_box_chars, False), + Bres(XtNforcePackedFont, XtCForcePackedFont, screen.force_packed, True), + Bres(XtNshowMissingGlyphs, XtCShowMissingGlyphs, screen.force_all_chars, False), + Bres(XtNassumeAllChars, XtCAssumeAllChars, screen.assume_all_chars, True), +#endif + +#if OPT_BROKEN_OSC + Bres(XtNbrokenLinuxOSC, XtCBrokenLinuxOSC, screen.brokenLinuxOSC, True), +#endif + +#if OPT_BROKEN_ST + Bres(XtNbrokenStringTerm, XtCBrokenStringTerm, screen.brokenStringTerm, False), +#endif + +#if OPT_C1_PRINT + Bres(XtNallowC1Printable, XtCAllowC1Printable, screen.c1_printable, False), +#endif + +#if OPT_CLIP_BOLD + Bres(XtNuseClipping, XtCUseClipping, screen.use_clipping, True), + Bres(XtNuseBorderClipping, XtCUseBorderClipping, + screen.use_border_clipping, False), +#endif + +#if OPT_DEC_CHRSET + Bres(XtNfontDoublesize, XtCFontDoublesize, screen.font_doublesize, True), + Ires(XtNcacheDoublesize, XtCCacheDoublesize, screen.cache_doublesize, NUM_CHRSET), +#endif + +#if OPT_DEC_RECTOPS + Ires(XtNchecksumExtension, XtCChecksumExtension, screen.checksum_ext0, csDEC), +#endif + +#if OPT_HIGHLIGHT_COLOR + Tres(XtNhighlightColor, XtCHighlightColor, HIGHLIGHT_BG, XtDefaultForeground), + Tres(XtNhighlightTextColor, XtCHighlightTextColor, HIGHLIGHT_FG, XtDefaultBackground), + Bres(XtNhighlightReverse, XtCHighlightReverse, screen.hilite_reverse, True), + Bres(XtNhighlightColorMode, XtCHighlightColorMode, screen.hilite_color, Maybe), +#endif /* OPT_HIGHLIGHT_COLOR */ + +#if OPT_INPUT_METHOD + Bres(XtNopenIm, XtCOpenIm, misc.open_im, True), + Sres(XtNinputMethod, XtCInputMethod, misc.input_method, NULL), + Sres(XtNpreeditType, XtCPreeditType, misc.preedit_type, + "OverTheSpot,Root"), + Ires(XtNretryInputMethod, XtCRetryInputMethod, misc.retry_im, 3), +#endif + +#if OPT_ISO_COLORS + Bres(XtNboldColors, XtCColorMode, screen.boldColors, True), + Ires(XtNveryBoldColors, XtCVeryBoldColors, screen.veryBoldColors, 0), + Bres(XtNcolorMode, XtCColorMode, screen.colorMode, DFT_COLORMODE), + + Bres(XtNcolorAttrMode, XtCColorAttrMode, screen.colorAttrMode, False), + Bres(XtNcolorBDMode, XtCColorAttrMode, screen.colorBDMode, False), + Bres(XtNcolorBLMode, XtCColorAttrMode, screen.colorBLMode, False), + Bres(XtNcolorRVMode, XtCColorAttrMode, screen.colorRVMode, False), + Bres(XtNcolorULMode, XtCColorAttrMode, screen.colorULMode, False), + Bres(XtNitalicULMode, XtCColorAttrMode, screen.italicULMode, False), +#if OPT_WIDE_ATTRS + Bres(XtNcolorITMode, XtCColorAttrMode, screen.colorITMode, False), +#endif +#if OPT_DIRECT_COLOR + Bres(XtNdirectColor, XtCDirectColor, screen.direct_color, True), +#endif + + COLOR_RES("0", screen.Acolors[COLOR_0], DFT_COLOR("black")), + COLOR_RES("1", screen.Acolors[COLOR_1], DFT_COLOR("red3")), + COLOR_RES("2", screen.Acolors[COLOR_2], DFT_COLOR("green3")), + COLOR_RES("3", screen.Acolors[COLOR_3], DFT_COLOR("yellow3")), + COLOR_RES("4", screen.Acolors[COLOR_4], DFT_COLOR(DEF_COLOR4)), + COLOR_RES("5", screen.Acolors[COLOR_5], DFT_COLOR("magenta3")), + COLOR_RES("6", screen.Acolors[COLOR_6], DFT_COLOR("cyan3")), + COLOR_RES("7", screen.Acolors[COLOR_7], DFT_COLOR("gray90")), + COLOR_RES("8", screen.Acolors[COLOR_8], DFT_COLOR("gray50")), + COLOR_RES("9", screen.Acolors[COLOR_9], DFT_COLOR("red")), + COLOR_RES("10", screen.Acolors[COLOR_10], DFT_COLOR("green")), + COLOR_RES("11", screen.Acolors[COLOR_11], DFT_COLOR("yellow")), + COLOR_RES("12", screen.Acolors[COLOR_12], DFT_COLOR(DEF_COLOR12)), + COLOR_RES("13", screen.Acolors[COLOR_13], DFT_COLOR("magenta")), + COLOR_RES("14", screen.Acolors[COLOR_14], DFT_COLOR("cyan")), + COLOR_RES("15", screen.Acolors[COLOR_15], DFT_COLOR("white")), + COLOR_RES("BD", screen.Acolors[COLOR_BD], DFT_COLOR(XtDefaultForeground)), + COLOR_RES("BL", screen.Acolors[COLOR_BL], DFT_COLOR(XtDefaultForeground)), + COLOR_RES("UL", screen.Acolors[COLOR_UL], DFT_COLOR(XtDefaultForeground)), + COLOR_RES("RV", screen.Acolors[COLOR_RV], DFT_COLOR(XtDefaultForeground)), + +#if OPT_WIDE_ATTRS + COLOR_RES("IT", screen.Acolors[COLOR_IT], DFT_COLOR(XtDefaultForeground)), +#endif + +#if !OPT_COLOR_RES2 +#if OPT_256_COLORS +# include <256colres.h> +#elif OPT_88_COLORS +# include <88colres.h> +#endif +#endif /* !OPT_COLOR_RES2 */ + +#endif /* OPT_ISO_COLORS */ + + CLICK_RES("2", screen.onClick[1], "word"), + CLICK_RES("3", screen.onClick[2], "line"), + CLICK_RES("4", screen.onClick[3], 0), + CLICK_RES("5", screen.onClick[4], 0), + +#if OPT_MOD_FKEYS + Ires(XtNmodifyKeyboard, XtCModifyKeyboard, + keyboard.modify_1st.allow_keys, 0), + Ires(XtNmodifyCursorKeys, XtCModifyCursorKeys, + keyboard.modify_1st.cursor_keys, 2), + Ires(XtNmodifyFunctionKeys, XtCModifyFunctionKeys, + keyboard.modify_1st.function_keys, 2), + Ires(XtNmodifyKeypadKeys, XtCModifyKeypadKeys, + keyboard.modify_1st.keypad_keys, 0), + Ires(XtNmodifyOtherKeys, XtCModifyOtherKeys, + keyboard.modify_1st.other_keys, 0), + Ires(XtNmodifyStringKeys, XtCModifyStringKeys, + keyboard.modify_1st.string_keys, 0), + Ires(XtNformatOtherKeys, XtCFormatOtherKeys, + keyboard.format_keys, 0), +#endif + +#if OPT_NUM_LOCK + Bres(XtNalwaysUseMods, XtCAlwaysUseMods, misc.alwaysUseMods, False), + Bres(XtNnumLock, XtCNumLock, misc.real_NumLock, True), +#endif + +#if OPT_PRINT_COLORS + Ires(XtNprintAttributes, XtCPrintAttributes, SPS.print_attributes, 1), +#endif + +#if OPT_REGIS_GRAPHICS + Sres(XtNregisDefaultFont, XtCRegisDefaultFont, + screen.graphics_regis_default_font, ""), + Sres(XtNregisScreenSize, XtCRegisScreenSize, + screen.graphics_regis_screensize, "auto"), +#endif + +#if OPT_GRAPHICS + Sres(XtNdecGraphicsID, XtCDecGraphicsID, screen.graph_id, DFT_DECID), + Sres(XtNmaxGraphicSize, XtCMaxGraphicSize, screen.graphics_max_size, + "1000x1000"), +#endif + +#if OPT_SHIFT_FONTS + Bres(XtNshiftFonts, XtCShiftFonts, misc.shift_fonts, True), +#endif + +#if OPT_SIXEL_GRAPHICS + Bres(XtNsixelScrolling, XtCSixelScrolling, screen.sixel_scrolling, True), + Bres(XtNsixelScrollsRight, XtCSixelScrollsRight, + screen.sixel_scrolls_right, False), +#endif + +#if OPT_GRAPHICS + Ires(XtNnumColorRegisters, XtCNumColorRegisters, + screen.numcolorregisters, 0), + Bres(XtNprivateColorRegisters, XtCPrivateColorRegisters, + screen.privatecolorregisters, True), +#endif + +#if OPT_SUNPC_KBD + Ires(XtNctrlFKeys, XtCCtrlFKeys, misc.ctrl_fkeys, 10), +#endif + +#if OPT_TEK4014 + Bres(XtNtekInhibit, XtCTekInhibit, misc.tekInhibit, False), + Bres(XtNtekSmall, XtCTekSmall, misc.tekSmall, False), + Bres(XtNtekStartup, XtCTekStartup, misc.TekEmu, False), +#endif + +#if OPT_TOOLBAR + Wres(XtNmenuBar, XtCMenuBar, VT100_TB_INFO(menu_bar), 0), + Ires(XtNmenuHeight, XtCMenuHeight, VT100_TB_INFO(menu_height), 25), +#endif + +#if OPT_WIDE_CHARS + Bres(XtNcjkWidth, XtCCjkWidth, misc.cjk_width, False), + Bres(XtNmkWidth, XtCMkWidth, misc.mk_width, False), + Bres(XtNprecompose, XtCPrecompose, screen.normalized_c, True), + Bres(XtNutf8Latin1, XtCUtf8Latin1, screen.utf8_latin1, False), + Bres(XtNutf8Weblike, XtCUtf8Weblike, screen.utf8_weblike, False), + Bres(XtNvt100Graphics, XtCVT100Graphics, screen.vt100_graphics, True), + Bres(XtNwideChars, XtCWideChars, screen.wide_chars, False), + Ires(XtNcombiningChars, XtCCombiningChars, screen.max_combining, 2), + Ires(XtNmkSamplePass, XtCMkSamplePass, misc.mk_samplepass, 655), + Ires(XtNmkSampleSize, XtCMkSampleSize, misc.mk_samplesize, 65536), + Sres(XtNutf8, XtCUtf8, screen.utf8_mode_s, "default"), + Sres(XtNutf8Fonts, XtCUtf8Fonts, screen.utf8_fonts_s, "default"), + Sres(XtNutf8Title, XtCUtf8Title, screen.utf8_title_s, "default"), + Sres(XtNwideBoldFont, XtCWideBoldFont, misc.default_font.f_wb, DEFWIDEBOLDFONT), + Sres(XtNwideFont, XtCWideFont, misc.default_font.f_w, DEFWIDEFONT), + Sres(XtNutf8SelectTypes, XtCUtf8SelectTypes, screen.utf8_select_types, NULL), +#endif + +#if OPT_LUIT_PROG + Sres(XtNlocale, XtCLocale, misc.locale_str, "medium"), + Sres(XtNlocaleFilter, XtCLocaleFilter, misc.localefilter, DEFLOCALEFILTER), +#endif + +#if OPT_INPUT_METHOD + Sres(XtNximFont, XtCXimFont, misc.f_x, DEFXIMFONT), +#endif + +#if OPT_SCROLL_LOCK + Bres(XtNallowScrollLock, XtCAllowScrollLock, screen.allowScrollLock0, False), +#endif + + /* these are used only for testing ncurses, not in the manual page */ +#if OPT_XMC_GLITCH + Bres(XtNxmcInline, XtCXmcInline, screen.xmc_inline, False), + Bres(XtNxmcMoveSGR, XtCXmcMoveSGR, screen.move_sgr_ok, True), + Ires(XtNxmcAttributes, XtCXmcAttributes, screen.xmc_attributes, 1), + Ires(XtNxmcGlitch, XtCXmcGlitch, screen.xmc_glitch, 0), +#endif + +#ifdef SCROLLBAR_RIGHT + Bres(XtNrightScrollBar, XtCRightScrollBar, misc.useRight, False), +#endif + +#if OPT_RENDERFONT + Bres(XtNforceXftHeight, XtCForceXftHeight, screen.force_xft_height, False), +#define RES_FACESIZE(n) Dres(XtNfaceSize #n, XtCFaceSize #n, misc.face_size[n], "0.0") + RES_FACESIZE(1), + RES_FACESIZE(2), + RES_FACESIZE(3), + RES_FACESIZE(4), + RES_FACESIZE(5), + RES_FACESIZE(6), + Dres(XtNfaceSize, XtCFaceSize, misc.face_size[0], DEFFACESIZE), + Sres(XtNfaceName, XtCFaceName, misc.default_xft.f_n, DEFFACENAME), + Sres(XtNrenderFont, XtCRenderFont, misc.render_font_s, "default"), + Ires(XtNlimitFontsets, XtCLimitFontsets, misc.limit_fontsets, DEF_XFT_CACHE), +#if OPT_RENDERWIDE + Sres(XtNfaceNameDoublesize, XtCFaceNameDoublesize, misc.default_xft.f_w, DEFFACENAME), +#endif +#endif +}; + +static Boolean VTSetValues(Widget cur, Widget request, Widget new_arg, + ArgList args, Cardinal *num_args); +static void VTClassInit(void); +static void VTDestroy(Widget w); +static void VTExpose(Widget w, XEvent *event, Region region); +static void VTInitialize(Widget wrequest, Widget new_arg, ArgList args, + Cardinal *num_args); +static void VTRealize(Widget w, XtValueMask * valuemask, + XSetWindowAttributes * values); +static void VTResize(Widget w); + +#if OPT_INPUT_METHOD +static void VTInitI18N(XtermWidget); +#endif + +#ifdef VMS +globaldef { + "xtermclassrec" +} noshare + +#else +static +#endif /* VMS */ +WidgetClassRec xtermClassRec = +{ + { + /* core_class fields */ + (WidgetClass) & widgetClassRec, /* superclass */ + "VT100", /* class_name */ + sizeof(XtermWidgetRec), /* widget_size */ + VTClassInit, /* class_initialize */ + NULL, /* class_part_initialize */ + False, /* class_inited */ + VTInitialize, /* initialize */ + NULL, /* initialize_hook */ + VTRealize, /* realize */ + actionsList, /* actions */ + XtNumber(actionsList), /* num_actions */ + xterm_resources, /* resources */ + XtNumber(xterm_resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + True, /* compress_motion */ + False, /* compress_exposure */ + True, /* compress_enterleave */ + False, /* visible_interest */ + VTDestroy, /* destroy */ + VTResize, /* resize */ + VTExpose, /* expose */ + VTSetValues, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_offsets */ + 0, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL /* extension */ + } +}; + +#ifdef VMS +globaldef { + "xtermwidgetclass" +} +noshare +#endif /* VMS */ +WidgetClass xtermWidgetClass = (WidgetClass) & xtermClassRec; + +/* + * Add input-actions for widgets that are overlooked (scrollbar and toolbar): + * + * a) Sometimes the scrollbar passes through translations, sometimes it + * doesn't. We add the KeyPress translations here, just to be sure. + * b) In the normal (non-toolbar) configuration, the xterm widget covers + * almost all of the window. With a toolbar, there's a relatively + * large area that the user would expect to enter keystrokes since the + * program can get the focus. + */ +void +xtermAddInput(Widget w) +{ + /* *INDENT-OFF* */ + XtActionsRec input_actions[] = { + { "insert", HandleKeyPressed }, /* alias */ + { "insert-eight-bit", HandleEightBitKeyPressed }, + { "insert-seven-bit", HandleKeyPressed }, + { "secure", HandleSecure }, + { "string", HandleStringEvent }, + { "scroll-back", HandleScrollBack }, + { "scroll-forw", HandleScrollForward }, + { "scroll-to", HandleScrollTo }, + { "select-cursor-end", HandleKeyboardSelectEnd }, + { "select-cursor-extend", HandleKeyboardSelectExtend }, + { "select-cursor-start", HandleKeyboardSelectStart }, + { "insert-selection", HandleInsertSelection }, + { "select-start", HandleSelectStart }, + { "select-extend", HandleSelectExtend }, + { "start-extend", HandleStartExtend }, + { "select-end", HandleSelectEnd }, + { "clear-saved-lines", HandleClearSavedLines }, + { "popup-menu", HandlePopupMenu }, + { "bell", HandleBell }, + { "ignore", HandleIgnore }, +#if OPT_DABBREV + { "dabbrev-expand", HandleDabbrevExpand }, +#endif +#if OPT_MAXIMIZE + { "fullscreen", HandleFullscreen }, +#endif +#if OPT_SCROLL_LOCK + { "scroll-lock", HandleScrollLock }, +#endif +#if OPT_SHIFT_FONTS + { "larger-vt-font", HandleLargerFont }, + { "smaller-vt-font", HandleSmallerFont }, +#endif + }; + /* *INDENT-ON* */ + + TRACE_TRANS("BEFORE", w); + XtAppAddActions(app_con, input_actions, XtNumber(input_actions)); + XtAugmentTranslations(w, XtParseTranslationTable(defaultTranslations)); + TRACE_TRANS("AFTER:", w); + +#if OPT_EXTRA_PASTE + if (term && term->keyboard.extra_translations) + XtOverrideTranslations((Widget) term, XtParseTranslationTable(term->keyboard.extra_translations)); +#endif +} + +#if OPT_ISO_COLORS +#ifdef EXP_BOGUS_FG +static Bool +CheckBogusForeground(TScreen *screen, const char *tag) +{ + int row = -1, col = -1, pass; + Bool isClear = True; + + (void) tag; + for (pass = 0; pass < 2; ++pass) { + row = screen->cur_row; + for (; isClear && (row <= screen->max_row); ++row) { + CLineData *ld = getLineData(screen, row); + + if (ld != 0) { + IAttr *attribs = ld->attribs; + + col = (row == screen->cur_row) ? screen->cur_col : 0; + for (; isClear && (col <= screen->max_col); ++col) { + unsigned flags = attribs[col]; + if (pass) { + flags &= ~FG_COLOR; + attribs[col] = (IAttr) flags; + } else if ((flags & BG_COLOR)) { + isClear = False; + } else if ((flags & FG_COLOR)) { + unsigned ch = ld->charData[col]; + isClear = ((ch == ' ') || (ch == 0)); + } else { + isClear = False; + } + } + } + } + } + TRACE(("%s checked %d,%d to %d,%d %s pass %d\n", + tag, screen->cur_row, screen->cur_col, + row, col, + isClear && pass ? "cleared" : "unchanged", + pass)); + + return isClear; +} +#endif + +/* + * The terminal's foreground and background colors are set via two mechanisms: + * text (cur_foreground, cur_background values that are passed down to + * XDrawImageString and XDrawString) + * area (X11 graphics context used in XClearArea and XFillRectangle) + */ +void +SGR_Foreground(XtermWidget xw, int color) +{ + TScreen *screen = TScreenOf(xw); + Pixel fg; + + if (color >= 0) { + UIntSet(xw->flags, FG_COLOR); + } else { + UIntClr(xw->flags, FG_COLOR); + } + fg = getXtermFG(xw, xw->flags, color); + xw->cur_foreground = color; + + setCgsFore(xw, WhichVWin(screen), gcNorm, fg); + setCgsBack(xw, WhichVWin(screen), gcNormReverse, fg); + + setCgsFore(xw, WhichVWin(screen), gcBold, fg); + setCgsBack(xw, WhichVWin(screen), gcBoldReverse, fg); + +#ifdef EXP_BOGUS_FG + /* + * If we've just turned off the foreground color, check for blank cells + * which have no background color, but do have foreground color. This + * could happen due to setting the foreground color just before scrolling. + * + * Those cells look uncolored, but will confuse ShowCursor(), which looks + * for the colors in the current cell, and will see the foreground color. + * In that case, remove the foreground color from the blank cells. + */ + if (color < 0) { + CheckBogusForeground(screen, "SGR_Foreground"); + } +#endif +} + +void +SGR_Background(XtermWidget xw, int color) +{ + TScreen *screen = TScreenOf(xw); + Pixel bg; + + /* + * An indexing operation may have set screen->scroll_amt, which would + * normally result in calling FlushScroll() in WriteText(). However, + * if we're changing the background color now, then the new value + * should not apply to the pending blank lines. + */ + if (screen->scroll_amt && (color != xw->cur_background)) + FlushScroll(xw); + + if (color >= 0) { + UIntSet(xw->flags, BG_COLOR); + } else { + UIntClr(xw->flags, BG_COLOR); + } + bg = getXtermBG(xw, xw->flags, color); + xw->cur_background = color; + + setCgsBack(xw, WhichVWin(screen), gcNorm, bg); + setCgsFore(xw, WhichVWin(screen), gcNormReverse, bg); + + setCgsBack(xw, WhichVWin(screen), gcBold, bg); + setCgsFore(xw, WhichVWin(screen), gcBoldReverse, bg); +} + +/* Invoked after updating bold/underline flags, computes the extended color + * index to use for foreground. (See also 'extract_fg()'). + */ +static void +setExtendedFG(XtermWidget xw) +{ + int fg = xw->sgr_foreground; + + if (TScreenOf(xw)->colorAttrMode + || (fg < 0)) { + fg = MapToColorMode(fg, TScreenOf(xw), xw->flags); + } + + /* This implements the IBM PC-style convention of 8-colors, with one + * bit for bold, thus mapping the 0-7 codes to 8-15. It won't make + * much sense for 16-color applications, but we keep it to retain + * compatibility with ANSI-color applications. + */ +#if OPT_PC_COLORS /* XXXJTL should be settable at runtime (resource or OSC?) */ + if (TScreenOf(xw)->boldColors + && (!xw->sgr_38_xcolors) + && (fg >= 0) + && (fg < 8) + && (xw->flags & BOLD)) + fg |= 8; +#endif + + SGR_Foreground(xw, fg); +} + +/* Invoked after updating inverse flag, computes the extended color + * index to use for background. (See also 'extract_bg()'). + */ +static void +setExtendedBG(XtermWidget xw) +{ + int bg = xw->sgr_background; + + if (TScreenOf(xw)->colorAttrMode + || (bg < 0)) { + if (TScreenOf(xw)->colorRVMode && (xw->flags & INVERSE)) + bg = COLOR_RV; + } + + SGR_Background(xw, bg); +} + +void +setExtendedColors(XtermWidget xw) +{ + setExtendedFG(xw); + setExtendedBG(xw); +} + +static void +reset_SGR_Foreground(XtermWidget xw) +{ + xw->sgr_foreground = -1; + xw->sgr_38_xcolors = False; + clrDirectFG(xw->flags); + setExtendedFG(xw); +} + +static void +reset_SGR_Background(XtermWidget xw) +{ + xw->sgr_background = -1; + clrDirectBG(xw->flags); + setExtendedBG(xw); +} + +static void +reset_SGR_Colors(XtermWidget xw) +{ + reset_SGR_Foreground(xw); + reset_SGR_Background(xw); +} +#endif /* OPT_ISO_COLORS */ + +#if OPT_WIDE_ATTRS +/* + * Call this before changing the state of ATR_ITALIC, to update the GC fonts. + */ +static void +setItalicFont(XtermWidget xw, Bool enable) +{ + if (enable) { + if ((xw->flags & ATR_ITALIC) == 0) { + xtermLoadItalics(xw); + TRACE(("setItalicFont: enabling Italics\n")); + xtermUpdateFontGCs(xw, getItalicFont); + } + } else if ((xw->flags & ATR_ITALIC) != 0) { + TRACE(("setItalicFont: disabling Italics\n")); + xtermUpdateFontGCs(xw, getNormalFont); + } +} + +static void +ResetItalics(XtermWidget xw) +{ + setItalicFont(xw, False); + UIntClr(xw->flags, ATR_ITALIC); +} + +#else +#define ResetItalics(xw) /* nothing */ +#endif + +static void +initCharset(TScreen *screen, int which, DECNRCM_codes code) +{ + screen->gsets[which] = code; +} + +void +saveCharsets(TScreen *screen, DECNRCM_codes * target) +{ + int g; + for (g = 0; g < NUM_GSETS; ++g) { + target[g] = screen->gsets[g]; + } +} + +void +restoreCharsets(TScreen *screen, DECNRCM_codes * source) +{ + int g; + for (g = 0; g < NUM_GSETS; ++g) { + screen->gsets[g] = source[g]; + } +} + +void +resetCharsets(TScreen *screen) +{ + TRACE(("resetCharsets\n")); + + initCharset(screen, 0, nrc_ASCII); + initCharset(screen, 1, nrc_ASCII); + initCharset(screen, 2, nrc_ASCII); + initCharset(screen, 3, nrc_ASCII); + + screen->curgl = 0; /* G0 => GL. */ + screen->curgr = 2; /* G2 => GR. */ + screen->curss = 0; /* No single shift. */ + +#if OPT_VT52_MODE + if (screen->vtXX_level == 0) + initCharset(screen, 1, nrc_DEC_Spec_Graphic); /* Graphics */ +#endif +} + +static void +modified_DECNRCM(XtermWidget xw) +{ +#if OPT_WIDE_CHARS + TScreen *screen = TScreenOf(xw); + if (screen->wide_chars && (screen->utf8_mode || screen->utf8_nrc_mode)) { + int enabled = ((xw->flags & NATIONAL) != 0); + int modefix; + EXCHANGE(screen->utf8_nrc_mode, screen->utf8_mode, modefix); + switchPtyData(screen, !enabled); + TRACE(("UTF8 mode temporarily %s\n", enabled ? "ON" : "OFF")); + } +#else + (void) xw; +#endif +} + +/* + * VT300 and up support three ANSI conformance levels, defined according to + * the dpANSI X3.134.1 standard. DEC's manuals equate levels 1 and 2, and + * are unclear. This code is written based on the manuals. + */ +static void +set_ansi_conformance(TScreen *screen, int level) +{ + TRACE(("set_ansi_conformance(%d) dec_level %d:%d, ansi_level %d\n", + level, + screen->vtXX_level * 100, + screen->terminal_id, + screen->ansi_level)); + if (screen->vtXX_level >= 3) { + switch (screen->ansi_level = level) { + case 1: + /* FALLTHRU */ + case 2: + initCharset(screen, 0, nrc_ASCII); /* G0 is ASCII */ + initCharset(screen, 1, nrc_ASCII); /* G1 is ISO Latin-1 */ + screen->curgl = 0; + screen->curgr = 1; + break; + case 3: + initCharset(screen, 0, nrc_ASCII); /* G0 is ASCII */ + screen->curgl = 0; + break; + } + } +} + +/* + * Set scrolling margins. VTxxx terminals require that the top/bottom are + * different, so we have at least two lines in the scrolling region. + */ +static void +set_tb_margins(TScreen *screen, int top, int bottom) +{ + TRACE(("set_tb_margins %d..%d, prior %d..%d\n", + top, bottom, + screen->top_marg, + screen->bot_marg)); + if (bottom > top) { + screen->top_marg = top; + screen->bot_marg = bottom; + } + if (screen->top_marg > screen->max_row) + screen->top_marg = screen->max_row; + if (screen->bot_marg > screen->max_row) + screen->bot_marg = screen->max_row; +} + +static void +set_lr_margins(TScreen *screen, int left, int right) +{ + TRACE(("set_lr_margins %d..%d, prior %d..%d\n", + left, right, + screen->lft_marg, + screen->rgt_marg)); + if (right > left) { + screen->lft_marg = left; + screen->rgt_marg = right; + } + if (screen->lft_marg > screen->max_col) + screen->lft_marg = screen->max_col; + if (screen->rgt_marg > screen->max_col) + screen->rgt_marg = screen->max_col; +} + +#define reset_tb_margins(screen) set_tb_margins(screen, 0, screen->max_row) +#define reset_lr_margins(screen) set_lr_margins(screen, 0, screen->max_col) + +void +resetMargins(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + UIntClr(xw->flags, LEFT_RIGHT); + reset_tb_margins(screen); + reset_lr_margins(screen); +} + +static void +resetRendition(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + (void) screen; + ResetItalics(xw); + UIntClr(xw->flags, + (SGR_MASK | SGR_MASK2 | INVISIBLE)); +} + +void +set_max_col(TScreen *screen, int cols) +{ + TRACE(("set_max_col %d, prior %d\n", cols, screen->max_col)); + if (cols < 0) + cols = 0; + screen->max_col = cols; +} + +void +set_max_row(TScreen *screen, int rows) +{ + TRACE(("set_max_row %d, prior %d\n", rows, screen->max_row)); + if (rows < 0) + rows = 0; + screen->max_row = rows; +} + +#if OPT_MOD_FKEYS +static void +set_mod_fkeys(XtermWidget xw, int which, int what, Bool enabled) +{ +#define SET_MOD_FKEYS(field) \ + xw->keyboard.modify_now.field = ((what == DEFAULT) && enabled) \ + ? xw->keyboard.modify_1st.field \ + : what; \ + TRACE(("set modify_now.%s to %d\n", #field, \ + xw->keyboard.modify_now.field)); + + switch (which) { + case 0: + SET_MOD_FKEYS(allow_keys); + break; + case 1: + SET_MOD_FKEYS(cursor_keys); + break; + case 2: + SET_MOD_FKEYS(function_keys); + break; + case 3: + SET_MOD_FKEYS(keypad_keys); + break; + case 4: + SET_MOD_FKEYS(other_keys); + break; + case 5: + SET_MOD_FKEYS(string_keys); + break; + } +} +#endif /* OPT_MOD_FKEYS */ + +#if OPT_TRACE +#define DATA(name) { name, #name } +static const struct { + Const PARSE_T *table; + const char *name; +} all_tables[] = { + + DATA(ansi_table) + ,DATA(cigtable) + ,DATA(csi2_table) + ,DATA(csi_ex_table) + ,DATA(csi_quo_table) + ,DATA(csi_table) + ,DATA(dec2_table) + ,DATA(dec3_table) + ,DATA(dec_table) + ,DATA(eigtable) + ,DATA(esc_sp_table) + ,DATA(esc_table) + ,DATA(scrtable) + ,DATA(scs96table) + ,DATA(scstable) + ,DATA(sos_table) +#if OPT_BLINK_CURS + ,DATA(csi_sp_table) +#endif +#if OPT_DEC_LOCATOR + ,DATA(csi_tick_table) +#endif +#if OPT_DEC_RECTOPS + ,DATA(csi_dollar_table) + ,DATA(csi_star_table) + ,DATA(csi_dec_dollar_table) +#endif +#if OPT_WIDE_CHARS + ,DATA(esc_pct_table) + ,DATA(scs_amp_table) + ,DATA(scs_pct_table) + ,DATA(scs_2qt_table) +#endif +#if OPT_VT52_MODE + ,DATA(vt52_table) + ,DATA(vt52_esc_table) + ,DATA(vt52_ignore_table) +#endif +#if OPT_XTERM_SGR + ,DATA(csi_hash_table) +#endif +#undef DATA +}; + +#define WHICH_TABLE(name) if (table == name) result = #name +static const char * +which_table(Const PARSE_T * table) +{ + const char *result = "?"; + Cardinal n; + for (n = 0; n < XtNumber(all_tables); ++n) { + if (table == all_tables[n].table) { + result = all_tables[n].name; + break; + } + } + + return result; +} + +static void +check_tables(void) +{ + Cardinal n; + int ch; + int total_codes = 0; + int total_ground = 0; + int total_ignored = 0; + + TRACE(("** check_tables\n")); + for (n = 0; n < XtNumber(all_tables); ++n) { + Const PARSE_T *table = all_tables[n].table; + TRACE(("*** %s\n", all_tables[n].name)); + /* + * Most of the tables should use the same codes in 0..31, 128..159 + * as the "ansi" table. + */ + if (strncmp(all_tables[n].name, "ansi", 4) && + strncmp(all_tables[n].name, "sos_", 4) && + strncmp(all_tables[n].name, "vt52", 4)) { + for (ch = 0; ch < 32; ++ch) { + int c1 = ch + 128; + PARSE_T st_l = table[ch]; + PARSE_T st_r = table[c1]; + if (st_l != ansi_table[ch]) { + TRACE((" %3d: %d vs %d\n", ch, st_l, ansi_table[ch])); + } + if (st_r != ansi_table[c1]) { + TRACE((" %3d: %d vs %d\n", c1, st_r, ansi_table[c1])); + } + } + } + /* + * All of the tables should have their GL/GR parts encoded the same. + */ + for (ch = 32; ch < 127; ++ch) { + PARSE_T st_l = table[ch]; + PARSE_T st_r = table[ch + 128]; + if (st_l != st_r) { + if (st_r == CASE_IGNORE && + !strncmp(all_tables[n].name, "vt52", 4)) { + ; + } else { + TRACE((" %3d: %d vs %d\n", ch, st_l, st_r)); + } + } + } + /* + * Just for amusement, show how sparse the encoding tables are. + */ + for (ch = 0; ch < 256; ++ch) { + ++total_codes; + switch (table[ch]) { + case CASE_GROUND_STATE: + total_ground++; + break; + case CASE_ESC_IGNORE: + /* FALLTHRU */ + case CASE_IGNORE: + /* FALLTHRU */ + case CASE_VT52_IGNORE: + total_ignored++; + break; + } + } + } + TRACE(("VTPrsTbl:\n")); + TRACE(("%d total codes\n", total_codes)); + TRACE(("%d total ignored\n", total_ignored)); + TRACE(("%d total reset/ground\n", total_ground)); +} + +static void +check_bitmasks(void) +{ +#define dMSK 0x100 +#define DATA(mode,name) { mode, name, #name } +#define DMSK(what) (dMSK | (what)) +#define DGRP(offs) (1 << ((offs) - 1)) + static struct { + int mode; + int code; + Const char *name; + } table[] = { + DATA(DGRP(1), INVERSE), + DATA(DGRP(1), UNDERLINE), + DATA(DGRP(1), BOLD), + DATA(DGRP(1), BLINK), + DATA(DMSK(DGRP(1)), SGR_MASK), + DATA(DGRP(2), BG_COLOR), + DATA(DGRP(2), FG_COLOR), + DATA(DGRP(2), PROTECTED), + DATA(DGRP(4), CHARDRAWN), +#if OPT_WIDE_ATTRS + DATA(DGRP(2), ATR_FAINT), + DATA(DGRP(2), ATR_ITALIC), + DATA(DGRP(2), ATR_STRIKEOUT), + DATA(DGRP(2), ATR_DBL_UNDER), + DATA(DGRP(2), ATR_DIRECT_FG), + DATA(DGRP(2), ATR_DIRECT_BG), +#endif + DATA(DMSK(DGRP(2)), SGR_MASK2), + DATA(DGRP(3), WRAPAROUND), + DATA(DGRP(3), REVERSEWRAP), + DATA(DGRP(3), REVERSE_VIDEO), + DATA(DGRP(3), LINEFEED), + DATA(DGRP(3), ORIGIN), + DATA(DGRP(3), INSERT), + DATA(DGRP(3), SMOOTHSCROLL), + DATA(DGRP(3), IN132COLUMNS), + DATA(DGRP(3), INVISIBLE), + DATA(DMSK(DGRP(3)), ATTRIBUTES), + DATA(DGRP(5), NATIONAL), + DATA(DGRP(5), LEFT_RIGHT), + DATA(DGRP(5), NOCLEAR_COLM), + DATA(DGRP(4), NOBACKGROUND), + DATA(DGRP(4), NOTRANSLATION), + DATA(DGRP(4), DOUBLEWFONT), + DATA(DGRP(4), DOUBLEHFONT), + DATA(DGRP(4), CHARBYCHAR), + DATA(DGRP(4), NORESOLUTION), + DATA(DMSK(DGRP(1) | DGRP(2) | DGRP(4)), DRAWX_MASK), + DATA(-1, EOF) + }; +#undef DATA + int j, k; + TRACE(("** check_bitmasks:\n")); + for (j = 0; table[j].mode >= 0; ++j) { + TRACE(("%4X %8X %s\n", table[j].mode, table[j].code, table[j].name)); + if (table[j].mode & dMSK) { + int mask = dMSK; + for (k = 0; table[k].mode >= 0; ++k) { + if (j == k) + continue; + if (table[k].mode & dMSK) + continue; + if ((table[j].mode & table[k].mode) != 0) + mask |= table[k].mode; + } + if (mask != table[j].mode) { + TRACE(("...expected %08X\n", mask)); + } + } else { + for (k = 0; table[k].mode >= 0; ++k) { + if (j == k) + continue; + if (table[k].mode & dMSK) + continue; + if ((table[j].code & table[k].code) != 0) { + TRACE(("...same bits %s\n", table[k].name)); + } + } + } + } +} +#endif + +static int +init_params(void) +{ + while (parms.count-- > 0) { + parms.is_sub[parms.count] = 0; + parms.params[parms.count] = 0; + } + parms.count = 0; + parms.has_subparams = 0; + return 0; +} + +#if OPT_TRACE > 0 +static void +dump_params(void) +{ + int n; + int arg; + TRACE(("params %d (%d)\n", nparam, parms.has_subparams)); + for (arg = 1, n = 0; n < nparam; ++n) { + TRACE(("%3d.%d %d\n", arg, parms.is_sub[n], parms.params[n])); + if (!parms.is_sub[n]) + ++arg; + } +} +#define DumpParams() dump_params() +#else +#define DumpParams() /* nothing */ +#endif + + /* allocate larger buffer if needed/possible */ +#define SafeAlloc(type, area, used, size) \ + type *new_string = area; \ + size_t new_length = size; \ + if (new_length == 0) { \ + new_length = 1024; \ + new_string = TypeMallocN(type, new_length); \ + } else if (used+1 >= new_length) { \ + new_length = size * 2; \ + new_string = TypeMallocN(type, new_length); \ + if (new_string != 0 \ + && area != 0 \ + && used != 0) { \ + memcpy(new_string, area, used * sizeof(type)); \ + } \ + } +#define SafeFree(area, size) \ + if (area != new_string) { \ + free(area); \ + area = new_string; \ + } \ + size = new_length + +#define WriteNow() { \ + unsigned single = 0; \ + \ + if (screen->curss) { \ + dotext(xw, \ + screen->gsets[(int) (screen->curss)], \ + sp->print_area, \ + (Cardinal) 1); \ + screen->curss = 0; \ + single++; \ + } \ + if (sp->print_used > single) { \ + dotext(xw, \ + screen->gsets[(int) (screen->curgl)], \ + sp->print_area + single, \ + (Cardinal) (sp->print_used - single)); \ + } \ + sp->print_used = 0; \ + } \ + +#define PARSE_SRM 1 + +struct ParseState { + unsigned check_recur; +#if OPT_VT52_MODE + Bool vt52_cup; +#endif + Const PARSE_T *groundtable; + Const PARSE_T *parsestate; + int scstype; + int scssize; + Bool private_function; /* distinguish private-mode from standard */ + int string_mode; /* nonzero iff we're processing a string */ + int lastchar; /* positive iff we had a graphic character */ + int nextstate; +#if OPT_WIDE_CHARS + int last_was_wide; +#endif + /* Buffer for processing printable text */ + IChar *print_area; + size_t print_size; + size_t print_used; + /* Buffer for processing strings (e.g., OSC ... ST) */ + Char *string_area; + size_t string_size; + size_t string_used; + /* Buffer for deferring input */ + Char *defer_area; + size_t defer_size; + size_t defer_used; +}; + +static struct ParseState myState; + +static void +init_groundtable(TScreen *screen, struct ParseState *sp) +{ + (void) screen; + +#if OPT_VT52_MODE + if (!(screen->vtXX_level)) { + sp->groundtable = vt52_table; + } else if (screen->terminal_id >= 100) +#endif + { + sp->groundtable = ansi_table; + } +} + +static void +select_charset(struct ParseState *sp, int type, int size) +{ + TRACE(("select_charset %d %d\n", type, size)); + sp->scstype = type; + sp->scssize = size; + if (size == 94) { + sp->parsestate = scstable; + } else { + sp->parsestate = scs96table; + } +} +/* *INDENT-OFF* */ +static struct { + DECNRCM_codes result; + int prefix; + int suffix; + int min_level; + int max_level; + int need_nrc; +} scs_table[] = { + { nrc_ASCII, 0, 'B', 1, 9, 0 }, + { nrc_British, 0, 'A', 1, 9, 0 }, + { nrc_DEC_Spec_Graphic, 0, '0', 1, 9, 0 }, + { nrc_DEC_Alt_Chars, 0, '1', 1, 1, 0 }, + { nrc_DEC_Alt_Graphics, 0, '2', 1, 1, 0 }, + /* VT2xx */ + { nrc_DEC_Supp, 0, '<', 2, 9, 0 }, + { nrc_Dutch, 0, '4', 2, 9, 1 }, + { nrc_Finnish, 0, '5', 2, 9, 1 }, + { nrc_Finnish2, 0, 'C', 2, 9, 1 }, + { nrc_French, 0, 'R', 2, 9, 1 }, + { nrc_French2, 0, 'f', 2, 9, 1 }, + { nrc_French_Canadian, 0, 'Q', 2, 9, 1 }, + { nrc_German, 0, 'K', 2, 9, 1 }, + { nrc_Italian, 0, 'Y', 2, 9, 1 }, + { nrc_Norwegian_Danish2, 0, 'E', 2, 9, 1 }, + { nrc_Norwegian_Danish3, 0, '6', 2, 9, 1 }, + { nrc_Spanish, 0, 'Z', 2, 9, 1 }, + { nrc_Swedish, 0, '7', 2, 9, 1 }, + { nrc_Swedish2, 0, 'H', 2, 9, 1 }, + { nrc_Swiss, 0, '=', 2, 9, 1 }, + /* VT3xx */ + { nrc_British_Latin_1, 0, 'A', 3, 9, 1 }, + { nrc_DEC_Supp_Graphic, '%', '5', 3, 9, 0 }, + { nrc_DEC_Technical, 0, '>', 3, 9, 0 }, + { nrc_French_Canadian2, 0, '9', 3, 9, 1 }, + { nrc_Norwegian_Danish, 0, '`', 3, 9, 1 }, + { nrc_Portugese, '%', '6', 3, 9, 1 }, + /* VT5xx */ + { nrc_Cyrillic, '&', '4', 5, 9, 1 }, + { nrc_Greek, '"', '>', 5, 9, 1 }, + { nrc_Hebrew, '%', '=', 5, 9, 1 }, + { nrc_Turkish, '%', '2', 5, 9, 1 }, + { nrc_DEC_Greek_Supp, '"', '?', 5, 9, 0 }, + { nrc_DEC_Hebrew_Supp, '"', '4', 5, 9, 0 }, + { nrc_DEC_Turkish_Supp, '%', '0', 5, 9, 0 }, + { nrc_ISO_Greek_Supp, 0, 'F', 5, 9, 0 }, + { nrc_ISO_Hebrew_Supp, 0, 'H', 5, 9, 0 }, + { nrc_ISO_Latin_5_Supp, 0, 'M', 5, 9, 0 }, + { nrc_ISO_Latin_Cyrillic,0, 'L', 5, 9, 0 }, + /* VT5xx (not implemented) */ +#if 0 + { nrc_Russian, '&', '5', 5, 9, 1 }, + { nrc_SCS_NRCS, '%', '3', 5, 9, 0 }, +#endif +}; +/* *INDENT-ON* */ + +#if OPT_DEC_RECTOPS +static char * +encode_scs(DECNRCM_codes value) +{ + static char buffer[3]; + Cardinal n; + char *result = buffer; + for (n = 0; n < XtNumber(scs_table); ++n) { + if (scs_table[n].result == value) { + if (scs_table[n].prefix) + *result++ = (char) scs_table[n].prefix; + if (scs_table[n].suffix) + *result++ = (char) scs_table[n].suffix; + break; + } + } + *result = '\0'; + return buffer; +} +#endif + +void +xtermDecodeSCS(XtermWidget xw, int which, int prefix, int suffix) +{ + TScreen *screen = TScreenOf(xw); + Cardinal n; + DECNRCM_codes result = nrc_Unknown; + + suffix &= 0x7f; + for (n = 0; n < XtNumber(scs_table); ++n) { + if (prefix == scs_table[n].prefix + && suffix == scs_table[n].suffix + && screen->vtXX_level >= scs_table[n].min_level + && screen->vtXX_level <= scs_table[n].max_level + && (scs_table[n].need_nrc == 0 || (xw->flags & NATIONAL) != 0)) { + result = scs_table[n].result; + break; + } + } + if (result != nrc_Unknown) { + initCharset(screen, which, result); + TRACE(("setting G%d to %s\n", which, visibleScsCode((int) result))); + } else { + TRACE(("...unknown GSET\n")); + } +} + +/* + * Given a parameter number, and subparameter (starting in each case from zero) + * return the corresponding index into the parameter array. If the combination + * is not found, return -1. + */ +static int +subparam_index(int p, int s) +{ + int result = -1; + int j, p2, s2; + + for (j = p2 = 0; j < nparam; ++j, ++p2) { + if (parms.is_sub[j]) { + s2 = 0; + + do { + if ((p == p2) && (s == s2)) { + result = j; + break; + } + ++s2; + } while ((++j < nparam) && (parms.is_sub[j - 1] < parms.is_sub[j])); + + if (result >= 0) + break; + + --j; /* undo the last "while" */ + } else if (p == p2) { + if (s == 0) { + result = j; + } + break; + } + } + TRACE2(("...subparam_index %d.%d = %d\n", p + 1, s + 1, result)); + return result; +} + +/* + * Check if the given item in the parameter array has subparameters. + * If so, return the number of subparameters to use as a loop limit, etc. + */ +static int +param_has_subparams(int item) +{ + int result = 0; + if (parms.has_subparams) { + int n = subparam_index(item, 0); + if (n >= 0 && parms.is_sub[n]) { + while (++n < nparam && parms.is_sub[n - 1] < parms.is_sub[n]) { + result++; + } + } + } + TRACE(("...param_has_subparams(%d) ->%d\n", item, result)); + return result; +} + +#if OPT_DIRECT_COLOR || OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS +/* + * Given an index into the parameter array, return the corresponding parameter + * number (starting from zero). + */ +static int +param_number(int item) +{ + int result = -1; + int j, p; + + for (j = p = 0; j < nparam; ++j, ++p) { + if (p >= item) { + result = j; + break; + } + if (parms.is_sub[j]) { + while ((++j < nparam) && (parms.is_sub[j - 1] < parms.is_sub[j])) { + /* EMPTY */ + } + --j; + } + } + + TRACE2(("...param_number(%d) = %d\n", item, result)); + return result; +} + +static int +get_subparam(int p, int s) +{ + int item = subparam_index(p, s); + int result = (item >= 0) ? parms.params[item] : DEFAULT; + TRACE(("...get_subparam[%d] = %d\n", item, result)); + return result; +} + +/* + * Some background - + * + * Todd Larason provided the initial changes to support 256-colors in July 1999. + * I pointed out that the description of SGR 38/48 in ECMA-48 was vague, and + * was unsure if there would be some standard using those codes. His response + * was that this was documented (it turns out, in equally vague terms) in ITU + * T.416 + * + * Discussing this with Todd Larason in mid-1999, my point was that given the + * high cost of obtaining ITU T.416 (ISO-8613-6), the standard was not going + * to be effective (more than $100 then, more than $200 in 2012) + * + * We overlooked the detail about ":" as a subparameter delimiter (documented + * in 5.4.2 in ECMA-48). Some discussion in KDE in mid-2006 led Lars Doelle + * to discuss the issue with me. Lars' initial concern dealt with the fact + * that a sequence such as + * CSI 38 ; 5 ; 1 m + * violated the principle that SGR parameters could be used in any order. + * Further discussion (see KDE #107487) resolved that the standard expected + * that the sequence would look like + * CSI 38 ; 5 : 1 m + * which still violates that principle, since the "5:1" parameter has to + * follow the "38" to be useful. + * + * This function accepts either format (per request by Paul Leonerd Evans). + * It also accepts + * CSI 38 : 5 : 1 m + * according to Lars' original assumption. While implementing that, I added + * support for Konsole's interpretation of "CSI 38 : 2" as a 24-bit RGB value. + * ISO-8613-6 documents that as "direct color". + * + * At the time in 2012, no one noticed (or commented) regarding ISO-8613-6's + * quirk in the description of direct color: it mentions a color space + * identifier parameter which should follow the "2" (as parameter 1). In the + * same section, ISO-8613-6 mentions a parameter 6 which can be ignored, as + * well as parameters 7 and 8. Like parameter 1, parameters 7 and 8 are not + * defined clearly in the standard, and a close reading indicates they are + * optional, saying they "may be used". This implementation ignores parameters + * 6 (and above), and provides for the color space identifier by checking the + * number of parameters: + * 3 after "2" (no color space identifier) + * 4 or more after "2" (color space identifier) + * + * By the way - all of the parameters are decimal integers, and missing + * parameters represent a default value. ISO-8613-6 is clear about that. + * + * Aside from ISO-8613-3, there is no standard use of ":" as a delimiter. + * ECMA-48 says only: + * + * 5.4.2 Parameter string format + * + * A parameter string which does not start with a bit combination in the + * range 03/12 to 03/15 shall have the following format: + * + * a) A parameter string consists of one or more parameter + * sub-strings, each of which represents a number in decimal + * notation. + * + * b) Each parameter sub-string consists of one or more bit + * combinations from 03/00 to 03/10; the bit combinations from + * 03/00 to 03/09 represent the digits ZERO to NINE; bit + * combination 03/10 may be used as a separator in a parameter + * sub-string, for example, to separate the fractional part of a + * decimal number from the integer part of that number. + * + * That is, there is no mention in ECMA-48 of the possibility that a parameter + * string might be a list of parameters, as done in ISO-8613-3 (nor does + * ECMA-48 provide an example where the ":" separator might be used). Because + * of this, xterm treats other cases than those needed for ISO-8613-3 as an + * error, and stops interpreting the sequence. + */ +#define extended_colors_limit(n) ((n) == 5 ? 1 : ((n) == 2 ? 3 : 0)) +static Boolean +parse_extended_colors(XtermWidget xw, int *colorp, int *itemp, Boolean *extended) +{ + Boolean result = False; + int item = *itemp; + int next = item; + int base = param_number(item); + int code = -1; + int values[3]; /* maximum number of subparameters */ + int need = 0; /* number of subparameters needed */ + int have; + int n; + + /* + * On entry, 'item' points to the 38/48 code in the parameter array. + * If that has subparameters, we will expect all of the values to + * be subparameters of that item. + */ + if ((have = param_has_subparams(item)) != 0) { + /* accept CSI 38 : 5 : 1 m */ + /* accept CSI 38 : 2 : 1 : 2 : 3 m */ + code = get_subparam(base, 1); + need = extended_colors_limit(code); + next = item + have; + for (n = 0; n < need && n < 3; ++n) { + values[n] = get_subparam(base, 2 + n + (have > 4)); + } + } else if (++item < nparam) { + ++base; + if ((have = param_has_subparams(item)) != 0) { + /* accept CSI 38 ; 5 : 1 m */ + /* accept CSI 38 ; 2 : 1 : 2 : 3 m */ + code = get_subparam(base, 0); + need = extended_colors_limit(code); + next = base + have; + for (n = 0; n < need && n < 3; ++n) { + values[n] = get_subparam(base, 1 + n + (have > 3)); + } + } else { + /* accept CSI 38 ; 5 ; 1 m */ + /* accept CSI 38 ; 2 ; 1 ; 2 ; 3 m */ + code = GetParam(item); + need = extended_colors_limit(code); + next = item + need; + for (n = 0; n < need && n < 3; ++n) { + values[n] = GetParam(item + 1 + n); + } + } + } + item = next; + + *extended = False; + switch (code) { + case 2: + /* direct color in rgb space */ + if ((values[0] >= 0 && values[0] < 256) && + (values[1] >= 0 && values[1] < 256) && + (values[2] >= 0 && values[2] < 256)) { +#if OPT_DIRECT_COLOR + if (TScreenOf(xw)->direct_color && xw->has_rgb) { + *colorp = getDirectColor(xw, values[0], values[1], values[2]); + result = True; + *extended = True; + } else +#endif + { + *colorp = xtermClosestColor(xw, values[0], values[1], values[2]); + result = okIndexedColor(*colorp); + } + } else { + *colorp = -1; + } + break; + case 5: + /* indexed color */ + *colorp = values[0]; + result = okIndexedColor(*colorp); + break; + default: + *colorp = -1; + break; + } + + TRACE(("...resulting color %d/%d %s\n", + *colorp, NUM_ANSI_COLORS, + result ? "OK" : "ERR")); + + *itemp = item; + return result; +} +#endif /* ...extended_colors */ + +static int +optional_param(int which) +{ + return (nparam > which) ? GetParam(which) : DEFAULT; +} + +static int +zero_if_default(int which) +{ + int result = (nparam > which) ? GetParam(which) : 0; + if (result <= 0) + result = 0; + return result; +} + +static int +one_if_default(int which) +{ + int result = (nparam > which) ? GetParam(which) : 0; + if (result <= 0) + result = 1; + return result; +} + +/* + * Color palette changes using the OSC controls require a repaint of the + * screen - but not immediately. Do the repaint as soon as we detect a + * state which will not lead to another color palette change. + */ +static void +repaintWhenPaletteChanged(XtermWidget xw, struct ParseState *sp) +{ + Boolean ignore = False; + + switch (sp->nextstate) { + case CASE_ESC: + ignore = ((sp->parsestate == ansi_table) || + (sp->parsestate == sos_table)); +#if USE_DOUBLE_BUFFER + if (resource.buffered && TScreenOf(xw)->needSwap) { + ignore = False; + } +#endif + break; + case CASE_OSC: + ignore = ((sp->parsestate == ansi_table) || + (sp->parsestate == esc_table)); + break; + case CASE_IGNORE: + ignore = (sp->parsestate == sos_table); + break; + case CASE_ST: + ignore = ((sp->parsestate == esc_table) || + (sp->parsestate == sos_table)); + break; + case CASE_ESC_DIGIT: + ignore = (sp->parsestate == csi_table); + break; + case CASE_ESC_SEMI: + ignore = (sp->parsestate == csi2_table); + break; + } + + if (!ignore) { + TRACE(("repaintWhenPaletteChanged\n")); + xw->work.palette_changed = False; + xtermRepaint(xw); + xtermFlushDbe(xw); + } +} + +#if OPT_C1_PRINT || OPT_WIDE_CHARS +#define ParseSOS(screen) ((screen)->c1_printable == 0) +#else +#define ParseSOS(screen) 0 +#endif + +#define ResetState(sp) InitParams(), (sp)->parsestate = (sp)->groundtable + +static void +illegal_parse(XtermWidget xw, unsigned c, struct ParseState *sp) +{ + ResetState(sp); + sp->nextstate = sp->parsestate[E2A(c)]; + Bell(xw, XkbBI_MinorError, 0); +} + +static void +init_parser(XtermWidget xw, struct ParseState *sp) +{ + TScreen *screen = TScreenOf(xw); + + memset(sp, 0, sizeof(*sp)); + sp->scssize = 94; /* number of printable/nonspace ASCII */ + sp->lastchar = -1; /* not a legal IChar */ + sp->nextstate = -1; /* not a legal state */ + + init_groundtable(screen, sp); + ResetState(sp); +} + +static void +init_reply(unsigned type) +{ + memset(&reply, 0, sizeof(reply)); + reply.a_type = (Char) type; +} + +static void +deferparsing(unsigned c, struct ParseState *sp) +{ + SafeAlloc(Char, sp->defer_area, sp->defer_used, sp->defer_size); + if (new_string == 0) { + xtermWarning("Cannot allocate %lu bytes for deferred parsing of %u\n", + (unsigned long) new_length, c); + return; + } + SafeFree(sp->defer_area, sp->defer_size); + sp->defer_area[(sp->defer_used)++] = CharOf(c); +} + +#if OPT_VT52_MODE +static void +update_vt52_vt100_settings(void) +{ + update_autowrap(); + update_reversewrap(); + update_autolinefeed(); + update_appcursor(); + update_appkeypad(); + update_allow132(); +} +#endif + +static Boolean +doparsing(XtermWidget xw, unsigned c, struct ParseState *sp) +{ + TScreen *screen = TScreenOf(xw); + int item; + int count; + int value; + int laststate; + int thischar = -1; + XTermRect myRect; +#if OPT_DEC_RECTOPS + int thispage = 1; +#endif + + if (sp->check_recur) { + /* Defer parsing when parser is already running as the parser is not + * safe to reenter. + */ + deferparsing(c, sp); + return True; + } + + do { +#if OPT_WIDE_CHARS + int this_is_wide = 0; + + /* + * Handle zero-width combining characters. Make it faster by noting + * that according to the Unicode charts, the majority of Western + * character sets do not use this feature. There are some unassigned + * codes at 0x242, but no zero-width characters until past 0x300. + */ + if (c >= 0x300 + && screen->wide_chars + && CharWidth(c) == 0 + && !isWideControl(c)) { + int prev, test; + Boolean used = True; + int use_row; + int use_col; + + WriteNow(); + use_row = (screen->char_was_written + ? screen->last_written_row + : screen->cur_row); + use_col = (screen->char_was_written + ? screen->last_written_col + : screen->cur_col); + + /* + * Check if the latest data can be added to the base character. + * If there is already a combining character stored for the cell, + * we cannot, since that would change the order. + */ + if (screen->normalized_c + && !IsCellCombined(screen, use_row, use_col)) { + prev = (int) XTERM_CELL(use_row, use_col); + test = do_precomposition(prev, (int) c); + TRACE(("do_precomposition (U+%04X [%d], U+%04X [%d]) -> U+%04X [%d]\n", + prev, CharWidth(prev), + (int) c, CharWidth(c), + test, CharWidth(test))); + } else { + prev = -1; + test = -1; + } + + /* substitute combined character with precomposed character + * only if it does not change the width of the base character + */ + if (test != -1 + && CharWidth(test) == CharWidth(prev)) { + putXtermCell(screen, use_row, use_col, test); + } else if (screen->char_was_written + || getXtermCell(screen, use_row, use_col) >= ' ') { + addXtermCombining(screen, use_row, use_col, c); + } else { + /* + * none of the above... we will add the combining character as + * a base character. + */ + used = False; + } + + if (used) { + if (!screen->scroll_amt) + ScrnUpdate(xw, use_row, use_col, 1, 1, 1); + continue; + } + } +#endif + + /* Intercept characters for printer controller mode */ + if (PrinterOf(screen).printer_controlmode == 2) { + if ((c = (unsigned) xtermPrinterControl(xw, (int) c)) == 0) + continue; + } + + /* + * VT52 is a little ugly in the one place it has a parameterized + * control sequence, since the parameter falls after the character + * that denotes the type of sequence. + */ +#if OPT_VT52_MODE + if (sp->vt52_cup) { + if (nparam < NPARAM - 1) { + SetParam(nparam++, (int) (c & 0x7f) - 32); + parms.is_sub[nparam] = 0; + } + if (nparam < 2) + continue; + sp->vt52_cup = False; + CursorSet(screen, zero_if_default(0), zero_if_default(1), xw->flags); + sp->parsestate = vt52_table; + SetParam(0, 0); + SetParam(1, 0); + continue; + } +#endif + + laststate = sp->nextstate; + if (c == ANSI_DEL + && sp->parsestate == sp->groundtable + && sp->scssize == 96 + && sp->scstype != 0) { + /* + * Handle special case of shifts for 96-character sets by checking + * if we have a DEL. The other special case for SPACE will always + * be printable. + */ + sp->nextstate = CASE_PRINT; + } else +#if OPT_WIDE_CHARS + if (c > 255) { + /* + * The parsing tables all have 256 entries. If we're supporting + * wide characters, we handle them by treating them the same as + * printing characters. + */ + if (sp->parsestate == sp->groundtable) { + sp->nextstate = CASE_PRINT; + } else if (sp->parsestate == sos_table) { + c &= WIDEST_ICHAR; + if (c > 255) { + TRACE(("Found code > 255 while in SOS state: %04X\n", c)); + c = BAD_ASCII; + } + } else { + sp->nextstate = CASE_GROUND_STATE; + } + } else +#endif + sp->nextstate = sp->parsestate[E2A(c)]; + +#if OPT_BROKEN_OSC + /* + * Linux console palette escape sequences start with an OSC, but do + * not terminate correctly. Some scripts do not check before writing + * them, making xterm appear to hang (it's awaiting a valid string + * terminator). Just ignore these if we see them - there's no point + * in emulating bad code. + */ + if (screen->brokenLinuxOSC + && sp->parsestate == sos_table) { + if (sp->string_used) { + switch (sp->string_area[0]) { + case 'P': + if (sp->string_used <= 7) + break; + /* FALLTHRU */ + case 'R': + illegal_parse(xw, c, sp); + TRACE(("Reset to ground state (brokenLinuxOSC)\n")); + break; + } + } + } +#endif + +#if OPT_BROKEN_ST + /* + * Before patch #171, carriage control embedded within an OSC string + * would terminate it. Some (buggy, of course) applications rely on + * this behavior. Accommodate them by allowing one to compile xterm + * and emulate the old behavior. + */ + if (screen->brokenStringTerm + && sp->parsestate == sos_table + && c < 32) { + switch (c) { + case ANSI_EOT: /* FALLTHRU */ + case ANSI_BS: /* FALLTHRU */ + case ANSI_HT: /* FALLTHRU */ + case ANSI_LF: /* FALLTHRU */ + case ANSI_VT: /* FALLTHRU */ + case ANSI_FF: /* FALLTHRU */ + case ANSI_CR: /* FALLTHRU */ + case ANSI_SO: /* FALLTHRU */ + case ANSI_SI: /* FALLTHRU */ + case ANSI_XON: /* FALLTHRU */ + case ANSI_CAN: + illegal_parse(xw, c, sp); + TRACE(("Reset to ground state (brokenStringTerm)\n")); + break; + } + } +#endif + +#if OPT_C1_PRINT + /* + * This is not completely foolproof, but will allow an application + * with values in the C1 range to use them as printable characters, + * provided that they are not intermixed with an escape sequence. + */ + if (screen->c1_printable + && (c >= 128 && c < 256)) { + sp->nextstate = (sp->parsestate == esc_table + ? CASE_ESC_IGNORE + : sp->parsestate[E2A(160)]); + TRACE(("allowC1Printable %04X %s ->%s\n", + c, which_table(sp->parsestate), + visibleVTparse(sp->nextstate))); + } +#endif + +#if OPT_WIDE_CHARS + /* + * If we have a C1 code and the c1_printable flag is not set, simply + * ignore it when it was translated from UTF-8. That is because the + * value could not have been present as-is in the UTF-8. + * + * To see that CASE_IGNORE is a consistent value, note that it is + * always used for NUL and other uninteresting C0 controls. + */ +#if OPT_C1_PRINT + if (!screen->c1_printable) +#endif + if (screen->wide_chars + && (c >= 128 && c < 160)) { + sp->nextstate = CASE_IGNORE; + } + + /* + * If this character is a different width than the last one, put the + * previous text into the buffer and draw it now. + */ + this_is_wide = isWide((int) c); + if (this_is_wide != sp->last_was_wide) { + WriteNow(); + } +#endif + + /* + * Accumulate string for printable text. This may be 8/16-bit + * characters. + */ + if (sp->nextstate == CASE_PRINT) { + SafeAlloc(IChar, sp->print_area, sp->print_used, sp->print_size); + if (new_string == 0) { + xtermWarning("Cannot allocate %lu bytes for printable text\n", + (unsigned long) new_length); + continue; + } + SafeFree(sp->print_area, sp->print_size); +#if OPT_VT52_MODE + /* + * Strip output text to 7-bits for VT52. We should do this for + * VT100 also (which is a 7-bit device), but xterm has been + * doing this for so long we shouldn't change this behavior. + */ + if (screen->vtXX_level < 1) + c &= 0x7f; +#endif + sp->print_area[sp->print_used++] = (IChar) c; + sp->lastchar = thischar = (int) c; +#if OPT_WIDE_CHARS + sp->last_was_wide = this_is_wide; +#endif + if (morePtyData(screen, VTbuffer)) { + continue; + } + } + + if (sp->nextstate == CASE_PRINT + || (laststate == CASE_PRINT && sp->print_used)) { + WriteNow(); + } + + /* + * Accumulate string for APC, DCS, PM, OSC, SOS controls + * This should always be 8-bit characters. + */ + if (sp->parsestate == sos_table) { + SafeAlloc(Char, sp->string_area, sp->string_used, sp->string_size); + if (new_string == 0) { + xtermWarning("Cannot allocate %lu bytes for string mode %d\n", + (unsigned long) new_length, sp->string_mode); + continue; + } + SafeFree(sp->string_area, sp->string_size); +#if OPT_WIDE_CHARS + /* + * We cannot display codes above 255, but let's try to + * accommodate the application a little by not aborting the + * string. + */ + if ((c & WIDEST_ICHAR) > 255) { + sp->nextstate = CASE_PRINT; + c = BAD_ASCII; + } +#endif + sp->string_area[(sp->string_used)++] = CharOf(c); + } else if (sp->parsestate != esc_table) { + /* if we were accumulating, we're not any more */ + sp->string_mode = 0; + sp->string_used = 0; + } + + DumpParams(); + TRACE(("parse %04X -> %s %s (used=%lu)\n", + c, visibleVTparse(sp->nextstate), + which_table(sp->parsestate), + (unsigned long) sp->string_used)); + + /* + * If the parameter list has subparameters (tokens separated by ":") + * reject any controls that do not accept subparameters. + */ + if (parms.has_subparams) { + switch (sp->nextstate) { + case CASE_GROUND_STATE: + case CASE_CSI_IGNORE: + /* FALLTHRU */ + + case CASE_ESC_DIGIT: + case CASE_ESC_SEMI: + case CASE_ESC_COLON: + /* these states are required to parse parameter lists */ + break; + + case CASE_SGR: + TRACE(("...possible subparam usage\n")); + break; + + case CASE_CSI_DEC_DOLLAR_STATE: + case CASE_CSI_DOLLAR_STATE: + case CASE_CSI_HASH_STATE: + case CASE_CSI_EX_STATE: + case CASE_CSI_QUOTE_STATE: + case CASE_CSI_SPACE_STATE: + case CASE_CSI_STAR_STATE: + case CASE_CSI_TICK_STATE: + case CASE_DEC2_STATE: + case CASE_DEC3_STATE: + case CASE_DEC_STATE: + /* use this branch when we do not yet have the final character */ + TRACE(("...unexpected subparam usage\n")); + InitParams(); + sp->nextstate = CASE_CSI_IGNORE; + break; + + default: + /* use this branch for cases where we have the final character + * in the table that processed the parameter list. + */ + TRACE(("...unexpected subparam usage\n")); + ResetState(sp); + continue; + } + } + + if (xw->work.palette_changed) { + repaintWhenPaletteChanged(xw, sp); + } + + switch (sp->nextstate) { + case CASE_PRINT: + TRACE(("CASE_PRINT - printable characters\n")); + break; + + case CASE_GROUND_STATE: + TRACE(("CASE_GROUND_STATE - exit ignore mode\n")); + ResetState(sp); + break; + + case CASE_IGNORE: + TRACE(("CASE_IGNORE - Ignore character %02X\n", c)); + break; + + case CASE_ENQ: + TRACE(("CASE_ENQ - answerback\n")); + for (count = 0; screen->answer_back[count] != 0; count++) + unparseputc(xw, screen->answer_back[count]); + unparse_end(xw); + break; + + case CASE_BELL: + TRACE(("CASE_BELL - bell\n")); + if (sp->string_mode == ANSI_OSC) { + if (sp->string_used) + sp->string_area[--(sp->string_used)] = '\0'; + do_osc(xw, sp->string_area, sp->string_used, (int) c); + ResetState(sp); + } else { + /* bell */ + Bell(xw, XkbBI_TerminalBell, 0); + } + break; + + case CASE_BS: + TRACE(("CASE_BS - backspace\n")); + CursorBack(xw, 1); + break; + + case CASE_CR: + TRACE(("CASE_CR\n")); + CarriageReturn(xw); + break; + + case CASE_ESC: + if_OPT_VT52_MODE(screen, { + sp->parsestate = vt52_esc_table; + break; + }); + sp->parsestate = esc_table; + break; + +#if OPT_VT52_MODE + case CASE_VT52_CUP: + TRACE(("CASE_VT52_CUP - VT52 cursor addressing\n")); + sp->vt52_cup = True; + ResetState(sp); + break; + + case CASE_VT52_IGNORE: + TRACE(("CASE_VT52_IGNORE - VT52 ignore-character\n")); + sp->parsestate = vt52_ignore_table; + break; +#endif + + case CASE_VMOT: + TRACE(("CASE_VMOT\n")); + /* + * form feed, line feed, vertical tab + */ + xtermAutoPrint(xw, c); + xtermIndex(xw, 1); + if (xw->flags & LINEFEED) + CarriageReturn(xw); + else + do_xevents(xw); + break; + + case CASE_CBT: + TRACE(("CASE_CBT\n")); + /* cursor backward tabulation */ + count = one_if_default(0); + while ((count-- > 0) + && (TabToPrevStop(xw))) ; + ResetState(sp); + break; + + case CASE_CHT: + TRACE(("CASE_CHT\n")); + /* cursor forward tabulation */ + count = one_if_default(0); + while ((count-- > 0) + && (TabToNextStop(xw))) ; + ResetState(sp); + break; + + case CASE_TAB: + /* tab */ + TabToNextStop(xw); + break; + + case CASE_SI: + screen->curgl = 0; + if_OPT_VT52_MODE(screen, { + ResetState(sp); + }); + break; + + case CASE_SO: + screen->curgl = 1; + if_OPT_VT52_MODE(screen, { + ResetState(sp); + }); + break; + + case CASE_DECDHL: + xterm_DECDHL(xw, c == '3'); + ResetState(sp); + break; + + case CASE_DECSWL: + xterm_DECSWL(xw); + ResetState(sp); + break; + + case CASE_DECDWL: + xterm_DECDWL(xw); + ResetState(sp); + break; + + case CASE_SCR_STATE: + /* enter scr state */ + sp->parsestate = scrtable; + break; + + case CASE_SCS0_STATE: + /* enter scs state 0 */ + select_charset(sp, 0, 94); + break; + + case CASE_SCS1_STATE: + /* enter scs state 1 */ + select_charset(sp, 1, 94); + break; + + case CASE_SCS2_STATE: + /* enter scs state 2 */ + select_charset(sp, 2, 94); + break; + + case CASE_SCS3_STATE: + /* enter scs state 3 */ + select_charset(sp, 3, 94); + break; + + case CASE_SCS1A_STATE: + /* enter scs state 1 */ + select_charset(sp, 1, 96); + break; + + case CASE_SCS2A_STATE: + /* enter scs state 2 */ + select_charset(sp, 2, 96); + break; + + case CASE_SCS3A_STATE: + /* enter scs state 3 */ + select_charset(sp, 3, 96); + break; + + case CASE_ESC_IGNORE: + /* unknown escape sequence */ + sp->parsestate = eigtable; + break; + + case CASE_ESC_DIGIT: + /* digit in csi or dec mode */ + if (nparam > 0) { + value = zero_if_default(nparam - 1); + SetParam(nparam - 1, (10 * value) + ((int) c - '0')); + if (GetParam(nparam - 1) > 65535) + SetParam(nparam - 1, 65535); + if (sp->parsestate == csi_table) + sp->parsestate = csi2_table; + } + break; + + case CASE_ESC_SEMI: + /* semicolon in csi or dec mode */ + if (nparam < NPARAM) { + parms.is_sub[nparam] = 0; + SetParam(nparam++, DEFAULT); + } + if (sp->parsestate == csi_table) + sp->parsestate = csi2_table; + break; + + /* + * A _few_ commands accept colon-separated subparameters. + * Mark the parameter list so that we can exclude (most) bogus + * commands with simple/fast checks. + */ + case CASE_ESC_COLON: + if (nparam < NPARAM) { + parms.has_subparams = 1; + if (nparam == 0) { + parms.is_sub[nparam] = 1; + SetParam(nparam++, DEFAULT); + } else if (parms.is_sub[nparam - 1] == 0) { + parms.is_sub[nparam - 1] = 1; + parms.is_sub[nparam] = 2; + parms.params[nparam] = 0; + ++nparam; + } else { + parms.is_sub[nparam] = 1 + parms.is_sub[nparam - 1]; + parms.params[nparam] = 0; + ++nparam; + } + } + break; + + case CASE_DEC_STATE: + /* enter dec mode */ + sp->parsestate = dec_table; + break; + + case CASE_DEC2_STATE: + /* enter dec2 mode */ + sp->parsestate = dec2_table; + break; + + case CASE_DEC3_STATE: + /* enter dec3 mode */ + sp->parsestate = dec3_table; + break; + + case CASE_ICH: + TRACE(("CASE_ICH - insert char\n")); + InsertChar(xw, (unsigned) one_if_default(0)); + ResetState(sp); + break; + + case CASE_CUU: + TRACE(("CASE_CUU - cursor up\n")); + CursorUp(screen, one_if_default(0)); + ResetState(sp); + break; + + case CASE_CUD: + TRACE(("CASE_CUD - cursor down\n")); + CursorDown(screen, one_if_default(0)); + ResetState(sp); + break; + + case CASE_CUF: + TRACE(("CASE_CUF - cursor forward\n")); + CursorForward(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_CUB: + TRACE(("CASE_CUB - cursor backward\n")); + CursorBack(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_CUP: + TRACE(("CASE_CUP - cursor position\n")); + if_OPT_XMC_GLITCH(screen, { + Jump_XMC(xw); + }); + CursorSet(screen, one_if_default(0) - 1, one_if_default(1) - 1, xw->flags); + ResetState(sp); + break; + + case CASE_VPA: + TRACE(("CASE_VPA - vertical position absolute\n")); + CursorSet(screen, one_if_default(0) - 1, CursorCol(xw), xw->flags); + ResetState(sp); + break; + + case CASE_HPA: + TRACE(("CASE_HPA - horizontal position absolute\n")); + CursorSet(screen, CursorRow(xw), one_if_default(0) - 1, xw->flags); + ResetState(sp); + break; + + case CASE_VPR: + TRACE(("CASE_VPR - vertical position relative\n")); + CursorSet(screen, + CursorRow(xw) + one_if_default(0), + CursorCol(xw), + xw->flags); + ResetState(sp); + break; + + case CASE_HPR: + TRACE(("CASE_HPR - horizontal position relative\n")); + CursorSet(screen, + CursorRow(xw), + CursorCol(xw) + one_if_default(0), + xw->flags); + ResetState(sp); + break; + + case CASE_HP_BUGGY_LL: + TRACE(("CASE_HP_BUGGY_LL\n")); + /* Some HP-UX applications have the bug that they + assume ESC F goes to the lower left corner of + the screen, regardless of what terminfo says. */ + if (screen->hp_ll_bc) + CursorSet(screen, screen->max_row, 0, xw->flags); + ResetState(sp); + break; + + case CASE_ED: + TRACE(("CASE_ED - erase display\n")); + do_cd_xtra_scroll(xw); + do_erase_display(xw, zero_if_default(0), OFF_PROTECT); + ResetState(sp); + break; + + case CASE_EL: + TRACE(("CASE_EL - erase line\n")); + do_erase_line(xw, zero_if_default(0), OFF_PROTECT); + ResetState(sp); + break; + + case CASE_ECH: + TRACE(("CASE_ECH - erase char\n")); + /* ECH */ + do_erase_char(xw, one_if_default(0), OFF_PROTECT); + ResetState(sp); + break; + + case CASE_IL: + TRACE(("CASE_IL - insert line\n")); + InsertLine(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_DL: + TRACE(("CASE_DL - delete line\n")); + DeleteLine(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_DCH: + TRACE(("CASE_DCH - delete char\n")); + DeleteChar(xw, (unsigned) one_if_default(0)); + ResetState(sp); + break; + + case CASE_TRACK_MOUSE: + /* + * A single parameter other than zero is always scroll-down. + * A zero-parameter is used to reset the mouse mode, and is + * not useful for scrolling anyway. + */ + if (nparam > 1 || GetParam(0) == 0) { + CELL start; + + TRACE(("CASE_TRACK_MOUSE\n")); + /* Track mouse as long as in window and between + * specified rows + */ + start.row = one_if_default(2) - 1; + start.col = GetParam(1) - 1; + TrackMouse(xw, + GetParam(0), + &start, + GetParam(3) - 1, GetParam(4) - 2); + } else { + TRACE(("CASE_SD - scroll down\n")); + /* SD */ + RevScroll(xw, one_if_default(0)); + do_xevents(xw); + } + ResetState(sp); + break; + + case CASE_SD: + /* + * Cater to ECMA-48's typographical error... + */ + TRACE(("CASE_SD - scroll down\n")); + RevScroll(xw, one_if_default(0)); + do_xevents(xw); + ResetState(sp); + break; + + case CASE_DECID: + TRACE(("CASE_DECID\n")); + if_OPT_VT52_MODE(screen, { + unparseputc(xw, ANSI_ESC); + unparseputc(xw, '/'); + unparseputc(xw, 'Z'); + unparse_end(xw); + ResetState(sp); + break; + }); + SetParam(0, DEFAULT); /* Default ID parameter */ + /* FALLTHRU */ + case CASE_DA1: + TRACE(("CASE_DA1\n")); + if (GetParam(0) <= 0) { /* less than means DEFAULT */ + count = 0; + init_reply(ANSI_CSI); + reply.a_pintro = '?'; + + /* + * The first parameter corresponds to the highest operating + * level (i.e., service level) of the emulation. A DEC + * terminal can be setup to respond with a different DA + * response, but there's no control sequence that modifies + * this. We set it via a resource. + */ + if (screen->terminal_id < 200) { + switch (screen->terminal_id) { + case 132: + reply.a_param[count++] = 4; /* VT132 */ +#if OPT_REGIS_GRAPHICS + reply.a_param[count++] = 6; /* no STP, AVO, GPO (ReGIS) */ +#else + reply.a_param[count++] = 2; /* no STP, AVO, no GPO (ReGIS) */ +#endif + break; + case 131: + reply.a_param[count++] = 7; /* VT131 */ + break; + case 125: + reply.a_param[count++] = 12; /* VT125 */ +#if OPT_REGIS_GRAPHICS + reply.a_param[count++] = 0 | 2 | 1; /* no STP, AVO, GPO (ReGIS) */ +#else + reply.a_param[count++] = 0 | 2 | 0; /* no STP, AVO, no GPO (ReGIS) */ +#endif + reply.a_param[count++] = 0; /* no printer */ + reply.a_param[count++] = XTERM_PATCH; /* ROM version */ + break; + case 102: + reply.a_param[count++] = 6; /* VT102 */ + break; + case 101: + reply.a_param[count++] = 1; /* VT101 */ + reply.a_param[count++] = 0; /* no options */ + break; + default: /* VT100 */ + reply.a_param[count++] = 1; /* VT100 */ + reply.a_param[count++] = 0 | 2 | 0; /* no STP, AVO, no GPO (ReGIS) */ + break; + } + } else { + reply.a_param[count++] = (ParmType) (60 + + screen->terminal_id + / 100); + reply.a_param[count++] = 1; /* 132-columns */ + reply.a_param[count++] = 2; /* printer */ +#if OPT_REGIS_GRAPHICS + if (optRegisGraphics(screen)) { + reply.a_param[count++] = 3; /* ReGIS graphics */ + } +#endif +#if OPT_SIXEL_GRAPHICS + if (optSixelGraphics(screen)) { + reply.a_param[count++] = 4; /* sixel graphics */ + } +#endif + reply.a_param[count++] = 6; /* selective-erase */ +#if OPT_SUNPC_KBD + if (xw->keyboard.type == keyboardIsVT220) +#endif + reply.a_param[count++] = 8; /* user-defined-keys */ + reply.a_param[count++] = 9; /* national replacement charsets */ + reply.a_param[count++] = 15; /* technical characters */ + reply.a_param[count++] = 16; /* locator port */ + if (screen->terminal_id >= 400) { + reply.a_param[count++] = 17; /* terminal state interrogation */ + reply.a_param[count++] = 18; /* windowing extension */ + reply.a_param[count++] = 21; /* horizontal scrolling */ + } + if_OPT_ISO_COLORS(screen, { + reply.a_param[count++] = 22; /* ANSI color, VT525 */ + }); + reply.a_param[count++] = 28; /* rectangular editing */ +#if OPT_DEC_LOCATOR + reply.a_param[count++] = 29; /* ANSI text locator */ +#endif + } + reply.a_nparam = (ParmType) count; + reply.a_inters = 0; + reply.a_final = 'c'; + unparseseq(xw, &reply); + } + ResetState(sp); + break; + + case CASE_DA2: + TRACE(("CASE_DA2\n")); + if (GetParam(0) <= 0) { /* less than means DEFAULT */ + count = 0; + init_reply(ANSI_CSI); + reply.a_pintro = '>'; + + if (screen->terminal_id >= 200) { + switch (screen->terminal_id) { + case 220: + default: + reply.a_param[count++] = 1; /* VT220 */ + break; + case 240: + case 241: + /* http://www.decuslib.com/DECUS/vax87a/gendyn/vt200_kind.lis */ + reply.a_param[count++] = 2; /* VT240 */ + break; + case 320: + /* http://www.vt100.net/docs/vt320-uu/appendixe.html */ + reply.a_param[count++] = 24; /* VT320 */ + break; + case 330: + reply.a_param[count++] = 18; /* VT330 */ + break; + case 340: + reply.a_param[count++] = 19; /* VT340 */ + break; + case 382: + reply.a_param[count++] = 32; /* VT382 */ + break; + case 420: + reply.a_param[count++] = 41; /* VT420 */ + break; + case 510: + /* http://www.vt100.net/docs/vt510-rm/DA2 */ + reply.a_param[count++] = 61; /* VT510 */ + break; + case 520: + reply.a_param[count++] = 64; /* VT520 */ + break; + case 525: + reply.a_param[count++] = 65; /* VT525 */ + break; + } + } else { + reply.a_param[count++] = 0; /* VT100 (nonstandard) */ + } + reply.a_param[count++] = XTERM_PATCH; /* Version */ + reply.a_param[count++] = 0; /* options (none) */ + reply.a_nparam = (ParmType) count; + reply.a_inters = 0; + reply.a_final = 'c'; + unparseseq(xw, &reply); + } + ResetState(sp); + break; + + case CASE_DECRPTUI: + TRACE(("CASE_DECRPTUI\n")); + if ((screen->vtXX_level >= 4) + && (GetParam(0) <= 0)) { /* less than means DEFAULT */ + unparseputc1(xw, ANSI_DCS); + unparseputc(xw, '!'); + unparseputc(xw, '|'); + /* report the "terminal unit id" as 4 pairs of hexadecimal + * digits -- meaningless for a terminal emulator, but some + * host may care about the format. + */ + for (count = 0; count < 8; ++count) { + unparseputc(xw, '0'); + } + unparseputc1(xw, ANSI_ST); + unparse_end(xw); + } + ResetState(sp); + break; + + case CASE_TBC: + TRACE(("CASE_TBC - tab clear\n")); + if ((value = GetParam(0)) <= 0) /* less than means default */ + TabClear(xw->tabs, screen->cur_col); + else if (value == 3) + TabZonk(xw->tabs); + ResetState(sp); + break; + + case CASE_SET: + TRACE(("CASE_SET - set mode\n")); + ansi_modes(xw, bitset); + ResetState(sp); + break; + + case CASE_RST: + TRACE(("CASE_RST - reset mode\n")); + ansi_modes(xw, bitclr); + ResetState(sp); + break; + + case CASE_SGR: + for (item = 0; item < nparam; ++item) { + int op = GetParam(item); + int skip; + + if_OPT_XMC_GLITCH(screen, { + Mark_XMC(xw, op); + }); + TRACE(("CASE_SGR %d\n", op)); + + /* + * Only SGR 38/48 accept subparameters, and in those cases + * the values will not be seen at this point. + */ + if ((skip = param_has_subparams(item))) { + switch (op) { + case 38: + /* FALLTHRU */ + case 48: + if_OPT_ISO_COLORS(screen, { + break; + }); + /* FALLTHRU */ + default: + TRACE(("...unexpected subparameter in SGR\n")); + item += skip; /* ignore this */ + op = NPARAM; /* will never use this, anyway */ + break; + } + } + + switch (op) { + case DEFAULT: + /* FALLTHRU */ + case 0: + resetRendition(xw); + if_OPT_ISO_COLORS(screen, { + reset_SGR_Colors(xw); + }); + break; + case 1: /* Bold */ + UIntSet(xw->flags, BOLD); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; +#if OPT_WIDE_ATTRS + case 2: /* faint, decreased intensity or second colour */ + UIntSet(xw->flags, ATR_FAINT); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; + case 3: /* italicized */ + setItalicFont(xw, UseItalicFont(screen)); + UIntSet(xw->flags, ATR_ITALIC); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; +#endif + case 4: /* Underscore */ + UIntSet(xw->flags, UNDERLINE); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; + case 5: /* Blink (less than 150 per minute) */ + /* FALLTHRU */ + case 6: /* Blink (150 per minute, or more) */ + UIntSet(xw->flags, BLINK); + StartBlinking(xw); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; + case 7: + UIntSet(xw->flags, INVERSE); + if_OPT_ISO_COLORS(screen, { + setExtendedBG(xw); + }); + break; + case 8: + UIntSet(xw->flags, INVISIBLE); + break; +#if OPT_WIDE_ATTRS + case 9: /* crossed-out characters */ + UIntSet(xw->flags, ATR_STRIKEOUT); + break; +#endif +#if OPT_WIDE_ATTRS + case 21: /* doubly-underlined */ + UIntSet(xw->flags, ATR_DBL_UNDER); + break; +#endif + case 22: /* reset 'bold' */ + UIntClr(xw->flags, BOLD); +#if OPT_WIDE_ATTRS + UIntClr(xw->flags, ATR_FAINT); +#endif + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; +#if OPT_WIDE_ATTRS + case 23: /* not italicized */ + ResetItalics(xw); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; +#endif + case 24: + UIntClr(xw->flags, UNDERLINE); +#if OPT_WIDE_ATTRS + UIntClr(xw->flags, ATR_DBL_UNDER); +#endif + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; + case 25: /* reset 'blink' */ + UIntClr(xw->flags, BLINK); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + break; + case 27: + UIntClr(xw->flags, INVERSE); + if_OPT_ISO_COLORS(screen, { + setExtendedBG(xw); + }); + break; + case 28: + UIntClr(xw->flags, INVISIBLE); + break; +#if OPT_WIDE_ATTRS + case 29: /* not crossed out */ + UIntClr(xw->flags, ATR_STRIKEOUT); + break; +#endif + case 30: + /* FALLTHRU */ + case 31: + /* FALLTHRU */ + case 32: + /* FALLTHRU */ + case 33: + /* FALLTHRU */ + case 34: + /* FALLTHRU */ + case 35: + /* FALLTHRU */ + case 36: + /* FALLTHRU */ + case 37: + if_OPT_ISO_COLORS(screen, { + xw->sgr_foreground = (op - 30); + xw->sgr_38_xcolors = False; + clrDirectFG(xw->flags); + setExtendedFG(xw); + }); + break; + case 38: + /* This is more complicated than I'd like, but it should + * properly eat all the parameters for unsupported modes. + */ + if_OPT_ISO_COLORS(screen, { + Boolean extended; + if (parse_extended_colors(xw, &value, &item, + &extended)) { + xw->sgr_foreground = value; + xw->sgr_38_xcolors = True; + setDirectFG(xw->flags, extended); + setExtendedFG(xw); + } + }); + break; + case 39: + if_OPT_ISO_COLORS(screen, { + reset_SGR_Foreground(xw); + }); + break; + case 40: + /* FALLTHRU */ + case 41: + /* FALLTHRU */ + case 42: + /* FALLTHRU */ + case 43: + /* FALLTHRU */ + case 44: + /* FALLTHRU */ + case 45: + /* FALLTHRU */ + case 46: + /* FALLTHRU */ + case 47: + if_OPT_ISO_COLORS(screen, { + xw->sgr_background = (op - 40); + clrDirectBG(xw->flags); + setExtendedBG(xw); + }); + break; + case 48: + if_OPT_ISO_COLORS(screen, { + Boolean extended; + if (parse_extended_colors(xw, &value, &item, + &extended)) { + xw->sgr_background = value; + setDirectBG(xw->flags, extended); + setExtendedBG(xw); + } + }); + break; + case 49: + if_OPT_ISO_COLORS(screen, { + reset_SGR_Background(xw); + }); + break; + case 90: + /* FALLTHRU */ + case 91: + /* FALLTHRU */ + case 92: + /* FALLTHRU */ + case 93: + /* FALLTHRU */ + case 94: + /* FALLTHRU */ + case 95: + /* FALLTHRU */ + case 96: + /* FALLTHRU */ + case 97: + if_OPT_AIX_COLORS(screen, { + xw->sgr_foreground = (op - 90 + 8); + clrDirectFG(xw->flags); + setExtendedFG(xw); + }); + break; + case 100: +#if !OPT_AIX_COLORS + if_OPT_ISO_COLORS(screen, { + reset_SGR_Foreground(xw); + reset_SGR_Background(xw); + }); + break; +#endif + case 101: + /* FALLTHRU */ + case 102: + /* FALLTHRU */ + case 103: + /* FALLTHRU */ + case 104: + /* FALLTHRU */ + case 105: + /* FALLTHRU */ + case 106: + /* FALLTHRU */ + case 107: + if_OPT_AIX_COLORS(screen, { + xw->sgr_background = (op - 100 + 8); + clrDirectBG(xw->flags); + setExtendedBG(xw); + }); + break; + default: + skip += NPARAM; + break; + } + } + ResetState(sp); + break; + + /* DSR (except for the '?') is a superset of CPR */ + case CASE_DSR: + sp->private_function = True; + + /* FALLTHRU */ + case CASE_CPR: + TRACE(("CASE_DSR - device status report\n")); + count = 0; + init_reply(ANSI_CSI); + reply.a_pintro = CharOf(sp->private_function ? '?' : 0); + reply.a_inters = 0; + reply.a_final = 'n'; + + switch (GetParam(0)) { + case 5: + TRACE(("...request operating status\n")); + /* operating status */ + reply.a_param[count++] = 0; /* (no malfunction ;-) */ + break; + case 6: + TRACE(("...request %s\n", + (sp->private_function + ? "DECXCPR" + : "CPR"))); + /* CPR */ + /* DECXCPR (with page=1) */ + value = (screen->cur_row + 1); + if ((xw->flags & ORIGIN) != 0) { + value -= screen->top_marg; + } + reply.a_param[count++] = (ParmType) value; + + value = (screen->cur_col + 1); + if ((xw->flags & ORIGIN) != 0) { + value -= screen->lft_marg; + } + reply.a_param[count++] = (ParmType) value; + + if (sp->private_function + && screen->vtXX_level >= 4) { /* VT420 */ + reply.a_param[count++] = 1; + } + reply.a_final = 'R'; + break; + case 15: + TRACE(("...request printer status\n")); + if (sp->private_function + && screen->vtXX_level >= 2) { /* VT220 */ + reply.a_param[count++] = 13; /* no printer detected */ + } + break; + case 25: + TRACE(("...request UDK status\n")); + if (sp->private_function + && screen->vtXX_level >= 2) { /* VT220 */ + reply.a_param[count++] = 20; /* UDK always unlocked */ + } + break; + case 26: + TRACE(("...request keyboard status\n")); + if (sp->private_function + && screen->vtXX_level >= 2) { /* VT220 */ + reply.a_param[count++] = 27; + reply.a_param[count++] = 1; /* North American */ + if (screen->vtXX_level >= 3) { /* VT320 */ + reply.a_param[count++] = 0; /* ready */ + } + if (screen->vtXX_level >= 4) { /* VT420 */ + reply.a_param[count++] = 0; /* LK201 */ + } + } + break; + case 53: /* according to existing xterm handling */ + /* FALLTHRU */ + case 55: /* according to the VT330/VT340 Text Programming Manual */ + TRACE(("...request locator status\n")); + if (sp->private_function + && screen->vtXX_level >= 3) { /* VT330 */ +#if OPT_DEC_LOCATOR + reply.a_param[count++] = 50; /* locator ready */ +#else + reply.a_param[count++] = 53; /* no locator */ +#endif + } + break; + case 56: + TRACE(("...request locator type\n")); + if (sp->private_function + && screen->vtXX_level >= 3) { /* VT330 */ + reply.a_param[count++] = 57; +#if OPT_DEC_LOCATOR + reply.a_param[count++] = 1; /* mouse */ +#else + reply.a_param[count++] = 0; /* unknown */ +#endif + } + break; + case 62: + TRACE(("...request DECMSR - macro space\n")); + if (sp->private_function + && screen->vtXX_level >= 4) { /* VT420 */ + reply.a_pintro = 0; + reply.a_radix[count] = 16; /* no data */ + reply.a_param[count++] = 0; /* no space for macros */ + reply.a_inters = '*'; + reply.a_final = L_CURL; + } + break; + case 63: + TRACE(("...request DECCKSR - memory checksum\n")); + /* DECCKSR - Memory checksum */ + if (sp->private_function + && screen->vtXX_level >= 4) { /* VT420 */ + init_reply(ANSI_DCS); + reply.a_param[count++] = (ParmType) GetParam(1); /* PID */ + reply.a_delim = "!~"; /* delimiter */ + reply.a_radix[count] = 16; /* use hex */ + reply.a_param[count++] = 0; /* no data */ + } + break; + case 75: + TRACE(("...request data integrity\n")); + if (sp->private_function + && screen->vtXX_level >= 4) { /* VT420 */ + reply.a_param[count++] = 70; /* no errors */ + } + break; + case 85: + TRACE(("...request multi-session configuration\n")); + if (sp->private_function + && screen->vtXX_level >= 4) { /* VT420 */ + reply.a_param[count++] = 83; /* not configured */ + } + break; + default: + break; + } + + if ((reply.a_nparam = (ParmType) count) != 0) + unparseseq(xw, &reply); + + ResetState(sp); + sp->private_function = False; + break; + + case CASE_MC: + TRACE(("CASE_MC - media control\n")); + xtermMediaControl(xw, GetParam(0), False); + ResetState(sp); + break; + + case CASE_DEC_MC: + TRACE(("CASE_DEC_MC - DEC media control\n")); + xtermMediaControl(xw, GetParam(0), True); + ResetState(sp); + break; + + case CASE_HP_MEM_LOCK: + /* FALLTHRU */ + case CASE_HP_MEM_UNLOCK: + TRACE(("%s\n", ((sp->parsestate[c] == CASE_HP_MEM_LOCK) + ? "CASE_HP_MEM_LOCK" + : "CASE_HP_MEM_UNLOCK"))); + if (screen->scroll_amt) + FlushScroll(xw); + if (sp->parsestate[c] == CASE_HP_MEM_LOCK) + set_tb_margins(screen, screen->cur_row, screen->bot_marg); + else + set_tb_margins(screen, 0, screen->bot_marg); + ResetState(sp); + break; + + case CASE_DECSTBM: + TRACE(("CASE_DECSTBM - set scrolling region\n")); + { + int top; + int bot; + top = one_if_default(0); + if (nparam < 2 || (bot = GetParam(1)) == DEFAULT + || bot > MaxRows(screen) + || bot == 0) + bot = MaxRows(screen); + if (bot > top) { + if (screen->scroll_amt) + FlushScroll(xw); + set_tb_margins(screen, top - 1, bot - 1); + CursorSet(screen, 0, 0, xw->flags); + } + ResetState(sp); + } + break; + + case CASE_DECREQTPARM: + TRACE(("CASE_DECREQTPARM\n")); + if (screen->terminal_id < 200) { /* VT102 */ + value = zero_if_default(0); + if (value == 0 || value == 1) { + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 7; + reply.a_param[0] = (ParmType) (value + 2); + reply.a_param[1] = 1; /* no parity */ + reply.a_param[2] = 1; /* eight bits */ + reply.a_param[3] = 128; /* transmit 38.4k baud */ + reply.a_param[4] = 128; /* receive 38.4k baud */ + reply.a_param[5] = 1; /* clock multiplier ? */ + reply.a_param[6] = 0; /* STP flags ? */ + reply.a_inters = 0; + reply.a_final = 'x'; + unparseseq(xw, &reply); + } + } + ResetState(sp); + break; + + case CASE_DECSET: + /* DECSET */ +#if OPT_VT52_MODE + if (screen->vtXX_level != 0) +#endif + dpmodes(xw, bitset); + ResetState(sp); +#if OPT_TEK4014 + if (TEK4014_ACTIVE(xw)) { + TRACE(("Tek4014 is now active...\n")); + return False; + } +#endif + break; + + case CASE_DECRST: + /* DECRST */ + dpmodes(xw, bitclr); + init_groundtable(screen, sp); + ResetState(sp); + break; + + case CASE_DECALN: + TRACE(("CASE_DECALN - alignment test\n")); + if (screen->cursor_state) + HideCursor(); + /* + * DEC STD 070 does not mention left/right margins. Likely the + * text was for VT100, and not updated for VT420. + */ + resetRendition(xw); + resetMargins(xw); + CursorSet(screen, 0, 0, xw->flags); + xtermParseRect(xw, 0, 0, &myRect); + ScrnFillRectangle(xw, &myRect, 'E', 0, False); + ResetState(sp); + break; + + case CASE_GSETS5: + if (screen->vtXX_level < 5) { + ResetState(sp); + break; + } + /* FALLTHRU */ + case CASE_GSETS3: + if (screen->vtXX_level < 3) { + ResetState(sp); + break; + } + /* FALLTHRU */ + case CASE_GSETS: + if (screen->vtXX_level >= 2 || strchr("012AB", (int) c) != 0) { + TRACE(("CASE_GSETS(%d) = '%c'\n", sp->scstype, c)); + xtermDecodeSCS(xw, sp->scstype, 0, (int) c); + } + ResetState(sp); + break; + + case CASE_ANSI_SC: + if (IsLeftRightMode(xw)) { + int left; + int right; + + TRACE(("CASE_DECSLRM - set left and right margin\n")); + left = one_if_default(0); + if (nparam < 2 || (right = GetParam(1)) == DEFAULT + || right > MaxCols(screen) + || right == 0) + right = MaxCols(screen); + if (right > left) { + set_lr_margins(screen, left - 1, right - 1); + CursorSet(screen, 0, 0, xw->flags); + } + } else { + TRACE(("CASE_ANSI_SC - save cursor\n")); + CursorSave(xw); + } + ResetState(sp); + break; + + case CASE_DECSC: + TRACE(("CASE_DECSC - save cursor\n")); + CursorSave(xw); + ResetState(sp); + break; + + case CASE_ANSI_RC: + /* FALLTHRU */ + case CASE_DECRC: + TRACE(("CASE_%sRC - restore cursor\n", + (sp->nextstate == CASE_DECRC) ? "DEC" : "ANSI_")); + CursorRestore(xw); + if_OPT_ISO_COLORS(screen, { + setExtendedFG(xw); + }); + ResetState(sp); + break; + + case CASE_DECKPAM: + TRACE(("CASE_DECKPAM\n")); + xw->keyboard.flags |= MODE_DECKPAM; + update_appkeypad(); + ResetState(sp); + break; + + case CASE_DECKPNM: + TRACE(("CASE_DECKPNM\n")); + UIntClr(xw->keyboard.flags, MODE_DECKPAM); + update_appkeypad(); + ResetState(sp); + break; + + case CASE_CSI_QUOTE_STATE: + sp->parsestate = csi_quo_table; + break; + +#if OPT_BLINK_CURS + case CASE_CSI_SPACE_STATE: + sp->parsestate = csi_sp_table; + break; + + case CASE_DECSCUSR: + TRACE(("CASE_DECSCUSR\n")); + { + Boolean change = True; + int blinks = screen->cursor_blink_esc; + + HideCursor(); + + switch (GetParam(0)) { + case DEFAULT: + /* FALLTHRU */ + case DEFAULT_STYLE: + /* FALLTHRU */ + case BLINK_BLOCK: + blinks = True; + screen->cursor_shape = CURSOR_BLOCK; + break; + case STEADY_BLOCK: + blinks = False; + screen->cursor_shape = CURSOR_BLOCK; + break; + case BLINK_UNDERLINE: + blinks = True; + screen->cursor_shape = CURSOR_UNDERLINE; + break; + case STEADY_UNDERLINE: + blinks = False; + screen->cursor_shape = CURSOR_UNDERLINE; + break; + case BLINK_BAR: + blinks = True; + screen->cursor_shape = CURSOR_BAR; + break; + case STEADY_BAR: + blinks = False; + screen->cursor_shape = CURSOR_BAR; + break; + default: + change = False; + break; + } + TRACE(("cursor_shape:%d blinks:%s\n", + screen->cursor_shape, BtoS(blinks))); + if (change) { + xtermSetCursorBox(screen); + screen->cursor_blink_esc = blinks; + UpdateCursorBlink(xw); + } + } + ResetState(sp); + break; +#endif + +#if OPT_SCROLL_LOCK + case CASE_DECLL: + TRACE(("CASE_DECLL\n")); + if (nparam > 0) { + for (count = 0; count < nparam; ++count) { + int op = zero_if_default(count); + switch (op) { + case 0: + case DEFAULT: + xtermClearLEDs(screen); + break; + case 1: + /* FALLTHRU */ + case 2: + /* FALLTHRU */ + case 3: + xtermShowLED(screen, + (Cardinal) op, + True); + break; + case 21: + /* FALLTHRU */ + case 22: + /* FALLTHRU */ + case 23: + xtermShowLED(screen, + (Cardinal) (op - 20), + True); + break; + } + } + } else { + xtermClearLEDs(screen); + } + ResetState(sp); + break; +#endif + +#if OPT_VT52_MODE + case CASE_VT52_FINISH: + TRACE(("CASE_VT52_FINISH terminal_id %d, vtXX_level %d\n", + screen->terminal_id, + screen->vtXX_level)); + if (screen->terminal_id >= 100 + && screen->vtXX_level == 0) { + sp->groundtable = + sp->parsestate = ansi_table; + /* + * On restore, the terminal does not recognize DECRQSS for + * DECSCL (per vttest). + */ + screen->vtXX_level = 1; + xw->flags = screen->vt52_save_flags; + screen->curgl = screen->vt52_save_curgl; + screen->curgr = screen->vt52_save_curgr; + screen->curss = screen->vt52_save_curss; + restoreCharsets(screen, screen->vt52_save_gsets); + update_vt52_vt100_settings(); + } + break; +#endif + + case CASE_ANSI_LEVEL_1: + TRACE(("CASE_ANSI_LEVEL_1\n")); + set_ansi_conformance(screen, 1); + ResetState(sp); + break; + + case CASE_ANSI_LEVEL_2: + TRACE(("CASE_ANSI_LEVEL_2\n")); + set_ansi_conformance(screen, 2); + ResetState(sp); + break; + + case CASE_ANSI_LEVEL_3: + TRACE(("CASE_ANSI_LEVEL_3\n")); + set_ansi_conformance(screen, 3); + ResetState(sp); + break; + + case CASE_DECSCL: + TRACE(("CASE_DECSCL(%d,%d)\n", GetParam(0), GetParam(1))); + /* + * This changes the emulation level, and is not recognized by + * VT100s. However, a VT220 or above can be set to conformance + * level 1 to act like a VT100. + */ + if (screen->terminal_id >= 200) { + /* + * Disallow unrecognized parameters, as well as attempts to set + * the operating level higher than the given terminal-id. + */ + if (GetParam(0) >= 61 + && GetParam(0) <= 60 + (screen->terminal_id / 100)) { + int new_vtXX_level = GetParam(0) - 60; + int case_value = zero_if_default(1); + /* + * Note: + * + * The VT300, VT420, VT520 manuals claim that DECSCL does a + * hard reset (RIS). + * + * Both the VT220 manual and DEC STD 070 (which documents + * levels 1-4 in detail) state that it is a soft reset. + * + * Perhaps both sets of manuals are right (unlikely). + * Kermit says it's soft. + */ + ReallyReset(xw, False, False); + init_parser(xw, sp); + screen->vtXX_level = new_vtXX_level; + if (new_vtXX_level > 1) { + switch (case_value) { + case 1: + show_8bit_control(False); + break; + case 0: + case 2: + show_8bit_control(True); + break; + } + } + } + } + ResetState(sp); + break; + + case CASE_DECSCA: + TRACE(("CASE_DECSCA\n")); + screen->protected_mode = DEC_PROTECT; + if (GetParam(0) <= 0 || GetParam(0) == 2) { + UIntClr(xw->flags, PROTECTED); + TRACE(("...clear PROTECTED\n")); + } else if (GetParam(0) == 1) { + xw->flags |= PROTECTED; + TRACE(("...set PROTECTED\n")); + } + ResetState(sp); + break; + + case CASE_DECSED: + TRACE(("CASE_DECSED\n")); + do_erase_display(xw, zero_if_default(0), DEC_PROTECT); + ResetState(sp); + break; + + case CASE_DECSEL: + TRACE(("CASE_DECSEL\n")); + do_erase_line(xw, zero_if_default(0), DEC_PROTECT); + ResetState(sp); + break; + + case CASE_GRAPHICS_ATTRIBUTES: +#if OPT_GRAPHICS + TRACE(("CASE_GRAPHICS_ATTRIBUTES\n")); + { + /* request: item, action, value */ + /* reply: item, status, value */ + if (nparam != 3) { + TRACE(("DATA_ERROR: malformed CASE_GRAPHICS_ATTRIBUTES request with %d parameters\n", nparam)); + } else { + int status = 3; /* assume failure */ + int result = 0; + int result2 = 0; + + TRACE(("CASE_GRAPHICS_ATTRIBUTES request: %d, %d, %d\n", + GetParam(0), GetParam(1), GetParam(2))); + switch (GetParam(0)) { + case 1: /* color register count */ + switch (GetParam(1)) { + case 1: /* read */ + status = 0; /* success */ + result = (int) get_color_register_count(screen); + break; + case 2: /* reset */ + screen->numcolorregisters = 0; + status = 0; /* success */ + result = (int) get_color_register_count(screen); + break; + case 3: /* set */ + if (GetParam(2) > 1 && + (unsigned) GetParam(2) <= MAX_COLOR_REGISTERS) { + screen->numcolorregisters = GetParam(2); + status = 0; /* success */ + result = (int) get_color_register_count(screen); + } + break; + case 4: /* read maximum */ + status = 0; /* success */ + result = MAX_COLOR_REGISTERS; + break; + default: + TRACE(("DATA_ERROR: CASE_GRAPHICS_ATTRIBUTES color register count request with unknown action parameter: %d\n", + GetParam(1))); + status = 2; /* error in Pa */ + break; + } + break; + case 2: /* graphics geometry */ + switch (GetParam(1)) { + case 1: /* read */ + TRACE(("Get sixel graphics geometry\n")); + status = 0; /* success */ + result = Min(Width(screen), screen->graphics_max_wide); + result2 = Min(Height(screen), screen->graphics_max_high); + break; + case 2: /* reset */ + /* FALLTHRU */ + case 3: /* set */ + break; + case 4: /* read maximum */ + status = 0; /* success */ + result = screen->graphics_max_wide; + result2 = screen->graphics_max_high; + break; + default: + TRACE(("DATA_ERROR: CASE_GRAPHICS_ATTRIBUTES graphics geometry request with unknown action parameter: %d\n", + GetParam(1))); + status = 2; /* error in Pa */ + break; + } + break; +# if OPT_REGIS_GRAPHICS + case 3: /* ReGIS geometry */ + switch (GetParam(1)) { + case 1: /* read */ + status = 0; /* success */ + result = screen->graphics_regis_def_wide; + result2 = screen->graphics_regis_def_high; + break; + case 2: /* reset */ + /* FALLTHRU */ + case 3: /* set */ + /* FALLTHRU */ + case 4: /* read maximum */ + /* not implemented */ + break; + default: + TRACE(("DATA_ERROR: CASE_GRAPHICS_ATTRIBUTES ReGIS geometry request with unknown action parameter: %d\n", + GetParam(1))); + status = 2; /* error in Pa */ + break; + } + break; +#endif + default: + TRACE(("DATA_ERROR: CASE_GRAPHICS_ATTRIBUTES request with unknown item parameter: %d\n", + GetParam(0))); + status = 1; + break; + } + + init_reply(ANSI_CSI); + reply.a_pintro = '?'; + count = 0; + reply.a_param[count++] = (ParmType) GetParam(0); + reply.a_param[count++] = (ParmType) status; + reply.a_param[count++] = (ParmType) result; + if (GetParam(0) >= 2) + reply.a_param[count++] = (ParmType) result2; + reply.a_nparam = (ParmType) count; + reply.a_inters = 0; + reply.a_final = 'S'; + unparseseq(xw, &reply); + } + } +#endif + ResetState(sp); + break; + + case CASE_ST: + TRACE(("CASE_ST: End of String (%lu bytes) (mode=%d)\n", + (unsigned long) sp->string_used, + sp->string_mode)); + ResetState(sp); + if (!sp->string_used) + break; + sp->string_area[--(sp->string_used)] = '\0'; + switch (sp->string_mode) { + case ANSI_APC: + /* ignored */ + break; + case ANSI_DCS: + do_dcs(xw, sp->string_area, sp->string_used); + break; + case ANSI_OSC: + do_osc(xw, sp->string_area, sp->string_used, ANSI_ST); + break; + case ANSI_PM: + /* ignored */ + break; + case ANSI_SOS: + /* ignored */ + break; + default: + TRACE(("unknown mode\n")); + break; + } + break; + + case CASE_SOS: + TRACE(("CASE_SOS: Start of String\n")); + if (ParseSOS(screen)) { + sp->string_mode = ANSI_SOS; + sp->parsestate = sos_table; + } else { + illegal_parse(xw, c, sp); + } + break; + + case CASE_PM: + TRACE(("CASE_PM: Privacy Message\n")); + if (ParseSOS(screen)) { + sp->string_mode = ANSI_PM; + sp->parsestate = sos_table; + } else { + illegal_parse(xw, c, sp); + } + break; + + case CASE_DCS: + TRACE(("CASE_DCS: Device Control String\n")); + sp->string_mode = ANSI_DCS; + sp->parsestate = sos_table; + break; + + case CASE_APC: + TRACE(("CASE_APC: Application Program Command\n")); + if (ParseSOS(screen)) { + sp->string_mode = ANSI_APC; + sp->parsestate = sos_table; + } else { + illegal_parse(xw, c, sp); + } + break; + + case CASE_SPA: + TRACE(("CASE_SPA - start protected area\n")); + screen->protected_mode = ISO_PROTECT; + xw->flags |= PROTECTED; + ResetState(sp); + break; + + case CASE_EPA: + TRACE(("CASE_EPA - end protected area\n")); + UIntClr(xw->flags, PROTECTED); + ResetState(sp); + break; + + case CASE_SU: + TRACE(("CASE_SU - scroll up\n")); + xtermScroll(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_SL: /* ISO 6429, non-DEC */ + TRACE(("CASE_SL - scroll left\n")); + xtermScrollLR(xw, one_if_default(0), True); + ResetState(sp); + break; + + case CASE_SR: /* ISO 6429, non-DEC */ + TRACE(("CASE_SR - scroll right\n")); + xtermScrollLR(xw, one_if_default(0), False); + ResetState(sp); + break; + + case CASE_DECDC: + TRACE(("CASE_DC - delete column\n")); + if (screen->vtXX_level >= 4) { + xtermColScroll(xw, one_if_default(0), True, screen->cur_col); + } + ResetState(sp); + break; + + case CASE_DECIC: + TRACE(("CASE_IC - insert column\n")); + if (screen->vtXX_level >= 4) { + xtermColScroll(xw, one_if_default(0), False, screen->cur_col); + } + ResetState(sp); + break; + + case CASE_DECBI: + TRACE(("CASE_BI - back index\n")); + if (screen->vtXX_level >= 4) { + xtermColIndex(xw, True); + } + ResetState(sp); + break; + + case CASE_DECFI: + TRACE(("CASE_FI - forward index\n")); + if (screen->vtXX_level >= 4) { + xtermColIndex(xw, False); + } + ResetState(sp); + break; + + case CASE_IND: + TRACE(("CASE_IND - index\n")); + xtermIndex(xw, 1); + do_xevents(xw); + ResetState(sp); + break; + + case CASE_CPL: + TRACE(("CASE_CPL - cursor prev line\n")); + CursorPrevLine(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_CNL: + TRACE(("CASE_CNL - cursor next line\n")); + CursorNextLine(xw, one_if_default(0)); + ResetState(sp); + break; + + case CASE_NEL: + TRACE(("CASE_NEL\n")); + xtermIndex(xw, 1); + CarriageReturn(xw); + ResetState(sp); + break; + + case CASE_HTS: + TRACE(("CASE_HTS - horizontal tab set\n")); + TabSet(xw->tabs, screen->cur_col); + ResetState(sp); + break; + + case CASE_REPORT_VERSION: + TRACE(("CASE_REPORT_VERSION - report terminal version\n")); + if (GetParam(0) <= 0) { + unparseputc1(xw, ANSI_DCS); + unparseputc(xw, '>'); + unparseputc(xw, '|'); + unparseputs(xw, xtermVersion()); + unparseputc1(xw, ANSI_ST); + unparse_end(xw); + } + ResetState(sp); + break; + + case CASE_RI: + TRACE(("CASE_RI - reverse index\n")); + RevIndex(xw, 1); + ResetState(sp); + break; + + case CASE_SS2: + TRACE(("CASE_SS2\n")); + screen->curss = 2; + ResetState(sp); + break; + + case CASE_SS3: + TRACE(("CASE_SS3\n")); + screen->curss = 3; + ResetState(sp); + break; + + case CASE_CSI_STATE: + /* enter csi state */ + InitParams(); + SetParam(nparam++, DEFAULT); + sp->parsestate = csi_table; + break; + + case CASE_ESC_SP_STATE: + /* esc space */ + sp->parsestate = esc_sp_table; + break; + + case CASE_CSI_EX_STATE: + /* csi exclamation */ + sp->parsestate = csi_ex_table; + break; + + case CASE_CSI_TICK_STATE: + /* csi tick (') */ + sp->parsestate = csi_tick_table; + break; + +#if OPT_DEC_LOCATOR + case CASE_DECEFR: + TRACE(("CASE_DECEFR - Enable Filter Rectangle\n")); + if (okSendMousePos(xw) == DEC_LOCATOR) { + MotionOff(screen, xw); + if ((screen->loc_filter_top = GetParam(0)) < 1) + screen->loc_filter_top = LOC_FILTER_POS; + if (nparam < 2 + || (screen->loc_filter_left = GetParam(1)) < 1) + screen->loc_filter_left = LOC_FILTER_POS; + if (nparam < 3 + || (screen->loc_filter_bottom = GetParam(2)) < 1) + screen->loc_filter_bottom = LOC_FILTER_POS; + if (nparam < 4 + || (screen->loc_filter_right = GetParam(3)) < 1) + screen->loc_filter_right = LOC_FILTER_POS; + InitLocatorFilter(xw); + } + ResetState(sp); + break; + + case CASE_DECELR: + MotionOff(screen, xw); + if (GetParam(0) <= 0 || GetParam(0) > 2) { + screen->send_mouse_pos = MOUSE_OFF; + TRACE(("DECELR - Disable Locator Reports\n")); + } else { + TRACE(("DECELR - Enable Locator Reports\n")); + screen->send_mouse_pos = DEC_LOCATOR; + xtermShowPointer(xw, True); + if (GetParam(0) == 2) { + screen->locator_reset = True; + } else { + screen->locator_reset = False; + } + if (nparam < 2 || GetParam(1) != 1) { + screen->locator_pixels = False; + } else { + screen->locator_pixels = True; + } + screen->loc_filter = False; + } + ResetState(sp); + break; + + case CASE_DECSLE: + TRACE(("DECSLE - Select Locator Events\n")); + for (count = 0; count < nparam; ++count) { + switch (zero_if_default(count)) { + case 0: + MotionOff(screen, xw); + screen->loc_filter = False; + screen->locator_events = 0; + break; + case 1: + screen->locator_events |= LOC_BTNS_DN; + break; + case 2: + UIntClr(screen->locator_events, LOC_BTNS_DN); + break; + case 3: + screen->locator_events |= LOC_BTNS_UP; + break; + case 4: + UIntClr(screen->locator_events, LOC_BTNS_UP); + break; + } + } + ResetState(sp); + break; + + case CASE_DECRQLP: + TRACE(("DECRQLP - Request Locator Position\n")); + if (GetParam(0) < 2) { + /* Issue DECLRP Locator Position Report */ + GetLocatorPosition(xw); + } + ResetState(sp); + break; +#endif /* OPT_DEC_LOCATOR */ + +#if OPT_DEC_RECTOPS + case CASE_CSI_DOLLAR_STATE: + TRACE(("CASE_CSI_DOLLAR_STATE\n")); + /* csi dollar ($) */ + if (screen->vtXX_level >= 3) + sp->parsestate = csi_dollar_table; + else + sp->parsestate = eigtable; + break; + + case CASE_CSI_STAR_STATE: + TRACE(("CASE_CSI_STAR_STATE\n")); + /* csi star (*) */ + if (screen->vtXX_level >= 4) + sp->parsestate = csi_star_table; + else + sp->parsestate = eigtable; + break; + + case CASE_DECRQCRA: + if (screen->vtXX_level >= 4 && AllowWindowOps(xw, ewGetChecksum)) { + int checksum; + int pid; + + TRACE(("CASE_DECRQCRA - Request checksum of rectangular area\n")); + xtermCheckRect(xw, ParamPair(0), &checksum); + init_reply(ANSI_DCS); + count = 0; + checksum &= 0xffff; + pid = GetParam(0); + reply.a_param[count++] = (ParmType) pid; + reply.a_delim = "!~"; /* delimiter */ + reply.a_radix[count] = 16; + reply.a_param[count++] = (ParmType) checksum; + reply.a_nparam = (ParmType) count; + TRACE(("...checksum(%d) = %04X\n", pid, checksum)); + unparseseq(xw, &reply); + } + ResetState(sp); + break; + + case CASE_DECCRA: + if (screen->vtXX_level >= 4) { + TRACE(("CASE_DECCRA - Copy rectangular area\n")); + xtermParseRect(xw, ParamPair(0), &myRect); + ScrnCopyRectangle(xw, &myRect, ParamPair(5)); + } + ResetState(sp); + break; + + case CASE_DECERA: + if (screen->vtXX_level >= 4) { + TRACE(("CASE_DECERA - Erase rectangular area\n")); + xtermParseRect(xw, ParamPair(0), &myRect); + ScrnFillRectangle(xw, &myRect, ' ', xw->flags, True); + } + ResetState(sp); + break; + + case CASE_DECFRA: + if (screen->vtXX_level >= 4) { + value = zero_if_default(0); + + TRACE(("CASE_DECFRA - Fill rectangular area\n")); + if (nparam > 0 && CharWidth(value) > 0) { + xtermParseRect(xw, ParamPair(1), &myRect); + ScrnFillRectangle(xw, &myRect, value, xw->flags, True); + } + } + ResetState(sp); + break; + + case CASE_DECSERA: + if (screen->vtXX_level >= 4) { + TRACE(("CASE_DECSERA - Selective erase rectangular area\n")); + xtermParseRect(xw, ParamPair(0), &myRect); + ScrnWipeRectangle(xw, &myRect); + } + ResetState(sp); + break; + + case CASE_DECSACE: + TRACE(("CASE_DECSACE - Select attribute change extent\n")); + screen->cur_decsace = zero_if_default(0); + ResetState(sp); + break; + + case CASE_DECCARA: + if (screen->vtXX_level >= 4) { + TRACE(("CASE_DECCARA - Change attributes in rectangular area\n")); + xtermParseRect(xw, ParamPair(0), &myRect); + ScrnMarkRectangle(xw, &myRect, False, ParamPair(4)); + } + ResetState(sp); + break; + + case CASE_DECRARA: + if (screen->vtXX_level >= 4) { + TRACE(("CASE_DECRARA - Reverse attributes in rectangular area\n")); + xtermParseRect(xw, ParamPair(0), &myRect); + ScrnMarkRectangle(xw, &myRect, True, ParamPair(4)); + } + ResetState(sp); + break; + + case CASE_DECSCPP: + if (screen->vtXX_level >= 3) { + TRACE(("CASE_DECSCPP\n")); + /* default and 0 are "80", with "132" as the other legal choice */ + switch (zero_if_default(0)) { + case 0: + case 80: + value = 80; + break; + case 132: + value = 132; + break; + default: + value = -1; + break; + } + if (value > 0) { + if (screen->cur_col + 1 > value) + CursorSet(screen, screen->cur_row, value - 1, xw->flags); + UIntClr(xw->flags, IN132COLUMNS); + if (value == 132) + UIntSet(xw->flags, IN132COLUMNS); + RequestResize(xw, -1, value, True); + } + } + ResetState(sp); + break; + + case CASE_DECSNLS: + if (screen->vtXX_level >= 4 && AllowWindowOps(xw, ewSetWinLines)) { + TRACE(("CASE_DECSNLS\n")); + value = zero_if_default(0); + if (value >= 1 && value <= 255) { + RequestResize(xw, value, -1, True); + } + } + ResetState(sp); + break; + + case CASE_DECRQPSR: +#define reply_char(n,c) do { reply.a_radix[(n)] = 1; reply.a_param[(n)++] = (ParmType)(c); } while (0) +#define reply_bit(n,c) ((n) ? (c) : 0) + if (screen->vtXX_level >= 3) { + TRACE(("CASE_DECRQPSR\n")); + switch (GetParam(0)) { + case 1: + TRACE(("...DECCIR\n")); + init_reply(ANSI_DCS); + count = 0; + reply_char(count, '1'); + reply_char(count, '$'); + reply_char(count, 'u'); + reply.a_param[count++] = (ParmType) (screen->cur_row + 1); + reply.a_param[count++] = (ParmType) (screen->cur_col + 1); + reply.a_param[count++] = (ParmType) thispage; + reply_char(count, ';'); + reply_char(count, (0x40 + | reply_bit(xw->flags & INVERSE, 8) + | reply_bit(xw->flags & BLINK, 4) + | reply_bit(xw->flags & UNDERLINE, 2) + | reply_bit(xw->flags & BOLD, 1) + )); + reply_char(count, ';'); + reply_char(count, 0x40 | + reply_bit(screen->protected_mode & + DEC_PROTECT, 1) + ); + reply_char(count, ';'); + reply_char(count, (0x40 + | reply_bit(screen->do_wrap, 8) + | reply_bit((screen->curss == 3), 4) + | reply_bit((screen->curss == 2), 2) + | reply_bit(xw->flags & ORIGIN, 1) + )); + reply_char(count, ';'); + reply.a_param[count++] = screen->curgl; + reply.a_param[count++] = screen->curgr; + reply_char(count, ';'); + reply_char(count, 0x4f); /* assert all 96's */ + reply_char(count, ';'); + for (item = 0; item < NUM_GSETS; ++item) { + char *temp = encode_scs(screen->gsets[item]); + while (*temp != '\0') { + reply_char(count, *temp++); + } + } + reply.a_nparam = (ParmType) count; + unparseseq(xw, &reply); + break; + case 2: + TRACE(("...DECTABSR\n")); + init_reply(ANSI_DCS); + reply.a_delim = "/"; + count = 0; + reply_char(count, '2'); + reply_char(count, '$'); + reply_char(count, 'u'); + for (item = 0; item < MAX_TABS; ++item) { + if (count + 1 >= NPARAM) + break; + if (TabIsSet(xw->tabs, item)) { + reply.a_param[count++] = (ParmType) (item + 1); + } + if (item > screen->max_col) + break; + } + reply.a_nparam = (ParmType) count; + unparseseq(xw, &reply); + break; + } + } + ResetState(sp); + break; + + case CASE_RQM: + TRACE(("CASE_RQM\n")); + do_ansi_rqm(xw, ParamPair(0)); + ResetState(sp); + break; + + case CASE_DECRQM: + TRACE(("CASE_DECRQM\n")); + do_dec_rqm(xw, ParamPair(0)); + ResetState(sp); + break; + + case CASE_CSI_DEC_DOLLAR_STATE: + TRACE(("CASE_CSI_DEC_DOLLAR_STATE\n")); + /* csi ? dollar ($) */ + sp->parsestate = csi_dec_dollar_table; + break; +#else + case CASE_CSI_DOLLAR_STATE: + /* csi dollar ($) */ + sp->parsestate = eigtable; + break; + + case CASE_CSI_STAR_STATE: + /* csi dollar (*) */ + sp->parsestate = eigtable; + break; + + case CASE_CSI_DEC_DOLLAR_STATE: + /* csi ? dollar ($) */ + sp->parsestate = eigtable; + break; +#endif /* OPT_DEC_RECTOPS */ + +#if OPT_XTERM_SGR + case CASE_CSI_HASH_STATE: + TRACE(("CASE_CSI_HASH_STATE\n")); + /* csi hash (#) */ + sp->parsestate = csi_hash_table; + break; + + case CASE_XTERM_CHECKSUM: +#if OPT_DEC_RECTOPS + if (screen->vtXX_level >= 4 && AllowWindowOps(xw, ewSetChecksum)) { + TRACE(("CASE_XTERM_CHECKSUM\n")); + screen->checksum_ext = zero_if_default(0); + } +#endif + ResetState(sp); + break; + + case CASE_XTERM_PUSH_SGR: + TRACE(("CASE_XTERM_PUSH_SGR\n")); + value = 0; + if (nparam == 0 || (nparam == 1 && GetParam(0) == DEFAULT)) { + value = DEFAULT; + } else if (nparam > 0) { + for (count = 0; count < nparam; ++count) { + item = zero_if_default(count); + /* deprecated - for compatibility */ +#if OPT_ISO_COLORS + if (item == psFG_COLOR_obs) { + item = psFG_COLOR; + } else if (item == psBG_COLOR_obs) { + item = psBG_COLOR; + } +#endif + if (item > 0 && item < MAX_PUSH_SGR) { + value |= (1 << (item - 1)); + } + } + } + xtermPushSGR(xw, value); + ResetState(sp); + break; + + case CASE_XTERM_REPORT_SGR: + TRACE(("CASE_XTERM_REPORT_SGR\n")); + xtermParseRect(xw, ParamPair(0), &myRect); + xtermReportSGR(xw, &myRect); + ResetState(sp); + break; + + case CASE_XTERM_POP_SGR: + TRACE(("CASE_XTERM_POP_SGR\n")); + xtermPopSGR(xw); + ResetState(sp); + break; + + case CASE_XTERM_PUSH_COLORS: + TRACE(("CASE_XTERM_PUSH_COLORS\n")); + if (nparam == 0) { + xtermPushColors(xw, DEFAULT); + } else { + for (count = 0; count < nparam; ++count) { + xtermPushColors(xw, GetParam(count)); + } + } + ResetState(sp); + break; + + case CASE_XTERM_POP_COLORS: + TRACE(("CASE_XTERM_POP_COLORS\n")); + if (nparam == 0) { + xtermPopColors(xw, DEFAULT); + } else { + for (count = 0; count < nparam; ++count) { + xtermPopColors(xw, GetParam(count)); + } + } + ResetState(sp); + break; + + case CASE_XTERM_REPORT_COLORS: + TRACE(("CASE_XTERM_REPORT_COLORS\n")); + xtermReportColors(xw); + ResetState(sp); + break; +#endif + + case CASE_S7C1T: + TRACE(("CASE_S7C1T\n")); + if (screen->vtXX_level >= 2) { + show_8bit_control(False); + ResetState(sp); + } + break; + + case CASE_S8C1T: + TRACE(("CASE_S8C1T\n")); + if (screen->vtXX_level >= 2) { + show_8bit_control(True); + ResetState(sp); + } + break; + + case CASE_OSC: + TRACE(("CASE_OSC: Operating System Command\n")); + sp->parsestate = sos_table; + sp->string_mode = ANSI_OSC; + break; + + case CASE_RIS: + TRACE(("CASE_RIS\n")); + VTReset(xw, True, True); + /* NOTREACHED */ + + case CASE_DECSTR: + TRACE(("CASE_DECSTR\n")); + VTReset(xw, False, False); + /* NOTREACHED */ + + case CASE_REP: + TRACE(("CASE_REP\n")); + if (CharWidth(sp->lastchar) > 0) { + IChar repeated[2]; + count = one_if_default(0); + repeated[0] = (IChar) sp->lastchar; + while (count-- > 0) { + dotext(xw, + screen->gsets[(int) (screen->curgl)], + repeated, 1); + } + } + ResetState(sp); + break; + + case CASE_LS2: + TRACE(("CASE_LS2\n")); + screen->curgl = 2; + ResetState(sp); + break; + + case CASE_LS3: + TRACE(("CASE_LS3\n")); + screen->curgl = 3; + ResetState(sp); + break; + + case CASE_LS3R: + TRACE(("CASE_LS3R\n")); + screen->curgr = 3; + ResetState(sp); + break; + + case CASE_LS2R: + TRACE(("CASE_LS2R\n")); + screen->curgr = 2; + ResetState(sp); + break; + + case CASE_LS1R: + TRACE(("CASE_LS1R\n")); + screen->curgr = 1; + ResetState(sp); + break; + + case CASE_XTERM_SAVE: + savemodes(xw); + ResetState(sp); + break; + + case CASE_XTERM_RESTORE: + restoremodes(xw); + ResetState(sp); + break; + + case CASE_XTERM_WINOPS: + TRACE(("CASE_XTERM_WINOPS\n")); + window_ops(xw); + ResetState(sp); + break; +#if OPT_WIDE_CHARS + case CASE_ESC_PERCENT: + TRACE(("CASE_ESC_PERCENT\n")); + sp->parsestate = esc_pct_table; + break; + + case CASE_UTF8: + /* If we did not set UTF-8 mode from resource or the + * command-line, allow it to be enabled/disabled by + * control sequence. + */ + TRACE(("CASE_UTF8 wide:%d, utf8:%d, req:%s\n", + screen->wide_chars, + screen->utf8_mode, + BtoS(c == 'G'))); + if ((!screen->wide_chars) && (c == 'G')) { + WriteNow(); + ChangeToWide(xw); + } + if (screen->wide_chars + && !screen->utf8_always) { + switchPtyData(screen, c == 'G'); + TRACE(("UTF8 mode %s\n", + BtoS(screen->utf8_mode))); + } else { + TRACE(("UTF8 mode NOT turned %s (%s)\n", + BtoS(c == 'G'), + (screen->utf8_mode == uAlways) + ? "UTF-8 mode set from command-line" + : "wideChars resource was not set")); + } + ResetState(sp); + break; + + case CASE_SCS_DQUOTE: + TRACE(("CASE_SCS_DQUOTE\n")); + sp->parsestate = scs_2qt_table; + break; + + case CASE_GSETS_DQUOTE: + if (screen->vtXX_level >= 5) { + TRACE(("CASE_GSETS_DQUOTE(%d) = '%c'\n", sp->scstype, c)); + xtermDecodeSCS(xw, sp->scstype, '"', (int) c); + } + ResetState(sp); + break; + + case CASE_SCS_AMPRSND: + TRACE(("CASE_SCS_AMPRSND\n")); + sp->parsestate = scs_amp_table; + break; + + case CASE_GSETS_AMPRSND: + if (screen->vtXX_level >= 5) { + TRACE(("CASE_GSETS_AMPRSND(%d) = '%c'\n", sp->scstype, c)); + xtermDecodeSCS(xw, sp->scstype, '&', (int) c); + } + ResetState(sp); + break; + + case CASE_SCS_PERCENT: + TRACE(("CASE_SCS_PERCENT\n")); + sp->parsestate = scs_pct_table; + break; + + case CASE_GSETS_PERCENT: + if (screen->vtXX_level >= 3) { + TRACE(("CASE_GSETS_PERCENT(%d) = '%c'\n", sp->scstype, c)); + xtermDecodeSCS(xw, sp->scstype, '%', (int) c); + } + ResetState(sp); + break; +#endif +#if OPT_MOD_FKEYS + case CASE_SET_MOD_FKEYS: + TRACE(("CASE_SET_MOD_FKEYS\n")); + if (nparam >= 1) { + set_mod_fkeys(xw, + GetParam(0), + ((nparam > 1) + ? GetParam(1) + : DEFAULT), + True); + } else { + for (value = 1; value <= 5; ++value) + set_mod_fkeys(xw, value, DEFAULT, True); + } + ResetState(sp); + break; + + case CASE_SET_MOD_FKEYS0: + TRACE(("CASE_SET_MOD_FKEYS0\n")); + if (nparam >= 1 && GetParam(0) != DEFAULT) { + set_mod_fkeys(xw, GetParam(0), -1, False); + } else { + xw->keyboard.modify_now.function_keys = -1; + } + ResetState(sp); + break; +#endif + case CASE_HIDE_POINTER: + TRACE(("CASE_HIDE_POINTER\n")); + if (nparam >= 1 && GetParam(0) != DEFAULT) { + screen->pointer_mode = GetParam(0); + } else { + screen->pointer_mode = DEF_POINTER_MODE; + } + ResetState(sp); + break; + + case CASE_XTERM_SM_TITLE: + TRACE(("CASE_XTERM_SM_TITLE\n")); + if (nparam >= 1) { + int n; + for (n = 0; n < nparam; ++n) { + if (GetParam(n) != DEFAULT) + screen->title_modes |= (1 << GetParam(n)); + } + } else { + screen->title_modes = DEF_TITLE_MODES; + } + TRACE(("...title_modes %#x\n", screen->title_modes)); + ResetState(sp); + break; + + case CASE_XTERM_RM_TITLE: + TRACE(("CASE_XTERM_RM_TITLE\n")); + if (nparam >= 1) { + int n; + for (n = 0; n < nparam; ++n) { + if (GetParam(n) != DEFAULT) + screen->title_modes &= ~(1 << GetParam(n)); + } + } else { + screen->title_modes = DEF_TITLE_MODES; + } + TRACE(("...title_modes %#x\n", screen->title_modes)); + ResetState(sp); + break; + + case CASE_CSI_IGNORE: + sp->parsestate = cigtable; + break; + + case CASE_DECSWBV: + TRACE(("CASE_DECSWBV\n")); + switch (zero_if_default(0)) { + case 2: + /* FALLTHRU */ + case 3: + /* FALLTHRU */ + case 4: + screen->warningVolume = bvLow; + break; + case 5: + /* FALLTHRU */ + case 6: + /* FALLTHRU */ + case 7: + /* FALLTHRU */ + case 8: + screen->warningVolume = bvHigh; + break; + default: + screen->warningVolume = bvOff; + break; + } + TRACE(("...warningVolume %d\n", screen->warningVolume)); + ResetState(sp); + break; + + case CASE_DECSMBV: + TRACE(("CASE_DECSMBV\n")); + switch (zero_if_default(0)) { + case 2: + /* FALLTHRU */ + case 3: + /* FALLTHRU */ + case 4: + screen->marginVolume = bvLow; + break; + case 0: + /* FALLTHRU */ + case 5: + /* FALLTHRU */ + case 6: + /* FALLTHRU */ + case 7: + /* FALLTHRU */ + case 8: + screen->marginVolume = bvHigh; + break; + default: + screen->marginVolume = bvOff; + break; + } + TRACE(("...marginVolume %d\n", screen->marginVolume)); + ResetState(sp); + break; + } + if (sp->parsestate == sp->groundtable) + sp->lastchar = thischar; + } while (0); + +#if OPT_WIDE_CHARS + screen->utf8_inparse = (Boolean) ((screen->utf8_mode != uFalse) + && (sp->parsestate != sos_table)); +#endif + + return True; +} + +static Boolean +redoparsing(XtermWidget xw, unsigned c, struct ParseState *sp, unsigned check) +{ + Boolean result = False; + if (!(sp->check_recur & check)) { + UIntSet(sp->check_recur, check); + result = doparsing(xw, c, sp); + UIntClr(sp->check_recur, check); + } + return result; +} + +static void +VTparse(XtermWidget xw) +{ + Boolean keep_running; + + /* We longjmp back to this point in VTReset() */ + (void) setjmp(vtjmpbuf); + init_parser(xw, &myState); + + do { + keep_running = doparsing(xw, doinput(xw), &myState); + while (myState.defer_used) { + Char *deferred = myState.defer_area; + size_t len = myState.defer_used; + size_t i; + myState.defer_area = NULL; + myState.defer_size = 0; + myState.defer_used = 0; + for (i = 0; i < len; i++) { + (void) doparsing(xw, deferred[i], &myState); + } + free(deferred); + } + } while (keep_running); +} + +static Char *v_buffer; /* pointer to physical buffer */ +static Char *v_bufstr = NULL; /* beginning of area to write */ +static Char *v_bufptr; /* end of area to write */ +static Char *v_bufend; /* end of physical buffer */ + +/* Write data to the pty as typed by the user, pasted with the mouse, + or generated by us in response to a query ESC sequence. */ + +void +v_write(int f, const Char *data, unsigned len) +{ + TRACE2(("v_write(%d:%s)\n", len, visibleChars(data, len))); + if (v_bufstr == NULL) { + if (len > 0) { + v_buffer = (Char *) XtMalloc((Cardinal) len); + v_bufstr = v_buffer; + v_bufptr = v_buffer; + v_bufend = v_buffer + len; + } + if (v_bufstr == NULL) { + return; + } + } + if_DEBUG({ + fprintf(stderr, "v_write called with %u bytes (%ld left over)", + len, (long) (v_bufptr - v_bufstr)); + if (len > 1 && len < 10) + fprintf(stderr, " \"%.*s\"", len, (const char *) data); + fprintf(stderr, "\n"); + }); + +#ifdef VMS + if ((1 << f) != pty_mask) { + tt_write((const char *) data, len); + return; + } +#else /* VMS */ + if (!FD_ISSET(f, &pty_mask)) { + IGNORE_RC(write(f, (const char *) data, (size_t) len)); + return; + } +#endif /* VMS */ + + /* + * Append to the block we already have. + * Always doing this simplifies the code, and + * isn't too bad, either. If this is a short + * block, it isn't too expensive, and if this is + * a long block, we won't be able to write it all + * anyway. + */ + + if (len > 0) { +#if OPT_DABBREV + TScreenOf(term)->dabbrev_working = False; /* break dabbrev sequence */ +#endif + if (v_bufend < v_bufptr + len) { /* we've run out of room */ + if (v_bufstr != v_buffer) { + /* there is unused space, move everything down */ + /* possibly overlapping memmove here */ + if_DEBUG({ + fprintf(stderr, "moving data down %ld\n", + (long) (v_bufstr - v_buffer)); + }); + memmove(v_buffer, v_bufstr, (size_t) (v_bufptr - v_bufstr)); + v_bufptr -= v_bufstr - v_buffer; + v_bufstr = v_buffer; + } + if (v_bufend < v_bufptr + len) { + /* still won't fit: get more space */ + /* Don't use XtRealloc because an error is not fatal. */ + unsigned size = (unsigned) (v_bufptr - v_buffer); + v_buffer = TypeRealloc(Char, size + len, v_buffer); + if (v_buffer) { + if_DEBUG({ + fprintf(stderr, "expanded buffer to %u\n", + size + len); + }); + v_bufstr = v_buffer; + v_bufptr = v_buffer + size; + v_bufend = v_bufptr + len; + } else { + /* no memory: ignore entire write request */ + xtermWarning("cannot allocate buffer space\n"); + v_buffer = v_bufstr; /* restore clobbered pointer */ + } + } + } + if (v_bufend >= v_bufptr + len) { + /* new stuff will fit */ + memmove(v_bufptr, data, (size_t) len); + v_bufptr += len; + } + } + + /* + * Write out as much of the buffer as we can. + * Be careful not to overflow the pty's input silo. + * We are conservative here and only write + * a small amount at a time. + * + * If we can't push all the data into the pty yet, we expect write + * to return a non-negative number less than the length requested + * (if some data written) or -1 and set errno to EAGAIN, + * EWOULDBLOCK, or EINTR (if no data written). + * + * (Not all systems do this, sigh, so the code is actually + * a little more forgiving.) + */ + +#define MAX_PTY_WRITE 128 /* 1/2 POSIX minimum MAX_INPUT */ + + if (v_bufptr > v_bufstr) { + int riten; + +#ifdef VMS + riten = tt_write(v_bufstr, + ((v_bufptr - v_bufstr <= VMS_TERM_BUFFER_SIZE) + ? v_bufptr - v_bufstr + : VMS_TERM_BUFFER_SIZE)); + if (riten == 0) + return (riten); +#else /* VMS */ + riten = (int) write(f, v_bufstr, + (size_t) ((v_bufptr - v_bufstr <= MAX_PTY_WRITE) + ? v_bufptr - v_bufstr + : MAX_PTY_WRITE)); + if (riten < 0) +#endif /* VMS */ + { + if_DEBUG({ + perror("write"); + }); + riten = 0; + } + if_DEBUG({ + fprintf(stderr, "write called with %ld, wrote %d\n", + ((long) ((v_bufptr - v_bufstr) <= MAX_PTY_WRITE) + ? (long) (v_bufptr - v_bufstr) + : MAX_PTY_WRITE), + riten); + }); + v_bufstr += riten; + if (v_bufstr >= v_bufptr) /* we wrote it all */ + v_bufstr = v_bufptr = v_buffer; + } + + /* + * If we have lots of unused memory allocated, return it + */ + if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */ + /* save pointers across realloc */ + int start = (int) (v_bufstr - v_buffer); + int size = (int) (v_bufptr - v_buffer); + unsigned allocsize = (unsigned) (size ? size : 1); + + v_buffer = TypeRealloc(Char, allocsize, v_buffer); + if (v_buffer) { + v_bufstr = v_buffer + start; + v_bufptr = v_buffer + size; + v_bufend = v_buffer + allocsize; + if_DEBUG({ + fprintf(stderr, "shrunk buffer to %u\n", allocsize); + }); + } else { + /* should we print a warning if couldn't return memory? */ + v_buffer = v_bufstr - start; /* restore clobbered pointer */ + } + } +} + +static void +updateCursor(TScreen *screen) +{ + if (screen->cursor_set != screen->cursor_state) { + if (screen->cursor_set) + ShowCursor(); + else + HideCursor(); + } +} + +#if OPT_BLINK_CURS || OPT_BLINK_TEXT +static void +reallyStopBlinking(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->cursor_state == BLINKED_OFF) { + /* force cursor to display if it is enabled */ + screen->cursor_state = !screen->cursor_set; + updateCursor(screen); + xevents(xw); + } +} +#endif + +static void +update_the_screen(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Boolean moved; + + if (screen->scroll_amt) + FlushScroll(xw); + moved = CursorMoved(screen); + if (screen->cursor_set && moved) { + if (screen->cursor_state) + HideCursor(); + ShowCursor(); +#if OPT_INPUT_METHOD + PreeditPosition(xw); +#endif + } else { +#if OPT_INPUT_METHOD + if (moved) + PreeditPosition(xw); +#endif + updateCursor(screen); + } +} + +#ifdef VMS +#define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0) + +static void +in_put(XtermWidget xw) +{ + static PtySelect select_mask; + static PtySelect write_mask; + int update = VTbuffer->update; + int size; + + int status; + Dimension replyWidth, replyHeight; + XtGeometryResult stat; + + TScreen *screen = TScreenOf(xw); + char *cp; + int i; + + select_mask = pty_mask; /* force initial read */ + for (;;) { + + /* if the terminal changed size, resize the widget */ + if (tt_changed) { + tt_changed = False; + + stat = REQ_RESIZE((Widget) xw, + ((Dimension) FontWidth(screen) + * (tt_width) + + 2 * screen->border + + screen->fullVwin.sb_info.width), + ((Dimension) FontHeight(screen) + * (tt_length) + + 2 * screen->border), + &replyWidth, &replyHeight); + + if (stat == XtGeometryYes || stat == XtGeometryDone) { + xw->core.width = replyWidth; + xw->core.height = replyHeight; + + ScreenResize(xw, replyWidth, replyHeight, &xw->flags); + } + repairSizeHints(); + } + + if (screen->eventMode == NORMAL + && readPtyData(xw, &select_mask, VTbuffer)) { + if (screen->scrollWidget + && screen->scrollttyoutput + && screen->topline < 0) + /* Scroll to bottom */ + WindowScroll(xw, 0, False); + break; + } + update_the_screen(xw); + + if (QLength(screen->display)) { + select_mask = X_mask; + } else { + write_mask = ptymask(); + XFlush(screen->display); + select_mask = Select_mask; + if (screen->eventMode != NORMAL) + select_mask = X_mask; + } + if (write_mask & ptymask()) { + v_write(screen->respond, 0, 0); /* flush buffer */ + } + + if (select_mask & X_mask) { + xevents(xw); + if (VTbuffer->update != update) + break; + } + } +} +#else /* VMS */ + +static void +in_put(XtermWidget xw) +{ + static PtySelect select_mask; + static PtySelect write_mask; + + TScreen *screen = TScreenOf(xw); + int i; + int update = VTbuffer->update; +#if USE_DOUBLE_BUFFER + int should_wait = 1; +#endif + + static struct timeval select_timeout; + +#if OPT_BLINK_CURS + /* + * Compute the timeout for the blinking cursor to be much smaller than + * the "on" or "off" interval. + */ + int tick = ((screen->blink_on < screen->blink_off) + ? screen->blink_on + : screen->blink_off); + tick *= (1000 / 8); /* 1000 for msec/usec, 8 for "much" smaller */ + if (tick < 1) + tick = 1; +#endif + + for (;;) { + int size; + int time_select; + + if (screen->eventMode == NORMAL + && (size = readPtyData(xw, &select_mask, VTbuffer)) != 0) { + if (screen->scrollWidget + && screen->scrollttyoutput + && screen->topline < 0) + WindowScroll(xw, 0, False); /* Scroll to bottom */ + /* stop speed reading at some point to look for X stuff */ + TRACE(("VTbuffer uses %ld/%d\n", + (long) (VTbuffer->last - VTbuffer->buffer), + BUF_SIZE)); + if ((VTbuffer->last - VTbuffer->buffer) > BUF_SIZE) { + FD_CLR(screen->respond, &select_mask); + break; + } +#if USE_DOUBLE_BUFFER + if (resource.buffered && should_wait) { + /* wait for potential extra data (avoids some flickering) */ + usleep((unsigned) DbeMsecs(xw)); + should_wait = 0; + } +#endif +#if defined(HAVE_SCHED_YIELD) + /* + * If we've read a full (small/fragment) buffer, let the operating + * system have a turn, and we'll resume reading until we've either + * read only a fragment of the buffer, or we've filled the large + * buffer (see above). Doing this helps keep up with large bursts + * of output. + */ + if (size == FRG_SIZE) { + select_timeout.tv_sec = 0; + i = Select(max_plus1, &select_mask, &write_mask, 0, + &select_timeout); + if (i > 0 && FD_ISSET(screen->respond, &select_mask)) { + sched_yield(); + } else + break; + } else { + break; + } +#else + (void) size; /* unused in this branch */ + break; +#endif + } + update_the_screen(xw); + + XFlush(screen->display); /* always flush writes before waiting */ + + /* Update the masks and, unless X events are already in the queue, + wait for I/O to be possible. */ + XFD_COPYSET(&Select_mask, &select_mask); + /* in selection mode xterm does not read pty */ + if (screen->eventMode != NORMAL) + FD_CLR(screen->respond, &select_mask); + + if (v_bufptr > v_bufstr) { + XFD_COPYSET(&pty_mask, &write_mask); + } else + FD_ZERO(&write_mask); + select_timeout.tv_sec = 0; + time_select = 0; + + /* + * if there's either an XEvent or an XtTimeout pending, just take + * a quick peek, i.e. timeout from the select() immediately. If + * there's nothing pending, let select() block a little while, but + * for a shorter interval than the arrow-style scrollbar timeout. + * The blocking is optional, because it tends to increase the load + * on the host. + */ + if (xtermAppPending()) { + select_timeout.tv_usec = 0; + time_select = 1; + } else if (screen->awaitInput) { + select_timeout.tv_usec = 50000; + time_select = 1; +#if OPT_BLINK_CURS + } else if ((screen->blink_timer != 0 && + ((screen->select & FOCUS) || screen->always_highlight)) || + (screen->cursor_state == BLINKED_OFF)) { + select_timeout.tv_usec = tick; + while (select_timeout.tv_usec > 1000000) { + select_timeout.tv_usec -= 1000000; + select_timeout.tv_sec++; + } + time_select = 1; +#endif +#if OPT_SESSION_MGT + } else if (resource.sessionMgt) { + if (ice_fd >= 0) + FD_SET(ice_fd, &select_mask); +#endif + } + if (need_cleanup) + NormalExit(); + xtermFlushDbe(xw); + i = Select(max_plus1, &select_mask, &write_mask, 0, + (time_select ? &select_timeout : 0)); + if (i < 0) { + if (errno != EINTR) + SysError(ERROR_SELECT); + continue; + } + + /* if there is room to write more data to the pty, go write more */ + if (FD_ISSET(screen->respond, &write_mask)) { + v_write(screen->respond, (Char *) 0, 0); /* flush buffer */ + } + + /* if there are X events already in our queue, it + counts as being readable */ + if (xtermAppPending() || + FD_ISSET(ConnectionNumber(screen->display), &select_mask)) { + xevents(xw); + if (VTbuffer->update != update) /* HandleInterpret */ + break; + } + + } +} +#endif /* VMS */ + +static IChar +doinput(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + while (!morePtyData(screen, VTbuffer)) + in_put(xw); + return nextPtyData(screen, VTbuffer); +} + +#if OPT_INPUT_METHOD +/* + * For OverTheSpot, client has to inform the position for XIM preedit. + */ +static void +PreeditPosition(XtermWidget xw) +{ + TInput *input = lookupTInput(xw, (Widget) xw); + TScreen *screen = TScreenOf(xw); + CLineData *ld; + XPoint spot; + XVaNestedList list; + + if (input && input->xic + && (ld = getLineData(screen, screen->cur_row)) != 0) { + spot.x = (short) LineCursorX(screen, ld, screen->cur_col); + spot.y = (short) (CursorY(screen, screen->cur_row) + xw->work.xim_fs_ascent); + list = XVaCreateNestedList(0, + XNSpotLocation, &spot, + XNForeground, T_COLOR(screen, TEXT_FG), + XNBackground, T_COLOR(screen, TEXT_BG), + (void *) 0); + XSetICValues(input->xic, XNPreeditAttributes, list, (void *) 0); + XFree(list); + } +} +#endif + +static void +WrapLine(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + LineData *ld = getLineData(screen, screen->cur_row); + + if (ld != 0) { + /* mark that we had to wrap this line */ + LineSetFlag(ld, LINEWRAPPED); + if (screen->show_wrap_marks) { + ShowWrapMarks(xw, screen->cur_row, ld); + } + xtermAutoPrint(xw, '\n'); + xtermIndex(xw, 1); + set_cur_col(screen, ScrnLeftMargin(xw)); + } +} + +/* + * Process a string of characters according to the character set indicated by + * charset. Worry about end of line conditions (wraparound if selected). + * + * It is possible to use CUP, etc., to move outside margins. In that case, the + * right-margin is ineffective until the text (may) wrap and get within the + * margins. + */ +void +dotext(XtermWidget xw, + DECNRCM_codes charset, + IChar *buf, /* start of characters to process */ + Cardinal len) /* end */ +{ + TScreen *screen = TScreenOf(xw); +#if OPT_WIDE_CHARS + Cardinal chars_chomped = 1; + int next_col = screen->cur_col; +#else + int next_col, this_col; /* must be signed */ +#endif + Cardinal offset; + int rmargin = ScrnRightMargin(xw); + +#if OPT_WIDE_CHARS + if (screen->vt100_graphics) +#endif + if (!xtermCharSetOut(xw, buf, buf + len, charset)) + return; + + if_OPT_XMC_GLITCH(screen, { + Cardinal n; + if (charset != '?') { + for (n = 0; n < len; n++) { + if (buf[n] == XMC_GLITCH) + buf[n] = XMC_GLITCH + 1; + } + } + }); + +#if OPT_WIDE_CHARS + for (offset = 0; + offset < len && (chars_chomped > 0 || screen->do_wrap); + offset += chars_chomped) { + int width_here = 0; + int last_chomp = 0; + Boolean force_wrap; + + chars_chomped = 0; + do { + int right = ((screen->cur_col > rmargin) + ? screen->max_col + : rmargin); + int width_available = right + 1 - screen->cur_col; + Boolean need_wrap = False; + Boolean did_wrap = False; + + force_wrap = False; + + if (screen->do_wrap) { + screen->do_wrap = False; + if ((xw->flags & WRAPAROUND)) { + WrapLine(xw); + right = ((screen->cur_col > rmargin) + ? screen->max_col + : rmargin); + width_available = right + 1 - screen->cur_col; + next_col = screen->cur_col; + did_wrap = True; + } + } + + /* + * This can happen with left/right margins... + */ + if (width_available <= 0) { + break; + } + + /* + * Regarding the soft-hyphen aberration, see + * http://archives.miloush.net/michkap/archive/2006/09/02/736881.html + */ + while (width_here <= width_available + && chars_chomped < (len - offset)) { + Cardinal n = chars_chomped + offset; + if (!screen->utf8_mode + || (screen->vt100_graphics && charset == '0')) { + last_chomp = 1; + } else if (screen->c1_printable && + buf[n] >= 0x80 && + buf[n] <= 0xa0) { + last_chomp = 1; + } else { + last_chomp = CharWidth(buf[n]); + if (last_chomp <= 0) { + IChar ch = buf[n]; + Bool eat_it = !screen->utf8_mode && (ch > 127); + if (ch == 0xad) { + /* + * Only display soft-hyphen if it happens to be at + * the right-margin. While that means that only + * the displayed character could be selected for + * pasting, a well-behaved application would never + * send this, anyway... + */ + if (width_here < width_available - 1) { + eat_it = True; + } else { + last_chomp = 1; + eat_it = False; + } + TRACE(("...will%s display soft-hyphen\n", + eat_it ? " not" : "")); + } + /* + * Supposedly we dealt with combining characters and + * control characters in doparse(). Anything left over + * is junk that we will not attempt to display. + */ + if (eat_it) { + TRACE(("...will not display U+%04X\n", ch)); + --len; + while (n < len) { + buf[n] = buf[n + 1]; + ++n; + } + last_chomp = 0; + chars_chomped--; + } + } + } + width_here += last_chomp; + chars_chomped++; + } + + if (width_here > width_available) { + if (last_chomp > right + 1) { + break; /* give up - it is too big */ + } else if (chars_chomped-- == 0) { + /* This can happen with left/right margins... */ + break; + } + width_here -= last_chomp; + if (chars_chomped > 0) { + if (!(xw->flags & WRAPAROUND)) { + buf[chars_chomped + offset - 1] = buf[len - 1]; + } else { + need_wrap = True; + } + } + } else if (width_here == width_available) { + need_wrap = True; + } else if (chars_chomped != (len - offset)) { + need_wrap = True; + } + + if (chars_chomped != 0 && next_col <= screen->max_col) { + WriteText(xw, buf + offset, chars_chomped); + } else if (!did_wrap + && len > 0 + && (xw->flags & WRAPAROUND) + && screen->cur_col > ScrnLeftMargin(xw)) { + force_wrap = True; + need_wrap = True; + } + next_col += width_here; + screen->do_wrap = need_wrap; + } while (force_wrap); + } + + /* + * Remember that we wrote something to the screen, for use as a base of + * combining characters. The logic above may have called cursor-forward + * or carriage-return operations which resets this flag, so we set it at + * the very end. + */ + screen->char_was_written = True; +#else /* ! OPT_WIDE_CHARS */ + + for (offset = 0; offset < len; offset += (Cardinal) this_col) { +#if OPT_DEC_CHRSET + CLineData *ld = getLineData(screen, screen->cur_row); +#endif + int right = ((screen->cur_col > rmargin) + ? screen->max_col + : rmargin); + + int last_col = LineMaxCol(screen, ld); + if (last_col > right) + last_col = right; + this_col = last_col - screen->cur_col + 1; + if (screen->do_wrap) { + screen->do_wrap = False; + if ((xw->flags & WRAPAROUND)) { + WrapLine(xw); + } + this_col = 1; + } + if (offset + (Cardinal) this_col > len) { + this_col = (int) (len - offset); + } + next_col = screen->cur_col + this_col; + + WriteText(xw, buf + offset, (unsigned) this_col); + + /* + * The call to WriteText updates screen->cur_col. + * If screen->cur_col is less than next_col, we must have + * hit the right margin - so set the do_wrap flag. + */ + screen->do_wrap = (Boolean) (screen->cur_col < next_col); + } + +#endif /* OPT_WIDE_CHARS */ +} + +#if OPT_WIDE_CHARS +unsigned +visual_width(const IChar *str, Cardinal len) +{ + /* returns the visual width of a string (doublewide characters count + as 2, normalwide characters count as 1) */ + unsigned my_len = 0; + while (len) { + int ch = (int) *str++; + if (isWide(ch)) + my_len += 2; + else + my_len++; + len--; + } + return my_len; +} +#endif + +#if HANDLE_STRUCT_NOTIFY +/* Flag icon name with "***" on window output when iconified. + */ +static void +HandleStructNotify(Widget w GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XEvent *event, + Boolean *cont GCC_UNUSED) +{ + XtermWidget xw = term; + TScreen *screen = TScreenOf(xw); + + (void) screen; + TRACE_EVENT("HandleStructNotify", event, NULL, 0); + switch (event->type) { + case MapNotify: + resetZIconBeep(xw); + mapstate = !IsUnmapped; + break; + case UnmapNotify: + mapstate = IsUnmapped; + break; + case MappingNotify: + XRefreshKeyboardMapping(&(event->xmapping)); + VTInitModifiers(xw); + break; + case ConfigureNotify: + if (event->xconfigure.window == XtWindow(toplevel)) { +#if !OPT_TOOLBAR + int height = event->xconfigure.height; + int width = event->xconfigure.width; +#endif + +#if USE_DOUBLE_BUFFER + discardRenderDraw(screen); +#endif /* USE_DOUBLE_BUFFER */ +#if OPT_TOOLBAR + /* + * The notification is for the top-level widget, but we care about + * vt100 (ignore the tek4014 window). + */ + if (screen->Vshow) { + VTwin *Vwin = WhichVWin(screen); + TbInfo *info = &(Vwin->tb_info); + TbInfo save = *info; + + if (info->menu_bar) { + XtVaGetValues(info->menu_bar, + XtNheight, &info->menu_height, + XtNborderWidth, &info->menu_border, + (XtPointer) 0); + + if (save.menu_height != info->menu_height + || save.menu_border != info->menu_border) { + + TRACE(("...menu_height %d\n", info->menu_height)); + TRACE(("...menu_border %d\n", info->menu_border)); + TRACE(("...had height %d, border %d\n", + save.menu_height, + save.menu_border)); + + /* + * Window manager still may be using the old values. + * Try to fool it. + */ + REQ_RESIZE((Widget) xw, + screen->fullVwin.fullwidth, + (Dimension) (info->menu_height + - save.menu_height + + screen->fullVwin.fullheight), + NULL, NULL); + repairSizeHints(); + } + } + } +#else + if (!xw->work.doing_resize +#if OPT_RENDERFONT && USE_DOUBLE_BUFFER + && !(resource.buffered && UsingRenderFont(xw)) /* buggyXft */ +#endif + && (height != xw->hints.height + || width != xw->hints.width)) { + /* + * This is a special case: other calls to RequestResize that + * could set the screensize arbitrarily are via escape + * sequences, and we've limited resizing. But a configure + * notify is from the window manager, presumably under control + * of the interactive user (ignoring abuse of wmctrl). Ignore + * the limit for this case. + */ + int saved_limit = xw->misc.limit_resize; + xw->misc.limit_resize = 0; + RequestResize(xw, height, width, False); + xw->misc.limit_resize = saved_limit; + } +#endif /* OPT_TOOLBAR */ + } + break; + } +} +#endif /* HANDLE_STRUCT_NOTIFY */ + +#if OPT_BLINK_CURS +static int +DoStartBlinking(TScreen *screen) +{ + int actual = ((screen->cursor_blink == cbTrue || + screen->cursor_blink == cbAlways) + ? 1 + : 0); + int wanted = screen->cursor_blink_esc ? 1 : 0; + int result; + if (screen->cursor_blink_xor) { + result = actual ^ wanted; + } else { + result = actual | wanted; + } + return result; +} + +static void +SetCursorBlink(XtermWidget xw, BlinkOps enable) +{ + TScreen *screen = TScreenOf(xw); + + if (SettableCursorBlink(screen)) { + screen->cursor_blink = enable; + } + if (DoStartBlinking(screen)) { + StartBlinking(xw); + } else { + /* EMPTY */ +#if OPT_BLINK_TEXT + reallyStopBlinking(xw); +#else + StopBlinking(xw); +#endif + } + update_cursorblink(); +} + +void +ToggleCursorBlink(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->cursor_blink == cbTrue) { + SetCursorBlink(xw, cbFalse); + } else if (screen->cursor_blink == cbFalse) { + SetCursorBlink(xw, cbTrue); + } +} +#endif + +/* + * process ANSI modes set, reset + */ +static void +ansi_modes(XtermWidget xw, BitFunc func) +{ + int i; + + for (i = 0; i < nparam; ++i) { + switch (GetParam(i)) { + case 2: /* KAM (if set, keyboard locked */ + (*func) (&xw->keyboard.flags, MODE_KAM); + break; + + case 4: /* IRM */ + (*func) (&xw->flags, INSERT); + break; + + case 12: /* SRM (if set, local echo */ + (*func) (&xw->keyboard.flags, MODE_SRM); + break; + + case 20: /* LNM */ + (*func) (&xw->flags, LINEFEED); + update_autolinefeed(); + break; + } + } +} + +#define IsSM() (func == bitset) + +#define set_bool_mode(flag) \ + flag = (Boolean) IsSM() + +static void +really_set_mousemode(XtermWidget xw, + Bool enabled, + XtermMouseModes mode) +{ + TScreenOf(xw)->send_mouse_pos = enabled ? mode : MOUSE_OFF; + if (okSendMousePos(xw) != MOUSE_OFF) + xtermShowPointer(xw, True); +} + +#define set_mousemode(mode) really_set_mousemode(xw, IsSM(), mode) + +#if OPT_PASTE64 || OPT_READLINE +#define set_mouseflag(f) \ + (IsSM() \ + ? SCREEN_FLAG_set(screen, f) \ + : SCREEN_FLAG_unset(screen, f)) +#endif + +/* + * process DEC private modes set, reset + */ +static void +dpmodes(XtermWidget xw, BitFunc func) +{ + TScreen *screen = TScreenOf(xw); + int i, j; + unsigned myflags; + + TRACE(("changing %d DEC private modes\n", nparam)); + for (i = 0; i < nparam; ++i) { + int code = GetParam(i); + + TRACE(("%s %d\n", IsSM()? "DECSET" : "DECRST", code)); + switch ((DECSET_codes) code) { + case srm_DECCKM: + (*func) (&xw->keyboard.flags, MODE_DECCKM); + update_appcursor(); + break; + case srm_DECANM: /* ANSI/VT52 mode */ + if (IsSM()) { /* ANSI (VT100) */ + /* + * Setting DECANM should have no effect, since this function + * cannot be reached from vt52 mode. + */ + /* EMPTY */ ; + } +#if OPT_VT52_MODE + else if (screen->terminal_id >= 100) { /* VT52 */ + TRACE(("DECANM terminal_id %d, vtXX_level %d\n", + screen->terminal_id, + screen->vtXX_level)); + /* + * According to DEC STD 070 section A.5.5, the various VT100 + * modes have undefined behavior when entering/exiting VT52 + * mode. xterm saves/restores/initializes the most commonly + * used settings, but a real VT100 or VT520 may differ. + * + * For instance, DEC's documentation goes on to comment that + * while the VT52 uses hardware tabs (8 columns), the emulation + * (e.g., a VT420) does not alter those tab settings when + * switching modes. + */ + screen->vtXX_level = 0; + screen->vt52_save_flags = xw->flags; + xw->flags = 0; + screen->vt52_save_curgl = screen->curgl; + screen->vt52_save_curgr = screen->curgr; + screen->vt52_save_curss = screen->curss; + saveCharsets(screen, screen->vt52_save_gsets); + resetCharsets(screen); + InitParams(); /* ignore the remaining params, if any */ + update_vt52_vt100_settings(); + RequestResize(xw, -1, 80, True); + } +#endif + break; + case srm_DECCOLM: + if (screen->c132) { + Boolean willResize = ((j = IsSM() + ? 132 + : 80) + != ((xw->flags & IN132COLUMNS) + ? 132 + : 80) + || j != MaxCols(screen)); + if (!(xw->flags & NOCLEAR_COLM)) + ClearScreen(xw); + if (willResize) + RequestResize(xw, -1, j, True); + (*func) (&xw->flags, IN132COLUMNS); + resetMargins(xw); + CursorSet(screen, 0, 0, xw->flags); + } + break; + case srm_DECSCLM: /* (slow scroll) */ + if (IsSM()) { + screen->jumpscroll = 0; + if (screen->scroll_amt) + FlushScroll(xw); + } else + screen->jumpscroll = 1; + (*func) (&xw->flags, SMOOTHSCROLL); + update_jumpscroll(); + break; + case srm_DECSCNM: + myflags = xw->flags; + (*func) (&xw->flags, REVERSE_VIDEO); + if ((xw->flags ^ myflags) & REVERSE_VIDEO) + ReverseVideo(xw); + /* update_reversevideo done in RevVid */ + break; + + case srm_DECOM: + (*func) (&xw->flags, ORIGIN); + CursorSet(screen, 0, 0, xw->flags); + break; + + case srm_DECAWM: + (*func) (&xw->flags, WRAPAROUND); + update_autowrap(); + break; + case srm_DECARM: + /* ignore autorepeat + * XAutoRepeatOn() and XAutoRepeatOff() can do this, but only + * for the whole display - not limited to a given window. + */ + break; + case srm_X10_MOUSE: /* MIT bogus sequence */ + MotionOff(screen, xw); + set_mousemode(X10_MOUSE); + break; +#if OPT_TOOLBAR + case srm_RXVT_TOOLBAR: + ShowToolbar(IsSM()); + break; +#endif +#if OPT_BLINK_CURS + case srm_ATT610_BLINK: /* AT&T 610: Start/stop blinking cursor */ + if (SettableCursorBlink(screen)) { + set_bool_mode(screen->cursor_blink_esc); + UpdateCursorBlink(xw); + } + break; + case srm_CURSOR_BLINK_OPS: + /* intentionally ignored (this is user-preference) */ + break; + case srm_XOR_CURSOR_BLINKS: + /* intentionally ignored (this is user-preference) */ + break; +#endif + case srm_DECPFF: /* print form feed */ + set_bool_mode(PrinterOf(screen).printer_formfeed); + break; + case srm_DECPEX: /* print extent */ + set_bool_mode(PrinterOf(screen).printer_extent); + break; + case srm_DECTCEM: /* Show/hide cursor (VT200) */ + set_bool_mode(screen->cursor_set); + break; + case srm_RXVT_SCROLLBAR: + if (screen->fullVwin.sb_info.width != (IsSM()? ON : OFF)) + ToggleScrollBar(xw); + break; +#if OPT_SHIFT_FONTS + case srm_RXVT_FONTSIZE: + set_bool_mode(xw->misc.shift_fonts); + break; +#endif +#if OPT_TEK4014 + case srm_DECTEK: + if (IsSM() && !(screen->inhibit & I_TEK)) { + FlushLog(xw); + TEK4014_ACTIVE(xw) = True; + TRACE(("Tek4014 is now active...\n")); + update_vttekmode(); + } + break; +#endif + case srm_132COLS: /* 132 column mode */ + set_bool_mode(screen->c132); + update_allow132(); + break; + case srm_CURSES_HACK: + set_bool_mode(screen->curses); + update_cursesemul(); + break; + case srm_DECNRCM: /* national charset (VT220) */ + if (screen->vtXX_level >= 2) { + if ((*func) (&xw->flags, NATIONAL)) { + modified_DECNRCM(xw); + } + } + break; + case srm_MARGIN_BELL: /* margin bell */ + set_bool_mode(screen->marginbell); + if (!screen->marginbell) + screen->bellArmed = -1; + update_marginbell(); + break; + case srm_REVERSEWRAP: /* reverse wraparound */ + (*func) (&xw->flags, REVERSEWRAP); + update_reversewrap(); + break; +#ifdef ALLOWLOGGING + case srm_ALLOWLOGGING: /* logging */ +#ifdef ALLOWLOGFILEONOFF + /* + * if this feature is enabled, logging may be + * enabled and disabled via escape sequences. + */ + if (IsSM()) + StartLog(xw); + else + CloseLog(xw); +#else + Bell(xw, XkbBI_Info, 0); + Bell(xw, XkbBI_Info, 0); +#endif /* ALLOWLOGFILEONOFF */ + break; +#endif + case srm_OPT_ALTBUF_CURSOR: /* alternate buffer & cursor */ + if (!xw->misc.titeInhibit) { + if (IsSM()) { + CursorSave(xw); + ToAlternate(xw, True); + ClearScreen(xw); + } else { + FromAlternate(xw); + CursorRestore(xw); + } + } else if (IsSM()) { + do_ti_xtra_scroll(xw); + } + break; + case srm_OPT_ALTBUF: + /* FALLTHRU */ + case srm_ALTBUF: /* alternate buffer */ + if (!xw->misc.titeInhibit) { + if (IsSM()) { + ToAlternate(xw, False); + } else { + if (screen->whichBuf + && (code == 1047)) + ClearScreen(xw); + FromAlternate(xw); + } + } else if (IsSM()) { + do_ti_xtra_scroll(xw); + } + break; + case srm_DECNKM: + (*func) (&xw->keyboard.flags, MODE_DECKPAM); + update_appkeypad(); + break; + case srm_DECBKM: + /* back-arrow mapped to backspace or delete(D) */ + (*func) (&xw->keyboard.flags, MODE_DECBKM); + TRACE(("DECSET DECBKM %s\n", + BtoS(xw->keyboard.flags & MODE_DECBKM))); + update_decbkm(); + break; + case srm_DECLRMM: + if (screen->vtXX_level >= 4) { /* VT420 */ + (*func) (&xw->flags, LEFT_RIGHT); + if (IsLeftRightMode(xw)) { + xterm_ResetDouble(xw); + } else { + reset_lr_margins(screen); + } + } + break; +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: /* sixel scrolling */ + if (optSixelGraphics(screen)) { /* FIXME: VT24x did not scroll sixel graphics */ + (*func) (&xw->keyboard.flags, MODE_DECSDM); + TRACE(("DECSET/DECRST DECSDM %s (resource default is %d)\n", + BtoS(xw->keyboard.flags & MODE_DECSDM), + TScreenOf(xw)->sixel_scrolling)); + update_decsdm(); + } + break; +#endif + case srm_DECNCSM: + if (screen->vtXX_level >= 5) { /* VT510 */ + (*func) (&xw->flags, NOCLEAR_COLM); + } + break; + case srm_VT200_MOUSE: /* xterm bogus sequence */ + MotionOff(screen, xw); + set_mousemode(VT200_MOUSE); + break; + case srm_VT200_HIGHLIGHT_MOUSE: /* xterm sequence w/hilite tracking */ + MotionOff(screen, xw); + set_mousemode(VT200_HIGHLIGHT_MOUSE); + break; + case srm_BTN_EVENT_MOUSE: + MotionOff(screen, xw); + set_mousemode(BTN_EVENT_MOUSE); + break; + case srm_ANY_EVENT_MOUSE: + set_mousemode(ANY_EVENT_MOUSE); + if (screen->send_mouse_pos == MOUSE_OFF) { + MotionOff(screen, xw); + } else { + MotionOn(screen, xw); + } + break; +#if OPT_FOCUS_EVENT + case srm_FOCUS_EVENT_MOUSE: + set_bool_mode(screen->send_focus_pos); + break; +#endif + case srm_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_SGR_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_URXVT_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_PIXEL_POSITION_MOUSE: + /* + * Rather than choose an arbitrary precedence among the coordinate + * modes, they are mutually exclusive. For consistency, a reset is + * only effective against the matching mode. + */ + if (IsSM()) { + screen->extend_coords = code; + } else if (screen->extend_coords == code) { + screen->extend_coords = 0; + } + break; + case srm_ALTERNATE_SCROLL: + set_bool_mode(screen->alternateScroll); + break; + case srm_RXVT_SCROLL_TTY_OUTPUT: + set_bool_mode(screen->scrollttyoutput); + update_scrollttyoutput(); + break; + case srm_RXVT_SCROLL_TTY_KEYPRESS: + set_bool_mode(screen->scrollkey); + update_scrollkey(); + break; + case srm_EIGHT_BIT_META: + if (screen->eight_bit_meta != ebNever) { + set_bool_mode(screen->eight_bit_meta); + } + break; +#if OPT_NUM_LOCK + case srm_REAL_NUMLOCK: + set_bool_mode(xw->misc.real_NumLock); + update_num_lock(); + break; + case srm_META_SENDS_ESC: + set_bool_mode(screen->meta_sends_esc); + update_meta_esc(); + break; +#endif + case srm_DELETE_IS_DEL: + set_bool_mode(screen->delete_is_del); + update_delete_del(); + break; +#if OPT_NUM_LOCK + case srm_ALT_SENDS_ESC: + set_bool_mode(screen->alt_sends_esc); + update_alt_esc(); + break; +#endif + case srm_KEEP_SELECTION: + set_bool_mode(screen->keepSelection); + update_keepSelection(); + break; + case srm_SELECT_TO_CLIPBOARD: + set_bool_mode(screen->selectToClipboard); + update_selectToClipboard(); + break; + case srm_BELL_IS_URGENT: + set_bool_mode(screen->bellIsUrgent); + update_bellIsUrgent(); + break; + case srm_POP_ON_BELL: + set_bool_mode(screen->poponbell); + update_poponbell(); + break; + case srm_KEEP_CLIPBOARD: + set_bool_mode(screen->keepClipboard); + update_keepClipboard(); + break; + case srm_ALLOW_ALTBUF: + if (IsSM()) { + xw->misc.titeInhibit = False; + } else if (!xw->misc.titeInhibit) { + xw->misc.titeInhibit = True; + FromAlternate(xw); + } + update_titeInhibit(); + break; + case srm_SAVE_CURSOR: + if (!xw->misc.titeInhibit) { + if (IsSM()) + CursorSave(xw); + else + CursorRestore(xw); + } + break; +#if OPT_TCAP_FKEYS + case srm_TCAP_FKEYS: + set_keyboard_type(xw, keyboardIsTermcap, IsSM()); + break; +#endif +#if OPT_SUN_FUNC_KEYS + case srm_SUN_FKEYS: + set_keyboard_type(xw, keyboardIsSun, IsSM()); + break; +#endif +#if OPT_HP_FUNC_KEYS + case srm_HP_FKEYS: + set_keyboard_type(xw, keyboardIsHP, IsSM()); + break; +#endif +#if OPT_SCO_FUNC_KEYS + case srm_SCO_FKEYS: + set_keyboard_type(xw, keyboardIsSCO, IsSM()); + break; +#endif + case srm_LEGACY_FKEYS: + set_keyboard_type(xw, keyboardIsLegacy, IsSM()); + break; +#if OPT_SUNPC_KBD + case srm_VT220_FKEYS: + set_keyboard_type(xw, keyboardIsVT220, IsSM()); + break; +#endif +#if OPT_PASTE64 || OPT_READLINE + case srm_PASTE_IN_BRACKET: + set_mouseflag(paste_brackets); + break; +#endif +#if OPT_READLINE + case srm_BUTTON1_MOVE_POINT: + set_mouseflag(click1_moves); + break; + case srm_BUTTON2_MOVE_POINT: + set_mouseflag(paste_moves); + break; + case srm_DBUTTON3_DELETE: + set_mouseflag(dclick3_deletes); + break; + case srm_PASTE_QUOTE: + set_mouseflag(paste_quotes); + break; + case srm_PASTE_LITERAL_NL: + set_mouseflag(paste_literal_nl); + break; +#endif /* OPT_READLINE */ +#if OPT_GRAPHICS + case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */ + TRACE(("DECSET/DECRST PRIVATE_COLOR_REGISTERS to %s (resource default is %s)\n", + BtoS(screen->privatecolorregisters), + BtoS(TScreenOf(xw)->privatecolorregisters))); + set_bool_mode(screen->privatecolorregisters); + update_privatecolorregisters(); + break; +#endif +#if OPT_SIXEL_GRAPHICS + case srm_SIXEL_SCROLLS_RIGHT: /* sixel scrolling moves cursor to right */ + if (optSixelGraphics(screen)) { /* FIXME: VT24x did not scroll sixel graphics */ + set_bool_mode(screen->sixel_scrolls_right); + TRACE(("DECSET/DECRST SIXEL_SCROLLS_RIGHT to %s (resource default is %s)\n", + BtoS(screen->sixel_scrolls_right), + BtoS(TScreenOf(xw)->sixel_scrolls_right))); + } + break; +#endif + default: + TRACE(("DATA_ERROR: unknown private code %d\n", code)); + break; + } + } +} + +/* + * process xterm private modes save + */ +static void +savemodes(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int i; + + for (i = 0; i < nparam; i++) { + int code = GetParam(i); + + TRACE(("savemodes %d\n", code)); + switch ((DECSET_codes) code) { + case srm_DECCKM: + DoSM(DP_DECCKM, xw->keyboard.flags & MODE_DECCKM); + break; + case srm_DECANM: /* ANSI/VT52 mode */ + /* no effect */ + break; + case srm_DECCOLM: + if (screen->c132) + DoSM(DP_DECCOLM, xw->flags & IN132COLUMNS); + break; + case srm_DECSCLM: /* (slow scroll) */ + DoSM(DP_DECSCLM, xw->flags & SMOOTHSCROLL); + break; + case srm_DECSCNM: + DoSM(DP_DECSCNM, xw->flags & REVERSE_VIDEO); + break; + case srm_DECOM: + DoSM(DP_DECOM, xw->flags & ORIGIN); + break; + case srm_DECAWM: + DoSM(DP_DECAWM, xw->flags & WRAPAROUND); + break; + case srm_DECARM: + /* ignore autorepeat */ + break; + case srm_X10_MOUSE: /* mouse bogus sequence */ + DoSM(DP_X_X10MSE, screen->send_mouse_pos); + break; +#if OPT_TOOLBAR + case srm_RXVT_TOOLBAR: + DoSM(DP_TOOLBAR, resource.toolBar); + break; +#endif +#if OPT_BLINK_CURS + case srm_ATT610_BLINK: /* AT&T 610: Start/stop blinking cursor */ + if (SettableCursorBlink(screen)) { + DoSM(DP_CRS_BLINK, screen->cursor_blink_esc); + } + break; + case srm_CURSOR_BLINK_OPS: + /* intentionally ignored (this is user-preference) */ + break; + case srm_XOR_CURSOR_BLINKS: + /* intentionally ignored (this is user-preference) */ + break; +#endif + case srm_DECPFF: /* print form feed */ + DoSM(DP_PRN_FORMFEED, PrinterOf(screen).printer_formfeed); + break; + case srm_DECPEX: /* print extent */ + DoSM(DP_PRN_EXTENT, PrinterOf(screen).printer_extent); + break; + case srm_DECTCEM: /* Show/hide cursor (VT200) */ + DoSM(DP_CRS_VISIBLE, screen->cursor_set); + break; + case srm_RXVT_SCROLLBAR: + DoSM(DP_RXVT_SCROLLBAR, (screen->fullVwin.sb_info.width != 0)); + break; +#if OPT_SHIFT_FONTS + case srm_RXVT_FONTSIZE: + DoSM(DP_RXVT_FONTSIZE, xw->misc.shift_fonts); + break; +#endif +#if OPT_TEK4014 + case srm_DECTEK: + DoSM(DP_DECTEK, TEK4014_ACTIVE(xw)); + break; +#endif + case srm_132COLS: /* 132 column mode */ + DoSM(DP_X_DECCOLM, screen->c132); + break; + case srm_CURSES_HACK: /* curses hack */ + DoSM(DP_X_MORE, screen->curses); + break; + case srm_DECNRCM: /* national charset (VT220) */ + if (screen->vtXX_level >= 2) { + DoSM(DP_DECNRCM, xw->flags & NATIONAL); + } + break; + case srm_MARGIN_BELL: /* margin bell */ + DoSM(DP_X_MARGIN, screen->marginbell); + break; + case srm_REVERSEWRAP: /* reverse wraparound */ + DoSM(DP_X_REVWRAP, xw->flags & REVERSEWRAP); + break; +#ifdef ALLOWLOGGING + case srm_ALLOWLOGGING: /* logging */ + DoSM(DP_X_LOGGING, screen->logging); + break; +#endif + case srm_OPT_ALTBUF_CURSOR: + /* FALLTHRU */ + case srm_OPT_ALTBUF: + /* FALLTHRU */ + case srm_ALTBUF: /* alternate buffer */ + DoSM(DP_X_ALTBUF, screen->whichBuf); + break; + case srm_DECNKM: + DoSM(DP_DECKPAM, xw->keyboard.flags & MODE_DECKPAM); + break; + case srm_DECBKM: /* backarrow mapping */ + DoSM(DP_DECBKM, xw->keyboard.flags & MODE_DECBKM); + break; + case srm_DECLRMM: /* left-right */ + DoSM(DP_X_LRMM, LEFT_RIGHT); + break; +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: /* sixel scrolling */ + DoSM(DP_DECSDM, xw->keyboard.flags & MODE_DECSDM); + update_decsdm(); + break; +#endif + case srm_DECNCSM: /* noclear */ + DoSM(DP_X_NCSM, NOCLEAR_COLM); + break; + case srm_VT200_MOUSE: /* mouse bogus sequence */ + /* FALLTHRU */ + case srm_VT200_HIGHLIGHT_MOUSE: + /* FALLTHRU */ + case srm_BTN_EVENT_MOUSE: + /* FALLTHRU */ + case srm_ANY_EVENT_MOUSE: + DoSM(DP_X_MOUSE, screen->send_mouse_pos); + break; +#if OPT_FOCUS_EVENT + case srm_FOCUS_EVENT_MOUSE: + DoSM(DP_X_FOCUS, screen->send_focus_pos); + break; +#endif + case srm_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_SGR_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_URXVT_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_PIXEL_POSITION_MOUSE: + DoSM(DP_X_EXT_MOUSE, screen->extend_coords); + break; + case srm_ALTERNATE_SCROLL: + DoSM(DP_ALTERNATE_SCROLL, screen->alternateScroll); + break; + case srm_RXVT_SCROLL_TTY_OUTPUT: + DoSM(DP_RXVT_SCROLL_TTY_OUTPUT, screen->scrollttyoutput); + break; + case srm_RXVT_SCROLL_TTY_KEYPRESS: + DoSM(DP_RXVT_SCROLL_TTY_KEYPRESS, screen->scrollkey); + break; + case srm_EIGHT_BIT_META: + DoSM(DP_EIGHT_BIT_META, screen->eight_bit_meta); + break; +#if OPT_NUM_LOCK + case srm_REAL_NUMLOCK: + DoSM(DP_REAL_NUMLOCK, xw->misc.real_NumLock); + break; + case srm_META_SENDS_ESC: + DoSM(DP_META_SENDS_ESC, screen->meta_sends_esc); + break; +#endif + case srm_DELETE_IS_DEL: + DoSM(DP_DELETE_IS_DEL, screen->delete_is_del); + break; +#if OPT_NUM_LOCK + case srm_ALT_SENDS_ESC: + DoSM(DP_ALT_SENDS_ESC, screen->alt_sends_esc); + break; +#endif + case srm_KEEP_SELECTION: + DoSM(DP_KEEP_SELECTION, screen->keepSelection); + break; + case srm_SELECT_TO_CLIPBOARD: + DoSM(DP_SELECT_TO_CLIPBOARD, screen->selectToClipboard); + break; + case srm_BELL_IS_URGENT: + DoSM(DP_BELL_IS_URGENT, screen->bellIsUrgent); + break; + case srm_POP_ON_BELL: + DoSM(DP_POP_ON_BELL, screen->poponbell); + break; + case srm_KEEP_CLIPBOARD: + DoSM(DP_KEEP_CLIPBOARD, screen->keepClipboard); + break; +#if OPT_TCAP_FKEYS + case srm_TCAP_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_SUN_FUNC_KEYS + case srm_SUN_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_HP_FUNC_KEYS + case srm_HP_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_SCO_FUNC_KEYS + case srm_SCO_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_SUNPC_KBD + case srm_VT220_FKEYS: + /* FALLTHRU */ +#endif + case srm_LEGACY_FKEYS: + DoSM(DP_KEYBOARD_TYPE, xw->keyboard.type); + break; + case srm_ALLOW_ALTBUF: + DoSM(DP_ALLOW_ALTBUF, xw->misc.titeInhibit); + break; + case srm_SAVE_CURSOR: + if (!xw->misc.titeInhibit) { + CursorSave(xw); + } + break; +#if OPT_PASTE64 || OPT_READLINE + case srm_PASTE_IN_BRACKET: + SCREEN_FLAG_save(screen, paste_brackets); + break; +#endif +#if OPT_READLINE + case srm_BUTTON1_MOVE_POINT: + SCREEN_FLAG_save(screen, click1_moves); + break; + case srm_BUTTON2_MOVE_POINT: + SCREEN_FLAG_save(screen, paste_moves); + break; + case srm_DBUTTON3_DELETE: + SCREEN_FLAG_save(screen, dclick3_deletes); + break; + case srm_PASTE_QUOTE: + SCREEN_FLAG_save(screen, paste_quotes); + break; + case srm_PASTE_LITERAL_NL: + SCREEN_FLAG_save(screen, paste_literal_nl); + break; +#endif /* OPT_READLINE */ +#if OPT_GRAPHICS + case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */ + TRACE(("save PRIVATE_COLOR_REGISTERS %s\n", + BtoS(screen->privatecolorregisters))); + DoSM(DP_X_PRIVATE_COLOR_REGISTERS, screen->privatecolorregisters); + update_privatecolorregisters(); + break; +#endif +#if OPT_SIXEL_GRAPHICS + case srm_SIXEL_SCROLLS_RIGHT: + TRACE(("save SIXEL_SCROLLS_RIGHT %s\n", + BtoS(screen->sixel_scrolls_right))); + DoSM(DP_SIXEL_SCROLLS_RIGHT, screen->sixel_scrolls_right); + break; +#endif + } + } +} + +/* + * process xterm private modes restore + */ +static void +restoremodes(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int i, j; + + for (i = 0; i < nparam; i++) { + int code = GetParam(i); + + TRACE(("restoremodes %d\n", code)); + switch ((DECSET_codes) code) { + case srm_DECCKM: + bitcpy(&xw->keyboard.flags, + screen->save_modes[DP_DECCKM], MODE_DECCKM); + update_appcursor(); + break; + case srm_DECANM: /* ANSI/VT52 mode */ + /* no effect */ + break; + case srm_DECCOLM: + if (screen->c132) { + if (!(xw->flags & NOCLEAR_COLM)) + ClearScreen(xw); + CursorSet(screen, 0, 0, xw->flags); + if ((j = (screen->save_modes[DP_DECCOLM] & IN132COLUMNS) + ? 132 : 80) != ((xw->flags & IN132COLUMNS) + ? 132 : 80) || j != MaxCols(screen)) + RequestResize(xw, -1, j, True); + bitcpy(&xw->flags, + screen->save_modes[DP_DECCOLM], + IN132COLUMNS); + } + break; + case srm_DECSCLM: /* (slow scroll) */ + if (screen->save_modes[DP_DECSCLM] & SMOOTHSCROLL) { + screen->jumpscroll = 0; + if (screen->scroll_amt) + FlushScroll(xw); + } else + screen->jumpscroll = 1; + bitcpy(&xw->flags, screen->save_modes[DP_DECSCLM], SMOOTHSCROLL); + update_jumpscroll(); + break; + case srm_DECSCNM: + if ((screen->save_modes[DP_DECSCNM] ^ xw->flags) & REVERSE_VIDEO) { + bitcpy(&xw->flags, screen->save_modes[DP_DECSCNM], REVERSE_VIDEO); + ReverseVideo(xw); + /* update_reversevideo done in RevVid */ + } + break; + case srm_DECOM: + bitcpy(&xw->flags, screen->save_modes[DP_DECOM], ORIGIN); + CursorSet(screen, 0, 0, xw->flags); + break; + + case srm_DECAWM: + bitcpy(&xw->flags, screen->save_modes[DP_DECAWM], WRAPAROUND); + update_autowrap(); + break; + case srm_DECARM: + /* ignore autorepeat */ + break; + case srm_X10_MOUSE: /* MIT bogus sequence */ + DoRM0(DP_X_X10MSE, screen->send_mouse_pos); + really_set_mousemode(xw, + screen->send_mouse_pos != MOUSE_OFF, + (XtermMouseModes) screen->send_mouse_pos); + break; +#if OPT_TOOLBAR + case srm_RXVT_TOOLBAR: + DoRM(DP_TOOLBAR, resource.toolBar); + ShowToolbar(resource.toolBar); + break; +#endif +#if OPT_BLINK_CURS + case srm_ATT610_BLINK: /* Start/stop blinking cursor */ + if (SettableCursorBlink(screen)) { + DoRM(DP_CRS_BLINK, screen->cursor_blink_esc); + UpdateCursorBlink(xw); + } + break; + case srm_CURSOR_BLINK_OPS: + /* intentionally ignored (this is user-preference) */ + break; + case srm_XOR_CURSOR_BLINKS: + /* intentionally ignored (this is user-preference) */ + break; +#endif + case srm_DECPFF: /* print form feed */ + DoRM(DP_PRN_FORMFEED, PrinterOf(screen).printer_formfeed); + break; + case srm_DECPEX: /* print extent */ + DoRM(DP_PRN_EXTENT, PrinterOf(screen).printer_extent); + break; + case srm_DECTCEM: /* Show/hide cursor (VT200) */ + DoRM(DP_CRS_VISIBLE, screen->cursor_set); + break; + case srm_RXVT_SCROLLBAR: + if ((screen->fullVwin.sb_info.width != 0) != + screen->save_modes[DP_RXVT_SCROLLBAR]) { + ToggleScrollBar(xw); + } + break; +#if OPT_SHIFT_FONTS + case srm_RXVT_FONTSIZE: + DoRM(DP_RXVT_FONTSIZE, xw->misc.shift_fonts); + break; +#endif +#if OPT_TEK4014 + case srm_DECTEK: + if (!(screen->inhibit & I_TEK) && + (TEK4014_ACTIVE(xw) != (Boolean) screen->save_modes[DP_DECTEK])) { + FlushLog(xw); + TEK4014_ACTIVE(xw) = (Boolean) screen->save_modes[DP_DECTEK]; + update_vttekmode(); + } + break; +#endif + case srm_132COLS: /* 132 column mode */ + DoRM(DP_X_DECCOLM, screen->c132); + update_allow132(); + break; + case srm_CURSES_HACK: /* curses hack */ + DoRM(DP_X_MORE, screen->curses); + update_cursesemul(); + break; + case srm_DECNRCM: /* national charset (VT220) */ + if (screen->vtXX_level >= 2) { + if (bitcpy(&xw->flags, screen->save_modes[DP_DECNRCM], NATIONAL)) + modified_DECNRCM(xw); + } + break; + case srm_MARGIN_BELL: /* margin bell */ + if ((DoRM(DP_X_MARGIN, screen->marginbell)) == 0) + screen->bellArmed = -1; + update_marginbell(); + break; + case srm_REVERSEWRAP: /* reverse wraparound */ + bitcpy(&xw->flags, screen->save_modes[DP_X_REVWRAP], REVERSEWRAP); + update_reversewrap(); + break; +#ifdef ALLOWLOGGING + case srm_ALLOWLOGGING: /* logging */ +#ifdef ALLOWLOGFILEONOFF + if (screen->save_modes[DP_X_LOGGING]) + StartLog(xw); + else + CloseLog(xw); +#endif /* ALLOWLOGFILEONOFF */ + /* update_logging done by StartLog and CloseLog */ + break; +#endif + case srm_OPT_ALTBUF_CURSOR: /* alternate buffer & cursor */ + /* FALLTHRU */ + case srm_OPT_ALTBUF: + /* FALLTHRU */ + case srm_ALTBUF: /* alternate buffer */ + if (!xw->misc.titeInhibit) { + if (screen->save_modes[DP_X_ALTBUF]) + ToAlternate(xw, False); + else + FromAlternate(xw); + /* update_altscreen done by ToAlt and FromAlt */ + } else if (screen->save_modes[DP_X_ALTBUF]) { + do_ti_xtra_scroll(xw); + } + break; + case srm_DECNKM: + bitcpy(&xw->flags, screen->save_modes[DP_DECKPAM], MODE_DECKPAM); + update_appkeypad(); + break; + case srm_DECBKM: /* backarrow mapping */ + bitcpy(&xw->flags, screen->save_modes[DP_DECBKM], MODE_DECBKM); + update_decbkm(); + break; + case srm_DECLRMM: /* left-right */ + bitcpy(&xw->flags, screen->save_modes[DP_X_LRMM], LEFT_RIGHT); + if (IsLeftRightMode(xw)) { + xterm_ResetDouble(xw); + } else { + reset_lr_margins(screen); + } + break; +#if OPT_SIXEL_GRAPHICS + case srm_DECSDM: /* sixel scrolling */ + bitcpy(&xw->keyboard.flags, screen->save_modes[DP_DECSDM], MODE_DECSDM); + update_decsdm(); + break; +#endif + case srm_DECNCSM: /* noclear */ + bitcpy(&xw->flags, screen->save_modes[DP_X_NCSM], NOCLEAR_COLM); + break; + case srm_VT200_MOUSE: /* mouse bogus sequence */ + /* FALLTHRU */ + case srm_VT200_HIGHLIGHT_MOUSE: + /* FALLTHRU */ + case srm_BTN_EVENT_MOUSE: + /* FALLTHRU */ + case srm_ANY_EVENT_MOUSE: + DoRM0(DP_X_MOUSE, screen->send_mouse_pos); + really_set_mousemode(xw, + screen->send_mouse_pos != MOUSE_OFF, + (XtermMouseModes) screen->send_mouse_pos); + break; +#if OPT_FOCUS_EVENT + case srm_FOCUS_EVENT_MOUSE: + DoRM(DP_X_FOCUS, screen->send_focus_pos); + break; +#endif + case srm_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_SGR_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_URXVT_EXT_MODE_MOUSE: + /* FALLTHRU */ + case srm_PIXEL_POSITION_MOUSE: + DoRM(DP_X_EXT_MOUSE, screen->extend_coords); + break; + case srm_ALLOW_ALTBUF: + DoRM(DP_ALLOW_ALTBUF, xw->misc.titeInhibit); + if (xw->misc.titeInhibit) + FromAlternate(xw); + update_titeInhibit(); + break; + case srm_SAVE_CURSOR: + if (!xw->misc.titeInhibit) { + CursorRestore(xw); + } + break; + case srm_ALTERNATE_SCROLL: + DoRM(DP_ALTERNATE_SCROLL, screen->alternateScroll); + break; + case srm_RXVT_SCROLL_TTY_OUTPUT: + DoRM(DP_RXVT_SCROLL_TTY_OUTPUT, screen->scrollttyoutput); + update_scrollttyoutput(); + break; + case srm_RXVT_SCROLL_TTY_KEYPRESS: + DoRM(DP_RXVT_SCROLL_TTY_KEYPRESS, screen->scrollkey); + update_scrollkey(); + break; + case srm_EIGHT_BIT_META: + DoRM(DP_EIGHT_BIT_META, screen->eight_bit_meta); + break; +#if OPT_NUM_LOCK + case srm_REAL_NUMLOCK: + DoRM(DP_REAL_NUMLOCK, xw->misc.real_NumLock); + update_num_lock(); + break; + case srm_META_SENDS_ESC: + DoRM(DP_META_SENDS_ESC, screen->meta_sends_esc); + update_meta_esc(); + break; +#endif + case srm_DELETE_IS_DEL: + DoRM(DP_DELETE_IS_DEL, screen->delete_is_del); + update_delete_del(); + break; +#if OPT_NUM_LOCK + case srm_ALT_SENDS_ESC: + DoRM(DP_ALT_SENDS_ESC, screen->alt_sends_esc); + update_alt_esc(); + break; +#endif + case srm_KEEP_SELECTION: + DoRM(DP_KEEP_SELECTION, screen->keepSelection); + update_keepSelection(); + break; + case srm_SELECT_TO_CLIPBOARD: + DoRM(DP_SELECT_TO_CLIPBOARD, screen->selectToClipboard); + update_selectToClipboard(); + break; + case srm_BELL_IS_URGENT: + DoRM(DP_BELL_IS_URGENT, screen->bellIsUrgent); + update_bellIsUrgent(); + break; + case srm_POP_ON_BELL: + DoRM(DP_POP_ON_BELL, screen->poponbell); + update_poponbell(); + break; + case srm_KEEP_CLIPBOARD: + DoRM(DP_KEEP_CLIPBOARD, screen->keepClipboard); + update_keepClipboard(); + break; +#if OPT_TCAP_FKEYS + case srm_TCAP_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_SUN_FUNC_KEYS + case srm_SUN_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_HP_FUNC_KEYS + case srm_HP_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_SCO_FUNC_KEYS + case srm_SCO_FKEYS: + /* FALLTHRU */ +#endif +#if OPT_SUNPC_KBD + case srm_VT220_FKEYS: + /* FALLTHRU */ +#endif + case srm_LEGACY_FKEYS: + xw->keyboard.type = (xtermKeyboardType) screen->save_modes[DP_KEYBOARD_TYPE]; + break; +#if OPT_PASTE64 || OPT_READLINE + case srm_PASTE_IN_BRACKET: + SCREEN_FLAG_restore(screen, paste_brackets); + break; +#endif +#if OPT_READLINE + case srm_BUTTON1_MOVE_POINT: + SCREEN_FLAG_restore(screen, click1_moves); + break; + case srm_BUTTON2_MOVE_POINT: + SCREEN_FLAG_restore(screen, paste_moves); + break; + case srm_DBUTTON3_DELETE: + SCREEN_FLAG_restore(screen, dclick3_deletes); + break; + case srm_PASTE_QUOTE: + SCREEN_FLAG_restore(screen, paste_quotes); + break; + case srm_PASTE_LITERAL_NL: + SCREEN_FLAG_restore(screen, paste_literal_nl); + break; +#endif /* OPT_READLINE */ +#if OPT_GRAPHICS + case srm_PRIVATE_COLOR_REGISTERS: /* private color registers for each graphic */ + TRACE(("restore PRIVATE_COLOR_REGISTERS before: %s\n", + BtoS(screen->privatecolorregisters))); + DoRM(DP_X_PRIVATE_COLOR_REGISTERS, screen->privatecolorregisters); + TRACE(("restore PRIVATE_COLOR_REGISTERS after: %s\n", + BtoS(screen->privatecolorregisters))); + update_privatecolorregisters(); + break; +#endif +#if OPT_SIXEL_GRAPHICS + case srm_SIXEL_SCROLLS_RIGHT: + TRACE(("restore SIXEL_SCROLLS_RIGHT before: %s\n", + BtoS(screen->sixel_scrolls_right))); + DoRM(DP_SIXEL_SCROLLS_RIGHT, screen->sixel_scrolls_right); + TRACE(("restore SIXEL_SCROLLS_RIGHT after: %s\n", + BtoS(screen->sixel_scrolls_right))); + break; +#endif + } + } +} + +/* + * Convert an XTextProperty to a string. + * + * This frees the data owned by the XTextProperty, and returns in its place the + * string, which must be freed by the caller. + */ +static char * +property_to_string(XtermWidget xw, XTextProperty * text) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + char *result = 0; + char **list = NULL; + int length = 0; + int rc; + + TRACE(("property_to_string value %p, encoding %s, format %d, nitems %ld\n", + text->value, + TraceAtomName(dpy, text->encoding), + text->format, + text->nitems)); + +#if OPT_WIDE_CHARS + /* + * We will use the XmbTextPropertyToTextList call to extract UTF-8 data. + * The xtermUtf8ToTextList() call is used to convert UTF-8 explicitly to + * ISO-8859-1. + */ + rc = -1; + if ((text->format != 8) + || IsTitleMode(xw, tmGetUtf8) + || (text->encoding == XA_UTF8_STRING(dpy) && + !(screen->wide_chars || screen->c1_printable) && + (rc = xtermUtf8ToTextList(xw, text, &list, &length)) < 0) + || (rc < 0)) +#endif + if ((rc = XmbTextPropertyToTextList(dpy, text, &list, &length)) < 0) + rc = XTextPropertyToStringList(text, &list, &length); + + if (rc >= 0) { + int n, c, pass; + size_t need; + + for (pass = 0; pass < 2; ++pass) { + for (n = 0, need = 0; n < length; n++) { + char *s = list[n]; + while ((c = *s++) != '\0') { + if (pass) + result[need] = (char) c; + ++need; + } + } + if (pass) + result[need] = '\0'; + else + result = malloc(need + 1); + if (result == 0) + break; + } + XFreeStringList(list); + } + if (text->value != 0) + XFree(text->value); + + return result; +} + +static char * +get_icon_label(XtermWidget xw) +{ + XTextProperty text; + char *result = 0; + + if (XGetWMIconName(TScreenOf(xw)->display, VShellWindow(xw), &text)) { + result = property_to_string(xw, &text); + } + return result; +} + +static char * +get_window_label(XtermWidget xw) +{ + XTextProperty text; + char *result = 0; + + if (XGetWMName(TScreenOf(xw)->display, VShellWindow(xw), &text)) { + result = property_to_string(xw, &text); + } + return result; +} + +/* + * Report window label (icon or title) in dtterm protocol + * ESC ] code label ESC backslash + */ +static void +report_win_label(XtermWidget xw, + int code, + char *text) +{ + unparseputc(xw, ANSI_ESC); + unparseputc(xw, ']'); + unparseputc(xw, code); + + if (text != 0) { + int copy = IsTitleMode(xw, tmGetBase16); + if (copy) { + TRACE(("Encoding hex:%s\n", text)); + text = x_encode_hex(text); + } + unparseputs(xw, text); + if (copy) + free(text); + } + + unparseputc(xw, ANSI_ESC); + unparseputc(xw, '\\'); /* should be ST */ + unparse_end(xw); +} + +/* + * Window operations (from CDE dtterm description, as well as extensions). + * See also "allowWindowOps" resource. + */ +static void +window_ops(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + XWindowChanges values; + XWindowAttributes win_attrs; +#if OPT_MAXIMIZE + unsigned root_width; + unsigned root_height; +#endif + int code = zero_if_default(0); + char *label; + + TRACE(("window_ops %d\n", code)); + switch (code) { + case ewRestoreWin: /* Restore (de-iconify) window */ + if (AllowWindowOps(xw, ewRestoreWin)) { + xtermDeiconify(xw); + } + break; + + case ewMinimizeWin: /* Minimize (iconify) window */ + if (AllowWindowOps(xw, ewMinimizeWin)) { + xtermIconify(xw); + } + break; + + case ewSetWinPosition: /* Move the window to the given position */ + if (AllowWindowOps(xw, ewSetWinPosition)) { + unsigned value_mask; + + values.x = (Position) zero_if_default(1); + values.y = (Position) zero_if_default(2); + TRACE(("...move window to %d,%d\n", values.x, values.y)); + value_mask = (CWX | CWY); + XReconfigureWMWindow(screen->display, + VShellWindow(xw), + DefaultScreen(screen->display), + value_mask, + &values); + } + break; + + case ewSetWinSizePixels: /* Resize the window to given size in pixels */ + if (AllowWindowOps(xw, ewSetWinSizePixels)) { + RequestResize(xw, optional_param(1), optional_param(2), False); + } + break; + + case ewRaiseWin: /* Raise the window to the front of the stack */ + if (AllowWindowOps(xw, ewRaiseWin)) { + TRACE(("...raise window\n")); + XRaiseWindow(screen->display, VShellWindow(xw)); + } + break; + + case ewLowerWin: /* Lower the window to the bottom of the stack */ + if (AllowWindowOps(xw, ewLowerWin)) { + TRACE(("...lower window\n")); + XLowerWindow(screen->display, VShellWindow(xw)); + } + break; + + case ewRefreshWin: /* Refresh the window */ + if (AllowWindowOps(xw, ewRefreshWin)) { + TRACE(("...redraw window\n")); + Redraw(); + } + break; + + case ewSetWinSizeChars: /* Resize the text-area, in characters */ + if (AllowWindowOps(xw, ewSetWinSizeChars)) { + RequestResize(xw, optional_param(1), optional_param(2), True); + } + break; + +#if OPT_MAXIMIZE + case ewMaximizeWin: /* Maximize or restore */ + if (AllowWindowOps(xw, ewMaximizeWin)) { + RequestMaximize(xw, zero_if_default(1)); + } + break; + case ewFullscreenWin: /* Fullscreen or restore */ + if (AllowWindowOps(xw, ewFullscreenWin)) { + switch (zero_if_default(1)) { + default: + RequestMaximize(xw, 0); + break; + case 1: + RequestMaximize(xw, 1); + break; + case 2: + RequestMaximize(xw, !(screen->restore_data)); + break; + } + } + break; +#endif + + case ewGetWinState: /* Report the window's state */ + if (AllowWindowOps(xw, ewGetWinState)) { + TRACE(("...get window attributes\n")); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 1; + reply.a_param[0] = (ParmType) (xtermIsIconified(xw) ? 2 : 1); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; + + case ewGetWinPosition: /* Report the window's position */ + if (AllowWindowOps(xw, ewGetWinPosition)) { + Window win; + Window result_win; + int result_y, result_x; + + TRACE(("...get window position\n")); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 3; + switch (zero_if_default(1)) { + case 2: /* report the text-window's position */ + result_y = 0; + result_x = 0; + { + Widget mw; + for (mw = (Widget) xw; mw != 0; mw = XtParent(mw)) { + result_x += mw->core.x; + result_y += mw->core.y; + if (mw == SHELL_OF(xw)) + break; + } + } + result_x += OriginX(screen); + result_y += OriginY(screen); + break; + default: + win = WMFrameWindow(xw); + xtermGetWinAttrs(screen->display, + win, + &win_attrs); + XTranslateCoordinates(screen->display, + VShellWindow(xw), + win_attrs.root, + -win_attrs.border_width, + -win_attrs.border_width, + &result_x, &result_y, &result_win); + TRACE(("translated position %d,%d vs %d,%d\n", + result_y, result_x, + win_attrs.y, win_attrs.x)); + if (!discount_frame_extents(xw, &result_y, &result_x)) { + TRACE(("...cancelled translation\n")); + result_y = win_attrs.y; + result_x = win_attrs.x; + } + break; + } + reply.a_param[1] = (ParmType) result_x; + reply.a_param[2] = (ParmType) result_y; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; + + case ewGetWinSizePixels: /* Report the window's size in pixels */ + if (AllowWindowOps(xw, ewGetWinSizePixels)) { + ParmType high = (ParmType) Height(screen); + ParmType wide = (ParmType) Width(screen); + + TRACE(("...get window size in pixels\n")); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 4; + switch (zero_if_default(1)) { + case 2: /* report the shell-window's size */ + xtermGetWinAttrs(screen->display, + WMFrameWindow(xw), + &win_attrs); + high = (ParmType) win_attrs.height; + wide = (ParmType) win_attrs.width; + /* FALLTHRU */ + default: + reply.a_param[1] = high; + reply.a_param[2] = wide; + break; + } + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; + +#if OPT_MAXIMIZE + case ewGetScreenSizePixels: /* Report the screen's size, in Pixels */ + if (AllowWindowOps(xw, ewGetScreenSizePixels)) { + TRACE(("...get screen size in pixels\n")); + (void) QueryMaximize(xw, &root_width, &root_height); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 5; + reply.a_param[1] = (ParmType) root_height; + reply.a_param[2] = (ParmType) root_width; + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; + case ewGetCharSizePixels: /* Report the font's size, in pixel */ + if (AllowWindowOps(xw, ewGetScreenSizeChars)) { + TRACE(("...get font size in pixels\n")); + TRACE(("...using font size %dx%d\n", + FontHeight(screen), + FontWidth(screen))); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 6; + reply.a_param[1] = (ParmType) FontHeight(screen); + reply.a_param[2] = (ParmType) FontWidth(screen); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; +#endif + + case ewGetWinSizeChars: /* Report the text's size in characters */ + if (AllowWindowOps(xw, ewGetWinSizeChars)) { + TRACE(("...get window size in characters\n")); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 8; + reply.a_param[1] = (ParmType) MaxRows(screen); + reply.a_param[2] = (ParmType) MaxCols(screen); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; + +#if OPT_MAXIMIZE + case ewGetScreenSizeChars: /* Report the screen's size, in characters */ + if (AllowWindowOps(xw, ewGetScreenSizeChars)) { + TRACE(("...get screen size in characters\n")); + TRACE(("...using font size %dx%d\n", + FontHeight(screen), + FontWidth(screen))); + (void) QueryMaximize(xw, &root_width, &root_height); + init_reply(ANSI_CSI); + reply.a_pintro = 0; + reply.a_nparam = 3; + reply.a_param[0] = 9; + reply.a_param[1] = (ParmType) (root_height + / (unsigned) FontHeight(screen)); + reply.a_param[2] = (ParmType) (root_width + / (unsigned) FontWidth(screen)); + reply.a_inters = 0; + reply.a_final = 't'; + unparseseq(xw, &reply); + } + break; +#endif + + case ewGetIconTitle: /* Report the icon's label */ + if (AllowWindowOps(xw, ewGetIconTitle)) { + TRACE(("...get icon's label\n")); + report_win_label(xw, 'L', label = get_icon_label(xw)); + free(label); + } + break; + + case ewGetWinTitle: /* Report the window's title */ + if (AllowWindowOps(xw, ewGetWinTitle)) { + TRACE(("...get window's label\n")); + report_win_label(xw, 'l', label = get_window_label(xw)); + free(label); + } + break; + + case ewPushTitle: /* save the window's title(s) on stack */ + if (AllowWindowOps(xw, ewPushTitle)) { + SaveTitle *last = screen->save_title; + SaveTitle *item = TypeCalloc(SaveTitle); + + TRACE(("...push title onto stack\n")); + if (item != 0) { + switch (zero_if_default(1)) { + case 0: + item->iconName = get_icon_label(xw); + item->windowName = get_window_label(xw); + break; + case 1: + item->iconName = get_icon_label(xw); + break; + case 2: + item->windowName = get_window_label(xw); + break; + } + item->next = last; + if (item->iconName == 0) { + item->iconName = ((last == 0) + ? get_icon_label(xw) + : x_strdup(last->iconName)); + } + if (item->windowName == 0) { + item->windowName = ((last == 0) + ? get_window_label(xw) + : x_strdup(last->windowName)); + } + screen->save_title = item; + } + } + break; + + case ewPopTitle: /* restore the window's title(s) from stack */ + if (AllowWindowOps(xw, ewPopTitle)) { + SaveTitle *item = screen->save_title; + + TRACE(("...pop title off stack\n")); + if (item != 0) { + switch (zero_if_default(1)) { + case 0: + ChangeIconName(xw, item->iconName); + ChangeTitle(xw, item->windowName); + break; + case 1: + ChangeIconName(xw, item->iconName); + break; + case 2: + ChangeTitle(xw, item->windowName); + break; + } + screen->save_title = item->next; + free(item->iconName); + free(item->windowName); + free(item); + } + } + break; + + default: /* DECSLPP (24, 25, 36, 48, 72, 144) */ + if (AllowWindowOps(xw, ewSetWinLines)) { + if (code >= 24) + RequestResize(xw, code, -1, True); + } + break; + } +} + +/* + * set a bit in a word given a pointer to the word and a mask. + */ +static int +bitset(unsigned *p, unsigned mask) +{ + unsigned before = *p; + *p |= mask; + return (before != *p); +} + +/* + * clear a bit in a word given a pointer to the word and a mask. + */ +static int +bitclr(unsigned *p, unsigned mask) +{ + unsigned before = *p; + *p &= ~mask; + return (before != *p); +} + +/* + * Copy bits from one word to another, given a mask + */ +static int +bitcpy(unsigned *p, unsigned q, unsigned mask) +{ + unsigned before = *p; + bitclr(p, mask); + bitset(p, q & mask); + return (before != *p); +} + +void +unparseputc1(XtermWidget xw, int c) +{ + if (c >= 0x80 && c <= 0x9F) { + if (!TScreenOf(xw)->control_eight_bits) { + unparseputc(xw, A2E(ANSI_ESC)); + c = A2E(c - 0x40); + } + } + unparseputc(xw, c); +} + +void +unparseseq(XtermWidget xw, ANSI *ap) +{ + int c; + + assert(ap->a_nparam < NPARAM); + unparseputc1(xw, c = ap->a_type); + if (c == ANSI_ESC + || c == ANSI_DCS + || c == ANSI_CSI + || c == ANSI_OSC + || c == ANSI_PM + || c == ANSI_APC + || c == ANSI_SS3) { + int i; + int inters; + char temp[8]; + + if (ap->a_pintro != 0) + unparseputc(xw, ap->a_pintro); + for (i = 0; i < ap->a_nparam; ++i) { + if (i != 0) { + if (ap->a_radix[i] == 1 || ap->a_radix[i - 1] == 1) { + ; + } else if (ap->a_delim) { + unparseputs(xw, ap->a_delim); + } else { + unparseputc(xw, ';'); + } + } + switch (ap->a_radix[i]) { + case 16: + sprintf(temp, "%04X", ap->a_param[i] & 0xffff); + unparseputs(xw, temp); + break; + case 1: + unparseputc(xw, ap->a_param[i]); + break; + default: + unparseputn(xw, (unsigned) ap->a_param[i]); + break; + } + } + if ((inters = ap->a_inters) != 0) { + for (i = 3; i >= 0; --i) { + c = CharOf(inters >> (8 * i)); + if (c != 0) + unparseputc(xw, c); + } + } + switch (ap->a_type) { + case ANSI_DCS: + /* FALLTHRU */ + case ANSI_OSC: + /* FALLTHRU */ + case ANSI_PM: + /* FALLTHRU */ + case ANSI_APC: + unparseputc1(xw, ANSI_ST); + break; + default: + unparseputc(xw, (char) ap->a_final); + break; + } + } + unparse_end(xw); +} + +void +unparseputn(XtermWidget xw, unsigned n) +{ + unsigned q; + + q = n / 10; + if (q != 0) + unparseputn(xw, q); + unparseputc(xw, (char) ('0' + (n % 10))); +} + +void +unparseputs(XtermWidget xw, const char *s) +{ + if (s != 0) { + while (*s) + unparseputc(xw, *s++); + } +} + +void +unparseputc(XtermWidget xw, int c) +{ + TScreen *screen = TScreenOf(xw); + IChar *buf = screen->unparse_bfr; + unsigned len; + + if ((screen->unparse_len + 2) >= screen->unparse_max) + unparse_end(xw); + + len = screen->unparse_len; + +#if OPT_TCAP_QUERY + /* + * If we're returning a termcap string, it has to be translated since + * a DCS must not contain any characters except for the normal 7-bit + * printable ASCII (counting tab, carriage return, etc). For now, + * just use hexadecimal for the whole thing. + */ + if (screen->tc_query_code >= 0) { + char tmp[3]; + sprintf(tmp, "%02X", c & 0xFF); + buf[len++] = CharOf(tmp[0]); + buf[len++] = CharOf(tmp[1]); + } else +#endif + if ((buf[len++] = (IChar) c) == '\r' && (xw->flags & LINEFEED)) { + buf[len++] = '\n'; + } + + screen->unparse_len = len; + + /* If send/receive mode is reset, we echo characters locally */ + if ((xw->keyboard.flags & MODE_SRM) == 0) { + (void) redoparsing(xw, (unsigned) c, &myState, PARSE_SRM); + } +} + +void +unparse_end(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + +#if OPT_TCAP_QUERY + /* + * tcap-query works by simulating key-presses, which ordinarily would be + * flushed out at the end of each key. For better efficiency, do not do + * the flush unless we are about to fill the buffer used to capture the + * response. + */ + if ((screen->tc_query_code >= 0) + && (screen->unparse_len + 2 < screen->unparse_max)) { + return; + } +#endif + if (screen->unparse_len) { + TRACE(("unparse_end %u:%s\n", + screen->unparse_len, + visibleIChars(screen->unparse_bfr, screen->unparse_len))); +#ifdef VMS + tt_write(screen->unparse_bfr, screen->unparse_len); +#else /* VMS */ + writePtyData(screen->respond, screen->unparse_bfr, screen->unparse_len); +#endif /* VMS */ + screen->unparse_len = 0; + } +} + +void +ToggleAlternate(XtermWidget xw) +{ + if (TScreenOf(xw)->whichBuf) + FromAlternate(xw); + else + ToAlternate(xw, False); +} + +static void +ToAlternate(XtermWidget xw, Bool clearFirst) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->whichBuf == 0) { + TRACE(("ToAlternate\n")); + if (!screen->editBuf_index[1]) + screen->editBuf_index[1] = allocScrnBuf(xw, + (unsigned) MaxRows(screen), + (unsigned) MaxCols(screen), + &screen->editBuf_data[1]); + SwitchBufs(xw, 1, clearFirst); +#if OPT_SAVE_LINES + screen->visbuf = screen->editBuf_index[screen->whichBuf]; +#endif + update_altscreen(); + } +} + +static void +FromAlternate(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->whichBuf != 0) { + TRACE(("FromAlternate\n")); + if (screen->scroll_amt) + FlushScroll(xw); + SwitchBufs(xw, 0, False); +#if OPT_SAVE_LINES + screen->visbuf = screen->editBuf_index[screen->whichBuf]; +#endif + update_altscreen(); + } +} + +static void +SwitchBufs(XtermWidget xw, int toBuf, Bool clearFirst) +{ + TScreen *screen = TScreenOf(xw); + int rows, top; + + screen->whichBuf = toBuf; + if (screen->cursor_state) + HideCursor(); + + rows = MaxRows(screen); + SwitchBufPtrs(screen, toBuf); + + if ((top = INX2ROW(screen, 0)) < rows) { + if (screen->scroll_amt) { + FlushScroll(xw); + } + xtermClear2(xw, + (int) OriginX(screen), + (int) top * FontHeight(screen) + screen->border, + (unsigned) Width(screen), + (unsigned) ((rows - top) * FontHeight(screen))); + if (clearFirst) { + ClearBufRows(xw, top, rows); + } + } + ScrnUpdate(xw, 0, 0, rows, MaxCols(screen), False); +} + +Bool +CheckBufPtrs(TScreen *screen) +{ + return (screen->visbuf != 0 +#if OPT_SAVE_LINES + && screen->editBuf_index[0] != 0 +#endif + && screen->editBuf_index[1] != 0); +} + +/* + * Swap buffer line pointers between alternate and regular screens. + */ +void +SwitchBufPtrs(TScreen *screen, int toBuf) +{ + if (CheckBufPtrs(screen)) { +#if OPT_SAVE_LINES + screen->visbuf = screen->editBuf_index[toBuf]; +#else + size_t len = ScrnPointers(screen, (size_t) MaxRows(screen)); + + (void) toBuf; + memcpy(screen->save_ptr, screen->visbuf, len); + memcpy(screen->visbuf, screen->editBuf_index[1], len); + memcpy(screen->editBuf_index[1], screen->save_ptr, len); +#endif + } +} + +void +VTRun(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + TRACE(("VTRun ...\n")); + + if (!screen->Vshow) { + set_vt_visibility(True); + } + update_vttekmode(); + update_vtshow(); + update_tekshow(); + set_vthide_sensitivity(); + + ScrnAllocBuf(xw); + + screen->cursor_state = OFF; + screen->cursor_set = ON; +#if OPT_BLINK_CURS + if (DoStartBlinking(screen)) + StartBlinking(xw); +#endif + +#if OPT_TEK4014 + if (Tpushb > Tpushback) { + fillPtyData(xw, VTbuffer, (char *) Tpushback, (int) (Tpushb - Tpushback)); + Tpushb = Tpushback; + } +#endif + screen->is_running = True; + if (screen->embed_high && screen->embed_wide) { + ScreenResize(xw, screen->embed_wide, screen->embed_high, &(xw->flags)); + } +#if OPT_MAXIMIZE + else if (resource.fullscreen == esTrue || resource.fullscreen == esAlways) + FullScreen(xw, True); +#endif + if (!setjmp(VTend)) + VTparse(xw); + StopBlinking(xw); + HideCursor(); + screen->cursor_set = OFF; + TRACE(("... VTRun\n")); +} + +/*ARGSUSED*/ +static void +VTExpose(Widget w GCC_UNUSED, + XEvent *event, + Region region GCC_UNUSED) +{ + DEBUG_MSG("Expose\n"); + if (event->type == Expose) + HandleExposure(term, event); +} + +static void +VTGraphicsOrNoExpose(XEvent *event) +{ + XtermWidget xw = term; + TScreen *screen = TScreenOf(xw); + if (screen->incopy <= 0) { + screen->incopy = 1; + if (screen->scrolls > 0) + screen->scrolls--; + } + if (event->type == GraphicsExpose) + if (HandleExposure(xw, event)) + screen->cursor_state = OFF; + if ((event->type == NoExpose) + || ((XGraphicsExposeEvent *) event)->count == 0) { + if (screen->incopy <= 0 && screen->scrolls > 0) + screen->scrolls--; + if (screen->scrolls) + screen->incopy = -1; + else + screen->incopy = 0; + } +} + +/*ARGSUSED*/ +static void +VTNonMaskableEvent(Widget w GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XEvent *event, + Boolean *cont GCC_UNUSED) +{ + switch (event->type) { + case GraphicsExpose: + /* FALLTHRU */ + case NoExpose: + VTGraphicsOrNoExpose(event); + break; + } +} + +static void +VTResize(Widget w) +{ + if (XtIsRealized(w)) { + XtermWidget xw = (XtermWidget) w; + ScreenResize(xw, xw->core.width, xw->core.height, &xw->flags); + } +} + +#define okDimension(src,dst) ((src <= 32767) \ + && ((dst = (Dimension) src) == src)) + +static void +RequestResize(XtermWidget xw, int rows, int cols, Bool text) +{ + TScreen *screen = TScreenOf(xw); + Dimension replyWidth, replyHeight; + Dimension askedWidth, askedHeight; + XtGeometryResult status; + XWindowAttributes attrs; +#if OPT_RENDERFONT && USE_DOUBLE_BUFFER + Boolean buggyXft = False; + Cardinal ignore = 0; +#endif + + TRACE(("RequestResize(rows=%d, cols=%d, text=%d)\n", rows, cols, text)); + + /* check first if the row/column values fit into a Dimension */ + if (cols > 0) { + if ((int) (askedWidth = (Dimension) cols) < cols) { + TRACE(("... cols too large for Dimension\n")); + return; + } + } else { + askedWidth = 0; + } + if (rows > 0) { + if ((int) (askedHeight = (Dimension) rows) < rows) { + TRACE(("... rows too large for Dimension\n")); + return; + } + } else { + askedHeight = 0; + } + + xw->work.doing_resize = True; + +#if OPT_RENDERFONT && USE_DOUBLE_BUFFER + /* + * Work around a bug seen when vttest switches from 132 columns back to 80 + * columns, while double-buffering is active. If Xft is active during the + * resize, the screen will be blank thereafter. This workaround causes + * some extra flickering, but that is preferable to a blank screen. + * + * Since the bitmap- and TrueType-fonts do not always have identical sizes, + * do this switching early, to use the updated font-sizes in the request + * for resizing the window. + */ +#define ToggleXft() HandleRenderFont((Widget)xw, (XEvent *)0, (String *)0, &ignore) + if (resource.buffered + && UsingRenderFont(xw)) { + ToggleXft(); + buggyXft = True; + } +#endif + + /* + * If the requested values will fit into a Dimension, and one or both are + * zero, get the current corresponding screen dimension to use as a limit. + */ + if (askedHeight == 0 + || askedWidth == 0 + || xw->misc.limit_resize > 0) { + xtermGetWinAttrs(XtDisplay(xw), + RootWindowOfScreen(XtScreen(xw)), &attrs); + } + + /* + * Using the current font metrics, translate the requested character + * rows/columns into pixels. + */ + if (text) { + unsigned long value; + + if ((value = (unsigned long) rows) != 0) { + if (rows < 0) + value = (unsigned long) MaxRows(screen); + value *= (unsigned long) FontHeight(screen); + value += (unsigned long) (2 * screen->border); + if (!okDimension(value, askedHeight)) + goto give_up; + } + + if ((value = (unsigned long) cols) != 0) { + if (cols < 0) + value = (unsigned long) MaxCols(screen); + value *= (unsigned long) FontWidth(screen); + value += (unsigned long) ((2 * screen->border) + + ScrollbarWidth(screen)); + if (!okDimension(value, askedWidth)) + goto give_up; + } + + } else { + if (rows < 0) + askedHeight = FullHeight(screen); + if (cols < 0) + askedWidth = FullWidth(screen); + } + + if (rows == 0) { + askedHeight = (Dimension) attrs.height; + } + if (cols == 0) { + askedWidth = (Dimension) attrs.width; + } + + if (xw->misc.limit_resize > 0) { + Dimension high = (Dimension) (xw->misc.limit_resize * attrs.height); + Dimension wide = (Dimension) (xw->misc.limit_resize * attrs.width); + if ((int) high < attrs.height) + high = (Dimension) attrs.height; + if (askedHeight > high) + askedHeight = high; + if ((int) wide < attrs.width) + wide = (Dimension) attrs.width; + if (askedWidth > wide) + askedWidth = wide; + } +#ifndef nothack + getXtermSizeHints(xw); +#endif + + TRACE(("...requesting resize %dx%d\n", askedHeight, askedWidth)); + status = REQ_RESIZE((Widget) xw, + askedWidth, askedHeight, + &replyWidth, &replyHeight); + + if (status == XtGeometryYes || + status == XtGeometryDone) { + ScreenResize(xw, replyWidth, replyHeight, &xw->flags); + } +#ifndef nothack + /* + * XtMakeResizeRequest() has the undesirable side-effect of clearing + * the window manager's hints, even on a failed request. This would + * presumably be fixed if the shell did its own work. + */ + if (xw->hints.flags + && replyHeight + && replyWidth) { + xw->hints.height = replyHeight; + xw->hints.width = replyWidth; + + TRACE(("%s@%d -- ", __FILE__, __LINE__)); + TRACE_HINTS(&xw->hints); + XSetWMNormalHints(screen->display, VShellWindow(xw), &xw->hints); + TRACE(("%s@%d -- ", __FILE__, __LINE__)); + TRACE_WM_HINTS(xw); + } +#endif + + XSync(screen->display, False); /* synchronize */ + if (xtermAppPending()) { + xevents(xw); + } + + give_up: +#if OPT_RENDERFONT && USE_DOUBLE_BUFFER + if (buggyXft) { + ToggleXft(); + if (xtermAppPending()) { + xevents(xw); + } + } +#endif + + xw->work.doing_resize = False; + + TRACE(("...RequestResize done\n")); + return; +} + +static String xterm_trans = +"WM_PROTOCOLS: DeleteWindow()\n\ + : KeyboardMapping()\n"; + +int +VTInit(XtermWidget xw) +{ + Widget vtparent = SHELL_OF(xw); + + TRACE(("VTInit {{\n")); + + XtRealizeWidget(vtparent); + XtOverrideTranslations(vtparent, XtParseTranslationTable(xterm_trans)); + (void) XSetWMProtocols(XtDisplay(vtparent), XtWindow(vtparent), + &wm_delete_window, 1); + TRACE_TRANS("shell", vtparent); + TRACE_TRANS("vt100", (Widget) (xw)); + + ScrnAllocBuf(xw); + + TRACE(("...}} VTInit\n")); + return (1); +} + +static void +VTClassInit(void) +{ + XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, + (XtConvertArgList) NULL, (Cardinal) 0); +} + +#if OPT_COLOR_RES +/* + * Override the use of XtDefaultForeground/XtDefaultBackground to make some + * colors, such as cursor color, use the actual foreground/background value + * if there is no explicit resource value used. + */ +static Pixel +fill_Tres(XtermWidget target, XtermWidget source, int offset) +{ + char *name; + ScrnColors temp; + TScreen *src = TScreenOf(source); + TScreen *dst = TScreenOf(target); + + dst->Tcolors[offset] = src->Tcolors[offset]; + dst->Tcolors[offset].mode = False; + + if ((name = x_strtrim(dst->Tcolors[offset].resource)) != 0) + dst->Tcolors[offset].resource = name; + + if (name == 0) { + dst->Tcolors[offset].value = target->dft_foreground; + } else if (isDefaultForeground(name)) { + dst->Tcolors[offset].value = ((offset == TEXT_FG || offset == TEXT_BG) + ? target->dft_foreground + : dst->Tcolors[TEXT_FG].value); + } else if (isDefaultBackground(name)) { + dst->Tcolors[offset].value = ((offset == TEXT_FG || offset == TEXT_BG) + ? target->dft_background + : dst->Tcolors[TEXT_BG].value); + } else { + memset(&temp, 0, sizeof(temp)); + if (AllocateTermColor(target, &temp, offset, name, True)) { + if (COLOR_DEFINED(&(temp), offset)) + free(temp.names[offset]); + dst->Tcolors[offset].value = temp.colors[offset]; + } else if (offset == TEXT_FG || offset == TEXT_BG) { + free(name); + dst->Tcolors[offset].resource = 0; + } + } + return dst->Tcolors[offset].value; +} + +/* + * If one or both of the foreground/background colors cannot be allocated, + * e.g., due to gross misconfiguration, recover by setting both to the + * display's default values. + */ +static void +repairColors(XtermWidget target) +{ + TScreen *screen = TScreenOf(target); + + if (screen->Tcolors[TEXT_FG].resource == 0 || + screen->Tcolors[TEXT_BG].resource == 0) { + xtermWarning("unable to allocate fg/bg colors\n"); + screen->Tcolors[TEXT_FG].resource = x_strdup(XtDefaultForeground); + screen->Tcolors[TEXT_BG].resource = x_strdup(XtDefaultBackground); + if (screen->Tcolors[TEXT_FG].resource == 0 || + screen->Tcolors[TEXT_BG].resource == 0) { + Exit(1); + } + screen->Tcolors[TEXT_FG].value = target->dft_foreground; + screen->Tcolors[TEXT_BG].value = target->dft_background; + } +} +#else +#define fill_Tres(target, source, offset) \ + TScreenOf(target)->Tcolors[offset] = TScreenOf(source)->Tcolors[offset] +#define repairColors(target) /* nothing */ +#endif + +#if OPT_WIDE_CHARS +static void +set_utf8_feature(TScreen *screen, int *feature) +{ + if (*feature == uDefault) { + switch (screen->utf8_mode) { + case uFalse: + /* FALLTHRU */ + case uTrue: + *feature = screen->utf8_mode; + break; + case uDefault: + /* should not happen */ + *feature = uTrue; + break; + case uAlways: + /* use this to disable menu entry */ + break; + } + } +} + +static void +VTInitialize_locale(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Bool is_utf8 = xtermEnvUTF8(); + + TRACE(("VTInitialize_locale\n")); + TRACE(("... request screen.utf8_mode = %d\n", screen->utf8_mode)); + TRACE(("... request screen.utf8_fonts = %d\n", screen->utf8_fonts)); + TRACE(("... request screen.utf8_title = %d\n", screen->utf8_title)); + + screen->utf8_always = (screen->utf8_mode == uAlways); + if (screen->utf8_mode < 0) + screen->utf8_mode = uFalse; + + if (screen->utf8_mode > 3) + screen->utf8_mode = uDefault; + + screen->latin9_mode = 0; + screen->unicode_font = 0; +#if OPT_LUIT_PROG + xw->misc.callfilter = 0; + xw->misc.use_encoding = 0; + + TRACE(("... setup for luit:\n")); + TRACE(("... request misc.locale_str = \"%s\"\n", xw->misc.locale_str)); + + if (screen->utf8_mode == uFalse) { + TRACE(("... command-line +u8 overrides\n")); + } else +#if OPT_MINI_LUIT + if (x_strcasecmp(xw->misc.locale_str, "CHECKFONT") == 0) { + int fl = (int) strlen(DefaultFontN(xw)); + if (fl > 11 + && x_strcasecmp(DefaultFontN(xw) + fl - 11, "-ISO10646-1") == 0) { + screen->unicode_font = 1; + /* unicode font, use True */ +#ifdef HAVE_LANGINFO_CODESET + if (!strcmp(xtermEnvEncoding(), "ANSI_X3.4-1968") + || !strcmp(xtermEnvEncoding(), "ISO-8859-1")) { + if (screen->utf8_mode == uDefault) + screen->utf8_mode = uFalse; + } else if (!strcmp(xtermEnvEncoding(), "ISO-8859-15")) { + if (screen->utf8_mode == uDefault) + screen->utf8_mode = uFalse; + screen->latin9_mode = 1; + } else { + xw->misc.callfilter = (Boolean) (is_utf8 ? 0 : 1); + screen->utf8_mode = uAlways; + } +#else + xw->misc.callfilter = is_utf8 ? 0 : 1; + screen->utf8_mode = uAlways; +#endif + } else { + /* other encoding, use False */ + if (screen->utf8_mode == uDefault) { + screen->utf8_mode = is_utf8 ? uAlways : uFalse; + } + } + } else +#endif /* OPT_MINI_LUIT */ + if (x_strcasecmp(xw->misc.locale_str, "TRUE") == 0 || + x_strcasecmp(xw->misc.locale_str, "ON") == 0 || + x_strcasecmp(xw->misc.locale_str, "YES") == 0 || + x_strcasecmp(xw->misc.locale_str, "AUTO") == 0 || + strcmp(xw->misc.locale_str, "1") == 0) { + /* when true ... fully obeying LC_CTYPE locale */ + xw->misc.callfilter = (Boolean) (is_utf8 ? 0 : 1); + screen->utf8_mode = uAlways; + } else if (x_strcasecmp(xw->misc.locale_str, "FALSE") == 0 || + x_strcasecmp(xw->misc.locale_str, "OFF") == 0 || + x_strcasecmp(xw->misc.locale_str, "NO") == 0 || + strcmp(xw->misc.locale_str, "0") == 0) { + /* when false ... original value of utf8_mode is effective */ + if (screen->utf8_mode == uDefault) { + screen->utf8_mode = is_utf8 ? uAlways : uFalse; + } + } else if (x_strcasecmp(xw->misc.locale_str, "MEDIUM") == 0 || + x_strcasecmp(xw->misc.locale_str, "SEMIAUTO") == 0) { + /* when medium ... obeying locale only for UTF-8 and Asian */ + if (is_utf8) { + screen->utf8_mode = uAlways; + } else if ( +#ifdef MB_CUR_MAX + MB_CUR_MAX > 1 || +#else + !strncmp(xtermEnvLocale(), "ja", (size_t) 2) || + !strncmp(xtermEnvLocale(), "ko", (size_t) 2) || + !strncmp(xtermEnvLocale(), "zh", (size_t) 2) || +#endif + !strncmp(xtermEnvLocale(), "th", (size_t) 2) || + !strncmp(xtermEnvLocale(), "vi", (size_t) 2)) { + xw->misc.callfilter = 1; + screen->utf8_mode = uAlways; + } else { + screen->utf8_mode = uFalse; + } + } else if (x_strcasecmp(xw->misc.locale_str, "UTF-8") == 0 || + x_strcasecmp(xw->misc.locale_str, "UTF8") == 0) { + /* when UTF-8 ... UTF-8 mode */ + screen->utf8_mode = uAlways; + } else { + /* other words are regarded as encoding name passed to luit */ + xw->misc.callfilter = 1; + screen->utf8_mode = uAlways; + xw->misc.use_encoding = 1; + } + TRACE(("... updated misc.callfilter = %s\n", BtoS(xw->misc.callfilter))); + TRACE(("... updated misc.use_encoding = %s\n", BtoS(xw->misc.use_encoding))); +#else + if (screen->utf8_mode == uDefault) { + screen->utf8_mode = is_utf8 ? uAlways : uFalse; + } +#endif /* OPT_LUIT_PROG */ + + set_utf8_feature(screen, &screen->utf8_fonts); + set_utf8_feature(screen, &screen->utf8_title); + + screen->utf8_inparse = (Boolean) (screen->utf8_mode != uFalse); + + TRACE(("... updated screen.utf8_mode = %d\n", screen->utf8_mode)); + TRACE(("... updated screen.utf8_fonts = %d\n", screen->utf8_fonts)); + TRACE(("... updated screen.utf8_title = %d\n", screen->utf8_title)); + TRACE(("...VTInitialize_locale done\n")); +} +#endif + +void +lookupSelectUnit(XtermWidget xw, Cardinal item, String value) +{ + /* *INDENT-OFF* */ + static const struct { + const char * name; + SelectUnit code; + } table[] = { + { "char", Select_CHAR }, + { "word", Select_WORD }, + { "line", Select_LINE }, + { "group", Select_GROUP }, + { "page", Select_PAGE }, + { "all", Select_ALL }, +#if OPT_SELECT_REGEX + { "regex", Select_REGEX }, +#endif + }; + /* *INDENT-ON* */ + + TScreen *screen = TScreenOf(xw); + String next = x_skip_nonblanks(value); + Cardinal n; + + screen->selectMap[item] = NSELECTUNITS; + for (n = 0; n < XtNumber(table); ++n) { + if (!x_strncasecmp(table[n].name, value, (unsigned) (next - value))) { + screen->selectMap[item] = table[n].code; +#if OPT_SELECT_REGEX + if (table[n].code == Select_REGEX) { + screen->selectExpr[item] = x_strtrim(next); + TRACE(("Parsed regex \"%s\"\n", screen->selectExpr[item])); + } +#endif + break; + } + } +} + +static void +ParseOnClicks(XtermWidget wnew, XtermWidget wreq, Cardinal item) +{ + lookupSelectUnit(wnew, item, TScreenOf(wreq)->onClick[item]); +} + +/* + * Parse a comma-separated list, returning a string which the caller must + * free, and updating the source pointer. + */ +static char * +ParseList(const char **source) +{ + const char *base = *source; + const char *next; + char *value = 0; + char *result; + + /* ignore empty values */ + while (*base == ',') + ++base; + + if (*base != '\0') { + size_t size; + + next = base; + while (*next != '\0' && *next != ',') + ++next; + size = (size_t) (1 + next - base); + value = malloc(size); + if (value != 0) { + memcpy(value, base, size); + value[size - 1] = '\0'; + } + *source = next; + } else { + *source = base; + } + result = x_strtrim(value); + free(value); + return result; +} + +static void +set_flags_from_list(char *target, + const char *source, + const FlagList * list) +{ + Cardinal n; + + while (!IsEmpty(source)) { + char *next = ParseList(&source); + Boolean found = False; + + if (next == 0) + break; + if (isdigit(CharOf(*next))) { + char *temp; + int value = (int) strtol(next, &temp, 0); + if (!FullS2L(next, temp)) { + xtermWarning("Expected a number: %s\n", next); + } else { + for (n = 0; list[n].name != 0; ++n) { + if (list[n].code == value) { + target[value] = 1; + found = True; + TRACE(("...found %s (%d)\n", list[n].name, value)); + break; + } + } + } + } else { + for (n = 0; list[n].name != 0; ++n) { + if (!x_wildstrcmp(next, list[n].name)) { + int value = list[n].code; + target[value] = 1; + found = True; + TRACE(("...found %s (%d)\n", list[n].name, value)); + } + } + } + if (!found) { + xtermWarning("Unrecognized keyword: %s\n", next); + } + free(next); + } +} + +#define InitCursorShape(target, source) \ + target->cursor_shape = source->cursor_underline \ + ? CURSOR_UNDERLINE \ + : CURSOR_BLOCK + +#if OPT_XRES_QUERY +static XtResource * +findVT100Resource(const char *name) +{ + Cardinal n; + XtResource *result = 0; + + if (!IsEmpty(name)) { + XrmQuark quarkName = XrmPermStringToQuark(name); + for (n = 0; n < XtNumber(xterm_resources); ++n) { + if ((int) xterm_resources[n].resource_offset >= 0 + && !strcmp(xterm_resources[n].resource_name, name)) { + result = &xterm_resources[n]; + break; + } else if (xterm_resources[n].resource_name + == (String) (intptr_t) quarkName) { + result = &xterm_resources[n]; + break; + } + } + } + return result; +} + +static int +cmp_resources(const void *a, const void *b) +{ + return strcmp((*(const String *) a), + (*(const String *) b)); +} + +static void +reportResources(XtermWidget xw) +{ + String *list = TypeMallocN(String, XtNumber(xterm_resources)); + Cardinal n; + int widest = 0; + + if (list == NULL) + return; + + for (n = 0; n < XtNumber(xterm_resources); ++n) { + int width; + list[n] = (((int) xterm_resources[n].resource_offset < 0) + ? XrmQuarkToString((XrmQuark) (intptr_t) + xterm_resources[n].resource_name) + : xterm_resources[n].resource_name); + width = (int) strlen(list[n]); + if (widest < width) + widest = width; + } + qsort(list, (size_t) XtNumber(xterm_resources), sizeof(String), cmp_resources); + for (n = 0; n < XtNumber(xterm_resources); ++n) { + char *value = vt100ResourceToString(xw, list[n]); + printf("%-*s : %s\n", widest, list[n], value ? value : "(skip)"); + free(value); + } + free(list); +} + +char * +vt100ResourceToString(XtermWidget xw, const char *name) +{ + XtResource *data; + char *result = NULL; + + if ((data = findVT100Resource(name)) != 0) { + int fake_offset = (int) data->resource_offset; + void *res_addr; + int real_offset; + String res_type; + + /* + * X Toolkit "compiles" the resource-list into quarks and changes the + * resource-offset at the same time to a negative value. + */ + if (fake_offset < 0) { + real_offset = -(fake_offset + 1); + res_type = XrmQuarkToString((XrmQuark) (intptr_t) data->resource_type); + } else { + real_offset = fake_offset; + res_type = data->resource_type; + } + res_addr = (void *) ((char *) xw + real_offset); + + if (!strcmp(res_type, XtRString)) { + char *value = *(char **) res_addr; + if (value != NULL) { + size_t need = strlen(value); + if ((result = malloc(1 + need)) != 0) + strcpy(result, value); + } + } else if (!strcmp(res_type, XtRInt)) { + if ((result = malloc(1 + (size_t) (3 * data->resource_size))) != 0) + sprintf(result, "%d", *(int *) res_addr); + } else if (!strcmp(res_type, XtRFloat)) { + if ((result = malloc(1 + (size_t) (3 * data->resource_size))) != 0) + sprintf(result, "%f", (double) (*(float *) res_addr)); + } else if (!strcmp(res_type, XtRBoolean)) { + if ((result = malloc((size_t) 6)) != 0) + strcpy(result, *(Boolean *) res_addr ? "true" : "false"); + } + } + TRACE(("vt100ResourceToString(%s) %s\n", name, NonNull(result))); + return result; +} +#endif /* OPT_XRES_QUERY */ + +static int +decodeTerminalID(const char *value) +{ + const char *s; + char *t; + long result; + + for (s = value; *s; s++) { + if (!isalpha(CharOf(*s))) + break; + } + result = strtol(s, &t, 10); + if (t == s || *t != '\0' || result <= 0L || result > 1000L) { + xtermWarning("unexpected value for terminalID: \"%s\"\n", value); + result = atoi(DFT_DECID); + } + TRACE(("decodeTerminalID \"%s\" ->%d\n", value, (int) result)); + return (int) result; +} + +static int +limitedTerminalID(int terminal_id) +{ + if (terminal_id < MIN_DECID) + terminal_id = MIN_DECID; + else if (terminal_id > MAX_DECID) + terminal_id = MAX_DECID; + else + terminal_id = atoi(DFT_DECID); + return terminal_id; +} + +/* ARGSUSED */ +static void +VTInitialize(Widget wrequest, + Widget new_arg, + ArgList args GCC_UNUSED, + Cardinal *num_args GCC_UNUSED) +{ +#define Kolor(name) TScreenOf(wnew)->name.resource +#define TxtFg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_FG]), Kolor(name)) +#define TxtBg(name) !x_strcasecmp(Kolor(Tcolors[TEXT_BG]), Kolor(name)) +#define DftFg(name) isDefaultForeground(Kolor(name)) +#define DftBg(name) isDefaultBackground(Kolor(name)) + +#define DATA_END { NULL, -1 } + +#if OPT_BLINK_CURS +#define DATA(name) { #name, cb##name } + static const FlagList tblBlinkOps[] = + { + DATA(Always) + ,DATA(Never) + ,DATA_END + }; +#undef DATA +#endif + +#define DATA(name) { #name, ec##name } + static const FlagList tblColorOps[] = + { + DATA(SetColor) + ,DATA(GetColor) + ,DATA(GetAnsiColor) + ,DATA_END + }; +#undef DATA + +#define DATA(name) { #name, ef##name } + static const FlagList tblFontOps[] = + { + DATA(SetFont) + ,DATA(GetFont) + ,DATA_END + }; +#undef DATA + +#define DATA(name) { #name, em##name } + static const FlagList tblMouseOps[] = + { + DATA(X10) + ,DATA(Locator) + ,DATA(VT200Click) + ,DATA(VT200Hilite) + ,DATA(AnyButton) + ,DATA(AnyEvent) + ,DATA(FocusEvent) + ,DATA(Extended) + ,DATA(SGR) + ,DATA(URXVT) + ,DATA(AlternateScroll) + ,DATA_END + }; +#undef DATA + +#define DATA(name) { #name, ep##name } + static const FlagList tblPasteControls[] = + { + DATA(C0) + ,DATA(BS) + ,DATA(CR) + ,DATA(DEL) + ,DATA(ESC) + ,DATA(FF) + ,DATA(HT) + ,DATA(NL) + ,DATA_END + }; +#undef DATA + +#define DATA(name) { #name, et##name } + static const FlagList tblTcapOps[] = + { + DATA(SetTcap) + ,DATA(GetTcap) + ,DATA_END + }; +#undef DATA + +#define DATA(name) { #name, ew##name } + static const FlagList tblWindowOps[] = + { + DATA(RestoreWin) + ,DATA(MinimizeWin) + ,DATA(SetWinPosition) + ,DATA(SetWinSizePixels) + ,DATA(RaiseWin) + ,DATA(LowerWin) + ,DATA(RefreshWin) + ,DATA(SetWinSizeChars) +#if OPT_MAXIMIZE + ,DATA(MaximizeWin) + ,DATA(FullscreenWin) +#endif + ,DATA(GetWinState) + ,DATA(GetWinPosition) + ,DATA(GetWinSizePixels) + ,DATA(GetWinSizeChars) +#if OPT_MAXIMIZE + ,DATA(GetScreenSizeChars) +#endif + ,DATA(GetIconTitle) + ,DATA(GetWinTitle) + ,DATA(PushTitle) + ,DATA(PopTitle) + /* this item uses all remaining numbers in the sequence */ + ,DATA(SetWinLines) + /* starting at this point, numbers do not apply */ + ,DATA(SetXprop) + ,DATA(GetSelection) + ,DATA(SetSelection) + ,DATA(GetChecksum) + ,DATA(SetChecksum) + ,DATA_END + }; +#undef DATA + +#if OPT_RENDERFONT +#define DATA(name) { #name, er##name } + static const FlagList tblRenderFont[] = + { + DATA(Default) + ,DATA_END + }; +#undef DATA +#endif + +#if OPT_WIDE_CHARS +#define DATA(name) { #name, u##name } + static const FlagList tblUtf8Mode[] = + { + DATA(Always) + ,DATA(Default) + ,DATA_END + }; +#undef DATA +#endif + +#ifndef NO_ACTIVE_ICON +#define DATA(name) { #name, ei##name } + static const FlagList tblAIconOps[] = + { + DATA(Default) + ,DATA_END + }; +#undef DATA +#endif + +#define DATA(name) { #name, eb##name } + static const FlagList tbl8BitMeta[] = + { + DATA(Never) + ,DATA(Locale) + ,DATA_END + }; +#undef DATA + + XtermWidget request = (XtermWidget) wrequest; + XtermWidget wnew = (XtermWidget) new_arg; + Widget my_parent = SHELL_OF(wnew); + int i; + +#if OPT_ISO_COLORS + Bool color_ok; +#endif + +#if OPT_ISO_COLORS && OPT_COLOR_RES2 + static XtResource fake_resources[] = + { +#if OPT_256_COLORS +# include <256colres.h> +#elif OPT_88_COLORS +# include <88colres.h> +#endif + }; +#endif /* OPT_COLOR_RES2 */ + TScreen *screen = TScreenOf(wnew); + char *saveLocale = xtermSetLocale(LC_NUMERIC, "C"); + +#if OPT_TRACE + check_bitmasks(); + check_tables(); +#endif + + TRACE(("VTInitialize wnew %p, %d / %d resources\n", + (void *) wnew, XtNumber(xterm_resources), MAXRESOURCES)); + assert(XtNumber(xterm_resources) < MAXRESOURCES); + + /* Zero out the entire "screen" component of "wnew" widget, then do + * field-by-field assignment of "screen" fields that are named in the + * resource list. + */ + memset(screen, 0, sizeof(wnew->screen)); + + /* DESCO Sys#67660 + * Zero out the entire "keyboard" component of "wnew" widget. + */ + memset(&wnew->keyboard, 0, sizeof(wnew->keyboard)); + + /* + * The workspace has no resources - clear it. + */ + memset(&wnew->work, 0, sizeof(wnew->work)); + + /* dummy values so that we don't try to Realize the parent shell with height + * or width of 0, which is illegal in X. The real size is computed in the + * xtermWidget's Realize proc, but the shell's Realize proc is called first, + * and must see a valid size. + */ + wnew->core.height = wnew->core.width = 1; + + /* + * The definition of -rv now is that it changes the definition of + * XtDefaultForeground and XtDefaultBackground. So, we no longer + * need to do anything special. + */ + screen->display = wnew->core.screen->display; + + /* prep getVisualInfo() */ + wnew->visInfo = 0; + wnew->numVisuals = 0; + (void) getVisualInfo(wnew); + + /* + * We use the default foreground/background colors to compare/check if a + * color-resource has been set. + */ +#define MyBlackPixel(dpy) BlackPixel(dpy,DefaultScreen(dpy)) +#define MyWhitePixel(dpy) WhitePixel(dpy,DefaultScreen(dpy)) + + if (request->misc.re_verse) { + wnew->dft_foreground = MyWhitePixel(screen->display); + wnew->dft_background = MyBlackPixel(screen->display); + } else { + wnew->dft_foreground = MyBlackPixel(screen->display); + wnew->dft_background = MyWhitePixel(screen->display); + } + + init_Tres(TEXT_FG); + init_Tres(TEXT_BG); + repairColors(wnew); + + wnew->old_foreground = T_COLOR(screen, TEXT_FG); + wnew->old_background = T_COLOR(screen, TEXT_BG); + + TRACE(("Color resource initialization:\n")); + TRACE((" Default foreground 0x%06lx\n", wnew->dft_foreground)); + TRACE((" Default background 0x%06lx\n", wnew->dft_background)); + TRACE((" Screen foreground 0x%06lx\n", T_COLOR(screen, TEXT_FG))); + TRACE((" Screen background 0x%06lx\n", T_COLOR(screen, TEXT_BG))); + TRACE((" Actual foreground 0x%06lx\n", wnew->old_foreground)); + TRACE((" Actual background 0x%06lx\n", wnew->old_background)); + + screen->mouse_button = 0; + screen->mouse_row = -1; + screen->mouse_col = -1; + +#if OPT_BOX_CHARS + init_Bres(screen.force_box_chars); + init_Bres(screen.force_packed); + init_Bres(screen.force_all_chars); + init_Bres(screen.assume_all_chars); +#endif + init_Bres(screen.free_bold_box); + init_Bres(screen.allowBoldFonts); + + init_Bres(screen.c132); + init_Bres(screen.curses); + init_Bres(screen.hp_ll_bc); +#if OPT_XMC_GLITCH + init_Ires(screen.xmc_glitch); + init_Ires(screen.xmc_attributes); + init_Bres(screen.xmc_inline); + init_Bres(screen.move_sgr_ok); +#endif +#if OPT_BLINK_CURS + init_Sres(screen.cursor_blink_s); + wnew->screen.cursor_blink = + extendedBoolean(wnew->screen.cursor_blink_s, + tblBlinkOps, cbLAST); + init_Bres(screen.cursor_blink_xor); + init_Ires(screen.blink_on); + init_Ires(screen.blink_off); + screen->cursor_blink_i = screen->cursor_blink; +#endif + init_Bres(screen.cursor_underline); + /* resources allow for underline or block, not (yet) bar */ + InitCursorShape(screen, TScreenOf(request)); +#if OPT_BLINK_CURS + TRACE(("cursor_shape:%d blinks:%d\n", + screen->cursor_shape, + screen->cursor_blink)); +#endif +#if OPT_BLINK_TEXT + init_Ires(screen.blink_as_bold); +#endif + init_Ires(screen.border); + init_Bres(screen.jumpscroll); + init_Bres(screen.fastscroll); + + init_Bres(screen.old_fkeys); + wnew->screen.old_fkeys0 = wnew->screen.old_fkeys; + wnew->keyboard.type = screen->old_fkeys + ? keyboardIsLegacy + : keyboardIsDefault; + + init_Mres(screen.delete_is_del); +#ifdef ALLOWLOGGING + init_Bres(misc.logInhibit); + init_Bres(misc.log_on); + init_Sres(screen.logfile); +#endif + init_Bres(screen.bellIsUrgent); + init_Bres(screen.bellOnReset); + init_Bres(screen.marginbell); + init_Bres(screen.multiscroll); + init_Ires(screen.nmarginbell); + init_Ires(screen.savelines); + init_Ires(screen.scrollBarBorder); + init_Ires(screen.scrolllines); + init_Bres(screen.alternateScroll); + init_Bres(screen.scrollttyoutput); + init_Bres(screen.scrollkey); + + init_Dres(screen.scale_height); + if (screen->scale_height < (float) 0.9) + screen->scale_height = (float) 0.9; + if (screen->scale_height > (float) 1.5) + screen->scale_height = (float) 1.5; + + init_Bres(misc.autoWrap); + init_Bres(misc.login_shell); + init_Bres(misc.reverseWrap); + init_Bres(misc.scrollbar); + init_Sres(misc.geo_metry); + init_Sres(misc.T_geometry); + + init_Sres(screen.term_id); + screen->terminal_id = decodeTerminalID(TScreenOf(request)->term_id); + switch (screen->terminal_id) { + case 52: + case 100: + case 101: + case 102: + case 125: /* maybe graphics */ + case 131: + case 132: /* maybe graphics */ + case 220: + case 320: + case 420: + case 510: + case 520: + case 525: + break; + default: +#if OPT_REGIS_GRAPHICS + if (optRegisGraphics(screen)) + break; +#endif +#if OPT_SIXEL_GRAPHICS + if (optSixelGraphics(screen)) + break; +#endif + screen->terminal_id = limitedTerminalID(screen->terminal_id); + break; + } + TRACE(("term_id '%s' -> terminal_id %d\n", + screen->term_id, + screen->terminal_id)); + + screen->vtXX_level = (screen->terminal_id / 100); + + init_Ires(screen.title_modes); + screen->title_modes0 = screen->title_modes; + + init_Ires(screen.nextEventDelay); + if (screen->nextEventDelay <= 0) + screen->nextEventDelay = 1; + + init_Bres(screen.visualbell); + init_Bres(screen.flash_line); + init_Ires(screen.visualBellDelay); + init_Bres(screen.poponbell); + + init_Bres(screen.eraseSavedLines0); + screen->eraseSavedLines = screen->eraseSavedLines0; + + init_Ires(misc.limit_resize); + +#if OPT_NUM_LOCK + init_Bres(misc.real_NumLock); + init_Bres(misc.alwaysUseMods); +#endif + +#if OPT_INPUT_METHOD + init_Bres(misc.open_im); + init_Ires(misc.retry_im); + init_Sres(misc.f_x); + init_Sres(misc.input_method); + init_Sres(misc.preedit_type); +#endif + +#if OPT_SHIFT_FONTS + init_Bres(misc.shift_fonts); +#endif +#if OPT_SUNPC_KBD + init_Ires(misc.ctrl_fkeys); +#endif +#if OPT_TEK4014 + TEK4014_SHOWN(wnew) = False; /* not a resource... */ + init_Bres(misc.tekInhibit); + init_Bres(misc.tekSmall); + init_Bres(misc.TekEmu); +#endif +#if OPT_TCAP_QUERY + screen->tc_query_code = -1; +#endif + wnew->misc.re_verse0 = request->misc.re_verse; + init_Bres(misc.re_verse); + init_Ires(screen.multiClickTime); + init_Ires(screen.bellSuppressTime); + init_Sres(screen.charClass); + + init_Bres(screen.always_highlight); + init_Bres(screen.brokenSelections); + init_Bres(screen.cutNewline); + init_Bres(screen.cutToBeginningOfLine); + init_Bres(screen.highlight_selection); + init_Bres(screen.show_wrap_marks); + init_Bres(screen.i18nSelections); + init_Bres(screen.keepClipboard); + init_Bres(screen.keepSelection); + init_Bres(screen.selectToClipboard); + init_Bres(screen.trim_selection); + + screen->pointer_cursor = TScreenOf(request)->pointer_cursor; + init_Ires(screen.pointer_mode); + wnew->screen.pointer_mode0 = wnew->screen.pointer_mode; + + init_Sres(screen.answer_back); + + wnew->SPS.printer_checked = False; + init_Sres(SPS.printer_command); + init_Bres(SPS.printer_autoclose); + init_Bres(SPS.printer_extent); + init_Bres(SPS.printer_formfeed); + init_Bres(SPS.printer_newline); + init_Ires(SPS.printer_controlmode); +#if OPT_PRINT_COLORS + init_Ires(SPS.print_attributes); +#endif + + init_Sres(screen.keyboard_dialect); + + init_Bres(screen.input_eight_bits); + init_Bres(screen.output_eight_bits); + init_Bres(screen.control_eight_bits); + init_Bres(screen.backarrow_key); + init_Bres(screen.alt_is_not_meta); + init_Bres(screen.alt_sends_esc); + init_Bres(screen.meta_sends_esc); + + init_Bres(screen.allowPasteControl0); + init_Bres(screen.allowSendEvent0); + init_Bres(screen.allowColorOp0); + init_Bres(screen.allowFontOp0); + init_Bres(screen.allowMouseOp0); + init_Bres(screen.allowTcapOp0); + init_Bres(screen.allowTitleOp0); + init_Bres(screen.allowWindowOp0); + +#if OPT_SCROLL_LOCK + init_Bres(screen.allowScrollLock0); +#endif + + init_Sres(screen.disallowedColorOps); + + set_flags_from_list(screen->disallow_color_ops, + screen->disallowedColorOps, + tblColorOps); + + init_Sres(screen.disallowedFontOps); + + set_flags_from_list(screen->disallow_font_ops, + screen->disallowedFontOps, + tblFontOps); + + init_Sres(screen.disallowedMouseOps); + + set_flags_from_list(screen->disallow_mouse_ops, + screen->disallowedMouseOps, + tblMouseOps); + + init_Sres(screen.disallowedPasteControls); + + set_flags_from_list(screen->disallow_paste_controls, + screen->disallowedPasteControls, + tblPasteControls); + + init_Sres(screen.disallowedTcapOps); + + set_flags_from_list(screen->disallow_tcap_ops, + screen->disallowedTcapOps, + tblTcapOps); + + init_Sres(screen.disallowedWinOps); + + set_flags_from_list(screen->disallow_win_ops, + screen->disallowedWinOps, + tblWindowOps); + + init_Sres(screen.default_string); + init_Sres(screen.eightbit_select_types); +#if OPT_WIDE_CHARS + init_Sres(screen.utf8_select_types); +#endif + + /* make a copy so that editres cannot change the resource after startup */ + screen->allowPasteControls = screen->allowPasteControl0; + screen->allowSendEvents = screen->allowSendEvent0; + screen->allowColorOps = screen->allowColorOp0; + screen->allowFontOps = screen->allowFontOp0; + screen->allowMouseOps = screen->allowMouseOp0; + screen->allowTcapOps = screen->allowTcapOp0; + screen->allowTitleOps = screen->allowTitleOp0; + screen->allowWindowOps = screen->allowWindowOp0; + +#if OPT_SCROLL_LOCK + screen->allowScrollLock = screen->allowScrollLock0; +#endif + + init_Bres(screen.quiet_grab); + +#ifndef NO_ACTIVE_ICON + init_Sres(screen.icon_fontname); + getIconicFont(screen)->fs = XLoadQueryFont(screen->display, + screen->icon_fontname); + TRACE(("iconFont '%s' %sloaded successfully\n", + screen->icon_fontname, + getIconicFont(screen)->fs ? "" : "NOT ")); + init_Sres(misc.active_icon_s); + wnew->work.active_icon = + (Boolean) extendedBoolean(wnew->misc.active_icon_s, + tblAIconOps, eiLAST); + init_Ires(misc.icon_border_width); + wnew->misc.icon_border_pixel = request->misc.icon_border_pixel; +#endif /* NO_ACTIVE_ICON */ + + init_Bres(misc.signalInhibit); + init_Bres(misc.titeInhibit); + init_Bres(misc.tiXtraScroll); + init_Bres(misc.cdXtraScroll); + init_Bres(misc.color_inner_border); + init_Bres(misc.dynamicColors); + +#if OPT_DEC_CHRSET + for (i = 0; i < NUM_CHRSET; i++) { + screen->double_fonts[i].warn = fwResource; + } +#endif + for (i = fontMenu_font1; i <= fontMenu_lastBuiltin; i++) { + init_Sres2(screen.MenuFontName, i); + } + for (i = 0; i < fMAX; i++) { + screen->fnts[i].warn = fwResource; +#if OPT_WIDE_ATTRS + screen->ifnts[i].warn = fwResource; +#endif + } +#ifndef NO_ACTIVE_ICON + screen->fnt_icon.warn = fwResource; +#endif + + init_Ires(misc.fontWarnings); + + initFontLists(wnew); + +#define DefaultFontNames screen->menu_font_names[fontMenu_default] + + /* + * Process Xft font resources first, since faceName may contain X11 fonts + * that should override the "font" resource. + */ +#if OPT_RENDERFONT + init_Bres(screen.force_xft_height); + for (i = 0; i <= fontMenu_lastBuiltin; ++i) { + init_Dres2(misc.face_size, i); + } + +#define ALLOC_FONTLIST(name,which,field) \ + init_Sres(misc.default_xft.field);\ + allocFontList(wnew,\ + name,\ + &(wnew->work.fonts),\ + which,\ + wnew->misc.default_xft.field,\ + True) + + ALLOC_FONTLIST(XtNfaceName, fNorm, f_n); + +#if OPT_WIDE_CHARS + ALLOC_FONTLIST(XtNfaceNameDoublesize, fWide, f_w); +#endif + +#undef ALLOC_FONTLIST + +#endif + + /* + * Process X11 (XLFD) font specifications. + */ +#define ALLOC_FONTLIST(name,which,field) \ + init_Sres(misc.default_font.field);\ + allocFontList(wnew,\ + name,\ + &(wnew->work.fonts),\ + which,\ + wnew->misc.default_font.field,\ + False) + + ALLOC_FONTLIST(XtNfont, fNorm, f_n); + ALLOC_FONTLIST(XtNboldFont, fBold, f_b); + + DefaultFontNames[fNorm] = x_strdup(DefaultFontN(wnew)); + DefaultFontNames[fBold] = x_strdup(DefaultFontB(wnew)); + +#if OPT_WIDE_CHARS + ALLOC_FONTLIST(XtNwideFont, fWide, f_w); + ALLOC_FONTLIST(XtNwideBoldFont, fWBold, f_wb); + + DefaultFontNames[fWide] = x_strdup(DefaultFontW(wnew)); + DefaultFontNames[fWBold] = x_strdup(DefaultFontWB(wnew)); +#endif + +#undef ALLOC_FONTLIST + + screen->EscapeFontName() = NULL; + screen->SelectFontName() = NULL; + + screen->menu_font_number = fontMenu_default; + init_Sres(screen.initial_font); + if (screen->initial_font != 0) { + int result = xtermGetFont(screen->initial_font); + if (result >= 0) + screen->menu_font_number = result; + } +#if OPT_BROKEN_OSC + init_Bres(screen.brokenLinuxOSC); +#endif + +#if OPT_BROKEN_ST + init_Bres(screen.brokenStringTerm); +#endif + +#if OPT_C1_PRINT + init_Bres(screen.c1_printable); +#endif + +#if OPT_CLIP_BOLD + init_Bres(screen.use_border_clipping); + init_Bres(screen.use_clipping); +#endif + +#if OPT_DEC_CHRSET + init_Bres(screen.font_doublesize); + init_Ires(screen.cache_doublesize); + if (screen->cache_doublesize > NUM_CHRSET) + screen->cache_doublesize = NUM_CHRSET; + if (screen->cache_doublesize == 0) + screen->font_doublesize = False; + TRACE(("Doublesize%s enabled, up to %d fonts\n", + screen->font_doublesize ? "" : " not", + screen->cache_doublesize)); +#endif +#if OPT_DEC_RECTOPS + init_Ires(screen.checksum_ext0); + screen->checksum_ext = screen->checksum_ext0; +#endif + +#if OPT_ISO_COLORS + init_Ires(screen.veryBoldColors); + init_Bres(screen.boldColors); + init_Bres(screen.colorAttrMode); + init_Bres(screen.colorBDMode); + init_Bres(screen.colorBLMode); + init_Bres(screen.colorMode); + init_Bres(screen.colorULMode); + init_Bres(screen.italicULMode); + init_Bres(screen.colorRVMode); + +#if OPT_WIDE_ATTRS + init_Bres(screen.colorITMode); +#endif +#if OPT_DIRECT_COLOR + init_Bres(screen.direct_color); +#endif + +#if OPT_COLOR_RES2 + TRACE(("...will fake resources for color%d to color%d\n", + MIN_ANSI_COLORS, + NUM_ANSI_COLORS - 1)); +#endif + for (i = 0, color_ok = False; i < MAXCOLORS; i++) { + +#if OPT_COLOR_RES2 + /* + * Xt has a hardcoded limit on the maximum number of resources that can + * be used in a widget. If we configure both luit (which implies + * wide-characters) and 256-colors, it goes over that limit. Most + * people would not need a resource-file with 256-colors; the default + * values in our table are sufficient. In that case, fake the resource + * setting by copying the default value from the table. The #define's + * can be overridden to make these true resources. + */ + if (i >= MIN_ANSI_COLORS && i < NUM_ANSI_COLORS) { + screen->Acolors[i].resource = + x_strtrim(fake_resources[i - MIN_ANSI_COLORS].default_addr); + if (screen->Acolors[i].resource == 0) + screen->Acolors[i].resource = XtDefaultForeground; + } else +#endif /* OPT_COLOR_RES2 */ + { + screen->Acolors[i] = TScreenOf(request)->Acolors[i]; + screen->Acolors[i].resource = + x_strtrim(screen->Acolors[i].resource); + } + +#if OPT_COLOR_RES + TRACE(("Acolors[%d] = %s\n", i, screen->Acolors[i].resource)); + screen->Acolors[i].mode = False; + if (DftFg(Acolors[i])) { + screen->Acolors[i].value = T_COLOR(screen, TEXT_FG); + screen->Acolors[i].mode = True; + } else if (DftBg(Acolors[i])) { + screen->Acolors[i].value = T_COLOR(screen, TEXT_BG); + screen->Acolors[i].mode = True; + } else { + color_ok = True; + } +#else + TRACE(("Acolors[%d] = %#lx\n", i, TScreenOf(request)->Acolors[i])); + if (screen->Acolors[i] != wnew->dft_foreground && + screen->Acolors[i] != T_COLOR(screen, TEXT_FG) && + screen->Acolors[i] != T_COLOR(screen, TEXT_BG)) + color_ok = True; +#endif + } + + /* + * Check if we're trying to use color in a monochrome screen. Disable + * color in that case, since that would make ANSI colors unusable. A 4-bit + * or 8-bit display is usable, so we do not have to check for anything more + * specific. + */ + if (color_ok) { + if (getVisualDepth(wnew) <= 1) { + TRACE(("disabling color since screen is monochrome\n")); + color_ok = False; + } + } + + /* If none of the colors are anything other than the foreground or + * background, we'll assume this isn't color, no matter what the colorMode + * resource says. (There doesn't seem to be any good way to determine if + * the resource lookup failed versus the user having misconfigured this). + */ + if (!color_ok) { + screen->colorMode = False; + TRACE(("All colors are foreground or background: disable colorMode\n")); + } + wnew->sgr_foreground = -1; + wnew->sgr_background = -1; + wnew->sgr_38_xcolors = False; + clrDirectFG(wnew->flags); + clrDirectFG(wnew->flags); +#endif /* OPT_ISO_COLORS */ + + /* + * Decode the resources that control the behavior on multiple mouse clicks. + * A single click is always bound to normal character selection, but the + * other flavors can be changed. + */ + for (i = 0; i < NSELECTUNITS; ++i) { + int ck = (i + 1); + screen->maxClicks = ck; + if (i == Select_CHAR) + screen->selectMap[i] = Select_CHAR; + else if (TScreenOf(request)->onClick[i] != 0) + ParseOnClicks(wnew, request, (unsigned) i); + else if (i <= Select_LINE) + screen->selectMap[i] = (SelectUnit) i; + else + break; +#if OPT_XRES_QUERY + init_Sres(screen.onClick[i]); +#endif + TRACE(("on%dClicks %s=%d\n", ck, + NonNull(TScreenOf(request)->onClick[i]), + screen->selectMap[i])); + if (screen->selectMap[i] == NSELECTUNITS) + break; + } + TRACE(("maxClicks %d\n", screen->maxClicks)); + + init_Tres(MOUSE_FG); + init_Tres(MOUSE_BG); + init_Tres(TEXT_CURSOR); +#if OPT_HIGHLIGHT_COLOR + init_Tres(HIGHLIGHT_BG); + init_Tres(HIGHLIGHT_FG); + init_Bres(screen.hilite_reverse); + init_Mres(screen.hilite_color); + if (screen->hilite_color == Maybe) { + screen->hilite_color = False; +#if OPT_COLOR_RES + /* + * If the highlight text/background are both set, and if they are + * not equal to either the text/background or background/text, then + * set the highlightColorMode automatically. + */ + if (!DftFg(Tcolors[HIGHLIGHT_BG]) + && !DftBg(Tcolors[HIGHLIGHT_FG]) + && !TxtFg(Tcolors[HIGHLIGHT_BG]) + && !TxtBg(Tcolors[HIGHLIGHT_FG]) + && !TxtBg(Tcolors[HIGHLIGHT_BG]) + && !TxtFg(Tcolors[HIGHLIGHT_FG])) { + TRACE(("...setting hilite_color automatically\n")); + screen->hilite_color = True; + } +#endif + } +#endif + +#if OPT_TEK4014 + /* + * The Tek4014 window has no separate resources for foreground, background + * and cursor color. Since xterm always creates the vt100 widget first, we + * can set the Tektronix colors here. That lets us use escape sequences to + * set its dynamic colors and get consistent behavior whether or not the + * window is displayed. + */ + screen->Tcolors[TEK_BG] = screen->Tcolors[TEXT_BG]; + screen->Tcolors[TEK_FG] = screen->Tcolors[TEXT_FG]; + screen->Tcolors[TEK_CURSOR] = screen->Tcolors[TEXT_CURSOR]; +#endif + +#ifdef SCROLLBAR_RIGHT + init_Bres(misc.useRight); +#endif + +#if OPT_RENDERFONT + init_Ires(misc.limit_fontsets); + wnew->work.max_fontsets = (unsigned) wnew->misc.limit_fontsets; + + init_Sres(misc.render_font_s); + wnew->work.render_font = + (Boolean) extendedBoolean(wnew->misc.render_font_s, + tblRenderFont, erLast); + if (wnew->work.render_font == erDefault) { + if (IsEmpty(CurrentXftFont(wnew))) { + free((void *) CurrentXftFont(wnew)); + CurrentXftFont(wnew) = x_strdup(DEFFACENAME_AUTO); + TRACE(("will allow runtime switch to render_font using \"%s\"\n", + CurrentXftFont(wnew))); + } else { + wnew->work.render_font = erTrue; + TRACE(("initially using TrueType font\n")); + } + } + /* minor tweak to make debug traces consistent: */ + if (wnew->work.render_font) { + if (IsEmpty(CurrentXftFont(wnew))) { + wnew->work.render_font = False; + TRACE(("reset render_font since there is no face_name\n")); + } + } +#endif + +#if OPT_WIDE_CHARS + /* setup data for next call */ + init_Sres(screen.utf8_mode_s); + request->screen.utf8_mode = + extendedBoolean(request->screen.utf8_mode_s, tblUtf8Mode, uLast); + + init_Sres(screen.utf8_fonts_s); + request->screen.utf8_fonts = + extendedBoolean(request->screen.utf8_fonts_s, tblUtf8Mode, uLast); + + init_Sres(screen.utf8_title_s); + request->screen.utf8_title = + extendedBoolean(request->screen.utf8_title_s, tblUtf8Mode, uLast); + + /* + * Make a copy in the input/request so that DefaultFontN() works for + * the "CHECKFONT" option. + */ + copyFontList(&(request->work.fonts.x11.list_n), + wnew->work.fonts.x11.list_n); + + VTInitialize_locale(request); + init_Bres(screen.normalized_c); + init_Bres(screen.utf8_latin1); + init_Bres(screen.utf8_weblike); + +#if OPT_LUIT_PROG + init_Bres(misc.callfilter); + init_Bres(misc.use_encoding); + init_Sres(misc.locale_str); + init_Sres(misc.localefilter); +#endif + + init_Ires(screen.utf8_inparse); + init_Ires(screen.utf8_mode); + init_Ires(screen.utf8_fonts); + init_Ires(screen.utf8_title); + init_Ires(screen.max_combining); + + init_Ires(screen.utf8_always); /* from utf8_mode, used in doparse */ + + if (screen->max_combining < 0) { + screen->max_combining = 0; + } + if (screen->max_combining > 5) { + screen->max_combining = 5; + } + + init_Bres(screen.vt100_graphics); + init_Bres(screen.wide_chars); + init_Bres(misc.mk_width); + init_Bres(misc.cjk_width); + + init_Ires(misc.mk_samplesize); + init_Ires(misc.mk_samplepass); + + if (wnew->misc.mk_samplesize > 0xffff) + wnew->misc.mk_samplesize = 0xffff; + if (wnew->misc.mk_samplesize < 0) + wnew->misc.mk_samplesize = 0; + + if (wnew->misc.mk_samplepass > wnew->misc.mk_samplesize) + wnew->misc.mk_samplepass = wnew->misc.mk_samplesize; + if (wnew->misc.mk_samplepass < 0) + wnew->misc.mk_samplepass = 0; + + if (TScreenOf(request)->utf8_mode) { + TRACE(("setting wide_chars on\n")); + screen->wide_chars = True; + } else { + TRACE(("setting utf8_mode to 0\n")); + screen->utf8_mode = uFalse; + } + mk_wcwidth_init(screen->utf8_mode); + TRACE(("initialized UTF-8 mode to %d\n", screen->utf8_mode)); + +#if OPT_MINI_LUIT + if (TScreenOf(request)->latin9_mode) { + screen->latin9_mode = True; + } + if (TScreenOf(request)->unicode_font) { + screen->unicode_font = True; + } + TRACE(("initialized Latin9 mode to %d\n", screen->latin9_mode)); + TRACE(("initialized unicode_font to %d\n", screen->unicode_font)); +#endif + + decode_wcwidth(wnew); + xtermSaveVTFonts(wnew); +#endif /* OPT_WIDE_CHARS */ + + init_Sres(screen.eight_bit_meta_s); + wnew->screen.eight_bit_meta = + extendedBoolean(request->screen.eight_bit_meta_s, tbl8BitMeta, ebLast); + if (wnew->screen.eight_bit_meta == ebLocale) { +#if OPT_WIDE_CHARS + if (xtermEnvUTF8()) { + wnew->screen.eight_bit_meta = ebFalse; + TRACE(("...eightBitMeta is false due to locale\n")); + } else +#endif /* OPT_WIDE_CHARS */ + { + wnew->screen.eight_bit_meta = ebTrue; + TRACE(("...eightBitMeta is true due to locale\n")); + } + } + + init_Bres(screen.always_bold_mode); + init_Bres(screen.bold_mode); + init_Bres(screen.underline); + + wnew->cur_foreground = 0; + wnew->cur_background = 0; + + wnew->keyboard.flags = MODE_SRM; + + if (screen->backarrow_key) + wnew->keyboard.flags |= MODE_DECBKM; + TRACE(("initialized DECBKM %s\n", + BtoS(wnew->keyboard.flags & MODE_DECBKM))); + +#if OPT_SIXEL_GRAPHICS + init_Bres(screen.sixel_scrolling); + if (screen->sixel_scrolling) + wnew->keyboard.flags |= MODE_DECSDM; + TRACE(("initialized DECSDM %s\n", + BtoS(wnew->keyboard.flags & MODE_DECSDM))); +#endif + +#if OPT_GRAPHICS + init_Sres(screen.graph_id); + screen->graphics_id = decodeTerminalID(TScreenOf(request)->graph_id); + switch (screen->graphics_id) { + case 125: + case 240: + case 241: + case 330: + case 340: + case 382: + break; + default: + screen->graphics_id = 0; + break; + } + TRACE(("graph_id '%s' -> graphics_id %d\n", + screen->graph_id, + screen->graphics_id)); + + init_Ires(screen.numcolorregisters); + TRACE(("initialized NUM_COLOR_REGISTERS to resource default: %d\n", + screen->numcolorregisters)); + + init_Bres(screen.privatecolorregisters); /* FIXME: should this be off unconditionally here? */ + TRACE(("initialized PRIVATE_COLOR_REGISTERS to resource default: %s\n", + BtoS(screen->privatecolorregisters))); +#endif + +#if OPT_GRAPHICS + { + int native_w, native_h; + + switch (GraphicsId(screen)) { + case 125: + native_w = 768; + native_h = 460; + break; + case 240: + /* FALLTHRU */ + case 241: + native_w = 800; + native_h = 460; + break; + case 330: + native_w = 800; + native_h = 480; + break; + case 340: + /* FALLTHRU */ + default: + native_w = 800; + native_h = 480; + break; + case 382: + native_w = 960; + native_h = 750; + break; + } + +# if OPT_REGIS_GRAPHICS + init_Sres(screen.graphics_regis_default_font); + TRACE(("default ReGIS font: %s\n", + screen->graphics_regis_default_font)); + + init_Sres(screen.graphics_regis_screensize); + screen->graphics_regis_def_high = 1000; + screen->graphics_regis_def_wide = 1000; + if (!x_strcasecmp(screen->graphics_regis_screensize, "auto")) { + TRACE(("setting default ReGIS screensize based on graphics_id %d\n", + GraphicsId(screen))); + screen->graphics_regis_def_high = (Dimension) native_w; + screen->graphics_regis_def_wide = (Dimension) native_h; + } else { + int conf_high; + int conf_wide; + char ignore; + + if (sscanf(screen->graphics_regis_screensize, + "%dx%d%c", + &conf_wide, + &conf_high, + &ignore) == 2) { + if (conf_high > 0 && conf_wide > 0) { + screen->graphics_regis_def_high = + (Dimension) conf_high; + screen->graphics_regis_def_wide = + (Dimension) conf_wide; + } else { + TRACE(("ignoring invalid regisScreenSize %s\n", + screen->graphics_regis_screensize)); + } + } else { + TRACE(("ignoring invalid regisScreenSize %s\n", + screen->graphics_regis_screensize)); + } + } + TRACE(("default ReGIS graphics screensize %dx%d\n", + (int) screen->graphics_regis_def_wide, + (int) screen->graphics_regis_def_high)); +# endif + + init_Sres(screen.graphics_max_size); + screen->graphics_max_high = 1000; + screen->graphics_max_wide = 1000; + if (!x_strcasecmp(screen->graphics_max_size, "auto")) { + TRACE(("setting max graphics screensize based on graphics_id %d\n", + GraphicsId(screen))); + screen->graphics_max_high = (Dimension) native_w; + screen->graphics_max_wide = (Dimension) native_h; + } else { + int conf_high; + int conf_wide; + char ignore; + + if (sscanf(screen->graphics_max_size, + "%dx%d%c", + &conf_wide, + &conf_high, + &ignore) == 2) { + if (conf_high > 0 && conf_wide > 0) { + screen->graphics_max_high = (Dimension) conf_high; + screen->graphics_max_wide = (Dimension) conf_wide; + } else { + TRACE(("ignoring invalid maxGraphicSize %s\n", + screen->graphics_max_size)); + } + } else { + TRACE(("ignoring invalid maxGraphicSize %s\n", + screen->graphics_max_size)); + } + } +# if OPT_REGIS_GRAPHICS + /* Make sure the max is large enough for the default ReGIS size. */ + if (screen->graphics_regis_def_high > + screen->graphics_max_high) { + screen->graphics_max_high = + screen->graphics_regis_def_high; + } + if (screen->graphics_regis_def_wide > + screen->graphics_max_wide) { + screen->graphics_max_wide = + screen->graphics_regis_def_wide; + } +# endif + TRACE(("max graphics screensize %dx%d\n", + (int) screen->graphics_max_wide, + (int) screen->graphics_max_high)); + } +#endif + +#if OPT_SIXEL_GRAPHICS + init_Bres(screen.sixel_scrolls_right); + TRACE(("initialized SIXEL_SCROLLS_RIGHT to resource default: %s\n", + BtoS(screen->sixel_scrolls_right))); +#endif + + /* look for focus related events on the shell, because we need + * to care about the shell's border being part of our focus. + */ + TRACE(("adding event handlers for my_parent %p\n", (void *) my_parent)); + XtAddEventHandler(my_parent, EnterWindowMask, False, + HandleEnterWindow, (Opaque) NULL); + XtAddEventHandler(my_parent, LeaveWindowMask, False, + HandleLeaveWindow, (Opaque) NULL); + XtAddEventHandler(my_parent, FocusChangeMask, False, + HandleFocusChange, (Opaque) NULL); + XtAddEventHandler((Widget) wnew, 0L, True, + VTNonMaskableEvent, (Opaque) NULL); + XtAddEventHandler((Widget) wnew, PropertyChangeMask, False, + HandleBellPropertyChange, (Opaque) NULL); + +#if HANDLE_STRUCT_NOTIFY +#if OPT_TOOLBAR + wnew->VT100_TB_INFO(menu_bar) = request->VT100_TB_INFO(menu_bar); + init_Ires(VT100_TB_INFO(menu_height)); +#endif + XtAddEventHandler(my_parent, MappingNotify | StructureNotifyMask, False, + HandleStructNotify, (Opaque) 0); +#endif /* HANDLE_STRUCT_NOTIFY */ + + screen->bellInProgress = False; + + set_character_class(screen->charClass); +#if OPT_REPORT_CCLASS + if (resource.reportCClass) + report_char_class(wnew); +#endif + + /* create it, but don't realize it */ + ScrollBarOn(wnew, True); + + /* make sure that the resize gravity acceptable */ + if (!GravityIsNorthWest(wnew) && + !GravityIsSouthWest(wnew)) { + char value[80]; + String temp[2]; + Cardinal nparams = 1; + + sprintf(value, "%d", wnew->misc.resizeGravity); + temp[0] = value; + temp[1] = 0; + XtAppWarningMsg(app_con, "rangeError", "resizeGravity", "XTermError", + "unsupported resizeGravity resource value (%s)", + temp, &nparams); + wnew->misc.resizeGravity = SouthWestGravity; + } +#ifndef NO_ACTIVE_ICON + screen->whichVwin = &screen->fullVwin; +#endif /* NO_ACTIVE_ICON */ + + init_Ires(screen.unparse_max); + if ((int) screen->unparse_max < 256) + screen->unparse_max = 256; + screen->unparse_bfr = (IChar *) (void *) XtCalloc(screen->unparse_max, + (Cardinal) sizeof(IChar)); + + if (screen->savelines < 0) + screen->savelines = 0; + + init_Bres(screen.awaitInput); + + wnew->flags = 0; + if (!screen->jumpscroll) + wnew->flags |= SMOOTHSCROLL; + if (wnew->misc.reverseWrap) + wnew->flags |= REVERSEWRAP; + if (wnew->misc.autoWrap) + wnew->flags |= WRAPAROUND; + if (wnew->misc.re_verse != wnew->misc.re_verse0) + wnew->flags |= REVERSE_VIDEO; + if (screen->c132) + wnew->flags |= IN132COLUMNS; + + wnew->initflags = wnew->flags; + +#if OPT_MOD_FKEYS + init_Ires(keyboard.modify_1st.allow_keys); + init_Ires(keyboard.modify_1st.cursor_keys); + init_Ires(keyboard.modify_1st.function_keys); + init_Ires(keyboard.modify_1st.keypad_keys); + init_Ires(keyboard.modify_1st.other_keys); + init_Ires(keyboard.modify_1st.string_keys); + init_Ires(keyboard.format_keys); + wnew->keyboard.modify_now = wnew->keyboard.modify_1st; +#endif + + init_Ires(misc.appcursorDefault); + if (wnew->misc.appcursorDefault) + wnew->keyboard.flags |= MODE_DECCKM; + + init_Ires(misc.appkeypadDefault); + if (wnew->misc.appkeypadDefault) + wnew->keyboard.flags |= MODE_DECKPAM; + + initLineData(wnew); +#if OPT_WIDE_CHARS + freeFontList(&(request->work.fonts.x11.list_n)); +#endif +#if OPT_XRES_QUERY + if (resource.reportXRes) + reportResources(wnew); +#endif + xtermResetLocale(LC_NUMERIC, saveLocale); + return; +} + +void +releaseCursorGCs(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + int n; + + for_each_curs_gc(n) { + freeCgs(xw, win, (CgsEnum) n); + } +} + +void +releaseWindowGCs(XtermWidget xw, VTwin *win) +{ + int n; + + for_each_text_gc(n) { + switch (n) { + case gcBorder: + case gcFiller: + break; + default: + freeCgs(xw, win, (CgsEnum) n); + break; + } + } +} + +#define TRACE_FREE_LEAK(name) \ + if (name) { \ + TRACE(("freed " #name ": %p\n", (const void *) name)); \ + free((void *) name); \ + name = 0; \ + } + +#define FREE_LEAK(name) \ + if (name) { \ + free((void *) name); \ + name = 0; \ + } + +#if OPT_INPUT_METHOD +static void +cleanupInputMethod(XtermWidget xw) +{ + TInput *input = lookupTInput(xw, (Widget) xw); + + if (input && input->xim) { + XCloseIM(input->xim); + input->xim = 0; + TRACE(("freed screen->xim\n")); + } +} +#else +#define cleanupInputMethod(xw) /* nothing */ +#endif + +static void +VTDestroy(Widget w GCC_UNUSED) +{ +#ifdef NO_LEAKS + XtermWidget xw = (XtermWidget) w; + TScreen *screen = TScreenOf(xw); + Cardinal n, k; + + StopBlinking(xw); + + if (screen->scrollWidget) { + XtUninstallTranslations(screen->scrollWidget); + XtDestroyWidget(screen->scrollWidget); + } +#if OPT_FIFO_LINES + while (screen->saved_fifo > 0) { + deleteScrollback(screen); + } +#endif + while (screen->save_title != 0) { + SaveTitle *last = screen->save_title; + screen->save_title = last->next; + free(last->iconName); + free(last->windowName); + free(last); + } +#ifndef NO_ACTIVE_ICON + TRACE_FREE_LEAK(xw->misc.active_icon_s); +#endif +#if OPT_ISO_COLORS + TRACE_FREE_LEAK(screen->cmap_data); + for (n = 0; n < MAXCOLORS; n++) { + TRACE_FREE_LEAK(screen->Acolors[n].resource); + } + for (n = 0; n < MAX_SAVED_SGR; n++) { + TRACE_FREE_LEAK(xw->saved_colors.palettes[n]); + } +#endif +#if OPT_COLOR_RES + for (n = 0; n < NCOLORS; n++) { + switch (n) { +#if OPT_TEK4014 + case TEK_BG: + /* FALLTHRU */ + case TEK_FG: + /* FALLTHRU */ + case TEK_CURSOR: + break; +#endif + default: + TRACE_FREE_LEAK(screen->Tcolors[n].resource); + break; + } + } +#endif + TRACE_FREE_LEAK(screen->unparse_bfr); + TRACE_FREE_LEAK(screen->save_ptr); + TRACE_FREE_LEAK(screen->saveBuf_data); + TRACE_FREE_LEAK(screen->saveBuf_index); + for (n = 0; n < 2; ++n) { + TRACE_FREE_LEAK(screen->editBuf_data[n]); + TRACE_FREE_LEAK(screen->editBuf_index[n]); + } + TRACE_FREE_LEAK(screen->keyboard_dialect); + TRACE_FREE_LEAK(screen->term_id); +#if OPT_WIDE_CHARS +#if OPT_LUIT_PROG + TRACE_FREE_LEAK(xw->misc.locale_str); + TRACE_FREE_LEAK(xw->misc.localefilter); +#endif +#endif + TRACE_FREE_LEAK(xw->misc.T_geometry); + TRACE_FREE_LEAK(xw->misc.geo_metry); +#if OPT_INPUT_METHOD + cleanupInputMethod(xw); + TRACE_FREE_LEAK(xw->misc.f_x); + TRACE_FREE_LEAK(xw->misc.input_method); + TRACE_FREE_LEAK(xw->misc.preedit_type); +#endif + releaseCursorGCs(xw); + releaseWindowGCs(xw, &(screen->fullVwin)); +#ifndef NO_ACTIVE_ICON + XFreeFont(screen->display, getIconicFont(screen)->fs); + releaseWindowGCs(xw, &(screen->iconVwin)); +#endif + XtUninstallTranslations((Widget) xw); +#if OPT_TOOLBAR + XtUninstallTranslations((Widget) XtParent(xw)); +#endif + XtUninstallTranslations((Widget) SHELL_OF(xw)); + + if (screen->hidden_cursor) + XFreeCursor(screen->display, screen->hidden_cursor); + + xtermCloseFonts(xw, screen->fnts); +#if OPT_WIDE_ATTRS + xtermCloseFonts(xw, screen->ifnts); +#endif + noleaks_cachedCgs(xw); + free_termcap(xw); + + TRACE_FREE_LEAK(screen->selection_targets_8bit); +#if OPT_SELECT_REGEX + for (n = 0; n < NSELECTUNITS; ++n) { + if (screen->selectMap[n] == Select_REGEX) { + TRACE_FREE_LEAK(screen->selectExpr[n]); + } + } +#endif + +#if OPT_RENDERFONT + for (n = 0; n < NMENUFONTS; ++n) { + int e; + for (e = 0; e < fMAX; ++e) { + xtermCloseXft(screen, getMyXftFont(xw, e, (int) n)); + } + } + discardRenderDraw(screen); + { + ListXftFonts *p; + while ((p = screen->list_xft_fonts) != 0) { + screen->list_xft_fonts = p->next; + free(p); + } + } +#endif + + /* free things allocated via init_Sres or Init_Sres2 */ +#ifndef NO_ACTIVE_ICON + TRACE_FREE_LEAK(screen->icon_fontname); +#endif +#ifdef ALLOWLOGGING + TRACE_FREE_LEAK(screen->logfile); +#endif + TRACE_FREE_LEAK(screen->eight_bit_meta_s); + TRACE_FREE_LEAK(screen->term_id); + TRACE_FREE_LEAK(screen->charClass); + TRACE_FREE_LEAK(screen->answer_back); + TRACE_FREE_LEAK(screen->printer_state.printer_command); + TRACE_FREE_LEAK(screen->keyboard_dialect); + TRACE_FREE_LEAK(screen->disallowedColorOps); + TRACE_FREE_LEAK(screen->disallowedFontOps); + TRACE_FREE_LEAK(screen->disallowedMouseOps); + TRACE_FREE_LEAK(screen->disallowedPasteControls); + TRACE_FREE_LEAK(screen->disallowedTcapOps); + TRACE_FREE_LEAK(screen->disallowedWinOps); + TRACE_FREE_LEAK(screen->default_string); + TRACE_FREE_LEAK(screen->eightbit_select_types); + +#if OPT_WIDE_CHARS + TRACE_FREE_LEAK(screen->utf8_select_types); +#endif + +#if 0 + for (n = fontMenu_font1; n <= fontMenu_lastBuiltin; n++) { + TRACE_FREE_LEAK(screen->MenuFontName(n)); + } +#endif + + TRACE_FREE_LEAK(screen->initial_font); + +#if OPT_LUIT_PROG + TRACE_FREE_LEAK(xw->misc.locale_str); + TRACE_FREE_LEAK(xw->misc.localefilter); +#endif + +#if OPT_RENDERFONT + TRACE_FREE_LEAK(xw->misc.default_xft.f_n); +#if OPT_WIDE_CHARS + TRACE_FREE_LEAK(xw->misc.default_xft.f_w); +#endif + TRACE_FREE_LEAK(xw->misc.render_font_s); +#endif + + TRACE_FREE_LEAK(xw->misc.default_font.f_n); + TRACE_FREE_LEAK(xw->misc.default_font.f_b); + +#if OPT_WIDE_CHARS + TRACE_FREE_LEAK(xw->misc.default_font.f_w); + TRACE_FREE_LEAK(xw->misc.default_font.f_wb); +#endif + + freeFontLists(&(xw->work.fonts.x11)); +#if OPT_RENDERFONT + freeFontLists(&(xw->work.fonts.xft)); +#endif + + xtermFontName(NULL); +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS + TRACE_FREE_LEAK(screen->cacheVTFonts.default_font.f_n); + TRACE_FREE_LEAK(screen->cacheVTFonts.default_font.f_b); +#if OPT_WIDE_CHARS + TRACE_FREE_LEAK(screen->cacheVTFonts.default_font.f_w); + TRACE_FREE_LEAK(screen->cacheVTFonts.default_font.f_wb); +#endif + freeFontLists(&(screen->cacheVTFonts.fonts.x11)); + for (n = 0; n < NMENUFONTS; ++n) { + for (k = 0; k < fMAX; ++k) { + if (screen->menu_font_names[n][k] != + screen->cacheVTFonts.menu_font_names[n][k]) { + if (screen->menu_font_names[n][k] != _Font_Selected_) { + TRACE_FREE_LEAK(screen->menu_font_names[n][k]); + } + TRACE_FREE_LEAK(screen->cacheVTFonts.menu_font_names[n][k]); + } else { + TRACE_FREE_LEAK(screen->menu_font_names[n][k]); + } + } + } +#endif + +#if OPT_SELECT_REGEX + for (n = 0; n < NSELECTUNITS; ++n) { + FREE_LEAK(screen->selectExpr[n]); + } +#endif + + if (screen->selection_atoms) + XtFree((void *) (screen->selection_atoms)); + + for (n = 0; n < MAX_SELECTIONS; ++n) { + free(screen->selected_cells[n].data_buffer); + } + + if (defaultTranslations != xtermClassRec.core_class.tm_table) { + TRACE_FREE_LEAK(defaultTranslations); + } + TRACE_FREE_LEAK(xtermClassRec.core_class.tm_table); + TRACE_FREE_LEAK(xw->keyboard.extra_translations); + TRACE_FREE_LEAK(xw->keyboard.shell_translations); + TRACE_FREE_LEAK(xw->keyboard.xterm_translations); + + XtFree((void *) (xw->visInfo)); + +#if OPT_WIDE_CHARS + FreeTypedBuffer(XChar2b); + FreeTypedBuffer(char); +#endif +#if OPT_RENDERFONT +#if OPT_RENDERWIDE + FreeTypedBuffer(XftCharSpec); +#else + FreeTypedBuffer(XftChar8); +#endif +#endif + + TRACE_FREE_LEAK(myState.print_area); + TRACE_FREE_LEAK(myState.string_area); + memset(&myState, 0, sizeof(myState)); + +#endif /* defined(NO_LEAKS) */ +} + +#ifndef NO_ACTIVE_ICON +static void * +getProperty(Display *dpy, + Window w, + Atom req_type, + const char *prop_name) +{ + Atom property; + Atom actual_return_type; + int actual_format_return = 0; + unsigned long nitems_return = 0; + unsigned long bytes_after_return = 0; + unsigned char *prop_return = 0; + long long_length = 1024; + size_t limit; + char *result = 0; + + TRACE(("getProperty %s(%s)\n", prop_name, + req_type ? TraceAtomName(dpy, req_type) : "?")); + property = XInternAtom(dpy, prop_name, False); + + if (!xtermGetWinProp(dpy, + w, + property, + 0L, + long_length, + req_type, + &actual_return_type, + &actual_format_return, + &nitems_return, + &bytes_after_return, + &prop_return)) { + TRACE((".. Cannot get %s property.\n", prop_name)); + } else if (prop_return != 0) { + + if (nitems_return != 0 && + actual_format_return != 0 && + actual_return_type == req_type) { + /* + * Null-terminate the result to make string handling easier. + * The format==8 corresponds to strings, and the number of items + * is the number of characters. + */ + if (actual_format_return == 8) { + limit = nitems_return; + } else { + /* manpage is misleading - X really uses 'long', not 32-bits */ + limit = sizeof(long) * nitems_return; + } + if ((result = malloc(limit + 1)) != 0) { + memcpy(result, prop_return, limit); + result[limit] = '\0'; + } + TRACE(("... result %s\n", result ? ("ok") : "null")); + } + XFree(prop_return); + } else { + TRACE((".. no property returned\n")); + } + return (void *) result; +} + +/* + * Active icons are supported by fvwm. This feature is not supported by + * metacity (gnome) or kwin (kde). Both metacity and kwin support (in + * incompatible ways, e.g., one uses the icon theme as a fallback for window + * decorations but the other does not, etc, ...) an icon as part of the window + * decoration (usually on the upper-left of the window). + * + * In either case, xterm's icon will only be shown in the window decorations if + * xterm does not use the active icon feature. + * + * This function (tries to) determine the window manager's name, so that we can + * provide a useful automatic default for active icons. It is based on reading + * wmctrl, which covers most of EWMH and ICCM. + */ +static char * +getWindowManagerName(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + Window *sup_window = NULL; + char *result = 0; + + TRACE(("getWindowManagerName\n")); +#define getWinProp(type, name) \ + (Window *)getProperty(dpy, DefaultRootWindow(dpy), type, name) + if ((sup_window = getWinProp(XA_WINDOW, "_NET_SUPPORTING_WM_CHECK")) == 0) { + sup_window = getWinProp(XA_CARDINAL, "_WIN_SUPPORTING_WM_CHECK"); + } + + /* + * If we found the supporting window, get the property containing the + * window manager's name. EWMH defines _NET_WM_NAME, while ICCM defines + * WM_CLASS. There is no standard for the names stored there; + * conventionally it is mixed case. In practice, the former is more often + * set; the latter is not given (or is a lowercased version of the former). + */ + if (sup_window != 0) { +#define getStringProp(type,name) \ + (char *)getProperty(dpy, *sup_window, type, name) + if ((result = getStringProp(XA_UTF8_STRING(dpy), "_NET_WM_NAME")) == 0 + && (result = getStringProp(XA_STRING, "_NET_WM_NAME")) == 0 + && (result = getStringProp(XA_STRING, "WM_CLASS")) == 0) { + TRACE(("... window manager does not tell its name\n")); + } + free(sup_window); + } else { + TRACE(("... Cannot get window manager info properties\n")); + } + if (result == 0) + result = x_strdup("unknown"); + TRACE(("... window manager name is %s\n", result)); + return result; +} + +static Boolean +discount_frame_extents(XtermWidget xw, int *high, int *wide) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + + Atom atom_supported = XInternAtom(dpy, "_NET_FRAME_EXTENTS", False); + Atom actual_type; + int actual_format; + long long_offset = 0; + long long_length = 128; /* number of items to ask for at a time */ + unsigned long nitems; + unsigned long bytes_after; + unsigned char *args; + Boolean rc; + + rc = xtermGetWinProp(dpy, + VShellWindow(xw), + atom_supported, + long_offset, + long_length, + XA_CARDINAL, /* req_type */ + &actual_type, /* actual_type_return */ + &actual_format, /* actual_format_return */ + &nitems, /* nitems_return */ + &bytes_after, /* bytes_after_return */ + &args /* prop_return */ + ); + + if (rc && args && (nitems == 4) && (actual_format == 32)) { + long *extents = (long *) (void *) args; + + TRACE(("_NET_FRAME_EXTENTS:\n")); + TRACE((" left: %ld\n", extents[0])); + TRACE((" right: %ld\n", extents[1])); + TRACE((" top: %ld\n", extents[2])); + TRACE((" bottom: %ld\n", extents[3])); + + if (!x_strncasecmp(xw->work.wm_name, "gnome shell", 11)) { + *wide -= (int) (extents[0] + extents[1]); /* -= (left+right) */ + *high -= (int) (extents[2] + extents[3]); /* -= (top+bottom) */ + TRACE(("...applied extents %d,%d\n", *high, *wide)); + } else if (!x_strncasecmp(xw->work.wm_name, "compiz", 6)) { + /* Ubuntu 16.04 is really off-by-one */ + *wide -= (int) (extents[0] + extents[1] - 1); + *high -= (int) (extents[2] + extents[3] - 1); + TRACE(("...applied extents %d,%d\n", *high, *wide)); + } else if (!x_strncasecmp(xw->work.wm_name, "fvwm", 4)) { + TRACE(("...skipping extents\n")); + } else { + TRACE(("...ignoring extents\n")); + rc = False; + } + } else { + rc = False; + } + return rc; +} +#endif /* !NO_ACTIVE_ICON */ + +void +initBorderGC(XtermWidget xw, VTwin *win) +{ + TScreen *screen = TScreenOf(xw); + Pixel filler; + + TRACE(("initBorderGC(%s) core bg %#lx, bd %#lx text fg %#lx, bg %#lx %s\n", + (win == &(screen->fullVwin)) ? "full" : "icon", + xw->core.background_pixel, + xw->core.border_pixel, + T_COLOR(screen, TEXT_FG), + T_COLOR(screen, TEXT_BG), + xw->misc.re_verse ? "reverse" : "normal")); + if (xw->misc.color_inner_border + && (xw->core.background_pixel != xw->core.border_pixel)) { + /* + * By default, try to match the inner window's background. + */ + if ((xw->core.background_pixel == T_COLOR(screen, TEXT_BG)) && + (xw->core.border_pixel == T_COLOR(screen, TEXT_FG))) { + filler = T_COLOR(screen, TEXT_BG); + } else { + filler = xw->core.border_pixel; + } + TRACE((" border %#lx\n", filler)); + setCgsFore(xw, win, gcBorder, filler); + setCgsBack(xw, win, gcBorder, filler); + win->border_gc = getCgsGC(xw, win, gcBorder); + } +#if USE_DOUBLE_BUFFER + else if (resource.buffered) { + filler = T_COLOR(screen, TEXT_BG); + TRACE((" border %#lx (buffered)\n", filler)); + setCgsFore(xw, win, gcBorder, filler); + setCgsBack(xw, win, gcBorder, filler); + win->border_gc = getCgsGC(xw, win, gcBorder); + } +#endif + else { + TRACE((" border unused\n")); + win->border_gc = 0; + } + + /* + * Initialize a GC for double-buffering, needed for XFillRectangle call + * in xtermClear2(). When not double-buffering, the XClearArea call works, + * without requiring a separate GC. + */ +#if USE_DOUBLE_BUFFER + if (resource.buffered) { + filler = (((xw->flags & BG_COLOR) && (xw->cur_background >= 0)) + ? getXtermBG(xw, xw->flags, xw->cur_background) + : T_COLOR(screen, TEXT_BG)); + + TRACE((" filler %#lx %s\n", + filler, + xw->misc.re_verse ? "reverse" : "normal")); + + setCgsFore(xw, win, gcFiller, filler); + setCgsBack(xw, win, gcFiller, filler); + + win->filler_gc = getCgsGC(xw, win, gcFiller); + } +#endif +} + +/*ARGSUSED*/ +static void +VTRealize(Widget w, + XtValueMask * valuemask, + XSetWindowAttributes * values) +{ + XtermWidget xw = (XtermWidget) w; + TScreen *screen = TScreenOf(xw); + + const VTFontNames *myfont; + struct Xinerama_geometry pos; + int pr; + Atom pid_atom; + int i; + + TRACE(("VTRealize {{\n")); + + TabReset(xw->tabs); + + if (screen->menu_font_number == fontMenu_default) { + myfont = defaultVTFontNames(xw); + } else { + myfont = xtermFontName(screen->MenuFontName(screen->menu_font_number)); + } + memset(screen->fnts, 0, sizeof(screen->fnts)); + + if (!xtermLoadFont(xw, + myfont, + False, + screen->menu_font_number)) { + if (XmuCompareISOLatin1(myfont->f_n, DEFFONT) != 0) { + char *use_font = x_strdup(DEFFONT); + xtermWarning("unable to open font \"%s\", trying \"%s\"....\n", + myfont->f_n, use_font); + (void) xtermLoadFont(xw, + xtermFontName(use_font), + False, + screen->menu_font_number); + screen->MenuFontName(screen->menu_font_number) = use_font; + } + } + + /* really screwed if we couldn't open default font */ + if (!GetNormalFont(screen, fNorm)->fs) { + xtermWarning("unable to locate a suitable font\n"); + Exit(1); + } +#if OPT_WIDE_CHARS + if (screen->utf8_mode) { + TRACE(("check if this is a wide font, if not try again\n")); + if (xtermLoadWideFonts(xw, False)) { + SetVTFont(xw, screen->menu_font_number, True, NULL); + /* we will not be able to switch to ISO-8859-1 */ + if (!screen->mergedVTFonts) { + screen->utf8_fonts = uAlways; + update_font_utf8_fonts(); + } + } + } +#endif + + /* making cursor */ + if (!screen->pointer_cursor) { + screen->pointer_cursor = + make_colored_cursor(XC_xterm, + T_COLOR(screen, MOUSE_FG), + T_COLOR(screen, MOUSE_BG)); + } else { + recolor_cursor(screen, + screen->pointer_cursor, + T_COLOR(screen, MOUSE_FG), + T_COLOR(screen, MOUSE_BG)); + } + + /* set defaults */ + pos.x = 1; + pos.y = 1; + pos.w = 80; + pos.h = 24; + + TRACE(("parsing geo_metry %s\n", NonNull(xw->misc.geo_metry))); + pr = XParseXineramaGeometry(screen->display, xw->misc.geo_metry, &pos); + TRACE(("... position %d,%d size %dx%d\n", pos.y, pos.x, pos.h, pos.w)); + + set_max_col(screen, (int) (pos.w - 1)); /* units in character cells */ + set_max_row(screen, (int) (pos.h - 1)); /* units in character cells */ + xtermUpdateFontInfo(xw, False); + + pos.w = screen->fullVwin.fullwidth; + pos.h = screen->fullVwin.fullheight; + + TRACE(("... BorderWidth: widget %d parent %d shell %d\n", + BorderWidth(xw), + BorderWidth(XtParent(xw)), + BorderWidth(SHELL_OF(xw)))); + + if ((pr & XValue) && (XNegative & pr)) { + pos.x = (Position) (pos.x + (pos.scr_w + - (int) pos.w + - (BorderWidth(XtParent(xw)) * 2))); + } + if ((pr & YValue) && (YNegative & pr)) { + pos.y = (Position) (pos.y + (pos.scr_h + - (int) pos.h + - (BorderWidth(XtParent(xw)) * 2))); + } + pos.x = (Position) (pos.x + pos.scr_x); + pos.y = (Position) (pos.y + pos.scr_y); + + /* set up size hints for window manager; min 1 char by 1 char */ + getXtermSizeHints(xw); + xtermSizeHints(xw, (xw->misc.scrollbar + ? (screen->scrollWidget->core.width + + BorderWidth(screen->scrollWidget)) + : 0)); + + xw->hints.x = pos.x; + xw->hints.y = pos.y; +#if OPT_MAXIMIZE + /* assure single-increment resize for fullscreen */ + if (xw->work.ewmh[0].mode) { + xw->hints.width_inc = 1; + xw->hints.height_inc = 1; + } +#endif + if ((XValue & pr) || (YValue & pr)) { + xw->hints.flags |= USSize | USPosition; + xw->hints.flags |= PWinGravity; + switch (pr & (XNegative | YNegative)) { + case 0: + xw->hints.win_gravity = NorthWestGravity; + break; + case XNegative: + xw->hints.win_gravity = NorthEastGravity; + break; + case YNegative: + xw->hints.win_gravity = SouthWestGravity; + break; + default: + xw->hints.win_gravity = SouthEastGravity; + break; + } + } else { + /* set a default size, but do *not* set position */ + xw->hints.flags |= PSize; + } + xw->hints.height = xw->hints.base_height + + xw->hints.height_inc * MaxRows(screen); + xw->hints.width = xw->hints.base_width + + xw->hints.width_inc * MaxCols(screen); + + if ((WidthValue & pr) || (HeightValue & pr)) + xw->hints.flags |= USSize; + else + xw->hints.flags |= PSize; + + /* + * Note that the size-hints are for the shell, while the resize-request + * is for the vt100 widget. They are not the same size. + */ + (void) REQ_RESIZE((Widget) xw, + (Dimension) pos.w, (Dimension) pos.h, + &xw->core.width, &xw->core.height); + + /* XXX This is bogus. We are parsing geometries too late. This + * is information that the shell widget ought to have before we get + * realized, so that it can do the right thing. + */ + if (xw->hints.flags & USPosition) + XMoveWindow(XtDisplay(xw), VShellWindow(xw), + xw->hints.x, xw->hints.y); + + TRACE(("%s@%d -- ", __FILE__, __LINE__)); + TRACE_HINTS(&xw->hints); + XSetWMNormalHints(XtDisplay(xw), VShellWindow(xw), &xw->hints); + TRACE(("%s@%d -- ", __FILE__, __LINE__)); + TRACE_WM_HINTS(xw); + + if ((pid_atom = XInternAtom(XtDisplay(xw), "_NET_WM_PID", False)) != None) { + /* XChangeProperty format 32 really is "long" */ + unsigned long pid_l = (unsigned long) getpid(); + TRACE(("Setting _NET_WM_PID property to %lu\n", pid_l)); + XChangeProperty(XtDisplay(xw), VShellWindow(xw), + pid_atom, XA_CARDINAL, 32, PropModeReplace, + (unsigned char *) &pid_l, 1); + } + + XFlush(XtDisplay(xw)); /* get it out to window manager */ + + /* use ForgetGravity instead of SouthWestGravity because translating + the Expose events for ConfigureNotifys is too hard */ + values->bit_gravity = (GravityIsNorthWest(xw) + ? NorthWestGravity + : ForgetGravity); + screen->fullVwin.window = XtWindow(xw) = + XCreateWindow(XtDisplay(xw), XtWindow(XtParent(xw)), + xw->core.x, xw->core.y, + xw->core.width, xw->core.height, BorderWidth(xw), + (int) xw->core.depth, + InputOutput, CopyFromParent, + *valuemask | CWBitGravity, values); +#if USE_DOUBLE_BUFFER + screen->fullVwin.drawable = screen->fullVwin.window; + + if (resource.buffered) { + Window win = screen->fullVwin.window; + Drawable d; + int major, minor; + if (XdbeQueryExtension(XtDisplay(xw), &major, &minor)) { + d = XdbeAllocateBackBufferName(XtDisplay(xw), win, + (XdbeSwapAction) XdbeCopied); + if (d == None) { + fprintf(stderr, "Couldn't allocate a back buffer!\n"); + exit(3); + } + screen->fullVwin.drawable = d; + screen->needSwap = 1; + TRACE(("initialized double-buffering\n")); + } else { + resource.buffered = False; + } + } +#endif /* USE_DOUBLE_BUFFER */ + screen->event_mask = values->event_mask; + +#ifndef NO_ACTIVE_ICON + /* + * Normally, the font-number for icon fonts does not correspond with any of + * the menu-selectable fonts. If we cannot load the font given for the + * iconFont resource, try with font1 aka "Unreadable". + */ + screen->icon_fontnum = -1; + if (getIconicFont(screen)->fs == 0) { + getIconicFont(screen)->fs = + XLoadQueryFont(screen->display, + screen->MenuFontName(fontMenu_font1)); + ReportIcons(("%susing font1 '%s' as iconFont\n", + (getIconicFont(screen)->fs + ? "" + : "NOT "), + screen->MenuFontName(fontMenu_font1))); + } +#if OPT_RENDERFONT + /* + * If we still have no result from iconFont resource (perhaps because fonts + * are missing) but are using Xft, try to use that instead. We prefer + * bitmap fonts in any case, since scaled fonts are usually less readable, + * particularly at small sizes. + */ + if (UsingRenderFont(xw) + && getIconicFont(screen)->fs == 0) { + screen->icon_fontnum = fontMenu_default; + getIconicFont(screen)->fs = GetNormalFont(screen, fNorm)->fs; /* need for next-if */ + ReportIcons(("using TrueType font as iconFont\n")); + } +#endif + xw->work.wm_name = getWindowManagerName(xw); + if ((xw->work.active_icon == eiDefault) && getIconicFont(screen)->fs) { + ReportIcons(("window manager name is %s\n", xw->work.wm_name)); + if (x_strncasecmp(xw->work.wm_name, "fvwm", 4) && + x_strncasecmp(xw->work.wm_name, "window maker", 12)) { + xw->work.active_icon = eiFalse; + } + } + if (xw->work.active_icon && getIconicFont(screen)->fs) { + int iconX = 0, iconY = 0; + Widget shell = SHELL_OF(xw); + VTwin *win = &(screen->iconVwin); + int save_fontnum = screen->menu_font_number; + + ReportIcons(("initializing active-icon %d\n", screen->icon_fontnum)); + screen->menu_font_number = screen->icon_fontnum; + XtVaGetValues(shell, + XtNiconX, &iconX, + XtNiconY, &iconY, + (XtPointer) 0); + xtermComputeFontInfo(xw, &(screen->iconVwin), + getIconicFont(screen)->fs, 0); + screen->menu_font_number = save_fontnum; + + /* since only one client is permitted to select for Button + * events, we have to let the window manager get 'em... + */ + values->event_mask &= ~(ButtonPressMask | ButtonReleaseMask); + values->border_pixel = xw->misc.icon_border_pixel; + + screen->iconVwin.window = + XCreateWindow(XtDisplay(xw), + RootWindowOfScreen(XtScreen(shell)), + iconX, iconY, + screen->iconVwin.fullwidth, + screen->iconVwin.fullheight, + xw->misc.icon_border_width, + (int) xw->core.depth, + InputOutput, CopyFromParent, + *valuemask | CWBitGravity | CWBorderPixel, + values); +#if USE_DOUBLE_BUFFER + screen->iconVwin.drawable = screen->iconVwin.window; +#endif + XtVaSetValues(shell, + XtNiconWindow, screen->iconVwin.window, + (XtPointer) 0); + XtRegisterDrawable(XtDisplay(xw), screen->iconVwin.window, w); + + setCgsFont(xw, win, gcNorm, getIconicFont(screen)); + setCgsFore(xw, win, gcNorm, T_COLOR(screen, TEXT_FG)); + setCgsBack(xw, win, gcNorm, T_COLOR(screen, TEXT_BG)); + + copyCgs(xw, win, gcBold, gcNorm); + + setCgsFont(xw, win, gcNormReverse, getIconicFont(screen)); + setCgsFore(xw, win, gcNormReverse, T_COLOR(screen, TEXT_BG)); + setCgsBack(xw, win, gcNormReverse, T_COLOR(screen, TEXT_FG)); + + copyCgs(xw, win, gcBoldReverse, gcNormReverse); + + initBorderGC(xw, win); + +#if OPT_TOOLBAR + /* + * Toolbar is initialized before we get here. Enable the menu item + * and set it properly. + */ + SetItemSensitivity(vtMenuEntries[vtMenu_activeicon].widget, True); + update_activeicon(); +#endif + } else { + ReportIcons(("disabled active-icon\n")); + xw->work.active_icon = eiFalse; + } +#endif /* NO_ACTIVE_ICON */ + +#if OPT_INPUT_METHOD + VTInitI18N(xw); +#endif +#if OPT_NUM_LOCK + VTInitModifiers(xw); +#if OPT_EXTRA_PASTE + if (xw->keyboard.extra_translations) { + XtOverrideTranslations((Widget) xw, + XtParseTranslationTable(xw->keyboard.extra_translations)); + } +#endif +#endif + + set_cursor_gcs(xw); + initBorderGC(xw, &(screen->fullVwin)); + + /* Reset variables used by ANSI emulation. */ + + resetCharsets(screen); + + XDefineCursor(screen->display, VShellWindow(xw), screen->pointer_cursor); + + set_cur_col(screen, 0); + set_cur_row(screen, 0); + set_max_col(screen, Width(screen) / screen->fullVwin.f_width - 1); + set_max_row(screen, Height(screen) / screen->fullVwin.f_height - 1); + resetMargins(xw); + + memset(screen->sc, 0, sizeof(screen->sc)); + + /* Mark screen buffer as unallocated. We wait until the run loop so + that the child process does not fork and exec with all the dynamic + memory it will never use. If we were to do it here, the + swap space for new process would be huge for huge savelines. */ +#if OPT_TEK4014 + if (!tekWidget) /* if not called after fork */ +#endif + { + screen->visbuf = NULL; + screen->saveBuf_index = NULL; + } + + ResetWrap(screen); + screen->scrolls = screen->incopy = 0; + xtermSetCursorBox(screen); + + screen->savedlines = 0; + + for (i = 0; i < 2; ++i) { + screen->whichBuf = !screen->whichBuf; + CursorSave(xw); + } + +#ifndef NO_ACTIVE_ICON + if (!xw->work.active_icon) +#endif + xtermLoadIcon(xw, resource.icon_hint); + + /* + * Do this last, since it may change the layout via a resize. + */ + if (xw->misc.scrollbar) { + screen->fullVwin.sb_info.width = 0; + ScrollBarOn(xw, False); + } + + xtermSetWinSize(xw); + TRACE(("}} VTRealize\n")); +} + +#if OPT_INPUT_METHOD + +/* limit this feature to recent XFree86 since X11R6.x core dumps */ +#if defined(XtSpecificationRelease) && XtSpecificationRelease >= 6 && defined(X_HAVE_UTF8_STRING) +#define USE_XIM_INSTANTIATE_CB + +static void +xim_instantiate_cb(Display *display, + XPointer client_data GCC_UNUSED, + XPointer call_data GCC_UNUSED) +{ + XtermWidget xw = term; + + TRACE(("xim_instantiate_cb client=%p, call=%p\n", client_data, call_data)); + + if (display == XtDisplay(xw)) { + VTInitI18N(xw); + } +} + +static void +xim_destroy_cb(XIM im GCC_UNUSED, + XPointer client_data GCC_UNUSED, + XPointer call_data GCC_UNUSED) +{ + XtermWidget xw = term; + TInput *input = lookupTInput(xw, (Widget) xw); + + TRACE(("xim_destroy_cb im=%lx, client=%p, call=%p\n", + (long) im, client_data, call_data)); + if (input) + input->xic = NULL; + XRegisterIMInstantiateCallback(XtDisplay(xw), NULL, NULL, NULL, + xim_instantiate_cb, NULL); +} +#endif /* X11R6+ */ + +static Boolean +xim_create_fs(XtermWidget xw) +{ + XFontStruct **fonts; + char **font_name_list; + char **missing_charset_list; + char *def_string; + int missing_charset_count; + unsigned i, j; + + if (xw->work.xim_fs == 0) { + xw->work.xim_fs = XCreateFontSet(XtDisplay(xw), + xw->misc.f_x, + &missing_charset_list, + &missing_charset_count, + &def_string); + if (xw->work.xim_fs == NULL) { + xtermWarning("Preparation of font set " + "\"%s\" for XIM failed.\n", xw->misc.f_x); + xw->work.xim_fs = XCreateFontSet(XtDisplay(xw), + DEFXIMFONT, + &missing_charset_list, + &missing_charset_count, + &def_string); + } + } + if (xw->work.xim_fs == NULL) { + xtermWarning("Preparation of default font set " + "\"%s\" for XIM failed.\n", DEFXIMFONT); + cleanupInputMethod(xw); + xw->work.cannot_im = True; + } else { + (void) XExtentsOfFontSet(xw->work.xim_fs); + j = (unsigned) XFontsOfFontSet(xw->work.xim_fs, &fonts, &font_name_list); + for (i = 0, xw->work.xim_fs_ascent = 0; i < j; i++) { + if (xw->work.xim_fs_ascent < (*fonts)->ascent) + xw->work.xim_fs_ascent = (*fonts)->ascent; + } + } + return (Boolean) !(xw->work.cannot_im); +} + +static void +xim_create_xic(XtermWidget xw, Widget theInput) +{ + Display *myDisplay = XtDisplay(theInput); + Window myWindow = XtWindow(theInput); + unsigned i, j; + char *p = NULL, *s, *t, *ns, *end, buf[32]; + XIMStyles *xim_styles; + XIMStyle input_style = 0; + Bool found; + static struct { + const char *name; + unsigned long code; + } known_style[] = { + { + "OverTheSpot", (XIMPreeditPosition | XIMStatusNothing) + }, + { + "OffTheSpot", (XIMPreeditArea | XIMStatusArea) + }, + { + "Root", (XIMPreeditNothing | XIMStatusNothing) + }, + }; + TInput *input = lookupTInput(xw, theInput); + + if (xw->work.cannot_im) { + return; + } + + if (input == 0) { + for (i = 0; i < NINPUTWIDGETS; ++i) { + if (xw->work.inputs[i].w == 0) { + input = xw->work.inputs + i; + input->w = theInput; + break; + } + } + } + + if (input == 0) { + xtermWarning("attempted to add too many input widgets\n"); + return; + } + + TRACE(("xim_real_init\n")); + + if (IsEmpty(xw->misc.input_method)) { + if ((p = XSetLocaleModifiers("")) != NULL && *p) { + input->xim = XOpenIM(myDisplay, NULL, NULL, NULL); + } + } else { + s = xw->misc.input_method; + i = 5 + (unsigned) strlen(s); + + t = (char *) MyStackAlloc(i, buf); + if (t == NULL) { + SysError(ERROR_VINIT); + } else { + + for (ns = s; ns && *s;) { + while (*s && isspace(CharOf(*s))) + s++; + if (!*s) + break; + if ((ns = end = strchr(s, ',')) == 0) + end = s + strlen(s); + while ((end != s) && isspace(CharOf(end[-1]))) + end--; + + if (end != s) { + strcpy(t, "@im="); + strncat(t, s, (size_t) (end - s)); + + if ((p = XSetLocaleModifiers(t)) != 0 && *p + && (input->xim = XOpenIM(myDisplay, + NULL, + NULL, + NULL)) != 0) { + break; + } + + } + s = ns + 1; + } + MyStackFree(t, buf); + } + } + + if (input->xim == NULL + && (p = XSetLocaleModifiers("@im=none")) != NULL + && *p) { + input->xim = XOpenIM(myDisplay, NULL, NULL, NULL); + } + + if (!input->xim) { + xtermWarning("Failed to open input method\n"); + return; + } + TRACE(("VTInitI18N opened input method:%s\n", NonNull(p))); + + if (XGetIMValues(input->xim, XNQueryInputStyle, &xim_styles, (void *) 0) + || !xim_styles + || !xim_styles->count_styles) { + xtermWarning("input method doesn't support any style\n"); + cleanupInputMethod(xw); + xw->work.cannot_im = True; + return; + } + + found = False; + for (s = xw->misc.preedit_type; s && !found;) { + while (*s && isspace(CharOf(*s))) + s++; + if (!*s) + break; + if ((ns = end = strchr(s, ',')) != 0) + ns++; + else + end = s + strlen(s); + while ((end != s) && isspace(CharOf(end[-1]))) + end--; + + if (end != s) { /* just in case we have a spurious comma */ + TRACE(("looking for style '%.*s'\n", (int) (end - s), s)); + for (i = 0; i < XtNumber(known_style); i++) { + if ((int) strlen(known_style[i].name) == (end - s) + && !strncmp(s, known_style[i].name, (size_t) (end - s))) { + input_style = known_style[i].code; + for (j = 0; j < xim_styles->count_styles; j++) { + if (input_style == xim_styles->supported_styles[j]) { + found = True; + break; + } + } + if (found) + break; + } + } + } + + s = ns; + } + XFree(xim_styles); + + if (!found) { + xtermWarning("input method doesn't support my preedit type (%s)\n", + xw->misc.preedit_type); + cleanupInputMethod(xw); + xw->work.cannot_im = True; + return; + } + + /* + * Check for styles we do not yet support. + */ + TRACE(("input_style %#lx\n", input_style)); + if (input_style == (XIMPreeditArea | XIMStatusArea)) { + xtermWarning("This program doesn't support the 'OffTheSpot' preedit type\n"); + cleanupInputMethod(xw); + xw->work.cannot_im = True; + return; + } + + /* + * For XIMPreeditPosition (or OverTheSpot), XIM client has to + * prepare a font. + * The font has to be locale-dependent XFontSet, whereas + * XTerm use Unicode font. This leads a problem that the + * same font cannot be used for XIM preedit. + */ + if (input_style != (XIMPreeditNothing | XIMStatusNothing)) { + XVaNestedList p_list; + XPoint spot = + {0, 0}; + + if (xim_create_fs(xw)) { + p_list = XVaCreateNestedList(0, + XNSpotLocation, &spot, + XNFontSet, xw->work.xim_fs, + (void *) 0); + input->xic = XCreateIC(input->xim, + XNInputStyle, input_style, + XNClientWindow, myWindow, + XNFocusWindow, myWindow, + XNPreeditAttributes, p_list, + (void *) 0); + } + } else { + input->xic = XCreateIC(input->xim, XNInputStyle, input_style, + XNClientWindow, myWindow, + XNFocusWindow, myWindow, + (void *) 0); + } + + if (!input->xic) { + xtermWarning("Failed to create input context\n"); + cleanupInputMethod(xw); + } +#if defined(USE_XIM_INSTANTIATE_CB) + else { + XIMCallback destroy_cb; + + destroy_cb.callback = xim_destroy_cb; + destroy_cb.client_data = NULL; + if (XSetIMValues(input->xim, + XNDestroyCallback, + &destroy_cb, + (void *) 0)) { + xtermWarning("Could not set destroy callback to IM\n"); + } + } +#endif + + return; +} + +static void +xim_real_init(XtermWidget xw) +{ + xim_create_xic(xw, (Widget) xw); +} + +static void +VTInitI18N(XtermWidget xw) +{ + if (xw->misc.open_im) { + xim_real_init(xw); + +#if defined(USE_XIM_INSTANTIATE_CB) + if (lookupTInput(xw, (Widget) xw) == NULL + && !xw->work.cannot_im + && xw->misc.retry_im-- > 0) { + sleep(3); + XRegisterIMInstantiateCallback(XtDisplay(xw), NULL, NULL, NULL, + xim_instantiate_cb, NULL); + } +#endif + } +} + +TInput * +lookupTInput(XtermWidget xw, Widget w) +{ + TInput *result = 0; + unsigned n; + + for (n = 0; n < NINPUTWIDGETS; ++n) { + if (xw->work.inputs[n].w == w) { + result = xw->work.inputs + n; + break; + } + } + + return result; +} +#endif /* OPT_INPUT_METHOD */ + +static void +set_cursor_outline_gc(XtermWidget xw, + Bool filled, + Pixel fg, + Pixel bg, + Pixel cc) +{ + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + CgsEnum cgsId = gcVTcursOutline; + + if (cc == bg) + cc = fg; + + if (filled) { + setCgsFore(xw, win, cgsId, bg); + setCgsBack(xw, win, cgsId, cc); + } else { + setCgsFore(xw, win, cgsId, cc); + setCgsBack(xw, win, cgsId, bg); + } +} + +static Boolean +VTSetValues(Widget cur, + Widget request GCC_UNUSED, + Widget wnew, + ArgList args GCC_UNUSED, + Cardinal *num_args GCC_UNUSED) +{ + XtermWidget curvt = (XtermWidget) cur; + XtermWidget newvt = (XtermWidget) wnew; + Boolean refresh_needed = False; + Boolean fonts_redone = False; + + if ((T_COLOR(TScreenOf(curvt), TEXT_BG) != + T_COLOR(TScreenOf(newvt), TEXT_BG)) || + (T_COLOR(TScreenOf(curvt), TEXT_FG) != + T_COLOR(TScreenOf(newvt), TEXT_FG)) || + (TScreenOf(curvt)->MenuFontName(TScreenOf(curvt)->menu_font_number) != + TScreenOf(newvt)->MenuFontName(TScreenOf(newvt)->menu_font_number)) || + strcmp(DefaultFontN(curvt), DefaultFontN(newvt))) { + if (strcmp(DefaultFontN(curvt), DefaultFontN(newvt))) { + TScreenOf(newvt)->MenuFontName(fontMenu_default) = DefaultFontN(newvt); + } + if (xtermLoadFont(newvt, + xtermFontName(TScreenOf(newvt)->MenuFontName(TScreenOf(curvt)->menu_font_number)), + True, TScreenOf(newvt)->menu_font_number)) { + /* resizing does the redisplay, so don't ask for it here */ + refresh_needed = True; + fonts_redone = True; + } else if (strcmp(DefaultFontN(curvt), DefaultFontN(newvt))) { + TScreenOf(newvt)->MenuFontName(fontMenu_default) = DefaultFontN(curvt); + } + } + if (!fonts_redone + && (T_COLOR(TScreenOf(curvt), TEXT_CURSOR) != + T_COLOR(TScreenOf(newvt), TEXT_CURSOR))) { + if (set_cursor_gcs(newvt)) + refresh_needed = True; + } + if (curvt->misc.re_verse != newvt->misc.re_verse) { + newvt->flags ^= REVERSE_VIDEO; + ReverseVideo(newvt); + /* ReverseVideo toggles */ + newvt->misc.re_verse = (Boolean) (!newvt->misc.re_verse); + refresh_needed = True; + } + if ((T_COLOR(TScreenOf(curvt), MOUSE_FG) != + T_COLOR(TScreenOf(newvt), MOUSE_FG)) || + (T_COLOR(TScreenOf(curvt), MOUSE_BG) != + T_COLOR(TScreenOf(newvt), MOUSE_BG))) { + recolor_cursor(TScreenOf(newvt), + TScreenOf(newvt)->pointer_cursor, + T_COLOR(TScreenOf(newvt), MOUSE_FG), + T_COLOR(TScreenOf(newvt), MOUSE_BG)); + refresh_needed = True; + } + if (curvt->misc.scrollbar != newvt->misc.scrollbar) { + ToggleScrollBar(newvt); + } + + return refresh_needed; +} + +/* + * Given a font-slot and information about selection/reverse, find the + * corresponding cached-GC slot. + */ +#if OPT_WIDE_ATTRS +static int +reverseCgs(XtermWidget xw, unsigned attr_flags, Bool hilite, int font) +{ + TScreen *screen = TScreenOf(xw); + CgsEnum result = gcMAX; + + (void) screen; + if (ReverseOrHilite(screen, attr_flags, hilite)) { + switch (font) { + case fNorm: + result = gcNormReverse; + break; + case fBold: + result = gcBoldReverse; + break; +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + case fItal: + result = gcNormReverse; /* FIXME */ + break; +#endif +#if OPT_WIDE_CHARS + case fWide: + result = gcWideReverse; + break; + case fWBold: + result = gcWBoldReverse; + break; + case fWItal: + result = gcWideReverse; /* FIXME */ + break; +#endif + } + } else { + switch (font) { + case fNorm: + result = gcNorm; + break; + case fBold: + result = gcBold; + break; +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + case fItal: + result = gcNorm; /* FIXME */ + break; +#endif +#if OPT_WIDE_CHARS + case fWide: + result = gcWide; + break; + case fWBold: + result = gcWBold; + break; + case fWItal: + result = gcWide; /* FIXME */ + break; +#endif + } + } + return (int) result; +} +#endif + +#define setGC(code) set_at = __LINE__, currentCgs = code + +#define OutsideSelection(screen,srow,scol) \ + ((srow) > (screen)->endH.row || \ + ((srow) == (screen)->endH.row && \ + (scol) >= (screen)->endH.col) || \ + (srow) < (screen)->startH.row || \ + ((srow) == (screen)->startH.row && \ + (scol) < (screen)->startH.col)) + +/* + * Shows cursor at new cursor position in screen. + */ +void +ShowCursor(void) +{ + XtermWidget xw = term; + XTermDraw params; + TScreen *screen = TScreenOf(xw); + IChar base; + unsigned flags; + CellColor fg_bg = initCColor; + GC currentGC; + GC outlineGC; + CgsEnum currentCgs = gcMAX; + VTwin *currentWin = WhichVWin(screen); + int set_at; + Bool in_selection; + Bool reversed; + Bool filled; + Pixel fg_pix; + Pixel bg_pix; + Pixel tmp; +#if OPT_HIGHLIGHT_COLOR + Pixel selbg_pix = T_COLOR(screen, HIGHLIGHT_BG); + Pixel selfg_pix = T_COLOR(screen, HIGHLIGHT_FG); + Boolean use_selbg; + Boolean use_selfg; +#endif +#if OPT_WIDE_CHARS + int my_col = 0; +#endif + int cursor_col; + CLineData *ld = 0; + + if (screen->cursor_state == BLINKED_OFF) + return; + + if (screen->eventMode != NORMAL) + return; + + if (INX2ROW(screen, screen->cur_row) > screen->max_row) + return; + + screen->cursorp.row = screen->cur_row; + cursor_col = screen->cursorp.col = screen->cur_col; + screen->cursor_moved = False; + +#ifndef NO_ACTIVE_ICON + if (IsIcon(screen)) { + screen->cursor_state = ON; + return; + } +#endif /* NO_ACTIVE_ICON */ + + ld = getLineData(screen, screen->cur_row); + + base = ld->charData[cursor_col]; + flags = ld->attribs[cursor_col]; + + if_OPT_WIDE_CHARS(screen, { + if (base == HIDDEN_CHAR && cursor_col > 0) { + /* if cursor points to non-initial part of wide character, + * back it up + */ + --cursor_col; + base = ld->charData[cursor_col]; + } + my_col = cursor_col; + if (base == 0) + base = ' '; + if (isWide((int) base)) + my_col += 1; + }); + + if (base == 0) { + base = ' '; + } +#if OPT_ISO_COLORS +#ifdef EXP_BOGUS_FG + /* + * If the cursor happens to be on blanks, and we have not set both + * foreground and background color, do not treat it as a colored cell. + */ + if (base == ' ') { + if ((flags & (FG_COLOR | BG_COLOR)) == BG_COLOR) { + TRACE(("ShowCursor - do not treat as a colored cell\n")); + flags &= ~(FG_COLOR | BG_COLOR); + } else if ((flags & (FG_COLOR | BG_COLOR)) == FG_COLOR) { + TRACE(("ShowCursor - should we treat as a colored cell?\n")); + if (!(xw->flags & FG_COLOR)) { + if (CheckBogusForeground(screen, "ShowCursor")) { + flags &= ~(FG_COLOR | BG_COLOR); + } + } + } + } +#else /* !EXP_BOGUS_FG */ + /* + * If the cursor happens to be on blanks, and the foreground color is set + * but not the background, do not treat it as a colored cell. + */ + if ((flags & TERM_COLOR_FLAGS(xw)) == FG_COLOR + && base == ' ') { + flags &= ~TERM_COLOR_FLAGS(xw); + } +#endif +#endif + + /* + * Compare the current cell to the last set of colors used for the + * cursor and update the GC's if needed. + */ + (void) fg_bg; + if_OPT_ISO_COLORS(screen, { + fg_bg = ld->color[cursor_col]; + }); + + fg_pix = getXtermFG(xw, flags, (int) extract_fg(xw, fg_bg, flags)); + bg_pix = getXtermBG(xw, flags, (int) extract_bg(xw, fg_bg, flags)); + + /* + * If we happen to have the same foreground/background colors, choose + * a workable foreground color from which we can obtain a visible cursor. + */ + if (fg_pix == bg_pix) { + long bg_diff = (long) (bg_pix - T_COLOR(TScreenOf(xw), TEXT_BG)); + long fg_diff = (long) (bg_pix - T_COLOR(TScreenOf(xw), TEXT_FG)); + if (bg_diff < 0) + bg_diff = -bg_diff; + if (fg_diff < 0) + fg_diff = -fg_diff; + if (bg_diff < fg_diff) { + fg_pix = T_COLOR(TScreenOf(xw), TEXT_FG); + } else { + fg_pix = T_COLOR(TScreenOf(xw), TEXT_BG); + } + } + + if (OutsideSelection(screen, screen->cur_row, screen->cur_col)) + in_selection = False; + else + in_selection = True; + + reversed = ReverseOrHilite(screen, flags, in_selection); + + /* This is like updatedXtermGC(), except that we have to worry about + * whether the window has focus, since in that case we want just an + * outline for the cursor. + */ + filled = (screen->select || screen->always_highlight) && isCursorBlock(screen); +#if OPT_HIGHLIGHT_COLOR + use_selbg = isNotForeground(xw, fg_pix, bg_pix, selbg_pix); + use_selfg = isNotBackground(xw, fg_pix, bg_pix, selfg_pix); +#endif + if (filled) { + if (reversed) { /* text is reverse video */ + if (getCgsGC(xw, currentWin, gcVTcursNormal)) { + setGC(gcVTcursNormal); + } else { + if (flags & BOLDATTR(screen)) { + setGC(gcBold); + } else { + setGC(gcNorm); + } + } + EXCHANGE(fg_pix, bg_pix, tmp); +#if OPT_HIGHLIGHT_COLOR + if (screen->hilite_reverse) { + if (use_selbg && !use_selfg) + fg_pix = bg_pix; + if (use_selfg && !use_selbg) + bg_pix = fg_pix; + if (use_selbg) + bg_pix = selbg_pix; + if (use_selfg) + fg_pix = selfg_pix; + } +#endif + } else { /* normal video */ + if (getCgsGC(xw, currentWin, gcVTcursReverse)) { + setGC(gcVTcursReverse); + } else { + if (flags & BOLDATTR(screen)) { + setGC(gcBoldReverse); + } else { + setGC(gcNormReverse); + } + } + } + +#define CUR_XX T_COLOR(screen, TEXT_CURSOR) +#define CGS_FG getCgsFore(xw, currentWin, getCgsGC(xw, currentWin, currentCgs)) +#define CGS_BG getCgsBack(xw, currentWin, getCgsGC(xw, currentWin, currentCgs)) + +#define FIX_311 (CUR_XX == (reversed ? xw->dft_background : xw->dft_foreground)) +#define FIX_328 (CUR_XX == bg_pix) +#define FIX_330 (FIX_328 && reversed && in_selection) + + if (FIX_330 || FIX_311) { + setCgsBack(xw, currentWin, currentCgs, fg_pix); + } + setCgsFore(xw, currentWin, currentCgs, bg_pix); + } else { /* not selected */ + if (reversed) { /* text is reverse video */ + EXCHANGE(fg_pix, bg_pix, tmp); + setGC(gcNormReverse); + } else { /* normal video */ + setGC(gcNorm); + } +#if OPT_HIGHLIGHT_COLOR + if (screen->hilite_reverse) { + if (in_selection && !reversed) { + /* EMPTY */ + /* really INVERSE ... */ + ; + } else if (in_selection || reversed) { + if (use_selbg) { + if (use_selfg) { + bg_pix = fg_pix; + } else { + fg_pix = bg_pix; + bg_pix = selbg_pix; + } + } + if (use_selfg) { + fg_pix = selfg_pix; + } + } + } else { + if (in_selection) { + if (use_selbg) { + bg_pix = selbg_pix; + } + if (use_selfg) { + fg_pix = selfg_pix; + } + } + } +#endif + setCgsFore(xw, currentWin, currentCgs, fg_pix); + setCgsBack(xw, currentWin, currentCgs, bg_pix); + } + + if (screen->cursor_busy == 0 + && (screen->cursor_state != ON || screen->cursor_GC != set_at)) { + int x, y; + + screen->cursor_GC = set_at; + TRACE(("ShowCursor calling drawXtermText cur(%d,%d) %s-%s, set_at %d\n", + screen->cur_row, screen->cur_col, + (filled ? "filled" : "outline"), + (isCursorBlock(screen) ? "box" : + isCursorUnderline(screen) ? "underline" : "bar"), + set_at)); + + currentGC = getCgsGC(xw, currentWin, currentCgs); + x = LineCursorX(screen, ld, cursor_col); + y = CursorY(screen, screen->cur_row); + + if (!isCursorBlock(screen)) { + /* + * Overriding the combination of filled, reversed, in_selection is + * too complicated since the underline or bar and the text-cell use + * different rules. Just redraw the text-cell, and draw the + * underline or bar on top of it. + */ + HideCursor(); + + /* + * Our current-GC is likely to have been modified in HideCursor(). + * Set up a new request. + */ + if (filled) { + if (FIX_330 || FIX_311) { + setCgsBack(xw, currentWin, currentCgs, fg_pix); + } + setCgsFore(xw, currentWin, currentCgs, bg_pix); + } else { + setCgsFore(xw, currentWin, currentCgs, fg_pix); + setCgsBack(xw, currentWin, currentCgs, bg_pix); + } + } + + /* + * Update the outline-gc, to keep the cursor color distinct from the + * background color. + */ + set_cursor_outline_gc(xw, + filled, + fg_pix, + bg_pix, + T_COLOR(screen, TEXT_CURSOR)); + + outlineGC = getCgsGC(xw, currentWin, gcVTcursOutline); + if (outlineGC == 0) + outlineGC = currentGC; + + if (isCursorUnderline(screen)) { + + /* + * Finally, draw the underline. + */ + screen->box->x = (short) x; + screen->box->y = (short) (y + FontHeight(screen) - 2); + XDrawLines(screen->display, VDrawable(screen), outlineGC, + screen->box, NBOX, CoordModePrevious); + } else if (isCursorBar(screen)) { + + /* + * Or draw the bar. + */ + screen->box->x = (short) x; + screen->box->y = (short) y; + XDrawLines(screen->display, VDrawable(screen), outlineGC, + screen->box, NBOX, CoordModePrevious); + } else { +#if OPT_WIDE_ATTRS + int italics_on = ((ld->attribs[cursor_col] & ATR_ITALIC) != 0); + int italics_off = ((xw->flags & ATR_ITALIC) != 0); + int fix_italics = (italics_on != italics_off); + int which_font = ((xw->flags & BOLD) ? fBold : fNorm); + MyGetFont getter = italics_on ? getItalicFont : getNormalFont; + + if_OPT_WIDE_CHARS(screen, { + if (isWide((int) base)) { + which_font = ((xw->flags & BOLD) ? fWBold : fWide); + } + }); + + if (fix_italics && UseItalicFont(screen)) { + xtermLoadItalics(xw); + setCgsFont(xw, currentWin, currentCgs, + getter(screen, which_font)); + } + currentGC = getCgsGC(xw, currentWin, currentCgs); +#endif /* OPT_WIDE_ATTRS */ + + /* *INDENT-EQLS* */ + params.xw = xw; + params.attr_flags = (flags & DRAWX_MASK); + params.draw_flags = 0; + params.this_chrset = LineCharSet(screen, ld); + params.real_chrset = CSET_SWL; + params.on_wide = 0; + + drawXtermText(¶ms, + currentGC, x, y, + &base, 1); + +#if OPT_WIDE_CHARS + if_OPT_WIDE_CHARS(screen, { + size_t off; + + /* *INDENT-EQLS* */ + params.draw_flags = NOBACKGROUND; + params.on_wide = isWide((int) base); + + for_each_combData(off, ld) { + if (!(ld->combData[off][my_col])) + break; + drawXtermText(¶ms, + currentGC, x, y, + ld->combData[off] + my_col, 1); + } + }); +#endif + + if (!filled) { + screen->box->x = (short) x; + screen->box->y = (short) y; + XDrawLines(screen->display, VDrawable(screen), outlineGC, + screen->box, NBOX, CoordModePrevious); + } +#if OPT_WIDE_ATTRS + if (fix_italics && UseItalicFont(screen)) { + setCgsFont(xw, currentWin, currentCgs, + getter(screen, which_font)); + } +#endif + } + } + screen->cursor_state = ON; + + return; +} + +/* + * hide cursor at previous cursor position in screen. + */ +void +HideCursor(void) +{ + XtermWidget xw = term; + XTermDraw params; + TScreen *screen = TScreenOf(xw); + GC currentGC; + int x, y; + IChar base; + unsigned flags; + CellColor fg_bg = initCColor; + Bool in_selection; +#if OPT_WIDE_CHARS + int my_col = 0; +#endif + int cursor_col; + CLineData *ld = 0; +#if OPT_WIDE_ATTRS + int which_Cgs = gcMAX; + unsigned attr_flags; + int which_font = fNorm; + MyGetFont getter = getNormalFont; +#endif + + if (screen->cursor_state == OFF) + return; + if (INX2ROW(screen, screen->cursorp.row) > screen->max_row) + return; + + cursor_col = screen->cursorp.col; + +#ifndef NO_ACTIVE_ICON + if (IsIcon(screen)) { + screen->cursor_state = OFF; + return; + } +#endif /* NO_ACTIVE_ICON */ + + ld = getLineData(screen, screen->cursorp.row); + + base = ld->charData[cursor_col]; + flags = ld->attribs[cursor_col]; + + if_OPT_WIDE_CHARS(screen, { + if (base == HIDDEN_CHAR && cursor_col > 0) { + /* if cursor points to non-initial part of wide character, + * back it up + */ + --cursor_col; + base = ld->charData[cursor_col]; + } + my_col = cursor_col; + if (base == 0) + base = ' '; + if (isWide((int) base)) + my_col += 1; + }); + + if (base == 0) { + base = ' '; + } +#ifdef EXP_BOGUS_FG + /* + * If the cursor happens to be on blanks, and we have not set both + * foreground and background color, do not treat it as a colored cell. + */ +#if OPT_ISO_COLORS + if (base == ' ') { + if ((flags & (FG_COLOR | BG_COLOR)) == BG_COLOR) { + TRACE(("HideCursor - do not treat as a colored cell\n")); + flags &= ~(FG_COLOR | BG_COLOR); + } else if ((flags & (FG_COLOR | BG_COLOR)) == FG_COLOR) { + TRACE(("HideCursor - should we treat as a colored cell?\n")); + if (!(xw->flags & FG_COLOR)) + if (CheckBogusForeground(screen, "HideCursor")) + flags &= ~(FG_COLOR | BG_COLOR); + } + } +#endif +#endif + + /* + * Compare the current cell to the last set of colors used for the + * cursor and update the GC's if needed. + */ + if_OPT_ISO_COLORS(screen, { + fg_bg = ld->color[cursor_col]; + }); + + if (OutsideSelection(screen, screen->cursorp.row, screen->cursorp.col)) + in_selection = False; + else + in_selection = True; + +#if OPT_WIDE_ATTRS + attr_flags = ld->attribs[cursor_col]; + if ((attr_flags & ATR_ITALIC) ^ (xw->flags & ATR_ITALIC)) { + which_font = ((attr_flags & BOLD) ? fBold : fNorm); + if ((attr_flags & ATR_ITALIC) && UseItalicFont(screen)) + getter = getItalicFont; + + if_OPT_WIDE_CHARS(screen, { + if (isWide((int) base)) { + which_font = ((attr_flags & BOLD) ? fWBold : fWide); + } + }); + + which_Cgs = reverseCgs(xw, attr_flags, in_selection, which_font); + if (which_Cgs != gcMAX) { + setCgsFont(xw, WhichVWin(screen), + (CgsEnum) which_Cgs, + getter(screen, which_font)); + } + } +#endif + + currentGC = updatedXtermGC(xw, flags, fg_bg, in_selection); + + TRACE(("HideCursor calling drawXtermText cur(%d,%d)\n", + screen->cursorp.row, screen->cursorp.col)); + + x = LineCursorX(screen, ld, cursor_col); + y = CursorY(screen, screen->cursorp.row); + + /* *INDENT-EQLS* */ + params.xw = xw; + params.attr_flags = (flags & DRAWX_MASK); + params.draw_flags = 0; + params.this_chrset = LineCharSet(screen, ld); + params.real_chrset = CSET_SWL; + params.on_wide = 0; + + drawXtermText(¶ms, + currentGC, x, y, + &base, 1); + +#if OPT_WIDE_CHARS + if_OPT_WIDE_CHARS(screen, { + size_t off; + + /* *INDENT-EQLS* */ + params.draw_flags = NOBACKGROUND; + params.on_wide = isWide((int) base); + + for_each_combData(off, ld) { + if (!(ld->combData[off][my_col])) + break; + drawXtermText(¶ms, + currentGC, x, y, + ld->combData[off] + my_col, 1); + } + }); +#endif + screen->cursor_state = OFF; + +#if OPT_WIDE_ATTRS + if (which_Cgs != gcMAX) { + setCgsFont(xw, WhichVWin(screen), + (CgsEnum) which_Cgs, + getter(screen, which_font)); + } +#endif + resetXtermGC(xw, flags, in_selection); + + refresh_displayed_graphics(xw, + screen->cursorp.col, + screen->cursorp.row, + 1, 1); + + return; +} + +#if OPT_BLINK_CURS || OPT_BLINK_TEXT +static void +StartBlinking(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->blink_timer == 0) { + unsigned long interval = (unsigned long) ((screen->cursor_state == ON) + ? screen->blink_on + : screen->blink_off); + if (interval == 0) /* wow! */ + interval = 1; /* let's humor him anyway */ + screen->blink_timer = XtAppAddTimeOut(app_con, + interval, + HandleBlinking, + xw); + } +} + +static void +StopBlinking(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->blink_timer) { + XtRemoveTimeOut(screen->blink_timer); + screen->blink_timer = 0; + reallyStopBlinking(xw); + } else { + screen->blink_timer = 0; + } +} + +#if OPT_BLINK_TEXT +Bool +LineHasBlinking(TScreen *screen, CLineData *ld) +{ + Bool result = False; + if (ld != 0) { + int col; + + for (col = 0; col < MaxCols(screen); ++col) { + if (ld->attribs[col] & BLINK) { + result = True; + break; + } + } + } + return result; +} +#endif + +/* + * Blink the cursor by alternately showing/hiding cursor. We leave the timer + * running all the time (even though that's a little inefficient) to make the + * logic simple. + */ +static void +HandleBlinking(XtPointer closure, XtIntervalId * id GCC_UNUSED) +{ + XtermWidget xw = (XtermWidget) closure; + TScreen *screen = TScreenOf(xw); + Bool resume = False; + + screen->blink_timer = 0; + screen->blink_state = !screen->blink_state; + +#if OPT_BLINK_CURS + if (DoStartBlinking(screen)) { + if (screen->cursor_state == ON) { + if (screen->select || screen->always_highlight) { + HideCursor(); + if (screen->cursor_state == OFF) + screen->cursor_state = BLINKED_OFF; + } + } else if (screen->cursor_state == BLINKED_OFF) { + screen->cursor_state = OFF; + ShowCursor(); + if (screen->cursor_state == OFF) + screen->cursor_state = BLINKED_OFF; + } + resume = True; + } +#endif + +#if OPT_BLINK_TEXT + /* + * Inspect the lines on the current screen to see if any have the BLINK flag + * associated with them. Prune off any that have had the corresponding + * cells reset. If any are left, repaint those lines with ScrnRefresh(). + */ + if (!(screen->blink_as_bold)) { + int row; + int first_row = screen->max_row; + int last_row = -1; + + for (row = screen->max_row; row >= 0; row--) { + LineData *ld = getLineData(screen, ROW2INX(screen, row)); + + if (ld != 0 && LineTstBlinked(ld)) { + if (LineHasBlinking(screen, ld)) { + resume = True; + if (row > last_row) + last_row = row; + if (row < first_row) + first_row = row; + } else { + LineClrBlinked(ld); + } + } + } + /* + * FIXME: this could be a little more efficient, e.g,. by limiting the + * columns which are updated. + */ + if (first_row <= last_row) { + ScrnRefresh(xw, + first_row, + 0, + last_row + 1 - first_row, + MaxCols(screen), + True); + } + } +#endif + + /* + * If either the cursor or text is blinking, restart the timer. + */ + if (resume) + StartBlinking(xw); +} +#endif /* OPT_BLINK_CURS || OPT_BLINK_TEXT */ + +void +RestartBlinking(XtermWidget xw) +{ +#if OPT_BLINK_CURS || OPT_BLINK_TEXT + TScreen *screen = TScreenOf(xw); + + if (screen->blink_timer == 0) { + Bool resume = False; + +#if OPT_BLINK_CURS + if (DoStartBlinking(screen)) { + resume = True; + } +#endif +#if OPT_BLINK_TEXT + if (!resume) { + int row; + + for (row = screen->max_row; row >= 0; row--) { + CLineData *ld = getLineData(screen, ROW2INX(screen, row)); + + if (ld != 0 && LineTstBlinked(ld)) { + if (LineHasBlinking(screen, ld)) { + resume = True; + break; + } + } + } + } +#endif + if (resume) + StartBlinking(xw); + } +#else + (void) xw; +#endif +} + +/* + * Implement soft or hard (full) reset of the VTxxx emulation. There are a + * couple of differences from real DEC VTxxx terminals (to avoid breaking + * applications which have come to rely on xterm doing this): + * + * + autowrap mode should be reset (instead it's reset to the resource + * default). + * + the popup menu offers a choice of resetting the savedLines, or not. + * (but the control sequence does this anyway). + */ +static void +ReallyReset(XtermWidget xw, Bool full, Bool saved) +{ + TScreen *screen = TScreenOf(xw); + IFlags saveflags = xw->flags; + + TRACE(("ReallyReset %s, %s\n", + full ? "hard" : "soft", + saved ? "clear savedLines" : "keep savedLines")); + + if (!XtIsRealized((Widget) xw) || (CURRENT_EMU() != (Widget) xw)) { + Bell(xw, XkbBI_MinorError, 0); + return; + } + + if (saved) { + screen->savedlines = 0; + ScrollBarDrawThumb(xw, 0); + } + + /* make cursor visible */ + screen->cursor_set = ON; + InitCursorShape(screen, screen); +#if OPT_BLINK_CURS + screen->cursor_blink = screen->cursor_blink_i; + screen->cursor_blink_esc = 0; + TRACE(("cursor_shape:%d blinks:%d\n", + screen->cursor_shape, + screen->cursor_blink)); +#endif + + /* reset scrolling region */ + resetMargins(xw); + + bitclr(&xw->flags, ORIGIN); + + if_OPT_ISO_COLORS(screen, { + static char empty[1]; + reset_SGR_Colors(xw); + if (ResetAnsiColorRequest(xw, empty, 0)) + xtermRepaint(xw); + }); + + /* Reset character-sets to initial state */ + resetCharsets(screen); + +#if OPT_MOD_FKEYS + /* Reset modifier-resources to initial state */ + xw->keyboard.modify_now = xw->keyboard.modify_1st; +#endif +#if OPT_DEC_RECTOPS + screen->checksum_ext = screen->checksum_ext0; +#endif + + /* Reset DECSCA */ + bitclr(&xw->flags, PROTECTED); + screen->protected_mode = OFF_PROTECT; + + reset_displayed_graphics(screen); + + if (full) { /* RIS */ + if (screen->bellOnReset) + Bell(xw, XkbBI_TerminalBell, 0); + + /* reset the mouse mode */ + screen->send_mouse_pos = MOUSE_OFF; + screen->send_focus_pos = OFF; + screen->extend_coords = 0; + screen->waitingForTrackInfo = False; + screen->eventMode = NORMAL; + + xtermShowPointer(xw, True); + + TabReset(xw->tabs); + xw->keyboard.flags = MODE_SRM; + + guard_keyboard_type = False; + screen->old_fkeys = screen->old_fkeys0; + decode_keyboard_type(xw, &resource); + update_keyboard_type(); + +#if OPT_INITIAL_ERASE + if (xw->keyboard.reset_DECBKM == 1) + xw->keyboard.flags |= MODE_DECBKM; + else if (xw->keyboard.reset_DECBKM == 2) +#endif + if (TScreenOf(xw)->backarrow_key) + xw->keyboard.flags |= MODE_DECBKM; + TRACE(("full reset DECBKM %s\n", + BtoS(xw->keyboard.flags & MODE_DECBKM))); + +#if OPT_SCROLL_LOCK + xtermClearLEDs(screen); +#endif + screen->title_modes = screen->title_modes0; + screen->pointer_mode = screen->pointer_mode0; +#if OPT_SIXEL_GRAPHICS + if (TScreenOf(xw)->sixel_scrolling) + xw->keyboard.flags |= MODE_DECSDM; + TRACE(("full reset DECSDM to %s (resource default is %s)\n", + BtoS(xw->keyboard.flags & MODE_DECSDM), + BtoS(TScreenOf(xw)->sixel_scrolling))); +#endif + +#if OPT_GRAPHICS + screen->privatecolorregisters = TScreenOf(xw)->privatecolorregisters; + TRACE(("full reset PRIVATE_COLOR_REGISTERS to %s (resource default is %s)\n", + BtoS(screen->privatecolorregisters), + BtoS(TScreenOf(xw)->privatecolorregisters))); +#endif + +#if OPT_SIXEL_GRAPHICS + screen->sixel_scrolls_right = TScreenOf(xw)->sixel_scrolls_right; + TRACE(("full reset SIXEL_SCROLLS_RIGHT to %s (resource default is %s)\n", + BtoS(screen->sixel_scrolls_right), + BtoS(TScreenOf(xw)->sixel_scrolls_right))); +#endif + + update_appcursor(); + update_appkeypad(); + update_decbkm(); + update_decsdm(); + show_8bit_control(False); + reset_decudk(xw); + + FromAlternate(xw); + ClearScreen(xw); + screen->cursor_state = OFF; + + if (xw->flags & REVERSE_VIDEO) + ReverseVideo(xw); + ResetItalics(xw); + xw->flags = xw->initflags; + + update_reversevideo(); + update_autowrap(); + update_reversewrap(); + update_autolinefeed(); + + screen->jumpscroll = (Boolean) (!(xw->flags & SMOOTHSCROLL)); + update_jumpscroll(); + +#if OPT_DEC_RECTOPS + screen->cur_decsace = 0; +#endif +#if OPT_PASTE64 || OPT_READLINE + screen->paste_brackets = OFF; +#endif +#if OPT_READLINE + screen->click1_moves = OFF; + screen->paste_moves = OFF; + screen->dclick3_deletes = OFF; + screen->paste_quotes = OFF; + screen->paste_literal_nl = OFF; +#endif /* OPT_READLINE */ + + if (screen->c132 && (saveflags & IN132COLUMNS)) { + TRACE(("Making resize-request to restore 80-columns %dx%d\n", + MaxRows(screen), MaxCols(screen))); + RequestResize(xw, MaxRows(screen), 80, True); + repairSizeHints(); + XSync(screen->display, False); /* synchronize */ + if (xtermAppPending()) + xevents(xw); + } + + CursorSet(screen, 0, 0, xw->flags); + CursorSave(xw); + } else { /* DECSTR */ + /* + * There's a tiny difference, to accommodate usage of xterm. + * We reset autowrap to the resource values rather than turning + * it off. + */ + UIntClr(xw->keyboard.flags, (MODE_DECCKM | MODE_KAM | MODE_DECKPAM)); + bitcpy(&xw->flags, xw->initflags, WRAPAROUND | REVERSEWRAP); + bitclr(&xw->flags, INSERT | INVERSE | BOLD | BLINK | UNDERLINE | INVISIBLE); + ResetItalics(xw); + if_OPT_ISO_COLORS(screen, { + reset_SGR_Colors(xw); + }); + update_appcursor(); + update_autowrap(); + update_reversewrap(); + + CursorSave(xw); + screen->sc[screen->whichBuf].row = + screen->sc[screen->whichBuf].col = 0; + } +} + +void +VTReset(XtermWidget xw, Bool full, Bool saved) +{ + ReallyReset(xw, full, saved); + + free(myState.string_area); + myState.string_area = 0; + + free(myState.print_area); + myState.print_area = 0; + + longjmp(vtjmpbuf, 1); /* force ground state in parser */ +} + +typedef enum { + ccLO, + ccDASH, + ccHI, + ccCOLON, + ccID, + ccCOMMA +} CCLASS; + +/* + * set_character_class - takes a string of the form + * + * low[-high][:id][,low[-high][:id][...]] + * + * and sets the indicated ranges to the indicated values. + */ +static int +set_character_class(char *s) +{ +#define FMT "%s in range string \"%s\" (position %d)\n" + + TRACE(("set_character_class(%s) {{\n", NonNull(s))); + if (IsEmpty(s)) { + return -1; + } else { + CCLASS state = ccLO; + int arg[3]; + int i; + int len = (int) strlen(s); + + arg[0] = + arg[1] = + arg[2] = -1; + + for (i = 0; i < len; ++i) { + int ch = CharOf(s[i]); + char *t = 0; + long value = 0; + + if (isspace(ch)) + continue; + + switch (state) { + case ccLO: + case ccHI: + case ccID: + if (!isdigit(ch)) { + xtermWarning(FMT, "missing number", s, i); + return (-1); + } + value = strtol(s + i, &t, 0); + i = (int) (t - s - 1); + break; + case ccDASH: + case ccCOLON: + case ccCOMMA: + break; + } + + switch (state) { + case ccLO: + arg[0] = + arg[1] = (int) value; + arg[2] = -1; + state = ccDASH; + break; + + case ccDASH: + if (ch == '-') { + state = ccHI; + } else { + goto parse_class; + } + break; + + case ccHI: + arg[1] = (int) value; + state = ccCOLON; + break; + + parse_class: + case ccCOLON: + if (ch == ':') { + state = ccID; + } else if (ch == ',') { + goto apply_class; + } else { + xtermWarning(FMT, "unexpected character", s, i); + return (-1); + } + break; + + case ccID: + arg[2] = (int) value; + state = ccCOMMA; + break; + + apply_class: + case ccCOMMA: + if (SetCharacterClassRange(arg[0], arg[1], arg[2]) != 0) { + xtermWarning(FMT, "bad range", s, i); + return -1; + } + state = ccLO; + break; + } + } + if (state >= ccDASH) { + if (SetCharacterClassRange(arg[0], arg[1], arg[2]) != 0) { + xtermWarning(FMT, "bad range", s, i); + return -1; + } + } + } + + TRACE(("}} set_character_class\n")); + return (0); +#undef FMT +} + +void +getKeymapResources(Widget w, + const char *mapName, + const char *mapClass, + const char *type, + void *result, + size_t size) +{ + XtResource key_resources[1]; + key_resources[0].resource_name = XtNtranslations; + key_resources[0].resource_class = XtCTranslations; + key_resources[0].resource_type = (char *) type; + key_resources[0].resource_size = (Cardinal) size; + key_resources[0].resource_offset = 0; + key_resources[0].default_type = key_resources[0].resource_type; + key_resources[0].default_addr = 0; + XtGetSubresources(w, (XtPointer) result, mapName, mapClass, + key_resources, (Cardinal) 1, NULL, (Cardinal) 0); +} + +/* ARGSUSED */ +static void +HandleKeymapChange(Widget w, + XEvent *event GCC_UNUSED, + String *params, + Cardinal *param_count) +{ + static XtTranslations keymap, original; + + TRACE(("HandleKeymapChange(%#lx, %s)\n", + (unsigned long) w, + (*param_count + ? params[0] + : "missing"))); + + if (*param_count != 1) + return; + + if (original == NULL) { + TRACE(("...saving original keymap-translations\n")); + original = w->core.tm.translations; + } + + if (strcmp(params[0], "None") == 0) { + TRACE(("...restoring original keymap-translations\n")); + XtOverrideTranslations(w, original); + } else { + char mapName[1000]; + char mapClass[1000]; + char *pmapName; + char *pmapClass; + size_t len; + + len = strlen(params[0]) + 7; + + pmapName = (char *) MyStackAlloc(len, mapName); + pmapClass = (char *) MyStackAlloc(len, mapClass); + if (pmapName == NULL + || pmapClass == NULL) { + SysError(ERROR_KMMALLOC1); + } else { + + (void) sprintf(pmapName, "%sKeymap", params[0]); + (void) strcpy(pmapClass, pmapName); + if (islower(CharOf(pmapClass[0]))) + pmapClass[0] = x_toupper(pmapClass[0]); + getKeymapResources(w, pmapName, pmapClass, XtRTranslationTable, + &keymap, sizeof(keymap)); + if (keymap != NULL) { + TRACE(("...applying keymap \"%s\"\n", pmapName)); + XtOverrideTranslations(w, keymap); + } else { + TRACE(("...found no match for keymap \"%s\"\n", pmapName)); + } + + MyStackFree(pmapName, mapName); + MyStackFree(pmapClass, mapClass); + } + } +} + +/* ARGSUSED */ +static void +HandleBell(Widget w GCC_UNUSED, + XEvent *event GCC_UNUSED, + String *params, /* [0] = volume */ + Cardinal *param_count) /* 0 or 1 */ +{ + int percent = (*param_count) ? atoi(params[0]) : 0; + + Bell(term, XkbBI_TerminalBell, percent); +} + +/* ARGSUSED */ +static void +HandleVisualBell(Widget w GCC_UNUSED, + XEvent *event GCC_UNUSED, + String *params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + VisualBell(); +} + +/* ARGSUSED */ +static void +HandleIgnore(Widget w, + XEvent *event, + String *params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + XtermWidget xw; + + TRACE(("Handle ignore for %p %s\n", + (void *) w, visibleEventType(event->type))); + if ((xw = getXtermWidget(w)) != 0) { + /* do nothing, but check for funny escape sequences */ + switch (event->type) { + case ButtonPress: + case ButtonRelease: + default: + (void) SendMousePosition(xw, event); + break; + } + } +} + +/* ARGSUSED */ +static void +DoSetSelectedFont(Widget w, + XtPointer client_data GCC_UNUSED, + Atom *selection GCC_UNUSED, + Atom *type, + XtPointer value, + unsigned long *length, + int *format) +{ + XtermWidget xw = getXtermWidget(w); + + if (xw == 0) { + xtermWarning("unexpected widget in DoSetSelectedFont\n"); + } else if (*type != XA_STRING || *format != 8) { + Bell(xw, XkbBI_MinorError, 0); + } else { + Boolean failed = False; + int oldFont = TScreenOf(xw)->menu_font_number; + char *save = TScreenOf(xw)->SelectFontName(); + char *val; + char *test; + unsigned len = (unsigned) *length; + unsigned tst; + + /* + * Some versions of X deliver null-terminated selections, some do not. + */ + for (tst = 0; tst < len; ++tst) { + if (((char *) value)[tst] == '\0') { + len = tst; + break; + } + } + + if (len > 0 && (val = TypeMallocN(char, len + 1)) != 0) { + char *used; + + memcpy(val, value, (size_t) len); + val[len] = '\0'; + used = x_strtrim(val); + TRACE(("DoSetSelectedFont(%s)\n", used)); + /* Do some sanity checking to avoid sending a long selection + back to the server in an OpenFont that is unlikely to succeed. + XLFD allows up to 255 characters and no control characters; + we are a little more liberal here. */ + if (len < 1000 + && used != 0 + && !strchr(used, '\n') + && (test = x_strdup(used)) != 0) { + TScreenOf(xw)->SelectFontName() = test; + if (!xtermLoadFont(xw, + xtermFontName(used), + True, + fontMenu_fontsel)) { + failed = True; + free(test); + TScreenOf(xw)->SelectFontName() = save; + } + } else { + failed = True; + } + if (failed) { + (void) xtermLoadFont(xw, + xtermFontName(TScreenOf(xw)->MenuFontName(oldFont)), + True, + oldFont); + Bell(xw, XkbBI_MinorError, 0); + } + free(used); + free(val); + } + } +} + +void +FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe) +{ + TScreen *screen = TScreenOf(xw); + static AtomPtr *atoms; + static unsigned int atomCount = 0; + AtomPtr *pAtom; + unsigned a; + Atom target; + + if (!atom_name) + atom_name = ((screen->mappedSelect && atomCount) + ? screen->mappedSelect[0] + : "PRIMARY"); + TRACE(("FindFontSelection(%s)\n", atom_name)); + + for (pAtom = atoms, a = atomCount; a; a--, pAtom++) { + if (strcmp(atom_name, XmuNameOfAtom(*pAtom)) == 0) { + TRACE(("...found atom %d:%s\n", a + 1, atom_name)); + break; + } + } + if (!a) { + atoms = TypeXtReallocN(AtomPtr, atoms, atomCount + 1); + *(pAtom = &atoms[atomCount]) = XmuMakeAtom(atom_name); + ++atomCount; + TRACE(("...added atom %d:%s\n", atomCount, atom_name)); + } + + target = XmuInternAtom(XtDisplay(xw), *pAtom); + if (justprobe) { + screen->SelectFontName() = + XGetSelectionOwner(XtDisplay(xw), target) ? _Font_Selected_ : 0; + TRACE(("...selected fontname '%s'\n", + NonNull(screen->SelectFontName()))); + } else { + XtGetSelectionValue((Widget) xw, target, XA_STRING, + DoSetSelectedFont, NULL, + XtLastTimestampProcessed(XtDisplay(xw))); + } + return; +} + +Bool +set_cursor_gcs(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + + Pixel cc = T_COLOR(screen, TEXT_CURSOR); + Pixel fg = T_COLOR(screen, TEXT_FG); + Pixel bg = T_COLOR(screen, TEXT_BG); + Bool changed = False; + + /* + * Let's see, there are three things that have "color": + * + * background + * text + * cursorblock + * + * And, there are four situations when drawing a cursor, if we decide + * that we like have a solid block of cursor color with the letter + * that it is highlighting shown in the background color to make it + * stand out: + * + * selected window, normal video - background on cursor + * selected window, reverse video - foreground on cursor + * unselected window, normal video - foreground on background + * unselected window, reverse video - background on foreground + * + * Since the last two are really just normalGC and reverseGC, we only + * need two new GC's. Under monochrome, we get the same effect as + * above by setting cursor color to foreground. + */ + + TRACE(("set_cursor_gcs cc=%#lx, fg=%#lx, bg=%#lx\n", cc, fg, bg)); + if (win != 0 && (cc != bg)) { + Pixel xx = ((fg == cc) ? bg : cc); + + /* set the fonts to the current one */ + setCgsFont(xw, win, gcVTcursNormal, 0); + setCgsFont(xw, win, gcVTcursFilled, 0); + setCgsFont(xw, win, gcVTcursReverse, 0); + setCgsFont(xw, win, gcVTcursOutline, 0); + + /* we have a colored cursor */ + setCgsFore(xw, win, gcVTcursNormal, fg); + setCgsBack(xw, win, gcVTcursNormal, xx); + + setCgsFore(xw, win, gcVTcursFilled, xx); + setCgsBack(xw, win, gcVTcursFilled, fg); + + if (screen->always_highlight) { + /* both GC's use the same color */ + setCgsFore(xw, win, gcVTcursReverse, bg); + setCgsBack(xw, win, gcVTcursReverse, cc); + } else { + setCgsFore(xw, win, gcVTcursReverse, bg); + setCgsBack(xw, win, gcVTcursReverse, cc); + } + set_cursor_outline_gc(xw, screen->always_highlight, fg, bg, cc); + changed = True; + } + + if (changed) { + TRACE(("...set_cursor_gcs - done\n")); + } + return changed; +} + +/* + * Build up the default translations string, allowing the user to suppress + * some of the features. + */ +void +VTInitTranslations(void) +{ + /* *INDENT-OFF* */ + static struct { + Boolean wanted; + const char *name; + const char *value; + } table[] = { +#define DATA(name,value) { False, name, value } + DATA("select", +"\ + Shift Select:select-cursor-start() select-cursor-end(SELECT, CUT_BUFFER0) \n\ + Shift Insert:insert-selection(SELECT, CUT_BUFFER0) \n\ +" + ), +#if OPT_MAXIMIZE + DATA("fullscreen", +"\ + Alt Return:fullscreen() \n\ +" + ), +#endif +#if OPT_SCROLL_LOCK + DATA("scroll-lock", +"\ + Scroll_Lock:scroll-lock() \n\ +" + ), +#endif +#if OPT_SHIFT_FONTS + DATA("shift-fonts", +"\ + Shift~Ctrl KP_Add:larger-vt-font() \n\ + Shift Ctrl KP_Add:smaller-vt-font() \n\ + Shift KP_Subtract:smaller-vt-font() \n\ +" + ), +#endif + DATA("paging", +"\ + Shift Prior:scroll-back(1,halfpage) \n\ + Shift Next:scroll-forw(1,halfpage) \n\ +" + ), + /* This must be the last set mentioning "KeyPress" */ + DATA("keypress", +"\ + ~Meta :insert-seven-bit() \n\ + Meta :insert-eight-bit() \n\ +" + ), + DATA("popup-menu", +"\ + !Ctrl :popup-menu(mainMenu) \n\ + !Lock Ctrl :popup-menu(mainMenu) \n\ + !Lock Ctrl @Num_Lock :popup-menu(mainMenu) \n\ + ! @Num_Lock Ctrl :popup-menu(mainMenu) \n\ + !Ctrl :popup-menu(vtMenu) \n\ + !Lock Ctrl :popup-menu(vtMenu) \n\ + !Lock Ctrl @Num_Lock :popup-menu(vtMenu) \n\ + ! @Num_Lock Ctrl :popup-menu(vtMenu) \n\ + !Ctrl :popup-menu(fontMenu) \n\ + !Lock Ctrl :popup-menu(fontMenu) \n\ + !Lock Ctrl @Num_Lock :popup-menu(fontMenu) \n\ + ! @Num_Lock Ctrl :popup-menu(fontMenu) \n\ +" + ), + /* PROCURA added "Meta :clear-saved-lines()" */ + DATA("reset", +"\ + Meta :clear-saved-lines() \n\ +" + ), + DATA("select", +"\ + ~Meta :select-start() \n\ + ~Meta :select-extend() \n\ + ~Ctrl ~Meta :ignore() \n\ + ~Ctrl ~Meta :insert-selection(SELECT, CUT_BUFFER0) \n\ + ~Ctrl ~Meta :start-extend() \n\ + ~Meta :select-extend() \n\ + :select-end(SELECT, CUT_BUFFER0) \n\ +" + ), + DATA("wheel-mouse", +"\ + Ctrl :scroll-back(1,halfpage,m) \n\ + Lock Ctrl :scroll-back(1,halfpage,m) \n\ + Lock @Num_Lock Ctrl :scroll-back(1,halfpage,m) \n\ + @Num_Lock Ctrl :scroll-back(1,halfpage,m) \n\ + :scroll-back(5,line,m) \n\ + Ctrl :scroll-forw(1,halfpage,m) \n\ + Lock Ctrl :scroll-forw(1,halfpage,m) \n\ + Lock @Num_Lock Ctrl :scroll-forw(1,halfpage,m) \n\ + @Num_Lock Ctrl :scroll-forw(1,halfpage,m) \n\ + :scroll-forw(5,line,m) \n\ +" + ), + DATA("default", +"\ + :ignore() \n\ +" + ) + }; +#undef DATA + /* *INDENT-ON* */ + + char *result = 0; + + int pass; + Cardinal item; + + TRACE(("VTInitTranslations\n")); + for (item = 0; item < XtNumber(table); ++item) { + table[item].wanted = True; + } +#if OPT_MAXIMIZE + /* + * As a special case, allow for disabling the alt-enter translation if + * the resource settings prevent fullscreen from being used. We would + * do the same for scroll-lock and shift-fonts if they were application + * resources too, rather than in the widget. + */ + if (resource.fullscreen == esNever) { + for (item = 0; item < XtNumber(table); ++item) { + if (!strcmp(table[item].name, "fullscreen")) { + table[item].wanted = False; + TRACE(("omit(%s):\n%s\n", table[item].name, table[item].value)); + } + } + } +#endif + if (!IsEmpty(resource.omitTranslation)) { + char *value; + const char *source = resource.omitTranslation; + + while (*source != '\0' && (value = ParseList(&source)) != 0) { + size_t len = strlen(value); + + TRACE(("parsed:%s\n", value)); + for (item = 0; item < XtNumber(table); ++item) { + if (strlen(table[item].name) >= len + && x_strncasecmp(table[item].name, + value, + (unsigned) len) == 0) { + table[item].wanted = False; + TRACE(("omit(%s):\n%s\n", table[item].name, table[item].value)); + /* continue: "select", for instance is two chunks */ + } + } + free(value); + } + } + + for (pass = 0; pass < 2; ++pass) { + size_t needed = 0; + for (item = 0; item < XtNumber(table); ++item) { + if (table[item].wanted) { + if (pass) { + strcat(result, table[item].value); + } else { + needed += strlen(table[item].value) + 1; + } + } + } + if (!pass) { + result = XtMalloc((Cardinal) needed); + *result = '\0'; + } + } + + TRACE(("result:\n%s\n", result)); + + defaultTranslations = result; + free((void *) xtermClassRec.core_class.tm_table); + xtermClassRec.core_class.tm_table = result; +} + +#ifdef NO_LEAKS +void +noleaks_charproc(void) +{ + if (v_buffer != 0) + free(v_buffer); +} +#endif diff --git a/ports/xterm/xterm-359/charproc.o b/ports/xterm/xterm-359/charproc.o new file mode 100644 index 0000000..480a7fa Binary files /dev/null and b/ports/xterm/xterm-359/charproc.o differ diff --git a/ports/xterm/xterm-359/charsets.c b/ports/xterm/xterm-359/charsets.c new file mode 100644 index 0000000..803162f --- /dev/null +++ b/ports/xterm/xterm-359/charsets.c @@ -0,0 +1,1681 @@ +/* $XTermId: charsets.c,v 1.107 2020/01/18 18:51:57 tom Exp $ */ + +/* + * Copyright 1998-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + */ + +#include +#include +#include + +#include + +#define BLANK ' ' +#define UNDEF 0x2e2e /* rendered as a backwards "?" (alt: 0x2426) */ + +/* + * This module performs translation as needed to support the DEC VT220 national + * replacement character sets as well as supplementary character sets (aka + * code-pages) introduced in VT320, etc. + * + * We assume that xterm's font is based on the ISO 8859-1 (Latin 1) character + * set, which is almost the same as the DEC multinational character set. Glyph + * positions 0-31 have to be the DEC graphic characters, though. + * + * References: + * "VT220 Programmer Pocket Guide" EK-VT220-HR-002 (2nd ed., 1984), which + * contains character charts for the national character sets. + * "VT330/VT340 Programmer Reference Manual Volume 1: Text Programming" + * EK-VT3XX-TP-001 (1st ed, 1987), which contains a table (2-1) + * listing the glyphs which are mapped from the multinational + * character set to the national character set. + * + * The latter reference, though easier to read, has a few errors and omissions. + * + * According to + * Digital ANSI-Compliant Printing Protocol + * Level 2 Programming Reference Manual + * EK–PPLV2–PM. B01 + * + * the supplementary character sets Greek, Hebrew, Latin-5 and Latin/Cyrillic + * are standardized by ISO: + * ISO Greek is 8859-7 + * ISO Hebrew is 8859-8 + * ISO Latin-5 is 8859-9 + * ISO Latin/Cyrillic is 8859-5 + * + * These are derived from the data at + * ftp://www.unicode.org/Public/MAPPINGS/ISO8859/ + * + * Note: the "figure A-xx" comments refer to EK–PPLV2–PM. + */ + +/* + * A "codepage" is treated different from the NRC mode: it is always enabled. + * Reuse the UNI() macros by temporarily setting its state. + */ +#if OPT_WIDE_CHARS +#define begin_CODEPAGE() \ + if (!(xw->flags & NATIONAL)) { \ + screen->utf8_nrc_mode++; \ + } +#define end_CODEPAGE() \ + if (!(xw->flags & NATIONAL)) { \ + screen->utf8_nrc_mode--; \ + } +#else +#define begin_CODEPAGE() /* nothing */ +#define end_CODEPAGE() /* nothing */ +#endif + +/* + * xterm's original implementation of NRCS in 1998 was before Unicode became + * prevalent. Most of the necessary mappings could be done using definitions + * from X11/keysymdef.h + */ +#define map_NRCS_Dutch(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_threequarters); \ + UNI(0x5b, 0x0133); /* ij ligature */ \ + MAP(0x5c, XK_onehalf); \ + MAP(0x5d, XK_bar); \ + MAP(0x7b, XK_diaeresis); \ + UNI(0x7c, 0x0192); /* florin */ \ + MAP(0x7d, XK_onequarter); \ + MAP(0x7e, XK_acute); \ + } + +#define map_NRCS_Finnish(code) \ + switch (code) { \ + MAP(0x5b, XK_Adiaeresis); \ + MAP(0x5c, XK_Odiaeresis); \ + MAP(0x5d, XK_Aring); \ + MAP(0x5e, XK_Udiaeresis); \ + MAP(0x60, XK_eacute); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_aring); \ + MAP(0x7e, XK_udiaeresis); \ + } + +#define map_NRCS_French(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_agrave); \ + MAP(0x5b, XK_degree); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_section); \ + MAP(0x7b, XK_eacute); \ + MAP(0x7c, XK_ugrave); \ + MAP(0x7d, XK_egrave); \ + MAP(0x7e, XK_diaeresis); \ + } + +#define map_NRCS_French_Canadian(code) \ + switch (code) { \ + MAP(0x40, XK_agrave); \ + MAP(0x5b, XK_acircumflex); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_ecircumflex); \ + MAP(0x5e, XK_icircumflex); \ + MAP(0x60, XK_ocircumflex); \ + MAP(0x7b, XK_eacute); \ + MAP(0x7c, XK_ugrave); \ + MAP(0x7d, XK_egrave); \ + MAP(0x7e, XK_ucircumflex); \ + } + +#define map_NRCS_German(code) \ + switch (code) { \ + MAP(0x40, XK_section); \ + MAP(0x5b, XK_Adiaeresis); \ + MAP(0x5c, XK_Odiaeresis); \ + MAP(0x5d, XK_Udiaeresis); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_udiaeresis); \ + MAP(0x7e, XK_ssharp); \ + } + +#define map_NRCS_Italian(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_section); \ + MAP(0x5b, XK_degree); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_eacute); \ + MAP(0x60, XK_ugrave); \ + MAP(0x7b, XK_agrave); \ + MAP(0x7c, XK_ograve); \ + MAP(0x7d, XK_egrave); \ + MAP(0x7e, XK_igrave); \ + } + +#define map_NRCS_Norwegian_Danish(code) \ + switch (code) { \ + MAP(0x40, XK_Adiaeresis); \ + MAP(0x5b, XK_AE); \ + MAP(0x5c, XK_Ooblique); \ + MAP(0x5d, XK_Aring); \ + MAP(0x5e, XK_Udiaeresis); \ + MAP(0x60, XK_adiaeresis); \ + MAP(0x7b, XK_ae); \ + MAP(0x7c, XK_oslash); \ + MAP(0x7d, XK_aring); \ + MAP(0x7e, XK_udiaeresis); \ + } + +#define map_NRCS_Portuguese(code) \ + switch (code) { \ + MAP(0x5b, XK_Atilde); \ + MAP(0x5c, XK_Ccedilla); \ + MAP(0x5d, XK_Otilde); \ + MAP(0x7b, XK_atilde); \ + MAP(0x7c, XK_ccedilla); \ + MAP(0x7d, XK_otilde); \ + } + +#define map_NRCS_Spanish(code) \ + switch (code) { \ + MAP(0x23, XK_sterling); \ + MAP(0x40, XK_section); \ + MAP(0x5b, XK_exclamdown); \ + MAP(0x5c, XK_Ntilde); \ + MAP(0x5d, XK_questiondown); \ + MAP(0x7b, XK_degree); \ + MAP(0x7c, XK_ntilde); \ + MAP(0x7d, XK_ccedilla); \ + } + +#define map_NRCS_Swedish(code) \ + switch (code) { \ + MAP(0x40, XK_Eacute); \ + MAP(0x5b, XK_Adiaeresis); \ + MAP(0x5c, XK_Odiaeresis); \ + MAP(0x5d, XK_Aring); \ + MAP(0x5e, XK_Udiaeresis); \ + MAP(0x60, XK_eacute); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_aring); \ + MAP(0x7e, XK_udiaeresis); \ + } + +#define map_NRCS_Swiss(code) \ + switch (code) { \ + MAP(0x23, XK_ugrave); \ + MAP(0x40, XK_agrave); \ + MAP(0x5b, XK_eacute); \ + MAP(0x5c, XK_ccedilla); \ + MAP(0x5d, XK_ecircumflex); \ + MAP(0x5e, XK_icircumflex); \ + MAP(0x5f, XK_egrave); \ + MAP(0x60, XK_ocircumflex); \ + MAP(0x7b, XK_adiaeresis); \ + MAP(0x7c, XK_odiaeresis); \ + MAP(0x7d, XK_udiaeresis); \ + MAP(0x7e, XK_ucircumflex); \ + } + +/* + * Unlike NRCS, which splices a few characters onto ASCII, the supplementary + * character sets are complete, normally mapped to GR. Most of these mappings + * rely upon glyphs not found in ISO-8859-1. We can display most of those + * using Unicode, thereby supporting specialized applications that use SCS + * with luit, subject to the limitation that select/paste will give meaningless + * results in terms of the application which uses these mappings. + * + * Since the codepages introduced with VT320, etc, use 8-bit encodings, there + * is no plausible argument to be made that these mappings "use" UTF-8, even + * though there is a hidden step in the terminal emulator which relies upon + * UTF-8. + */ +#define map_DEC_Supp_Graphic(code,dft) \ + begin_CODEPAGE(); \ + switch (code) { \ + XXX(0x24, UNDEF); \ + XXX(0x26, UNDEF); \ + MAP(0x28, 0xa4); \ + XXX(0x2c, UNDEF); \ + XXX(0x2d, UNDEF); \ + XXX(0x2e, UNDEF); \ + XXX(0x2f, UNDEF); \ + XXX(0x34, UNDEF); \ + XXX(0x38, UNDEF); \ + XXX(0x3e, UNDEF); \ + XXX(0x50, UNDEF); \ + UNI(0x57, 0x0152); \ + MAP(0x5d, 0x0178); \ + XXX(0x5e, UNDEF); \ + XXX(0x70, UNDEF); \ + UNI(0x77, 0x0153); \ + MAP(0x7d, 0xff); \ + XXX(0x7e, UNDEF); \ + XXX(0x7f, UNDEF); \ + default: dft; break; \ + } \ + end_CODEPAGE() + +#if OPT_WIDE_CHARS + /* derived from http://www.vt100.net/charsets/technical.html */ +#define map_DEC_Technical(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x21, 0x23b7); /* RADICAL SYMBOL BOTTOM Centred left to right, so that it joins up with 02/02 */ \ + UNI(0x22, 0x250c); /* BOX DRAWINGS LIGHT DOWN AND RIGHT */ \ + UNI(0x23, 0x2500); /* BOX DRAWINGS LIGHT HORIZONTAL */ \ + UNI(0x24, 0x2320); /* TOP HALF INTEGRAL with the proviso that the stem is vertical, to join with 02/06 */ \ + UNI(0x25, 0x2321); /* BOTTOM HALF INTEGRAL with the proviso above. */ \ + UNI(0x26, 0x2502); /* BOX DRAWINGS LIGHT VERTICAL */ \ + UNI(0x27, 0x23a1); /* LEFT SQUARE BRACKET UPPER CORNER Joins vertically to 02/06, 02/08. Doesn't join to its right. */ \ + UNI(0x28, 0x23a3); /* LEFT SQUARE BRACKET LOWER CORNER Joins vertically to 02/06, 02/07. Doesn't join to its right. */ \ + UNI(0x29, 0x23a4); /* RIGHT SQUARE BRACKET UPPER CORNER Joins vertically to 026, 02a. Doesn't join to its left. */ \ + UNI(0x2a, 0x23a6); /* RIGHT SQUARE BRACKET LOWER CORNER Joins vertically to 026, 029. Doesn't join to its left. */ \ + UNI(0x2b, 0x23a7); /* LEFT CURLY BRACKET UPPER HOOK Joins vertically to 026, 02c, 02/15. Doesn't join to its right. */ \ + UNI(0x2c, 0x23a9); /* LEFT CURLY BRACKET LOWER HOOK Joins vertically to 026, 02b, 02/15. Doesn't join to its right. */ \ + UNI(0x2d, 0x23ab); /* RIGHT CURLY BRACKET UPPER HOOK Joins vertically to 026, 02e, 03/00. Doesn't join to its left. */ \ + UNI(0x2e, 0x23ad); /* RIGHT CURLY BRACKET LOWER HOOK Joins vertically to 026, 02d, 03/00. Doesn't join to its left. */ \ + UNI(0x2f, 0x23a8); /* LEFT CURLY BRACKET MIDDLE PIECE Joins vertically to 026, 02b, 02c. */ \ + UNI(0x30, 0x23ac); /* RIGHT CURLY BRACKET MIDDLE PIECE Joins vertically to 02/06, 02d, 02e. */ \ + XXX(0x31, UNDEF); /* Top Left Sigma. Joins to right with 02/03, 03/05. Joins diagonally below right with 03/03, 03/07. */ \ + XXX(0x32, UNDEF); /* Bottom Left Sigma. Joins to right with 02/03, 03/06. Joins diagonally above right with 03/04, 03/07. */ \ + XXX(0x33, UNDEF); /* Top Diagonal Sigma. Line for joining 03/01 to 03/04 or 03/07. */ \ + XXX(0x34, UNDEF); /* Bottom Diagonal Sigma. Line for joining 03/02 to 03/03 or 03/07. */ \ + XXX(0x35, UNDEF); /* Top Right Sigma. Joins to left with 02/03, 03/01. */ \ + XXX(0x36, UNDEF); /* Bottom Right Sigma. Joins to left with 02/03, 03/02. */ \ + XXX(0x37, UNDEF); /* Middle Sigma. Joins diagonally with 03/01, 03/02, 03/03, 03/04. */ \ + XXX(0x38, UNDEF); /* undefined */ \ + XXX(0x39, UNDEF); /* undefined */ \ + XXX(0x3a, UNDEF); /* undefined */ \ + XXX(0x3b, UNDEF); /* undefined */ \ + UNI(0x3c, 0x2264); /* LESS-THAN OR EQUAL TO */ \ + UNI(0x3d, 0x2260); /* NOT EQUAL TO */ \ + UNI(0x3e, 0x2265); /* GREATER-THAN OR EQUAL TO */ \ + UNI(0x3f, 0x222B); /* INTEGRAL */ \ + UNI(0x40, 0x2234); /* THEREFORE */ \ + UNI(0x41, 0x221d); /* PROPORTIONAL TO */ \ + UNI(0x42, 0x221e); /* INFINITY */ \ + UNI(0x43, 0x00f7); /* DIVISION SIGN */ \ + UNI(0x44, 0x0394); /* GREEK CAPITAL DELTA */ \ + UNI(0x45, 0x2207); /* NABLA */ \ + UNI(0x46, 0x03a6); /* GREEK CAPITAL LETTER PHI */ \ + UNI(0x47, 0x0393); /* GREEK CAPITAL LETTER GAMMA */ \ + UNI(0x48, 0x223c); /* TILDE OPERATOR */ \ + UNI(0x49, 0x2243); /* ASYMPTOTICALLY EQUAL TO */ \ + UNI(0x4a, 0x0398); /* GREEK CAPITAL LETTER THETA */ \ + UNI(0x4b, 0x00d7); /* MULTIPLICATION SIGN */ \ + UNI(0x4c, 0x039b); /* GREEK CAPITAL LETTER LAMDA */ \ + UNI(0x4d, 0x21d4); /* LEFT RIGHT DOUBLE ARROW */ \ + UNI(0x4e, 0x21d2); /* RIGHTWARDS DOUBLE ARROW */ \ + UNI(0x4f, 0x2261); /* IDENTICAL TO */ \ + UNI(0x50, 0x03a0); /* GREEK CAPITAL LETTER PI */ \ + UNI(0x51, 0x03a8); /* GREEK CAPITAL LETTER PSI */ \ + UNI(0x52, UNDEF); /* undefined */ \ + UNI(0x53, 0x03a3); /* GREEK CAPITAL LETTER SIGMA */ \ + XXX(0x54, UNDEF); /* undefined */ \ + XXX(0x55, UNDEF); /* undefined */ \ + UNI(0x56, 0x221a); /* SQUARE ROOT */ \ + UNI(0x57, 0x03a9); /* GREEK CAPITAL LETTER OMEGA */ \ + UNI(0x58, 0x039e); /* GREEK CAPITAL LETTER XI */ \ + UNI(0x59, 0x03a5); /* GREEK CAPITAL LETTER UPSILON */ \ + UNI(0x5a, 0x2282); /* SUBSET OF */ \ + UNI(0x5b, 0x2283); /* SUPERSET OF */ \ + UNI(0x5c, 0x2229); /* INTERSECTION */ \ + UNI(0x5d, 0x222a); /* UNION */ \ + UNI(0x5e, 0x2227); /* LOGICAL AND */ \ + UNI(0x5f, 0x2228); /* LOGICAL OR */ \ + UNI(0x60, 0x00ac); /* NOT SIGN */ \ + UNI(0x61, 0x03b1); /* GREEK SMALL LETTER ALPHA */ \ + UNI(0x62, 0x03b2); /* GREEK SMALL LETTER BETA */ \ + UNI(0x63, 0x03c7); /* GREEK SMALL LETTER CHI */ \ + UNI(0x64, 0x03b4); /* GREEK SMALL LETTER DELTA */ \ + UNI(0x65, 0x03b5); /* GREEK SMALL LETTER EPSILON */ \ + UNI(0x66, 0x03c6); /* GREEK SMALL LETTER PHI */ \ + UNI(0x67, 0x03b3); /* GREEK SMALL LETTER GAMMA */ \ + UNI(0x68, 0x03b7); /* GREEK SMALL LETTER ETA */ \ + UNI(0x69, 0x03b9); /* GREEK SMALL LETTER IOTA */ \ + UNI(0x6a, 0x03b8); /* GREEK SMALL LETTER THETA */ \ + UNI(0x6b, 0x03ba); /* GREEK SMALL LETTER KAPPA */ \ + UNI(0x6c, 0x03bb); /* GREEK SMALL LETTER LAMDA */ \ + XXX(0x6d, UNDEF); /* undefined */ \ + UNI(0x6e, 0x03bd); /* GREEK SMALL LETTER NU */ \ + UNI(0x6f, 0x2202); /* PARTIAL DIFFERENTIAL */ \ + UNI(0x70, 0x03c0); /* GREEK SMALL LETTER PI */ \ + UNI(0x71, 0x03c8); /* GREEK SMALL LETTER PSI */ \ + UNI(0x72, 0x03c1); /* GREEK SMALL LETTER RHO */ \ + UNI(0x73, 0x03c3); /* GREEK SMALL LETTER SIGMA */ \ + UNI(0x74, 0x03c4); /* GREEK SMALL LETTER TAU */ \ + XXX(0x75, UNDEF); /* undefined */ \ + UNI(0x76, 0x0192); /* LATIN SMALL LETTER F WITH HOOK Probably chosen for its meaning of "function" */ \ + UNI(0x77, 0x03c9); /* GREEK SMALL LETTER OMEGA */ \ + UNI(0x78, 0x03bE); /* GREEK SMALL LETTER XI */ \ + UNI(0x79, 0x03c5); /* GREEK SMALL LETTER UPSILON */ \ + UNI(0x7a, 0x03b6); /* GREEK SMALL LETTER ZETA */ \ + UNI(0x7b, 0x2190); /* LEFTWARDS ARROW */ \ + UNI(0x7c, 0x2191); /* UPWARDS ARROW */ \ + UNI(0x7d, 0x2192); /* RIGHTWARDS ARROW */ \ + UNI(0x7e, 0x2193); /* DOWNWARDS ARROW */ \ + } \ + end_CODEPAGE() + /* ISO Latin/Cyrillic is 8859-5 */ +#define map_ISO_Latin_Cyrillic(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x20, 0x00a0); /* NO-BREAK SPACE */ \ + UNI(0x21, 0x0401); /* CYRILLIC CAPITAL LETTER IO */ \ + UNI(0x22, 0x0402); /* CYRILLIC CAPITAL LETTER DJE */ \ + UNI(0x23, 0x0403); /* CYRILLIC CAPITAL LETTER GJE */ \ + UNI(0x24, 0x0404); /* CYRILLIC CAPITAL LETTER UKRAINIAN IE */ \ + UNI(0x25, 0x0405); /* CYRILLIC CAPITAL LETTER DZE */ \ + UNI(0x26, 0x0406); /* CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */ \ + UNI(0x27, 0x0407); /* CYRILLIC CAPITAL LETTER YI */ \ + UNI(0x28, 0x0408); /* CYRILLIC CAPITAL LETTER JE */ \ + UNI(0x29, 0x0409); /* CYRILLIC CAPITAL LETTER LJE */ \ + UNI(0x2a, 0x040a); /* CYRILLIC CAPITAL LETTER NJE */ \ + UNI(0x2b, 0x040b); /* CYRILLIC CAPITAL LETTER TSHE */ \ + UNI(0x2c, 0x040c); /* CYRILLIC CAPITAL LETTER KJE */ \ + UNI(0x2d, 0x00ad); /* SOFT HYPHEN */ \ + UNI(0x2e, 0x040e); /* CYRILLIC CAPITAL LETTER SHORT U */ \ + UNI(0x2f, 0x040f); /* CYRILLIC CAPITAL LETTER DZHE */ \ + UNI(0x30, 0x0410); /* CYRILLIC CAPITAL LETTER A */ \ + UNI(0x31, 0x0411); /* CYRILLIC CAPITAL LETTER BE */ \ + UNI(0x32, 0x0412); /* CYRILLIC CAPITAL LETTER VE */ \ + UNI(0x33, 0x0413); /* CYRILLIC CAPITAL LETTER GHE */ \ + UNI(0x34, 0x0414); /* CYRILLIC CAPITAL LETTER DE */ \ + UNI(0x35, 0x0415); /* CYRILLIC CAPITAL LETTER IE */ \ + UNI(0x36, 0x0416); /* CYRILLIC CAPITAL LETTER ZHE */ \ + UNI(0x37, 0x0417); /* CYRILLIC CAPITAL LETTER ZE */ \ + UNI(0x38, 0x0418); /* CYRILLIC CAPITAL LETTER I */ \ + UNI(0x39, 0x0419); /* CYRILLIC CAPITAL LETTER SHORT I */ \ + UNI(0x3a, 0x041a); /* CYRILLIC CAPITAL LETTER KA */ \ + UNI(0x3b, 0x041b); /* CYRILLIC CAPITAL LETTER EL */ \ + UNI(0x3c, 0x041c); /* CYRILLIC CAPITAL LETTER EM */ \ + UNI(0x3d, 0x041d); /* CYRILLIC CAPITAL LETTER EN */ \ + UNI(0x3e, 0x041e); /* CYRILLIC CAPITAL LETTER O */ \ + UNI(0x3f, 0x041f); /* CYRILLIC CAPITAL LETTER PE */ \ + UNI(0x40, 0x0420); /* CYRILLIC CAPITAL LETTER ER */ \ + UNI(0x41, 0x0421); /* CYRILLIC CAPITAL LETTER ES */ \ + UNI(0x42, 0x0422); /* CYRILLIC CAPITAL LETTER TE */ \ + UNI(0x43, 0x0423); /* CYRILLIC CAPITAL LETTER U */ \ + UNI(0x44, 0x0424); /* CYRILLIC CAPITAL LETTER EF */ \ + UNI(0x45, 0x0425); /* CYRILLIC CAPITAL LETTER HA */ \ + UNI(0x46, 0x0426); /* CYRILLIC CAPITAL LETTER TSE */ \ + UNI(0x47, 0x0427); /* CYRILLIC CAPITAL LETTER CHE */ \ + UNI(0x48, 0x0428); /* CYRILLIC CAPITAL LETTER SHA */ \ + UNI(0x49, 0x0429); /* CYRILLIC CAPITAL LETTER SHCHA */ \ + UNI(0x4a, 0x042a); /* CYRILLIC CAPITAL LETTER HARD SIGN */ \ + UNI(0x4b, 0x042b); /* CYRILLIC CAPITAL LETTER YERU */ \ + UNI(0x4c, 0x042c); /* CYRILLIC CAPITAL LETTER SOFT SIGN */ \ + UNI(0x4d, 0x042d); /* CYRILLIC CAPITAL LETTER E */ \ + UNI(0x4e, 0x042e); /* CYRILLIC CAPITAL LETTER YU */ \ + UNI(0x4f, 0x042f); /* CYRILLIC CAPITAL LETTER YA */ \ + UNI(0x50, 0x0430); /* CYRILLIC SMALL LETTER A */ \ + UNI(0x51, 0x0431); /* CYRILLIC SMALL LETTER BE */ \ + UNI(0x52, 0x0432); /* CYRILLIC SMALL LETTER VE */ \ + UNI(0x53, 0x0433); /* CYRILLIC SMALL LETTER GHE */ \ + UNI(0x54, 0x0434); /* CYRILLIC SMALL LETTER DE */ \ + UNI(0x55, 0x0435); /* CYRILLIC SMALL LETTER IE */ \ + UNI(0x56, 0x0436); /* CYRILLIC SMALL LETTER ZHE */ \ + UNI(0x57, 0x0437); /* CYRILLIC SMALL LETTER ZE */ \ + UNI(0x58, 0x0438); /* CYRILLIC SMALL LETTER I */ \ + UNI(0x59, 0x0439); /* CYRILLIC SMALL LETTER SHORT I */ \ + UNI(0x5a, 0x043a); /* CYRILLIC SMALL LETTER KA */ \ + UNI(0x5b, 0x043b); /* CYRILLIC SMALL LETTER EL */ \ + UNI(0x5c, 0x043c); /* CYRILLIC SMALL LETTER EM */ \ + UNI(0x5d, 0x043d); /* CYRILLIC SMALL LETTER EN */ \ + UNI(0x5e, 0x043e); /* CYRILLIC SMALL LETTER O */ \ + UNI(0x5f, 0x043f); /* CYRILLIC SMALL LETTER PE */ \ + UNI(0x60, 0x0440); /* CYRILLIC SMALL LETTER ER */ \ + UNI(0x61, 0x0441); /* CYRILLIC SMALL LETTER ES */ \ + UNI(0x62, 0x0442); /* CYRILLIC SMALL LETTER TE */ \ + UNI(0x63, 0x0443); /* CYRILLIC SMALL LETTER U */ \ + UNI(0x64, 0x0444); /* CYRILLIC SMALL LETTER EF */ \ + UNI(0x65, 0x0445); /* CYRILLIC SMALL LETTER HA */ \ + UNI(0x66, 0x0446); /* CYRILLIC SMALL LETTER TSE */ \ + UNI(0x67, 0x0447); /* CYRILLIC SMALL LETTER CHE */ \ + UNI(0x68, 0x0448); /* CYRILLIC SMALL LETTER SHA */ \ + UNI(0x69, 0x0449); /* CYRILLIC SMALL LETTER SHCHA */ \ + UNI(0x6a, 0x044a); /* CYRILLIC SMALL LETTER HARD SIGN */ \ + UNI(0x6b, 0x044b); /* CYRILLIC SMALL LETTER YERU */ \ + UNI(0x6c, 0x044c); /* CYRILLIC SMALL LETTER SOFT SIGN */ \ + UNI(0x6d, 0x044d); /* CYRILLIC SMALL LETTER E */ \ + UNI(0x6e, 0x044e); /* CYRILLIC SMALL LETTER YU */ \ + UNI(0x6f, 0x044f); /* CYRILLIC SMALL LETTER YA */ \ + UNI(0x70, 0x2116); /* NUMERO SIGN */ \ + UNI(0x71, 0x0451); /* CYRILLIC SMALL LETTER IO */ \ + UNI(0x72, 0x0452); /* CYRILLIC SMALL LETTER DJE */ \ + UNI(0x73, 0x0453); /* CYRILLIC SMALL LETTER GJE */ \ + UNI(0x74, 0x0454); /* CYRILLIC SMALL LETTER UKRAINIAN IE */ \ + UNI(0x75, 0x0455); /* CYRILLIC SMALL LETTER DZE */ \ + UNI(0x76, 0x0456); /* CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ \ + UNI(0x77, 0x0457); /* CYRILLIC SMALL LETTER YI */ \ + UNI(0x78, 0x0458); /* CYRILLIC SMALL LETTER JE */ \ + UNI(0x79, 0x0459); /* CYRILLIC SMALL LETTER LJE */ \ + UNI(0x7a, 0x045a); /* CYRILLIC SMALL LETTER NJE */ \ + UNI(0x7b, 0x045b); /* CYRILLIC SMALL LETTER TSHE */ \ + UNI(0x7c, 0x045c); /* CYRILLIC SMALL LETTER KJE */ \ + UNI(0x7d, 0x00a7); /* SECTION SIGN */ \ + UNI(0x7e, 0x045e); /* CYRILLIC SMALL LETTER SHORT U */ \ + UNI(0x7f, 0x045f); /* CYRILLIC SMALL LETTER DZHE */ \ + } \ + end_CODEPAGE() + /* ISO Greek is 8859-7 */ +#define map_ISO_Greek_Supp(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x20, 0x00a0); /* NO-BREAK SPACE */ \ + UNI(0x21, 0x2018); /* LEFT SINGLE QUOTATION MARK */ \ + UNI(0x22, 0x2019); /* RIGHT SINGLE QUOTATION MARK */ \ + UNI(0x23, 0x00a3); /* POUND SIGN */ \ + UNI(0x24, 0x20ac); /* EURO SIGN */ \ + UNI(0x25, 0x20af); /* DRACHMA SIGN */ \ + UNI(0x26, 0x00a6); /* BROKEN BAR */ \ + UNI(0x27, 0x00a7); /* SECTION SIGN */ \ + UNI(0x28, 0x00a8); /* DIAERESIS */ \ + UNI(0x29, 0x00a9); /* COPYRIGHT SIGN */ \ + UNI(0x2a, 0x037a); /* GREEK YPOGEGRAMMENI */ \ + UNI(0x2b, 0x00ab); /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x2c, 0x00ac); /* NOT SIGN */ \ + UNI(0x2d, 0x00ad); /* SOFT HYPHEN */ \ + XXX(0x2e, UNDEF); /* undefined */ \ + UNI(0x2f, 0x2015); /* HORIZONTAL BAR */ \ + UNI(0x30, 0x00b0); /* DEGREE SIGN */ \ + UNI(0x31, 0x00b1); /* PLUS-MINUS SIGN */ \ + UNI(0x32, 0x00b2); /* SUPERSCRIPT TWO */ \ + UNI(0x33, 0x00b3); /* SUPERSCRIPT THREE */ \ + UNI(0x34, 0x0384); /* GREEK TONOS */ \ + UNI(0x35, 0x0385); /* GREEK DIALYTIKA TONOS */ \ + UNI(0x36, 0x0386); /* GREEK CAPITAL LETTER ALPHA WITH TONOS */ \ + UNI(0x37, 0x00b7); /* MIDDLE DOT */ \ + UNI(0x38, 0x0388); /* GREEK CAPITAL LETTER EPSILON WITH TONOS */ \ + UNI(0x39, 0x0389); /* GREEK CAPITAL LETTER ETA WITH TONOS */ \ + UNI(0x3a, 0x038a); /* GREEK CAPITAL LETTER IOTA WITH TONOS */ \ + UNI(0x3b, 0x00bb); /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x3c, 0x038c); /* GREEK CAPITAL LETTER OMICRON WITH TONOS */ \ + UNI(0x3d, 0x00bd); /* VULGAR FRACTION ONE HALF */ \ + UNI(0x3e, 0x038e); /* GREEK CAPITAL LETTER UPSILON WITH TONOS */ \ + UNI(0x3f, 0x038f); /* GREEK CAPITAL LETTER OMEGA WITH TONOS */ \ + UNI(0x40, 0x0390); /* GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */ \ + UNI(0x41, 0x0391); /* GREEK CAPITAL LETTER ALPHA */ \ + UNI(0x42, 0x0392); /* GREEK CAPITAL LETTER BETA */ \ + UNI(0x43, 0x0393); /* GREEK CAPITAL LETTER GAMMA */ \ + UNI(0x44, 0x0394); /* GREEK CAPITAL LETTER DELTA */ \ + UNI(0x45, 0x0395); /* GREEK CAPITAL LETTER EPSILON */ \ + UNI(0x46, 0x0396); /* GREEK CAPITAL LETTER ZETA */ \ + UNI(0x47, 0x0397); /* GREEK CAPITAL LETTER ETA */ \ + UNI(0x48, 0x0398); /* GREEK CAPITAL LETTER THETA */ \ + UNI(0x49, 0x0399); /* GREEK CAPITAL LETTER IOTA */ \ + UNI(0x4a, 0x039a); /* GREEK CAPITAL LETTER KAPPA */ \ + UNI(0x4b, 0x039b); /* GREEK CAPITAL LETTER LAMDA */ \ + UNI(0x4c, 0x039c); /* GREEK CAPITAL LETTER MU */ \ + UNI(0x4d, 0x039d); /* GREEK CAPITAL LETTER NU */ \ + UNI(0x4e, 0x039e); /* GREEK CAPITAL LETTER XI */ \ + UNI(0x4f, 0x039f); /* GREEK CAPITAL LETTER OMICRON */ \ + UNI(0x50, 0x03a0); /* GREEK CAPITAL LETTER PI */ \ + UNI(0x51, 0x03a1); /* GREEK CAPITAL LETTER RHO */ \ + XXX(0x52, UNDEF); /* undefined */ \ + UNI(0x53, 0x03a3); /* GREEK CAPITAL LETTER SIGMA */ \ + UNI(0x54, 0x03a4); /* GREEK CAPITAL LETTER TAU */ \ + UNI(0x55, 0x03a5); /* GREEK CAPITAL LETTER UPSILON */ \ + UNI(0x56, 0x03a6); /* GREEK CAPITAL LETTER PHI */ \ + UNI(0x57, 0x03a7); /* GREEK CAPITAL LETTER CHI */ \ + UNI(0x58, 0x03a8); /* GREEK CAPITAL LETTER PSI */ \ + UNI(0x59, 0x03a9); /* GREEK CAPITAL LETTER OMEGA */ \ + UNI(0x5a, 0x03aa); /* GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */ \ + UNI(0x5b, 0x03ab); /* GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */ \ + UNI(0x5c, 0x03ac); /* GREEK SMALL LETTER ALPHA WITH TONOS */ \ + UNI(0x5d, 0x03ad); /* GREEK SMALL LETTER EPSILON WITH TONOS */ \ + UNI(0x5e, 0x03ae); /* GREEK SMALL LETTER ETA WITH TONOS */ \ + UNI(0x5f, 0x03af); /* GREEK SMALL LETTER IOTA WITH TONOS */ \ + UNI(0x60, 0x03b0); /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */ \ + UNI(0x61, 0x03b1); /* GREEK SMALL LETTER ALPHA */ \ + UNI(0x62, 0x03b2); /* GREEK SMALL LETTER BETA */ \ + UNI(0x63, 0x03b3); /* GREEK SMALL LETTER GAMMA */ \ + UNI(0x64, 0x03b4); /* GREEK SMALL LETTER DELTA */ \ + UNI(0x65, 0x03b5); /* GREEK SMALL LETTER EPSILON */ \ + UNI(0x66, 0x03b6); /* GREEK SMALL LETTER ZETA */ \ + UNI(0x67, 0x03b7); /* GREEK SMALL LETTER ETA */ \ + UNI(0x68, 0x03b8); /* GREEK SMALL LETTER THETA */ \ + UNI(0x69, 0x03b9); /* GREEK SMALL LETTER IOTA */ \ + UNI(0x6a, 0x03ba); /* GREEK SMALL LETTER KAPPA */ \ + UNI(0x6b, 0x03bb); /* GREEK SMALL LETTER LAMDA */ \ + UNI(0x6c, 0x03bc); /* GREEK SMALL LETTER MU */ \ + UNI(0x6d, 0x03bd); /* GREEK SMALL LETTER NU */ \ + UNI(0x6e, 0x03be); /* GREEK SMALL LETTER XI */ \ + UNI(0x6f, 0x03bf); /* GREEK SMALL LETTER OMICRON */ \ + UNI(0x70, 0x03c0); /* GREEK SMALL LETTER PI */ \ + UNI(0x71, 0x03c1); /* GREEK SMALL LETTER RHO */ \ + UNI(0x72, 0x03c2); /* GREEK SMALL LETTER FINAL SIGMA */ \ + UNI(0x73, 0x03c3); /* GREEK SMALL LETTER SIGMA */ \ + UNI(0x74, 0x03c4); /* GREEK SMALL LETTER TAU */ \ + UNI(0x75, 0x03c5); /* GREEK SMALL LETTER UPSILON */ \ + UNI(0x76, 0x03c6); /* GREEK SMALL LETTER PHI */ \ + UNI(0x77, 0x03c7); /* GREEK SMALL LETTER CHI */ \ + UNI(0x78, 0x03c8); /* GREEK SMALL LETTER PSI */ \ + UNI(0x79, 0x03c9); /* GREEK SMALL LETTER OMEGA */ \ + UNI(0x7a, 0x03ca); /* GREEK SMALL LETTER IOTA WITH DIALYTIKA */ \ + UNI(0x7b, 0x03cb); /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ \ + UNI(0x7c, 0x03cc); /* GREEK SMALL LETTER OMICRON WITH TONOS */ \ + UNI(0x7d, 0x03cd); /* GREEK SMALL LETTER UPSILON WITH TONOS */ \ + UNI(0x7e, 0x03ce); /* GREEK SMALL LETTER OMEGA WITH TONOS */ \ + } \ + end_CODEPAGE() + /* figure A-23 "ISO Latin-Hebrew Supplemental Character Set" */ +#define map_ISO_Hebrew(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x20, 0x00a0); /* NO-BREAK SPACE */ \ + XXX(0x21, UNDEF); /* undefined */ \ + UNI(0x22, 0x00a2); /* CENT SIGN */ \ + UNI(0x23, 0x00a3); /* POUND SIGN */ \ + UNI(0x24, 0x00a4); /* CURRENCY SIGN */ \ + UNI(0x25, 0x00a5); /* YEN SIGN */ \ + UNI(0x26, 0x00a6); /* BROKEN BAR */ \ + UNI(0x27, 0x00a7); /* SECTION SIGN */ \ + UNI(0x28, 0x00a8); /* DIAERESIS */ \ + UNI(0x29, 0x00a9); /* COPYRIGHT SIGN */ \ + UNI(0x2a, 0x00d7); /* MULTIPLICATION SIGN */ \ + UNI(0x2b, 0x00ab); /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x2c, 0x00ac); /* NOT SIGN */ \ + UNI(0x2d, 0x00ad); /* SOFT HYPHEN */ \ + UNI(0x2e, 0x00ae); /* REGISTERED SIGN */ \ + UNI(0x2f, 0x00af); /* MACRON */ \ + UNI(0x30, 0x00b0); /* DEGREE SIGN */ \ + UNI(0x31, 0x00b1); /* PLUS-MINUS SIGN */ \ + UNI(0x32, 0x00b2); /* SUPERSCRIPT TWO */ \ + UNI(0x33, 0x00b3); /* SUPERSCRIPT THREE */ \ + UNI(0x34, 0x00b4); /* ACUTE ACCENT */ \ + UNI(0x35, 0x00b5); /* MICRO SIGN */ \ + UNI(0x36, 0x00b6); /* PILCROW SIGN */ \ + UNI(0x37, 0x00b7); /* MIDDLE DOT */ \ + UNI(0x38, 0x00b8); /* CEDILLA */ \ + UNI(0x39, 0x00b9); /* SUPERSCRIPT ONE */ \ + UNI(0x3a, 0x00f7); /* DIVISION SIGN */ \ + UNI(0x3b, 0x00bb); /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x3c, 0x00bc); /* VULGAR FRACTION ONE QUARTER */ \ + UNI(0x3d, 0x00bd); /* VULGAR FRACTION ONE HALF */ \ + UNI(0x3e, 0x00be); /* VULGAR FRACTION THREE QUARTERS */ \ + XXX(0x3f, UNDEF); /* undefined */ \ + XXX(0x40, UNDEF); /* undefined */ \ + XXX(0x41, UNDEF); /* undefined */ \ + XXX(0x42, UNDEF); /* undefined */ \ + XXX(0x43, UNDEF); /* undefined */ \ + XXX(0x44, UNDEF); /* undefined */ \ + XXX(0x45, UNDEF); /* undefined */ \ + XXX(0x46, UNDEF); /* undefined */ \ + XXX(0x47, UNDEF); /* undefined */ \ + XXX(0x48, UNDEF); /* undefined */ \ + XXX(0x49, UNDEF); /* undefined */ \ + XXX(0x4a, UNDEF); /* undefined */ \ + XXX(0x4b, UNDEF); /* undefined */ \ + XXX(0x4c, UNDEF); /* undefined */ \ + XXX(0x4d, UNDEF); /* undefined */ \ + XXX(0x4e, UNDEF); /* undefined */ \ + XXX(0x4f, UNDEF); /* undefined */ \ + XXX(0x50, UNDEF); /* undefined */ \ + XXX(0x51, UNDEF); /* undefined */ \ + XXX(0x52, UNDEF); /* undefined */ \ + XXX(0x53, UNDEF); /* undefined */ \ + XXX(0x54, UNDEF); /* undefined */ \ + XXX(0x55, UNDEF); /* undefined */ \ + XXX(0x56, UNDEF); /* undefined */ \ + XXX(0x57, UNDEF); /* undefined */ \ + XXX(0x58, UNDEF); /* undefined */ \ + XXX(0x59, UNDEF); /* undefined */ \ + XXX(0x5a, UNDEF); /* undefined */ \ + XXX(0x5b, UNDEF); /* undefined */ \ + XXX(0x5c, UNDEF); /* undefined */ \ + XXX(0x5d, UNDEF); /* undefined */ \ + XXX(0x5e, UNDEF); /* undefined */ \ + UNI(0x5f, 0x2017); /* DOUBLE LOW LINE */ \ + UNI(0x60, 0x05d0); /* HEBREW LETTER ALEF */ \ + UNI(0x61, 0x05d1); /* HEBREW LETTER BET */ \ + UNI(0x62, 0x05d2); /* HEBREW LETTER GIMEL */ \ + UNI(0x63, 0x05d3); /* HEBREW LETTER DALET */ \ + UNI(0x64, 0x05d4); /* HEBREW LETTER HE */ \ + UNI(0x65, 0x05d5); /* HEBREW LETTER VAV */ \ + UNI(0x66, 0x05d6); /* HEBREW LETTER ZAYIN */ \ + UNI(0x67, 0x05d7); /* HEBREW LETTER HET */ \ + UNI(0x68, 0x05d8); /* HEBREW LETTER TET */ \ + UNI(0x69, 0x05d9); /* HEBREW LETTER YOD */ \ + UNI(0x6a, 0x05da); /* HEBREW LETTER FINAL KAF */ \ + UNI(0x6b, 0x05db); /* HEBREW LETTER KAF */ \ + UNI(0x6c, 0x05dc); /* HEBREW LETTER LAMED */ \ + UNI(0x6d, 0x05dd); /* HEBREW LETTER FINAL MEM */ \ + UNI(0x6e, 0x05de); /* HEBREW LETTER MEM */ \ + UNI(0x6f, 0x05df); /* HEBREW LETTER FINAL NUN */ \ + UNI(0x70, 0x05e0); /* HEBREW LETTER NUN */ \ + UNI(0x71, 0x05e1); /* HEBREW LETTER SAMEKH */ \ + UNI(0x72, 0x05e2); /* HEBREW LETTER AYIN */ \ + UNI(0x73, 0x05e3); /* HEBREW LETTER FINAL PE */ \ + UNI(0x74, 0x05e4); /* HEBREW LETTER PE */ \ + UNI(0x75, 0x05e5); /* HEBREW LETTER FINAL TSADI */ \ + UNI(0x76, 0x05e6); /* HEBREW LETTER TSADI */ \ + UNI(0x77, 0x05e7); /* HEBREW LETTER QOF */ \ + UNI(0x78, 0x05e8); /* HEBREW LETTER RESH */ \ + UNI(0x79, 0x05e9); /* HEBREW LETTER SHIN */ \ + UNI(0x7a, 0x05ea); /* HEBREW LETTER TAV */ \ + XXX(0x7b, UNDEF); /* undefined */ \ + XXX(0x7c, UNDEF); /* undefined */ \ + UNI(0x7d, 0x200e); /* LEFT-TO-RIGHT MARK */ \ + UNI(0x7e, 0x200f); /* RIGHT-TO-LEFT MARK */ \ + } \ + end_CODEPAGE() + /* ISO Latin-5 is 8859-9 */ +#define map_ISO_Latin_5(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x20, 0x00a0); /* NO-BREAK SPACE */ \ + UNI(0x21, 0x00a1); /* INVERTED EXCLAMATION MARK */ \ + UNI(0x22, 0x00a2); /* CENT SIGN */ \ + UNI(0x23, 0x00a3); /* POUND SIGN */ \ + UNI(0x24, 0x00a4); /* CURRENCY SIGN */ \ + UNI(0x25, 0x00a5); /* YEN SIGN */ \ + UNI(0x26, 0x00a6); /* BROKEN BAR */ \ + UNI(0x27, 0x00a7); /* SECTION SIGN */ \ + UNI(0x28, 0x00a8); /* DIAERESIS */ \ + UNI(0x29, 0x00a9); /* COPYRIGHT SIGN */ \ + UNI(0x2a, 0x00aa); /* FEMININE ORDINAL INDICATOR */ \ + UNI(0x2b, 0x00ab); /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x2c, 0x00ac); /* NOT SIGN */ \ + UNI(0x2d, 0x00ad); /* SOFT HYPHEN */ \ + UNI(0x2e, 0x00ae); /* REGISTERED SIGN */ \ + UNI(0x2f, 0x00af); /* MACRON */ \ + UNI(0x30, 0x00b0); /* DEGREE SIGN */ \ + UNI(0x31, 0x00b1); /* PLUS-MINUS SIGN */ \ + UNI(0x32, 0x00b2); /* SUPERSCRIPT TWO */ \ + UNI(0x33, 0x00b3); /* SUPERSCRIPT THREE */ \ + UNI(0x34, 0x00b4); /* ACUTE ACCENT */ \ + UNI(0x35, 0x00b5); /* MICRO SIGN */ \ + UNI(0x36, 0x00b6); /* PILCROW SIGN */ \ + UNI(0x37, 0x00b7); /* MIDDLE DOT */ \ + UNI(0x38, 0x00b8); /* CEDILLA */ \ + UNI(0x39, 0x00b9); /* SUPERSCRIPT ONE */ \ + UNI(0x3a, 0x00ba); /* MASCULINE ORDINAL INDICATOR */ \ + UNI(0x3b, 0x00bb); /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x3c, 0x00bc); /* VULGAR FRACTION ONE QUARTER */ \ + UNI(0x3d, 0x00bd); /* VULGAR FRACTION ONE HALF */ \ + UNI(0x3e, 0x00be); /* VULGAR FRACTION THREE QUARTERS */ \ + UNI(0x3f, 0x00bf); /* INVERTED QUESTION MARK */ \ + UNI(0x40, 0x00c0); /* LATIN CAPITAL LETTER A WITH GRAVE */ \ + UNI(0x41, 0x00c1); /* LATIN CAPITAL LETTER A WITH ACUTE */ \ + UNI(0x42, 0x00c2); /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ \ + UNI(0x43, 0x00c3); /* LATIN CAPITAL LETTER A WITH TILDE */ \ + UNI(0x44, 0x00c4); /* LATIN CAPITAL LETTER A WITH DIAERESIS */ \ + UNI(0x45, 0x00c5); /* LATIN CAPITAL LETTER A WITH RING ABOVE */ \ + UNI(0x46, 0x00c6); /* LATIN CAPITAL LETTER AE */ \ + UNI(0x47, 0x00c7); /* LATIN CAPITAL LETTER C WITH CEDILLA */ \ + UNI(0x48, 0x00c8); /* LATIN CAPITAL LETTER E WITH GRAVE */ \ + UNI(0x49, 0x00c9); /* LATIN CAPITAL LETTER E WITH ACUTE */ \ + UNI(0x4a, 0x00ca); /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ \ + UNI(0x4b, 0x00cb); /* LATIN CAPITAL LETTER E WITH DIAERESIS */ \ + UNI(0x4c, 0x00cc); /* LATIN CAPITAL LETTER I WITH GRAVE */ \ + UNI(0x4d, 0x00cd); /* LATIN CAPITAL LETTER I WITH ACUTE */ \ + UNI(0x4e, 0x00ce); /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ \ + UNI(0x4f, 0x00cf); /* LATIN CAPITAL LETTER I WITH DIAERESIS */ \ + UNI(0x50, 0x011e); /* LATIN CAPITAL LETTER G WITH BREVE */ \ + UNI(0x51, 0x00d1); /* LATIN CAPITAL LETTER N WITH TILDE */ \ + UNI(0x52, 0x00d2); /* LATIN CAPITAL LETTER O WITH GRAVE */ \ + UNI(0x53, 0x00d3); /* LATIN CAPITAL LETTER O WITH ACUTE */ \ + UNI(0x54, 0x00d4); /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ \ + UNI(0x55, 0x00d5); /* LATIN CAPITAL LETTER O WITH TILDE */ \ + UNI(0x56, 0x00d6); /* LATIN CAPITAL LETTER O WITH DIAERESIS */ \ + UNI(0x57, 0x00d7); /* MULTIPLICATION SIGN */ \ + UNI(0x58, 0x00d8); /* LATIN CAPITAL LETTER O WITH STROKE */ \ + UNI(0x59, 0x00d9); /* LATIN CAPITAL LETTER U WITH GRAVE */ \ + UNI(0x5a, 0x00da); /* LATIN CAPITAL LETTER U WITH ACUTE */ \ + UNI(0x5b, 0x00db); /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ \ + UNI(0x5c, 0x00dc); /* LATIN CAPITAL LETTER U WITH DIAERESIS */ \ + UNI(0x5d, 0x0130); /* LATIN CAPITAL LETTER I WITH DOT ABOVE */ \ + UNI(0x5e, 0x015e); /* LATIN CAPITAL LETTER S WITH CEDILLA */ \ + UNI(0x5f, 0x00df); /* LATIN SMALL LETTER SHARP S */ \ + UNI(0x60, 0x00e0); /* LATIN SMALL LETTER A WITH GRAVE */ \ + UNI(0x61, 0x00e1); /* LATIN SMALL LETTER A WITH ACUTE */ \ + UNI(0x62, 0x00e2); /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ \ + UNI(0x63, 0x00e3); /* LATIN SMALL LETTER A WITH TILDE */ \ + UNI(0x64, 0x00e4); /* LATIN SMALL LETTER A WITH DIAERESIS */ \ + UNI(0x65, 0x00e5); /* LATIN SMALL LETTER A WITH RING ABOVE */ \ + UNI(0x66, 0x00e6); /* LATIN SMALL LETTER AE */ \ + UNI(0x67, 0x00e7); /* LATIN SMALL LETTER C WITH CEDILLA */ \ + UNI(0x68, 0x00e8); /* LATIN SMALL LETTER E WITH GRAVE */ \ + UNI(0x69, 0x00e9); /* LATIN SMALL LETTER E WITH ACUTE */ \ + UNI(0x6a, 0x00ea); /* LATIN SMALL LETTER E WITH CIRCUMFLEX */ \ + UNI(0x6b, 0x00eb); /* LATIN SMALL LETTER E WITH DIAERESIS */ \ + UNI(0x6c, 0x00ec); /* LATIN SMALL LETTER I WITH GRAVE */ \ + UNI(0x6d, 0x00ed); /* LATIN SMALL LETTER I WITH ACUTE */ \ + UNI(0x6e, 0x00ee); /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ \ + UNI(0x6f, 0x00ef); /* LATIN SMALL LETTER I WITH DIAERESIS */ \ + UNI(0x70, 0x011f); /* LATIN SMALL LETTER G WITH BREVE */ \ + UNI(0x71, 0x00f1); /* LATIN SMALL LETTER N WITH TILDE */ \ + UNI(0x72, 0x00f2); /* LATIN SMALL LETTER O WITH GRAVE */ \ + UNI(0x73, 0x00f3); /* LATIN SMALL LETTER O WITH ACUTE */ \ + UNI(0x74, 0x00f4); /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ \ + UNI(0x75, 0x00f5); /* LATIN SMALL LETTER O WITH TILDE */ \ + UNI(0x76, 0x00f6); /* LATIN SMALL LETTER O WITH DIAERESIS */ \ + UNI(0x77, 0x00f7); /* DIVISION SIGN */ \ + UNI(0x78, 0x00f8); /* LATIN SMALL LETTER O WITH STROKE */ \ + UNI(0x79, 0x00f9); /* LATIN SMALL LETTER U WITH GRAVE */ \ + UNI(0x7a, 0x00fa); /* LATIN SMALL LETTER U WITH ACUTE */ \ + UNI(0x7b, 0x00fb); /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ \ + UNI(0x7c, 0x00fc); /* LATIN SMALL LETTER U WITH DIAERESIS */ \ + UNI(0x7d, 0x0131); /* LATIN SMALL LETTER DOTLESS I */ \ + UNI(0x7e, 0x015f); /* LATIN SMALL LETTER S WITH CEDILLA */ \ + UNI(0x7f, 0x00ff); /* LATIN SMALL LETTER Y WITH DIAERESIS */ \ + } \ + end_CODEPAGE() + /* DEC Cyrillic from screenshot */ +#define map_DEC_Cyrillic(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x20, 0x00a0); /* NO-BREAK SPACE */ \ + XXX(0x21, UNDEF); /* undefined */ \ + XXX(0x22, UNDEF); /* undefined */ \ + XXX(0x23, UNDEF); /* undefined */ \ + XXX(0x24, UNDEF); /* undefined */ \ + XXX(0x25, UNDEF); /* undefined */ \ + XXX(0x26, UNDEF); /* undefined */ \ + XXX(0x27, UNDEF); /* undefined */ \ + XXX(0x28, UNDEF); /* undefined */ \ + XXX(0x29, UNDEF); /* undefined */ \ + XXX(0x2a, UNDEF); /* undefined */ \ + XXX(0x2b, UNDEF); /* undefined */ \ + XXX(0x2c, UNDEF); /* undefined */ \ + XXX(0x2d, UNDEF); /* undefined */ \ + XXX(0x2e, UNDEF); /* undefined */ \ + XXX(0x2f, UNDEF); /* undefined */ \ + XXX(0x30, UNDEF); /* undefined */ \ + XXX(0x31, UNDEF); /* undefined */ \ + XXX(0x32, UNDEF); /* undefined */ \ + XXX(0x33, UNDEF); /* undefined */ \ + XXX(0x34, UNDEF); /* undefined */ \ + XXX(0x35, UNDEF); /* undefined */ \ + XXX(0x36, UNDEF); /* undefined */ \ + XXX(0x37, UNDEF); /* undefined */ \ + XXX(0x38, UNDEF); /* undefined */ \ + XXX(0x39, UNDEF); /* undefined */ \ + XXX(0x3a, UNDEF); /* undefined */ \ + XXX(0x3b, UNDEF); /* undefined */ \ + XXX(0x3c, UNDEF); /* undefined */ \ + XXX(0x3d, UNDEF); /* undefined */ \ + XXX(0x3e, UNDEF); /* undefined */ \ + XXX(0x3f, UNDEF); /* undefined */ \ + \ + UNI(0x40, 0x044e); /* CYRILLIC SMALL LETTER YU */ \ + UNI(0x41, 0x0430); /* CYRILLIC SMALL LETTER A */ \ + UNI(0x42, 0x0431); /* CYRILLIC SMALL LETTER BE */ \ + UNI(0x43, 0x0446); /* CYRILLIC SMALL LETTER TSE */ \ + UNI(0x44, 0x0434); /* CYRILLIC SMALL LETTER DE */ \ + UNI(0x45, 0x0435); /* CYRILLIC SMALL LETTER IE */ \ + UNI(0x46, 0x0444); /* CYRILLIC SMALL LETTER EF */ \ + UNI(0x47, 0x0433); /* CYRILLIC SMALL LETTER GHE */ \ + UNI(0x48, 0x0445); /* CYRILLIC SMALL LETTER HA */ \ + UNI(0x49, 0x0438); /* CYRILLIC SMALL LETTER I */ \ + UNI(0x4a, 0x0439); /* CYRILLIC SMALL LETTER SHORT I */ \ + UNI(0x4b, 0x043a); /* CYRILLIC SMALL LETTER KA */ \ + UNI(0x4c, 0x043b); /* CYRILLIC SMALL LETTER EL */ \ + UNI(0x4d, 0x043c); /* CYRILLIC SMALL LETTER EM */ \ + UNI(0x4e, 0x043d); /* CYRILLIC SMALL LETTER EN */ \ + UNI(0x4f, 0x043e); /* CYRILLIC SMALL LETTER O */ \ + UNI(0x50, 0x043f); /* CYRILLIC SMALL LETTER PE */ \ + UNI(0x51, 0x044f); /* CYRILLIC SMALL LETTER YA */ \ + UNI(0x52, 0x0440); /* CYRILLIC SMALL LETTER ER */ \ + UNI(0x53, 0x0441); /* CYRILLIC SMALL LETTER ES */ \ + UNI(0x54, 0x0442); /* CYRILLIC SMALL LETTER TE */ \ + UNI(0x55, 0x0443); /* CYRILLIC SMALL LETTER U */ \ + UNI(0x56, 0x0436); /* CYRILLIC SMALL LETTER ZHE */ \ + UNI(0x57, 0x0432); /* CYRILLIC SMALL LETTER VE */ \ + UNI(0x58, 0x044c); /* CYRILLIC SMALL LETTER SOFT SIGN */ \ + UNI(0x59, 0x044b); /* CYRILLIC SMALL LETTER YERU */ \ + UNI(0x5a, 0x0437); /* CYRILLIC SMALL LETTER ZE */ \ + UNI(0x5b, 0x0448); /* CYRILLIC SMALL LETTER SHA */ \ + UNI(0x5c, 0x044d); /* CYRILLIC SMALL LETTER E */ \ + UNI(0x5d, 0x0449); /* CYRILLIC SMALL LETTER SHCHA */ \ + UNI(0x5e, 0x0447); /* CYRILLIC SMALL LETTER CHE */ \ + UNI(0x5f, 0x044a); /* CYRILLIC SMALL LETTER HARD SIGN */ \ + \ + UNI(0x60, 0x042e); /* CYRILLIC CAPITAL LETTER YU */ \ + UNI(0x61, 0x0410); /* CYRILLIC CAPITAL LETTER A */ \ + UNI(0x62, 0x0411); /* CYRILLIC CAPITAL LETTER BE */ \ + UNI(0x63, 0x0426); /* CYRILLIC CAPITAL LETTER TSE */ \ + UNI(0x64, 0x0414); /* CYRILLIC CAPITAL LETTER DE */ \ + UNI(0x65, 0x0415); /* CYRILLIC CAPITAL LETTER IE */ \ + UNI(0x66, 0x0424); /* CYRILLIC CAPITAL LETTER EF */ \ + UNI(0x67, 0x0413); /* CYRILLIC CAPITAL LETTER GHE */ \ + UNI(0x68, 0x0425); /* CYRILLIC CAPITAL LETTER HA */ \ + UNI(0x69, 0x0418); /* CYRILLIC CAPITAL LETTER I */ \ + UNI(0x6a, 0x0419); /* CYRILLIC CAPITAL LETTER SHORT I */ \ + UNI(0x6b, 0x041a); /* CYRILLIC CAPITAL LETTER KA */ \ + UNI(0x6c, 0x041b); /* CYRILLIC CAPITAL LETTER EL */ \ + UNI(0x6d, 0x041c); /* CYRILLIC CAPITAL LETTER EM */ \ + UNI(0x6e, 0x041d); /* CYRILLIC CAPITAL LETTER EN */ \ + UNI(0x6f, 0x041e); /* CYRILLIC CAPITAL LETTER O */ \ + UNI(0x70, 0x041f); /* CYRILLIC CAPITAL LETTER PE */ \ + UNI(0x71, 0x042f); /* CYRILLIC CAPITAL LETTER YA */ \ + UNI(0x72, 0x0420); /* CYRILLIC CAPITAL LETTER ER */ \ + UNI(0x73, 0x0421); /* CYRILLIC CAPITAL LETTER ES */ \ + UNI(0x74, 0x0422); /* CYRILLIC CAPITAL LETTER TE */ \ + UNI(0x75, 0x0423); /* CYRILLIC CAPITAL LETTER U */ \ + UNI(0x76, 0x0416); /* CYRILLIC CAPITAL LETTER ZHE */ \ + UNI(0x77, 0x0412); /* CYRILLIC CAPITAL LETTER VE */ \ + UNI(0x78, 0x042c); /* CYRILLIC CAPITAL LETTER SOFT SIGN */ \ + UNI(0x79, 0x042b); /* CYRILLIC CAPITAL LETTER YERU */ \ + UNI(0x7a, 0x0417); /* CYRILLIC CAPITAL LETTER ZE */ \ + UNI(0x7b, 0x0428); /* CYRILLIC CAPITAL LETTER SHA */ \ + UNI(0x7c, 0x042d); /* CYRILLIC CAPITAL LETTER E */ \ + UNI(0x7d, 0x0429); /* CYRILLIC CAPITAL LETTER SHCHA */ \ + UNI(0x7e, 0x0427); /* CYRILLIC CAPITAL LETTER CHE */ \ + UNI(0x7f, 0x042a); /* CYRILLIC CAPITAL LETTER HARD SIGN */ \ + \ + } \ + end_CODEPAGE() + /* figure A-24 "DEC Greek Supplemental Character Set" */ +#define map_DEC_Greek_Supp(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + MAP(0x20, 0x00a0); /* NO-BREAK SPACE */ \ + UNI(0x21, 0x00a1); /* LEFT SINGLE QUOTATION MARK */ \ + UNI(0x22, 0x00a2); /* RIGHT SINGLE QUOTATION MARK */ \ + UNI(0x23, 0x00a3); /* POUND SIGN */ \ + XXX(0x24, UNDEF); /* EURO SIGN */ \ + UNI(0x25, 0x00a5); /* YEN SIGN */ \ + XXX(0x26, UNDEF); /* BROKEN BAR */ \ + UNI(0x27, 0x00a7); /* SECTION SIGN */ \ + UNI(0x28, 0x00a4); /* CURRENCY SIGN */ \ + UNI(0x29, 0x00a9); /* COPYRIGHT SIGN */ \ + UNI(0x2a, 0x00aa); /* FEMININE ORDINAL INDICATOR */ \ + UNI(0x2b, 0x00ab); /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + XXX(0x2c, UNDEF); /* reserved */ \ + XXX(0x2d, UNDEF); /* reserved */ \ + XXX(0x2e, UNDEF); /* reserved */ \ + XXX(0x2f, UNDEF); /* reserved */ \ + UNI(0x30, 0x00b0); /* DEGREE SIGN */ \ + UNI(0x31, 0x00b1); /* PLUS-MINUS SIGN */ \ + UNI(0x32, 0x00b2); /* SUPERSCRIPT TWO */ \ + UNI(0x33, 0x00b3); /* SUPERSCRIPT THREE */ \ + XXX(0x34, UNDEF); /* reserved */ \ + UNI(0x35, 0x00b5); /* MICRO SIGN */ \ + UNI(0x36, 0x00b6); /* PILCROW SIGN */ \ + UNI(0x37, 0x00b7); /* MIDDLE DOT */ \ + XXX(0x38, UNDEF); /* reserved */ \ + UNI(0x39, 0x00b9); /* SUPERSCRIPT ONE */ \ + UNI(0x3a, 0x00ba); /* MASCULINE ORDINAL INDICATOR */ \ + UNI(0x3b, 0x00bb); /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x3c, 0x00bc); /* VULGAR FRACTION ONE QUARTER */ \ + UNI(0x3d, 0x00bd); /* VULGAR FRACTION ONE HALF */ \ + XXX(0x3e, UNDEF); /* reserved */ \ + UNI(0x3f, 0x00BF); /* INVERTED QUESTION MARK */ \ + UNI(0x40, 0x03ca); /* GREEK SMALL LETTER IOTA WITH DIALYTIKA */ \ + UNI(0x41, 0x0391); /* GREEK CAPITAL LETTER ALPHA */ \ + UNI(0x42, 0x0392); /* GREEK CAPITAL LETTER BETA */ \ + UNI(0x43, 0x0393); /* GREEK CAPITAL LETTER GAMMA */ \ + UNI(0x44, 0x0394); /* GREEK CAPITAL LETTER DELTA */ \ + UNI(0x45, 0x0395); /* GREEK CAPITAL LETTER EPSILON */ \ + UNI(0x46, 0x0396); /* GREEK CAPITAL LETTER ZETA */ \ + UNI(0x47, 0x0397); /* GREEK CAPITAL LETTER ETA */ \ + UNI(0x48, 0x0398); /* GREEK CAPITAL LETTER THETA */ \ + UNI(0x49, 0x0399); /* GREEK CAPITAL LETTER IOTA */ \ + UNI(0x4a, 0x039a); /* GREEK CAPITAL LETTER KAPPA */ \ + UNI(0x4b, 0x039b); /* GREEK CAPITAL LETTER LAMDA */ \ + UNI(0x4c, 0x039c); /* GREEK CAPITAL LETTER MU */ \ + UNI(0x4d, 0x039d); /* GREEK CAPITAL LETTER NU */ \ + UNI(0x4e, 0x039e); /* GREEK CAPITAL LETTER XI */ \ + UNI(0x4f, 0x039f); /* GREEK CAPITAL LETTER OMICRON */ \ + XXX(0x50, UNDEF); /* reserved */ \ + UNI(0x51, 0x03a0); /* GREEK CAPITAL LETTER PI */ \ + UNI(0x52, 0x03a1); /* GREEK CAPITAL LETTER RHO */ \ + UNI(0x53, 0x03a3); /* GREEK CAPITAL LETTER SIGMA */ \ + UNI(0x54, 0x03a4); /* GREEK CAPITAL LETTER TAU */ \ + UNI(0x55, 0x03a5); /* GREEK CAPITAL LETTER UPSILON */ \ + UNI(0x56, 0x03a6); /* GREEK CAPITAL LETTER PHI */ \ + UNI(0x57, 0x03a7); /* GREEK CAPITAL LETTER CHI */ \ + UNI(0x58, 0x03a8); /* GREEK CAPITAL LETTER PSI */ \ + UNI(0x59, 0x03a9); /* GREEK CAPITAL LETTER OMEGA */ \ + UNI(0x5a, 0x03ac); /* GREEK SMALL LETTER ALPHA WITH TONOS */ \ + UNI(0x5b, 0x03ad); /* GREEK SMALL LETTER EPSILON WITH TONOS */ \ + UNI(0x5c, 0x03ae); /* GREEK SMALL LETTER ETA WITH TONOS */ \ + UNI(0x5d, 0x03af); /* GREEK SMALL LETTER IOTA WITH TONOS */ \ + XXX(0x5e, UNDEF); /* reserved */ \ + UNI(0x5f, 0x03cc); /* GREEK SMALL LETTER OMICRON WITH TONOS */ \ + UNI(0x60, 0x03cb); /* GREEK SMALL LETTER UPSILON WITH DIALYTIKA */ \ + UNI(0x61, 0x03b1); /* GREEK SMALL LETTER ALPHA */ \ + UNI(0x62, 0x03b2); /* GREEK SMALL LETTER BETA */ \ + UNI(0x63, 0x03b3); /* GREEK SMALL LETTER GAMMA */ \ + UNI(0x64, 0x03b4); /* GREEK SMALL LETTER DELTA */ \ + UNI(0x65, 0x03b5); /* GREEK SMALL LETTER EPSILON */ \ + UNI(0x66, 0x03b6); /* GREEK SMALL LETTER ZETA */ \ + UNI(0x67, 0x03b7); /* GREEK SMALL LETTER ETA */ \ + UNI(0x68, 0x03b8); /* GREEK SMALL LETTER THETA */ \ + UNI(0x69, 0x03b9); /* GREEK SMALL LETTER IOTA */ \ + UNI(0x6a, 0x03ba); /* GREEK SMALL LETTER KAPPA */ \ + UNI(0x6b, 0x03bb); /* GREEK SMALL LETTER LAMDA */ \ + UNI(0x6c, 0x03bc); /* GREEK SMALL LETTER MU */ \ + UNI(0x6d, 0x03bd); /* GREEK SMALL LETTER NU */ \ + UNI(0x6e, 0x03be); /* GREEK SMALL LETTER XI */ \ + UNI(0x6f, 0x03bf); /* GREEK SMALL LETTER OMICRON */ \ + XXX(0x70, UNDEF); /* reserved */ \ + UNI(0x71, 0x03c0); /* GREEK SMALL LETTER PI */ \ + UNI(0x72, 0x03c1); /* GREEK SMALL LETTER RHO */ \ + UNI(0x73, 0x03c3); /* GREEK SMALL LETTER SIGMA */ \ + UNI(0x74, 0x03c4); /* GREEK SMALL LETTER TAU */ \ + UNI(0x75, 0x03c5); /* GREEK SMALL LETTER UPSILON */ \ + UNI(0x76, 0x03c6); /* GREEK SMALL LETTER PHI */ \ + UNI(0x77, 0x03c7); /* GREEK SMALL LETTER CHI */ \ + UNI(0x78, 0x03c8); /* GREEK SMALL LETTER PSI */ \ + UNI(0x79, 0x03c9); /* GREEK SMALL LETTER OMEGA */ \ + UNI(0x7a, 0x03c2); /* GREEK SMALL LETTER FINAL SIGMA */ \ + UNI(0x7b, 0x03cd); /* GREEK SMALL LETTER UPSILON WITH TONOS */ \ + UNI(0x7c, 0x03ce); /* GREEK SMALL LETTER OMEGA WITH TONOS */ \ + UNI(0x7d, 0x0384); /* GREEK TONOS */ \ + XXX(0x7e, UNDEF); /* reserved */ \ + } \ + end_CODEPAGE() + /* figure A-22 "DEC Hebrew Supplemental Character Set" */ +#define map_DEC_Hebrew_Supp(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x21, 0x00a1); /* INVERTED EXCLAMATION MARK */ \ + UNI(0x22, 0x00a2); /* CENT SIGN */ \ + UNI(0x23, 0x00a3); /* POUND SIGN */ \ + XXX(0x24, UNDEF); /* CURRENCY SIGN */ \ + UNI(0x25, 0x00a5); /* YEN SIGN */ \ + XXX(0x26, UNDEF); /* BROKEN BAR */ \ + UNI(0x27, 0x00a7); /* SECTION SIGN */ \ + UNI(0x28, 0x00a8); /* DIAERESIS */ \ + UNI(0x29, 0x00a9); /* COPYRIGHT SIGN */ \ + UNI(0x2a, 0x00d7); /* MULTIPLICATION SIGN */ \ + UNI(0x2b, 0x00ab); /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + XXX(0x2c, UNDEF); /* NOT SIGN */ \ + XXX(0x2d, UNDEF); /* SOFT HYPHEN */ \ + XXX(0x2e, UNDEF); /* REGISTERED SIGN */ \ + XXX(0x2f, UNDEF); /* MACRON */ \ + UNI(0x30, 0x00b0); /* DEGREE SIGN */ \ + UNI(0x31, 0x00b1); /* PLUS-MINUS SIGN */ \ + UNI(0x32, 0x00b2); /* SUPERSCRIPT TWO */ \ + UNI(0x33, 0x00b3); /* SUPERSCRIPT THREE */ \ + XXX(0x34, UNDEF); /* ACUTE ACCENT */ \ + UNI(0x35, 0x00b5); /* MICRO SIGN */ \ + UNI(0x36, 0x00b6); /* PILCROW SIGN */ \ + UNI(0x37, 0x00b7); /* MIDDLE DOT */ \ + XXX(0x38, UNDEF); /* CEDILLA */ \ + UNI(0x39, 0x00b9); /* SUPERSCRIPT ONE */ \ + UNI(0x3a, 0x00f7); /* DIVISION SIGN */ \ + UNI(0x3b, 0x00bb); /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x3c, 0x00bc); /* VULGAR FRACTION ONE QUARTER */ \ + UNI(0x3d, 0x00bd); /* VULGAR FRACTION ONE HALF */ \ + XXX(0x3e, UNDEF); /* VULGAR FRACTION THREE QUARTERS */ \ + UNI(0x3f, 0x00bf); /* INVERTED QUESTION MARK */ \ + XXX(0x40, UNDEF); /* reserved */ \ + XXX(0x41, UNDEF); /* reserved */ \ + XXX(0x42, UNDEF); /* reserved */ \ + XXX(0x43, UNDEF); /* reserved */ \ + XXX(0x44, UNDEF); /* reserved */ \ + XXX(0x45, UNDEF); /* reserved */ \ + XXX(0x46, UNDEF); /* reserved */ \ + XXX(0x47, UNDEF); /* reserved */ \ + XXX(0x48, UNDEF); /* reserved */ \ + XXX(0x49, UNDEF); /* reserved */ \ + XXX(0x4a, UNDEF); /* reserved */ \ + XXX(0x4b, UNDEF); /* reserved */ \ + XXX(0x4c, UNDEF); /* reserved */ \ + XXX(0x4d, UNDEF); /* reserved */ \ + XXX(0x4e, UNDEF); /* reserved */ \ + XXX(0x4f, UNDEF); /* reserved */ \ + XXX(0x50, UNDEF); /* reserved */ \ + XXX(0x51, UNDEF); /* reserved */ \ + XXX(0x52, UNDEF); /* reserved */ \ + XXX(0x53, UNDEF); /* reserved */ \ + XXX(0x54, UNDEF); /* reserved */ \ + XXX(0x55, UNDEF); /* reserved */ \ + XXX(0x56, UNDEF); /* reserved */ \ + XXX(0x57, UNDEF); /* reserved */ \ + XXX(0x58, UNDEF); /* reserved */ \ + XXX(0x59, UNDEF); /* reserved */ \ + XXX(0x5a, UNDEF); /* reserved */ \ + XXX(0x5b, UNDEF); /* reserved */ \ + XXX(0x5c, UNDEF); /* reserved */ \ + XXX(0x5d, UNDEF); /* reserved */ \ + XXX(0x5e, UNDEF); /* reserved */ \ + XXX(0x5f, UNDEF); /* reserved */ \ + UNI(0x60, 0x05d0); /* HEBREW LETTER ALEF */ \ + UNI(0x61, 0x05d1); /* HEBREW LETTER BET */ \ + UNI(0x62, 0x05d2); /* HEBREW LETTER GIMEL */ \ + UNI(0x63, 0x05d3); /* HEBREW LETTER DALET */ \ + UNI(0x64, 0x05d4); /* HEBREW LETTER HE */ \ + UNI(0x65, 0x05d5); /* HEBREW LETTER VAV */ \ + UNI(0x66, 0x05d6); /* HEBREW LETTER ZAYIN */ \ + UNI(0x67, 0x05d7); /* HEBREW LETTER HET */ \ + UNI(0x68, 0x05d8); /* HEBREW LETTER TET */ \ + UNI(0x69, 0x05d9); /* HEBREW LETTER YOD */ \ + UNI(0x6a, 0x05da); /* HEBREW LETTER FINAL KAF */ \ + UNI(0x6b, 0x05db); /* HEBREW LETTER KAF */ \ + UNI(0x6c, 0x05dc); /* HEBREW LETTER LAMED */ \ + UNI(0x6d, 0x05dd); /* HEBREW LETTER FINAL MEM */ \ + UNI(0x6e, 0x05de); /* HEBREW LETTER MEM */ \ + UNI(0x6f, 0x05df); /* HEBREW LETTER FINAL NUN */ \ + UNI(0x70, 0x05e0); /* HEBREW LETTER NUN */ \ + UNI(0x71, 0x05e1); /* HEBREW LETTER SAMEKH */ \ + UNI(0x72, 0x05e2); /* HEBREW LETTER AYIN */ \ + UNI(0x73, 0x05e3); /* HEBREW LETTER FINAL PE */ \ + UNI(0x74, 0x05e4); /* HEBREW LETTER PE */ \ + UNI(0x75, 0x05e5); /* HEBREW LETTER FINAL TSADI */ \ + UNI(0x76, 0x05e6); /* HEBREW LETTER TSADI */ \ + UNI(0x77, 0x05e7); /* HEBREW LETTER QOF */ \ + UNI(0x78, 0x05e8); /* HEBREW LETTER RESH */ \ + UNI(0x79, 0x05e9); /* HEBREW LETTER SHIN */ \ + UNI(0x7a, 0x05ea); /* HEBREW LETTER TAV */ \ + XXX(0x7b, UNDEF); /* reserved */ \ + XXX(0x7c, UNDEF); /* reserved */ \ + XXX(0x7d, UNDEF); /* reserved */ \ + XXX(0x7e, UNDEF); /* reserved */ \ + } \ + end_CODEPAGE() + /* figure A-27 "DEC 8-Bit Turkish Supplemental Character Set" */ +#define map_DEC_Turkish_Supp(code) \ + begin_CODEPAGE(); \ + switch (code) { \ + UNI(0x21, 0x00A1); /* INVERTED EXCLAMATION MARK */ \ + UNI(0x22, 0x00A2); /* CENT SIGN */ \ + UNI(0x23, 0x00A3); /* POUND SIGN */ \ + XXX(0x24, UNDEF); /* reserved */ \ + UNI(0x25, 0x00A5); /* YEN SIGN */ \ + XXX(0x26, UNDEF); /* reserved */ \ + UNI(0x27, 0x00A7); /* SECTION SIGN */ \ + UNI(0x28, 0x00A8); /* DIAERESIS */ \ + UNI(0x29, 0x00A9); /* COPYRIGHT SIGN */ \ + UNI(0x2A, 0x00AA); /* FEMININE ORDINAL INDICATOR */ \ + UNI(0x2B, 0x00AB); /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + XXX(0x2C, UNDEF); /* reserved */ \ + XXX(0x2D, UNDEF); /* reserved */ \ + UNI(0x2E, 0x0130); /* LATIN CAPITAL LETTER I WITH DOT ABOVE */ \ + XXX(0x2F, UNDEF); /* reserved */ \ + UNI(0x30, 0x00B0); /* DEGREE SIGN */ \ + UNI(0x31, 0x00B1); /* PLUS-MINUS SIGN */ \ + UNI(0x32, 0x00B2); /* SUPERSCRIPT TWO */ \ + UNI(0x33, 0x00B3); /* SUPERSCRIPT THREE */ \ + XXX(0x34, UNDEF); /* reserved */ \ + UNI(0x35, 0x00B5); /* MICRO SIGN */ \ + UNI(0x36, 0x00B6); /* PILCROW SIGN */ \ + UNI(0x37, 0x00B7); /* MIDDLE DOT */ \ + XXX(0x38, UNDEF); /* reserved */ \ + UNI(0x39, 0x00B9); /* SUPERSCRIPT ONE */ \ + UNI(0x3A, 0x00BA); /* MASCULINE ORDINAL INDICATOR */ \ + UNI(0x3B, 0x00BB); /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ \ + UNI(0x3C, 0x00BC); /* VULGAR FRACTION ONE QUARTER */ \ + UNI(0x3D, 0x00BD); /* VULGAR FRACTION ONE HALF */ \ + UNI(0x3E, 0x0131); /* LATIN SMALL LETTER DOTLESS I */ \ + UNI(0x3F, 0x00BF); /* INVERTED QUESTION MARK */ \ + UNI(0x40, 0x00C0); /* LATIN CAPITAL LETTER A WITH GRAVE */ \ + UNI(0x41, 0x00C1); /* LATIN CAPITAL LETTER A WITH ACUTE */ \ + UNI(0x42, 0x00C2); /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ \ + UNI(0x43, 0x00C3); /* LATIN CAPITAL LETTER A WITH TILDE */ \ + UNI(0x44, 0x00C4); /* LATIN CAPITAL LETTER A WITH DIAERESIS */ \ + UNI(0x45, 0x00C5); /* LATIN CAPITAL LETTER A WITH RING ABOVE */ \ + UNI(0x46, 0x00C6); /* LATIN CAPITAL LETTER AE */ \ + UNI(0x47, 0x00C7); /* LATIN CAPITAL LETTER C WITH CEDILLA */ \ + UNI(0x48, 0x00C8); /* LATIN CAPITAL LETTER E WITH GRAVE */ \ + UNI(0x49, 0x00C9); /* LATIN CAPITAL LETTER E WITH ACUTE */ \ + UNI(0x4A, 0x00CA); /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ \ + UNI(0x4B, 0x00CB); /* LATIN CAPITAL LETTER E WITH DIAERESIS */ \ + UNI(0x4C, 0x00CC); /* LATIN CAPITAL LETTER I WITH GRAVE */ \ + UNI(0x4D, 0x00CD); /* LATIN CAPITAL LETTER I WITH ACUTE */ \ + UNI(0x4E, 0x00CE); /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ \ + UNI(0x4F, 0x00CF); /* LATIN CAPITAL LETTER I WITH DIAERESIS */ \ + UNI(0x50, 0x011E); /* LATIN CAPITAL LETTER G WITH BREVE */ \ + UNI(0x51, 0x00D1); /* LATIN CAPITAL LETTER N WITH TILDE */ \ + UNI(0x52, 0x00D2); /* LATIN CAPITAL LETTER O WITH GRAVE */ \ + UNI(0x53, 0x00D3); /* LATIN CAPITAL LETTER O WITH ACUTE */ \ + UNI(0x54, 0x00D4); /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ \ + UNI(0x55, 0x00D5); /* LATIN CAPITAL LETTER O WITH TILDE */ \ + UNI(0x56, 0x00D6); /* LATIN CAPITAL LETTER O WITH DIAERESIS */ \ + UNI(0x57, 0x0152); /* LATIN CAPITAL LIGATURE OE */ \ + UNI(0x58, 0x00D8); /* LATIN CAPITAL LETTER O WITH STROKE */ \ + UNI(0x59, 0x00D9); /* LATIN CAPITAL LETTER U WITH GRAVE */ \ + UNI(0x5A, 0x00DA); /* LATIN CAPITAL LETTER U WITH ACUTE */ \ + UNI(0x5B, 0x00DB); /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ \ + UNI(0x5C, 0x00DC); /* LATIN CAPITAL LETTER U WITH DIAERESIS */ \ + UNI(0x5D, 0x0178); /* LATIN CAPITAL LETTER Y WITH DIAERESIS */ \ + UNI(0x5E, 0x015E); /* LATIN CAPITAL LETTER S WITH CEDILLA */ \ + UNI(0x5F, 0x00DF); /* LATIN SMALL LETTER SHARP S */ \ + UNI(0x60, 0x00E0); /* LATIN SMALL LETTER A WITH GRAVE */ \ + UNI(0x61, 0x00E1); /* LATIN SMALL LETTER A WITH ACUTE */ \ + UNI(0x62, 0x00E2); /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ \ + UNI(0x63, 0x00E3); /* LATIN SMALL LETTER A WITH TILDE */ \ + UNI(0x64, 0x00E4); /* LATIN SMALL LETTER A WITH DIAERESIS */ \ + UNI(0x65, 0x00E5); /* LATIN SMALL LETTER A WITH RING ABOVE */ \ + UNI(0x66, 0x00E6); /* LATIN SMALL LETTER AE */ \ + UNI(0x67, 0x00E7); /* LATIN SMALL LETTER C WITH CEDILLA */ \ + UNI(0x68, 0x00E8); /* LATIN SMALL LETTER E WITH GRAVE */ \ + UNI(0x69, 0x00E9); /* LATIN SMALL LETTER E WITH ACUTE */ \ + UNI(0x6A, 0x00EA); /* LATIN SMALL LETTER E WITH CIRCUMFLEX */ \ + UNI(0x6B, 0x00EB); /* LATIN SMALL LETTER E WITH DIAERESIS */ \ + UNI(0x6C, 0x00EC); /* LATIN SMALL LETTER I WITH GRAVE */ \ + UNI(0x6D, 0x00ED); /* LATIN SMALL LETTER I WITH ACUTE */ \ + UNI(0x6E, 0x00EE); /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ \ + UNI(0x6F, 0x00EF); /* LATIN SMALL LETTER I WITH DIAERESIS */ \ + UNI(0x70, 0x011F); /* LATIN SMALL LETTER G WITH BREVE */ \ + UNI(0x71, 0x00F1); /* LATIN SMALL LETTER N WITH TILDE */ \ + UNI(0x72, 0x00F2); /* LATIN SMALL LETTER O WITH GRAVE */ \ + UNI(0x73, 0x00F3); /* LATIN SMALL LETTER O WITH ACUTE */ \ + UNI(0x74, 0x00F4); /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ \ + UNI(0x75, 0x00F5); /* LATIN SMALL LETTER O WITH TILDE */ \ + UNI(0x76, 0x00F6); /* LATIN SMALL LETTER O WITH DIAERESIS */ \ + UNI(0x77, 0x0153); /* LATIN SMALL LIGATURE OE */ \ + UNI(0x78, 0x00F8); /* LATIN SMALL LETTER O WITH STROKE */ \ + UNI(0x79, 0x00F9); /* LATIN SMALL LETTER U WITH GRAVE */ \ + UNI(0x7A, 0x00FA); /* LATIN SMALL LETTER U WITH ACUTE */ \ + UNI(0x7B, 0x00FB); /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ \ + UNI(0x7C, 0x00FC); /* LATIN SMALL LETTER U WITH DIAERESIS */ \ + UNI(0x7D, 0x00FF); /* LATIN SMALL LETTER Y WITH DIAERESIS */ \ + UNI(0x7E, 0x015F); /* LATIN SMALL LETTER S WITH CEDILLA */ \ + } \ + end_CODEPAGE() + /* + * mentioned, but not documented in VT510 manual, etc., this uses + * the ELOT927 table from Kermit 95: + */ +#define map_NRCS_Greek(code) \ + switch (code) { \ + MAP(0x61, 0x0391); /* CAPITAL GREEK LETTER ALPHA */ \ + MAP(0x62, 0x0392); /* CAPITAL GREEK LETTER BETA */ \ + MAP(0x63, 0x0393); /* CAPITAL GREEK LETTER GAMMA */ \ + MAP(0x64, 0x0394); /* CAPITAL GREEK LETTER DELTA */ \ + MAP(0x65, 0x0395); /* CAPITAL GREEK LETTER EPSILON */ \ + MAP(0x66, 0x0396); /* CAPITAL GREEK LETTER ZETA */ \ + MAP(0x67, 0x0397); /* CAPITAL GREEK LETTER ETA */ \ + MAP(0x68, 0x0398); /* CAPITAL GREEK LETTER THETA */ \ + MAP(0x69, 0x0399); /* CAPITAL GREEK LETTER IOTA */ \ + MAP(0x6a, 0x039a); /* CAPITAL GREEK LETTER KAPPA */ \ + MAP(0x6b, 0x039b); /* CAPITAL GREEK LETTER LAMDA */ \ + MAP(0x6c, 0x039c); /* CAPITAL GREEK LETTER MU */ \ + MAP(0x6d, 0x039d); /* CAPITAL GREEK LETTER NU */ \ + MAP(0x6e, 0x03a7); /* CAPITAL GREEK LETTER KSI (CHI) */ \ + MAP(0x6f, 0x039f); /* CAPITAL GREEK LETTER OMICRON */ \ + MAP(0x70, 0x03a0); /* CAPITAL GREEK LETTER PI */ \ + MAP(0x71, 0x03a1); /* CAPITAL GREEK LETTER RHO */ \ + MAP(0x72, 0x03a3); /* CAPITAL GREEK LETTER SIGMA */ \ + MAP(0x73, 0x03a4); /* CAPITAL GREEK LETTER TAU */ \ + MAP(0x74, 0x03a5); /* CAPITAL GREEK LETTER UPSILON */ \ + MAP(0x75, 0x03a6); /* CAPITAL GREEK LETTER FI (PHI) */ \ + MAP(0x76, 0x039e); /* CAPITAL GREEK LETTER XI */ \ + MAP(0x77, 0x03a8); /* CAPITAL GREEK LETTER PSI */ \ + MAP(0x78, 0x03a9); /* CAPITAL GREEK LETTER OMEGA */ \ + XXX(0x79, BLANK); /* unused */ \ + XXX(0x7a, BLANK); /* unused */ \ + } + /* figure A-21 "DEC 7-Bit Hebrew Character Set" */ +#define map_NRCS_Hebrew(code) \ + switch (code) { \ + UNI(0x60, 0x05d0); /* HEBREW LETTER ALEF */ \ + UNI(0x61, 0x05d1); /* HEBREW LETTER BET */ \ + UNI(0x62, 0x05d2); /* HEBREW LETTER GIMEL */ \ + UNI(0x63, 0x05d3); /* HEBREW LETTER DALET */ \ + UNI(0x64, 0x05d4); /* HEBREW LETTER HE */ \ + UNI(0x65, 0x05d5); /* HEBREW LETTER VAV */ \ + UNI(0x66, 0x05d6); /* HEBREW LETTER ZAYIN */ \ + UNI(0x67, 0x05d7); /* HEBREW LETTER HET */ \ + UNI(0x68, 0x05d8); /* HEBREW LETTER TET */ \ + UNI(0x69, 0x05d9); /* HEBREW LETTER YOD */ \ + UNI(0x6a, 0x05da); /* HEBREW LETTER FINAL KAF */ \ + UNI(0x6b, 0x05db); /* HEBREW LETTER KAF */ \ + UNI(0x6c, 0x05dc); /* HEBREW LETTER LAMED */ \ + UNI(0x6d, 0x05dd); /* HEBREW LETTER FINAL MEM */ \ + UNI(0x6e, 0x05de); /* HEBREW LETTER MEM */ \ + UNI(0x6f, 0x05df); /* HEBREW LETTER FINAL NUN */ \ + UNI(0x70, 0x05e0); /* HEBREW LETTER NUN */ \ + UNI(0x71, 0x05e1); /* HEBREW LETTER SAMEKH */ \ + UNI(0x72, 0x05e2); /* HEBREW LETTER AYIN */ \ + UNI(0x73, 0x05e3); /* HEBREW LETTER FINAL PE */ \ + UNI(0x74, 0x05e4); /* HEBREW LETTER PE */ \ + UNI(0x75, 0x05e5); /* HEBREW LETTER FINAL TSADI */ \ + UNI(0x76, 0x05e6); /* HEBREW LETTER TSADI */ \ + UNI(0x77, 0x05e7); /* HEBREW LETTER QOF */ \ + UNI(0x78, 0x05e8); /* HEBREW LETTER RESH */ \ + UNI(0x79, 0x05e9); /* HEBREW LETTER SHIN */ \ + UNI(0x7a, 0x05ea); /* HEBREW LETTER TAV */ \ + } + /* figure A-26 "DEC 7-Bit Turkish Character Set" */ +#define map_NRCS_Turkish(code) \ + switch (code) { \ + UNI(0x26, 0x011f); /* LATIN SMALL LETTER G WITH BREVE */ \ + UNI(0x40, 0x0130); /* LATIN CAPITAL LETTER I WITH DOT ABOVE */ \ + UNI(0x5b, 0x015e); /* LATIN CAPITAL LETTER S WITH CEDILLA */ \ + UNI(0x5c, 0x00d6); /* LATIN CAPITAL LETTER O WITH DIAERESIS */ \ + UNI(0x5d, 0x00c7); /* LATIN CAPITAL LETTER C WITH CEDILLA */ \ + UNI(0x5e, 0x00dC); /* LATIN CAPITAL LETTER U WITH DIAERESIS */ \ + UNI(0x60, 0x011e); /* LATIN CAPITAL LETTER G WITH BREVE */ \ + UNI(0x7b, 0x015f); /* LATIN SMALL LETTER S WITH CEDILLA */ \ + UNI(0x7c, 0x00f6); /* LATIN SMALL LETTER O WITH DIAERESIS */ \ + UNI(0x7d, 0x00e7); /* LATIN SMALL LETTER C WITH CEDILLA */ \ + UNI(0x7e, 0x00fc); /* LATIN SMALL LETTER U WITH DIAERESIS */ \ + } +#else +#define map_DEC_Cyrillic(code) /* nothing */ +#define map_DEC_Greek_Supp(code) /* nothing */ +#define map_DEC_Hebrew_Supp(code) /* nothing */ +#define map_DEC_Technical(code) /* nothing */ +#define map_DEC_Turkish_Supp(code) /* nothing */ +#define map_ISO_Greek_Supp(code) /* nothing */ +#define map_ISO_Hebrew(code) /* nothing */ +#define map_ISO_Latin_5(code) /* nothing */ +#define map_ISO_Latin_Cyrillic(code) /* nothing */ +#define map_NRCS_Greek(code) /* nothing */ +#define map_NRCS_Hebrew(code) /* nothing */ +#define map_NRCS_Turkish(code) /* nothing */ +#endif /* OPT_WIDE_CHARS */ + +/* + * Translate an input keysym to the corresponding NRC keysym. + */ +unsigned +xtermCharSetIn(XtermWidget xw, unsigned code, DECNRCM_codes charset) +{ + TScreen *screen = TScreenOf(xw); +#define MAP(to, from) case from: code = to; break + +#if OPT_WIDE_CHARS +#define UNI(to, from) case from: if (screen->utf8_nrc_mode) code = to; break +#else +#define UNI(to, from) case from: break +#endif + +#define XXX(to, from) /* no defined mapping to 0..255 */ + + TRACE(("CHARSET-IN GL=%s(G%d) GR=%s(G%d) SS%d\n\t%s\n", + visibleScsCode(screen->gsets[screen->curgl]), screen->curgl, + visibleScsCode(screen->gsets[screen->curgr]), screen->curgr, + screen->curss, + visibleUChar(code))); + + (void) screen; + switch (charset) { + case nrc_British: /* United Kingdom set (or Latin 1) */ + if (code == XK_sterling) + code = 0x23; + code &= 0x7f; + break; + + case nrc_DEC_Alt_Chars: + case nrc_DEC_Alt_Graphics: + case nrc_ASCII: + break; + + case nrc_DEC_Spec_Graphic: + break; + + case nrc_DEC_Supp: + map_DEC_Supp_Graphic(code, code &= 0x7f); + break; + + case nrc_DEC_Supp_Graphic: + map_DEC_Supp_Graphic(code, code |= 0x80); + break; + + case nrc_DEC_Technical: + map_DEC_Technical(code); + break; + + case nrc_Dutch: + map_NRCS_Dutch(code); + break; + + case nrc_Finnish: + case nrc_Finnish2: + map_NRCS_Finnish(code); + break; + + case nrc_French: + case nrc_French2: + map_NRCS_French(code); + break; + + case nrc_French_Canadian: + map_NRCS_French_Canadian(code); + break; + + case nrc_German: + map_NRCS_German(code); + break; + + case nrc_Greek: + map_NRCS_Greek(code); /* FIXME - ELOT? */ + break; + + case nrc_DEC_Greek_Supp: + map_DEC_Greek_Supp(code); + break; + + case nrc_ISO_Greek_Supp: + map_ISO_Greek_Supp(code); + break; + + case nrc_DEC_Hebrew_Supp: + map_DEC_Hebrew_Supp(code); + break; + + case nrc_Hebrew: + map_NRCS_Hebrew(code); + break; + + case nrc_ISO_Hebrew_Supp: + map_ISO_Hebrew(code); + break; + + case nrc_Italian: + map_NRCS_Italian(code); + break; + + case nrc_ISO_Latin_5_Supp: + map_ISO_Latin_5(code); + break; + + case nrc_ISO_Latin_Cyrillic: + map_ISO_Latin_Cyrillic(code); + break; + + case nrc_Norwegian_Danish: + case nrc_Norwegian_Danish2: + case nrc_Norwegian_Danish3: + map_NRCS_Norwegian_Danish(code); + break; + + case nrc_Portugese: + map_NRCS_Portuguese(code); + break; + + case nrc_SCS_NRCS: /* vt5xx - probably Serbo/Croatian */ + /* FIXME */ + break; + + case nrc_Spanish: + map_NRCS_Spanish(code); + break; + + case nrc_Swedish2: + case nrc_Swedish: + map_NRCS_Swedish(code); + break; + + case nrc_Swiss: + map_NRCS_Swiss(code); + break; + + case nrc_Turkish: + map_NRCS_Turkish(code); + break; + + case nrc_DEC_Turkish_Supp: + map_DEC_Turkish_Supp(code); + break; + + case nrc_Cyrillic: + map_DEC_Cyrillic(code); + break; + + case nrc_British_Latin_1: + case nrc_Russian: + case nrc_French_Canadian2: + case nrc_Unknown: + default: /* any character sets we don't recognize */ + break; + } + code &= 0x7f; /* NRC in any case is 7-bit */ + TRACE(("->\t%s\n", + visibleUChar(code))); + return code; +#undef MAP +#undef UNI +#undef XXX +} + +/* + * Translate a string to the display form. This assumes the font has the + * DEC graphic characters in cells 0-31, and otherwise is ISO-8859-1. + */ +int +xtermCharSetOut(XtermWidget xw, IChar *buf, IChar *ptr, DECNRCM_codes leftset) +{ + IChar *s; + TScreen *screen = TScreenOf(xw); + int count = 0; + DECNRCM_codes rightset = screen->gsets[(int) (screen->curgr)]; + +#define MAP(from, to) case from: chr = to; break + +#if OPT_WIDE_CHARS +#define UNI(from, to) case from: if (screen->utf8_nrc_mode) chr = to; break +#define XXX(from, to) UNI(from, to) +#else +#define UNI(old, new) chr = old; break +#define XXX(from, to) /* nothing */ +#endif + + TRACE(("CHARSET-OUT GL=%s(G%d) GR=%s(G%d) SS%d\n\t%s\n", + visibleScsCode(leftset), screen->curgl, + visibleScsCode(rightset), screen->curgr, + screen->curss, + visibleIChars(buf, (unsigned) (ptr - buf)))); + + for (s = buf; s < ptr; ++s) { + int eight = CharOf(E2A(*s)); + int seven = eight & 0x7f; + DECNRCM_codes cs = (eight >= 128) ? rightset : leftset; + int chr = eight; + + count++; +#if OPT_WIDE_CHARS + /* + * This is only partly right - prevent inadvertent remapping of + * the replacement character and other non-8bit codes into bogus + * 8bit codes. + */ + if (screen->utf8_mode || screen->utf8_nrc_mode) { + if (*s > 255) + continue; + } +#endif + if (*s < 32) + continue; + + switch (cs) { + case nrc_British_Latin_1: + /* FALLTHRU */ + case nrc_British: /* United Kingdom set (or Latin 1) */ + if ((xw->flags & NATIONAL) + || (screen->vtXX_level <= 1)) { + if ((xw->flags & NATIONAL)) { + chr = seven; + } + if (chr == 0x23) { + chr = XTERM_POUND; +#if OPT_WIDE_CHARS + if (screen->utf8_nrc_mode) { + chr = 0xa3; + } +#endif + } + } else { + chr = (seven | 0x80); + } + break; + + case nrc_DEC_Alt_Chars: + case nrc_DEC_Alt_Graphics: + case nrc_ASCII: + break; + + case nrc_DEC_Spec_Graphic: + if (seven > 0x5f && seven <= 0x7e) { +#if OPT_WIDE_CHARS + if (screen->utf8_mode || screen->utf8_nrc_mode) + chr = (int) dec2ucs(screen, (unsigned) (seven - 0x5f)); + else +#endif + chr = seven - 0x5f; + } else if (chr == 0x5f) { + chr = 0; + } else { + chr = seven; + } + break; + + case nrc_DEC_Supp: + map_DEC_Supp_Graphic(chr = seven, chr |= 0x80); + break; + + case nrc_DEC_Supp_Graphic: + map_DEC_Supp_Graphic(chr = seven, chr |= 0x80); + break; + + case nrc_DEC_Technical: + map_DEC_Technical(chr = seven); + break; + + case nrc_Dutch: + map_NRCS_Dutch(chr = seven); + break; + + case nrc_Finnish: + case nrc_Finnish2: + map_NRCS_Finnish(chr = seven); + break; + + case nrc_French: + case nrc_French2: + map_NRCS_French(chr = seven); + break; + + case nrc_French_Canadian: + case nrc_French_Canadian2: + map_NRCS_French_Canadian(chr = seven); + break; + + case nrc_German: + map_NRCS_German(chr = seven); + break; + + case nrc_Greek: + map_NRCS_Greek(chr = seven); /* FIXME - ELOT? */ + break; + + case nrc_DEC_Greek_Supp: + map_DEC_Greek_Supp(chr = seven); + break; + + case nrc_ISO_Greek_Supp: + map_ISO_Greek_Supp(chr = seven); + break; + + case nrc_DEC_Hebrew_Supp: + map_DEC_Hebrew_Supp(chr = seven); + break; + + case nrc_Hebrew: + map_NRCS_Hebrew(chr = seven); + break; + + case nrc_ISO_Hebrew_Supp: + map_ISO_Hebrew(chr = seven); + break; + + case nrc_Italian: + map_NRCS_Italian(chr = seven); + break; + + case nrc_ISO_Latin_5_Supp: + map_ISO_Latin_5(chr = seven); + break; + + case nrc_ISO_Latin_Cyrillic: + map_ISO_Latin_Cyrillic(chr = seven); + break; + + case nrc_Norwegian_Danish: + case nrc_Norwegian_Danish2: + case nrc_Norwegian_Danish3: + map_NRCS_Norwegian_Danish(chr = seven); + break; + + case nrc_Portugese: + map_NRCS_Portuguese(chr = seven); + break; + + case nrc_SCS_NRCS: /* vt5xx - probably Serbo/Croatian */ + /* FIXME */ + break; + + case nrc_Spanish: + map_NRCS_Spanish(chr = seven); + break; + + case nrc_Swedish2: + case nrc_Swedish: + map_NRCS_Swedish(chr = seven); + break; + + case nrc_Swiss: + map_NRCS_Swiss(chr = seven); + break; + + case nrc_Turkish: + map_NRCS_Turkish(chr = seven); + break; + + case nrc_DEC_Turkish_Supp: + map_DEC_Turkish_Supp(chr = seven); + break; + + case nrc_Cyrillic: + map_DEC_Cyrillic(chr = seven); + break; + + case nrc_Russian: + case nrc_Unknown: + default: /* any character sets we don't recognize */ + count--; + break; + } + /* + * The state machine already treated DEL as a nonprinting and + * nonspacing character. If we have DEL now, simply render + * it as a blank. + */ + if (chr == ANSI_DEL) + chr = ' '; + *s = (IChar) A2E(chr); + } + TRACE(("%d\t%s\n", + count, + visibleIChars(buf, (unsigned) (ptr - buf)))); + return count; +#undef MAP +#undef UNI +#undef XXX +} diff --git a/ports/xterm/xterm-359/charsets.o b/ports/xterm/xterm-359/charsets.o new file mode 100644 index 0000000..7a9066c Binary files /dev/null and b/ports/xterm/xterm-359/charsets.o differ diff --git a/ports/xterm/xterm-359/config.guess b/ports/xterm/xterm-359/config.guess new file mode 100755 index 0000000..e94095c --- /dev/null +++ b/ports/xterm/xterm-359/config.guess @@ -0,0 +1,1687 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2020 Free Software Foundation, Inc. + +timestamp='2020-07-12' + +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2020 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + break + fi + done + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac +} + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if test -f /.attbin/uname ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +case "$UNAME_SYSTEM" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" + + # If ldd exists, use it to detect musl libc. + if command -v ldd >/dev/null && \ + ldd --version 2>&1 | grep -q ^musl + then + LIBC=musl + fi + ;; +esac + +# 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 tuples: *-*-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. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + "/sbin/$sysctl" 2>/dev/null || \ + "/usr/sbin/$sysctl" 2>/dev/null || \ + echo unknown)` + case "$UNAME_MACHINE_ARCH" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine="${arch}${endian}"-unknown + ;; + *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently (or will in the future) and ABI. + case "$UNAME_MACHINE_ARCH" in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # Determine ABI tags. + case "$UNAME_MACHINE_ARCH" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "$UNAME_VERSION" in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "$machine-${os}${release}${abi-}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + exit ;; + *:OS108:*:*) + echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Twizzler:*:*) + echo "$UNAME_MACHINE"-unknown-twizzler + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos"$UNAME_RELEASE" + ;; + sun4) + echo sparc-sun-sunos"$UNAME_RELEASE" + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; + # 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 + # > 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. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + then + if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ + [ "$TARGET_BINARY_INTERFACE"x = x ] + then + echo m88k-dg-dgux"$UNAME_RELEASE" + else + echo m88k-dg-dguxbcs"$UNAME_RELEASE" + fi + else + echo i586-dg-dgux"$UNAME_RELEASE" + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[4567]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + case "$UNAME_MACHINE" in + 9000/31?) HP_ARCH=m68000 ;; + 9000/[34]??) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "$sc_cpu_version" in + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "$sc_kernel_bits" in + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "$HP_ARCH" = "" ]; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ "$HP_ARCH" = hppa2.0w ] + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux"$HPUX_REV" + exit ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo "$UNAME_MACHINE"-unknown-osf1mk + else + echo "$UNAME_MACHINE"-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:BSD/OS:*:*) + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + exit ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi + else + echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf + fi + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`/usr/bin/uname -p` + case "$UNAME_PROCESSOR" in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + i*:CYGWIN*:*) + echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) + echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) + echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) + echo "$UNAME_MACHINE"-pc-msys + exit ;; + i*:PW*:*) + echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) + case "$UNAME_MACHINE" in + x86) + echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) + echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; + i*:UWIN*:*) + echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-pc-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + exit ;; + *:GNU:*:*) + # the GNU system + echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + exit ;; + *:Minix:*:*) + echo "$UNAME_MACHINE"-unknown-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + ia64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m68*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-"$LIBC" + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sh*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; + x86_64:Linux:*:*) + set_cc_for_build + LIBCABI=$LIBC + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI="$LIBC"x32 + fi + fi + echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" + exit ;; + xtensa*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo "$UNAME_MACHINE"-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) + echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) + echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + else + echo "$UNAME_MACHINE"-pc-sysv32 + fi + exit ;; + 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 i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo "$UNAME_MACHINE"-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo "$UNAME_MACHINE"-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv"$UNAME_RELEASE" + else + echo mips-unknown-sysv"$UNAME_RELEASE" + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Rhapsody:*:*) + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + exit ;; + arm64:Darwin:*:*) + echo aarch64-apple-darwin"$UNAME_RELEASE" + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + # shellcheck disable=SC2154 + if test "$cputype" = 386; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) + echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "$UNAME_MACHINE" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + exit ;; + i*86:rdos:*:*) + echo "$UNAME_MACHINE"-pc-rdos + exit ;; + i*86:AROS:*:*) + echo "$UNAME_MACHINE"-pc-aros + exit ;; + x86_64:VMkernel:*:*) + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; + *:Unleashed:*:*) + echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" + exit ;; +esac + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); +#endif + +#if defined (vax) +#if !defined (ultrix) +#include +#if defined (BSD) +#if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +#else +#if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#endif +#else + printf ("vax-dec-bsd\n"); exit (0); +#endif +#else +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case "$UNAME_MACHINE:$UNAME_SYSTEM" in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&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 +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/ports/xterm/xterm-359/config.log b/ports/xterm/xterm-359/config.log new file mode 100644 index 0000000..4090e19 --- /dev/null +++ b/ports/xterm/xterm-359/config.log @@ -0,0 +1,2218 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by configure, which was +generated by GNU Autoconf 2.52.20200802. Invocation command line was + + $ ./configure --with-neXtaw --enable-toolbar + +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = commandante +uname -m = x86_64 +uname -r = 5.11.13-hardened1-hardened +uname -s = Linux +uname -v = #5 SMP PREEMPT Thu Apr 29 18:52:56 UTC 2021 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = unknown +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH = /bin:/sbin:/usr/bin:/usr/sbin + +## ------------ ## +## Core tests. ## +## ------------ ## + +configure:1103: PATH=".;."; conftest.sh +./configure[1111]: conftest.sh: not found +configure:1106: $? = 127 +configure:1148: checking build system type +configure:1166: result: x86_64-pc-linux-gnu +configure:1174: checking host system type +configure:1188: result: x86_64-pc-linux-gnu +configure:1214: result: Configuring for linux-gnu +configure:1280: checking for gcc +configure:1295: found /bin/gcc +configure:1303: result: gcc +configure:1531: checking for C compiler version +configure:1534: gcc --version &5 +gcc (GCC) 11.1.0 +Copyright (C) 2021 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:1537: $? = 0 +configure:1539: gcc -v &5 +Using built-in specs. +COLLECT_GCC=gcc +COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/lto-wrapper +Target: x86_64-pc-linux-gnu +Configured with: ../gcc/configure --prefix=/usr --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --disable-multilib --disable-symvers --disable-libmpx --disable-libmudflap --disable-libsanitizer --disable-werror --disable-fixed-point --disable-libstdcxx-pch --disable-nls --enable-checking=release --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-shared --enable-threads --enable-tls --enable-languages=c,c++ --without-included-gettext --with-system-zlib --build=x86_64-pc-linux-gnu --disable-bootstrap +Thread model: posix +Supported LTO compression algorithms: zlib zstd +gcc version 11.1.0 (GCC) +configure:1542: $? = 0 +configure:1544: gcc -V &5 +gcc: error: unrecognized command-line option '-V' +gcc: fatal error: no input files +compilation terminated. +configure:1547: $? = 1 +configure:1567: checking for C compiler default output +configure:1570: gcc conftest.c >&5 +configure:1573: $? = 0 +configure:1602: result: a.out +configure:1607: checking whether the C compiler works +configure:1613: ./a.out +configure:1616: $? = 0 +configure:1631: result: yes +configure:1638: checking whether we are cross compiling +configure:1640: result: no +configure:1643: checking for executable suffix +configure:1645: gcc -o conftest conftest.c >&5 +configure:1648: $? = 0 +configure:1670: result: +configure:1676: checking for object suffix +configure:1694: gcc -c conftest.c >&5 +configure:1697: $? = 0 +configure:1716: result: o +configure:1720: checking whether we are using the GNU C compiler +configure:1741: gcc -c conftest.c >&5 +configure:1744: $? = 0 +configure:1747: test -s conftest.o +configure:1750: $? = 0 +configure:1762: result: yes +configure:1768: checking whether gcc accepts -g +configure:1786: gcc -c -g conftest.c >&5 +configure:1789: $? = 0 +configure:1792: test -s conftest.o +configure:1795: $? = 0 +configure:1805: result: yes +configure:1832: gcc -c -g -O2 conftest.c >&5 +conftest.c:2:3: error: unknown type name 'choke' + 2 | choke me + | ^~~~~ +conftest.c:2:3: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input +configure:1835: $? = 1 +configure: failed program was: +#ifndef __cplusplus + choke me +#endif +configure:1936: checking version of gcc +configure:1940: result: 11.1.0 +configure:1949: checking if this is really Intel C compiler +configure:1971: gcc -c -g -O2 -no-gcc conftest.c >&5 +gcc: error: unrecognized command-line option '-no-gcc' +configure:1974: $? = 1 +configure: failed program was: +#line 1954 "configure" +#include "confdefs.h" + +int +main (void) +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +configure:1991: result: no +configure:2000: checking if this is really Clang C compiler +configure:2022: gcc -c -g -O2 -Qunused-arguments conftest.c >&5 +gcc: error: unrecognized command-line option '-Qunused-arguments' +configure:2025: $? = 1 +configure: failed program was: +#line 2005 "configure" +#include "confdefs.h" + +int +main (void) +{ + +#ifdef __clang__ +#else +make an error +#endif + + ; + return 0; +} +configure:2042: result: no +configure:2046: checking for gcc option to accept ANSI C +configure:2103: gcc -c -g -O2 conftest.c >&5 +configure:2106: $? = 0 +configure:2109: test -s conftest.o +configure:2112: $? = 0 +configure:2129: result: none needed +configure:2140: checking $CFLAGS variable +configure:2254: result: ok +configure:2259: checking $CC variable +configure:2394: result: ok +configure:2405: checking how to run the C preprocessor +configure:2431: gcc -E conftest.c +configure:2437: $? = 0 +configure:2464: gcc -E conftest.c +configure:2461:10: fatal error: ac_nonexistent.h: No such file or directory + 2461 | #include "confdefs.h" + | ^~~~~~~~~~~~ +compilation terminated. +configure:2470: $? = 1 +configure: failed program was: +#line 2460 "configure" +#include "confdefs.h" +#include +configure:2507: result: gcc -E +configure:2522: gcc -E conftest.c +configure:2528: $? = 0 +configure:2555: gcc -E conftest.c +configure:2552:10: fatal error: ac_nonexistent.h: No such file or directory + 2552 | #include "confdefs.h" + | ^~~~~~~~~~~~ +compilation terminated. +configure:2561: $? = 1 +configure: failed program was: +#line 2551 "configure" +#include "confdefs.h" +#include +configure:2605: checking for mawk +configure:2631: result: no +configure:2605: checking for gawk +configure:2631: result: no +configure:2605: checking for nawk +configure:2631: result: no +configure:2605: checking for awk +configure:2620: found /bin/awk +configure:2628: result: awk +configure:2650: checking for a BSD compatible install +configure:2699: result: /bin/install -c +configure:2710: checking whether ln -s works +configure:2714: result: yes +configure:2738: checking for lint +configure:2764: result: no +configure:2738: checking for cppcheck +configure:2764: result: no +configure:2738: checking for splint +configure:2764: result: no +configure:2779: checking if the POSIX test-macros are already defined +configure:2805: gcc -c -g -O2 conftest.c >&5 +configure:2808: $? = 0 +configure:2811: test -s conftest.o +configure:2814: $? = 0 +configure:2825: result: no +configure:2870: checking if this is the GNU C library +configure:2896: gcc -c -g -O2 conftest.c >&5 +configure:2899: $? = 0 +configure:2902: test -s conftest.o +configure:2905: $? = 0 +configure:2916: result: yes +configure:2924: checking if _DEFAULT_SOURCE can be used as a basis +configure:2955: gcc -c -g -O2 -D_DEFAULT_SOURCE conftest.c >&5 +configure:2958: $? = 0 +configure:2961: test -s conftest.o +configure:2964: $? = 0 +configure:2976: result: yes +configure:2981: checking if _XOPEN_SOURCE=700 works with _DEFAULT_SOURCE +configure:3106: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:3109: $? = 0 +configure:3112: test -s conftest.o +configure:3115: $? = 0 +configure:3126: result: yes +configure:4263: checking if _XOPEN_SOURCE really is set +configure:4281: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:4284: $? = 0 +configure:4287: test -s conftest.o +configure:4290: $? = 0 +configure:4299: result: yes +configure:4319: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:4322: $? = 0 +configure:4325: test -s conftest.o +configure:4328: $? = 0 +configure:4553: checking if SIGWINCH is defined +configure:4575: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:4578: $? = 0 +configure:4581: test -s conftest.o +configure:4584: $? = 0 +configure:4632: result: yes +configure:4714: checking for ncurses/curses.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4721:10: fatal error: ncurses/curses.h: No such file or directory + 4721 | #include "confdefs.h" + | ^~~~~~~~~~~~ +compilation terminated. +configure:4730: $? = 1 +configure: failed program was: +#line 4720 "configure" +#include "confdefs.h" +#include +configure:4749: result: no +configure:4714: checking for ncurses/term.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4721:10: fatal error: ncurses/term.h: No such file or directory + 4721 | #include "confdefs.h" + | ^~~~~~~~~~~~ +compilation terminated. +configure:4730: $? = 1 +configure: failed program was: +#line 4720 "configure" +#include "confdefs.h" +#include +configure:4749: result: no +configure:4714: checking for stdlib.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4730: $? = 0 +configure:4749: result: yes +configure:4714: checking for sys/ptem.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4721:10: fatal error: sys/ptem.h: No such file or directory + 4721 | #include "confdefs.h" + | ^~~~~~~~~~~~ +compilation terminated. +configure:4730: $? = 1 +configure: failed program was: +#line 4720 "configure" +#include "confdefs.h" +#include +configure:4749: result: no +configure:4714: checking for sys/ttydefaults.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4730: $? = 0 +configure:4749: result: yes +configure:4714: checking for term.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4730: $? = 0 +configure:4749: result: yes +configure:4714: checking for termios.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4730: $? = 0 +configure:4749: result: yes +configure:4714: checking for unistd.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4730: $? = 0 +configure:4749: result: yes +configure:4714: checking for wchar.h +configure:4724: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4730: $? = 0 +configure:4749: result: yes +configure:4759: checking whether time.h and sys/time.h may both be included +configure:4781: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:4784: $? = 0 +configure:4787: test -s conftest.o +configure:4790: $? = 0 +configure:4800: result: yes +configure:4810: checking for nl_langinfo and CODESET +configure:4828: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:4831: $? = 0 +configure:4834: test -s conftest +configure:4837: $? = 0 +configure:4848: result: yes +configure:4860: checking for signal global datatype +configure:4896: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:4899: $? = 0 +configure:4902: test -s conftest.o +configure:4905: $? = 0 +configure:4919: result: volatile sig_atomic_t +configure:4926: checking for ANSI C header files +configure:4940: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:4946: $? = 0 +configure:5033: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5036: $? = 0 +configure:5038: ./conftest +configure:5041: $? = 0 +configure:5054: result: yes +configure:5070: checking for sys/types.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for sys/stat.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for stdlib.h +configure:5101: result: yes +configure:5070: checking for string.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for memory.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for strings.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for inttypes.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for stdint.h +configure:5082: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5085: $? = 0 +configure:5088: test -s conftest.o +configure:5091: $? = 0 +configure:5101: result: yes +configure:5070: checking for unistd.h +configure:5101: result: yes +configure:5111: checking for time_t +configure:5132: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5135: $? = 0 +configure:5138: test -s conftest.o +configure:5141: $? = 0 +configure:5151: result: yes +configure:5163: checking for cc_t in or +configure:5190: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5193: $? = 0 +configure:5196: test -s conftest.o +configure:5199: $? = 0 +configure:5211: result: yes +configure:5218: checking for mode_t +configure:5239: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5242: $? = 0 +configure:5245: test -s conftest.o +configure:5248: $? = 0 +configure:5258: result: yes +configure:5270: checking for pid_t +configure:5291: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5294: $? = 0 +configure:5297: test -s conftest.o +configure:5300: $? = 0 +configure:5310: result: yes +configure:5322: checking for uid_t in sys/types.h +configure:5342: result: yes +configure:5356: checking for off_t +configure:5377: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5380: $? = 0 +configure:5383: test -s conftest.o +configure:5386: $? = 0 +configure:5396: result: yes +configure:5428: checking for gethostname +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for getusershell +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for endusershell +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for getlogin +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for initgroups +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for mkdtemp +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for putenv +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for unsetenv +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for sched_yield +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for setpgid +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for strftime +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5445:6: warning: conflicting types for built-in function 'strftime'; expected 'long unsigned int(char *, long unsigned int, const char *, const void *)' [-Wbuiltin-declaration-mismatch] + 5445 | builtin and then its argument prototype would still apply. */ + | ^~~~~~~~ +configure:5437:1: note: 'strftime' is declared in header '' + 5436 | #define $ac_func autoconf_temporary + +++ |+#include + 5437 | #include /* least-intrusive standard header which defines gcc2 __stub macros */ +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for tcgetattr +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for waitpid +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for wcswidth +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5428: checking for wcwidth +configure:5465: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5468: $? = 0 +configure:5471: test -s conftest +configure:5474: $? = 0 +configure:5484: result: yes +configure:5497: checking for lastlog.h +configure:5507: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:5513: $? = 0 +configure:5532: result: yes +configure:5497: checking for paths.h +configure:5507: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:5513: $? = 0 +configure:5532: result: yes +configure:5542: checking for lastlog path +configure:5569: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5572: $? = 0 +configure:5575: test -s conftest.o +configure:5578: $? = 0 +configure:5593: result: _PATH_LASTLOG +configure:5600: checking for utmp implementation +configure:5633: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5621:18: error: conflicting types for 'getutxent'; have 'struct utmp *(void)' + 5621 | main (void) + | ^ +In file included from configure:5620: +/usr/include/utmpx.h:65:22: note: previous declaration of 'getutxent' with type 'struct utmpx *(void)' + 65 | extern struct utmpx *getutxent (void); + | ^~~~~~~~~ +configure:5636: $? = 1 +configure: failed program was: +#line 5617 "configure" +#include "confdefs.h" + +#include +#include +#define getutent getutxent +#ifdef USE_LASTLOG +#include /* may conflict with utmpx.h on Linux */ +#endif + +int +main (void) +{ +struct utmpx x; + char *name = x.ut_name; /* utmp.h and compatible definitions */ + (void)x; + (void)name; + + ; + return 0; +} +configure:5667: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5655:18: error: conflicting types for 'getutxent'; have 'struct utmp *(void)' + 5655 | main (void) + | ^ +In file included from configure:5654: +/usr/include/utmpx.h:65:22: note: previous declaration of 'getutxent' with type 'struct utmpx *(void)' + 65 | extern struct utmpx *getutxent (void); + | ^~~~~~~~~ +configure:5670: $? = 1 +configure: failed program was: +#line 5651 "configure" +#include "confdefs.h" + +#include +#include +#define getutent getutxent +#ifdef USE_LASTLOG +#include /* may conflict with utmpx.h on Linux */ +#endif + +int +main (void) +{ +struct utmpx x; + char *name = x.ut_user; /* utmpx.h must declare this */ + (void)x; + (void)name; + + ; + return 0; +} +configure:5633: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5636: $? = 0 +configure:5639: test -s conftest.o +configure:5642: $? = 0 +configure:5691: result: utmp +configure:5706: checking if utmp.ut_host is declared +configure:5730: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5733: $? = 0 +configure:5736: test -s conftest.o +configure:5739: $? = 0 +configure:5751: result: yes +configure:5761: checking if utmp.ut_syslen is declared +configure:5785: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure: In function 'main': +configure:5776:12: error: 'struct utmp' has no member named 'ut_syslen' + 5776 | struct $cf_cv_have_utmp x; + | ^ +configure:5788: $? = 1 +configure: failed program was: +#line 5768 "configure" +#include "confdefs.h" + +#include +#include +int +main (void) +{ +struct utmp x; + int y = x.ut_syslen; + (void)x; + (void)y + ; + return 0; +} +configure:5806: result: no +configure:5816: checking if utmp.ut_name is declared +configure:5849: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5852: $? = 0 +configure:5855: test -s conftest.o +configure:5858: $? = 0 +configure:5870: result: ut_name +configure:5890: checking for exit-status in utmp +configure:5920: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure: In function 'main': +configure:5911:22: error: 'struct exit_status' has no member named '__e_exit'; did you mean 'e_exit'? + 5911 | struct $cf_cv_have_utmp x; + | ^~~~~ + | e_exit +configure:5923: $? = 1 +configure: failed program was: +#line 5903 "configure" +#include "confdefs.h" + +#include +#include +int +main (void) +{ +struct utmp x; + long y = x.ut_exit.__e_exit = 0; + (void)x; + (void)y + ; + return 0; +} +configure:5920: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5923: $? = 0 +configure:5926: test -s conftest.o +configure:5929: $? = 0 +configure:5942: result: ut_exit.e_exit +configure:5958: checking if utmp.ut_xtime is declared +configure:5982: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:5985: $? = 0 +configure:5988: test -s conftest.o +configure:5991: $? = 0 +configure:6038: result: yes +configure:6057: checking if utmp.ut_session is declared +configure:6081: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:6084: $? = 0 +configure:6087: test -s conftest.o +configure:6090: $? = 0 +configure:6101: result: yes +configure:6112: checking if utmp is SYSV flavor +configure:6139: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:6142: $? = 0 +configure:6145: test -s conftest +configure:6148: $? = 0 +configure:6159: result: yes +configure:6171: checking for lastlog.h +configure:6206: result: yes +configure:6216: checking for struct lastlog +configure:6241: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:6244: $? = 0 +configure:6246: ./conftest +configure:6249: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6227 "configure" +#include "confdefs.h" + +#include +#include +#include + +int main(void) +{ + struct lastlog data; + return (sizeof(data.ll_time) != sizeof(time_t)); +} +configure:6263: result: no +configure:6276: checking for sys/param.h +configure:6286: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:6292: $? = 0 +configure:6311: result: yes +configure:6321: checking if POSIX saved-ids are supported +configure:6358: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:6361: $? = 0 +configure:6364: test -s conftest +configure:6367: $? = 0 +configure:6419: result: yes +configure:6458: checking for termcap.h +configure:6468: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:6474: $? = 0 +configure:6493: result: yes +configure:6503: checking if we want full tgetent function +configure:6520: result: yes +configure:6529: checking for full tgetent function +configure:6585: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +/bin/ld: /tmp/ccol5N2X.o: in function `main': +/var/db/kiss/repos/kiss-mfavila/ports/xterm/xterm-359/configure:6580: undefined reference to `tgetent' +collect2: error: ld returned 1 exit status +configure:6588: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "vt100"); + return (buffer[0] == 0); } +no, there is no termcap/tgetent in +configure:6585: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lotermcap >&5 +/bin/ld: cannot find -lotermcap +collect2: error: ld returned 1 exit status +configure:6588: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "vt100"); + return (buffer[0] == 0); } +no, there is no termcap/tgetent in otermcap +configure:6585: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -ltermcap >&5 +/bin/ld: cannot find -ltermcap +collect2: error: ld returned 1 exit status +configure:6588: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "vt100"); + return (buffer[0] == 0); } +no, there is no termcap/tgetent in termcap +configure:6585: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -ltermlib >&5 +/bin/ld: cannot find -ltermlib +collect2: error: ld returned 1 exit status +configure:6588: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "vt100"); + return (buffer[0] == 0); } +no, there is no termcap/tgetent in termlib +configure:6585: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:6588: $? = 0 +configure:6590: ./conftest +configure:6593: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "vt100"); + return (buffer[0] == 0); } +no, there is no termcap/tgetent in ncurses +configure:6585: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lcurses >&5 +configure:6588: $? = 0 +configure:6590: ./conftest +configure:6593: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "vt100"); + return (buffer[0] == 0); } +no, there is no termcap/tgetent in curses +configure:6614: result: no +configure:6739: checking for partial tgetent function +configure:6761: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lotermcap >&5 +configure: In function 'main': +configure:6754:1: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration] + 6754 | { + | ^ +/bin/ld: cannot find -lotermcap +collect2: error: ld returned 1 exit status +configure:6764: $? = 1 +configure: failed program was: +#line 6749 "configure" +#include "confdefs.h" + +int +main (void) +{ +tgetent(0, "vt100") + ; + return 0; +} +configure:6761: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -ltermcap >&5 +configure: In function 'main': +configure:6754:1: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration] + 6754 | { + | ^ +/bin/ld: cannot find -ltermcap +collect2: error: ld returned 1 exit status +configure:6764: $? = 1 +configure: failed program was: +#line 6749 "configure" +#include "confdefs.h" + +int +main (void) +{ +tgetent(0, "vt100") + ; + return 0; +} +configure:6761: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -ltermlib >&5 +configure: In function 'main': +configure:6754:1: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration] + 6754 | { + | ^ +/bin/ld: cannot find -ltermlib +collect2: error: ld returned 1 exit status +configure:6764: $? = 1 +configure: failed program was: +#line 6749 "configure" +#include "confdefs.h" + +int +main (void) +{ +tgetent(0, "vt100") + ; + return 0; +} +configure:6761: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure: In function 'main': +configure:6754:1: warning: implicit declaration of function 'tgetent' [-Wimplicit-function-declaration] + 6754 | { + | ^ +configure:6764: $? = 0 +configure:6767: test -s conftest +configure:6770: $? = 0 +there is a terminfo/tgetent in ncurses +configure:6784: result: -lncurses +configure:6808: checking for termcap.h +configure:6843: result: yes +configure:6863: checking for X applications class +configure:6889: result: XTerm +configure:6892: checking for directory to install resource files +configure:6964: result: ${exec_prefix}/lib/X11/app-defaults +configure:6975: checking for the icon name +configure:6991: result: mini.xterm +configure:6994: checking for icon symlink to use +configure:7013: result: NONE +configure:7029: testing adding icons/filled-xterm to icon-list ... +configure:7029: testing adding icons/mini.xterm to icon-list ... +configure:7036: testing adding icons/mini.xterm_48x48 to icon-list ... +configure:7029: testing adding icons/xterm-color to icon-list ... +configure:7029: testing adding icons/xterm to icon-list ... +configure:7042: checking for directory to install pixmaps +configure:7100: result: ${datadir}/pixmaps +configure:7111: checking for directory to install icons +configure:7169: result: no +configure:7180: checking if icon theme should be used +configure:7198: result: no +configure:7231: checking for icon(s) to install +configure:7237: testing using .svg .png .xpm ... +configure:7312: result: icons/mini.xterm_48x48.png icons/mini.xterm_48x48.xpm +configure:7322: checking for icon name +configure:7324: result: mini.xterm +configure:7328: checking if you want to install desktop files +configure:7345: result: yes +configure:7352: checking for desktop-file-install +configure:7376: result: no +configure:7480: checking for install-permissions reference +configure:7490: result: xterm +configure:7495: checking for PATH separator +configure:7502: result: : +configure:7510: checking for xterm +configure:7527: found /bin/xterm +configure:7538: result: /bin/xterm +configure:7600: testing defining path for /bin/xterm ... +configure:7621: checking for symbolic link to create to xterm +configure:7631: result: xterm +configure:7640: checking if you want to disable openpty +configure:7657: result: no +configure:7660: checking if you want to disable setuid +configure:7677: result: no +configure:7680: checking if you want to disable setgid +configure:7697: result: no +configure:7700: checking if you want to run xterm setuid to a given user +configure:7710: result: no +configure:7723: checking if you want to run xterm setgid to match utmp/utmpx file +configure:7733: result: no +configure:7806: checking if you want to link with utempter +configure:7816: result: no +configure:7931: checking if external errno is declared +configure:7956: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:7959: $? = 0 +configure:7962: test -s conftest.o +configure:7965: $? = 0 +configure:7976: result: yes +configure:7991: checking if external errno exists +configure:8013: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +/bin/ld: errno: TLS definition in /usr/lib/libc.so.6 section .tbss mismatches non-TLS reference in /tmp/ccc7phrT.o +/bin/ld: /usr/lib/libc.so.6: error adding symbols: bad value +collect2: error: ld returned 1 exit status +configure:8016: $? = 1 +configure: failed program was: +#line 7998 "configure" +#include "confdefs.h" + +#undef errno +extern int errno; + +int +main (void) +{ +errno = 2 + ; + return 0; +} +configure:8033: result: no +configure:8046: checking for explicit tty group name +configure:8058: result: auto... +configure:8062: checking for tty group name +configure:8115: result: midfavil +configure:8135: checking if we may use the midfavil group +configure:8174: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:8177: $? = 0 +configure:8179: ./conftest +configure:8182: $? = 1 +configure: program exited with status 1 +configure: failed program was: +#line 8148 "configure" +#include "confdefs.h" + +#include +#include +#include +#include +int main(void) +{ + struct stat sb; + struct group *ttygrp = getgrnam(TTY_GROUP_NAME); + char *name = ttyname(0); + + endgrent(); + if (ttygrp != 0 + && name != 0 + && stat(name, &sb) == 0 + && sb.st_gid != getgid() + && sb.st_gid == ttygrp->gr_gid) { + return (0); + } + return (1); +} + +configure:8200: result: no +configure:8204: WARNING: Cannot use midfavil group +configure:8215: checking for X +configure:8323: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:8329: $? = 0 +configure:8431: result: libraries /usr/lib64, headers +configure:8570: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses -L/usr/lib64 -lX11 >&5 +configure:8573: $? = 0 +configure:8576: test -s conftest +configure:8579: $? = 0 +configure:8705: checking for gethostbyname +configure:8742: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:8745: $? = 0 +configure:8748: test -s conftest +configure:8751: $? = 0 +configure:8761: result: yes +configure:8882: checking for connect +configure:8919: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:8922: $? = 0 +configure:8925: test -s conftest +configure:8928: $? = 0 +configure:8938: result: yes +configure:8998: checking for remove +configure:9035: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:9038: $? = 0 +configure:9041: test -s conftest +configure:9044: $? = 0 +configure:9054: result: yes +configure:9114: checking for shmat +configure:9151: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:9154: $? = 0 +configure:9157: test -s conftest +configure:9160: $? = 0 +configure:9170: result: yes +configure:9239: checking for IceConnectionNumber in -lICE +configure:9266: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -L/usr/lib64 conftest.c -lICE -lncurses >&5 +configure:9269: $? = 0 +configure:9272: test -s conftest +configure:9275: $? = 0 +configure:9286: result: yes +configure:9296: checking for sys/wait.h that is POSIX.1 compatible +configure:9324: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:9327: $? = 0 +configure:9330: test -s conftest.o +configure:9333: $? = 0 +configure:9343: result: yes +configure:9353: checking for POSIX wait functions +configure:9385: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +configure:9388: $? = 0 +configure:9391: test -s conftest +configure:9394: $? = 0 +configure:9405: result: yes +configure:9412: checking if external sys_nerr is declared +configure:9437: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure: In function 'main': +configure:9430:15: error: 'sys_nerr' undeclared (first use in this function) + 9430 | { + | ^ +configure:9430:15: note: each undeclared identifier is reported only once for each function it appears in +configure:9440: $? = 1 +configure: failed program was: +#line 9419 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include +int +main (void) +{ +int x = (int) sys_nerr; (void)x + ; + return 0; +} +configure:9457: result: no +configure:9472: checking if external sys_nerr exists +configure:9494: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +/bin/ld: /tmp/ccZOGNLH.o: warning: relocation against `sys_nerr' in read-only section `.text.startup' +/bin/ld: /tmp/ccZOGNLH.o: in function `main': +/var/db/kiss/repos/kiss-mfavila/ports/xterm/xterm-359/configure:9487: undefined reference to `sys_nerr' +/bin/ld: warning: creating DT_TEXTREL in a PIE +collect2: error: ld returned 1 exit status +configure:9497: $? = 1 +configure: failed program was: +#line 9479 "configure" +#include "confdefs.h" + +#undef sys_nerr +extern int sys_nerr; + +int +main (void) +{ +sys_nerr = 2 + ; + return 0; +} +configure:9514: result: no +configure:9527: checking if external sys_errlist is declared +configure:9552: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure: In function 'main': +configure:9545:15: error: 'sys_errlist' undeclared (first use in this function) + 9545 | { + | ^ +configure:9545:15: note: each undeclared identifier is reported only once for each function it appears in +configure:9555: $? = 1 +configure: failed program was: +#line 9534 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include +int +main (void) +{ +int x = (int) sys_errlist; (void)x + ; + return 0; +} +configure:9572: result: no +configure:9587: checking if external sys_errlist exists +configure:9609: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lncurses >&5 +/bin/ld: /tmp/ccgu9C5I.o: warning: relocation against `sys_errlist' in read-only section `.text.startup' +/bin/ld: /tmp/ccgu9C5I.o: in function `main': +/var/db/kiss/repos/kiss-mfavila/ports/xterm/xterm-359/configure:9602: undefined reference to `sys_errlist' +/bin/ld: warning: creating DT_TEXTREL in a PIE +collect2: error: ld returned 1 exit status +configure:9612: $? = 1 +configure: failed program was: +#line 9594 "configure" +#include "confdefs.h" + +#undef sys_errlist +extern int sys_errlist; + +int +main (void) +{ +sys_errlist = 2 + ; + return 0; +} +configure:9629: result: no +configure:9665: checking for termios.h +configure:9700: result: yes +configure:9665: checking for stdlib.h +configure:9700: result: yes +configure:9665: checking for X11/Intrinsic.h +configure:9675: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:9681: $? = 0 +configure:9700: result: yes +configure:9710: checking if we should define SYSV +configure:9761: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:9736:10: fatal error: sys/termio.h: No such file or directory + 9736 | #include /* declare sys_errlist on older systems */ + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ +compilation terminated. +configure:9764: $? = 1 +configure: failed program was: +#line 9717 "configure" +#include "confdefs.h" + +#undef SYSV +#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ +#ifdef HAVE_STDLIB_H +#include /* look for wchar_t */ +#endif +#ifdef HAVE_X11_INTRINSIC_H +#include /* Intrinsic.h has other traps... */ +#endif +#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ +#include +#define STRUCT_TERMIOS struct termios +#else +#define STRUCT_TERMIOS struct termio +#endif +#include +#include /* eliminate most BSD hacks */ +#include /* declare sys_errlist on older systems */ +#include /* eliminate most of the remaining ones */ + +int +main (void) +{ + +static STRUCT_TERMIOS d_tio; + d_tio.c_cc[VINTR] = 0; + d_tio.c_cc[VQUIT] = 0; + d_tio.c_cc[VERASE] = 0; + d_tio.c_cc[VKILL] = 0; + d_tio.c_cc[VEOF] = 0; + d_tio.c_cc[VEOL] = 0; + d_tio.c_cc[VMIN] = 0; + d_tio.c_cc[VTIME] = 0; +#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) +sys_errlist[0] = ""; /* Cygwin mis-declares this */ +#endif + + ; + return 0; +} +configure:9781: result: no +configure:9792: checking for elf_begin in -lelf +configure:9819: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lelf -lncurses >&5 +configure:9822: $? = 0 +configure:9825: test -s conftest +configure:9828: $? = 0 +configure:9839: result: yes +configure:9843: checking if this is an SVR4 system +configure:9879: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:9856:10: fatal error: sys/termio.h: No such file or directory + 9856 | #include + | ^~~~~~~ +compilation terminated. +configure:9882: $? = 1 +configure: failed program was: +#line 9850 "configure" +#include "confdefs.h" + +#if defined(__CYGWIN__) +make an error +#endif +#include +#include + +int +main (void) +{ + +static struct termio d_tio; + d_tio.c_cc[VINTR] = 0; + d_tio.c_cc[VQUIT] = 0; + d_tio.c_cc[VERASE] = 0; + d_tio.c_cc[VKILL] = 0; + d_tio.c_cc[VEOF] = 0; + d_tio.c_cc[VEOL] = 0; + d_tio.c_cc[VMIN] = 0; + d_tio.c_cc[VTIME] = 0; + d_tio.c_cc[VLNEXT] = 0; + + ; + return 0; +} +configure:9899: result: no +configure:9909: checking if you want to use pkg-config +configure:9919: result: yes +configure:9971: checking for pkg-config +configure:9988: found /bin/pkg-config +configure:10000: result: /bin/pkg-config +configure:10623: testing found package xt ... +configure:10629: testing package xt CFLAGS: ... +configure:10633: testing package xt LIBS: -lXt -lX11 ... +configure:10958: checking for usable X Toolkit package +configure:10980: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:10983: $? = 0 +configure:10986: test -s conftest +configure:10989: $? = 0 +configure:10999: result: yes +configure:11745: checking for X11/DECkeysym.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11745: checking for X11/Sunkeysym.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11745: checking for X11/XF86keysym.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11745: checking for X11/XKBlib.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11745: checking for X11/TranslateI.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11745: checking for X11/Xpoll.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11745: checking for X11/extensions/XKB.h +configure:11755: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11761: $? = 0 +configure:11780: result: yes +configure:11795: checking if you want to use the Xpm library for colored icon +configure:11805: result: yes +configure:11813: checking for X11/xpm.h +configure:11823: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:11829: $? = 0 +configure:11848: result: yes +configure:11852: checking for XpmCreatePixmapFromData in -lXpm +configure:11879: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lXpm -lX11 -L/usr/lib64 -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:11882: $? = 0 +configure:11885: test -s conftest +configure:11888: $? = 0 +configure:11899: result: yes +configure:11919: checking if you want to use the Xinerama extension +configure:11929: result: yes +configure:11936: testing found package xinerama ... +configure:11942: testing package xinerama CFLAGS: ... +configure:11946: testing package xinerama LIBS: -lXinerama ... +configure:12195: checking if you want to link with Xaw 3d library +configure:12209: result: no +configure:12213: checking if you want to link with Xaw 3d xft library +configure:12227: result: no +configure:12231: checking if you want to link with neXT Athena library +configure:12242: result: yes +configure:12249: checking if you want to link with Athena-Plus library +configure:12263: result: no +configure:12808: checking for XextCreateExtension in -lXext +configure:12835: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:12838: $? = 0 +configure:12841: test -s conftest +configure:12844: $? = 0 +configure:12855: result: yes +configure:13445: testing found package xt ... +configure:13451: testing package xt CFLAGS: ... +configure:13455: testing package xt LIBS: -lXt -lX11 ... +configure:13780: checking for usable X Toolkit package +configure:13821: result: yes +configure:14592: checking for X11/neXtaw/SimpleMenu.h +configure:14610: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:14613: $? = 0 +configure:14616: test -s conftest.o +configure:14619: $? = 0 +configure:14628: result: yes +configure:14709: checking for XawSimpleMenuAddGlobalActions in -lneXtaw -lXmu +configure:14728: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses -lSM -lICE -L/usr/lib64 >&5 +configure:14731: $? = 0 +configure:14734: test -s conftest +configure:14737: $? = 0 +configure:14746: result: yes +configure:14795: checking for X11/Xpoll.h +configure:14830: result: yes +configure:14840: checking for declaration of fd_set +configure:14846: testing sys/types alone ... +configure:14862: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:14865: $? = 0 +configure:14868: test -s conftest.o +configure:14871: $? = 0 +configure:14952: result: sys/types.h +configure:14962: checking for declaration of fd_mask +configure:15041: result: sys/types.h +configure:15051: checking for IRIX 6.5 baud-rate redefinitions +configure:15077: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:15061:10: fatal error: sys/termio.h: No such file or directory +15061 | #include + | ^~~~~~~~~~~~~ +compilation terminated. +configure:15080: $? = 1 +configure: failed program was: +#line 15058 "configure" +#include "confdefs.h" + +#include +#include +int +main (void) +{ + +struct termio foo; +foo.c_ispeed = B38400; +foo.c_ospeed = B9600; +(void)foo; + + ; + return 0; +} +configure:15098: result: no +configure:15105: checking for termios type tcflag_t +configure:15125: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:15128: $? = 0 +configure:15131: test -s conftest.o +configure:15134: $? = 0 +configure:15145: result: yes +configure:15152: checking for termios type speed_t +configure:15172: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:15175: $? = 0 +configure:15178: test -s conftest.o +configure:15181: $? = 0 +configure:15192: result: yes +configure:15199: checking for termios type cc_t +configure:15219: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:15222: $? = 0 +configure:15225: test -s conftest.o +configure:15228: $? = 0 +configure:15239: result: yes +configure:15247: checking for XcursorGetTheme in -lXcursor +configure:15274: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lXcursor -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15277: $? = 0 +configure:15280: test -s conftest +configure:15283: $? = 0 +configure:15294: result: yes +configure:15311: checking for stropts.h +configure:15321: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:15318:10: fatal error: stropts.h: No such file or directory +15318 | #include "confdefs.h" + | ^~~~~~~~~~~ +compilation terminated. +configure:15327: $? = 1 +configure: failed program was: +#line 15317 "configure" +#include "confdefs.h" +#include +configure:15346: result: no +configure:15376: checking for grantpt +configure:15413: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15416: $? = 0 +configure:15419: test -s conftest +configure:15422: $? = 0 +configure:15432: result: yes +configure:15376: checking for ptsname +configure:15413: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15416: $? = 0 +configure:15419: test -s conftest +configure:15422: $? = 0 +configure:15432: result: yes +configure:15376: checking for posix_openpt +configure:15413: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15416: $? = 0 +configure:15419: test -s conftest +configure:15422: $? = 0 +configure:15432: result: yes +configure:15444: checking if grantpt really works +configure:15548: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15551: $? = 0 +configure:15554: test -s conftest +configure:15557: $? = 0 +configure:15663: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15666: $? = 0 +configure:15668: ./conftest +configure:15671: $? = 0 +configure:15690: result: yes +configure:15696: checking for pty features +configure:15712: testing pty feature test 4:5 ... +configure:15821: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15824: $? = 0 +configure:15826: ./conftest +configure:15829: $? = 0 +configure:15712: testing pty feature test 5:5 ... +configure:15821: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15824: $? = 0 +configure:15826: ./conftest +configure:15829: $? = 0 +configure:15712: testing pty feature test 6:5 ... +configure:15821: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15824: $? = 0 +configure:15826: ./conftest +configure:15829: $? = 0 +configure:15880: result: pty_isatty pty_tcsetattr tty_tcsetattr +configure:15893: checking for openpty in -lutil +configure:15920: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:15923: $? = 0 +configure:15926: test -s conftest +configure:15929: $? = 0 +configure:15940: result: yes +configure:15963: checking for util.h +configure:15973: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:15970:10: fatal error: util.h: No such file or directory +15970 | #include "confdefs.h" + | ^~~~~~~~ +compilation terminated. +configure:15979: $? = 1 +configure: failed program was: +#line 15969 "configure" +#include "confdefs.h" +#include +configure:15998: result: no +configure:15963: checking for libutil.h +configure:15973: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:15970:10: fatal error: libutil.h: No such file or directory +15970 | #include "confdefs.h" + | ^~~~~~~~~~~ +compilation terminated. +configure:15979: $? = 1 +configure: failed program was: +#line 15969 "configure" +#include "confdefs.h" +#include +configure:15998: result: no +configure:15963: checking for pty.h +configure:15973: gcc -E -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c +configure:15979: $? = 0 +configure:15998: result: yes +configure:16041: testing will rely upon openpty ... +configure:16045: checking if we can use XkbQueryExtension +configure:16081: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:16084: $? = 0 +configure:16087: test -s conftest.o +configure:16090: $? = 0 +configure:16105: result: yes +configure:16114: checking for XkbQueryExtension +configure:16151: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:16154: $? = 0 +configure:16157: test -s conftest +configure:16160: $? = 0 +configure:16170: result: yes +configure:16182: checking if we can use XkbKeycodeToKeysym +configure:16207: gcc -c -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c >&5 +configure:16210: $? = 0 +configure:16213: test -s conftest.o +configure:16216: $? = 0 +configure:16231: result: yes +configure:16240: checking for XkbKeycodeToKeysym +configure:16277: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:16280: $? = 0 +configure:16283: test -s conftest +configure:16286: $? = 0 +configure:16296: result: yes +configure:16324: checking for XKB Bell extension +configure:16352: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses -lSM -lICE -L/usr/lib64 >&5 +configure: In function 'main': +configure:16344:31: warning: passing argument 2 of 'XkbBell' makes integer from pointer without a cast [-Wint-conversion] +16344 | (void)x; + | ^ + | | + | struct _WidgetRec * +In file included from configure:16334: +/usr/include/X11/XKBlib.h:457:9: note: expected 'Window' {aka 'long unsigned int'} but argument is of type 'struct _WidgetRec *' + 457 | Window /* win */, + | ^~~~~~ +configure:16355: $? = 0 +configure:16358: test -s conftest +configure:16361: $? = 0 +configure:16372: result: yes +configure:16386: checking for Xutf8LookupString +configure:16423: gcc -o conftest -g -O2 -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 conftest.c -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:16426: $? = 0 +configure:16429: test -s conftest +configure:16432: $? = 0 +configure:16442: result: yes +configure:16458: checking if you want narrow prototypes for X libraries +configure:16484: result: yes +configure:16487: checking if we should use imake to help +configure:16504: result: yes +configure:16513: checking for xmkmf +configure:16530: found /bin/xmkmf +configure:16541: result: /bin/xmkmf +configure:16604: testing Using /bin/xmkmf ... +configure:16699: testing IMAKE_CFLAGS -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DUSE_TERMINFO -DHAVE_TIGETSTR -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -DPROJECTROOT='"/usr"' -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -D__vendorversion__='"Version 7.7.0 X.Org"' -I/usr/include ... +configure:16703: testing IMAKE_LOADFLAGS ... +configure:16959: checking for groff +configure:16976: found /bin/groff +configure:16988: result: /bin/groff +configure:16999: checking for nroff +configure:17016: found /bin/nroff +configure:17027: result: /bin/nroff +configure:17040: checking for tbl +configure:17057: found /bin/tbl +configure:17069: result: /bin/tbl +configure:17092: checking for man2html +configure:17121: result: no +configure:17148: checking for program to convert manpage to html +configure:17207: result: /bin/groff +configure:17356: testing removing terminfo flags from IMAKE_CFLAGS ... +configure:17361: testing ...result -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -DPROJECTROOT='"/usr"' -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -D__vendorversion__='"Version 7.7.0 X.Org"' -I/usr/include ... +configure:17365: testing removing terminfo flags from CPPFLAGS ... +configure:17370: testing ...result -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include ... +configure:17376: checking for default terminal-id +configure:17386: result: vt420 +configure:17397: checking for default terminal-type +configure:17407: result: xterm +configure:17415: checking if backarrow-key should be BS +configure:17433: result: yes +configure:17454: checking if backarrow-key should be treated as erase +configure:17472: result: no +configure:17493: checking for default backspace/DEL setting +configure:17504: result: maybe +configure:17525: checking for default pty initial erase setting +configure:17536: result: False +configure:17557: checking if alt should send ESC +configure:17575: result: no +configure:17596: checking if meta should send ESC +configure:17614: result: no +configure:17638: checking for tic +configure:17653: found /bin/tic +configure:17662: result: yes +configure:17681: checking for private terminfo-directory +configure:17691: result: none +configure:17746: checking if you want active-icons +configure:17763: result: yes +configure:17773: checking if you want ANSI color +configure:17790: result: yes +configure:17799: checking if you want 16 colors like aixterm +configure:17816: result: yes +configure:17823: checking if you want 256 colors +configure:17840: result: yes +configure:17852: checking if you want direct-color support +configure:17869: result: yes +configure:17914: checking if you want blinking cursor +configure:17931: result: yes +configure:17938: checking if you want to ignore Linux's broken palette-strings +configure:17962: result: yes +configure:17978: checking if you want to allow broken string-terminators +configure:17995: result: yes +configure:18002: checking if you want to compile-in icon data +configure:18019: result: no +configure:18026: checking if you want printable 128-159 +configure:18043: result: yes +configure:18052: checking if you want bold colors mapped like IBM PC +configure:18069: result: yes +configure:18076: checking if you want separate color-classes +configure:18093: result: yes +configure:18100: checking if you want color-mode enabled by default +configure:18117: result: yes +configure:18126: checking if you want support for color highlighting +configure:18143: result: yes +configure:18150: checking if you want support for doublesize characters +configure:18167: result: yes +configure:18174: checking if you want fallback-support for box characters +configure:18191: result: yes +configure:18198: checking if you want to allow spawning new xterms +configure:18215: result: no +configure:18391: checking for XextCreateExtension in -lXext +configure:18438: result: yes +configure:18462: checking for X11/extensions/Xdbe.h +configure:18472: gcc -E -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include conftest.c +configure:18478: $? = 0 +configure:18497: result: yes +configure:18505: checking for XdbeSwapBuffers +configure:18542: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include conftest.c -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:18545: $? = 0 +configure:18548: test -s conftest +configure:18551: $? = 0 +configure:18561: result: yes +configure:18576: checking if you want to enable double-buffering in default resources +configure:18593: result: no +configure:18605: checking if you want to use FreeType library +configure:18622: result: yes +configure:18632: checking for FreeType configuration script +configure:18644: result: auto +configure:18824: checking for FreeType config +configure:18826: result: /bin/pkg-config xft +configure:18830: checking for /bin/pkg-config cflags +configure:18833: result: -I/usr/include/freetype2 -I/usr/include/libpng16 +configure:18838: checking for /bin/pkg-config libs +configure:18841: result: -lXft +configure:18854: checking if we can link with FreeType libraries +configure:18895: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:18898: $? = 0 +configure:18901: test -s conftest +configure:18904: $? = 0 +configure:18913: result: yes +configure:19046: checking for XftDrawCharSpec +configure:19083: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:19086: $? = 0 +configure:19089: test -s conftest +configure:19092: $? = 0 +configure:19102: result: yes +configure:19046: checking for XftDrawSetClip +configure:19083: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:19086: $? = 0 +configure:19089: test -s conftest +configure:19092: $? = 0 +configure:19102: result: yes +configure:19046: checking for XftDrawSetClipRectangles +configure:19083: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:19086: $? = 0 +configure:19089: test -s conftest +configure:19092: $? = 0 +configure:19102: result: yes +configure:19121: checking for usable Xft/fontconfig package +configure:19147: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +/bin/ld: /tmp/ccaVmhzp.o: undefined reference to symbol 'FcPatternBuild' +/bin/ld: /usr/lib/libfontconfig.so.1: error adding symbols: DSO missing from command line +collect2: error: ld returned 1 exit status +configure:19150: $? = 1 +configure: failed program was: +#line 19128 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + + XftPattern *pat = 0; + XftPatternBuild(pat, + XFT_FAMILY, XftTypeString, "mono", + (void *) 0); + + ; + return 0; +} +configure:19167: result: no +configure:19179: testing work around broken package ... +configure:19186: testing found package fontconfig ... +configure:19192: testing package fontconfig CFLAGS: -I/usr/include/freetype2 -I/usr/include/libpng16 ... +configure:19196: testing package fontconfig LIBS: -lfontconfig -lfreetype ... +configure:19414: testing ...before -lXft -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses ... +configure:19419: testing ...after -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses ... +configure:19445: checking if you want support for HP-style function keys +configure:19462: result: no +configure:19472: checking if you want support for SCO-style function keys +configure:19489: result: no +configure:19499: checking if you want support for Sun-style function keys +configure:19516: result: yes +configure:19526: checking if you want saved-lines stored as a FIFO +configure:19543: result: yes +configure:19553: checking if you want support for internationalization +configure:19570: result: yes +configure:19580: checking if you want support for initial-erase setup +configure:19597: result: yes +configure:19607: checking if you want support for input-method +configure:19624: result: yes +configure:19627: checking if X libraries support input-method +configure:19668: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:19671: $? = 0 +configure:19674: test -s conftest +configure:19677: $? = 0 +configure:19687: result: yes +configure:19706: checking if you want support for load-vt-fonts +configure:19723: result: no +configure:19733: checking if you want support for logging +configure:19750: result: no +configure:19786: checking if you want support for iconify/maximize translations +configure:19803: result: yes +configure:19810: checking if you want NumLock to override keyboard tables +configure:19827: result: yes +configure:19834: checking if you want support for get/set of base64 selection data +configure:19851: result: yes +configure:19867: checking if you want support for pty-handshaking +configure:19884: result: yes +configure:19900: checking if you want support for mouse in readline applications +configure:19917: result: no +configure:19927: checking if you want support for regular-expression selections +configure:19944: result: yes +configure:19948: checking if you want to use PCRE2 for regular-expressions +configure:19957: result: no +configure:20446: checking if you want to use PCRE for regular-expressions +configure:20455: result: no +configure:20832: checking for regcomp +configure:20869: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:20872: $? = 0 +configure:20875: test -s conftest +configure:20878: $? = 0 +configure:20888: result: yes +configure:21114: checking for regular-expression headers +configure:21189: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:21192: $? = 0 +configure:21195: test -s conftest +configure:21198: $? = 0 +configure:21214: result: regex.h +configure:21251: checking if you want support for right-scrollbar +configure:21268: result: yes +configure:21278: checking if you want check for redundant name-change +configure:21295: result: yes +configure:21302: checking if you want support for selection-actions +configure:21319: result: yes +configure:21326: checking if you want support for session management +configure:21343: result: yes +configure:21350: checking if you want to use termcap function-keys +configure:21367: result: yes +configure:21374: checking if you want to use termcap-query/report +configure:21391: result: yes +configure:21398: checking if you want support for tek4014 +configure:21415: result: yes +configure:21429: checking if you want pulldown menus with a toolbar +configure:21446: result: yes +configure:21456: checking if you want VT52 emulation +configure:21473: result: yes +configure:21480: checking if you want wide-attribute support +configure:21497: result: yes +configure:21506: checking if you want wide-character support +configure:21523: result: yes +configure:21530: checking if you want only 16-bit character support +configure:21547: result: no +configure:21561: checking if you want to use mini-luit/Latin9 built-in support +configure:21578: result: no +configure:21588: checking if you want to use luit +configure:21605: result: yes +configure:21618: checking for xterm-filter +configure:21649: result: no +configure:21618: checking for xterm-filter +configure:21649: result: no +configure:21618: checking for bluit +configure:21649: result: no +configure:21618: checking for luit +configure:21649: result: no +configure:21732: checking if you want dynamic-abbreviation support +configure:21749: result: no +configure:21759: checking if you want DECterm Locator support +configure:21776: result: no +configure:21786: checking if you want XHTML and SVG screen dump support +configure:21803: result: yes +configure:21816: checking if you want ReGIS graphics support +configure:21833: result: no +configure:21912: checking if you want sixel graphics support +configure:21929: result: yes +configure:21953: checking if you want VT420 rectangle support +configure:21970: result: yes +configure:21980: checking if you want -ziconbeep option +configure:21997: result: yes +configure:22006: checking if you want debugging traces +configure:22023: result: no +configure:22035: checking if you want to use dmalloc for testing +configure:22052: result: no +configure:22267: checking if you want to use dbmalloc for testing +configure:22284: result: no +configure:22499: checking if you want to use valgrind for testing +configure:22516: result: no +configure:22629: checking if you want to perform memory-leak testing +configure:22639: result: no +configure:22654: checking if you want to see long compiling messages +configure:22688: result: yes +configure:22691: checking if you want magic cookie emulation +configure:22708: result: no +configure:22723: checking for tigetstr +configure:22760: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:22763: $? = 0 +configure:22766: test -s conftest +configure:22769: $? = 0 +configure:22779: result: yes +configure:22794: checking for use_extended_names +configure:22831: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:22834: $? = 0 +configure:22837: test -s conftest +configure:22840: $? = 0 +configure:22850: result: yes +configure:22863: checking if you want to turn on gcc warnings +configure:22880: result: no +configure:23287: checking if filesystem supports mixed-case filenames +configure:23314: result: yes +configure:23325: checking for exctags +configure:23351: result: no +configure:23325: checking for ctags +configure:23351: result: no +configure:23362: checking for exetags +configure:23388: result: no +configure:23362: checking for etags +configure:23388: result: no +configure:23397: checking for ctags +configure:23421: result: no +configure:23431: checking for etags +configure:23455: result: no +configure:23481: checking for an rpath option +configure:23512: result: -Wl,-rpath, +configure:23576: checking if rpath-hack should be disabled +configure:23593: result: no +configure:23597: checking for updated LDFLAGS +configure:23600: result: maybe +configure:23607: checking for ldd +configure:23622: found /bin/ldd +configure:23630: result: ldd +configure:23659: gcc -o conftest -g -O2 -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16 conftest.c -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses >&5 +configure:23662: $? = 0 +configure:23665: test -s conftest +configure:23668: $? = 0 +configure:23708: testing ...checking EXTRA_LDFLAGS ... +configure:23712: testing ...checking LDFLAGS ... +configure:23762: testing ...checked LDFLAGS ... +configure:23766: testing ...checking LIBS -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses ... +configure:23816: testing ...checked LIBS -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses ... +configure:23820: testing ...checked EXTRA_LDFLAGS ... +configure:23918: creating ./config.status + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by config.status 2.52.20200802, executed with + CONFIG_FILES = + CONFIG_HEADERS = + CONFIG_LINKS = + CONFIG_COMMANDS = + > ./config.status +on commandante + +config.status:24464: creating Makefile +config.status:24464: creating df-install +config.status:24464: creating minstall +config.status:24617: creating xtermcfg.h + +## ----------------- ## +## Cache variables. ## +## ----------------- ## + +ac_cv_build=x86_64-pc-linux-gnu +ac_cv_build_alias=x86_64-pc-linux-gnu +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_func_XdbeSwapBuffers=yes +ac_cv_func_XftDrawCharSpec=yes +ac_cv_func_XftDrawSetClip=yes +ac_cv_func_XftDrawSetClipRectangles=yes +ac_cv_func_XkbKeycodeToKeysym=yes +ac_cv_func_XkbQueryExtension=yes +ac_cv_func_Xutf8LookupString=yes +ac_cv_func_connect=yes +ac_cv_func_endusershell=yes +ac_cv_func_gethostbyname=yes +ac_cv_func_gethostname=yes +ac_cv_func_getlogin=yes +ac_cv_func_getusershell=yes +ac_cv_func_grantpt=no +ac_cv_func_initgroups=yes +ac_cv_func_mkdtemp=yes +ac_cv_func_posix_openpt=yes +ac_cv_func_ptsname=yes +ac_cv_func_putenv=yes +ac_cv_func_regcomp=yes +ac_cv_func_remove=yes +ac_cv_func_sched_yield=yes +ac_cv_func_setpgid=yes +ac_cv_func_shmat=yes +ac_cv_func_strftime=yes +ac_cv_func_tcgetattr=yes +ac_cv_func_tigetstr=yes +ac_cv_func_unsetenv=yes +ac_cv_func_use_extended_names=yes +ac_cv_func_waitpid=yes +ac_cv_func_wcswidth=yes +ac_cv_func_wcwidth=yes +ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries=/usr/lib64' +ac_cv_header_X11_DECkeysym_h=yes +ac_cv_header_X11_Intrinsic_h=yes +ac_cv_header_X11_Sunkeysym_h=yes +ac_cv_header_X11_TranslateI_h=yes +ac_cv_header_X11_XF86keysym_h=yes +ac_cv_header_X11_XKBlib_h=yes +ac_cv_header_X11_Xpoll_h=yes +ac_cv_header_X11_extensions_XKB_h=yes +ac_cv_header_X11_extensions_Xdbe_h=yes +ac_cv_header_X11_xpm_h=yes +ac_cv_header_inttypes_h=yes +ac_cv_header_lastlog_h=yes +ac_cv_header_libutil_h=no +ac_cv_header_memory_h=yes +ac_cv_header_ncurses_curses_h=no +ac_cv_header_ncurses_term_h=no +ac_cv_header_paths_h=yes +ac_cv_header_pty_h=yes +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_stropts_h=no +ac_cv_header_sys_param_h=yes +ac_cv_header_sys_ptem_h=no +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_ttydefaults_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_sys_wait_h=yes +ac_cv_header_term_h=yes +ac_cv_header_termcap_h=yes +ac_cv_header_termios_h=yes +ac_cv_header_time=yes +ac_cv_header_unistd_h=yes +ac_cv_header_util_h=no +ac_cv_header_wchar_h=yes +ac_cv_host=x86_64-pc-linux-gnu +ac_cv_host_alias=x86_64-pc-linux-gnu +ac_cv_lib_ICE_IceConnectionNumber=yes +ac_cv_lib_Xcursor_XcursorGetTheme=yes +ac_cv_lib_Xext_XextCreateExtension=yes +ac_cv_lib_Xpm_XpmCreatePixmapFromData=yes +ac_cv_lib_elf_elf_begin=yes +ac_cv_lib_util_openpty=yes +ac_cv_objext=o +ac_cv_path_GROFF_PATH=/bin/groff +ac_cv_path_IMAKE=/bin/xmkmf +ac_cv_path_NROFF_PATH=/bin/nroff +ac_cv_path_TBL_PATH=/bin/tbl +ac_cv_path_XTERM_PATH=/bin/xterm +ac_cv_path_ac_pt_PKG_CONFIG=/bin/pkg-config +ac_cv_path_cf_man2html=no +ac_cv_path_install='/bin/install -c' +ac_cv_prog_AWK=awk +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_MAKE_LOWER_TAGS=no +ac_cv_prog_MAKE_UPPER_TAGS=no +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_cf_ldd_prog=ldd +ac_cv_prog_cf_tic_prog=yes +ac_cv_prog_desktop_utils=no +ac_cv_type_mode_t=yes +ac_cv_type_off_t=yes +ac_cv_type_pid_t=yes +ac_cv_type_time_t=yes +ac_cv_type_uid_t=yes +am_cv_langinfo_codeset=yes +cf_cv_dcl_errno=yes +cf_cv_dcl_sys_errlist=no +cf_cv_dcl_sys_nerr=no +cf_cv_define_sigwinch=yes +cf_cv_found_freetype=yes +cf_cv_gnu_dftsrc_219=yes +cf_cv_gnu_library=yes +cf_cv_gnu_library_219=yes +cf_cv_have_errno=no +cf_cv_have_sys_errlist=no +cf_cv_have_sys_nerr=no +cf_cv_have_utmp=utmp +cf_cv_have_utmp_ut_host=yes +cf_cv_have_utmp_ut_name=ut_name +cf_cv_have_utmp_ut_session=yes +cf_cv_have_utmp_ut_syslen=no +cf_cv_have_utmp_ut_xstatus=ut_exit.e_exit +cf_cv_have_utmp_ut_xtime=yes +cf_cv_havetype_cc_t=yes +cf_cv_havetype_speed_t=yes +cf_cv_havetype_tcflag_t=yes +cf_cv_icon_list=' icons/filled-xterm icons/mini.xterm icons/mini.xterm_48x48 icons/xterm-color icons/xterm' +cf_cv_input_method=yes +cf_cv_lib_part_tgetent=-lncurses +cf_cv_lib_tgetent=no +cf_cv_mixedcase=yes +cf_cv_path_lastlog=_PATH_LASTLOG +cf_cv_posix_saved_ids=yes +cf_cv_posix_visible=no +cf_cv_posix_wait=yes +cf_cv_regex_hdrs=regex.h +cf_cv_sig_atomic_t='volatile sig_atomic_t' +cf_cv_struct_lastlog=no +cf_cv_svr4=no +cf_cv_system_name=linux-gnu +cf_cv_sysv=no +cf_cv_sysv_utmp=yes +cf_cv_termio_c_ispeed=no +cf_cv_tty_group=no +cf_cv_tty_group_name=midfavil +cf_cv_type_cc_t=yes +cf_cv_type_fd_mask=sys/types.h +cf_cv_type_fd_set=sys/types.h +cf_cv_x_freetype_cfgs=auto +cf_cv_x_freetype_incs='-I/usr/include/freetype2 -I/usr/include/libpng16 ' +cf_cv_x_freetype_libs=' -lXft ' +cf_cv_xft_compat=no +cf_cv_xkb_bell_ext=yes +cf_cv_xkb_keycode_to_keysym=yes +cf_cv_xkb_query_extension=yes +cf_cv_xt_ice_compat=yes + +## ------------ ## +## confdefs.h. ## +## ------------ ## + +#define SYSTEM_NAME "linux-gnu" +#define HAVE_STDLIB_H 1 +#define HAVE_SYS_TTYDEFAULTS_H 1 +#define HAVE_TERM_H 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_WCHAR_H 1 +#define TIME_WITH_SYS_TIME 1 +#define HAVE_LANGINFO_CODESET 1 +#define SIG_ATOMIC_T volatile sig_atomic_t +#define STDC_HEADERS 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_UNISTD_H 1 +#define HAVE_GETHOSTNAME 1 +#define HAVE_GETUSERSHELL 1 +#define HAVE_ENDUSERSHELL 1 +#define HAVE_GETLOGIN 1 +#define HAVE_INITGROUPS 1 +#define HAVE_MKDTEMP 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_SCHED_YIELD 1 +#define HAVE_SETPGID 1 +#define HAVE_STRFTIME 1 +#define HAVE_TCGETATTR 1 +#define HAVE_WAITPID 1 +#define HAVE_WCSWIDTH 1 +#define HAVE_WCWIDTH 1 +#define HAVE_LASTLOG_H 1 +#define HAVE_PATHS_H 1 +#define USE_LASTLOG 1 +#define HAVE_UTMP 1 +#define HAVE_UTMP_UT_HOST 1 +#define HAVE_UTMP_UT_XSTATUS 1 +#define ut_xstatus ut_exit.e_exit +#define HAVE_UTMP_UT_XTIME 1 +#define HAVE_UTMP_UT_SESSION 1 +#define USE_SYSV_UTMP 1 +#define HAVE_LASTLOG_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_POSIX_SAVED_IDS 1 +#define HAVE_TERMCAP_H 1 +#define HAVE_TERMCAP_H 1 +#define USE_TERMINFO 1 +#define XTERM_PATH_PATH "/bin/xterm" +#define TTY_GROUP_NAME "midfavil" +#define HAVE_SYS_WAIT_H 1 +#define USE_POSIX_WAIT 1 +#define DECL_SYS_NERR 1 +#define DECL_SYS_ERRLIST 1 +#define HAVE_TERMIOS_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_X11_INTRINSIC_H 1 +#define HAVE_X11_DECKEYSYM_H 1 +#define HAVE_X11_SUNKEYSYM_H 1 +#define HAVE_X11_XF86KEYSYM_H 1 +#define HAVE_X11_XKBLIB_H 1 +#define HAVE_X11_TRANSLATEI_H 1 +#define HAVE_X11_XPOLL_H 1 +#define HAVE_X11_EXTENSIONS_XKB_H 1 +#define HAVE_LIBXPM 1 +#define HAVE_X11_EXTENSIONS_XINERAMA_H 1 +#define HAVE_LIB_NEXTAW 1 +#define HAVE_X11_XPOLL_H 1 +#define HAVE_LIB_XCURSOR 1 +#define HAVE_GRANTPT 1 +#define HAVE_PTSNAME 1 +#define HAVE_POSIX_OPENPT 1 +#define HAVE_OPENPTY 1 +#define HAVE_PTY_H 1 +#define HAVE_XKBQUERYEXTENSION 1 +#define HAVE_XKBKEYCODETOKEYSYM 1 +#define HAVE_XKB_BELL_EXT 1 +#define HAVE_XUTF8LOOKUPSTRING 1 +#define DFT_DECID "420" +#define DFT_TERMTYPE "xterm" +#define DEF_BACKARO_BS True +#define DEF_BACKARO_ERASE False +#define DEFDELETE_DEL Maybe +#define DEF_INITIAL_ERASE False +#define DEF_ALT_SENDS_ESC False +#define DEF_META_SENDS_ESC False +#define OPT_256_COLORS 1 +#define OPT_DIRECT_COLOR 1 +#define OPT_BROKEN_OSC 1 +#define HAVE_X11_EXTENSIONS_XDBE_H 1 +#define HAVE_XDBESWAPBUFFERS 1 +#define XRENDERFONT 1 +#define HAVE_XFTDRAWCHARSPEC 1 +#define HAVE_XFTDRAWSETCLIP 1 +#define HAVE_XFTDRAWSETCLIPRECTANGLES 1 +#define OPT_FIFO_LINES 1 +#define OPT_PASTE64 1 +#define OPT_PTY_HANDSHAKE 1 +#define HAVE_REGEX_H_FUNCS 1 +#define OPT_SELECT_REGEX 1 +#define SCROLLBAR_RIGHT 1 +#define OPT_TCAP_FKEYS 1 +#define OPT_TCAP_QUERY 1 +#define OPT_TOOLBAR 1 +#define OPT_LUIT_PROG 1 +#define OPT_WIDE_CHARS 1 +#define OPT_SIXEL_GRAPHICS 1 +#define OPT_GRAPHICS 1 +#define OPT_DEC_RECTOPS 1 +#define HAVE_TIGETSTR 1 +#define HAVE_USE_EXTENDED_NAMES 1 +#define MIXEDCASE_FILENAMES 1 + + +configure: exit 0 diff --git a/ports/xterm/xterm-359/config.status b/ports/xterm/xterm-359/config.status new file mode 100755 index 0000000..8eb13d9 --- /dev/null +++ b/ports/xterm/xterm-359/config.status @@ -0,0 +1,1180 @@ +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=${CONFIG_SHELL-/bin/sh} +ac_cs_invocation="$0 $@" + +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +config_files=" Makefile df-install minstall:minstall.in" +config_headers=" xtermcfg.h:xtermcfg.hin" + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." +ac_cs_version="\ +config.status +configured by ./configure, generated by GNU Autoconf 2.52.20200802, + with options \"--with-neXtaw --enable-toolbar\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=. +INSTALL="/bin/install -c" +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running /bin/sh ./configure " --with-neXtaw --enable-toolbar " --no-create --no-recursion" + exec /bin/sh ./configure --with-neXtaw --enable-toolbar --no-create --no-recursion ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:24093: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:24112: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52.20200802, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "df-install" ) CONFIG_FILES="$CONFIG_FILES df-install" ;; + "minstall" ) CONFIG_FILES="$CONFIG_FILES minstall:minstall.in" ;; + "xtermcfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS xtermcfg.h:xtermcfg.hin" ;; + *) { { echo "$as_me:24151: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t$/@;t t/; /@;t t$/s/[\\&,]/\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t$/,;t t/' >$tmp/subs.sed <<\CEOF +s,@SHELL@,/bin/sh,;t t +s,@exec_prefix@,${prefix},;t t +s,@prefix@,/usr/local,;t t +s,@program_transform_name@,s,x,x,,;t t +s,@bindir@,${exec_prefix}/bin,;t t +s,@sbindir@,${exec_prefix}/sbin,;t t +s,@libexecdir@,${exec_prefix}/libexec,;t t +s,@datarootdir@,${prefix}/share,;t t +s,@datadir@,${datarootdir},;t t +s,@sysconfdir@,${prefix}/etc,;t t +s,@sharedstatedir@,${prefix}/com,;t t +s,@localstatedir@,${prefix}/var,;t t +s,@runstatedir@,${localstatedir}/run,;t t +s,@libdir@,${exec_prefix}/lib,;t t +s,@includedir@,${prefix}/include,;t t +s,@oldincludedir@,/usr/include,;t t +s,@infodir@,${datarootdir}/info,;t t +s,@mandir@,${datarootdir}/man,;t t +s,@PACKAGE_NAME@,,;t t +s,@PACKAGE_TARNAME@,,;t t +s,@PACKAGE_VERSION@,,;t t +s,@PACKAGE_STRING@,,;t t +s,@PACKAGE_BUGREPORT@,,;t t +s,@build_alias@,,;t t +s,@host_alias@,,;t t +s,@target_alias@,,;t t +s,@ECHO_C@,\c,;t t +s,@ECHO_N@,,;t t +s,@ECHO_T@,,;t t +s,@PATH_SEPARATOR@,:,;t t +s,@DEFS@,-DHAVE_CONFIG_H,;t t +s,@LIBS@, -lXft -lfontconfig -lfreetype -lutil -lneXtaw -lXmu -lSM -lICE -lXext -lXinerama -lXpm -lXt -lX11 -lSM -lICE -lncurses,;t t +s,@build@,x86_64-pc-linux-gnu,;t t +s,@build_cpu@,x86_64,;t t +s,@build_vendor@,pc,;t t +s,@build_os@,linux-gnu,;t t +s,@host@,x86_64-pc-linux-gnu,;t t +s,@host_cpu@,x86_64,;t t +s,@host_vendor@,pc,;t t +s,@host_os@,linux-gnu,;t t +s,@CC@,gcc,;t t +s,@CFLAGS@,-g -O2,;t t +s,@LDFLAGS@,,;t t +s,@CPPFLAGS@, -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DXFREE86_FT2 -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -I/usr/include -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng16,;t t +s,@ac_ct_CC@,gcc,;t t +s,@EXEEXT@,,;t t +s,@OBJEXT@,o,;t t +s,@EXTRA_CPPFLAGS@,-DPROJECTROOT='"/usr"' -D__vendorversion__='"Version 7.7.0 X.Org"',;t t +s,@CPP@,gcc -E,;t t +s,@AWK@,awk,;t t +s,@INSTALL_PROGRAM@,${INSTALL},;t t +s,@INSTALL_SCRIPT@,${INSTALL},;t t +s,@INSTALL_DATA@,${INSTALL} -m 644,;t t +s,@LN_S@,ln -s,;t t +s,@LINT@,,;t t +s,@LINT_OPTS@,,;t t +s,@APP_CLASS@,XTerm,;t t +s,@APPSDIR@,${exec_prefix}/lib/X11/app-defaults,;t t +s,@no_appsdir@,,;t t +s,@ICON_NAME@,mini.xterm,;t t +s,@ICON_SYMLINK@,NONE,;t t +s,@PIXMAPDIR@,${datadir}/pixmaps,;t t +s,@no_pixmapdir@,,;t t +s,@ICONDIR@,no,;t t +s,@no_icondir@,#,;t t +s,@ICON_FORMAT@,.svg .png .xpm,;t t +s,@ICON_THEME@,no,;t t +s,@ICON_LIST@,icons/mini.xterm_48x48.png icons/mini.xterm_48x48.xpm,;t t +s,@desktop_utils@,#,;t t +s,@DESKTOP_FLAGS@,,;t t +s,@DESKTOP_CATEGORY@,,;t t +s,@XTERM_PATH@,/bin/xterm,;t t +s,@XTERM_SYMLINK@,NONE,;t t +s,@SINSTALL_OPTS@,,;t t +s,@X_CFLAGS@,,;t t +s,@X_PRE_LIBS@, -lSM -lICE,;t t +s,@X_LIBS@, -L/usr/lib64,;t t +s,@X_EXTRA_LIBS@,,;t t +s,@PKG_CONFIG@,/bin/pkg-config,;t t +s,@ac_pt_PKG_CONFIG@,/bin/pkg-config,;t t +s,@ICON_SUFFIX@,.xpm,;t t +s,@IMAKE@,/bin/xmkmf,;t t +s,@IMAKE_CFLAGS@, -I. -I/usr/include/freetype2 -I/usr/include/freetype2/config -Dlinux -D__amd64__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFUNCPROTO=15 -DNARROWPROTO -DHAVE_TERM_H -DSCROLLBAR_RIGHT -DOPT_WIDE_CHARS -DOPT_LUIT_PROG -DXRENDERFONT -DXFREE86_FT2 -DPROJECTROOT='"/usr"' -D_DEFAULT_SOURCE -U_XOPEN_SOURCE -D_XOPEN_SOURCE=600 -DUTMP -DUSE_TTY_GROUP -DOSMAJORVERSION=5 -DOSMINORVERSION=11 -D__vendorversion__='"Version 7.7.0 X.Org"' -I/usr/include,;t t +s,@IMAKE_LOADFLAGS@,,;t t +s,@GROFF_PATH@,/bin/groff,;t t +s,@NROFF_PATH@,/bin/nroff,;t t +s,@TBL_PATH@,/bin/tbl,;t t +s,@GROFF_NOTE@,,;t t +s,@NROFF_NOTE@,#,;t t +s,@cf_man2html@,/bin/groff,;t t +s,@MAN2HTML_NOTE@,,;t t +s,@MAN2HTML_PATH@,/bin/groff,;t t +s,@MAN2HTML_TEMP@,man2html.tmp,;t t +s,@default_termid@,420,;t t +s,@default_TERM@,xterm,;t t +s,@backarrow_is_bs@,True,;t t +s,@backarrow_is_erase@,False,;t t +s,@delete_is_del@,Maybe,;t t +s,@initial_erase@,False,;t t +s,@alt_sends_esc@,False,;t t +s,@meta_sends_esc@,False,;t t +s,@cf_tic_prog@,yes,;t t +s,@no_ticprog@,,;t t +s,@TERMINFO_DIR@,$(DESTDIR)/usr/lib/terminfo,;t t +s,@SET_TERMINFO@,TERMINFO=$(TERMINFO_DIR),;t t +s,@double_buffer@,False,;t t +s,@FREETYPE_CONFIG@,/bin/pkg-config,;t t +s,@FREETYPE_OLD_CONFIG@,,;t t +s,@FREETYPE_XFT_CONFIG@,,;t t +s,@HAVE_TYPE_FCCHAR32@,,;t t +s,@HAVE_TYPE_XFTCHARSPEC@,,;t t +s,@LUIT@,,;t t +s,@ECHO_LT@,,;t t +s,@ECHO_LD@,,;t t +s,@RULE_CC@,,;t t +s,@SHOW_CC@,,;t t +s,@ECHO_CC@,,;t t +s,@EXTRA_CFLAGS@,,;t t +s,@CHARPROC_DEPS@, 256colres.h,;t t +s,@EXTRAHDRS@, 256colres.h Tekparse.h charclass.h precompose.h wcwidth.h graphics_sixel.h graphics.h,;t t +s,@EXTRASRCS@, TekPrsTbl.c Tekproc.c charclass.c precompose.c wcwidth.c html.c svg.c graphics_sixel.c graphics.c,;t t +s,@EXTRAOBJS@, TekPrsTbl.o Tekproc.o charclass.o precompose.o wcwidth.o html.o svg.o graphics_sixel.o graphics.o,;t t +s,@MAY_SETUID@,,;t t +s,@NOT_SETUID@,#,;t t +s,@CTAGS@,,;t t +s,@ETAGS@,,;t t +s,@MAKE_LOWER_TAGS@,#,;t t +s,@MAKE_UPPER_TAGS@,#,;t t +s,@cf_ldd_prog@,ldd,;t t +s,@EXTRA_LDFLAGS@,,;t t +CEOF + + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr $ac_end + $ac_max_sed_lines` + sed "1,${ac_BEG}d; ${ac_END}p; q" $tmp/subs.sed >$tmp/subs.next + if test -s $tmp/subs.next; then + grep '^s,@[^@,][^@,]*@,.*\\$' $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + grep "^s,@[^@,][^@,]*@,.*,;t t$" $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + if test $ac_beg -gt 1; then + ac_end=`expr $ac_end - 1` + continue + fi + fi + fi + fi + + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:24464: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:24482: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:24495: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + ac_warn_datarootdir=no + if test x"$ac_file" != x-; then + for ac_item in $ac_file_inputs + do + ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` + if test -n "$ac_seen"; then + ac_used=`grep '@datarootdir@' $ac_item` + if test -z "$ac_used"; then + { echo "$as_me:24511: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + fi + ac_seen=`grep '${datarootdir}' $ac_item` + if test -n "$ac_seen"; then + { echo "$as_me:24520: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + done + fi + +if test "x$ac_warn_datarootdir" = xyes; then + ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" +fi + + sed "/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +} + +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + cp $tmp/out $ac_file + + for ac_name in prefix exec_prefix datarootdir + do + ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` + if test -n "$ac_seen"; then + ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` + if test -z "$ac_init"; then + ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` + { echo "$as_me:24557: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&5 +echo "$as_me: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&2;} + fi + fi + done + egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out + egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out + if test -s $tmp/out; then + ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` + { echo "$as_me:24568: WARNING: Some variables may not be substituted: +$ac_seen" >&5 +echo "$as_me: WARNING: Some variables may not be substituted: +$ac_seen" >&2;} + fi + else + cat $tmp/out + fi + rm -f $tmp/out + +done + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_iB='\([ ]\),\1#\2define\3' +ac_iC=' ' +ac_iD='\4,;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:24617: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:24628: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:24641: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + + # Handle all the #define templates only if necessary. + if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then + # If there are no defines, we may have an empty if/fi + : + cat >$tmp/defines.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/defines.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/defines.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + fi # egrep + + # Handle all the #undef templates + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + cat >$tmp/undefs.sed <$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:24759: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done + +{ (exit 0); exit 0; } diff --git a/ports/xterm/xterm-359/config.sub b/ports/xterm/xterm-359/config.sub new file mode 100755 index 0000000..3d9a8dc --- /dev/null +++ b/ports/xterm/xterm-359/config.sub @@ -0,0 +1,1851 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2020 Free Software Foundation, Inc. + +timestamp='2020-07-10' + +# 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 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# 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. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2020 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + 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 + +# Split fields of configuration type +# shellcheck disable=SC2162 +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ + | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ + | unicom* | ibm* | next | hp | isi* | apollo | altos* \ + | convergent* | ncr* | news | 32* | 3600* | 3100* \ + | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ + | ultra | tti* | harris | dolphin | highlevel | gould \ + | cbm | ns | masscomp | apple | axis | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x$basic_os != x ] +then + +# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo $basic_os | sed -e 's|gnu/linux|gnu|'` + ;; + nto-qnx*) + kernel=nto + os=`echo $basic_os | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + nto-qnx*) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-aix*) + vendor=ibm + ;; + *-beos*) + vendor=be + ;; + *-hpux*) + vendor=hp + ;; + *-mpeix*) + vendor=hp + ;; + *-hiux*) + vendor=hitachi + ;; + *-unos*) + vendor=crds + ;; + *-dgux*) + vendor=dg + ;; + *-luna*) + vendor=omron + ;; + *-genix*) + vendor=ns + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-vxsim* | *-vxworks* | *-windiss*) + vendor=wrs + ;; + *-aux*) + vendor=apple + ;; + *-hms*) + vendor=hitachi + ;; + *-mpw* | *-macos*) + vendor=apple + ;; + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) + vendor=atari + ;; + *-vos*) + vendor=stratus + ;; + esac + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/ports/xterm/xterm-359/configure b/ports/xterm/xterm-359/configure new file mode 100755 index 0000000..3d377c6 --- /dev/null +++ b/ports/xterm/xterm-359/configure @@ -0,0 +1,24825 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52.20200802. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +ac_unique_file="charproc.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${datarootdir}/info' +mandir='${datarootdir}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst \ + | --runs | --run | --ru) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* \ + | --runs=* | --run=* | --ru=*) + runstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +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 || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:1012: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:1023: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:1031: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:1047: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:1051: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:1057: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:1059: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:1061: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:1080: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:1082: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway + ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:1103: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:1106: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_config_headers="$ac_config_headers xtermcfg.h:xtermcfg.hin" + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:1134: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:1144: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:1148: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:1157: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:1161: error: $ac_config_sub $ac_cv_build_alias failed." >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1166: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then + echo "$as_me:1174: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:1183: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:1188: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + system_name="$host_os" +else + system_name="`(uname -s -r) 2>/dev/null`" + if test -z "$system_name" ; then + system_name="`(hostname) 2>/dev/null`" + fi +fi +test -n "$system_name" && +cat >>confdefs.h <&6 +else + cf_cv_system_name="$system_name" +fi + +test -z "$system_name" && system_name="$cf_cv_system_name" +test -n "$cf_cv_system_name" && echo "$as_me:1214: result: Configuring for $cf_cv_system_name" >&5 +echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 + +if test ".$system_name" != ".$cf_cv_system_name" ; then + echo "$as_me:1218: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 +echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 + { { echo "$as_me:1220: error: \"Please remove config.cache and try again.\"" >&5 +echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} + { (exit 1); exit 1; }; } +fi + +### checks for alternative programs + +case "$host_os" in +(openedition) : ${CFLAGS="-O2 -Wc,dll -Wl,EDIT=NO"} + : ${CPPFLAGS="-D_ALL_SOURCE"} + : ${LIBS="/usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x"} + : ${CC=c89};; +(darwin*) + : ${LDFLAGS}="${LDFLAGS} -Wl,-bind_at_load";; +esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:1245: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1260: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1268: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1271: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1280: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1295: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1303: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1306: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1319: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1334: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1342: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1345: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1354: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1369: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1377: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1380: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1393: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1413: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1435: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1438: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1449: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1464: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1472: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1475: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1488: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1503: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1511: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1514: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1526: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:1531:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:1534: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:1537: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1539: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:1542: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:1544: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:1547: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line 1551 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:1567: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1570: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1573: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1596: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1602: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1607: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1613: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1616: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1623: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1631: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1638: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1640: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1643: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1645: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1648: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1664: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1670: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1676: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1682 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1694: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1697: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1709: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1716: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1720: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1726 "configure" +#include "confdefs.h" + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1741: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1744: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1747: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1750: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1762: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1768: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1774 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1786: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1789: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1792: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1795: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1805: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1832: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1835: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1838: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1841: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1853 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main (void) +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1866: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1869: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1872: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1875: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1885 "configure" +#include "confdefs.h" +$ac_declaration +int +main (void) +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1897: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1900: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1903: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1906: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -rf conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +GCC_VERSION=none +if test "$GCC" = yes ; then + echo "$as_me:1936: checking version of $CC" >&5 +echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 + GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[^)]*) //' -e 's/^.*(Debian[^)]*) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" + test -z "$GCC_VERSION" && GCC_VERSION=unknown + echo "$as_me:1940: result: $GCC_VERSION" >&5 +echo "${ECHO_T}$GCC_VERSION" >&6 +fi + +INTEL_COMPILER=no + +if test "$GCC" = yes ; then + case $host_os in + (linux*|gnu*) + echo "$as_me:1949: checking if this is really Intel C compiler" >&5 +echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + cat >conftest.$ac_ext <<_ACEOF +#line 1954 "configure" +#include "confdefs.h" + +int +main (void) +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1971: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1974: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1977: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1980: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:1991: result: $INTEL_COMPILER" >&5 +echo "${ECHO_T}$INTEL_COMPILER" >&6 + ;; + esac +fi + +CLANG_COMPILER=no + +if test "$GCC" = yes ; then + echo "$as_me:2000: checking if this is really Clang C compiler" >&5 +echo $ECHO_N "checking if this is really Clang C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Qunused-arguments" + cat >conftest.$ac_ext <<_ACEOF +#line 2005 "configure" +#include "confdefs.h" + +int +main (void) +{ + +#ifdef __clang__ +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2022: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2025: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2028: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2031: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + CLANG_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:2042: result: $CLANG_COMPILER" >&5 +echo "${ECHO_T}$CLANG_COMPILER" >&6 +fi + +echo "$as_me:2046: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line 2054 "configure" +#include "confdefs.h" +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main (void) +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:2103: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2106: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2109: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2112: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:2129: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:2132: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# This should have been defined by AC_PROG_CC +: ${CC:=cc} + +echo "$as_me:2140: checking \$CFLAGS variable" >&5 +echo $ECHO_N "checking \$CFLAGS variable... $ECHO_C" >&6 +case "x$CFLAGS" in +(*-[IUD]*) + echo "$as_me:2144: result: broken" >&5 +echo "${ECHO_T}broken" >&6 + { echo "$as_me:2146: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&5 +echo "$as_me: WARNING: your environment uses the CFLAGS variable to hold CPPFLAGS options" >&2;} + cf_flags="$CFLAGS" + CFLAGS= + for cf_arg in $cf_flags + do + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_arg +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + done + ;; +(*) + echo "$as_me:2254: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + ;; +esac + +echo "$as_me:2259: checking \$CC variable" >&5 +echo $ECHO_N "checking \$CC variable... $ECHO_C" >&6 +case "$CC" in +(*[\ \ ]-*) + echo "$as_me:2263: result: broken" >&5 +echo "${ECHO_T}broken" >&6 + { echo "$as_me:2265: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&5 +echo "$as_me: WARNING: your environment uses the CC variable to hold CFLAGS/CPPFLAGS options" >&2;} + # humor him... + cf_prog=`echo "$CC" | sed -e 's/ / /g' -e 's/[ ]* / /g' -e 's/[ ]*[ ]-[^ ].*//'` + cf_flags=`echo "$CC" | ${AWK:-awk} -v prog="$cf_prog" '{ printf("%s", substr($0,1+length(prog))); }'` + CC="$cf_prog" + for cf_arg in $cf_flags + do + case "x$cf_arg" in + (x-[IUDfgOW]*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_arg +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + ;; + (*) + CC="$CC $cf_arg" + ;; + esac + done + test -n "$verbose" && echo " resulting CC: '$CC'" 1>&6 + +echo "${as_me:-configure}:2382: testing resulting CC: '$CC' ..." 1>&5 + + test -n "$verbose" && echo " resulting CFLAGS: '$CFLAGS'" 1>&6 + +echo "${as_me:-configure}:2386: testing resulting CFLAGS: '$CFLAGS' ..." 1>&5 + + test -n "$verbose" && echo " resulting CPPFLAGS: '$CPPFLAGS'" 1>&6 + +echo "${as_me:-configure}:2390: testing resulting CPPFLAGS: '$CPPFLAGS' ..." 1>&5 + + ;; +(*) + echo "$as_me:2394: result: ok" >&5 +echo "${ECHO_T}ok" >&6 + ;; +esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return +echo "$as_me:2405: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2426 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2431: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2437: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2460 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2464: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2470: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:2507: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 2517 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:2522: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2528: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2551 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2555: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2561: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2589: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return=return + +for ac_prog in mawk gawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2605: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AWK="$ac_prog" +echo "$as_me:2620: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:2628: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:2631: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:2650: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:2699: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:2710: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:2714: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:2717: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +for ac_prog in lint cppcheck splint +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:2738: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LINT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LINT"; then + ac_cv_prog_LINT="$LINT" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_LINT="$ac_prog" +echo "$as_me:2753: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +LINT=$ac_cv_prog_LINT +if test -n "$LINT"; then + echo "$as_me:2761: result: $LINT" >&5 +echo "${ECHO_T}$LINT" >&6 +else + echo "$as_me:2764: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LINT" && break +done + +case "x$LINT" in +(xcppcheck|x*/cppcheck) + test -z "$LINT_OPTS" && LINT_OPTS="--enable=all" + ;; +esac + +### checks for compiler characteristics + +echo "$as_me:2779: checking if the POSIX test-macros are already defined" >&5 +echo $ECHO_N "checking if the POSIX test-macros are already defined... $ECHO_C" >&6 +if test "${cf_cv_posix_visible+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 2786 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#if defined(__POSIX_VISIBLE) && ((__POSIX_VISIBLE - 0L) > 0) \ + && defined(__XSI_VISIBLE) && ((__XSI_VISIBLE - 0L) > 0) \ + && defined(__BSD_VISIBLE) && ((__BSD_VISIBLE - 0L) > 0) \ + && defined(__ISO_C_VISIBLE) && ((__ISO_C_VISIBLE - 0L) > 0) +#error conflicting symbols found +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2805: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2808: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2811: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2814: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_visible=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_visible=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:2825: result: $cf_cv_posix_visible" >&5 +echo "${ECHO_T}$cf_cv_posix_visible" >&6 + +if test "$cf_cv_posix_visible" = no; then + +cf_XOPEN_SOURCE=700 +cf_POSIX_C_SOURCE=199506L +cf_xopen_source= + +case $host_os in +(aix[4-7]*) + cf_xopen_source="-D_ALL_SOURCE" + ;; +(msys) + cf_XOPEN_SOURCE=600 + ;; +(darwin[0-8].*) + cf_xopen_source="-D_APPLE_C_SOURCE" + ;; +(darwin*) + cf_xopen_source="-D_DARWIN_C_SOURCE" + cf_XOPEN_SOURCE= + ;; +(freebsd*|dragonfly*|midnightbsd*) + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +(hpux11*) + cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500" + ;; +(hpux*) + cf_xopen_source="-D_HPUX_SOURCE" + ;; +(irix[56].*) + cf_xopen_source="-D_SGI_SOURCE" + cf_XOPEN_SOURCE= + ;; +(linux*|uclinux*|gnu*|mint*|k*bsd*-gnu|cygwin) + +cf_gnu_xopen_source=$cf_XOPEN_SOURCE + +echo "$as_me:2870: checking if this is the GNU C library" >&5 +echo $ECHO_N "checking if this is the GNU C library... $ECHO_C" >&6 +if test "${cf_cv_gnu_library+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 2877 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #if __GLIBC__ > 0 && __GLIBC_MINOR__ >= 0 + return 0; + #elif __NEWLIB__ > 0 && __NEWLIB_MINOR__ >= 0 + return 0; + #else + # error not GNU C library + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2896: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2899: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2902: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2905: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_library=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_library=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:2916: result: $cf_cv_gnu_library" >&5 +echo "${ECHO_T}$cf_cv_gnu_library" >&6 + +if test x$cf_cv_gnu_library = xyes; then + + # With glibc 2.19 (13 years after this check was begun), _DEFAULT_SOURCE + # was changed to help a little. newlib incorporated the change about 4 + # years later. + echo "$as_me:2924: checking if _DEFAULT_SOURCE can be used as a basis" >&5 +echo $ECHO_N "checking if _DEFAULT_SOURCE can be used as a basis... $ECHO_C" >&6 +if test "${cf_cv_gnu_library_219+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_save="$CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 2936 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19) || (__GLIBC__ > 2) + return 0; + #elif (__NEWLIB__ == 2 && __NEWLIB_MINOR__ >= 4) || (__GLIBC__ > 3) + return 0; + #else + # error GNU C library __GLIBC__.__GLIBC_MINOR__ is too old + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:2955: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:2958: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:2961: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2964: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_library_219=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_library_219=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +echo "$as_me:2976: result: $cf_cv_gnu_library_219" >&5 +echo "${ECHO_T}$cf_cv_gnu_library_219" >&6 + + if test "x$cf_cv_gnu_library_219" = xyes; then + cf_save="$CPPFLAGS" + echo "$as_me:2981: checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE" >&5 +echo $ECHO_N "checking if _XOPEN_SOURCE=$cf_gnu_xopen_source works with _DEFAULT_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_dftsrc_219+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=$cf_gnu_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + cat >conftest.$ac_ext <<_ACEOF +#line 3086 "configure" +#include "confdefs.h" + + #include + #include + +int +main (void) +{ + + #if (_XOPEN_SOURCE >= $cf_gnu_xopen_source) && (MB_LEN_MAX > 1) + return 0; + #else + # error GNU C library is too old + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3106: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3109: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3112: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3115: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_dftsrc_219=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_dftsrc_219=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3126: result: $cf_cv_gnu_dftsrc_219" >&5 +echo "${ECHO_T}$cf_cv_gnu_dftsrc_219" >&6 + test "x$cf_cv_gnu_dftsrc_219" = "xyes" || CPPFLAGS="$cf_save" + else + cf_cv_gnu_dftsrc_219=maybe + fi + + if test "x$cf_cv_gnu_dftsrc_219" != xyes; then + + echo "$as_me:3135: checking if we must define _GNU_SOURCE" >&5 +echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 3142 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #ifndef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be defined + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3157: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3160: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3163: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3166: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -D_GNU_SOURCE +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + cat >conftest.$ac_ext <<_ACEOF +#line 3273 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #ifdef _XOPEN_SOURCE + #error expected _XOPEN_SOURCE to be undefined + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3288: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3291: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3294: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3297: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3312: result: $cf_cv_gnu_source" >&5 +echo "${ECHO_T}$cf_cv_gnu_source" >&6 + + if test "$cf_cv_gnu_source" = yes + then + echo "$as_me:3317: checking if we should also define _DEFAULT_SOURCE" >&5 +echo $ECHO_N "checking if we should also define _DEFAULT_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_default_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_GNU_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 3327 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + #ifdef _DEFAULT_SOURCE + #error expected _DEFAULT_SOURCE to be undefined + #endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3342: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3345: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3348: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3351: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_default_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_default_source=yes +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3362: result: $cf_cv_default_source" >&5 +echo "${ECHO_T}$cf_cv_default_source" >&6 + if test "$cf_cv_default_source" = yes + then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_DEFAULT_SOURCE" + + fi + fi + fi + +fi + + ;; +(minix*) + cf_xopen_source="-D_NETBSD_SOURCE" # POSIX.1-2001 features are ifdef'd with this... + ;; +(mirbsd*) + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks and other headers which use u_int / u_short types + cf_XOPEN_SOURCE= + +if test "$cf_cv_posix_visible" = no; then + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:3399: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:3405: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3408 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3423: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3426: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3429: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3432: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[12]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 3453 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifdef _POSIX_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3468: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3471: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3474: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3477: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + +echo "${as_me:-configure}:3488: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 + + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" + +echo "${as_me:-configure}:3496: testing if the second compile does not leave our definition intact error ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3499 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3514: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3517: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3520: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3523: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3539: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_posix_c_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + +fi # cf_cv_posix_visible + + ;; +(netbsd*) + cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +(openbsd[4-9]*) + # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw + cf_xopen_source="-D_BSD_SOURCE" + cf_XOPEN_SOURCE=600 + ;; +(openbsd*) + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +(osf[45]*) + cf_xopen_source="-D_OSF_SOURCE" + ;; +(nto-qnx*) + cf_xopen_source="-D_QNX_SOURCE" + ;; +(sco*) + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +(solaris2.*) + cf_xopen_source="-D__EXTENSIONS__" + cf_cv_xopen_source=broken + ;; +(sysv4.2uw2.*) # Novell/SCO UnixWare 2.x (tested on 2.1.2) + cf_XOPEN_SOURCE= + cf_POSIX_C_SOURCE= + ;; +(*) + +echo "$as_me:3679: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 3686 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3705: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3708: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3711: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3714: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 3726 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3745: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3748: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3751: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3754: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:3769: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + +if test "$cf_cv_xopen_source" != no ; then + +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_temp_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + +if test "$cf_cv_posix_visible" = no; then + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_POSIX_C_SOURCE"'\(=[^ ]*\)\?$//g'` + +echo "$as_me:3899: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:3905: testing if the symbol is already defined go no further ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3908 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3923: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3926: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3929: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3932: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + (.[12]??*) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + (.2) + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + (.*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 3953 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifdef _POSIX_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:3968: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:3971: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:3974: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:3977: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi + +echo "${as_me:-configure}:3988: testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 + + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_cv_posix_c_source" + +echo "${as_me:-configure}:3996: testing if the second compile does not leave our definition intact error ..." 1>&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 3999 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4014: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4017: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4020: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4023: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4039: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_posix_c_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + +fi # cf_cv_posix_visible + + ;; +esac + +if test -n "$cf_xopen_source" ; then + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:4233: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:4243: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:4253: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + +if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then + echo "$as_me:4263: checking if _XOPEN_SOURCE really is set" >&5 +echo $ECHO_N "checking if _XOPEN_SOURCE really is set... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 4266 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4281: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4284: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4287: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4290: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_XOPEN_SOURCE_set=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_XOPEN_SOURCE_set=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:4299: result: $cf_XOPEN_SOURCE_set" >&5 +echo "${ECHO_T}$cf_XOPEN_SOURCE_set" >&6 + if test $cf_XOPEN_SOURCE_set = yes + then + cat >conftest.$ac_ext <<_ACEOF +#line 4304 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + +#if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4319: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4322: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4325: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4328: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_XOPEN_SOURCE_set_ok=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_XOPEN_SOURCE_set_ok=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + if test $cf_XOPEN_SOURCE_set_ok = no + then + { echo "$as_me:4339: WARNING: _XOPEN_SOURCE is lower than requested" >&5 +echo "$as_me: WARNING: _XOPEN_SOURCE is lower than requested" >&2;} + fi + else + +echo "$as_me:4344: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 4351 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4370: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4373: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4376: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4379: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + + cat >conftest.$ac_ext <<_ACEOF +#line 4391 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4410: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4413: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4416: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4419: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4434: result: $cf_cv_xopen_source" >&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + +if test "$cf_cv_xopen_source" != no ; then + +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"_XOPEN_SOURCE"'\(=[^ ]*\)\?$//g'` + + cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_temp_xopen_source +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + + fi +fi +fi # cf_cv_posix_visible + +echo "$as_me:4553: checking if SIGWINCH is defined" >&5 +echo $ECHO_N "checking if SIGWINCH is defined... $ECHO_C" >&6 +if test "${cf_cv_define_sigwinch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 4560 "configure" +#include "confdefs.h" + +#include +#include + +int +main (void) +{ +int x = SIGWINCH; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4575: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4578: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4581: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4584: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_define_sigwinch=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line 4591 "configure" +#include "confdefs.h" + +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include + +int +main (void) +{ +int x = SIGWINCH; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4609: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4612: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4615: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4618: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_define_sigwinch=maybe +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_define_sigwinch=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:4632: result: $cf_cv_define_sigwinch" >&5 +echo "${ECHO_T}$cf_cv_define_sigwinch" >&6 + +if test "$cf_cv_define_sigwinch" = maybe ; then +echo "$as_me:4636: checking for actual SIGWINCH definition" >&5 +echo $ECHO_N "checking for actual SIGWINCH definition... $ECHO_C" >&6 +if test "${cf_cv_fixup_sigwinch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_fixup_sigwinch=unknown +cf_sigwinch=32 +while test $cf_sigwinch != 1 +do + cat >conftest.$ac_ext <<_ACEOF +#line 4647 "configure" +#include "confdefs.h" + +#undef _XOPEN_SOURCE +#undef _POSIX_SOURCE +#undef _POSIX_C_SOURCE +#include +#include + +int +main (void) +{ + +#if SIGWINCH != $cf_sigwinch +make an error +#endif +int x = SIGWINCH; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4669: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4672: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4675: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4678: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_fixup_sigwinch=$cf_sigwinch + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +cf_sigwinch=`expr $cf_sigwinch - 1` +done + +fi +echo "$as_me:4692: result: $cf_cv_fixup_sigwinch" >&5 +echo "${ECHO_T}$cf_cv_fixup_sigwinch" >&6 + + if test "$cf_cv_fixup_sigwinch" != unknown ; then + CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch" + fi +fi + +### checks for header files + +for ac_header in \ +ncurses/curses.h \ +ncurses/term.h \ +stdlib.h \ +sys/ptem.h sys/ttydefaults.h \ +term.h \ +termios.h \ +unistd.h \ +wchar.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:4714: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4720 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:4724: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4730: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4749: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +if test "${ac_cv_header_time+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4765 "configure" +#include "confdefs.h" +#include +#include +#include + +int +main (void) +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4781: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4784: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4787: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4790: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_time=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_time=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:4800: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6 +if test $ac_cv_header_time = yes; then + +cat >>confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo "$as_me:4810: checking for nl_langinfo and CODESET" >&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 +if test "${am_cv_langinfo_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4816 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +char* cs = nl_langinfo(CODESET); (void)cs + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4828: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4831: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4834: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4837: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_langinfo_codeset=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_langinfo_codeset=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:4848: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 + if test $am_cv_langinfo_codeset = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LANGINFO_CODESET 1 +EOF + + fi + +### checks for typedefs + +echo "$as_me:4860: checking for signal global datatype" >&5 +echo $ECHO_N "checking for signal global datatype... $ECHO_C" >&6 +if test "${cf_cv_sig_atomic_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + for cf_type in \ + "volatile sig_atomic_t" \ + "sig_atomic_t" \ + "int" + do + cat >conftest.$ac_ext <<_ACEOF +#line 4872 "configure" +#include "confdefs.h" + +#include +#include +#include + +extern $cf_type x; +$cf_type x; +static void handler(int sig) +{ + (void)sig; + x = 5; +} +int +main (void) +{ +signal(SIGINT, handler); + x = 1 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4896: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4899: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4902: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4905: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_sig_atomic_t=$cf_type +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_sig_atomic_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + test "$cf_cv_sig_atomic_t" != no && break + done + +fi + +echo "$as_me:4919: result: $cf_cv_sig_atomic_t" >&5 +echo "${ECHO_T}$cf_cv_sig_atomic_t" >&6 +test "$cf_cv_sig_atomic_t" != no && +cat >>confdefs.h <&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4932 "configure" +#include "confdefs.h" +#include +#include +#include +#include + +_ACEOF +if { (eval echo "$as_me:4940: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4946: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 4968 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -rf conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +#line 4986 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -rf conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +#line 5007 "configure" +#include "confdefs.h" +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main (void) +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + $ac_main_return(2); + $ac_main_return (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:5033: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5036: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:5038: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5041: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_stdc=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:5054: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:5070: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5076 "configure" +#include "confdefs.h" +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5082: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5085: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5088: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5091: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Header=no" +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:5101: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for time_t... $ECHO_C" >&6 +if test "${ac_cv_type_time_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5117 "configure" +#include "confdefs.h" +$ac_includes_default +int +main (void) +{ +if ((time_t *) 0) + return 0; +if (sizeof (time_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5132: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5135: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5138: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5141: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_time_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_time_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:5151: result: $ac_cv_type_time_t" >&5 +echo "${ECHO_T}$ac_cv_type_time_t" >&6 +if test $ac_cv_type_time_t = yes; then + : +else + +cat >>confdefs.h < or " >&5 +echo $ECHO_N "checking for cc_t in or ... $ECHO_C" >&6 +if test "${cf_cv_type_cc_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 5170 "configure" +#include "confdefs.h" + +#include +#if defined(HAVE_TERMIOS_H) +#include +#else +#include +#include +#endif + +int +main (void) +{ +cc_t x; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5190: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5193: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5196: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5199: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_cc_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_type_cc_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + +echo "$as_me:5211: result: $cf_cv_type_cc_t" >&5 +echo "${ECHO_T}$cf_cv_type_cc_t" >&6 +test $cf_cv_type_cc_t = no && +cat >>confdefs.h <<\EOF +#define cc_t unsigned char +EOF + +echo "$as_me:5218: checking for mode_t" >&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 +if test "${ac_cv_type_mode_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5224 "configure" +#include "confdefs.h" +$ac_includes_default +int +main (void) +{ +if ((mode_t *) 0) + return 0; +if (sizeof (mode_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5239: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5242: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5245: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5248: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_mode_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_mode_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:5258: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6 +if test $ac_cv_type_mode_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5276 "configure" +#include "confdefs.h" +$ac_includes_default +int +main (void) +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5291: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5294: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5297: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5300: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_pid_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:5310: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6 +if test "${ac_cv_type_uid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5328 "configure" +#include "confdefs.h" +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + ac_cv_type_uid_t=yes +else + ac_cv_type_uid_t=no +fi +rm -rf conftest* + +fi +echo "$as_me:5342: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6 +if test $ac_cv_type_uid_t = no; then + +cat >>confdefs.h <<\EOF +#define uid_t int +EOF + +cat >>confdefs.h <<\EOF +#define gid_t int +EOF + +fi + +echo "$as_me:5356: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +if test "${ac_cv_type_off_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5362 "configure" +#include "confdefs.h" +$ac_includes_default +int +main (void) +{ +if ((off_t *) 0) + return 0; +if (sizeof (off_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5377: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5380: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5383: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5386: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_off_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_type_off_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:5396: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6 +if test $ac_cv_type_off_t = yes; then + : +else + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5434 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:5465: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:5468: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:5471: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5474: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:5484: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 5503 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:5507: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:5513: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:5532: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for lastlog path... $ECHO_C" >&6 +if test "${cf_cv_path_lastlog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 5549 "configure" +#include "confdefs.h" + +#include +#ifdef HAVE_LASTLOG_H +#include +#else +#ifdef HAVE_PATHS_H +#include +#endif +#endif +int +main (void) +{ +char *path = _PATH_LASTLOG; (void)path + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5569: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5572: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5575: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5578: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_path_lastlog="_PATH_LASTLOG" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +if test -f /usr/adm/lastlog ; then + cf_cv_path_lastlog=/usr/adm/lastlog + else + cf_cv_path_lastlog=no + fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:5593: result: $cf_cv_path_lastlog" >&5 +echo "${ECHO_T}$cf_cv_path_lastlog" >&6 +test $cf_cv_path_lastlog != no && +cat >>confdefs.h <<\EOF +#define USE_LASTLOG 1 +EOF + +echo "$as_me:5600: checking for utmp implementation" >&5 +echo $ECHO_N "checking for utmp implementation... $ECHO_C" >&6 +if test "${cf_cv_have_utmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_have_utmp=no +for cf_header in utmpx utmp ; do +cf_utmp_includes=" +#include +#include <${cf_header}.h> +#define getutent getutxent +#ifdef USE_LASTLOG +#include /* may conflict with utmpx.h on Linux */ +#endif +" + cat >conftest.$ac_ext <<_ACEOF +#line 5617 "configure" +#include "confdefs.h" +$cf_utmp_includes +int +main (void) +{ +struct $cf_header x; + char *name = x.ut_name; /* utmp.h and compatible definitions */ + (void)x; + (void)name; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5633: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5636: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5639: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5642: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cat >conftest.$ac_ext <<_ACEOF +#line 5651 "configure" +#include "confdefs.h" +$cf_utmp_includes +int +main (void) +{ +struct $cf_header x; + char *name = x.ut_user; /* utmpx.h must declare this */ + (void)x; + (void)name; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5667: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5670: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5673: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5676: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp=$cf_header + break + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:5691: result: $cf_cv_have_utmp" >&5 +echo "${ECHO_T}$cf_cv_have_utmp" >&6 + +if test $cf_cv_have_utmp != no ; then + +cat >>confdefs.h <<\EOF +#define HAVE_UTMP 1 +EOF + + test $cf_cv_have_utmp = utmpx && +cat >>confdefs.h <<\EOF +#define UTMPX_FOR_UTMP 1 +EOF + +if test $cf_cv_have_utmp != no ; then +echo "$as_me:5706: checking if ${cf_cv_have_utmp}.ut_host is declared" >&5 +echo $ECHO_N "checking if ${cf_cv_have_utmp}.ut_host is declared... $ECHO_C" >&6 +if test "${cf_cv_have_utmp_ut_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 5713 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ +struct $cf_cv_have_utmp x; + char *y = &x.ut_host[0]; + (void)x; + (void)y + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5730: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5733: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5736: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5739: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_host=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_utmp_ut_host=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + +echo "$as_me:5751: result: $cf_cv_have_utmp_ut_host" >&5 +echo "${ECHO_T}$cf_cv_have_utmp_ut_host" >&6 +test $cf_cv_have_utmp_ut_host != no && +cat >>confdefs.h <<\EOF +#define HAVE_UTMP_UT_HOST 1 +EOF + +fi + +if test $cf_cv_have_utmp != no ; then +echo "$as_me:5761: checking if ${cf_cv_have_utmp}.ut_syslen is declared" >&5 +echo $ECHO_N "checking if ${cf_cv_have_utmp}.ut_syslen is declared... $ECHO_C" >&6 +if test "${cf_cv_have_utmp_ut_syslen+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 5768 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ +struct $cf_cv_have_utmp x; + int y = x.ut_syslen; + (void)x; + (void)y + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5785: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5788: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5791: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5794: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_syslen=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_utmp_ut_syslen=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + +echo "$as_me:5806: result: $cf_cv_have_utmp_ut_syslen" >&5 +echo "${ECHO_T}$cf_cv_have_utmp_ut_syslen" >&6 +test $cf_cv_have_utmp_ut_syslen != no && +cat >>confdefs.h <<\EOF +#define HAVE_UTMP_UT_SYSLEN 1 +EOF + +fi + +if test $cf_cv_have_utmp != no ; then +echo "$as_me:5816: checking if ${cf_cv_have_utmp}.ut_name is declared" >&5 +echo $ECHO_N "checking if ${cf_cv_have_utmp}.ut_name is declared... $ECHO_C" >&6 +if test "${cf_cv_have_utmp_ut_name+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_have_utmp_ut_name=no +cf_utmp_includes=" +#include +#include <${cf_cv_have_utmp}.h> +#define getutent getutxent +#ifdef USE_LASTLOG +#include /* may conflict with utmpx.h on Linux */ +#endif +" +for cf_header in ut_name ut_user ; do + cat >conftest.$ac_ext <<_ACEOF +#line 5833 "configure" +#include "confdefs.h" +$cf_utmp_includes +int +main (void) +{ +struct $cf_cv_have_utmp x; + char *name = x.$cf_header; + (void)x; + (void)name; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5849: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5852: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5855: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5858: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_name=$cf_header + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:5870: result: $cf_cv_have_utmp_ut_name" >&5 +echo "${ECHO_T}$cf_cv_have_utmp_ut_name" >&6 + +case $cf_cv_have_utmp_ut_name in +(no) + { { echo "$as_me:5875: error: Cannot find declaration for ut.ut_name" >&5 +echo "$as_me: error: Cannot find declaration for ut.ut_name" >&2;} + { (exit 1); exit 1; }; } + ;; +(ut_user) + +cat >>confdefs.h <<\EOF +#define ut_name ut_user +EOF + + ;; +esac +fi + +if test $cf_cv_have_utmp != no ; then +echo "$as_me:5890: checking for exit-status in $cf_cv_have_utmp" >&5 +echo $ECHO_N "checking for exit-status in $cf_cv_have_utmp... $ECHO_C" >&6 +if test "${cf_cv_have_utmp_ut_xstatus+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +for cf_result in \ + ut_exit.__e_exit \ + ut_exit.e_exit \ + ut_exit.ut_e_exit \ + ut_exit.ut_exit +do +cat >conftest.$ac_ext <<_ACEOF +#line 5903 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ +struct $cf_cv_have_utmp x; + long y = x.$cf_result = 0; + (void)x; + (void)y + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5920: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5923: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5926: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5929: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_xstatus=$cf_result + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_utmp_ut_xstatus=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done + +fi +echo "$as_me:5942: result: $cf_cv_have_utmp_ut_xstatus" >&5 +echo "${ECHO_T}$cf_cv_have_utmp_ut_xstatus" >&6 +if test $cf_cv_have_utmp_ut_xstatus != no ; then + +cat >>confdefs.h <<\EOF +#define HAVE_UTMP_UT_XSTATUS 1 +EOF + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if ${cf_cv_have_utmp}.ut_xtime is declared... $ECHO_C" >&6 +if test "${cf_cv_have_utmp_ut_xtime+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 5965 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ +struct $cf_cv_have_utmp x; + long y = x.ut_xtime = 0; + (void)x; + (void)y + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:5982: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:5985: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:5988: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:5991: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_xtime=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cat >conftest.$ac_ext <<_ACEOF +#line 5998 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ +struct $cf_cv_have_utmp x; + long y = x.ut_tv.tv_sec; + (void)x; + (void)y + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6015: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6018: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6021: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6024: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_xtime=define +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_utmp_ut_xtime=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:6038: result: $cf_cv_have_utmp_ut_xtime" >&5 +echo "${ECHO_T}$cf_cv_have_utmp_ut_xtime" >&6 +if test $cf_cv_have_utmp_ut_xtime != no ; then + +cat >>confdefs.h <<\EOF +#define HAVE_UTMP_UT_XTIME 1 +EOF + + if test $cf_cv_have_utmp_ut_xtime = define ; then + +cat >>confdefs.h <<\EOF +#define ut_xtime ut_tv.tv_sec +EOF + + fi +fi +fi + +if test $cf_cv_have_utmp != no ; then +echo "$as_me:6057: checking if ${cf_cv_have_utmp}.ut_session is declared" >&5 +echo $ECHO_N "checking if ${cf_cv_have_utmp}.ut_session is declared... $ECHO_C" >&6 +if test "${cf_cv_have_utmp_ut_session+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 6064 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ +struct $cf_cv_have_utmp x; + long y = x.ut_session; + (void)x; + (void)y + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6081: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6084: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6087: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6090: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_utmp_ut_session=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_utmp_ut_session=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:6101: result: $cf_cv_have_utmp_ut_session" >&5 +echo "${ECHO_T}$cf_cv_have_utmp_ut_session" >&6 +if test $cf_cv_have_utmp_ut_session != no ; then + +cat >>confdefs.h <<\EOF +#define HAVE_UTMP_UT_SESSION 1 +EOF + +fi +fi + +echo "$as_me:6112: checking if $cf_cv_have_utmp is SYSV flavor" >&5 +echo $ECHO_N "checking if $cf_cv_have_utmp is SYSV flavor... $ECHO_C" >&6 +if test "${cf_cv_sysv_utmp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" +cat >conftest.$ac_ext <<_ACEOF +#line 6120 "configure" +#include "confdefs.h" + +#include +#include <${cf_cv_have_utmp}.h> +int +main (void) +{ + +struct $cf_cv_have_utmp x; + set${cf_prefix}ent (); + get${cf_prefix}id(&x); + put${cf_prefix}line(&x); + end${cf_prefix}ent(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6139: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6142: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6145: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6148: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_sysv_utmp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_sysv_utmp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:6159: result: $cf_cv_sysv_utmp" >&5 +echo "${ECHO_T}$cf_cv_sysv_utmp" >&6 +test $cf_cv_sysv_utmp = yes && +cat >>confdefs.h <<\EOF +#define USE_SYSV_UTMP 1 +EOF + +fi + +for ac_header in lastlog.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:6171: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6177 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6181: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6187: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6206: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for struct lastlog... $ECHO_C" >&6 +if test "${cf_cv_struct_lastlog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +if test "$cross_compiling" = yes; then + +cf_cv_struct_lastlog=unknown +else + cat >conftest.$ac_ext <<_ACEOF +#line 6227 "configure" +#include "confdefs.h" + +#include +#include +#include + +int main(void) +{ + struct lastlog data; + return (sizeof(data.ll_time) != sizeof(time_t)); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:6241: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6244: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:6246: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6249: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +cf_cv_struct_lastlog=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +cf_cv_struct_lastlog=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:6263: result: $cf_cv_struct_lastlog" >&5 +echo "${ECHO_T}$cf_cv_struct_lastlog" >&6 + +test $cf_cv_struct_lastlog != no && +cat >>confdefs.h <<\EOF +#define USE_STRUCT_LASTLOG 1 +EOF + +for ac_header in \ +sys/param.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:6276: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6282 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6286: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6292: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6311: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if POSIX saved-ids are supported... $ECHO_C" >&6 +if test "${cf_cv_posix_saved_ids+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 6328 "configure" +#include "confdefs.h" + +#include +#ifdef HAVE_SYS_PARAM_H +#include /* this may define "BSD" */ +#endif + +int +main (void) +{ + +#if defined(_POSIX_SAVED_IDS) && (_POSIX_SAVED_IDS > 0) + void *p = (void *) seteuid; + int x = seteuid(geteuid()); + (void)p; + (void)x; +#elif defined(BSD) && (BSD >= 199103) +/* The BSD's may implement the runtime check - and it fails. + * However, saved-ids work almost like POSIX (close enough for most uses). + */ +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6358: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6361: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6364: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6367: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_saved_ids=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +if test "$cross_compiling" = yes; then + cf_cv_posix_saved_ids=unknown +else + cat >conftest.$ac_ext <<_ACEOF +#line 6379 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDLIB_H +#include +#endif +#include +int main(void) +{ + void *p = (void *) seteuid; + long code = sysconf(_SC_SAVED_IDS); + (void)p; + ${cf_cv_main_return:-return} ((code > 0) ? 0 : 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:6395: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6398: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:6400: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6403: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_saved_ids=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_saved_ids=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:6419: result: $cf_cv_posix_saved_ids" >&5 +echo "${ECHO_T}$cf_cv_posix_saved_ids" >&6 + +test "$cf_cv_posix_saved_ids" = yes && +cat >>confdefs.h <<\EOF +#define HAVE_POSIX_SAVED_IDS 1 +EOF + +# compute a reasonable value for $TERM to give tgetent(), since we may be +# running in 'screen', which sets $TERMCAP to a specific entry that is not +# necessarily in /etc/termcap - unsetenv is not portable, so we cannot simply +# discard $TERMCAP. +cf_TERMVAR=vt100 +if test -n "$TERMCAP" +then + cf_TERMCAP=`echo "$TERMCAP" | tr '\n' ' ' | sed -e 's/^..|//' -e 's/|.*//'` + case "$cf_TERMCAP" in + (screen*.*) + ;; + (*) + cf_TERMVAR="$cf_TERMCAP" + ;; + esac +fi +test -z "$cf_TERMVAR" && cf_TERMVAR=vt100 + +# BSD termcap used no header file +# SVr4 provided termcap prototypes as a legacy feature in term.h +# GNU termcap provided termcap prototypes in termcap.h +# ncurses provides termcap prototypes in both term.h and termcap.h +# +# The terminfo-based termcap interfaces do not provide a full tgetent (i.e., do +# not return the text of the termcap entry in the buffer), but as a special +# case, FreeBSD provides ncurses' termcap.h with a modified termcap reader that +# returns the termcap text. + +for ac_header in termcap.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:6458: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6464 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6468: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6474: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6493: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if we want full tgetent function... $ECHO_C" >&6 + +# Check whether --enable-full-tgetent or --disable-full-tgetent was given. +if test "${enable_full_tgetent+set}" = set; then + enableval="$enable_full_tgetent" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_full_tgetent=no + else + cf_full_tgetent=yes + fi +else + enableval=yes + cf_full_tgetent=yes + +fi; +echo "$as_me:6520: result: $cf_full_tgetent" >&5 +echo "${ECHO_T}$cf_full_tgetent" >&6 + +if test "$cf_full_tgetent" = yes ; then + cf_test_message="full tgetent" +else + cf_test_message="tgetent" +fi + +echo "$as_me:6529: checking for $cf_test_message function" >&5 +echo $ECHO_N "checking for $cf_test_message function... $ECHO_C" >&6 +if test "${cf_cv_lib_tgetent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_save_LIBS="$LIBS" +cf_cv_lib_tgetent=no +if test "$cf_full_tgetent" = yes ; then + cf_TERMLIB="otermcap termcap termlib ncurses curses" + cf_TERMTST="buffer[0] == 0" +else + cf_TERMLIB="termlib ncurses curses" + cf_TERMTST="0" +fi +for cf_termlib in '' $cf_TERMLIB ; do + LIBS="$cf_save_LIBS" + test -n "$cf_termlib" && { +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -l$cf_termlib; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + } + if test "$cross_compiling" = yes; then + echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&5 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6567 "configure" +#include "confdefs.h" + +#ifdef HAVE_TERMCAP_H +#include +#endif +/* terminfo implementations ignore the buffer argument, making it useless for + * the xterm application, which uses this information to make a new TERMCAP + * environment variable. + */ +int main(void) +{ + char buffer[1024]; + buffer[0] = 0; + tgetent(buffer, "$cf_TERMVAR"); + ${cf_cv_main_return:-return} ($cf_TERMTST); } +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:6585: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6588: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:6590: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6593: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&5 + if test -n "$cf_termlib" ; then + cf_cv_lib_tgetent="-l$cf_termlib" + else + cf_cv_lib_tgetent=yes + fi + break +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "no, there is no termcap/tgetent in $cf_termlib" 1>&5 +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +done +LIBS="$cf_save_LIBS" + +fi +echo "$as_me:6614: result: $cf_cv_lib_tgetent" >&5 +echo "${ECHO_T}$cf_cv_lib_tgetent" >&6 + +# If we found a working tgetent(), set LIBS and check for termcap.h. +# (LIBS cannot be set inside AC_CACHE_CHECK; the commands there should +# not have side effects other than setting the cache variable, because +# they are not executed when a cached value exists.) +if test "x$cf_cv_lib_tgetent" != xno ; then + test "x$cf_cv_lib_tgetent" != xyes && { +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_cv_lib_tgetent; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + } + +cat >>confdefs.h <<\EOF +#define USE_TERMCAP 1 +EOF + + if test "$cf_full_tgetent" = no ; then + cat >conftest.$ac_ext <<_ACEOF +#line 6646 "configure" +#include "confdefs.h" + +#include +int +main (void) +{ + +#ifdef NCURSES_VERSION +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6662: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6665: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6668: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6671: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cat >>confdefs.h <<\EOF +#define HAVE_TERMCAP_H 1 +EOF + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + else + +for ac_header in termcap.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:6687: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6693 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6697: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6703: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6722: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for partial tgetent function... $ECHO_C" >&6 +if test "${cf_cv_lib_part_tgetent+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cf_cv_lib_part_tgetent=no + for cf_termlib in $cf_TERMLIB ; do + LIBS="$cf_save_LIBS -l$cf_termlib" + cat >conftest.$ac_ext <<_ACEOF +#line 6749 "configure" +#include "confdefs.h" + +int +main (void) +{ +tgetent(0, "$cf_TERMVAR") + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6761: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6764: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6767: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6770: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "there is a terminfo/tgetent in $cf_termlib" 1>&5 + cf_cv_lib_part_tgetent="-l$cf_termlib" + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + LIBS="$cf_save_LIBS" + +fi +echo "$as_me:6784: result: $cf_cv_lib_part_tgetent" >&5 +echo "${ECHO_T}$cf_cv_lib_part_tgetent" >&6 + + if test "$cf_cv_lib_part_tgetent" != no ; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_cv_lib_part_tgetent; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +for ac_header in termcap.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:6808: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6814 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:6818: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:6824: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:6843: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <>confdefs.h <<\EOF +#define USE_TERMINFO 1 +EOF + + fi +fi + +echo "$as_me:6863: checking for X applications class" >&5 +echo $ECHO_N "checking for X applications class... $ECHO_C" >&6 + +# Check whether --with-app-class or --without-app-class was given. +if test "${with_app_class+set}" = set; then + withval="$with_app_class" + APP_CLASS=$withval +else + APP_CLASS=XTerm +fi; + +case x$APP_CLASS in +(*[/@,%]*) + { echo "$as_me:6876: WARNING: X applications class cannot contain punctuation" >&5 +echo "$as_me: WARNING: X applications class cannot contain punctuation" >&2;} + APP_CLASS=XTerm + ;; +(x[A-Z]*) + ;; +(*) + { echo "$as_me:6883: WARNING: X applications class must start with capital, ignoring $APP_CLASS" >&5 +echo "$as_me: WARNING: X applications class must start with capital, ignoring $APP_CLASS" >&2;} + APP_CLASS=XTerm + ;; +esac + +echo "$as_me:6889: result: $APP_CLASS" >&5 +echo "${ECHO_T}$APP_CLASS" >&6 + +echo "$as_me:6892: checking for directory to install resource files" >&5 +echo $ECHO_N "checking for directory to install resource files... $ECHO_C" >&6 + +# Check whether --with-app-defaults or --without-app-defaults was given. +if test "${with_app_defaults+set}" = set; then + withval="$with_app_defaults" + APPSDIR=$withval +else + APPSDIR='${exec_prefix}/lib/X11/app-defaults' +fi; + +if test "x$APPSDIR" = xauto +then + APPSDIR='${exec_prefix}/lib/X11/app-defaults' + for cf_path in \ + /opt/local/share/X11/app-defaults \ + /opt/X11/share/X11/app-defaults \ + /usr/share/X11/app-defaults \ + /usr/X11/share/X11/app-defaults \ + /usr/X11/lib/X11/app-defaults \ + /usr/lib/X11/app-defaults \ + /etc/X11/app-defaults \ + /usr/pkg/lib/X11/app-defaults \ + /usr/X11R7/lib/X11/app-defaults \ + /usr/X11R6/lib/X11/app-defaults \ + /usr/X11R5/lib/X11/app-defaults \ + /usr/X11R4/lib/X11/app-defaults \ + /usr/local/lib/X11/app-defaults \ + /usr/local/share/X11/app-defaults \ + /usr/lib64/X11/app-defaults + do + if test -d "$cf_path" ; then + APPSDIR="$cf_path" + break + fi + done +else + cf_path=$APPSDIR + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$cf_path" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval cf_path="$cf_path" + case ".$cf_path" in + (.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:6956: error: expected a pathname, not \"$cf_path\"" >&5 +echo "$as_me: error: expected a pathname, not \"$cf_path\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +fi + +echo "$as_me:6964: result: $APPSDIR" >&5 +echo "${ECHO_T}$APPSDIR" >&6 + +no_appsdir= +if test "$APPSDIR" = no +then + no_appsdir="#" +else + EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(APPSDIR)" +fi + +echo "$as_me:6975: checking for the icon name" >&5 +echo $ECHO_N "checking for the icon name... $ECHO_C" >&6 + +# Check whether --with-icon-name or --without-icon-name was given. +if test "${with_icon_name+set}" = set; then + withval="$with_icon_name" + ICON_NAME="$withval" +else + ICON_NAME=mini.xterm +fi; +case "x$ICON_NAME" in +(xyes|xno|x) + ICON_NAME=mini.xterm + ;; +esac + +echo "$as_me:6991: result: $ICON_NAME" >&5 +echo "${ECHO_T}$ICON_NAME" >&6 + +echo "$as_me:6994: checking for icon symlink to use" >&5 +echo $ECHO_N "checking for icon symlink to use... $ECHO_C" >&6 + +# Check whether --with-icon-symlink or --without-icon-symlink was given. +if test "${with_icon_symlink+set}" = set; then + withval="$with_icon_symlink" + ICON_SYMLINK="$withval" +else + ICON_SYMLINK=NONE +fi; +case "x$ICON_SYMLINK" in +(xyes) + ICON_SYMLINK=xterm + ;; +(xno|x) + ICON_SYMLINK=NONE + ;; +esac + +echo "$as_me:7013: result: $ICON_SYMLINK" >&5 +echo "${ECHO_T}$ICON_SYMLINK" >&6 + +# Install all icons except for the overused "terminal". +cf_cv_icon_list= +for my_item in $srcdir/icons/*.svg +do + test -f "$my_item" || continue + cf_icon_name=`echo $my_item |sed -e "s,.svg,," -e "s,^$srcdir/,,"` + case $cf_icon_name in + (*_48x48) + continue + ;; + esac + test -n "$verbose" && echo " adding $cf_icon_name to icon-list" 1>&6 + +echo "${as_me:-configure}:7029: testing adding $cf_icon_name to icon-list ..." 1>&5 + + cf_cv_icon_list="$cf_cv_icon_list $cf_icon_name" + if test -f "${cf_icon_name}_48x48.png" + then + test -n "$verbose" && echo " adding ${cf_icon_name}_48x48 to icon-list" 1>&6 + +echo "${as_me:-configure}:7036: testing adding ${cf_icon_name}_48x48 to icon-list ..." 1>&5 + + cf_cv_icon_list="$cf_cv_icon_list ${cf_icon_name}_48x48" + fi +done + +echo "$as_me:7042: checking for directory to install pixmaps" >&5 +echo $ECHO_N "checking for directory to install pixmaps... $ECHO_C" >&6 + +# Check whether --with-pixmapdir or --without-pixmapdir was given. +if test "${with_pixmapdir+set}" = set; then + withval="$with_pixmapdir" + PIXMAPDIR=$withval +else + test -z "$PIXMAPDIR" && PIXMAPDIR='${datadir}/pixmaps' +fi; + +if test "x$PIXMAPDIR" = xauto +then + PIXMAPDIR='${datadir}/pixmaps' + for cf_path in \ + /usr/share/pixmaps \ + /usr/X11R6/share/pixmaps + do + if test -d "$cf_path" ; then + PIXMAPDIR="$cf_path" + break + fi + done +else + cf_path=$PIXMAPDIR + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$cf_path" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval cf_path="$cf_path" + case ".$cf_path" in + (.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:7093: error: expected a pathname, not \"$cf_path\"" >&5 +echo "$as_me: error: expected a pathname, not \"$cf_path\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +fi +echo "$as_me:7100: result: $PIXMAPDIR" >&5 +echo "${ECHO_T}$PIXMAPDIR" >&6 + +no_pixmapdir= +if test "$PIXMAPDIR" = no +then + no_pixmapdir="#" +else + EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(PIXMAPDIR)" +fi + +echo "$as_me:7111: checking for directory to install icons" >&5 +echo $ECHO_N "checking for directory to install icons... $ECHO_C" >&6 + +# Check whether --with-icondir or --without-icondir was given. +if test "${with_icondir+set}" = set; then + withval="$with_icondir" + ICONDIR=$withval +else + test -z "$ICONDIR" && ICONDIR=no +fi; + +if test "x$ICONDIR" = xauto +then + ICONDIR='${datadir}/icons' + for cf_path in \ + /usr/share/icons \ + /usr/X11R6/share/icons + do + if test -d "$cf_path" ; then + ICONDIR="$cf_path" + break + fi + done +else + cf_path=$ICONDIR + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$cf_path" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval cf_path="$cf_path" + case ".$cf_path" in + (.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + cf_path=`echo $cf_path | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:7162: error: expected a pathname, not \"$cf_path\"" >&5 +echo "$as_me: error: expected a pathname, not \"$cf_path\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +fi +echo "$as_me:7169: result: $ICONDIR" >&5 +echo "${ECHO_T}$ICONDIR" >&6 + +no_icondir= +if test "$ICONDIR" = no +then + no_icondir="#" +else + EXTRA_INSTALL_DIRS="$EXTRA_INSTALL_DIRS \$(ICONDIR)" +fi + +echo "$as_me:7180: checking if icon theme should be used" >&5 +echo $ECHO_N "checking if icon theme should be used... $ECHO_C" >&6 + +# Check whether --with-icon-theme or --without-icon-theme was given. +if test "${with_icon_theme+set}" = set; then + withval="$with_icon_theme" + ICON_THEME=$withval +else + ICON_THEME=no +fi; + +case "x$ICON_THEME" in +(xno) + ;; +(x|xyes) + ICON_THEME=hicolor + ;; +esac +echo "$as_me:7198: result: $ICON_THEME" >&5 +echo "${ECHO_T}$ICON_THEME" >&6 + +if test "x$ICON_THEME" = xno +then + if test "x$ICONDIR" != xno + then + test -n "$verbose" && echo " ignoring icondir without theme" 1>&6 + +echo "${as_me:-configure}:7207: testing ignoring icondir without theme ..." 1>&5 + + no_icondir="#" + fi +else + if test "x$ICONDIR" = xno + then + { { echo "$as_me:7214: error: icondir must be set for icon theme" >&5 +echo "$as_me: error: icondir must be set for icon theme" >&2;} + { (exit 1); exit 1; }; } + fi +fi + +: ${ICON_FORMAT:=".svg .png .xpm"} + +ICON_LIST= + +if test "x$ICON_THEME" != xno +then + cf_icon_list="$cf_cv_icon_list" +else + cf_icon_list="icons/${ICON_NAME}_48x48" +fi + +echo "$as_me:7231: checking for icon(s) to install" >&5 +echo $ECHO_N "checking for icon(s) to install... $ECHO_C" >&6 +for cf_name in $cf_icon_list +do + test -n "$verbose" && echo " using $ICON_FORMAT" 1>&6 + +echo "${as_me:-configure}:7237: testing using $ICON_FORMAT ..." 1>&5 + + for cf_suffix in $ICON_FORMAT + do + cf_icon="${cf_name}${cf_suffix}" + cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` + if test ! -f "${cf_left}" + then + if test "x$srcdir" != "x." + then + cf_icon="${srcdir}/${cf_left}" + cf_left=`echo "$cf_icon" | sed -e 's/:.*//'` + if test ! -f "${cf_left}" + then + continue + fi + else + continue + fi + fi + if test "x$ICON_THEME" != xno + then + cf_base=`basename $cf_left` + cf_trim=`echo "$cf_base" | sed -e 's/_[0-9][0-9]x[0-9][0-9]\././'` + case "x${cf_base}" in + (*:*) + cf_next=$cf_base + # user-defined mapping + ;; + (*.png) + cf_size=`file "$cf_left"|sed -e 's/^[^:]*://' -e 's/^.*[^0-9]\([0-9][0-9]* x [0-9][0-9]*\)[^0-9].*$/\1/' -e 's/ //g'` + if test -z "$cf_size" + then + { echo "$as_me:7270: WARNING: cannot determine size of $cf_left" >&5 +echo "$as_me: WARNING: cannot determine size of $cf_left" >&2;} + continue + fi + cf_next="$cf_size/apps/$cf_trim" + ;; + (*.svg) + cf_next="scalable/apps/$cf_trim" + ;; + (*.xpm) + test -n "$verbose" && echo " ignored XPM file in icon theme" 1>&6 + +echo "${as_me:-configure}:7282: testing ignored XPM file in icon theme ..." 1>&5 + + continue + ;; + (*_[0-9][0-9]*x[0-9][0-9]*.*) + cf_size=`echo "$cf_left"|sed -e 's/^.*_\([0-9][0-9]*x[0-9][0-9]*\)\..*$/\1/'` + cf_left=`echo "$cf_left"|sed -e 's/^\(.*\)_\([0-9][0-9]*x[0-9][0-9]*\)\(\..*\)$/\1\3/'` + cf_next="$cf_size/apps/$cf_base" + ;; + esac + test -n "$verbose" && echo " adding $cf_next" 1>&6 + +echo "${as_me:-configure}:7294: testing adding $cf_next ..." 1>&5 + + cf_icon="${cf_icon}:${cf_next}" + fi + test -n "$ICON_LIST" && ICON_LIST="$ICON_LIST " + ICON_LIST="$ICON_LIST${cf_icon}" + if test -z "$ICON_NAME" + then + ICON_NAME=`basename $cf_icon | sed -e 's/[.:].*//'` + fi + done +done + +if test -n "$verbose" +then + echo "$as_me:7309: checking result" >&5 +echo $ECHO_N "checking result... $ECHO_C" >&6 +fi +echo "$as_me:7312: result: $ICON_LIST" >&5 +echo "${ECHO_T}$ICON_LIST" >&6 + +if test -z "$ICON_LIST" +then + { { echo "$as_me:7317: error: no icons found" >&5 +echo "$as_me: error: no icons found" >&2;} + { (exit 1); exit 1; }; } +fi + +echo "$as_me:7322: checking for icon name" >&5 +echo $ECHO_N "checking for icon name... $ECHO_C" >&6 +echo "$as_me:7324: result: $ICON_NAME" >&5 +echo "${ECHO_T}$ICON_NAME" >&6 + +# Comment-out the install-desktop rule if the desktop-utils are not found. +echo "$as_me:7328: checking if you want to install desktop files" >&5 +echo $ECHO_N "checking if you want to install desktop files... $ECHO_C" >&6 + +# Check whether --enable-desktop or --disable-desktop was given. +if test "${enable_desktop+set}" = set; then + enableval="$enable_desktop" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_desktop=$enableval + else + enable_desktop=$enableval + fi +else + enableval=yes + enable_desktop=$enableval + +fi; +echo "$as_me:7345: result: $enable_desktop" >&5 +echo "${ECHO_T}$enable_desktop" >&6 + +desktop_utils= +if test "$enable_desktop" = yes ; then +# Extract the first word of "desktop-file-install", so it can be a program name with args. +set dummy desktop-file-install; ac_word=$2 +echo "$as_me:7352: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_desktop_utils+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$desktop_utils"; then + ac_cv_prog_desktop_utils="$desktop_utils" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_desktop_utils="yes" +echo "$as_me:7367: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_desktop_utils" && ac_cv_prog_desktop_utils="no" +fi +fi +desktop_utils=$ac_cv_prog_desktop_utils +if test -n "$desktop_utils"; then + echo "$as_me:7376: result: $desktop_utils" >&5 +echo "${ECHO_T}$desktop_utils" >&6 +else + echo "$as_me:7379: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi + +test "$desktop_utils" = yes && desktop_utils= || desktop_utils="#" + +if test -z "$desktop_utils" +then + echo "$as_me:7389: checking for requested desktop-category" >&5 +echo $ECHO_N "checking for requested desktop-category... $ECHO_C" >&6 + +# Check whether --with-desktop-category or --without-desktop-category was given. +if test "${with_desktop_category+set}" = set; then + withval="$with_desktop_category" + cf_desktop_want=$withval +else + cf_desktop_want=auto +fi; + echo "$as_me:7399: result: $cf_desktop_want" >&5 +echo "${ECHO_T}$cf_desktop_want" >&6 + + if test "$cf_desktop_want" = auto + then + rm -rf conftest* + cf_desktop_also= + for cf_desktop_dir in \ + /usr/share/app-install \ + /usr/share/applications + do + if test -d $cf_desktop_dir + then + find $cf_desktop_dir -name '*.desktop' | \ + while true + do + read cf_desktop_path + test -z "$cf_desktop_path" && break + cf_desktop_name=`basename $cf_desktop_path .desktop` + case $cf_desktop_name in + (xterm|*-xterm|*rxvt*|*konsole|*[Tt]erminal) + test -n "$verbose" && echo " inspect $cf_desktop_path" 1>&6 + +echo "${as_me:-configure}:7422: testing inspect $cf_desktop_path ..." 1>&5 + + egrep '^Categories=' $cf_desktop_path | \ + tr ';' '\n' | \ + sed -e 's%^.*=%%' -e '/^$/d' >>conftest.1 + ;; + esac + done + fi + done + if test -s conftest.1 + then + cf_desktop_last= + sort conftest.1 | \ + while true + do + read cf_desktop_this + test -z "$cf_desktop_this" && break + case $cf_desktop_this in + (Qt*|GTK*|KDE*|GNOME*|*XFCE*|*Xfce*) + ;; + (System|TerminalEmulator|*) + test "x$cf_desktop_last" != "x$cf_desktop_this" && echo $cf_desktop_this >>conftest.2 + ;; + esac + cf_desktop_last=$cf_desktop_this + done + cf_desktop_want=`cat conftest.2 | tr '\n' ';'` + fi + if test -n "$cf_desktop_want" + then + if test "$cf_desktop_want" = auto + then + cf_desktop_want= + else + # do a sanity check on the semicolon-separated list, ignore on failure + cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/[^;]//g'` + test -z "$cf_desktop_test" && cf_desktop_want= + cf_desktop_test=`echo "$cf_desktop_want" | sed -e 's/^.*;$/./g'` + test -z "$cf_desktop_test" && cf_desktop_want= + fi + fi + if test -z "$cf_desktop_want" + then + cf_desktop_want="`echo "System|TerminalEmulator|*" | sed -e 's/\*//g' -e 's/|/;/g' -e 's/;*$/;/g'`" + test -n "$verbose" && echo " no usable value found for desktop category" 1>&6 + +echo "${as_me:-configure}:7469: testing no usable value found for desktop category ..." 1>&5 + + fi + fi + DESKTOP_CATEGORY=`echo "$cf_desktop_want" | sed -e 's/[ ,]/;/g'` + test -n "$verbose" && echo " will use Categories=$DESKTOP_CATEGORY" 1>&6 + +echo "${as_me:-configure}:7476: testing will use Categories=$DESKTOP_CATEGORY ..." 1>&5 + +fi + +echo "$as_me:7480: checking for install-permissions reference" >&5 +echo $ECHO_N "checking for install-permissions reference... $ECHO_C" >&6 + +# Check whether --with-reference or --without-reference was given. +if test "${with_reference+set}" = set; then + withval="$with_reference" + with_reference=$withval +else + with_reference=xterm +fi; +echo "$as_me:7490: result: $with_reference" >&5 +echo "${ECHO_T}$with_reference" >&6 + +with_full_paths=yes + + echo "$as_me:7495: checking for PATH separator" >&5 +echo $ECHO_N "checking for PATH separator... $ECHO_C" >&6 + case $cf_cv_system_name in + (os2*) PATH_SEPARATOR=';' ;; + (*) ${PATH_SEPARATOR:=':'} ;; + esac + + echo "$as_me:7502: result: $PATH_SEPARATOR" >&5 +echo "${ECHO_T}$PATH_SEPARATOR" >&6 + +test -z "$XTERM_PATH" && XTERM_PATH=$with_reference +for ac_prog in $XTERM_PATH $with_reference +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:7510: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_XTERM_PATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $XTERM_PATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_XTERM_PATH="$XTERM_PATH" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_XTERM_PATH="$ac_dir/$ac_word" + echo "$as_me:7527: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +XTERM_PATH=$ac_cv_path_XTERM_PATH + +if test -n "$XTERM_PATH"; then + echo "$as_me:7538: result: $XTERM_PATH" >&5 +echo "${ECHO_T}$XTERM_PATH" >&6 +else + echo "$as_me:7541: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$XTERM_PATH" && break +done +test -n "$XTERM_PATH" || XTERM_PATH="$XTERM_PATH" + +cf_path_prog="" +cf_path_args="" +IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" +for cf_temp in $ac_cv_path_XTERM_PATH +do + if test -z "$cf_path_prog" ; then + if test "$with_full_paths" = yes ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$cf_temp" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval cf_temp="$cf_temp" + case ".$cf_temp" in + (.NONE/*) + cf_temp=`echo $cf_temp | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + cf_temp=`echo $cf_temp | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + break + ;; +esac + + cf_path_prog="$cf_temp" + else + cf_path_prog="`basename $cf_temp`" + fi + elif test -z "$cf_path_args" ; then + cf_path_args="$cf_temp" + else + cf_path_args="$cf_path_args $cf_temp" + fi +done +IFS="$cf_save_ifs" + +if test -n "$cf_path_prog" ; then + +echo "${as_me:-configure}:7600: testing defining path for ${cf_path_prog} ..." 1>&5 + +cat >>confdefs.h <>confdefs.h <&5 +echo $ECHO_N "checking for symbolic link to create to $cf_name... $ECHO_C" >&6 + +# Check whether --with-xterm-symlink or --without-xterm-symlink was given. +if test "${with_xterm_symlink+set}" = set; then + withval="$with_xterm_symlink" + with_symlink=$withval +else + with_symlink=xterm +fi; +echo "$as_me:7631: result: $with_symlink" >&5 +echo "${ECHO_T}$with_symlink" >&6 +test "$with_symlink" = yes && with_symlink=xterm +test -n "$with_symlink" && \ + test "$with_symlink" != no && \ + test "$with_symlink" != $cf_name && \ + XTERM_SYMLINK="$with_symlink" +fi + +echo "$as_me:7640: checking if you want to disable openpty" >&5 +echo $ECHO_N "checking if you want to disable openpty... $ECHO_C" >&6 + +# Check whether --enable-openpty or --disable-openpty was given. +if test "${enable_openpty+set}" = set; then + enableval="$enable_openpty" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + disable_openpty=yes + else + disable_openpty=no + fi +else + enableval=yes + disable_openpty=no + +fi; +echo "$as_me:7657: result: $disable_openpty" >&5 +echo "${ECHO_T}$disable_openpty" >&6 + +echo "$as_me:7660: checking if you want to disable setuid" >&5 +echo $ECHO_N "checking if you want to disable setuid... $ECHO_C" >&6 + +# Check whether --enable-setuid or --disable-setuid was given. +if test "${enable_setuid+set}" = set; then + enableval="$enable_setuid" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + disable_setuid=yes + else + disable_setuid=no + fi +else + enableval=yes + disable_setuid=no + +fi; +echo "$as_me:7677: result: $disable_setuid" >&5 +echo "${ECHO_T}$disable_setuid" >&6 + +echo "$as_me:7680: checking if you want to disable setgid" >&5 +echo $ECHO_N "checking if you want to disable setgid... $ECHO_C" >&6 + +# Check whether --enable-setgid or --disable-setgid was given. +if test "${enable_setgid+set}" = set; then + enableval="$enable_setgid" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + disable_setgid=yes + else + disable_setgid=no + fi +else + enableval=yes + disable_setgid=no + +fi; +echo "$as_me:7697: result: $disable_setgid" >&5 +echo "${ECHO_T}$disable_setgid" >&6 + +echo "$as_me:7700: checking if you want to run xterm setuid to a given user" >&5 +echo $ECHO_N "checking if you want to run xterm setuid to a given user... $ECHO_C" >&6 + +# Check whether --with-setuid or --without-setuid was given. +if test "${with_setuid+set}" = set; then + withval="$with_setuid" + use_given_setuid=$withval +else + use_given_setuid=no +fi; +echo "$as_me:7710: result: $use_given_setuid" >&5 +echo "${ECHO_T}$use_given_setuid" >&6 + +if test "$use_given_setuid" != no ; then + if test "$use_given_setuid" = yes ; then + cf_cv_given_setuid=root + else + cf_cv_given_setuid=$use_given_setuid + fi + # inherit SINSTALL_OPTS from environment to allow packager to customize it. + SINSTALL_OPTS="$SINSTALL_OPTS u+s -u $cf_cv_given_setuid" +fi + +echo "$as_me:7723: checking if you want to run xterm setgid to match utmp/utmpx file" >&5 +echo $ECHO_N "checking if you want to run xterm setgid to match utmp/utmpx file... $ECHO_C" >&6 + +# Check whether --with-utmp-setgid or --without-utmp-setgid was given. +if test "${with_utmp_setgid+set}" = set; then + withval="$with_utmp_setgid" + use_utmp_setgid=$withval +else + use_utmp_setgid=no +fi; +echo "$as_me:7733: result: $use_utmp_setgid" >&5 +echo "${ECHO_T}$use_utmp_setgid" >&6 + +if test "$use_utmp_setgid" != no ; then + if test "$use_utmp_setgid" = yes ; then + +if test $cf_cv_have_utmp != no ; then +echo "$as_me:7740: checking for utmp/utmpx group" >&5 +echo $ECHO_N "checking for utmp/utmpx group... $ECHO_C" >&6 +if test "${cf_cv_utmp_group+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +for cf_utmp_path in /var/adm /var/run +do + for cf_utmp_file in utmpx utmp + do + if test -f $cf_utmp_path/$cf_utmp_file + then + cf_cv_utmp_group=root + + cf_option="-l -L" + + # Expect listing to have fields like this: + #-r--r--r-- 1 user group 34293 Jul 18 16:29 pathname + ls $cf_option $cf_utmp_path/$cf_utmp_file >conftest + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest conftest + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest &5 +echo "${ECHO_T}$cf_cv_utmp_group" >&6 +else + { { echo "$as_me:7785: error: cannot find utmp group" >&5 +echo "$as_me: error: cannot find utmp group" >&2;} + { (exit 1); exit 1; }; } +fi + + else + cf_cv_utmp_group=$use_utmp_setgid + fi + if test "$cf_cv_posix_saved_ids" != yes ; then + { { echo "$as_me:7794: error: Your system does not support POSIX saved-ids" >&5 +echo "$as_me: error: Your system does not support POSIX saved-ids" >&2;} + { (exit 1); exit 1; }; } + fi + +cat >>confdefs.h <<\EOF +#define USE_UTMP_SETGID 1 +EOF + + SINSTALL_OPTS="$SINSTALL_OPTS g+s -g $cf_cv_utmp_group" +fi + +echo "$as_me:7806: checking if you want to link with utempter" >&5 +echo $ECHO_N "checking if you want to link with utempter... $ECHO_C" >&6 + +# Check whether --with-utempter or --without-utempter was given. +if test "${with_utempter+set}" = set; then + withval="$with_utempter" + use_utempter=$withval +else + use_utempter=no +fi; +echo "$as_me:7816: result: $use_utempter" >&5 +echo "${ECHO_T}$use_utempter" >&6 + +if test "$use_utempter" = yes ; then + +echo "$as_me:7821: checking if we can link with utempter library" >&5 +echo $ECHO_N "checking if we can link with utempter library... $ECHO_C" >&6 +if test "${cf_cv_have_utempter+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_save_LIBS="$LIBS" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lutempter; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +cat >conftest.$ac_ext <<_ACEOF +#line 7846 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + + addToUtmp("/dev/tty", 0, 1); + removeFromUtmp(); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7863: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7866: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7869: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7872: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_have_utempter=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_have_utempter=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS="$cf_save_LIBS" + +fi +echo "$as_me:7886: result: $cf_cv_have_utempter" >&5 +echo "${ECHO_T}$cf_cv_have_utempter" >&6 +if test "$cf_cv_have_utempter" = yes ; then + +cat >>confdefs.h <<\EOF +#define USE_UTEMPTER 1 +EOF + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lutempter; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + + test "$cf_cv_have_utempter" != yes && use_utempter=no +else + use_utempter=no +fi + +# Some configurations permit (or require) either setuid or setgid mode. +# Let the user decide. +if test "$use_utempter" = yes ; then + if test "${enable_setuid+set}" != set ; then + disable_setuid=yes + test -n "$verbose" && echo " No --disable-setuid option given, force to yes" 1>&6 + +echo "${as_me:-configure}:7924: testing No --disable-setuid option given, force to yes ..." 1>&5 + + fi +fi + +### checks for external data + +echo "$as_me:7931: checking if external errno is declared" >&5 +echo $ECHO_N "checking if external errno is declared... $ECHO_C" >&6 +if test "${cf_cv_dcl_errno+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 7938 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include +int +main (void) +{ +int x = (int) errno; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7956: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7959: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7962: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7965: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_dcl_errno=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_dcl_errno=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:7976: result: $cf_cv_dcl_errno" >&5 +echo "${ECHO_T}$cf_cv_dcl_errno" >&6 + +if test "$cf_cv_dcl_errno" = no ; then + +cf_result=`echo "decl_errno" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&5 +echo $ECHO_N "checking if external errno exists... $ECHO_C" >&6 +if test "${cf_cv_have_errno+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 7998 "configure" +#include "confdefs.h" + +#undef errno +extern int errno; + +int +main (void) +{ +errno = 2 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8013: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8016: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8019: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8022: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_errno=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_errno=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:8033: result: $cf_cv_have_errno" >&5 +echo "${ECHO_T}$cf_cv_have_errno" >&6 + +if test "$cf_cv_have_errno" = yes ; then + +cf_result=`echo "have_errno" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&5 +echo $ECHO_N "checking for explicit tty group name... $ECHO_C" >&6 + +# Check whether --with-tty-group or --without-tty-group was given. +if test "${with_tty_group+set}" = set; then + withval="$with_tty_group" + cf_tty_group=$withval +else + cf_tty_group=auto... +fi; +test -z "$cf_tty_group" && cf_tty_group=auto... +test "$cf_tty_group" = yes && cf_tty_group=auto... +echo "$as_me:8058: result: $cf_tty_group" >&5 +echo "${ECHO_T}$cf_tty_group" >&6 + +if test "$cf_tty_group" = "auto..." ; then +echo "$as_me:8062: checking for tty group name" >&5 +echo $ECHO_N "checking for tty group name... $ECHO_C" >&6 +if test "${cf_cv_tty_group_name+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +# If we are configuring as root, it is hard to get a clue about the tty group. +# But we'll guess based on how our connection is set up - assuming it is done +# properly. + +cf_uid=`id | sed -e 's/^^=*=//' -e 's/(.*$//'` +# )vi +if test "$cf_uid" != 0 ; then +cf_cv_tty_group_name= +cf_tty_name=`tty` +test "$cf_tty_name" = "not a tty" && cf_tty_name=/dev/tty +test -z "$cf_tty_name" && cf_tty_name=/dev/tty +if test -c "$cf_tty_name" +then + cf_option="-l -L" + + # Expect listing to have fields like this: + #-rwxrwxrwx 1 user group 34293 Jul 18 16:29 pathname + ls $cf_option $cf_tty_name >conftest.out + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest conftest.out + read cf_mode cf_links cf_usr cf_grp cf_size cf_date1 cf_date2 cf_date3 cf_rest /dev/null 1>/dev/null ) then + cf_cv_tty_group_name="tty" + fi + ;; +esac +fi + +fi +echo "$as_me:8115: result: $cf_cv_tty_group_name" >&5 +echo "${ECHO_T}$cf_cv_tty_group_name" >&6 +cf_tty_group="$cf_cv_tty_group_name" +else + # if configure option, always do this + +cat >>confdefs.h <<\EOF +#define USE_TTY_GROUP 1 +EOF + +fi + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if we may use the $cf_tty_group group... $ECHO_C" >&6 +if test "${cf_cv_tty_group+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_tty_name=`tty` +if test "$cf_tty_name" != "not a tty" +then +if test "$cross_compiling" = yes; then + cf_cv_tty_group=unknown +else + cat >conftest.$ac_ext <<_ACEOF +#line 8148 "configure" +#include "confdefs.h" + +#include +#include +#include +#include +int main(void) +{ + struct stat sb; + struct group *ttygrp = getgrnam(TTY_GROUP_NAME); + char *name = ttyname(0); + + endgrent(); + if (ttygrp != 0 + && name != 0 + && stat(name, &sb) == 0 + && sb.st_gid != getgid() + && sb.st_gid == ttygrp->gr_gid) { + ${cf_cv_main_return:-return} (0); + } + ${cf_cv_main_return:-return} (1); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:8174: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8177: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:8179: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8182: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_tty_group=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_tty_group=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +elif test "$cross_compiling" = yes; then + cf_cv_tty_group=unknown +else + cf_cv_tty_group=yes +fi + +fi +echo "$as_me:8200: result: $cf_cv_tty_group" >&5 +echo "${ECHO_T}$cf_cv_tty_group" >&6 + +if test $cf_cv_tty_group = no ; then + { echo "$as_me:8204: WARNING: Cannot use $cf_tty_group group" >&5 +echo "$as_me: WARNING: Cannot use $cf_tty_group group" >&2;} +else + cat >>confdefs.h <<\EOF +#define USE_TTY_GROUP 1 +EOF + +fi + +### checks for system services and user specified options + +echo "$as_me:8215: checking for X" >&5 +echo $ECHO_N "checking for X... $ECHO_C" >&6 + +# Check whether --with-x or --without-x was given. +if test "${with_x+set}" = set; then + withval="$with_x" + +fi; +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else + if test "${ac_cv_have_x+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat >Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib dll; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -fr conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/opt/local/include +/opt/X11/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. + # First, try using that file with no special directory specified. + cat >conftest.$ac_ext <<_ACEOF +#line 8319 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:8323: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:8329: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # We can compile using X headers with no special include directory. +ac_x_includes= +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + cat >conftest.$ac_ext <<_ACEOF +#line 8362 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +XtMalloc (0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8374: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8377: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8380: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8383: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib dll; do + if test -r $ac_dir/libXt.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi +fi + + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + echo "$as_me:8421: result: $have_x" >&5 +echo "${ECHO_T}$have_x" >&6 + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + echo "$as_me:8431: result: libraries $x_libraries, headers $x_includes" >&5 +echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + +cat >>confdefs.h <<\EOF +#define X_DISPLAY_MISSING 1 +EOF + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + echo "$as_me:8455: checking whether -R must be followed by a space" >&5 +echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + cat >conftest.$ac_ext <<_ACEOF +#line 8459 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8471: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8474: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8477: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8480: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_nospace=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_R_nospace=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test $ac_R_nospace = yes; then + echo "$as_me:8490: result: no" >&5 +echo "${ECHO_T}no" >&6 + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat >conftest.$ac_ext <<_ACEOF +#line 8496 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8508: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8511: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8514: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8517: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_R_space=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_R_space=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + if test $ac_R_space = yes; then + echo "$as_me:8527: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + X_LIBS="$X_LIBS -R $x_libraries" + else + echo "$as_me:8531: result: neither works" >&5 +echo "${ECHO_T}neither works" >&6 + fi + fi + LIBS=$ac_xsave_LIBS + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + cat >conftest.$ac_ext <<_ACEOF +#line 8551 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main (void) +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8570: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8573: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8576: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8579: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +echo "$as_me:8585: checking for dnet_ntoa in -ldnet" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8593 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main (void) +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8612: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8615: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8618: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8621: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dnet_dnet_ntoa=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8632: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + echo "$as_me:8639: checking for dnet_ntoa in -ldnet_stub" >&5 +echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 +if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet_stub $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8647 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dnet_ntoa (); +int +main (void) +{ +dnet_ntoa (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8666: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8669: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8672: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8675: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dnet_stub_dnet_ntoa=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dnet_stub_dnet_ntoa=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8686: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 +if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +fi + + fi +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + echo "$as_me:8705: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8711 "configure" +#include "confdefs.h" +#define gethostbyname autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef gethostbyname + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +#error found stub for gethostbyname +#endif + + return gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8742: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8745: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8748: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8751: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8761: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 + + if test $ac_cv_func_gethostbyname = no; then + echo "$as_me:8765: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8773 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main (void) +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8792: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8795: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8798: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8801: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8812: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +fi + + if test $ac_cv_lib_nsl_gethostbyname = no; then + echo "$as_me:8819: checking for gethostbyname in -lbsd" >&5 +echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 +if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8827 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main (void) +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8846: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8849: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8852: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8855: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_bsd_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_bsd_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8866: result: $ac_cv_lib_bsd_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 +if test $ac_cv_lib_bsd_gethostbyname = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +fi + + fi + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says Simon Leinen: it contains gethostby* + # variants that don't use the nameserver (or something). -lsocket + # must be given before -lnsl if both are needed. We assume that + # if connect needs -lnsl, so does gethostbyname. + echo "$as_me:8882: checking for connect" >&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 8888 "configure" +#include "confdefs.h" +#define connect autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef connect + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +#error found stub for connect +#endif + + return connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8919: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8922: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8925: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8928: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:8938: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 + + if test $ac_cv_func_connect = no; then + echo "$as_me:8942: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 8950 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main (void) +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:8969: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:8972: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:8975: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8978: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:8989: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +fi + + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + echo "$as_me:8998: checking for remove" >&5 +echo $ECHO_N "checking for remove... $ECHO_C" >&6 +if test "${ac_cv_func_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 9004 "configure" +#include "confdefs.h" +#define remove autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef remove + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_remove) || defined (__stub___remove) +#error found stub for remove +#endif + + return remove (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9035: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9038: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9041: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9044: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_remove=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_remove=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9054: result: $ac_cv_func_remove" >&5 +echo "${ECHO_T}$ac_cv_func_remove" >&6 + + if test $ac_cv_func_remove = no; then + echo "$as_me:9058: checking for remove in -lposix" >&5 +echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 +if test "${ac_cv_lib_posix_remove+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9066 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char remove (); +int +main (void) +{ +remove (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9085: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9088: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9091: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9094: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix_remove=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_posix_remove=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:9105: result: $ac_cv_lib_posix_remove" >&5 +echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 +if test $ac_cv_lib_posix_remove = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + echo "$as_me:9114: checking for shmat" >&5 +echo $ECHO_N "checking for shmat... $ECHO_C" >&6 +if test "${ac_cv_func_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 9120 "configure" +#include "confdefs.h" +#define shmat autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef shmat + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shmat) || defined (__stub___shmat) +#error found stub for shmat +#endif + + return shmat (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9151: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9154: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9157: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9160: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_shmat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_shmat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:9170: result: $ac_cv_func_shmat" >&5 +echo "${ECHO_T}$ac_cv_func_shmat" >&6 + + if test $ac_cv_func_shmat = no; then + echo "$as_me:9174: checking for shmat in -lipc" >&5 +echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 +if test "${ac_cv_lib_ipc_shmat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9182 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shmat (); +int +main (void) +{ +shmat (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9201: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9204: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9207: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9210: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ipc_shmat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ipc_shmat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:9221: result: $ac_cv_lib_ipc_shmat" >&5 +echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 +if test $ac_cv_lib_ipc_shmat = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + echo "$as_me:9239: checking for IceConnectionNumber in -lICE" >&5 +echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 +if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9247 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char IceConnectionNumber (); +int +main (void) +{ +IceConnectionNumber (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9266: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9269: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9272: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9275: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ICE_IceConnectionNumber=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ICE_IceConnectionNumber=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:9286: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 +if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +fi + + LDFLAGS=$ac_save_LDFLAGS + +fi + +echo "$as_me:9296: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 9302 "configure" +#include "confdefs.h" +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main (void) +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9324: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9327: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9330: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9333: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_sys_wait_h=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_header_sys_wait_h=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:9343: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +if test $ac_cv_header_sys_wait_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +echo "$as_me:9353: checking for POSIX wait functions" >&5 +echo $ECHO_N "checking for POSIX wait functions... $ECHO_C" >&6 +if test "${cf_cv_posix_wait+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 9360 "configure" +#include "confdefs.h" + +#include +#include +#include +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +int +main (void) +{ + + int stat_loc; + pid_t pid = waitpid(-1, &stat_loc, WNOHANG|WUNTRACED); + pid_t pid2 = wait(&stat_loc); + (void)pid; + (void)pid2; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9385: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9388: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9391: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9394: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_wait=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_wait=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:9405: result: $cf_cv_posix_wait" >&5 +echo "${ECHO_T}$cf_cv_posix_wait" >&6 +test "$cf_cv_posix_wait" = yes && +cat >>confdefs.h <<\EOF +#define USE_POSIX_WAIT 1 +EOF + +echo "$as_me:9412: checking if external sys_nerr is declared" >&5 +echo $ECHO_N "checking if external sys_nerr is declared... $ECHO_C" >&6 +if test "${cf_cv_dcl_sys_nerr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 9419 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include +int +main (void) +{ +int x = (int) sys_nerr; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9437: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9440: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9443: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9446: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_dcl_sys_nerr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_dcl_sys_nerr=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:9457: result: $cf_cv_dcl_sys_nerr" >&5 +echo "${ECHO_T}$cf_cv_dcl_sys_nerr" >&6 + +if test "$cf_cv_dcl_sys_nerr" = no ; then + +cf_result=`echo "decl_sys_nerr" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&5 +echo $ECHO_N "checking if external sys_nerr exists... $ECHO_C" >&6 +if test "${cf_cv_have_sys_nerr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 9479 "configure" +#include "confdefs.h" + +#undef sys_nerr +extern int sys_nerr; + +int +main (void) +{ +sys_nerr = 2 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9494: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9497: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9500: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9503: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_sys_nerr=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_sys_nerr=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:9514: result: $cf_cv_have_sys_nerr" >&5 +echo "${ECHO_T}$cf_cv_have_sys_nerr" >&6 + +if test "$cf_cv_have_sys_nerr" = yes ; then + +cf_result=`echo "have_sys_nerr" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&5 +echo $ECHO_N "checking if external sys_errlist is declared... $ECHO_C" >&6 +if test "${cf_cv_dcl_sys_errlist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 9534 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDLIB_H +#include +#endif +#include +#include +#include +int +main (void) +{ +int x = (int) sys_errlist; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9552: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9555: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9558: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9561: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_dcl_sys_errlist=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_dcl_sys_errlist=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:9572: result: $cf_cv_dcl_sys_errlist" >&5 +echo "${ECHO_T}$cf_cv_dcl_sys_errlist" >&6 + +if test "$cf_cv_dcl_sys_errlist" = no ; then + +cf_result=`echo "decl_sys_errlist" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&5 +echo $ECHO_N "checking if external sys_errlist exists... $ECHO_C" >&6 +if test "${cf_cv_have_sys_errlist+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 9594 "configure" +#include "confdefs.h" + +#undef sys_errlist +extern int sys_errlist; + +int +main (void) +{ +sys_errlist = 2 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9609: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9612: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9615: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9618: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_have_sys_errlist=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_have_sys_errlist=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:9629: result: $cf_cv_have_sys_errlist" >&5 +echo "${ECHO_T}$cf_cv_have_sys_errlist" >&6 + +if test "$cf_cv_have_sys_errlist" = yes ; then + +cf_result=`echo "have_sys_errlist" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 9671 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:9675: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:9681: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:9700: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if we should define SYSV... $ECHO_C" >&6 +if test "${cf_cv_sysv+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 9717 "configure" +#include "confdefs.h" + +#undef SYSV +#define SYSV 1 /* get Xos.h to declare sys_errlist[] */ +#ifdef HAVE_STDLIB_H +#include /* look for wchar_t */ +#endif +#ifdef HAVE_X11_INTRINSIC_H +#include /* Intrinsic.h has other traps... */ +#endif +#ifdef HAVE_TERMIOS_H /* needed for HPUX 10.20 */ +#include +#define STRUCT_TERMIOS struct termios +#else +#define STRUCT_TERMIOS struct termio +#endif +#include +#include /* eliminate most BSD hacks */ +#include /* declare sys_errlist on older systems */ +#include /* eliminate most of the remaining ones */ + +int +main (void) +{ + +static STRUCT_TERMIOS d_tio; + d_tio.c_cc[VINTR] = 0; + d_tio.c_cc[VQUIT] = 0; + d_tio.c_cc[VERASE] = 0; + d_tio.c_cc[VKILL] = 0; + d_tio.c_cc[VEOF] = 0; + d_tio.c_cc[VEOL] = 0; + d_tio.c_cc[VMIN] = 0; + d_tio.c_cc[VTIME] = 0; +#if defined(HAVE_SYS_ERRLIST) && !defined(DECL_SYS_ERRLIST) +sys_errlist[0] = ""; /* Cygwin mis-declares this */ +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9761: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9764: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9767: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9770: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_sysv=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_sysv=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:9781: result: $cf_cv_sysv" >&5 +echo "${ECHO_T}$cf_cv_sysv" >&6 +test "$cf_cv_sysv" = yes && +cat >>confdefs.h <<\EOF +#define SYSV 1 +EOF + +LIBS="$cf_save_LIBS_CF_SYSV" +CFLAGS="$cf_save_CFLAGS_CF_SYSV" +CPPFLAGS="$cf_save_CPPFLAGS_CF_SYSV" + +echo "$as_me:9792: checking for elf_begin in -lelf" >&5 +echo $ECHO_N "checking for elf_begin in -lelf... $ECHO_C" >&6 +if test "${ac_cv_lib_elf_elf_begin+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lelf $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 9800 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char elf_begin (); +int +main (void) +{ +elf_begin (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:9819: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:9822: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:9825: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9828: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_elf_elf_begin=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_elf_elf_begin=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:9839: result: $ac_cv_lib_elf_elf_begin" >&5 +echo "${ECHO_T}$ac_cv_lib_elf_elf_begin" >&6 +if test $ac_cv_lib_elf_elf_begin = yes; then + +echo "$as_me:9843: checking if this is an SVR4 system" >&5 +echo $ECHO_N "checking if this is an SVR4 system... $ECHO_C" >&6 +if test "${cf_cv_svr4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 9850 "configure" +#include "confdefs.h" + +#if defined(__CYGWIN__) +make an error +#endif +#include +#include + +int +main (void) +{ + +static struct termio d_tio; + d_tio.c_cc[VINTR] = 0; + d_tio.c_cc[VQUIT] = 0; + d_tio.c_cc[VERASE] = 0; + d_tio.c_cc[VKILL] = 0; + d_tio.c_cc[VEOF] = 0; + d_tio.c_cc[VEOL] = 0; + d_tio.c_cc[VMIN] = 0; + d_tio.c_cc[VTIME] = 0; + d_tio.c_cc[VLNEXT] = 0; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:9879: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:9882: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:9885: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:9888: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_svr4=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_svr4=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:9899: result: $cf_cv_svr4" >&5 +echo "${ECHO_T}$cf_cv_svr4" >&6 + +fi + +test "$cf_cv_svr4" = yes && +cat >>confdefs.h <<\EOF +#define SVR4 1 +EOF + +echo "$as_me:9909: checking if you want to use pkg-config" >&5 +echo $ECHO_N "checking if you want to use pkg-config... $ECHO_C" >&6 + +# Check whether --with-pkg-config or --without-pkg-config was given. +if test "${with_pkg_config+set}" = set; then + withval="$with_pkg_config" + cf_pkg_config=$withval +else + cf_pkg_config=yes +fi; +echo "$as_me:9919: result: $cf_pkg_config" >&5 +echo "${ECHO_T}$cf_pkg_config" >&6 + +case $cf_pkg_config in +(no) + PKG_CONFIG=none + ;; +(yes) + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +echo "$as_me:9931: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:9948: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:9959: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:9962: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:9971: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_ac_pt_PKG_CONFIG="$ac_dir/$ac_word" + echo "$as_me:9988: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_ac_pt_PKG_CONFIG" && ac_cv_path_ac_pt_PKG_CONFIG="none" + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:10000: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:10003: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + + ;; +(*) + PKG_CONFIG=$withval + ;; +esac + +test -z "$PKG_CONFIG" && PKG_CONFIG=none +if test "$PKG_CONFIG" != none ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$PKG_CONFIG" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval PKG_CONFIG="$PKG_CONFIG" + case ".$PKG_CONFIG" in + (.NONE/*) + PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + PKG_CONFIG=`echo $PKG_CONFIG | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + { { echo "$as_me:10046: error: expected a pathname, not \"$PKG_CONFIG\"" >&5 +echo "$as_me: error: expected a pathname, not \"$PKG_CONFIG\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + +elif test "x$cf_pkg_config" != xno ; then + { echo "$as_me:10053: WARNING: pkg-config is not installed" >&5 +echo "$as_me: WARNING: pkg-config is not installed" >&2;} +fi + +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:10069: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:10075: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:10079: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:10199: WARNING: unable to find X11 library" >&5 +echo "$as_me: WARNING: unable to find X11 library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:10206: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:10212: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:10216: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:10336: WARNING: unable to find ICE library" >&5 +echo "$as_me: WARNING: unable to find ICE library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:10343: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:10349: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:10353: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:10473: WARNING: unable to find SM library" >&5 +echo "$as_me: WARNING: unable to find SM library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:10480: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:10486: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:10490: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:10610: WARNING: unable to find Xt library" >&5 +echo "$as_me: WARNING: unable to find Xt library" >&2;} +fi + +else + LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS" +fi + +cf_have_X_LIBS=no + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:10623: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:10629: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:10633: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + case "x$LIBS" in + (*-lX11*) + ;; + (*) +# we have an "xt" package, but it may omit Xt's dependency on X11 +echo "$as_me:10754: checking for usable X dependency" >&5 +echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 +if test "${cf_cv_xt_x11_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 10761 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + + int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); + int rc2 = XClearWindow((Display*) 0, (Window) 0); + int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); + int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10780: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10783: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10786: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10789: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xt_x11_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_x11_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10799: result: $cf_cv_xt_x11_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 + if test "$cf_cv_xt_x11_compat" = no + then + test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 + +echo "${as_me:-configure}:10805: testing work around broken X11 dependency ..." 1>&5 + + # 2010/11/19 - good enough until a working Xt on Xcb is delivered. + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:10812: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:10818: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:10822: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:10945: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt -lX11 %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:10950: testing ...after $LIBS ..." 1>&5 + +fi + + fi + ;; + esac + +echo "$as_me:10958: checking for usable X Toolkit package" >&5 +echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 +if test "${cf_cv_xt_ice_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 10965 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ +int num = IceConnectionNumber(0); (void) num + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:10980: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10983: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:10986: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10989: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xt_ice_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_ice_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:10999: result: $cf_cv_xt_ice_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 + + if test "$cf_cv_xt_ice_compat" = no + then + # workaround for broken ".pc" files used for X Toolkit. + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) + ;; + (*) + test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 + +echo "${as_me:-configure}:11013: testing work around broken ICE dependency ..." 1>&5 + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:11018: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:11024: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:11028: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:11147: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:11153: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:11157: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:11286: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt $X_PRE_LIBS %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:11291: testing ...after $LIBS ..." 1>&5 + +fi + + ;; + esac + ;; + esac + fi + + cf_have_X_LIBS=yes + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + LDFLAGS="$X_LIBS $LDFLAGS" + +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 + +echo "${as_me:-configure}:11311: testing checking additions to CFLAGS ..." 1>&5 + +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $X_CFLAGS +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:11396: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:11406: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:11416: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +cat >conftest.$ac_ext <<_ACEOF +#line 11425 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +printf("Hello world"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11437: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11440: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11443: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11446: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + +echo "${as_me:-configure}:11454: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 + + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:11459: testing but keeping change to \$CPPFLAGS ..." 1>&5 + + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + + echo "$as_me:11467: checking for XOpenDisplay" >&5 +echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 +if test "${ac_cv_func_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11473 "configure" +#include "confdefs.h" +#define XOpenDisplay autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XOpenDisplay + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) +#error found stub for XOpenDisplay +#endif + + return XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11504: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11507: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11510: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11513: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:11523: result: $ac_cv_func_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 +if test $ac_cv_func_XOpenDisplay = yes; then + : +else + + echo "$as_me:11529: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11537 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main (void) +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11556: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11559: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11562: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11565: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_X11_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_X11_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11576: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lX11; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + +fi + + echo "$as_me:11600: checking for XtAppInitialize" >&5 +echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 +if test "${ac_cv_func_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11606 "configure" +#include "confdefs.h" +#define XtAppInitialize autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XtAppInitialize + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) +#error found stub for XtAppInitialize +#endif + + return XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11637: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11640: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11643: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11646: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:11656: result: $ac_cv_func_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 +if test $ac_cv_func_XtAppInitialize = yes; then + : +else + + echo "$as_me:11662: checking for XtAppInitialize in -lXt" >&5 +echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 +if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11670 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (); +int +main (void) +{ +XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11689: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11692: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11695: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11698: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xt_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xt_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11709: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 +if test $ac_cv_lib_Xt_XtAppInitialize = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIBXT 1 +EOF + + cf_have_X_LIBS=Xt + LIBS="-lXt $LIBS" +fi + +fi + +fi + +if test $cf_have_X_LIBS = no ; then + { echo "$as_me:11726: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&5 +echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&2;} +fi + +for ac_header in \ + X11/DECkeysym.h \ + X11/Sunkeysym.h \ + X11/XF86keysym.h \ + X11/XKBlib.h \ + X11/TranslateI.h \ + X11/Xpoll.h \ + X11/extensions/XKB.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:11745: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11751 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:11755: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11761: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:11780: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to use the Xpm library for colored icon... $ECHO_C" >&6 + +# Check whether --with-xpm or --without-xpm was given. +if test "${with_xpm+set}" = set; then + withval="$with_xpm" + cf_Xpm_library="$withval" +else + cf_Xpm_library=yes +fi; +echo "$as_me:11805: result: $cf_Xpm_library" >&5 +echo "${ECHO_T}$cf_Xpm_library" >&6 + +if test "$cf_Xpm_library" != no ; then + if test "$cf_Xpm_library" != yes ; then + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="$LDFLAGS -L$withval/lib" + fi + echo "$as_me:11813: checking for X11/xpm.h" >&5 +echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_xpm_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 11819 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:11823: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:11829: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_X11_xpm_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_X11_xpm_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:11848: result: $ac_cv_header_X11_xpm_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6 +if test $ac_cv_header_X11_xpm_h = yes; then + + echo "$as_me:11852: checking for XpmCreatePixmapFromData in -lXpm" >&5 +echo $ECHO_N "checking for XpmCreatePixmapFromData in -lXpm... $ECHO_C" >&6 +if test "${ac_cv_lib_Xpm_XpmCreatePixmapFromData+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXpm -lX11 $X_LIBS $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 11860 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XpmCreatePixmapFromData (); +int +main (void) +{ +XpmCreatePixmapFromData (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:11879: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:11882: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:11885: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:11888: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xpm_XpmCreatePixmapFromData=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xpm_XpmCreatePixmapFromData=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:11899: result: $ac_cv_lib_Xpm_XpmCreatePixmapFromData" >&5 +echo "${ECHO_T}$ac_cv_lib_Xpm_XpmCreatePixmapFromData" >&6 +if test $ac_cv_lib_Xpm_XpmCreatePixmapFromData = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIBXPM 1 +EOF + + ICON_SUFFIX=.xpm + LIBS="-lXpm $LIBS" +else + CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}" +fi + +else + CPPFLAGS="${cf_save_cppflags}" LDFLAGS="${cf_save_ldflags}" +fi + +fi + +echo "$as_me:11919: checking if you want to use the Xinerama extension" >&5 +echo $ECHO_N "checking if you want to use the Xinerama extension... $ECHO_C" >&6 + +# Check whether --with-xinerama or --without-xinerama was given. +if test "${with_xinerama+set}" = set; then + withval="$with_xinerama" + cf_with_xinerama="$withval" +else + cf_with_xinerama=yes +fi; +echo "$as_me:11929: result: $cf_with_xinerama" >&5 +echo "${ECHO_T}$cf_with_xinerama" >&6 +if test "$cf_with_xinerama" = yes; then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xinerama; then + test -n "$verbose" && echo " found package xinerama" 1>&6 + +echo "${as_me:-configure}:11936: testing found package xinerama ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xinerama 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xinerama 2>/dev/null`" + test -n "$verbose" && echo " package xinerama CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:11942: testing package xinerama CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xinerama LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:11946: testing package xinerama LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >>confdefs.h <<\EOF +#define HAVE_X11_EXTENSIONS_XINERAMA_H 1 +EOF + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + echo "$as_me:12070: checking for XineramaQueryScreens in -lXinerama" >&5 +echo $ECHO_N "checking for XineramaQueryScreens in -lXinerama... $ECHO_C" >&6 +if test "${ac_cv_lib_Xinerama_XineramaQueryScreens+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXinerama $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12078 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XineramaQueryScreens (); +int +main (void) +{ +XineramaQueryScreens (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12097: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12100: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12103: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12106: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xinerama_XineramaQueryScreens=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xinerama_XineramaQueryScreens=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12117: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5 +echo "${ECHO_T}$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6 +if test $ac_cv_lib_Xinerama_XineramaQueryScreens = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lXinerama; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +for ac_header in \ + X11/extensions/Xinerama.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:12142: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 12148 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:12152: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:12158: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:12177: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to link with Xaw 3d library... $ECHO_C" >&6 +withval= + +# Check whether --with-Xaw3d or --without-Xaw3d was given. +if test "${with_Xaw3d+set}" = set; then + withval="$with_Xaw3d" + +fi; +if test "$withval" = yes ; then + cf_x_athena=Xaw3d + echo "$as_me:12206: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12209: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:12213: checking if you want to link with Xaw 3d xft library" >&5 +echo $ECHO_N "checking if you want to link with Xaw 3d xft library... $ECHO_C" >&6 +withval= + +# Check whether --with-Xaw3dxft or --without-Xaw3dxft was given. +if test "${with_Xaw3dxft+set}" = set; then + withval="$with_Xaw3dxft" + +fi; +if test "$withval" = yes ; then + cf_x_athena=Xaw3dxft + echo "$as_me:12224: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12227: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:12231: checking if you want to link with neXT Athena library" >&5 +echo $ECHO_N "checking if you want to link with neXT Athena library... $ECHO_C" >&6 +withval= + +# Check whether --with-neXtaw or --without-neXtaw was given. +if test "${with_neXtaw+set}" = set; then + withval="$with_neXtaw" + +fi; +if test "$withval" = yes ; then + cf_x_athena=neXtaw + echo "$as_me:12242: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12245: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:12249: checking if you want to link with Athena-Plus library" >&5 +echo $ECHO_N "checking if you want to link with Athena-Plus library... $ECHO_C" >&6 +withval= + +# Check whether --with-XawPlus or --without-XawPlus was given. +if test "${with_XawPlus+set}" = set; then + withval="$with_XawPlus" + +fi; +if test "$withval" = yes ; then + cf_x_athena=XawPlus + echo "$as_me:12260: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12263: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +cf_x_athena_lib="" + +if test "$PKG_CONFIG" != none ; then + cf_athena_list= + test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6" + for cf_athena_pkg in \ + $cf_athena_list \ + ${cf_x_athena} \ + ${cf_x_athena}-devel \ + lib${cf_x_athena} \ + lib${cf_x_athena}-devel + do + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $cf_athena_pkg; then + test -n "$verbose" && echo " found package $cf_athena_pkg" 1>&6 + +echo "${as_me:-configure}:12283: testing found package $cf_athena_pkg ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags $cf_athena_pkg 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs $cf_athena_pkg 2>/dev/null`" + test -n "$verbose" && echo " package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12289: testing package $cf_athena_pkg CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package $cf_athena_pkg LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12293: testing package $cf_athena_pkg LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cf_x_athena_lib="$cf_pkgconfig_libs" + +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&6 + +echo "${as_me:-configure}:12424: testing ..trimmed $LIBS ..." 1>&5 + + ;; + esac + done + +echo "$as_me:12430: checking for usable $cf_x_athena/Xmu package" >&5 +echo $ECHO_N "checking for usable $cf_x_athena/Xmu package... $ECHO_C" >&6 +if test "${cf_cv_xaw_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 12437 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + +int check = XmuCompareISOLatin1("big", "small"); +(void)check; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12454: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12457: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12460: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12463: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xaw_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xaw_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:12473: result: $cf_cv_xaw_compat" >&5 +echo "${ECHO_T}$cf_cv_xaw_compat" >&6 + + if test "$cf_cv_xaw_compat" = no + then + # workaround for broken ".pc" files... + case "$cf_x_athena_lib" in + (*-lXmu*) + ;; + (*) + test -n "$verbose" && echo " work around broken package" 1>&6 + +echo "${as_me:-configure}:12485: testing work around broken package ..." 1>&5 + + cf_save_xmu="$LIBS" + cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^ *//' -e 's/ .*//'` + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xmu; then + test -n "$verbose" && echo " found package xmu" 1>&6 + +echo "${as_me:-configure}:12493: testing found package xmu ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xmu 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xmu 2>/dev/null`" + test -n "$verbose" && echo " package xmu CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12499: testing package xmu CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xmu LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12503: testing package xmu LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + LIBS="$cf_save_xmu" + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:12623: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib $cf_pkgconfig_libs %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:12628: testing ...after $LIBS ..." 1>&5 + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:12636: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%$cf_first_lib %$cf_first_lib -lXmu %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:12641: testing ...after $LIBS ..." 1>&5 + +fi + + for cf_trim_lib in Xmu Xt X11 + do + case "$LIBS" in + (*-l$cf_trim_lib\ *-l$cf_trim_lib*) + LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'` + test -n "$verbose" && echo " ..trimmed $LIBS" 1>&6 + +echo "${as_me:-configure}:12652: testing ..trimmed $LIBS ..." 1>&5 + + ;; + esac + done + + ;; + esac + fi + + break +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi + + done +fi + +if test -z "$cf_x_athena_lib" ; then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then + test -n "$verbose" && echo " found package Xext" 1>&6 + +echo "${as_me:-configure}:12677: testing found package Xext ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" + test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12683: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12687: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + echo "$as_me:12808: checking for XextCreateExtension in -lXext" >&5 +echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 +if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 12816 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XextCreateExtension (); +int +main (void) +{ +XextCreateExtension (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:12835: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:12838: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:12841: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12844: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xext_XextCreateExtension=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xext_XextCreateExtension=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:12855: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 +echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 +if test $ac_cv_lib_Xext_XextCreateExtension = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lXext; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + +fi + +# OSX is schizoid about who owns /usr/X11 (old) versus /opt/X11 (new) (and +# in some cases has installed dummy files in the former, other cases replaced +# it with a link to the new location). This complicates the configure script. +# Check for that pitfall, and recover using pkg-config +# +# If none of these are set, the configuration is almost certainly broken. +if test -z "${X_CFLAGS}${X_PRE_LIBS}${X_LIBS}${X_EXTRA_LIBS}" +then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:12891: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:12897: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:12901: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13021: WARNING: unable to find X11 library" >&5 +echo "$as_me: WARNING: unable to find X11 library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:13028: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13034: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13038: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13158: WARNING: unable to find ICE library" >&5 +echo "$as_me: WARNING: unable to find ICE library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:13165: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13171: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13175: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13295: WARNING: unable to find SM library" >&5 +echo "$as_me: WARNING: unable to find SM library" >&2;} +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:13302: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13308: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13312: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + { echo "$as_me:13432: WARNING: unable to find Xt library" >&5 +echo "$as_me: WARNING: unable to find Xt library" >&2;} +fi + +else + LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS" +fi + +cf_have_X_LIBS=no + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xt; then + test -n "$verbose" && echo " found package xt" 1>&6 + +echo "${as_me:-configure}:13445: testing found package xt ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags xt 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs xt 2>/dev/null`" + test -n "$verbose" && echo " package xt CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13451: testing package xt CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package xt LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13455: testing package xt LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + case "x$LIBS" in + (*-lX11*) + ;; + (*) +# we have an "xt" package, but it may omit Xt's dependency on X11 +echo "$as_me:13576: checking for usable X dependency" >&5 +echo $ECHO_N "checking for usable X dependency... $ECHO_C" >&6 +if test "${cf_cv_xt_x11_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 13583 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + + int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0); + int rc2 = XClearWindow((Display*) 0, (Window) 0); + int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0); + int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13602: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13605: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13608: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13611: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xt_x11_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_x11_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13621: result: $cf_cv_xt_x11_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_x11_compat" >&6 + if test "$cf_cv_xt_x11_compat" = no + then + test -n "$verbose" && echo " work around broken X11 dependency" 1>&6 + +echo "${as_me:-configure}:13627: testing work around broken X11 dependency ..." 1>&5 + + # 2010/11/19 - good enough until a working Xt on Xcb is delivered. + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists x11; then + test -n "$verbose" && echo " found package x11" 1>&6 + +echo "${as_me:-configure}:13634: testing found package x11 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags x11 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs x11 2>/dev/null`" + test -n "$verbose" && echo " package x11 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13640: testing package x11 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package x11 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13644: testing package x11 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:13767: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt -lX11 %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:13772: testing ...after $LIBS ..." 1>&5 + +fi + + fi + ;; + esac + +echo "$as_me:13780: checking for usable X Toolkit package" >&5 +echo $ECHO_N "checking for usable X Toolkit package... $ECHO_C" >&6 +if test "${cf_cv_xt_ice_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 13787 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ +int num = IceConnectionNumber(0); (void) num + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:13802: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:13805: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:13808: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:13811: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xt_ice_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xt_ice_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:13821: result: $cf_cv_xt_ice_compat" >&5 +echo "${ECHO_T}$cf_cv_xt_ice_compat" >&6 + + if test "$cf_cv_xt_ice_compat" = no + then + # workaround for broken ".pc" files used for X Toolkit. + case "x$X_PRE_LIBS" in + (*-lICE*) + case "x$LIBS" in + (*-lICE*) + ;; + (*) + test -n "$verbose" && echo " work around broken ICE dependency" 1>&6 + +echo "${as_me:-configure}:13835: testing work around broken ICE dependency ..." 1>&5 + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists ice; then + test -n "$verbose" && echo " found package ice" 1>&6 + +echo "${as_me:-configure}:13840: testing found package ice ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags ice 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs ice 2>/dev/null`" + test -n "$verbose" && echo " package ice CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13846: testing package ice CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package ice LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13850: testing package ice LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists sm; then + test -n "$verbose" && echo " found package sm" 1>&6 + +echo "${as_me:-configure}:13969: testing found package sm ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags sm 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs sm 2>/dev/null`" + test -n "$verbose" && echo " package sm CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:13975: testing package sm CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package sm LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:13979: testing package sm LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + : +fi + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:14108: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXt %-lXt $X_PRE_LIBS %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:14113: testing ...after $LIBS ..." 1>&5 + +fi + + ;; + esac + ;; + esac + fi + + cf_have_X_LIBS=yes + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + LDFLAGS="$X_LIBS $LDFLAGS" + +test -n "$verbose" && echo " checking additions to CFLAGS" 1>&6 + +echo "${as_me:-configure}:14133: testing checking additions to CFLAGS ..." 1>&5 + +cf_check_cflags="$CFLAGS" +cf_check_cppflags="$CPPFLAGS" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $X_CFLAGS +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + test -n "$verbose" && echo " add to \$CFLAGS $cf_new_cflags" 1>&6 + +echo "${as_me:-configure}:14218: testing add to \$CFLAGS $cf_new_cflags ..." 1>&5 + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + test -n "$verbose" && echo " add to \$CPPFLAGS $cf_new_cppflags" 1>&6 + +echo "${as_me:-configure}:14228: testing add to \$CPPFLAGS $cf_new_cppflags ..." 1>&5 + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + test -n "$verbose" && echo " add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags" 1>&6 + +echo "${as_me:-configure}:14238: testing add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags ..." 1>&5 + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +if test "x$cf_check_cflags" != "x$CFLAGS" ; then +cat >conftest.$ac_ext <<_ACEOF +#line 14247 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +printf("Hello world"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14259: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14262: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14265: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14268: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +test -n "$verbose" && echo " test-compile failed. Undoing change to \$CFLAGS" 1>&6 + +echo "${as_me:-configure}:14276: testing test-compile failed. Undoing change to \$CFLAGS ..." 1>&5 + + if test "x$cf_check_cppflags" != "x$CPPFLAGS" ; then + test -n "$verbose" && echo " but keeping change to \$CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:14281: testing but keeping change to \$CPPFLAGS ..." 1>&5 + + fi + CFLAGS="$cf_check_flags" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi + + echo "$as_me:14289: checking for XOpenDisplay" >&5 +echo $ECHO_N "checking for XOpenDisplay... $ECHO_C" >&6 +if test "${ac_cv_func_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 14295 "configure" +#include "confdefs.h" +#define XOpenDisplay autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XOpenDisplay + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XOpenDisplay) || defined (__stub___XOpenDisplay) +#error found stub for XOpenDisplay +#endif + + return XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14326: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14329: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14332: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14335: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:14345: result: $ac_cv_func_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_func_XOpenDisplay" >&6 +if test $ac_cv_func_XOpenDisplay = yes; then + : +else + + echo "$as_me:14351: checking for XOpenDisplay in -lX11" >&5 +echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6 +if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lX11 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 14359 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XOpenDisplay (); +int +main (void) +{ +XOpenDisplay (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14378: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14381: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14384: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14387: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_X11_XOpenDisplay=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_X11_XOpenDisplay=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:14398: result: $ac_cv_lib_X11_XOpenDisplay" >&5 +echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6 +if test $ac_cv_lib_X11_XOpenDisplay = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lX11; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + +fi + + echo "$as_me:14422: checking for XtAppInitialize" >&5 +echo $ECHO_N "checking for XtAppInitialize... $ECHO_C" >&6 +if test "${ac_cv_func_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 14428 "configure" +#include "confdefs.h" +#define XtAppInitialize autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XtAppInitialize + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XtAppInitialize) || defined (__stub___XtAppInitialize) +#error found stub for XtAppInitialize +#endif + + return XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14459: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14462: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14465: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14468: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:14478: result: $ac_cv_func_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_func_XtAppInitialize" >&6 +if test $ac_cv_func_XtAppInitialize = yes; then + : +else + + echo "$as_me:14484: checking for XtAppInitialize in -lXt" >&5 +echo $ECHO_N "checking for XtAppInitialize in -lXt... $ECHO_C" >&6 +if test "${ac_cv_lib_Xt_XtAppInitialize+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXt $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 14492 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XtAppInitialize (); +int +main (void) +{ +XtAppInitialize (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14511: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14514: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14517: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14520: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xt_XtAppInitialize=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xt_XtAppInitialize=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:14531: result: $ac_cv_lib_Xt_XtAppInitialize" >&5 +echo "${ECHO_T}$ac_cv_lib_Xt_XtAppInitialize" >&6 +if test $ac_cv_lib_Xt_XtAppInitialize = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIBXT 1 +EOF + + cf_have_X_LIBS=Xt + LIBS="-lXt $LIBS" +fi + +fi + +fi + +if test $cf_have_X_LIBS = no ; then + { echo "$as_me:14548: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&5 +echo "$as_me: WARNING: Unable to successfully link X Toolkit library (-lXt) with +test program. You will have to check and add the proper libraries by hand +to makefile." >&2;} +fi + +cf_x_athena_root=$cf_x_athena +cf_x_athena_inc="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + if test -z "$cf_x_athena_inc" ; then + +cf_save_LIBS_CF_X_ATHENA_CPPFLAGS="$LIBS" +cf_save_CFLAGS_CF_X_ATHENA_CPPFLAGS="$CFLAGS" +cf_save_CPPFLAGS_CF_X_ATHENA_CPPFLAGS="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[IUD]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done + + cf_test=X11/$cf_x_athena_root/SimpleMenu.h + if test $cf_path != default ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_path/include" + + echo "$as_me:14589: checking for $cf_test in $cf_path" >&5 +echo $ECHO_N "checking for $cf_test in $cf_path... $ECHO_C" >&6 + else + echo "$as_me:14592: checking for $cf_test" >&5 +echo $ECHO_N "checking for $cf_test... $ECHO_C" >&6 + fi + cat >conftest.$ac_ext <<_ACEOF +#line 14596 "configure" +#include "confdefs.h" + +#include +#include <$cf_test> +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:14610: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:14613: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:14616: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14619: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:14628: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + +LIBS="$cf_save_LIBS_CF_X_ATHENA_CPPFLAGS" +CFLAGS="$cf_save_CFLAGS_CF_X_ATHENA_CPPFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS_CF_X_ATHENA_CPPFLAGS" + + if test "$cf_result" = yes ; then + test "$cf_path" = default && cf_x_athena_inc=default + test "$cf_path" != default && cf_x_athena_inc=$cf_path/include + break + fi + fi +done + +if test -z "$cf_x_athena_inc" ; then + { echo "$as_me:14644: WARNING: Unable to find Athena header files" >&5 +echo "$as_me: WARNING: Unable to find Athena header files" >&2;} +elif test "$cf_x_athena_inc" != default ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-I$cf_x_athena_inc" + +fi + +cf_x_athena_root=$cf_x_athena +cf_x_athena_lib="" + +for cf_path in default \ + /usr/contrib/X11R6 \ + /usr/contrib/X11R5 \ + /usr/lib/X11R5 \ + /usr/local +do + for cf_lib in \ + ${cf_x_athena_root} \ + ${cf_x_athena_root}7 \ + ${cf_x_athena_root}6 + do + for cf_libs in \ + "-l$cf_lib -lXmu" \ + "-l$cf_lib -lXpm -lXmu" \ + "-l${cf_lib}_s -lXmu_s" + do + test -n "$cf_x_athena_lib" && break + +cf_save_LIBS_CF_X_ATHENA_LIBS="$LIBS" +cf_save_CFLAGS_CF_X_ATHENA_LIBS="$CFLAGS" +cf_save_CPPFLAGS_CF_X_ATHENA_LIBS="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[IUD]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done + + cf_test=XawSimpleMenuAddGlobalActions + test "$cf_path" != default && cf_libs="-L$cf_path/lib $cf_libs" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + echo "$as_me:14709: checking for $cf_test in $cf_libs" >&5 +echo $ECHO_N "checking for $cf_test in $cf_libs... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 14712 "configure" +#include "confdefs.h" + +#include +#include + +int +main (void) +{ + +$cf_test((XtAppContext) 0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:14728: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:14731: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:14734: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14737: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:14746: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + +LIBS="$cf_save_LIBS_CF_X_ATHENA_LIBS" +CFLAGS="$cf_save_CFLAGS_CF_X_ATHENA_LIBS" +CPPFLAGS="$cf_save_CPPFLAGS_CF_X_ATHENA_LIBS" + + if test "$cf_result" = yes ; then + cf_x_athena_lib="$cf_libs" + break + fi + done # cf_libs + test -n "$cf_x_athena_lib" && break + done # cf_lib +done + +if test -z "$cf_x_athena_lib" ; then + { { echo "$as_me:14763: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&5 +echo "$as_me: error: Unable to successfully link Athena library (-l$cf_x_athena_root) with test program" >&2;} + { (exit 1); exit 1; }; } +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_x_athena_lib; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +cf_x_athena_LIBS=`echo "HAVE_LIB_$cf_x_athena" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 14801 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:14805: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:14811: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:14830: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for declaration of fd_set... $ECHO_C" >&6 +if test "${cf_cv_type_fd_set+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +echo "${as_me:-configure}:14846: testing sys/types alone ..." 1>&5 + +cat >conftest.$ac_ext <<_ACEOF +#line 14849 "configure" +#include "confdefs.h" + +#include +int +main (void) +{ +fd_set x; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:14862: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:14865: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:14868: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14871: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_fd_set=sys/types.h +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +echo "${as_me:-configure}:14878: testing X11/Xpoll.h ..." 1>&5 + +cat >conftest.$ac_ext <<_ACEOF +#line 14881 "configure" +#include "confdefs.h" + +#ifdef HAVE_X11_XPOLL_H +#include +#endif +int +main (void) +{ +fd_set x; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:14896: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:14899: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:14902: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14905: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_fd_set=X11/Xpoll.h +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +echo "${as_me:-configure}:14912: testing sys/select.h ..." 1>&5 + +cat >conftest.$ac_ext <<_ACEOF +#line 14915 "configure" +#include "confdefs.h" + +#include +#include +int +main (void) +{ +fd_set x; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:14929: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:14932: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:14935: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14938: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_fd_set=sys/select.h +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_type_fd_set=unknown +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:14952: result: $cf_cv_type_fd_set" >&5 +echo "${ECHO_T}$cf_cv_type_fd_set" >&6 +if test $cf_cv_type_fd_set = sys/select.h ; then + +cat >>confdefs.h <<\EOF +#define USE_SYS_SELECT_H 1 +EOF + +fi + +echo "$as_me:14962: checking for declaration of fd_mask" >&5 +echo $ECHO_N "checking for declaration of fd_mask... $ECHO_C" >&6 +if test "${cf_cv_type_fd_mask+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + if test x$cf_cv_type_fd_set = xX11/Xpoll.h ; then + cat >conftest.$ac_ext <<_ACEOF +#line 14970 "configure" +#include "confdefs.h" + +#include +int +main (void) +{ +fd_mask x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:14983: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:14986: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:14989: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:14992: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +echo "${as_me:-configure}:14999: testing if we must define CSRG_BASED ..." 1>&5 + +# Xosdefs.h on Mac OS X may not define this (but it should). + cat >conftest.$ac_ext <<_ACEOF +#line 15003 "configure" +#include "confdefs.h" + +#define CSRG_BASED +#include +int +main (void) +{ +fd_mask x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:15017: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:15020: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:15023: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15026: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_type_fd_mask=CSRG_BASED +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.$ac_objext conftest.$ac_ext + else + cf_cv_type_fd_mask=$cf_cv_type_fd_set + fi + +fi +echo "$as_me:15041: result: $cf_cv_type_fd_mask" >&5 +echo "${ECHO_T}$cf_cv_type_fd_mask" >&6 +if test x$cf_cv_type_fd_mask = xCSRG_BASED ; then + +cat >>confdefs.h <<\EOF +#define CSRG_BASED 1 +EOF + +fi + +echo "$as_me:15051: checking for IRIX 6.5 baud-rate redefinitions" >&5 +echo $ECHO_N "checking for IRIX 6.5 baud-rate redefinitions... $ECHO_C" >&6 +if test "${cf_cv_termio_c_ispeed+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 15058 "configure" +#include "confdefs.h" + +#include +#include +int +main (void) +{ + +struct termio foo; +foo.c_ispeed = B38400; +foo.c_ospeed = B9600; +(void)foo; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:15077: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:15080: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:15083: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15086: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_termio_c_ispeed=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_termio_c_ispeed=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:15098: result: $cf_cv_termio_c_ispeed" >&5 +echo "${ECHO_T}$cf_cv_termio_c_ispeed" >&6 +test "$cf_cv_termio_c_ispeed" = yes && +cat >>confdefs.h <<\EOF +#define HAVE_TERMIO_C_ISPEED 1 +EOF + +echo "$as_me:15105: checking for termios type tcflag_t" >&5 +echo $ECHO_N "checking for termios type tcflag_t... $ECHO_C" >&6 +if test "${cf_cv_havetype_tcflag_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 15112 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + tcflag_t x = 0; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:15125: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:15128: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:15131: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15134: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_havetype_tcflag_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_havetype_tcflag_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:15145: result: $cf_cv_havetype_tcflag_t" >&5 +echo "${ECHO_T}$cf_cv_havetype_tcflag_t" >&6 +test "$cf_cv_havetype_tcflag_t" = no && +cat >>confdefs.h <<\EOF +#define tcflag_t unsigned long +EOF + +echo "$as_me:15152: checking for termios type speed_t" >&5 +echo $ECHO_N "checking for termios type speed_t... $ECHO_C" >&6 +if test "${cf_cv_havetype_speed_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 15159 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + speed_t x = 0; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:15172: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:15175: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:15178: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15181: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_havetype_speed_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_havetype_speed_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:15192: result: $cf_cv_havetype_speed_t" >&5 +echo "${ECHO_T}$cf_cv_havetype_speed_t" >&6 +test "$cf_cv_havetype_speed_t" = no && +cat >>confdefs.h <<\EOF +#define speed_t unsigned short +EOF + +echo "$as_me:15199: checking for termios type cc_t" >&5 +echo $ECHO_N "checking for termios type cc_t... $ECHO_C" >&6 +if test "${cf_cv_havetype_cc_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 15206 "configure" +#include "confdefs.h" +#include +int +main (void) +{ + + cc_t x = 0; (void)x + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:15219: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:15222: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:15225: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15228: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_havetype_cc_t=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_havetype_cc_t=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:15239: result: $cf_cv_havetype_cc_t" >&5 +echo "${ECHO_T}$cf_cv_havetype_cc_t" >&6 +test "$cf_cv_havetype_cc_t" = no && +cat >>confdefs.h <<\EOF +#define cc_t unsigned char +EOF + +# If we notice Xcursor, there is a workaround needed. +echo "$as_me:15247: checking for XcursorGetTheme in -lXcursor" >&5 +echo $ECHO_N "checking for XcursorGetTheme in -lXcursor... $ECHO_C" >&6 +if test "${ac_cv_lib_Xcursor_XcursorGetTheme+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXcursor $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 15255 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XcursorGetTheme (); +int +main (void) +{ +XcursorGetTheme (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15274: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15277: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15280: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15283: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xcursor_XcursorGetTheme=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xcursor_XcursorGetTheme=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:15294: result: $ac_cv_lib_Xcursor_XcursorGetTheme" >&5 +echo "${ECHO_T}$ac_cv_lib_Xcursor_XcursorGetTheme" >&6 +if test $ac_cv_lib_Xcursor_XcursorGetTheme = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_LIB_XCURSOR 1 +EOF + +fi + +LIBS="$LIBS $X_EXTRA_LIBS" + +for ac_header in \ +stropts.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:15311: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 15317 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:15321: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:15327: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:15346: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 15382 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15413: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15416: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15419: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15422: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:15432: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if grantpt really works... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 15447 "configure" +#include "confdefs.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_POSIX_OPENPT +#undef posix_openpt +#define posix_openpt(mode) open("/dev/ptmx", mode) +#endif + +#ifdef HAVE_STROPTS_H +#include +#endif + +static void failed(int code) +{ + perror("conftest"); + exit(code); +} + +static void my_timeout(int sig) +{ + (void)sig; + exit(99); +} + +int +main (void) +{ + + int code = 0; + int rc; + int pty; + int tty; + char *slave; + struct termios tio; + + (void)tio; + signal(SIGALRM, my_timeout); + + if (alarm(2) == 9) + failed(9); + else if ((pty = posix_openpt(O_RDWR)) < 0) + failed(1); + else if ((rc = grantpt(pty)) < 0) + failed(2); + else if ((rc = unlockpt(pty)) < 0) + failed(3); + else if ((slave = ptsname(pty)) == 0) + failed(4); +#if (CONFTEST == 3) || defined(CONFTEST_isatty) + else if (!isatty(pty)) + failed(4); +#endif +#if CONFTEST >= 4 + else if ((rc = tcgetattr(pty, &tio)) < 0) + failed(20); + else if ((rc = tcsetattr(pty, TCSAFLUSH, &tio)) < 0) + failed(21); +#endif + /* BSD posix_openpt does not treat pty as a terminal until slave is opened. + * Linux does treat it that way. + */ + else if ((tty = open(slave, O_RDWR)) < 0) + failed(5); +#ifdef CONFTEST +#ifdef I_PUSH +#if (CONFTEST == 0) || defined(CONFTEST_ptem) + else if ((rc = ioctl(tty, I_PUSH, "ptem")) < 0) + failed(10); +#endif +#if (CONFTEST == 1) || defined(CONFTEST_ldterm) + else if ((rc = ioctl(tty, I_PUSH, "ldterm")) < 0) + failed(11); +#endif +#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) + else if ((rc = ioctl(tty, I_PUSH, "ttcompat")) < 0) + failed(12); +#endif +#endif /* I_PUSH */ +#if CONFTEST >= 5 + else if ((rc = tcgetattr(tty, &tio)) < 0) + failed(30); + else if ((rc = tcsetattr(tty, TCSAFLUSH, &tio)) < 0) + failed(31); +#endif +#endif /* CONFTEST */ + + ${cf_cv_main_return:-return}(code); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15548: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15551: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15554: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15557: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + if test "$cross_compiling" = yes; then + ac_cv_func_grantpt=maybe +else + cat >conftest.$ac_ext <<_ACEOF +#line 15564 "configure" +#include "confdefs.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_POSIX_OPENPT +#undef posix_openpt +#define posix_openpt(mode) open("/dev/ptmx", mode) +#endif + +#ifdef HAVE_STROPTS_H +#include +#endif + +static void failed(int code) +{ + perror("conftest"); + exit(code); +} + +static void my_timeout(int sig) +{ + (void)sig; + exit(99); +} + +int main(void) +{ + + int code = 0; + int rc; + int pty; + int tty; + char *slave; + struct termios tio; + + (void)tio; + signal(SIGALRM, my_timeout); + + if (alarm(2) == 9) + failed(9); + else if ((pty = posix_openpt(O_RDWR)) < 0) + failed(1); + else if ((rc = grantpt(pty)) < 0) + failed(2); + else if ((rc = unlockpt(pty)) < 0) + failed(3); + else if ((slave = ptsname(pty)) == 0) + failed(4); +#if (CONFTEST == 3) || defined(CONFTEST_isatty) + else if (!isatty(pty)) + failed(4); +#endif +#if CONFTEST >= 4 + else if ((rc = tcgetattr(pty, &tio)) < 0) + failed(20); + else if ((rc = tcsetattr(pty, TCSAFLUSH, &tio)) < 0) + failed(21); +#endif + /* BSD posix_openpt does not treat pty as a terminal until slave is opened. + * Linux does treat it that way. + */ + else if ((tty = open(slave, O_RDWR)) < 0) + failed(5); +#ifdef CONFTEST +#ifdef I_PUSH +#if (CONFTEST == 0) || defined(CONFTEST_ptem) + else if ((rc = ioctl(tty, I_PUSH, "ptem")) < 0) + failed(10); +#endif +#if (CONFTEST == 1) || defined(CONFTEST_ldterm) + else if ((rc = ioctl(tty, I_PUSH, "ldterm")) < 0) + failed(11); +#endif +#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) + else if ((rc = ioctl(tty, I_PUSH, "ttcompat")) < 0) + failed(12); +#endif +#endif /* I_PUSH */ +#if CONFTEST >= 5 + else if ((rc = tcgetattr(tty, &tio)) < 0) + failed(30); + else if ((rc = tcsetattr(tty, TCSAFLUSH, &tio)) < 0) + failed(31); +#endif +#endif /* CONFTEST */ + + ${cf_cv_main_return:-return}(code); + +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:15663: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15666: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:15668: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15671: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_grantpt=no + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_grantpt=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:15690: result: $ac_cv_func_grantpt" >&5 +echo "${ECHO_T}$ac_cv_func_grantpt" >&6 + + if test "x$ac_cv_func_grantpt" != "xno" ; then + + if test "x$ac_cv_func_grantpt" = "xyes" ; then + echo "$as_me:15696: checking for pty features" >&5 +echo $ECHO_N "checking for pty features... $ECHO_C" >&6 + if test "x$ac_cv_header_stropts_h" = xyes + then + cf_pty_this=0 + else + cf_pty_this=3 + fi + + cf_pty_defines= + while test $cf_pty_this != 6 + do + + cf_pty_feature= + cf_pty_next=`expr $cf_pty_this + 1` + +echo "${as_me:-configure}:15712: testing pty feature test $cf_pty_next:5 ..." 1>&5 + + if test "$cross_compiling" = yes; then + { { echo "$as_me:15715: error: cannot run test program while cross compiling" >&5 +echo "$as_me: error: cannot run test program while cross compiling" >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +#line 15720 "configure" +#include "confdefs.h" +#define CONFTEST $cf_pty_this +$cf_pty_defines + +#include +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_POSIX_OPENPT +#undef posix_openpt +#define posix_openpt(mode) open("/dev/ptmx", mode) +#endif + +#ifdef HAVE_STROPTS_H +#include +#endif + +static void failed(int code) +{ + perror("conftest"); + exit(code); +} + +static void my_timeout(int sig) +{ + (void)sig; + exit(99); +} + +int main(void) +{ + + int code = 0; + int rc; + int pty; + int tty; + char *slave; + struct termios tio; + + (void)tio; + signal(SIGALRM, my_timeout); + + if (alarm(2) == 9) + failed(9); + else if ((pty = posix_openpt(O_RDWR)) < 0) + failed(1); + else if ((rc = grantpt(pty)) < 0) + failed(2); + else if ((rc = unlockpt(pty)) < 0) + failed(3); + else if ((slave = ptsname(pty)) == 0) + failed(4); +#if (CONFTEST == 3) || defined(CONFTEST_isatty) + else if (!isatty(pty)) + failed(4); +#endif +#if CONFTEST >= 4 + else if ((rc = tcgetattr(pty, &tio)) < 0) + failed(20); + else if ((rc = tcsetattr(pty, TCSAFLUSH, &tio)) < 0) + failed(21); +#endif + /* BSD posix_openpt does not treat pty as a terminal until slave is opened. + * Linux does treat it that way. + */ + else if ((tty = open(slave, O_RDWR)) < 0) + failed(5); +#ifdef CONFTEST +#ifdef I_PUSH +#if (CONFTEST == 0) || defined(CONFTEST_ptem) + else if ((rc = ioctl(tty, I_PUSH, "ptem")) < 0) + failed(10); +#endif +#if (CONFTEST == 1) || defined(CONFTEST_ldterm) + else if ((rc = ioctl(tty, I_PUSH, "ldterm")) < 0) + failed(11); +#endif +#if (CONFTEST == 2) || defined(CONFTEST_ttcompat) + else if ((rc = ioctl(tty, I_PUSH, "ttcompat")) < 0) + failed(12); +#endif +#endif /* I_PUSH */ +#if CONFTEST >= 5 + else if ((rc = tcgetattr(tty, &tio)) < 0) + failed(30); + else if ((rc = tcsetattr(tty, TCSAFLUSH, &tio)) < 0) + failed(31); +#endif +#endif /* CONFTEST */ + + ${cf_cv_main_return:-return}(code); + +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:15821: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15824: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:15826: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15829: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + case $cf_pty_next in + (1) # - streams + cf_pty_feature=ptem + ;; + (2) # - streams + cf_pty_feature=ldterm + ;; + (3) # - streams + cf_pty_feature=ttcompat + ;; + (4) + cf_pty_feature=pty_isatty + ;; + (5) + cf_pty_feature=pty_tcsetattr + ;; + (6) + cf_pty_feature=tty_tcsetattr + ;; + esac + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + case $cf_pty_next in + (1|2|3) + +echo "${as_me:-configure}:15861: testing skipping remaining streams features $cf_pty_this..2 ..." 1>&5 + + cf_pty_next=3 + ;; + esac + +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + if test -n "$cf_pty_feature" + then + cf_pty_defines="$cf_pty_defines +#define CONFTEST_$cf_pty_feature 1 +" + cf_grantpt_opts="$cf_grantpt_opts $cf_pty_feature" + fi + + cf_pty_this=$cf_pty_next + done + echo "$as_me:15880: result: $cf_grantpt_opts" >&5 +echo "${ECHO_T}$cf_grantpt_opts" >&6 + cf_grantpt_opts=`echo "$cf_grantpt_opts" | sed -e 's/ isatty//'` + fi + fi +fi + +if test "x$cf_prefer_posix_openpt" = "xyes" && test "x$ac_cv_func_posix_openpt" = "xyes" ; then + test -n "$verbose" && echo " prefer posix_openpt over openpty" 1>&6 + +echo "${as_me:-configure}:15890: testing prefer posix_openpt over openpty ..." 1>&5 + +elif test "x$disable_openpty" != "xyes" || test -z "$cf_grantpt_opts" ; then + echo "$as_me:15893: checking for openpty in -lutil" >&5 +echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6 +if test "${ac_cv_lib_util_openpty+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 15901 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char openpty (); +int +main (void) +{ +openpty (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:15920: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:15923: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:15926: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:15929: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_util_openpty=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_util_openpty=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:15940: result: $ac_cv_lib_util_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6 +if test $ac_cv_lib_util_openpty = yes; then + cf_have_openpty=yes +else + cf_have_openpty=no +fi + + if test "$cf_have_openpty" = yes ; then + ac_cv_func_grantpt=no + LIBS="-lutil $LIBS" + +cat >>confdefs.h <<\EOF +#define HAVE_OPENPTY 1 +EOF + +for ac_header in \ + util.h \ + libutil.h \ + pty.h \ + +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:15963: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 15969 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:15973: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:15979: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:15998: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&6 + +echo "${as_me:-configure}:16015: testing will rely upon grantpt ..." 1>&5 + +cat >>confdefs.h <<\EOF +#define HAVE_WORKING_GRANTPT 1 +EOF + + for cf_feature in $cf_grantpt_opts + do + cf_feature=`echo "$cf_feature" | sed -e 's/ //g'` + +cf_FEATURE=`echo "$cf_feature" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + + cat >>confdefs.h <&6 + +echo "${as_me:-configure}:16036: testing will rely upon BSD-pseudoterminals ..." 1>&5 + +else + test -n "$verbose" && echo " will rely upon openpty" 1>&6 + +echo "${as_me:-configure}:16041: testing will rely upon openpty ..." 1>&5 + +fi + +echo "$as_me:16045: checking if we can use XkbQueryExtension" >&5 +echo $ECHO_N "checking if we can use XkbQueryExtension... $ECHO_C" >&6 +if test "${cf_cv_xkb_query_extension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 16052 "configure" +#include "confdefs.h" + +#include +#include +#include + +int +main (void) +{ + + int xkbmajor = XkbMajorVersion; + int xkbminor = XkbMinorVersion; + int xkbopcode, xkbevent, xkberror; + + if (XkbLibraryVersion(&xkbmajor, &xkbminor) + && XkbQueryExtension((Display *)0, + &xkbopcode, + &xkbevent, + &xkberror, + &xkbmajor, + &xkbminor)) + return 0; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:16081: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:16084: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:16087: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16090: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +cf_cv_xkb_query_extension=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +cf_cv_xkb_query_extension=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:16105: result: $cf_cv_xkb_query_extension" >&5 +echo "${ECHO_T}$cf_cv_xkb_query_extension" >&6 + +if test $cf_cv_xkb_query_extension = yes +then + +for ac_func in XkbQueryExtension +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:16114: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 16120 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16151: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16154: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16157: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16160: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:16170: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if we can use XkbKeycodeToKeysym... $ECHO_C" >&6 +if test "${cf_cv_xkb_keycode_to_keysym+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 16189 "configure" +#include "confdefs.h" + +#include +#include + +int +main (void) +{ + + KeySym keysym = XkbKeycodeToKeysym((Display *)0, 0, 0, 0); + (void)keysym; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:16207: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:16210: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:16213: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16216: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +cf_cv_xkb_keycode_to_keysym=yes + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + +cf_cv_xkb_keycode_to_keysym=no + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:16231: result: $cf_cv_xkb_keycode_to_keysym" >&5 +echo "${ECHO_T}$cf_cv_xkb_keycode_to_keysym" >&6 + +if test $cf_cv_xkb_keycode_to_keysym = yes +then + +for ac_func in XkbKeycodeToKeysym +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:16240: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 16246 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16277: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16280: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16283: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16286: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:16296: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for XKB Bell extension... $ECHO_C" >&6 +if test "${cf_cv_xkb_bell_ext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 16331 "configure" +#include "confdefs.h" + +#include +#include /* has the prototype */ +#include /* has the XkbBI_xxx definitions */ + +int +main (void) +{ + + int x = (XkbBI_Info |XkbBI_MinorError |XkbBI_MajorError |XkbBI_TerminalBell |XkbBI_MarginBell); + Atom y = 0; + (void)x; + XkbBell((Display *)0, (Widget)0, 0, y); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16352: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16355: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16358: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16361: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xkb_bell_ext=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xkb_bell_ext=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:16372: result: $cf_cv_xkb_bell_ext" >&5 +echo "${ECHO_T}$cf_cv_xkb_bell_ext" >&6 +test "$cf_cv_xkb_bell_ext" = yes && +cat >>confdefs.h <<\EOF +#define HAVE_XKB_BELL_EXT 1 +EOF + +LIBS="$cf_save_LIBS_CF_XKB_BELL_EXT" +CFLAGS="$cf_save_CFLAGS_CF_XKB_BELL_EXT" +CPPFLAGS="$cf_save_CPPFLAGS_CF_XKB_BELL_EXT" + +for ac_func in Xutf8LookupString +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:16386: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 16392 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:16423: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:16426: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:16429: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:16432: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:16442: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want narrow prototypes for X libraries... $ECHO_C" >&6 + +case `$ac_config_guess` in +(*freebsd*|*gnu*|*irix5*|*irix6*|*linux-gnu*|*netbsd*|*openbsd*|*qnx*|*sco*|*sgi*) + cf_default_narrowproto=yes + ;; +(*) + cf_default_narrowproto=no + ;; +esac + +# Check whether --enable-narrowproto or --disable-narrowproto was given. +if test "${enable_narrowproto+set}" = set; then + enableval="$enable_narrowproto" + test "$enableval" != no && enableval=yes + if test "$enableval" != "$cf_default_narrowproto" ; then + enable_narrowproto=$enableval + else + enable_narrowproto=$cf_default_narrowproto + fi +else + enableval=$cf_default_narrowproto + enable_narrowproto=$cf_default_narrowproto + +fi; +echo "$as_me:16484: result: $enable_narrowproto" >&5 +echo "${ECHO_T}$enable_narrowproto" >&6 + +echo "$as_me:16487: checking if we should use imake to help" >&5 +echo $ECHO_N "checking if we should use imake to help... $ECHO_C" >&6 + +# Check whether --enable-imake or --disable-imake was given. +if test "${enable_imake+set}" = set; then + enableval="$enable_imake" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_imake=no + else + enable_imake=yes + fi +else + enableval=yes + enable_imake=yes + +fi; +echo "$as_me:16504: result: $enable_imake" >&5 +echo "${ECHO_T}$enable_imake" >&6 + +if test "$enable_imake" = yes ; then + +for ac_prog in xmkmf imake +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:16513: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_IMAKE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $IMAKE in + [\\/]* | ?:[\\/]*) + ac_cv_path_IMAKE="$IMAKE" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_IMAKE="$ac_dir/$ac_word" + echo "$as_me:16530: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +IMAKE=$ac_cv_path_IMAKE + +if test -n "$IMAKE"; then + echo "$as_me:16541: result: $IMAKE" >&5 +echo "${ECHO_T}$IMAKE" >&6 +else + echo "$as_me:16544: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$IMAKE" && break +done + +if test -n "$IMAKE" ; then + +case $IMAKE in +(*/imake) + cf_imake_opts="-DUseInstalled=YES" + ;; +(*/util/xmkmf) + # A single parameter tells xmkmf where the config-files are: + cf_imake_opts="`echo $IMAKE|sed -e s,/config/util/xmkmf,,`" + ;; +(*) + cf_imake_opts= + ;; +esac + +# If it's installed properly, imake (or its wrapper, xmkmf) will point to the +# config directory. +if mkdir conftestdir; then + CDPATH=; export CDPATH + cf_makefile=`cd $srcdir;pwd`/Imakefile + cd conftestdir + + cat >fix_cflags.sed <<'CF_EOF' +s/\\//g +s/[ ][ ]*/ /g +s/"//g +:pack +s/\(=[^ ][^ ]*\) \([^-]\)/\1 \2/g +t pack +s/\(-D[a-zA-Z0-9_][a-zA-Z0-9_]*\)=\([^\'0-9 ][^ ]*\)/\1='\\"\2\\"'/g +s/^IMAKE[ ]/IMAKE_CFLAGS="/ +s/ / /g +s/$/"/ +CF_EOF + + cat >fix_lflags.sed <<'CF_EOF' +s/^IMAKE[ ]*/IMAKE_LOADFLAGS="/ +s/$/"/ +CF_EOF + + echo >./Imakefile + test -f $cf_makefile && cat $cf_makefile >>./Imakefile + + cat >> ./Imakefile <<'CF_EOF' +findstddefs: + @echo IMAKE ${ALLDEFINES} $(MAIN_DEFINES) $(VENDORMANDEFS) | sed -f fix_cflags.sed + @echo IMAKE ${EXTRA_LOAD_FLAGS} | sed -f fix_lflags.sed +CF_EOF + + if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&5 && test -f Makefile) + then + test -n "$verbose" && echo " Using $IMAKE $cf_imake_opts" 1>&6 + +echo "${as_me:-configure}:16604: testing Using $IMAKE $cf_imake_opts ..." 1>&5 + + else + # sometimes imake doesn't have the config path compiled in. Find it. + cf_config= + for cf_libpath in $X_LIBS $LIBS ; do + case $cf_libpath in + (-L*) + cf_libpath=`echo .$cf_libpath | sed -e 's/^...//'` + cf_libpath=$cf_libpath/X11/config + if test -d $cf_libpath ; then + cf_config=$cf_libpath + break + fi + ;; + esac + done + if test -z "$cf_config" ; then + { echo "$as_me:16622: WARNING: Could not find imake config-directory" >&5 +echo "$as_me: WARNING: Could not find imake config-directory" >&2;} + else + cf_imake_opts="$cf_imake_opts -I$cf_config" + if ( $IMAKE -v $cf_imake_opts 2>&5) + then + test -n "$verbose" && echo " Using $IMAKE $cf_config" 1>&6 + +echo "${as_me:-configure}:16630: testing Using $IMAKE $cf_config ..." 1>&5 + + else + { echo "$as_me:16633: WARNING: Cannot run $IMAKE" >&5 +echo "$as_me: WARNING: Cannot run $IMAKE" >&2;} + fi + fi + fi + + # GNU make sometimes prints "make[1]: Entering...", which + # would confuse us. + eval `make findstddefs 2>/dev/null | grep -v make` + + cd .. + rm -rf conftestdir + + # We use ${ALLDEFINES} rather than ${STD_DEFINES} because the former + # declares XTFUNCPROTO there. However, some vendors (e.g., SGI) have + # modified it to support site.cf, adding a kludge for the /usr/include + # directory. Try to filter that out, otherwise gcc won't find its + # headers. + if test -n "$GCC" ; then + if test -n "$IMAKE_CFLAGS" ; then + cf_nostdinc="" + cf_std_incl="" + cf_cpp_opts="" + for cf_opt in $IMAKE_CFLAGS + do + case "$cf_opt" in + (-nostdinc) + cf_nostdinc="$cf_opt" + ;; + (-I/usr/include) + cf_std_incl="$cf_opt" + ;; + (*) + cf_cpp_opts="$cf_cpp_opts $cf_opt" + ;; + esac + done + if test -z "$cf_nostdinc" ; then + IMAKE_CFLAGS="$cf_cpp_opts $cf_std_incl" + elif test -z "$cf_std_incl" ; then + IMAKE_CFLAGS="$cf_cpp_opts $cf_nostdinc" + else + test -n "$verbose" && echo " suppressed \"$cf_nostdinc\" and \"$cf_std_incl\"" 1>&6 + +echo "${as_me:-configure}:16677: testing suppressed \"$cf_nostdinc\" and \"$cf_std_incl\" ..." 1>&5 + + IMAKE_CFLAGS="$cf_cpp_opts" + fi + fi + fi +fi + +# Some imake configurations define PROJECTROOT with an empty value. Remove +# the empty definition. +case $IMAKE_CFLAGS in +(*-DPROJECTROOT=/*) + ;; +(*) + IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" |sed -e "s,-DPROJECTROOT=[ ], ,"` + ;; +esac + +fi + +test -n "$verbose" && echo " IMAKE_CFLAGS $IMAKE_CFLAGS" 1>&6 + +echo "${as_me:-configure}:16699: testing IMAKE_CFLAGS $IMAKE_CFLAGS ..." 1>&5 + +test -n "$verbose" && echo " IMAKE_LOADFLAGS $IMAKE_LOADFLAGS" 1>&6 + +echo "${as_me:-configure}:16703: testing IMAKE_LOADFLAGS $IMAKE_LOADFLAGS ..." 1>&5 + +fi + +if test -n "$IMAKE" && test -n "$IMAKE_CFLAGS" ; then + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $IMAKE_CFLAGS +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +else + IMAKE_CFLAGS= + IMAKE_LOADFLAGS= + test -n "$verbose" && echo " make fallback definitions" 1>&6 + +echo "${as_me:-configure}:16812: testing make fallback definitions ..." 1>&5 + + # We prefer config.guess' values when we can get them, to avoid + # inconsistent results with uname (AIX for instance). However, + # config.guess is not always consistent either. + case $host_os in + (*[0-9].[0-9]*) + UNAME_RELEASE="$host_os" + ;; + (*) + UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown + ;; + esac + + case .$UNAME_RELEASE in + (*[0-9].[0-9]*) + OSMAJORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[^0-9]*//' -e 's/\..*//'` + OSMINORVERSION=`echo "$UNAME_RELEASE" |sed -e 's/^[^0-9]*//' -e 's/^[^.]*\.//' -e 's/\..*//' -e 's/[^0-9].*//' ` + test -z "$OSMAJORVERSION" && OSMAJORVERSION=1 + test -z "$OSMINORVERSION" && OSMINORVERSION=0 + IMAKE_CFLAGS="-DOSMAJORVERSION=$OSMAJORVERSION -DOSMINORVERSION=$OSMINORVERSION $IMAKE_CFLAGS" + ;; + esac + + # FUNCPROTO is standard with X11R6, but XFree86 drops it, leaving some + # fallback/fragments for NeedPrototypes, etc. + IMAKE_CFLAGS="-DFUNCPROTO=15 $IMAKE_CFLAGS" + + # If this is not set properly, Xaw's scrollbars will not work + if test "$enable_narrowproto" = yes ; then + IMAKE_CFLAGS="-DNARROWPROTO=1 $IMAKE_CFLAGS" + fi + + # Other special definitions: + case $host_os in + (aix*) + # imake on AIX 5.1 defines AIXV3. really. + IMAKE_CFLAGS="-DAIXV3 -DAIXV4 $IMAKE_CFLAGS" + ;; + (irix[56].*) + # these are needed to make SIGWINCH work in xterm + IMAKE_CFLAGS="-DSYSV -DSVR4 $IMAKE_CFLAGS" + ;; + esac + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $IMAKE_CFLAGS +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +fi + +# Extract the first word of "groff", so it can be a program name with args. +set dummy groff; ac_word=$2 +echo "$as_me:16959: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_GROFF_PATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GROFF_PATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_GROFF_PATH="$GROFF_PATH" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_GROFF_PATH="$ac_dir/$ac_word" + echo "$as_me:16976: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_GROFF_PATH" && ac_cv_path_GROFF_PATH="no" + ;; +esac +fi +GROFF_PATH=$ac_cv_path_GROFF_PATH + +if test -n "$GROFF_PATH"; then + echo "$as_me:16988: result: $GROFF_PATH" >&5 +echo "${ECHO_T}$GROFF_PATH" >&6 +else + echo "$as_me:16991: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +for ac_prog in nroff mandoc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:16999: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_NROFF_PATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $NROFF_PATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_NROFF_PATH="$NROFF_PATH" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_NROFF_PATH="$ac_dir/$ac_word" + echo "$as_me:17016: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +NROFF_PATH=$ac_cv_path_NROFF_PATH + +if test -n "$NROFF_PATH"; then + echo "$as_me:17027: result: $NROFF_PATH" >&5 +echo "${ECHO_T}$NROFF_PATH" >&6 +else + echo "$as_me:17030: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$NROFF_PATH" && break +done +test -n "$NROFF_PATH" || NROFF_PATH="no" + +# Extract the first word of "tbl", so it can be a program name with args. +set dummy tbl; ac_word=$2 +echo "$as_me:17040: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_TBL_PATH+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $TBL_PATH in + [\\/]* | ?:[\\/]*) + ac_cv_path_TBL_PATH="$TBL_PATH" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_TBL_PATH="$ac_dir/$ac_word" + echo "$as_me:17057: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_TBL_PATH" && ac_cv_path_TBL_PATH="cat" + ;; +esac +fi +TBL_PATH=$ac_cv_path_TBL_PATH + +if test -n "$TBL_PATH"; then + echo "$as_me:17069: result: $TBL_PATH" >&5 +echo "${ECHO_T}$TBL_PATH" >&6 +else + echo "$as_me:17072: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "x$GROFF_PATH" = xno +then + NROFF_NOTE= + GROFF_NOTE="#" +else + NROFF_NOTE="#" + GROFF_NOTE= +fi + +case "x${with_man2html}" in +(xno) + cf_man2html=no + ;; +(x|xyes) + # Extract the first word of "man2html", so it can be a program name with args. +set dummy man2html; ac_word=$2 +echo "$as_me:17092: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_cf_man2html+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $cf_man2html in + [\\/]* | ?:[\\/]*) + ac_cv_path_cf_man2html="$cf_man2html" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_cf_man2html="$ac_dir/$ac_word" + echo "$as_me:17109: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_cf_man2html" && ac_cv_path_cf_man2html="no" + ;; +esac +fi +cf_man2html=$ac_cv_path_cf_man2html + +if test -n "$cf_man2html"; then + echo "$as_me:17121: result: $cf_man2html" >&5 +echo "${ECHO_T}$cf_man2html" >&6 +else + echo "$as_me:17124: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + case "x$cf_man2html" in + (x/*) + echo "$as_me:17130: checking for the modified Earl Hood script" >&5 +echo $ECHO_N "checking for the modified Earl Hood script... $ECHO_C" >&6 + if ( $cf_man2html -help 2>&1 | grep 'Make an index of headers at the end' >/dev/null ) + then + cf_man2html_ok=yes + else + cf_man2html=no + cf_man2html_ok=no + fi + echo "$as_me:17139: result: $cf_man2html_ok" >&5 +echo "${ECHO_T}$cf_man2html_ok" >&6 + ;; + (*) + cf_man2html=no + ;; + esac +esac + +echo "$as_me:17148: checking for program to convert manpage to html" >&5 +echo $ECHO_N "checking for program to convert manpage to html... $ECHO_C" >&6 + +# Check whether --with-man2html or --without-man2html was given. +if test "${with_man2html+set}" = set; then + withval="$with_man2html" + cf_man2html=$withval +else + cf_man2html=$cf_man2html +fi; + +cf_with_groff=no + +case $cf_man2html in +(yes) + echo "$as_me:17163: result: man2html" >&5 +echo "${ECHO_T}man2html" >&6 + # Extract the first word of "man2html", so it can be a program name with args. +set dummy man2html; ac_word=$2 +echo "$as_me:17167: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_cf_man2html+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $cf_man2html in + [\\/]* | ?:[\\/]*) + ac_cv_path_cf_man2html="$cf_man2html" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_cf_man2html="$ac_dir/$ac_word" + echo "$as_me:17184: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_cf_man2html" && ac_cv_path_cf_man2html="no" + ;; +esac +fi +cf_man2html=$ac_cv_path_cf_man2html + +if test -n "$cf_man2html"; then + echo "$as_me:17196: result: $cf_man2html" >&5 +echo "${ECHO_T}$cf_man2html" >&6 +else + echo "$as_me:17199: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + ;; +(no|groff|*/groff*) + cf_with_groff=yes + cf_man2html=$GROFF_PATH + echo "$as_me:17207: result: $cf_man2html" >&5 +echo "${ECHO_T}$cf_man2html" >&6 + ;; +(*) + echo "$as_me:17211: result: $cf_man2html" >&5 +echo "${ECHO_T}$cf_man2html" >&6 + ;; +esac + +MAN2HTML_TEMP="man2html.tmp" + cat >$MAN2HTML_TEMP <>$MAN2HTML_TEMP <&5 +echo "$as_me: error: expected a pathname, not \"$cf_man2html\"" >&2;} + { (exit 1); exit 1; }; } + ;; +esac + + MAN2HTML_PATH="$cf_man2html" + echo "$as_me:17282: checking for $cf_man2html top/bottom margins" >&5 +echo $ECHO_N "checking for $cf_man2html top/bottom margins... $ECHO_C" >&6 + + # for this example, expect 3 lines of content, the remainder is head/foot + cat >conftest.in <conftest.out + + cf_man2html_1st=`fgrep -n MARKER conftest.out |sed -e 's/^[^0-9]*://' -e 's/:.*//'` + cf_man2html_top=`expr $cf_man2html_1st - 2` + cf_man2html_bot=`wc -l conftest.out |sed -e 's/[^0-9]//g'` + cf_man2html_bot=`expr $cf_man2html_bot - 2 - $cf_man2html_top` + cf_man2html_top_bot="-topm=$cf_man2html_top -botm=$cf_man2html_bot" + + echo "$as_me:17300: result: $cf_man2html_top_bot" >&5 +echo "${ECHO_T}$cf_man2html_top_bot" >&6 + + echo "$as_me:17303: checking for pagesize to use" >&5 +echo $ECHO_N "checking for pagesize to use... $ECHO_C" >&6 + for cf_block in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 + do + cat >>conftest.in <conftest.out + cf_man2html_page=`fgrep -n HEAD1 conftest.out |sed -n '$p' |sed -e 's/^[^0-9]*://' -e 's/:.*//'` + test -z "$cf_man2html_page" && cf_man2html_page=99999 + test "$cf_man2html_page" -gt 100 && cf_man2html_page=99999 + + rm -rf conftest* + echo "$as_me:17328: result: $cf_man2html_page" >&5 +echo "${ECHO_T}$cf_man2html_page" >&6 + + cat >>$MAN2HTML_TEMP <&6 + +echo "${as_me:-configure}:17356: testing removing terminfo flags from IMAKE_CFLAGS ..." 1>&5 + + IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" | sed -e 's/-DUSE_TERMINFO[ ]*-DHAVE_TIGETSTR[ ]*//'` + test -n "$verbose" && echo " ...result $IMAKE_CFLAGS" 1>&6 + +echo "${as_me:-configure}:17361: testing ...result $IMAKE_CFLAGS ..." 1>&5 + + test -n "$verbose" && echo " removing terminfo flags from CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:17365: testing removing terminfo flags from CPPFLAGS ..." 1>&5 + + CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/-DUSE_TERMINFO[ ]*-DHAVE_TIGETSTR[ ]*//'` + test -n "$verbose" && echo " ...result $CPPFLAGS" 1>&6 + +echo "${as_me:-configure}:17370: testing ...result $CPPFLAGS ..." 1>&5 + + ;; + esac +fi + +echo "$as_me:17376: checking for default terminal-id" >&5 +echo $ECHO_N "checking for default terminal-id... $ECHO_C" >&6 + +# Check whether --with-terminal-id or --without-terminal-id was given. +if test "${with_terminal_id+set}" = set; then + withval="$with_terminal_id" + default_termid=$withval +else + default_termid=vt420 +fi; +echo "$as_me:17386: result: $default_termid" >&5 +echo "${ECHO_T}$default_termid" >&6 +case $default_termid in +(vt*) default_termid=`echo $default_termid | sed -e 's/^..//'` + ;; +esac + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for default terminal-type... $ECHO_C" >&6 + +# Check whether --with-terminal-type or --without-terminal-type was given. +if test "${with_terminal_type+set}" = set; then + withval="$with_terminal_type" + default_TERM=$withval +else + default_TERM=xterm +fi; +echo "$as_me:17407: result: $default_TERM" >&5 +echo "${ECHO_T}$default_TERM" >&6 + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if backarrow-key should be BS... $ECHO_C" >&6 + +# Check whether --enable-backarrow-key or --disable-backarrow-key was given. +if test "${enable_backarrow_key+set}" = set; then + enableval="$enable_backarrow_key" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + backarrow_is_bs=$enableval + else + backarrow_is_bs=yes + fi +else + enableval=yes + backarrow_is_bs=yes + +fi; + +echo "$as_me:17433: result: $backarrow_is_bs" >&5 +echo "${ECHO_T}$backarrow_is_bs" >&6 +case $backarrow_is_bs in +(yes) + backarrow_is_bs=true + ;; +(no) + backarrow_is_bs=false + ;; +esac +cf_xbool1=`echo "$backarrow_is_bs"|sed -e 's/^\(.\).*/\1/'` + +cf_xbool1=`echo "$cf_xbool1" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_xbool2=`echo "$backarrow_is_bs"|sed -e 's/^.//'` +backarrow_is_bs=${cf_xbool1}${cf_xbool2} + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if backarrow-key should be treated as erase... $ECHO_C" >&6 + +# Check whether --enable-backarrow-is-erase or --disable-backarrow-is-erase was given. +if test "${enable_backarrow_is_erase+set}" = set; then + enableval="$enable_backarrow_is_erase" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + backarrow_is_erase=$enableval + else + backarrow_is_erase=no + fi +else + enableval=no + backarrow_is_erase=no + +fi; + +echo "$as_me:17472: result: $backarrow_is_erase" >&5 +echo "${ECHO_T}$backarrow_is_erase" >&6 +case $backarrow_is_erase in +(yes) + backarrow_is_erase=true + ;; +(no) + backarrow_is_erase=false + ;; +esac +cf_xbool1=`echo "$backarrow_is_erase"|sed -e 's/^\(.\).*/\1/'` + +cf_xbool1=`echo "$cf_xbool1" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_xbool2=`echo "$backarrow_is_erase"|sed -e 's/^.//'` +backarrow_is_erase=${cf_xbool1}${cf_xbool2} + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for default backspace/DEL setting... $ECHO_C" >&6 + +# Check whether --enable-delete-is-del or --disable-delete-is-del was given. +if test "${enable_delete_is_del+set}" = set; then + enableval="$enable_delete_is_del" + delete_is_del=$enableval +else + delete_is_del=maybe +fi; + +echo "$as_me:17504: result: $delete_is_del" >&5 +echo "${ECHO_T}$delete_is_del" >&6 +case $delete_is_del in +(yes) + delete_is_del=true + ;; +(no) + delete_is_del=false + ;; +esac +cf_xbool1=`echo "$delete_is_del"|sed -e 's/^\(.\).*/\1/'` + +cf_xbool1=`echo "$cf_xbool1" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_xbool2=`echo "$delete_is_del"|sed -e 's/^.//'` +delete_is_del=${cf_xbool1}${cf_xbool2} + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for default pty initial erase setting... $ECHO_C" >&6 + +# Check whether --enable-pty-erase or --disable-pty-erase was given. +if test "${enable_pty_erase+set}" = set; then + enableval="$enable_pty_erase" + initial_erase=$enableval +else + initial_erase=False +fi; + +echo "$as_me:17536: result: $initial_erase" >&5 +echo "${ECHO_T}$initial_erase" >&6 +case $initial_erase in +(yes) + initial_erase=true + ;; +(no) + initial_erase=false + ;; +esac +cf_xbool1=`echo "$initial_erase"|sed -e 's/^\(.\).*/\1/'` + +cf_xbool1=`echo "$cf_xbool1" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_xbool2=`echo "$initial_erase"|sed -e 's/^.//'` +initial_erase=${cf_xbool1}${cf_xbool2} + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if alt should send ESC... $ECHO_C" >&6 + +# Check whether --enable-alt-sends-esc or --disable-alt-sends-esc was given. +if test "${enable_alt_sends_esc+set}" = set; then + enableval="$enable_alt_sends_esc" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + alt_sends_esc=$enableval + else + alt_sends_esc=no + fi +else + enableval=no + alt_sends_esc=no + +fi; + +echo "$as_me:17575: result: $alt_sends_esc" >&5 +echo "${ECHO_T}$alt_sends_esc" >&6 +case $alt_sends_esc in +(yes) + alt_sends_esc=true + ;; +(no) + alt_sends_esc=false + ;; +esac +cf_xbool1=`echo "$alt_sends_esc"|sed -e 's/^\(.\).*/\1/'` + +cf_xbool1=`echo "$cf_xbool1" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_xbool2=`echo "$alt_sends_esc"|sed -e 's/^.//'` +alt_sends_esc=${cf_xbool1}${cf_xbool2} + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if meta should send ESC... $ECHO_C" >&6 + +# Check whether --enable-meta-sends-esc or --disable-meta-sends-esc was given. +if test "${enable_meta_sends_esc+set}" = set; then + enableval="$enable_meta_sends_esc" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + meta_sends_esc=$enableval + else + meta_sends_esc=no + fi +else + enableval=no + meta_sends_esc=no + +fi; + +echo "$as_me:17614: result: $meta_sends_esc" >&5 +echo "${ECHO_T}$meta_sends_esc" >&6 +case $meta_sends_esc in +(yes) + meta_sends_esc=true + ;; +(no) + meta_sends_esc=false + ;; +esac +cf_xbool1=`echo "$meta_sends_esc"|sed -e 's/^\(.\).*/\1/'` + +cf_xbool1=`echo "$cf_xbool1" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` + +cf_xbool2=`echo "$meta_sends_esc"|sed -e 's/^.//'` +meta_sends_esc=${cf_xbool1}${cf_xbool2} + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_cf_tic_prog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$cf_tic_prog"; then + ac_cv_prog_cf_tic_prog="$cf_tic_prog" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_cf_tic_prog="yes" +echo "$as_me:17653: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_cf_tic_prog" && ac_cv_prog_cf_tic_prog="no" +fi +fi +cf_tic_prog=$ac_cv_prog_cf_tic_prog +if test -n "$cf_tic_prog"; then + echo "$as_me:17662: result: $cf_tic_prog" >&5 +echo "${ECHO_T}$cf_tic_prog" >&6 +else + echo "$as_me:17665: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$cf_tic_prog" = yes ; then + if test -n "$TERMINFO" + then + case "$TERMINFO" in + (/*) + test -d "$TERMINFO" || unset TERMINFO + ;; + (*) + unset TERMINFO + ;; + esac + fi + echo "$as_me:17681: checking for private terminfo-directory" >&5 +echo $ECHO_N "checking for private terminfo-directory... $ECHO_C" >&6 + +# Check whether --with-own-terminfo or --without-own-terminfo was given. +if test "${with_own_terminfo+set}" = set; then + withval="$with_own_terminfo" + TERMINFO_DIR=$withval +else + TERMINFO_DIR=${TERMINFO-none} +fi; + echo "$as_me:17691: result: $TERMINFO_DIR" >&5 +echo "${ECHO_T}$TERMINFO_DIR" >&6 + if test "$TERMINFO_DIR" = yes ; then + { echo "$as_me:17694: WARNING: no value given" >&5 +echo "$as_me: WARNING: no value given" >&2;} + elif test "$TERMINFO_DIR" != none ; then + if test -d $TERMINFO_DIR ; then + +cat >>confdefs.h <&5 +echo $ECHO_N "checking if \$TERMINFO should also be set... $ECHO_C" >&6 + +# Check whether --enable-env-terminfo or --disable-env-terminfo was given. +if test "${enable_env_terminfo+set}" = set; then + enableval="$enable_env_terminfo" + cf_env_terminfo=yes +else + cf_env_terminfo=no +fi; + echo "$as_me:17713: result: $cf_env_terminfo" >&5 +echo "${ECHO_T}$cf_env_terminfo" >&6 + test $cf_env_terminfo = yes && + +cat >>confdefs.h <<\EOF +#define OWN_TERMINFO_ENV 1 +EOF + + else + { echo "$as_me:17722: WARNING: not a directory" >&5 +echo "$as_me: WARNING: not a directory" >&2;} + fi + elif test "$prefix" != NONE ; then + TERMINFO_DIR='${prefix}/lib/terminfo' + elif test -d /usr/lib/terminfo ; then + TERMINFO_DIR=/usr/lib/terminfo + else + TERMINFO_DIR= + fi + SET_TERMINFO= + if test -n "$TERMINFO_DIR" ; then + TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR + SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)' + fi + no_ticprog= +else + no_ticprog="#" + TERMINFO_DIR= + SET_TERMINFO= +fi + +############################################################################### + +echo "$as_me:17746: checking if you want active-icons" >&5 +echo $ECHO_N "checking if you want active-icons... $ECHO_C" >&6 + +# Check whether --enable-active-icon or --disable-active-icon was given. +if test "${enable_active_icon+set}" = set; then + enableval="$enable_active_icon" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_active_icon=no + else + enable_active_icon=yes + fi +else + enableval=yes + enable_active_icon=yes + +fi; +echo "$as_me:17763: result: $enable_active_icon" >&5 +echo "${ECHO_T}$enable_active_icon" >&6 +if test "$enable_active_icon" = no ; then + +cat >>confdefs.h <<\EOF +#define NO_ACTIVE_ICON 1 +EOF + +fi + +echo "$as_me:17773: checking if you want ANSI color" >&5 +echo $ECHO_N "checking if you want ANSI color... $ECHO_C" >&6 + +# Check whether --enable-ansi-color or --disable-ansi-color was given. +if test "${enable_ansi_color+set}" = set; then + enableval="$enable_ansi_color" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_ansi_color=no + else + enable_ansi_color=yes + fi +else + enableval=yes + enable_ansi_color=yes + +fi; +echo "$as_me:17790: result: $enable_ansi_color" >&5 +echo "${ECHO_T}$enable_ansi_color" >&6 +test "$enable_ansi_color" = no && +cat >>confdefs.h <<\EOF +#define OPT_ISO_COLORS 0 +EOF + +if test "$enable_ansi_color" = yes ; then + + echo "$as_me:17799: checking if you want 16 colors like aixterm" >&5 +echo $ECHO_N "checking if you want 16 colors like aixterm... $ECHO_C" >&6 + +# Check whether --enable-16-color or --disable-16-color was given. +if test "${enable_16_color+set}" = set; then + enableval="$enable_16_color" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_16_color=no + else + enable_16_color=yes + fi +else + enableval=yes + enable_16_color=yes + +fi; + echo "$as_me:17816: result: $enable_16_color" >&5 +echo "${ECHO_T}$enable_16_color" >&6 + test "$enable_16_color" = no && +cat >>confdefs.h <<\EOF +#define OPT_AIX_COLORS 0 +EOF + + echo "$as_me:17823: checking if you want 256 colors" >&5 +echo $ECHO_N "checking if you want 256 colors... $ECHO_C" >&6 + +# Check whether --enable-256-color or --disable-256-color was given. +if test "${enable_256_color+set}" = set; then + enableval="$enable_256_color" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_256_color=no + else + enable_256_color=yes + fi +else + enableval=yes + enable_256_color=yes + +fi; + echo "$as_me:17840: result: $enable_256_color" >&5 +echo "${ECHO_T}$enable_256_color" >&6 + + if test "$enable_256_color" = yes ; then + + CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h" + EXTRAHDRS="$EXTRAHDRS 256colres.h" + +cat >>confdefs.h <<\EOF +#define OPT_256_COLORS 1 +EOF + + echo "$as_me:17852: checking if you want direct-color support" >&5 +echo $ECHO_N "checking if you want direct-color support... $ECHO_C" >&6 + +# Check whether --enable-direct-color or --disable-direct-color was given. +if test "${enable_direct_color+set}" = set; then + enableval="$enable_direct_color" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_direct_color=no + else + enable_direct_color=yes + fi +else + enableval=yes + enable_direct_color=yes + +fi; + echo "$as_me:17869: result: $enable_direct_color" >&5 +echo "${ECHO_T}$enable_direct_color" >&6 + if test "$enable_direct_color" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_DIRECT_COLOR 1 +EOF + + fi + + else + + echo "$as_me:17881: checking if you want 88 colors" >&5 +echo $ECHO_N "checking if you want 88 colors... $ECHO_C" >&6 + +# Check whether --enable-88-color or --disable-88-color was given. +if test "${enable_88_color+set}" = set; then + enableval="$enable_88_color" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_88_color=no + else + enable_88_color=yes + fi +else + enableval=yes + enable_88_color=yes + +fi; + echo "$as_me:17898: result: $enable_88_color" >&5 +echo "${ECHO_T}$enable_88_color" >&6 + if test "$enable_88_color" = yes ; then + CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h" + EXTRAHDRS="$EXTRAHDRS 88colres.h" + +cat >>confdefs.h <<\EOF +#define OPT_88_COLORS 1 +EOF + + fi + + fi + +fi + +echo "$as_me:17914: checking if you want blinking cursor" >&5 +echo $ECHO_N "checking if you want blinking cursor... $ECHO_C" >&6 + +# Check whether --enable-blink-cursor or --disable-blink-cursor was given. +if test "${enable_blink_cursor+set}" = set; then + enableval="$enable_blink_cursor" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_blink_curs=no + else + enable_blink_curs=yes + fi +else + enableval=yes + enable_blink_curs=yes + +fi; +echo "$as_me:17931: result: $enable_blink_curs" >&5 +echo "${ECHO_T}$enable_blink_curs" >&6 +test "$enable_blink_curs" = no && +cat >>confdefs.h <<\EOF +#define OPT_BLINK_CURS 0 +EOF + +echo "$as_me:17938: checking if you want to ignore Linux's broken palette-strings" >&5 +echo $ECHO_N "checking if you want to ignore Linux's broken palette-strings... $ECHO_C" >&6 + +case $host_os in +(linux*) + assume_broken_osc=yes ;; +(*) + assume_broken_osc=no ;; +esac + +# Check whether --enable-broken-osc or --disable-broken-osc was given. +if test "${enable_broken_osc+set}" = set; then + enableval="$enable_broken_osc" + test "$enableval" != no && enableval=yes + if test "$enableval" != "$assume_broken_osc" ; then + enable_broken_osc=$enableval + else + enable_broken_osc=$enableval + fi +else + enableval=$assume_broken_osc + enable_broken_osc=$enableval + +fi; +echo "$as_me:17962: result: $enable_broken_osc" >&5 +echo "${ECHO_T}$enable_broken_osc" >&6 +if test "$enable_broken_osc" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_BROKEN_OSC 1 +EOF + +else + +cat >>confdefs.h <<\EOF +#define OPT_BROKEN_OSC 0 +EOF + +fi + +echo "$as_me:17978: checking if you want to allow broken string-terminators" >&5 +echo $ECHO_N "checking if you want to allow broken string-terminators... $ECHO_C" >&6 + +# Check whether --enable-broken-st or --disable-broken-st was given. +if test "${enable_broken_st+set}" = set; then + enableval="$enable_broken_st" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_broken_st=no + else + enable_broken_st=yes + fi +else + enableval=no + enable_broken_st=yes + +fi; +echo "$as_me:17995: result: $enable_broken_st" >&5 +echo "${ECHO_T}$enable_broken_st" >&6 +test "$enable_broken_st" = no && +cat >>confdefs.h <<\EOF +#define OPT_BROKEN_ST 0 +EOF + +echo "$as_me:18002: checking if you want to compile-in icon data" >&5 +echo $ECHO_N "checking if you want to compile-in icon data... $ECHO_C" >&6 + +# Check whether --enable-builtin-xpms or --disable-builtin-xpms was given. +if test "${enable_builtin_xpms+set}" = set; then + enableval="$enable_builtin_xpms" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_builtin_xpms=yes + else + enable_builtin_xpms=no + fi +else + enableval=no + enable_builtin_xpms=no + +fi; +echo "$as_me:18019: result: $enable_builtin_xpms" >&5 +echo "${ECHO_T}$enable_builtin_xpms" >&6 +test "$enable_builtin_xpms" = yes && +cat >>confdefs.h <<\EOF +#define OPT_BUILTIN_XPMS 1 +EOF + +echo "$as_me:18026: checking if you want printable 128-159" >&5 +echo $ECHO_N "checking if you want printable 128-159... $ECHO_C" >&6 + +# Check whether --enable-c1-print or --disable-c1-print was given. +if test "${enable_c1_print+set}" = set; then + enableval="$enable_c1_print" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_c1_print=no + else + enable_c1_print=yes + fi +else + enableval=yes + enable_c1_print=yes + +fi; +echo "$as_me:18043: result: $enable_c1_print" >&5 +echo "${ECHO_T}$enable_c1_print" >&6 +test "$enable_c1_print" = no && +cat >>confdefs.h <<\EOF +#define OPT_C1_PRINT 0 +EOF + +if test "$enable_ansi_color" = yes ; then + + echo "$as_me:18052: checking if you want bold colors mapped like IBM PC" >&5 +echo $ECHO_N "checking if you want bold colors mapped like IBM PC... $ECHO_C" >&6 + +# Check whether --enable-bold-color or --disable-bold-color was given. +if test "${enable_bold_color+set}" = set; then + enableval="$enable_bold_color" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_pc_color=no + else + enable_pc_color=yes + fi +else + enableval=yes + enable_pc_color=yes + +fi; + echo "$as_me:18069: result: $enable_pc_color" >&5 +echo "${ECHO_T}$enable_pc_color" >&6 + test "$enable_pc_color" = no && +cat >>confdefs.h <<\EOF +#define OPT_PC_COLORS 0 +EOF + + echo "$as_me:18076: checking if you want separate color-classes" >&5 +echo $ECHO_N "checking if you want separate color-classes... $ECHO_C" >&6 + +# Check whether --enable-color-class or --disable-color-class was given. +if test "${enable_color_class+set}" = set; then + enableval="$enable_color_class" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_color_class=no + else + enable_color_class=yes + fi +else + enableval=yes + enable_color_class=yes + +fi; + echo "$as_me:18093: result: $enable_color_class" >&5 +echo "${ECHO_T}$enable_color_class" >&6 + test "$enable_color_class" = no && +cat >>confdefs.h <<\EOF +#define OPT_COLOR_CLASS 0 +EOF + + echo "$as_me:18100: checking if you want color-mode enabled by default" >&5 +echo $ECHO_N "checking if you want color-mode enabled by default... $ECHO_C" >&6 + +# Check whether --enable-color-mode or --disable-color-mode was given. +if test "${enable_color_mode+set}" = set; then + enableval="$enable_color_mode" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + default_colormode=no + else + default_colormode=yes + fi +else + enableval=yes + default_colormode=yes + +fi; + echo "$as_me:18117: result: $default_colormode" >&5 +echo "${ECHO_T}$default_colormode" >&6 + test "$default_colormode" = no && +cat >>confdefs.h <<\EOF +#define DFT_COLORMODE 0 +EOF + +fi + +echo "$as_me:18126: checking if you want support for color highlighting" >&5 +echo $ECHO_N "checking if you want support for color highlighting... $ECHO_C" >&6 + +# Check whether --enable-highlighting or --disable-highlighting was given. +if test "${enable_highlighting+set}" = set; then + enableval="$enable_highlighting" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + default_highlight=no + else + default_highlight=yes + fi +else + enableval=yes + default_highlight=yes + +fi; +echo "$as_me:18143: result: $default_highlight" >&5 +echo "${ECHO_T}$default_highlight" >&6 +test "$default_highlight" = no && +cat >>confdefs.h <<\EOF +#define OPT_HIGHLIGHT_COLOR 0 +EOF + +echo "$as_me:18150: checking if you want support for doublesize characters" >&5 +echo $ECHO_N "checking if you want support for doublesize characters... $ECHO_C" >&6 + +# Check whether --enable-doublechars or --disable-doublechars was given. +if test "${enable_doublechars+set}" = set; then + enableval="$enable_doublechars" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_doublechars=no + else + enable_doublechars=yes + fi +else + enableval=yes + enable_doublechars=yes + +fi; +echo "$as_me:18167: result: $enable_doublechars" >&5 +echo "${ECHO_T}$enable_doublechars" >&6 +test "$enable_doublechars" = no && +cat >>confdefs.h <<\EOF +#define OPT_DEC_CHRSET 0 +EOF + +echo "$as_me:18174: checking if you want fallback-support for box characters" >&5 +echo $ECHO_N "checking if you want fallback-support for box characters... $ECHO_C" >&6 + +# Check whether --enable-boxchars or --disable-boxchars was given. +if test "${enable_boxchars+set}" = set; then + enableval="$enable_boxchars" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_boxchars=no + else + enable_boxchars=yes + fi +else + enableval=yes + enable_boxchars=yes + +fi; +echo "$as_me:18191: result: $enable_boxchars" >&5 +echo "${ECHO_T}$enable_boxchars" >&6 +test "$enable_boxchars" = no && +cat >>confdefs.h <<\EOF +#define OPT_BOX_CHARS 0 +EOF + +echo "$as_me:18198: checking if you want to allow spawning new xterms" >&5 +echo $ECHO_N "checking if you want to allow spawning new xterms... $ECHO_C" >&6 + +# Check whether --enable-exec-xterm or --disable-exec-xterm was given. +if test "${enable_exec_xterm+set}" = set; then + enableval="$enable_exec_xterm" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_exec_xterm=yes + else + enable_exec_xterm=no + fi +else + enableval=no + enable_exec_xterm=no + +fi; +echo "$as_me:18215: result: $enable_exec_xterm" >&5 +echo "${ECHO_T}$enable_exec_xterm" >&6 +if test "$enable_exec_xterm" = yes ; then + +echo "$as_me:18219: checking for proc tree with cwd-support" >&5 +echo $ECHO_N "checking for proc tree with cwd-support... $ECHO_C" >&6 +if test "${cf_cv_procfs_cwd+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_procfs_cwd=no +for cf_path in /proc /compat/linux/proc /usr/compat/linux/proc +do + if test -d $cf_path && \ + test -d $cf_path/$$ && \ + ( test -d $cf_path/$$/cwd || \ + test -L $cf_path/$$/cwd ); then + cf_cv_procfs_cwd=$cf_path + break + fi +done + +fi +echo "$as_me:18238: result: $cf_cv_procfs_cwd" >&5 +echo "${ECHO_T}$cf_cv_procfs_cwd" >&6 + + if test "$cf_cv_procfs_cwd" = no ; then + { echo "$as_me:18242: WARNING: no suitable proc filesystem found" >&5 +echo "$as_me: WARNING: no suitable proc filesystem found" >&2;} + else + +cat >>confdefs.h <>confdefs.h <<\EOF +#define OPT_EXEC_XTERM 1 +EOF + + fi +fi + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists Xext; then + test -n "$verbose" && echo " found package Xext" 1>&6 + +echo "${as_me:-configure}:18260: testing found package Xext ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags Xext 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs Xext 2>/dev/null`" + test -n "$verbose" && echo " package Xext CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:18266: testing package Xext CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package Xext LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:18270: testing package Xext LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + echo "$as_me:18391: checking for XextCreateExtension in -lXext" >&5 +echo $ECHO_N "checking for XextCreateExtension in -lXext... $ECHO_C" >&6 +if test "${ac_cv_lib_Xext_XextCreateExtension+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXext $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 18399 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XextCreateExtension (); +int +main (void) +{ +XextCreateExtension (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:18418: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:18421: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:18424: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:18427: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_Xext_XextCreateExtension=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_Xext_XextCreateExtension=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:18438: result: $ac_cv_lib_Xext_XextCreateExtension" >&5 +echo "${ECHO_T}$ac_cv_lib_Xext_XextCreateExtension" >&6 +if test $ac_cv_lib_Xext_XextCreateExtension = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lXext; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + +fi + +echo "$as_me:18462: checking for X11/extensions/Xdbe.h" >&5 +echo $ECHO_N "checking for X11/extensions/Xdbe.h... $ECHO_C" >&6 +if test "${ac_cv_header_X11_extensions_Xdbe_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 18468 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:18472: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:18478: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_X11_extensions_Xdbe_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_X11_extensions_Xdbe_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:18497: result: $ac_cv_header_X11_extensions_Xdbe_h" >&5 +echo "${ECHO_T}$ac_cv_header_X11_extensions_Xdbe_h" >&6 +if test $ac_cv_header_X11_extensions_Xdbe_h = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_X11_EXTENSIONS_XDBE_H 1 +EOF + + echo "$as_me:18505: checking for XdbeSwapBuffers" >&5 +echo $ECHO_N "checking for XdbeSwapBuffers... $ECHO_C" >&6 +if test "${ac_cv_func_XdbeSwapBuffers+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 18511 "configure" +#include "confdefs.h" +#define XdbeSwapBuffers autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef XdbeSwapBuffers + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char XdbeSwapBuffers (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_XdbeSwapBuffers) || defined (__stub___XdbeSwapBuffers) +#error found stub for XdbeSwapBuffers +#endif + + return XdbeSwapBuffers (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:18542: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:18545: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:18548: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:18551: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_XdbeSwapBuffers=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_XdbeSwapBuffers=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:18561: result: $ac_cv_func_XdbeSwapBuffers" >&5 +echo "${ECHO_T}$ac_cv_func_XdbeSwapBuffers" >&6 +if test $ac_cv_func_XdbeSwapBuffers = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_XDBESWAPBUFFERS 1 +EOF + + cf_x_ext_double_buffer=yes +fi + +fi + +double_buffer=False +if test "$cf_x_ext_double_buffer" = yes ; then + echo "$as_me:18576: checking if you want to enable double-buffering in default resources" >&5 +echo $ECHO_N "checking if you want to enable double-buffering in default resources... $ECHO_C" >&6 + +# Check whether --enable-double-buffer or --disable-double-buffer was given. +if test "${enable_double_buffer+set}" = set; then + enableval="$enable_double_buffer" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_double_bfr=yes + else + enable_double_bfr=no + fi +else + enableval=no + enable_double_bfr=no + +fi; + echo "$as_me:18593: result: $enable_double_bfr" >&5 +echo "${ECHO_T}$enable_double_bfr" >&6 + if test "$enable_double_bfr" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_DOUBLE_BUFFER 1 +EOF + + double_buffer=True + fi +fi + +echo "$as_me:18605: checking if you want to use FreeType library" >&5 +echo $ECHO_N "checking if you want to use FreeType library... $ECHO_C" >&6 + +# Check whether --enable-freetype or --disable-freetype was given. +if test "${enable_freetype+set}" = set; then + enableval="$enable_freetype" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_freetype=no + else + enable_freetype=yes + fi +else + enableval=yes + enable_freetype=yes + +fi; +echo "$as_me:18622: result: $enable_freetype" >&5 +echo "${ECHO_T}$enable_freetype" >&6 +if test "$enable_freetype" = yes ; then + +cf_cv_x_freetype_incs=no +cf_cv_x_freetype_libs=no +cf_extra_freetype_libs= +FREETYPE_CONFIG=none +FREETYPE_PARAMS= + +echo "$as_me:18632: checking for FreeType configuration script" >&5 +echo $ECHO_N "checking for FreeType configuration script... $ECHO_C" >&6 + +# Check whether --with-freetype-config or --without-freetype-config was given. +if test "${with_freetype_config+set}" = set; then + withval="$with_freetype_config" + cf_cv_x_freetype_cfgs="$withval" +else + cf_cv_x_freetype_cfgs=auto +fi; +test -z $cf_cv_x_freetype_cfgs && cf_cv_x_freetype_cfgs=auto +test $cf_cv_x_freetype_cfgs = no && cf_cv_x_freetype_cfgs=none +echo "$as_me:18644: result: $cf_cv_x_freetype_cfgs" >&5 +echo "${ECHO_T}$cf_cv_x_freetype_cfgs" >&6 + +case $cf_cv_x_freetype_cfgs in +(none) + echo "$as_me:18649: checking if you specified -D/-I options for FreeType" >&5 +echo $ECHO_N "checking if you specified -D/-I options for FreeType... $ECHO_C" >&6 + +# Check whether --with-freetype-cflags or --without-freetype-cflags was given. +if test "${with_freetype_cflags+set}" = set; then + withval="$with_freetype_cflags" + cf_cv_x_freetype_incs="$with_freetype_cflags" +else + cf_cv_x_freetype_incs=no +fi; + echo "$as_me:18659: result: $cf_cv_x_freetype_incs" >&5 +echo "${ECHO_T}$cf_cv_x_freetype_incs" >&6 + + echo "$as_me:18662: checking if you specified -L/-l options for FreeType" >&5 +echo $ECHO_N "checking if you specified -L/-l options for FreeType... $ECHO_C" >&6 + +# Check whether --with-freetype-libs or --without-freetype-libs was given. +if test "${with_freetype_libs+set}" = set; then + withval="$with_freetype_libs" + cf_cv_x_freetype_libs="$with_freetype_libs" +else + cf_cv_x_freetype_libs=no +fi; + echo "$as_me:18672: result: $cf_cv_x_freetype_libs" >&5 +echo "${ECHO_T}$cf_cv_x_freetype_libs" >&6 + ;; +(auto) + if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then + FREETYPE_CONFIG=$PKG_CONFIG + FREETYPE_PARAMS=xft + else + # Extract the first word of "freetype-config", so it can be a program name with args. +set dummy freetype-config; ac_word=$2 +echo "$as_me:18682: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_FREETYPE_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $FREETYPE_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_FREETYPE_CONFIG="$FREETYPE_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_FREETYPE_CONFIG="$ac_dir/$ac_word" + echo "$as_me:18699: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_FREETYPE_CONFIG" && ac_cv_path_FREETYPE_CONFIG="none" + ;; +esac +fi +FREETYPE_CONFIG=$ac_cv_path_FREETYPE_CONFIG + +if test -n "$FREETYPE_CONFIG"; then + echo "$as_me:18711: result: $FREETYPE_CONFIG" >&5 +echo "${ECHO_T}$FREETYPE_CONFIG" >&6 +else + echo "$as_me:18714: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$FREETYPE_CONFIG" != none; then + FREETYPE_CONFIG=$FREETYPE_CONFIG + cf_extra_freetype_libs="-lXft" + else + # Extract the first word of "xft-config", so it can be a program name with args. +set dummy xft-config; ac_word=$2 +echo "$as_me:18724: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_FREETYPE_OLD_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $FREETYPE_OLD_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_FREETYPE_OLD_CONFIG="$FREETYPE_OLD_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_FREETYPE_OLD_CONFIG="$ac_dir/$ac_word" + echo "$as_me:18741: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_FREETYPE_OLD_CONFIG" && ac_cv_path_FREETYPE_OLD_CONFIG="none" + ;; +esac +fi +FREETYPE_OLD_CONFIG=$ac_cv_path_FREETYPE_OLD_CONFIG + +if test -n "$FREETYPE_OLD_CONFIG"; then + echo "$as_me:18753: result: $FREETYPE_OLD_CONFIG" >&5 +echo "${ECHO_T}$FREETYPE_OLD_CONFIG" >&6 +else + echo "$as_me:18756: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$FREETYPE_OLD_CONFIG" != none; then + FREETYPE_CONFIG=$FREETYPE_OLD_CONFIG + fi + fi + fi + ;; +(pkg*) + if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists xft; then + FREETYPE_CONFIG=$cf_cv_x_freetype_cfgs + FREETYPE_PARAMS=xft + else + { echo "$as_me:18771: WARNING: cannot find pkg-config for Xft" >&5 +echo "$as_me: WARNING: cannot find pkg-config for Xft" >&2;} + fi + ;; +(*) + # Extract the first word of "$cf_cv_x_freetype_cfgs", so it can be a program name with args. +set dummy $cf_cv_x_freetype_cfgs; ac_word=$2 +echo "$as_me:18778: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_FREETYPE_XFT_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $FREETYPE_XFT_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_FREETYPE_XFT_CONFIG="$FREETYPE_XFT_CONFIG" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_FREETYPE_XFT_CONFIG="$ac_dir/$ac_word" + echo "$as_me:18795: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_FREETYPE_XFT_CONFIG" && ac_cv_path_FREETYPE_XFT_CONFIG="none" + ;; +esac +fi +FREETYPE_XFT_CONFIG=$ac_cv_path_FREETYPE_XFT_CONFIG + +if test -n "$FREETYPE_XFT_CONFIG"; then + echo "$as_me:18807: result: $FREETYPE_XFT_CONFIG" >&5 +echo "${ECHO_T}$FREETYPE_XFT_CONFIG" >&6 +else + echo "$as_me:18810: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$FREETYPE_XFT_CONFIG" != none; then + FREETYPE_CONFIG=$FREETYPE_XFT_CONFIG + else + { echo "$as_me:18817: WARNING: cannot find config script for Xft" >&5 +echo "$as_me: WARNING: cannot find config script for Xft" >&2;} + fi + ;; +esac + +if test "$FREETYPE_CONFIG" != none ; then + echo "$as_me:18824: checking for FreeType config" >&5 +echo $ECHO_N "checking for FreeType config... $ECHO_C" >&6 + echo "$as_me:18826: result: $FREETYPE_CONFIG $FREETYPE_PARAMS" >&5 +echo "${ECHO_T}$FREETYPE_CONFIG $FREETYPE_PARAMS" >&6 + + if test "$cf_cv_x_freetype_incs" = no ; then + echo "$as_me:18830: checking for $FREETYPE_CONFIG cflags" >&5 +echo $ECHO_N "checking for $FREETYPE_CONFIG cflags... $ECHO_C" >&6 + cf_cv_x_freetype_incs="`$FREETYPE_CONFIG $FREETYPE_PARAMS --cflags 2>/dev/null`" + echo "$as_me:18833: result: $cf_cv_x_freetype_incs" >&5 +echo "${ECHO_T}$cf_cv_x_freetype_incs" >&6 + fi + + if test "$cf_cv_x_freetype_libs" = no ; then + echo "$as_me:18838: checking for $FREETYPE_CONFIG libs" >&5 +echo $ECHO_N "checking for $FREETYPE_CONFIG libs... $ECHO_C" >&6 + cf_cv_x_freetype_libs="$cf_extra_freetype_libs `$FREETYPE_CONFIG $FREETYPE_PARAMS --libs 2>/dev/null`" + echo "$as_me:18841: result: $cf_cv_x_freetype_libs" >&5 +echo "${ECHO_T}$cf_cv_x_freetype_libs" >&6 + fi +fi + +if test "$cf_cv_x_freetype_incs" = no ; then + cf_cv_x_freetype_incs= +fi + +if test "$cf_cv_x_freetype_libs" = no ; then + cf_cv_x_freetype_libs=-lXft +fi + +echo "$as_me:18854: checking if we can link with FreeType libraries" >&5 +echo $ECHO_N "checking if we can link with FreeType libraries... $ECHO_C" >&6 + +cf_save_LIBS="$LIBS" +cf_save_INCS="$CPPFLAGS" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_cv_x_freetype_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +CPPFLAGS="$CPPFLAGS $cf_cv_x_freetype_incs" + +cat >conftest.$ac_ext <<_ACEOF +#line 18879 "configure" +#include "confdefs.h" + +#include +#include +#include +int +main (void) +{ + + XftPattern *pat = XftNameParse ("name"); (void)pat + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:18895: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:18898: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:18901: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:18904: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_found_freetype=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_found_freetype=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +echo "$as_me:18913: result: $cf_cv_found_freetype" >&5 +echo "${ECHO_T}$cf_cv_found_freetype" >&6 + +LIBS="$cf_save_LIBS" +CPPFLAGS="$cf_save_INCS" + +if test "$cf_cv_found_freetype" = yes ; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_cv_x_freetype_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_x_freetype_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cat >>confdefs.h <<\EOF +#define XRENDERFONT 1 +EOF + +for ac_func in \ + XftDrawCharSpec \ + XftDrawSetClip \ + XftDrawSetClipRectangles \ + +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:19046: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 19052 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:19083: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:19086: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:19089: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:19092: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:19102: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo "$as_me: WARNING: No libraries found for FreeType" >&2;} + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + +# FIXME: revisit this if needed + +if test "$cf_cv_found_freetype" = yes ; then +echo "$as_me:19121: checking for usable Xft/fontconfig package" >&5 +echo $ECHO_N "checking for usable Xft/fontconfig package... $ECHO_C" >&6 +if test "${cf_cv_xft_compat+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 19128 "configure" +#include "confdefs.h" + +#include + +int +main (void) +{ + + XftPattern *pat = 0; + XftPatternBuild(pat, + XFT_FAMILY, XftTypeString, "mono", + (void *) 0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:19147: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:19150: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:19153: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:19156: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xft_compat=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xft_compat=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +fi +echo "$as_me:19167: result: $cf_cv_xft_compat" >&5 +echo "${ECHO_T}$cf_cv_xft_compat" >&6 + +if test "$cf_cv_xft_compat" = no +then + # workaround for broken ".pc" files used for Xft. + case "$cf_cv_x_freetype_libs" in + (*-lfontconfig*) + ;; + (*) + test -n "$verbose" && echo " work around broken package" 1>&6 + +echo "${as_me:-configure}:19179: testing work around broken package ..." 1>&5 + + cf_save_fontconfig="$LIBS" + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists fontconfig; then + test -n "$verbose" && echo " found package fontconfig" 1>&6 + +echo "${as_me:-configure}:19186: testing found package fontconfig ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags fontconfig 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs fontconfig 2>/dev/null`" + test -n "$verbose" && echo " package fontconfig CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:19192: testing package fontconfig CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package fontconfig LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:19196: testing package fontconfig LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + LIBS="$cf_save_fontconfig" + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:19414: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXft %-lXft $cf_pkgconfig_libs %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:19419: testing ...after $LIBS ..." 1>&5 + +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +test -n "$verbose" && echo " ...before $LIBS" 1>&6 + +echo "${as_me:-configure}:19427: testing ...before $LIBS ..." 1>&5 + +LIBS=`echo "$LIBS" | sed -e "s/[ ][ ]*/ /g" -e "s%-lXft %-lXft -lfontconfig %" -e 's% % %g'` +test -n "$verbose" && echo " ...after $LIBS" 1>&6 + +echo "${as_me:-configure}:19432: testing ...after $LIBS ..." 1>&5 + +fi + + ;; + esac +fi +fi + +else + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + +echo "$as_me:19445: checking if you want support for HP-style function keys" >&5 +echo $ECHO_N "checking if you want support for HP-style function keys... $ECHO_C" >&6 + +# Check whether --enable-hp-fkeys or --disable-hp-fkeys was given. +if test "${enable_hp_fkeys+set}" = set; then + enableval="$enable_hp_fkeys" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_hp_fkeys=yes + else + enable_hp_fkeys=no + fi +else + enableval=no + enable_hp_fkeys=no + +fi; +echo "$as_me:19462: result: $enable_hp_fkeys" >&5 +echo "${ECHO_T}$enable_hp_fkeys" >&6 +if test "$enable_hp_fkeys" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_HP_FUNC_KEYS 1 +EOF + +fi + +echo "$as_me:19472: checking if you want support for SCO-style function keys" >&5 +echo $ECHO_N "checking if you want support for SCO-style function keys... $ECHO_C" >&6 + +# Check whether --enable-sco-fkeys or --disable-sco-fkeys was given. +if test "${enable_sco_fkeys+set}" = set; then + enableval="$enable_sco_fkeys" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_sco_fkeys=yes + else + enable_sco_fkeys=no + fi +else + enableval=no + enable_sco_fkeys=no + +fi; +echo "$as_me:19489: result: $enable_sco_fkeys" >&5 +echo "${ECHO_T}$enable_sco_fkeys" >&6 +if test "$enable_sco_fkeys" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_SCO_FUNC_KEYS 1 +EOF + +fi + +echo "$as_me:19499: checking if you want support for Sun-style function keys" >&5 +echo $ECHO_N "checking if you want support for Sun-style function keys... $ECHO_C" >&6 + +# Check whether --enable-sun-fkeys or --disable-sun-fkeys was given. +if test "${enable_sun_fkeys+set}" = set; then + enableval="$enable_sun_fkeys" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_sun_fkeys=no + else + enable_sun_fkeys=yes + fi +else + enableval=yes + enable_sun_fkeys=yes + +fi; +echo "$as_me:19516: result: $enable_sun_fkeys" >&5 +echo "${ECHO_T}$enable_sun_fkeys" >&6 +if test "$enable_sun_fkeys" = no ; then + +cat >>confdefs.h <<\EOF +#define OPT_SUN_FUNC_KEYS 0 +EOF + +fi + +echo "$as_me:19526: checking if you want saved-lines stored as a FIFO" >&5 +echo $ECHO_N "checking if you want saved-lines stored as a FIFO... $ECHO_C" >&6 + +# Check whether --enable-fifo-lines or --disable-fifo-lines was given. +if test "${enable_fifo_lines+set}" = set; then + enableval="$enable_fifo_lines" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_fifo_lines=no + else + enable_fifo_lines=yes + fi +else + enableval=yes + enable_fifo_lines=yes + +fi; +echo "$as_me:19543: result: $enable_fifo_lines" >&5 +echo "${ECHO_T}$enable_fifo_lines" >&6 +if test "$enable_fifo_lines" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_FIFO_LINES 1 +EOF + +fi + +echo "$as_me:19553: checking if you want support for internationalization" >&5 +echo $ECHO_N "checking if you want support for internationalization... $ECHO_C" >&6 + +# Check whether --enable-i18n or --disable-i18n was given. +if test "${enable_i18n+set}" = set; then + enableval="$enable_i18n" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_i18n=no + else + enable_i18n=yes + fi +else + enableval=yes + enable_i18n=yes + +fi; +echo "$as_me:19570: result: $enable_i18n" >&5 +echo "${ECHO_T}$enable_i18n" >&6 +if test "$enable_i18n" = no ; then + +cat >>confdefs.h <<\EOF +#define OPT_I18N_SUPPORT 0 +EOF + +fi + +echo "$as_me:19580: checking if you want support for initial-erase setup" >&5 +echo $ECHO_N "checking if you want support for initial-erase setup... $ECHO_C" >&6 + +# Check whether --enable-initial-erase or --disable-initial-erase was given. +if test "${enable_initial_erase+set}" = set; then + enableval="$enable_initial_erase" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_ie=no + else + enable_ie=yes + fi +else + enableval=yes + enable_ie=yes + +fi; +echo "$as_me:19597: result: $enable_ie" >&5 +echo "${ECHO_T}$enable_ie" >&6 +if test "$enable_ie" = no ; then + +cat >>confdefs.h <<\EOF +#define OPT_INITIAL_ERASE 0 +EOF + +fi + +echo "$as_me:19607: checking if you want support for input-method" >&5 +echo $ECHO_N "checking if you want support for input-method... $ECHO_C" >&6 + +# Check whether --enable-input-method or --disable-input-method was given. +if test "${enable_input_method+set}" = set; then + enableval="$enable_input_method" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_ximp=no + else + enable_ximp=$enable_i18n + fi +else + enableval=yes + enable_ximp=$enable_i18n + +fi; +echo "$as_me:19624: result: $enable_ximp" >&5 +echo "${ECHO_T}$enable_ximp" >&6 + +echo "$as_me:19627: checking if X libraries support input-method" >&5 +echo $ECHO_N "checking if X libraries support input-method... $ECHO_C" >&6 +if test "${cf_cv_input_method+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +#line 19634 "configure" +#include "confdefs.h" + +#include +#include +#include +#include +#include +#include + +int +main (void) +{ + +{ + XIM xim; + XIMStyles *xim_styles = 0; + XIMStyle input_style; + Widget w = 0; + + XSetLocaleModifiers("@im=none"); + xim = XOpenIM(XtDisplay(w), NULL, NULL, NULL); + XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); + XCloseIM(xim); + input_style = (XIMPreeditNothing | XIMStatusNothing); + (void)xim_styles; + (void)input_style; +} + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:19668: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:19671: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:19674: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:19677: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_input_method=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_input_method=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:19687: result: $cf_cv_input_method" >&5 +echo "${ECHO_T}$cf_cv_input_method" >&6 + +test "$cf_cv_input_method" = no && enable_ximp=no +if test "$enable_ximp" != no ; then + if test "$enable_i18n" = no ; then + { echo "$as_me:19693: WARNING: input-methor relies upon internationalization" >&5 +echo "$as_me: WARNING: input-methor relies upon internationalization" >&2;} + enable_ximp=no + fi +fi +if test "$enable_ximp" = no ; then + +cat >>confdefs.h <<\EOF +#define OPT_INPUT_METHOD 0 +EOF + +fi + +echo "$as_me:19706: checking if you want support for load-vt-fonts" >&5 +echo $ECHO_N "checking if you want support for load-vt-fonts... $ECHO_C" >&6 + +# Check whether --enable-load-vt-fonts or --disable-load-vt-fonts was given. +if test "${enable_load_vt_fonts+set}" = set; then + enableval="$enable_load_vt_fonts" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_load_vt_fonts=yes + else + enable_load_vt_fonts=no + fi +else + enableval=no + enable_load_vt_fonts=no + +fi; +echo "$as_me:19723: result: $enable_load_vt_fonts" >&5 +echo "${ECHO_T}$enable_load_vt_fonts" >&6 +if test "$enable_load_vt_fonts" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_LOAD_VTFONTS 1 +EOF + +fi + +echo "$as_me:19733: checking if you want support for logging" >&5 +echo $ECHO_N "checking if you want support for logging... $ECHO_C" >&6 + +# Check whether --enable-logging or --disable-logging was given. +if test "${enable_logging+set}" = set; then + enableval="$enable_logging" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_logging=yes + else + enable_logging=no + fi +else + enableval=no + enable_logging=no + +fi; +echo "$as_me:19750: result: $enable_logging" >&5 +echo "${ECHO_T}$enable_logging" >&6 +if test "$enable_logging" = yes ; then + +cat >>confdefs.h <<\EOF +#define ALLOWLOGGING 1 +EOF + + echo "$as_me:19758: checking if you want to allow logging via a pipe" >&5 +echo $ECHO_N "checking if you want to allow logging via a pipe... $ECHO_C" >&6 + +# Check whether --enable-logfile-exec or --disable-logfile-exec was given. +if test "${enable_logfile_exec+set}" = set; then + enableval="$enable_logfile_exec" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_log_exec=yes + else + enable_log_exec=no + fi +else + enableval=no + enable_log_exec=no + +fi; + echo "$as_me:19775: result: $enable_log_exec" >&5 +echo "${ECHO_T}$enable_log_exec" >&6 + if test "$enable_log_exec" = yes ; then + +cat >>confdefs.h <<\EOF +#define ALLOWLOGFILEEXEC 1 +EOF + + fi +fi + +echo "$as_me:19786: checking if you want support for iconify/maximize translations" >&5 +echo $ECHO_N "checking if you want support for iconify/maximize translations... $ECHO_C" >&6 + +# Check whether --enable-maximize or --disable-maximize was given. +if test "${enable_maximize+set}" = set; then + enableval="$enable_maximize" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_maximize=no + else + enable_maximize=yes + fi +else + enableval=yes + enable_maximize=yes + +fi; +echo "$as_me:19803: result: $enable_maximize" >&5 +echo "${ECHO_T}$enable_maximize" >&6 +test "$enable_maximize" = no && +cat >>confdefs.h <<\EOF +#define OPT_MAXIMIZE 0 +EOF + +echo "$as_me:19810: checking if you want NumLock to override keyboard tables" >&5 +echo $ECHO_N "checking if you want NumLock to override keyboard tables... $ECHO_C" >&6 + +# Check whether --enable-num-lock or --disable-num-lock was given. +if test "${enable_num_lock+set}" = set; then + enableval="$enable_num_lock" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_numlock=no + else + enable_numlock=yes + fi +else + enableval=yes + enable_numlock=yes + +fi; +echo "$as_me:19827: result: $enable_numlock" >&5 +echo "${ECHO_T}$enable_numlock" >&6 +test "$enable_numlock" = no && +cat >>confdefs.h <<\EOF +#define OPT_NUM_LOCK 0 +EOF + +echo "$as_me:19834: checking if you want support for get/set of base64 selection data" >&5 +echo $ECHO_N "checking if you want support for get/set of base64 selection data... $ECHO_C" >&6 + +# Check whether --enable-paste64 or --disable-paste64 was given. +if test "${enable_paste64+set}" = set; then + enableval="$enable_paste64" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_paste64=no + else + enable_paste64=yes + fi +else + enableval=yes + enable_paste64=yes + +fi; +echo "$as_me:19851: result: $enable_paste64" >&5 +echo "${ECHO_T}$enable_paste64" >&6 +if test "$enable_paste64" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_PASTE64 1 +EOF + +else + +cat >>confdefs.h <<\EOF +#define OPT_PASTE64 0 +EOF + +fi + +echo "$as_me:19867: checking if you want support for pty-handshaking" >&5 +echo $ECHO_N "checking if you want support for pty-handshaking... $ECHO_C" >&6 + +# Check whether --enable-pty-handshake or --disable-pty-handshake was given. +if test "${enable_pty_handshake+set}" = set; then + enableval="$enable_pty_handshake" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_pty_handshake=no + else + enable_pty_handshake=yes + fi +else + enableval=yes + enable_pty_handshake=yes + +fi; +echo "$as_me:19884: result: $enable_pty_handshake" >&5 +echo "${ECHO_T}$enable_pty_handshake" >&6 +if test "$enable_pty_handshake" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_PTY_HANDSHAKE 1 +EOF + +else + +cat >>confdefs.h <<\EOF +#define OPT_PTY_HANDSHAKE 0 +EOF + +fi + +echo "$as_me:19900: checking if you want support for mouse in readline applications" >&5 +echo $ECHO_N "checking if you want support for mouse in readline applications... $ECHO_C" >&6 + +# Check whether --enable-readline-mouse or --disable-readline-mouse was given. +if test "${enable_readline_mouse+set}" = set; then + enableval="$enable_readline_mouse" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_readline_mouse=yes + else + enable_readline_mouse=no + fi +else + enableval=no + enable_readline_mouse=no + +fi; +echo "$as_me:19917: result: $enable_readline_mouse" >&5 +echo "${ECHO_T}$enable_readline_mouse" >&6 +if test "$enable_readline_mouse" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_READLINE 1 +EOF + +fi + +echo "$as_me:19927: checking if you want support for regular-expression selections" >&5 +echo $ECHO_N "checking if you want support for regular-expression selections... $ECHO_C" >&6 + +# Check whether --enable-regex or --disable-regex was given. +if test "${enable_regex+set}" = set; then + enableval="$enable_regex" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_regex=no + else + enable_regex=yes + fi +else + enableval=yes + enable_regex=yes + +fi; +echo "$as_me:19944: result: $enable_regex" >&5 +echo "${ECHO_T}$enable_regex" >&6 +if test "$enable_regex" = yes ; then + +echo "$as_me:19948: checking if you want to use PCRE2 for regular-expressions" >&5 +echo $ECHO_N "checking if you want to use PCRE2 for regular-expressions... $ECHO_C" >&6 + +# Check whether --with-pcre2 or --without-pcre2 was given. +if test "${with_pcre2+set}" = set; then + withval="$with_pcre2" + +fi; +test -z "$with_pcre2" && with_pcre2=no +echo "$as_me:19957: result: $with_pcre2" >&5 +echo "${ECHO_T}$with_pcre2" >&6 + +if test "x$with_pcre2" != xno ; then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists libpcre2; then + test -n "$verbose" && echo " found package libpcre2" 1>&6 + +echo "${as_me:-configure}:19965: testing found package libpcre2 ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags libpcre2 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs libpcre2 2>/dev/null`" + test -n "$verbose" && echo " package libpcre2 CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:19971: testing package libpcre2 CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package libpcre2 LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:19975: testing package libpcre2 LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists libpcre; then + test -n "$verbose" && echo " found package libpcre" 1>&6 + +echo "${as_me:-configure}:20099: testing found package libpcre ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags libpcre 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs libpcre 2>/dev/null`" + test -n "$verbose" && echo " package libpcre CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:20105: testing package libpcre CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package libpcre LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:20109: testing package libpcre LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + + { { echo "$as_me:20230: error: Cannot find PCRE2 library" >&5 +echo "$as_me: error: Cannot find PCRE2 library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +cat >>confdefs.h <<\EOF +#define HAVE_LIB_PCRE2 1 +EOF + + # if pkgconfig gave no results, look for the libraries directly + case $LIBS in + (*pcre2-posix*|*pcreposix*) + ;; + (*) + echo "$as_me:20246: checking for regcomp in -lpcre2-posix" >&5 +echo $ECHO_N "checking for regcomp in -lpcre2-posix... $ECHO_C" >&6 +if test "${ac_cv_lib_pcre2_posix_regcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre2-posix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 20254 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char regcomp (); +int +main (void) +{ +regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20273: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20276: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20279: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20282: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcre2_posix_regcomp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pcre2_posix_regcomp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:20293: result: $ac_cv_lib_pcre2_posix_regcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_pcre2_posix_regcomp" >&6 +if test $ac_cv_lib_pcre2_posix_regcomp = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lpcre2-posix; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +else + echo "$as_me:20314: checking for regcomp in -lpcreposix" >&5 +echo $ECHO_N "checking for regcomp in -lpcreposix... $ECHO_C" >&6 +if test "${ac_cv_lib_pcreposix_regcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcreposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 20322 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char regcomp (); +int +main (void) +{ +regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20341: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20344: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20347: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20350: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcreposix_regcomp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pcreposix_regcomp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:20361: result: $ac_cv_lib_pcreposix_regcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_pcreposix_regcomp" >&6 +if test $ac_cv_lib_pcreposix_regcomp = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lpcreposix; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +else + { { echo "$as_me:20382: error: Cannot find PCRE2 POSIX library" >&5 +echo "$as_me: error: Cannot find PCRE2 POSIX library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + + ;; + esac + + # either way, check for the library header files + +for ac_header in pcre2posix.h pcreposix.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:20397: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 20403 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:20407: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:20413: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:20432: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to use PCRE for regular-expressions... $ECHO_C" >&6 + +# Check whether --with-pcre or --without-pcre was given. +if test "${with_pcre+set}" = set; then + withval="$with_pcre" + +fi; +test -z "$with_pcre" && with_pcre=no +echo "$as_me:20455: result: $with_pcre" >&5 +echo "${ECHO_T}$with_pcre" >&6 + +if test "$with_pcre" != no ; then + +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists libpcre; then + test -n "$verbose" && echo " found package libpcre" 1>&6 + +echo "${as_me:-configure}:20463: testing found package libpcre ..." 1>&5 + + cf_pkgconfig_incs="`$PKG_CONFIG --cflags libpcre 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs libpcre 2>/dev/null`" + test -n "$verbose" && echo " package libpcre CFLAGS: $cf_pkgconfig_incs" 1>&6 + +echo "${as_me:-configure}:20469: testing package libpcre CFLAGS: $cf_pkgconfig_incs ..." 1>&5 + + test -n "$verbose" && echo " package libpcre LIBS: $cf_pkgconfig_libs" 1>&6 + +echo "${as_me:-configure}:20473: testing package libpcre LIBS: $cf_pkgconfig_libs ..." 1>&5 + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_pkgconfig_incs +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in $cf_pkgconfig_libs; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + : +else + cf_pkgconfig_incs= + cf_pkgconfig_libs= + +echo "$as_me:20594: checking for pcre_compile in -lpcre" >&5 +echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6 +if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 20602 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pcre_compile (); +int +main (void) +{ +pcre_compile (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20621: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20624: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20627: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20630: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcre_pcre_compile=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pcre_pcre_compile=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:20641: result: $ac_cv_lib_pcre_pcre_compile" >&5 +echo "${ECHO_T}$ac_cv_lib_pcre_pcre_compile" >&6 +if test $ac_cv_lib_pcre_pcre_compile = yes; then + cat >>confdefs.h <&5 +echo "$as_me: error: Cannot find PCRE library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + +cat >>confdefs.h <<\EOF +#define HAVE_LIB_PCRE 1 +EOF + + case $LIBS in + (*pcreposix*) + ;; + (*) + echo "$as_me:20666: checking for pcreposix_regcomp in -lpcreposix" >&5 +echo $ECHO_N "checking for pcreposix_regcomp in -lpcreposix... $ECHO_C" >&6 +if test "${ac_cv_lib_pcreposix_pcreposix_regcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcreposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 20674 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pcreposix_regcomp (); +int +main (void) +{ +pcreposix_regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20693: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20696: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20699: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20702: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcreposix_pcreposix_regcomp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pcreposix_pcreposix_regcomp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:20713: result: $ac_cv_lib_pcreposix_pcreposix_regcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_pcreposix_pcreposix_regcomp" >&6 +if test $ac_cv_lib_pcreposix_pcreposix_regcomp = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_PCREPOSIX_H 1 +EOF + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lpcreposix; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +else + echo "$as_me:20738: checking for regcomp in -lpcreposix" >&5 +echo $ECHO_N "checking for regcomp in -lpcreposix... $ECHO_C" >&6 +if test "${ac_cv_lib_pcreposix_regcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcreposix $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 20746 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char regcomp (); +int +main (void) +{ +regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20765: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20768: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20771: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20774: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pcreposix_regcomp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_pcreposix_regcomp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:20785: result: $ac_cv_lib_pcreposix_regcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_pcreposix_regcomp" >&6 +if test $ac_cv_lib_pcreposix_regcomp = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_PCREPOSIX_H 1 +EOF + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lpcreposix; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +else + { { echo "$as_me:20810: error: Cannot find PCRE POSIX library" >&5 +echo "$as_me: error: Cannot find PCRE POSIX library" >&2;} + { (exit 1); exit 1; }; } +fi + +fi + + ;; + esac +fi + + if test "$with_pcre" = no ; then + +cf_regex_func=no + +cf_regex_libs="regex re" +case $host_os in +(mingw*) + cf_regex_libs="systre gnurx $cf_regex_libs" + ;; +esac + +echo "$as_me:20832: checking for regcomp" >&5 +echo $ECHO_N "checking for regcomp... $ECHO_C" >&6 +if test "${ac_cv_func_regcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 20838 "configure" +#include "confdefs.h" +#define regcomp autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef regcomp + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char regcomp (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_regcomp) || defined (__stub___regcomp) +#error found stub for regcomp +#endif + + return regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20869: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20872: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20875: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20878: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_regcomp=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_regcomp=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:20888: result: $ac_cv_func_regcomp" >&5 +echo "${ECHO_T}$ac_cv_func_regcomp" >&6 +if test $ac_cv_func_regcomp = yes; then + cf_regex_func=regcomp +else + + for cf_regex_lib in $cf_regex_libs + do + as_ac_Lib=`echo "ac_cv_lib_$cf_regex_lib''_regcomp" | $as_tr_sh` +echo "$as_me:20897: checking for regcomp in -l$cf_regex_lib" >&5 +echo $ECHO_N "checking for regcomp in -l$cf_regex_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$cf_regex_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 20905 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char regcomp (); +int +main (void) +{ +regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:20924: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:20927: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:20930: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:20933: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_Lib=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:20944: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -l$cf_regex_lib; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cf_regex_func=regcomp + break +fi + + done + +fi + +if test "$cf_regex_func" = no ; then + echo "$as_me:20973: checking for compile" >&5 +echo $ECHO_N "checking for compile... $ECHO_C" >&6 +if test "${ac_cv_func_compile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 20979 "configure" +#include "confdefs.h" +#define compile autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef compile + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char compile (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_compile) || defined (__stub___compile) +#error found stub for compile +#endif + + return compile (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:21010: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:21013: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:21016: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:21019: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_compile=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_compile=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:21029: result: $ac_cv_func_compile" >&5 +echo "${ECHO_T}$ac_cv_func_compile" >&6 +if test $ac_cv_func_compile = yes; then + cf_regex_func=compile +else + + echo "$as_me:21035: checking for compile in -lgen" >&5 +echo $ECHO_N "checking for compile in -lgen... $ECHO_C" >&6 +if test "${ac_cv_lib_gen_compile+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgen $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 21043 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char compile (); +int +main (void) +{ +compile (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:21062: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:21065: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:21068: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:21071: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gen_compile=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gen_compile=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:21082: result: $ac_cv_lib_gen_compile" >&5 +echo "${ECHO_T}$ac_cv_lib_gen_compile" >&6 +if test $ac_cv_lib_gen_compile = yes; then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lgen; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cf_regex_func=compile +fi + +fi + +fi + +if test "$cf_regex_func" = no ; then + { echo "$as_me:21110: WARNING: cannot find regular expression library" >&5 +echo "$as_me: WARNING: cannot find regular expression library" >&2;} +fi + +echo "$as_me:21114: checking for regular-expression headers" >&5 +echo $ECHO_N "checking for regular-expression headers... $ECHO_C" >&6 +if test "${cf_cv_regex_hdrs+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_regex_hdrs=no +case $cf_regex_func in +(compile) + for cf_regex_hdr in regexp.h regexpr.h + do + cat >conftest.$ac_ext <<_ACEOF +#line 21126 "configure" +#include "confdefs.h" +#include <$cf_regex_hdr> +int +main (void) +{ + + char *p = compile("", "", "", 0); + int x = step("", ""); + (void)p; + (void)x; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:21143: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:21146: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:21149: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:21152: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_regex_hdrs=$cf_regex_hdr + break + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + ;; +(*) + for cf_regex_hdr in regex.h + do + cat >conftest.$ac_ext <<_ACEOF +#line 21169 "configure" +#include "confdefs.h" +#include +#include <$cf_regex_hdr> +int +main (void) +{ + + regex_t *p = 0; + int x = regcomp(p, "", 0); + int y = regexec(p, "", 0, 0, 0); + (void)x; + (void)y; + regfree(p); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:21189: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:21192: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:21195: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:21198: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_regex_hdrs=$cf_regex_hdr + break + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + done + ;; +esac + +fi +echo "$as_me:21214: result: $cf_cv_regex_hdrs" >&5 +echo "${ECHO_T}$cf_cv_regex_hdrs" >&6 + +case $cf_cv_regex_hdrs in + (no) { echo "$as_me:21218: WARNING: no regular expression header found" >&5 +echo "$as_me: WARNING: no regular expression header found" >&2;} ;; + (regex.h) +cat >>confdefs.h <<\EOF +#define HAVE_REGEX_H_FUNCS 1 +EOF + ;; + (regexp.h) +cat >>confdefs.h <<\EOF +#define HAVE_REGEXP_H_FUNCS 1 +EOF + ;; + (regexpr.h) +cat >>confdefs.h <<\EOF +#define HAVE_REGEXPR_H_FUNCS 1 +EOF + ;; +esac + + if test "X$cf_cv_regex_hdrs" != "Xregex.h" ; then + { { echo "$as_me:21238: error: Only POSIX, PCRE, or PCRE2 regular expressions are supported" >&5 +echo "$as_me: error: Only POSIX, PCRE, or PCRE2 regular expressions are supported" >&2;} + { (exit 1); exit 1; }; } + fi + fi + fi + +cat >>confdefs.h <<\EOF +#define OPT_SELECT_REGEX 1 +EOF + +fi + +echo "$as_me:21251: checking if you want support for right-scrollbar" >&5 +echo $ECHO_N "checking if you want support for right-scrollbar... $ECHO_C" >&6 + +# Check whether --enable-rightbar or --disable-rightbar was given. +if test "${enable_rightbar+set}" = set; then + enableval="$enable_rightbar" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_rightbar=no + else + enable_rightbar=yes + fi +else + enableval=yes + enable_rightbar=yes + +fi; +echo "$as_me:21268: result: $enable_rightbar" >&5 +echo "${ECHO_T}$enable_rightbar" >&6 +if test "$enable_rightbar" = yes ; then + +cat >>confdefs.h <<\EOF +#define SCROLLBAR_RIGHT 1 +EOF + +fi + +echo "$as_me:21278: checking if you want check for redundant name-change" >&5 +echo $ECHO_N "checking if you want check for redundant name-change... $ECHO_C" >&6 + +# Check whether --enable-samename or --disable-samename was given. +if test "${enable_samename+set}" = set; then + enableval="$enable_samename" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_samename=no + else + enable_samename=yes + fi +else + enableval=yes + enable_samename=yes + +fi; +echo "$as_me:21295: result: $enable_samename" >&5 +echo "${ECHO_T}$enable_samename" >&6 +test "$enable_samename" = no && +cat >>confdefs.h <<\EOF +#define OPT_SAME_NAME 0 +EOF + +echo "$as_me:21302: checking if you want support for selection-actions" >&5 +echo $ECHO_N "checking if you want support for selection-actions... $ECHO_C" >&6 + +# Check whether --enable-selection-ops or --disable-selection-ops was given. +if test "${enable_selection_ops+set}" = set; then + enableval="$enable_selection_ops" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_selection_ops=no + else + enable_selection_ops=yes + fi +else + enableval=yes + enable_selection_ops=yes + +fi; +echo "$as_me:21319: result: $enable_selection_ops" >&5 +echo "${ECHO_T}$enable_selection_ops" >&6 +test "$enable_selection_ops" = no && +cat >>confdefs.h <<\EOF +#define OPT_SELECTION_OPS 0 +EOF + +echo "$as_me:21326: checking if you want support for session management" >&5 +echo $ECHO_N "checking if you want support for session management... $ECHO_C" >&6 + +# Check whether --enable-session-mgt or --disable-session-mgt was given. +if test "${enable_session_mgt+set}" = set; then + enableval="$enable_session_mgt" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_session_mgt=no + else + enable_session_mgt=yes + fi +else + enableval=yes + enable_session_mgt=yes + +fi; +echo "$as_me:21343: result: $enable_session_mgt" >&5 +echo "${ECHO_T}$enable_session_mgt" >&6 +test "$enable_session_mgt" = no && +cat >>confdefs.h <<\EOF +#define OPT_SESSION_MGT 0 +EOF + +echo "$as_me:21350: checking if you want to use termcap function-keys" >&5 +echo $ECHO_N "checking if you want to use termcap function-keys... $ECHO_C" >&6 + +# Check whether --enable-tcap-fkeys or --disable-tcap-fkeys was given. +if test "${enable_tcap_fkeys+set}" = set; then + enableval="$enable_tcap_fkeys" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_tcap_fkeys=no + else + enable_tcap_fkeys=yes + fi +else + enableval=yes + enable_tcap_fkeys=yes + +fi; +echo "$as_me:21367: result: $enable_tcap_fkeys" >&5 +echo "${ECHO_T}$enable_tcap_fkeys" >&6 +test "$enable_tcap_fkeys" = yes && +cat >>confdefs.h <<\EOF +#define OPT_TCAP_FKEYS 1 +EOF + +echo "$as_me:21374: checking if you want to use termcap-query/report" >&5 +echo $ECHO_N "checking if you want to use termcap-query/report... $ECHO_C" >&6 + +# Check whether --enable-tcap-query or --disable-tcap-query was given. +if test "${enable_tcap_query+set}" = set; then + enableval="$enable_tcap_query" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_tcap_query=no + else + enable_tcap_query=yes + fi +else + enableval=yes + enable_tcap_query=yes + +fi; +echo "$as_me:21391: result: $enable_tcap_query" >&5 +echo "${ECHO_T}$enable_tcap_query" >&6 +test "$enable_tcap_query" = yes && +cat >>confdefs.h <<\EOF +#define OPT_TCAP_QUERY 1 +EOF + +echo "$as_me:21398: checking if you want support for tek4014" >&5 +echo $ECHO_N "checking if you want support for tek4014... $ECHO_C" >&6 + +# Check whether --enable-tek4014 or --disable-tek4014 was given. +if test "${enable_tek4014+set}" = set; then + enableval="$enable_tek4014" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_tek4014=no + else + enable_tek4014=yes + fi +else + enableval=yes + enable_tek4014=yes + +fi; +echo "$as_me:21415: result: $enable_tek4014" >&5 +echo "${ECHO_T}$enable_tek4014" >&6 +if test "$enable_tek4014" = no ; then + +cat >>confdefs.h <<\EOF +#define OPT_TEK4014 0 +EOF + +else + EXTRAHDRS="$EXTRAHDRS Tekparse.h" + EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c" + EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o" +fi + +echo "$as_me:21429: checking if you want pulldown menus with a toolbar" >&5 +echo $ECHO_N "checking if you want pulldown menus with a toolbar... $ECHO_C" >&6 + +# Check whether --enable-toolbar or --disable-toolbar was given. +if test "${enable_toolbar+set}" = set; then + enableval="$enable_toolbar" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_toolbar=yes + else + enable_toolbar=no + fi +else + enableval=no + enable_toolbar=no + +fi; +echo "$as_me:21446: result: $enable_toolbar" >&5 +echo "${ECHO_T}$enable_toolbar" >&6 +if test "$enable_toolbar" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_TOOLBAR 1 +EOF + +fi + +echo "$as_me:21456: checking if you want VT52 emulation" >&5 +echo $ECHO_N "checking if you want VT52 emulation... $ECHO_C" >&6 + +# Check whether --enable-vt52 or --disable-vt52 was given. +if test "${enable_vt52+set}" = set; then + enableval="$enable_vt52" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_vt52=no + else + enable_vt52=yes + fi +else + enableval=yes + enable_vt52=yes + +fi; +echo "$as_me:21473: result: $enable_vt52" >&5 +echo "${ECHO_T}$enable_vt52" >&6 +test "$enable_vt52" = no && +cat >>confdefs.h <<\EOF +#define OPT_VT52_MODE 0 +EOF + +echo "$as_me:21480: checking if you want wide-attribute support" >&5 +echo $ECHO_N "checking if you want wide-attribute support... $ECHO_C" >&6 + +# Check whether --enable-wide-attrs or --disable-wide-attrs was given. +if test "${enable_wide_attrs+set}" = set; then + enableval="$enable_wide_attrs" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_wattr=no + else + enable_wattr=yes + fi +else + enableval=yes + enable_wattr=yes + +fi; +echo "$as_me:21497: result: $enable_wattr" >&5 +echo "${ECHO_T}$enable_wattr" >&6 + +if test x$enable_wattr = xno && test x$enable_direct_color = xyes ; then + { echo "$as_me:21501: WARNING: overriding wide-attributes to support direct color" >&5 +echo "$as_me: WARNING: overriding wide-attributes to support direct color" >&2;} + enable_wattr=yes +fi + +echo "$as_me:21506: checking if you want wide-character support" >&5 +echo $ECHO_N "checking if you want wide-character support... $ECHO_C" >&6 + +# Check whether --enable-wide-chars or --disable-wide-chars was given. +if test "${enable_wide_chars+set}" = set; then + enableval="$enable_wide_chars" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_wchar=no + else + enable_wchar=yes + fi +else + enableval=yes + enable_wchar=yes + +fi; +echo "$as_me:21523: result: $enable_wchar" >&5 +echo "${ECHO_T}$enable_wchar" >&6 +test "x$enable_wattr" = xno && +cat >>confdefs.h <<\EOF +#define OPT_WIDE_ATTRS 0 +EOF + +echo "$as_me:21530: checking if you want only 16-bit character support" >&5 +echo $ECHO_N "checking if you want only 16-bit character support... $ECHO_C" >&6 + +# Check whether --enable-16bit-chars or --disable-16bit-chars was given. +if test "${enable_16bit_chars+set}" = set; then + enableval="$enable_16bit_chars" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_16bit_chars=yes + else + enable_16bit_chars=no + fi +else + enableval=no + enable_16bit_chars=no + +fi; +echo "$as_me:21547: result: $enable_16bit_chars" >&5 +echo "${ECHO_T}$enable_16bit_chars" >&6 + +if test "$enable_16bit_chars" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_WIDER_ICHAR 0 +EOF + + enable_wchar=yes +fi + +if test "$enable_wchar" = yes ; then + +echo "$as_me:21561: checking if you want to use mini-luit/Latin9 built-in support" >&5 +echo $ECHO_N "checking if you want to use mini-luit/Latin9 built-in support... $ECHO_C" >&6 + +# Check whether --enable-mini-luit or --disable-mini-luit was given. +if test "${enable_mini_luit+set}" = set; then + enableval="$enable_mini_luit" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_mini_luit=yes + else + enable_mini_luit=no + fi +else + enableval=no + enable_mini_luit=no + +fi; +echo "$as_me:21578: result: $enable_mini_luit" >&5 +echo "${ECHO_T}$enable_mini_luit" >&6 +if test "$enable_mini_luit" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_MINI_LUIT 1 +EOF + +fi + +echo "$as_me:21588: checking if you want to use luit" >&5 +echo $ECHO_N "checking if you want to use luit... $ECHO_C" >&6 + +# Check whether --enable-luit or --disable-luit was given. +if test "${enable_luit+set}" = set; then + enableval="$enable_luit" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_luit=no + else + enable_luit=yes + fi +else + enableval=yes + enable_luit=yes + +fi; +echo "$as_me:21605: result: $enable_luit" >&5 +echo "${ECHO_T}$enable_luit" >&6 +if test "$enable_luit" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_LUIT_PROG 1 +EOF + +test -z "$LUIT" && LUIT=xterm-filter +for ac_prog in $LUIT xterm-filter bluit luit +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:21618: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_LUIT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $LUIT in + [\\/]* | ?:[\\/]*) + ac_cv_path_LUIT="$LUIT" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_LUIT="$ac_dir/$ac_word" + echo "$as_me:21635: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +LUIT=$ac_cv_path_LUIT + +if test -n "$LUIT"; then + echo "$as_me:21646: result: $LUIT" >&5 +echo "${ECHO_T}$LUIT" >&6 +else + echo "$as_me:21649: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LUIT" && break +done +test -n "$LUIT" || LUIT="$LUIT" + +cf_path_prog="" +cf_path_args="" +IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR" +for cf_temp in $ac_cv_path_LUIT +do + if test -z "$cf_path_prog" ; then + if test "$with_full_paths" = yes ; then + +if test "x$prefix" != xNONE; then + cf_path_syntax="$prefix" +else + cf_path_syntax="$ac_default_prefix" +fi + +case ".$cf_temp" in +(.\$\(*\)*|.\'*\'*) + ;; +(..|./*|.\\*) + ;; +(.[a-zA-Z]:[\\/]*) # OS/2 EMX + ;; +(.\${*prefix}*|.\${*dir}*) + eval cf_temp="$cf_temp" + case ".$cf_temp" in + (.NONE/*) + cf_temp=`echo $cf_temp | sed -e s%NONE%$cf_path_syntax%` + ;; + esac + ;; +(.no|.NONE/*) + cf_temp=`echo $cf_temp | sed -e s%NONE%$cf_path_syntax%` + ;; +(*) + break + ;; +esac + + cf_path_prog="$cf_temp" + else + cf_path_prog="`basename $cf_temp`" + fi + elif test -z "$cf_path_args" ; then + cf_path_args="$cf_temp" + else + cf_path_args="$cf_path_args $cf_temp" + fi +done +IFS="$cf_save_ifs" + +if test -n "$cf_path_prog" ; then + +echo "${as_me:-configure}:21708: testing defining path for ${cf_path_prog} ..." 1>&5 + +cat >>confdefs.h <>confdefs.h <>confdefs.h <<\EOF +#define OPT_WIDE_CHARS 1 +EOF + + EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" + EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c" + EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o" +fi + +echo "$as_me:21732: checking if you want dynamic-abbreviation support" >&5 +echo $ECHO_N "checking if you want dynamic-abbreviation support... $ECHO_C" >&6 + +# Check whether --enable-dabbrev or --disable-dabbrev was given. +if test "${enable_dabbrev+set}" = set; then + enableval="$enable_dabbrev" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_dabbrev=yes + else + enable_dabbrev=no + fi +else + enableval=no + enable_dabbrev=no + +fi; +echo "$as_me:21749: result: $enable_dabbrev" >&5 +echo "${ECHO_T}$enable_dabbrev" >&6 +if test "$enable_dabbrev" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_DABBREV 1 +EOF + +fi + +echo "$as_me:21759: checking if you want DECterm Locator support" >&5 +echo $ECHO_N "checking if you want DECterm Locator support... $ECHO_C" >&6 + +# Check whether --enable-dec-locator or --disable-dec-locator was given. +if test "${enable_dec_locator+set}" = set; then + enableval="$enable_dec_locator" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_dec_locator=yes + else + enable_dec_locator=no + fi +else + enableval=no + enable_dec_locator=no + +fi; +echo "$as_me:21776: result: $enable_dec_locator" >&5 +echo "${ECHO_T}$enable_dec_locator" >&6 +if test "$enable_dec_locator" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_DEC_LOCATOR 1 +EOF + +fi + +echo "$as_me:21786: checking if you want XHTML and SVG screen dump support" >&5 +echo $ECHO_N "checking if you want XHTML and SVG screen dump support... $ECHO_C" >&6 + +# Check whether --enable-screen-dumps or --disable-screen-dumps was given. +if test "${enable_screen_dumps+set}" = set; then + enableval="$enable_screen_dumps" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_screen_dumps=no + else + enable_screen_dumps=yes + fi +else + enableval=yes + enable_screen_dumps=yes + +fi; +echo "$as_me:21803: result: $enable_screen_dumps" >&5 +echo "${ECHO_T}$enable_screen_dumps" >&6 +if test "$enable_screen_dumps" = yes ; then + EXTRASRCS="$EXTRASRCS html.c svg.c" + EXTRAOBJS="$EXTRAOBJS html.o svg.o" +else + +cat >>confdefs.h <<\EOF +#define OPT_SCREEN_DUMPS 0 +EOF + +fi + +echo "$as_me:21816: checking if you want ReGIS graphics support" >&5 +echo $ECHO_N "checking if you want ReGIS graphics support... $ECHO_C" >&6 + +# Check whether --enable-regis-graphics or --disable-regis-graphics was given. +if test "${enable_regis_graphics+set}" = set; then + enableval="$enable_regis_graphics" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_regis_graphics=yes + else + enable_regis_graphics=no + fi +else + enableval=no + enable_regis_graphics=no + +fi; +echo "$as_me:21833: result: $enable_regis_graphics" >&5 +echo "${ECHO_T}$enable_regis_graphics" >&6 +if test "$enable_regis_graphics" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_REGIS_GRAPHICS 1 +EOF + + EXTRAHDRS="$EXTRAHDRS graphics_regis.h" + EXTRASRCS="$EXTRASRCS graphics_regis.c" + EXTRAOBJS="$EXTRAOBJS graphics_regis.o" + +echo "$as_me:21845: checking if -lm needed for math functions" >&5 +echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6 +if test "${cf_cv_need_libm+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 21852 "configure" +#include "confdefs.h" + + #include + #include + #include + +int +main (void) +{ +double x = rand(); printf("result = %g\n", sin(x)) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:21868: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:21871: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:21874: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:21877: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_need_libm=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_need_libm=yes +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:21887: result: $cf_cv_need_libm" >&5 +echo "${ECHO_T}$cf_cv_need_libm" >&6 +if test "$cf_cv_need_libm" = yes +then + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in -lm; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + +fi + +fi + +echo "$as_me:21912: checking if you want sixel graphics support" >&5 +echo $ECHO_N "checking if you want sixel graphics support... $ECHO_C" >&6 + +# Check whether --enable-sixel-graphics or --disable-sixel-graphics was given. +if test "${enable_sixel_graphics+set}" = set; then + enableval="$enable_sixel_graphics" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_sixel_graphics=no + else + enable_sixel_graphics=yes + fi +else + enableval=yes + enable_sixel_graphics=yes + +fi; +echo "$as_me:21929: result: $enable_sixel_graphics" >&5 +echo "${ECHO_T}$enable_sixel_graphics" >&6 +if test "$enable_sixel_graphics" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_SIXEL_GRAPHICS 1 +EOF + + EXTRAHDRS="$EXTRAHDRS graphics_sixel.h" + EXTRASRCS="$EXTRASRCS graphics_sixel.c" + EXTRAOBJS="$EXTRAOBJS graphics_sixel.o" +fi + +if test "$enable_regis_graphics" = yes || test "$enable_sixel_graphics" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_GRAPHICS 1 +EOF + + EXTRAHDRS="$EXTRAHDRS graphics.h" + EXTRASRCS="$EXTRASRCS graphics.c" + EXTRAOBJS="$EXTRAOBJS graphics.o" +fi + +echo "$as_me:21953: checking if you want VT420 rectangle support" >&5 +echo $ECHO_N "checking if you want VT420 rectangle support... $ECHO_C" >&6 + +# Check whether --enable-rectangles or --disable-rectangles was given. +if test "${enable_rectangles+set}" = set; then + enableval="$enable_rectangles" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_rectangles=no + else + enable_rectangles=yes + fi +else + enableval=yes + enable_rectangles=yes + +fi; +echo "$as_me:21970: result: $enable_rectangles" >&5 +echo "${ECHO_T}$enable_rectangles" >&6 +if test "$enable_rectangles" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_DEC_RECTOPS 1 +EOF + +fi + +echo "$as_me:21980: checking if you want -ziconbeep option" >&5 +echo $ECHO_N "checking if you want -ziconbeep option... $ECHO_C" >&6 + +# Check whether --enable-ziconbeep or --disable-ziconbeep was given. +if test "${enable_ziconbeep+set}" = set; then + enableval="$enable_ziconbeep" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_ziconbeep=no + else + enable_ziconbeep=yes + fi +else + enableval=yes + enable_ziconbeep=yes + +fi; +echo "$as_me:21997: result: $enable_ziconbeep" >&5 +echo "${ECHO_T}$enable_ziconbeep" >&6 +test "$enable_ziconbeep" = no && +cat >>confdefs.h <<\EOF +#define OPT_ZICONBEEP 0 +EOF + +############################################################################### + +echo "$as_me:22006: checking if you want debugging traces" >&5 +echo $ECHO_N "checking if you want debugging traces... $ECHO_C" >&6 + +# Check whether --enable-trace or --disable-trace was given. +if test "${enable_trace+set}" = set; then + enableval="$enable_trace" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_trace=yes + else + enable_trace=no + fi +else + enableval=no + enable_trace=no + +fi; +echo "$as_me:22023: result: $enable_trace" >&5 +echo "${ECHO_T}$enable_trace" >&6 +if test "$enable_trace" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_TRACE 1 +EOF + + EXTRASRCS="$EXTRASRCS trace.c" + EXTRAOBJS="$EXTRAOBJS trace.o" +fi + +echo "$as_me:22035: checking if you want to use dmalloc for testing" >&5 +echo $ECHO_N "checking if you want to use dmalloc for testing... $ECHO_C" >&6 + +# Check whether --with-dmalloc or --without-dmalloc was given. +if test "${with_dmalloc+set}" = set; then + withval="$with_dmalloc" + +cat >>confdefs.h <&5 +echo "${ECHO_T}${with_dmalloc:-no}" >&6 + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + ;; + esac + ;; +esac + +if test "$with_dmalloc" = yes ; then + echo "$as_me:22166: checking for dmalloc.h" >&5 +echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 22172 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:22176: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:22182: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:22201: result: $ac_cv_header_dmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 +if test $ac_cv_header_dmalloc_h = yes; then + +echo "$as_me:22205: checking for dmalloc_debug in -ldmalloc" >&5 +echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 22213 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dmalloc_debug (); +int +main (void) +{ +dmalloc_debug (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:22232: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:22235: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:22238: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:22241: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dmalloc_dmalloc_debug=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dmalloc_dmalloc_debug=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:22252: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 +if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to use dbmalloc for testing... $ECHO_C" >&6 + +# Check whether --with-dbmalloc or --without-dbmalloc was given. +if test "${with_dbmalloc+set}" = set; then + withval="$with_dbmalloc" + +cat >>confdefs.h <&5 +echo "${ECHO_T}${with_dbmalloc:-no}" >&6 + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + ;; + esac + ;; +esac + +if test "$with_dbmalloc" = yes ; then + echo "$as_me:22398: checking for dbmalloc.h" >&5 +echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dbmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 22404 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:22408: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:22414: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dbmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dbmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:22433: result: $ac_cv_header_dbmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 +if test $ac_cv_header_dbmalloc_h = yes; then + +echo "$as_me:22437: checking for debug_malloc in -ldbmalloc" >&5 +echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 +if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldbmalloc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 22445 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char debug_malloc (); +int +main (void) +{ +debug_malloc (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:22464: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:22467: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:22470: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:22473: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dbmalloc_debug_malloc=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dbmalloc_debug_malloc=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:22484: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 +if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to use valgrind for testing... $ECHO_C" >&6 + +# Check whether --with-valgrind or --without-valgrind was given. +if test "${with_valgrind+set}" = set; then + withval="$with_valgrind" + +cat >>confdefs.h <&5 +echo "${ECHO_T}${with_valgrind:-no}" >&6 + +case .$with_cflags in +(.*-g*) + case .$CFLAGS in + (.*-g*) + ;; + (*) + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in -g +do +case $cf_fix_cppflags in +(no) + case $cf_add_cflags in + (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) + case $cf_add_cflags in + (-D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + continue + fi + ;; + esac + case "$CPPFLAGS" in + (*$cf_add_cflags) + ;; + (*) + case $cf_add_cflags in + (-D*) + cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` + +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]'"$cf_tst_cppflags"'\(=[^ ]*\)\?$//g'` + + ;; + esac + + test -n "$cf_new_cppflags" && cf_new_cppflags="$cf_new_cppflags " + cf_new_cppflags="${cf_new_cppflags}$cf_add_cflags" + + ;; + esac + ;; + (*) + + test -n "$cf_new_cflags" && cf_new_cflags="$cf_new_cflags " + cf_new_cflags="${cf_new_cflags}$cf_add_cflags" + + ;; + esac + ;; +(yes) + + test -n "$cf_new_extra_cppflags" && cf_new_extra_cppflags="$cf_new_extra_cppflags " + cf_new_extra_cppflags="${cf_new_extra_cppflags}$cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + test -n "$CFLAGS" && CFLAGS="$CFLAGS " + CFLAGS="${CFLAGS}$cf_new_cflags" + +fi + +if test -n "$cf_new_cppflags" ; then + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}$cf_new_cppflags" + +fi + +if test -n "$cf_new_extra_cppflags" ; then + + test -n "$EXTRA_CPPFLAGS" && EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS " + EXTRA_CPPFLAGS="${EXTRA_CPPFLAGS}$cf_new_extra_cppflags" + +fi + + ;; + esac + ;; +esac + +echo "$as_me:22629: checking if you want to perform memory-leak testing" >&5 +echo $ECHO_N "checking if you want to perform memory-leak testing... $ECHO_C" >&6 + +# Check whether --enable-leaks or --disable-leaks was given. +if test "${enable_leaks+set}" = set; then + enableval="$enable_leaks" + if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi +else + : ${with_no_leaks:=no} +fi; +echo "$as_me:22639: result: $with_no_leaks" >&5 +echo "${ECHO_T}$with_no_leaks" >&6 + +if test "$with_no_leaks" = yes ; then + +cat >>confdefs.h <<\EOF +#define NO_LEAKS 1 +EOF + +cat >>confdefs.h <<\EOF +#define YY_NO_LEAKS 1 +EOF + +fi + +echo "$as_me:22654: checking if you want to see long compiling messages" >&5 +echo $ECHO_N "checking if you want to see long compiling messages... $ECHO_C" >&6 + +# Check whether --enable-echo or --disable-echo was given. +if test "${enable_echo+set}" = set; then + enableval="$enable_echo" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + + ECHO_LT='--silent' + ECHO_LD='@echo linking $@;' + RULE_CC='@echo compiling $<' + SHOW_CC='@echo compiling $@' + ECHO_CC='@' + + else + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + + fi +else + enableval=yes + + ECHO_LT='' + ECHO_LD='' + RULE_CC='' + SHOW_CC='' + ECHO_CC='' + +fi; +echo "$as_me:22688: result: $enableval" >&5 +echo "${ECHO_T}$enableval" >&6 + +echo "$as_me:22691: checking if you want magic cookie emulation" >&5 +echo $ECHO_N "checking if you want magic cookie emulation... $ECHO_C" >&6 + +# Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. +if test "${enable_xmc_glitch+set}" = set; then + enableval="$enable_xmc_glitch" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + enable_xmc=yes + else + enable_xmc=no + fi +else + enableval=no + enable_xmc=no + +fi; +echo "$as_me:22708: result: $enable_xmc" >&5 +echo "${ECHO_T}$enable_xmc" >&6 +if test "$enable_xmc" = yes ; then + +cat >>confdefs.h <<\EOF +#define OPT_XMC_GLITCH 1 +EOF + + EXTRASRCS="$EXTRASRCS testxmc.c" + EXTRAOBJS="$EXTRAOBJS testxmc.o" +fi + +for ac_func in tigetstr +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:22723: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 22729 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:22760: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:22763: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:22766: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:22769: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:22779: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 22800 "configure" +#include "confdefs.h" +#define $ac_func autoconf_temporary +#include /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $ac_func + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (void); + +int +main (void) +{ + +/* The GNU C library defines stubs for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#error found stub for $ac_func +#endif + + return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:22831: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:22834: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:22837: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:22840: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:22850: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking if you want to turn on gcc warnings... $ECHO_C" >&6 + +# Check whether --enable-warnings or --disable-warnings was given. +if test "${enable_warnings+set}" = set; then + enableval="$enable_warnings" + test "$enableval" != yes && enableval=no + if test "$enableval" != "no" ; then + with_warnings=yes + else + with_warnings=no + fi +else + enableval=no + with_warnings=no + +fi; +echo "$as_me:22880: result: $with_warnings" >&5 +echo "${ECHO_T}$with_warnings" >&6 +if test "$with_warnings" = yes +then + +if test "$GCC" = yes +then +cat > conftest.i <&5 +echo "$as_me: checking for $CC __attribute__ directives..." >&6;} +cat > conftest.$ac_ext <&5 + + case $cf_attribute in + (printf) + cf_printf_attribute=yes + cat >conftest.h <conftest.h <conftest.h <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:22958: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:22960: result: ... $cf_attribute" >&5 +echo "${ECHO_T}... $cf_attribute" >&6 + cat conftest.h >>confdefs.h + case $cf_attribute in + (noreturn) + +cat >>confdefs.h <>confdefs.h <<\EOF +#define GCC_PRINTF 1 +EOF + + fi + +cat >>confdefs.h <>confdefs.h <<\EOF +#define GCC_SCANF 1 +EOF + + fi + +cat >>confdefs.h <>confdefs.h <>confdefs.h +fi +rm -rf conftest* +fi + +if test "x$have_x" = xyes; then + +cf_save_LIBS_CF_CONST_X_STRING="$LIBS" +cf_save_CFLAGS_CF_CONST_X_STRING="$CFLAGS" +cf_save_CPPFLAGS_CF_CONST_X_STRING="$CPPFLAGS" +LIBS="$LIBS ${X_PRE_LIBS} ${X_LIBS} ${X_EXTRA_LIBS}" +for cf_X_CFLAGS in $X_CFLAGS +do + case "x$cf_X_CFLAGS" in + x-[IUD]*) + CPPFLAGS="$CPPFLAGS $cf_X_CFLAGS" + ;; + *) + CFLAGS="$CFLAGS $cf_X_CFLAGS" + ;; + esac +done + +cat >conftest.$ac_ext <<_ACEOF +#line 23038 "configure" +#include "confdefs.h" + +#include +#include + +int +main (void) +{ +String foo = malloc(1); (void)foo + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:23053: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:23056: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:23059: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:23062: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + +echo "$as_me:23065: checking for X11/Xt const-feature" >&5 +echo $ECHO_N "checking for X11/Xt const-feature... $ECHO_C" >&6 +if test "${cf_cv_const_x_string+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 23072 "configure" +#include "confdefs.h" + +#define _CONST_X_STRING /* X11R7.8 (perhaps) */ +#undef XTSTRINGDEFINES /* X11R5 and later */ +#include +#include + +int +main (void) +{ +String foo = malloc(1); *foo = 0 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:23089: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:23092: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:23095: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:23098: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cf_cv_const_x_string=no + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + cf_cv_const_x_string=yes + +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:23113: result: $cf_cv_const_x_string" >&5 +echo "${ECHO_T}$cf_cv_const_x_string" >&6 + +LIBS="$cf_save_LIBS_CF_CONST_X_STRING" +CFLAGS="$cf_save_CFLAGS_CF_CONST_X_STRING" +CPPFLAGS="$cf_save_CPPFLAGS_CF_CONST_X_STRING" + +case $cf_cv_const_x_string in +(no) + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-DXTSTRINGDEFINES" + + ;; +(*) + + test -n "$CPPFLAGS" && CPPFLAGS="$CPPFLAGS " + CPPFLAGS="${CPPFLAGS}-D_CONST_X_STRING" + + ;; +esac + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi +cat > conftest.$ac_ext <&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-Wall" + for cf_opt in \ + wd1419 \ + wd1683 \ + wd1684 \ + wd193 \ + wd593 \ + wd279 \ + wd810 \ + wd869 \ + wd981 + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:23174: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:23177: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:23179: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" +elif test "$GCC" = yes && test "$GCC_VERSION" != "unknown" +then + { echo "$as_me:23187: checking for $CC warning options..." >&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS= + cf_warn_CONST="" + test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings" + cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs" + test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings= + for cf_opt in W Wall \ + Wbad-function-cast \ + Wcast-align \ + Wcast-qual \ + Wdeclaration-after-statement \ + Wextra \ + Winline \ + Wmissing-declarations \ + Wmissing-prototypes \ + Wnested-externs \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes \ + Wundef Wno-inline $cf_gcc_warnings $cf_warn_CONST Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum Wno-cast-qual + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:23211: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:23214: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:23216: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + case $cf_opt in + (Winline) + case $GCC_VERSION in + ([34].*) + test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 + +echo "${as_me:-configure}:23224: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 + + continue;; + esac + ;; + (Wpointer-arith) + case $GCC_VERSION in + ([12].*) + test -n "$verbose" && echo " feature is broken in gcc $GCC_VERSION" 1>&6 + +echo "${as_me:-configure}:23234: testing feature is broken in gcc $GCC_VERSION ..." 1>&5 + + continue;; + esac + ;; + esac + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" +fi +rm -rf conftest* + +fi +fi + +test "$disable_setuid" = yes && +cat >>confdefs.h <<\EOF +#define DISABLE_SETUID 1 +EOF + +test "$disable_setgid" = yes && +cat >>confdefs.h <<\EOF +#define DISABLE_SETGID 1 +EOF + +if test $disable_setuid = yes ; then + MAY_SETUID="#" + NOT_SETUID= +elif test $disable_setgid = yes ; then + MAY_SETUID="#" + NOT_SETUID= +else + MAY_SETUID= + NOT_SETUID="#" +fi + +### remove from CPPFLAGS the optional features we define in xtermcfg.h +### or other conflicting symbols that may be defined via imake: +for cf_def in \ + __STDC__ \ + ALLOWLOGGING \ + ALLOWLOGFILEEXEC \ + OPT_LUIT_PROG \ + OPT_WIDE_CHARS \ + SCROLLBAR_RIGHT \ + USE_TTY_GROUP \ + USE_UTEMPTER \ + XRENDERFONT +do + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//` +done + +echo "$as_me:23287: checking if filesystem supports mixed-case filenames" >&5 +echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 +if test "${cf_cv_mixedcase+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +if test "$cross_compiling" = yes ; then + case $target_alias in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) + cf_cv_mixedcase=no + ;; + (*) + cf_cv_mixedcase=yes + ;; + esac +else + rm -f conftest CONFTEST + echo test >conftest + if test -f CONFTEST ; then + cf_cv_mixedcase=no + else + cf_cv_mixedcase=yes + fi + rm -f conftest CONFTEST +fi + +fi +echo "$as_me:23314: result: $cf_cv_mixedcase" >&5 +echo "${ECHO_T}$cf_cv_mixedcase" >&6 +test "$cf_cv_mixedcase" = yes && +cat >>confdefs.h <<\EOF +#define MIXEDCASE_FILENAMES 1 +EOF + +for ac_prog in exctags ctags +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:23325: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CTAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CTAGS"; then + ac_cv_prog_CTAGS="$CTAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CTAGS="$ac_prog" +echo "$as_me:23340: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CTAGS=$ac_cv_prog_CTAGS +if test -n "$CTAGS"; then + echo "$as_me:23348: result: $CTAGS" >&5 +echo "${ECHO_T}$CTAGS" >&6 +else + echo "$as_me:23351: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CTAGS" && break +done + +for ac_prog in exetags etags +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:23362: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ETAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ETAGS"; then + ac_cv_prog_ETAGS="$ETAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ETAGS="$ac_prog" +echo "$as_me:23377: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ETAGS=$ac_cv_prog_ETAGS +if test -n "$ETAGS"; then + echo "$as_me:23385: result: $ETAGS" >&5 +echo "${ECHO_T}$ETAGS" >&6 +else + echo "$as_me:23388: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ETAGS" && break +done + +# Extract the first word of "${CTAGS:-ctags}", so it can be a program name with args. +set dummy ${CTAGS:-ctags}; ac_word=$2 +echo "$as_me:23397: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MAKE_LOWER_TAGS"; then + ac_cv_prog_MAKE_LOWER_TAGS="$MAKE_LOWER_TAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_MAKE_LOWER_TAGS="yes" +echo "$as_me:23412: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_MAKE_LOWER_TAGS" && ac_cv_prog_MAKE_LOWER_TAGS="no" +fi +fi +MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS +if test -n "$MAKE_LOWER_TAGS"; then + echo "$as_me:23421: result: $MAKE_LOWER_TAGS" >&5 +echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 +else + echo "$as_me:23424: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$cf_cv_mixedcase" = yes ; then + # Extract the first word of "${ETAGS:-etags}", so it can be a program name with args. +set dummy ${ETAGS:-etags}; ac_word=$2 +echo "$as_me:23431: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$MAKE_UPPER_TAGS"; then + ac_cv_prog_MAKE_UPPER_TAGS="$MAKE_UPPER_TAGS" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_MAKE_UPPER_TAGS="yes" +echo "$as_me:23446: found $ac_dir/$ac_word" >&5 +break +done + + test -z "$ac_cv_prog_MAKE_UPPER_TAGS" && ac_cv_prog_MAKE_UPPER_TAGS="no" +fi +fi +MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS +if test -n "$MAKE_UPPER_TAGS"; then + echo "$as_me:23455: result: $MAKE_UPPER_TAGS" >&5 +echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 +else + echo "$as_me:23458: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +else + MAKE_UPPER_TAGS=no +fi + +if test "$MAKE_UPPER_TAGS" = yes ; then + MAKE_UPPER_TAGS= +else + MAKE_UPPER_TAGS="#" +fi + +if test "$MAKE_LOWER_TAGS" = yes ; then + MAKE_LOWER_TAGS= +else + MAKE_LOWER_TAGS="#" +fi + +LD_RPATH_OPT= +if test "x$cf_cv_enable_rpath" != xno +then + echo "$as_me:23481: checking for an rpath option" >&5 +echo $ECHO_N "checking for an rpath option... $ECHO_C" >&6 + case $cf_cv_system_name in + (irix*) + if test "$GCC" = yes; then + LD_RPATH_OPT="-Wl,-rpath," + else + LD_RPATH_OPT="-rpath " + fi + ;; + (linux*|gnu*|k*bsd*-gnu|freebsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (openbsd[2-9].*|mirbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (dragonfly*) + LD_RPATH_OPT="-rpath " + ;; + (netbsd*) + LD_RPATH_OPT="-Wl,-rpath," + ;; + (osf*|mls+*) + LD_RPATH_OPT="-rpath " + ;; + (solaris2*) + LD_RPATH_OPT="-R" + ;; + (*) + ;; + esac + echo "$as_me:23512: result: $LD_RPATH_OPT" >&5 +echo "${ECHO_T}$LD_RPATH_OPT" >&6 + + case "x$LD_RPATH_OPT" in + (x-R*) + echo "$as_me:23517: checking if we need a space after rpath option" >&5 +echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 + cf_save_LIBS="$LIBS" + +cf_add_libs="$LIBS" +# reverse order +cf_add_0lib= +for cf_add_1lib in ${LD_RPATH_OPT}$libdir; do cf_add_0lib="$cf_add_1lib $cf_add_0lib"; done +# filter duplicates +for cf_add_1lib in $cf_add_0lib; do + for cf_add_2lib in $cf_add_libs; do + if test "x$cf_add_1lib" = "x$cf_add_2lib"; then + cf_add_1lib= + break + fi + done + test -n "$cf_add_1lib" && cf_add_libs="$cf_add_1lib $cf_add_libs" +done +LIBS="$cf_add_libs" + + cat >conftest.$ac_ext <<_ACEOF +#line 23538 "configure" +#include "confdefs.h" + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:23550: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:23553: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:23556: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:23559: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_rpath_space=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_rpath_space=yes +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$cf_save_LIBS" + echo "$as_me:23569: result: $cf_rpath_space" >&5 +echo "${ECHO_T}$cf_rpath_space" >&6 + test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT " + ;; + esac +fi + +echo "$as_me:23576: checking if rpath-hack should be disabled" >&5 +echo $ECHO_N "checking if rpath-hack should be disabled... $ECHO_C" >&6 + +# Check whether --enable-rpath-hack or --disable-rpath-hack was given. +if test "${enable_rpath_hack+set}" = set; then + enableval="$enable_rpath_hack" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + cf_disable_rpath_hack=yes + else + cf_disable_rpath_hack=no + fi +else + enableval=yes + cf_disable_rpath_hack=no + +fi; +echo "$as_me:23593: result: $cf_disable_rpath_hack" >&5 +echo "${ECHO_T}$cf_disable_rpath_hack" >&6 +if test "$cf_disable_rpath_hack" = no ; then + +echo "$as_me:23597: checking for updated LDFLAGS" >&5 +echo $ECHO_N "checking for updated LDFLAGS... $ECHO_C" >&6 +if test -n "$LD_RPATH_OPT" ; then + echo "$as_me:23600: result: maybe" >&5 +echo "${ECHO_T}maybe" >&6 + + for ac_prog in ldd +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:23607: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_cf_ldd_prog+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$cf_ldd_prog"; then + ac_cv_prog_cf_ldd_prog="$cf_ldd_prog" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_cf_ldd_prog="$ac_prog" +echo "$as_me:23622: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +cf_ldd_prog=$ac_cv_prog_cf_ldd_prog +if test -n "$cf_ldd_prog"; then + echo "$as_me:23630: result: $cf_ldd_prog" >&5 +echo "${ECHO_T}$cf_ldd_prog" >&6 +else + echo "$as_me:23633: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$cf_ldd_prog" && break +done +test -n "$cf_ldd_prog" || cf_ldd_prog="no" + + cf_rpath_list="/usr/lib /lib" + if test "$cf_ldd_prog" != no + then + cf_rpath_oops= + +cat >conftest.$ac_ext <<_ACEOF +#line 23647 "configure" +#include "confdefs.h" +#include +int +main (void) +{ +printf("Hello"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:23659: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:23662: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:23665: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:23668: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` + cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[ ]/%/%' -e 's%/[^/][^/]*$%%' |sort | uniq` +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + + # If we passed the link-test, but get a "not found" on a given library, + # this could be due to inept reconfiguration of gcc to make it only + # partly honor /usr/local/lib (or whatever). Sometimes this behavior + # is intentional, e.g., installing gcc in /usr/bin and suppressing the + # /usr/local libraries. + if test -n "$cf_rpath_oops" + then + for cf_rpath_src in $cf_rpath_oops + do + for cf_rpath_dir in \ + /usr/local \ + /usr/pkg \ + /opt/sfw + do + if test -f $cf_rpath_dir/lib/$cf_rpath_src + then + test -n "$verbose" && echo " ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src" 1>&6 + +echo "${as_me:-configure}:23696: testing ...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src ..." 1>&5 + + LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" + break + fi + done + done + fi + fi + + test -n "$verbose" && echo " ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 + +echo "${as_me:-configure}:23708: testing ...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 + +test -n "$verbose" && echo " ...checking LDFLAGS $LDFLAGS" 1>&6 + +echo "${as_me:-configure}:23712: testing ...checking LDFLAGS $LDFLAGS ..." 1>&5 + +cf_rpath_dst= +for cf_rpath_src in $LDFLAGS +do + case $cf_rpath_src in + (-L*) + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 + +echo "${as_me:-configure}:23749: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 + + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +LDFLAGS=$cf_rpath_dst + +test -n "$verbose" && echo " ...checked LDFLAGS $LDFLAGS" 1>&6 + +echo "${as_me:-configure}:23762: testing ...checked LDFLAGS $LDFLAGS ..." 1>&5 + +test -n "$verbose" && echo " ...checking LIBS $LIBS" 1>&6 + +echo "${as_me:-configure}:23766: testing ...checking LIBS $LIBS ..." 1>&5 + +cf_rpath_dst= +for cf_rpath_src in $LIBS +do + case $cf_rpath_src in + (-L*) + + # check if this refers to a directory which we will ignore + cf_rpath_skip=no + if test -n "$cf_rpath_list" + then + for cf_rpath_item in $cf_rpath_list + do + if test "x$cf_rpath_src" = "x-L$cf_rpath_item" + then + cf_rpath_skip=yes + break + fi + done + fi + + if test "$cf_rpath_skip" = no + then + # transform the option + if test "$LD_RPATH_OPT" = "-R " ; then + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"` + else + cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"` + fi + + # if we have not already added this, add it now + cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"` + if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS" + then + test -n "$verbose" && echo " ...Filter $cf_rpath_src ->$cf_rpath_tmp" 1>&6 + +echo "${as_me:-configure}:23803: testing ...Filter $cf_rpath_src ->$cf_rpath_tmp ..." 1>&5 + + EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS" + fi + fi + ;; + esac + cf_rpath_dst="$cf_rpath_dst $cf_rpath_src" +done +LIBS=$cf_rpath_dst + +test -n "$verbose" && echo " ...checked LIBS $LIBS" 1>&6 + +echo "${as_me:-configure}:23816: testing ...checked LIBS $LIBS ..." 1>&5 + + test -n "$verbose" && echo " ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS" 1>&6 + +echo "${as_me:-configure}:23820: testing ...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS ..." 1>&5 + +else + echo "$as_me:23823: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi + +# Force plink.sh to not trim pcre's libraries, which have the same symbol +# names as the system regexp. +if test "$with_pcre" != no +then + LIBS=`echo "$LIBS" | sed -e 's/-lpcre/-kpcre/g'` +fi + +### output xtermcfg.h, etc +ac_config_files="$ac_config_files Makefile df-install minstall:minstall.in" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:23918: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:24093: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:24112: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.52.20200802, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "df-install" ) CONFIG_FILES="$CONFIG_FILES df-install" ;; + "minstall" ) CONFIG_FILES="$CONFIG_FILES minstall:minstall.in" ;; + "xtermcfg.h" ) CONFIG_HEADERS="$CONFIG_HEADERS xtermcfg.h:xtermcfg.hin" ;; + *) { { echo "$as_me:24151: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datarootdir@,$datarootdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@runstatedir@,$runstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t +s,@CPP@,$CPP,;t t +s,@AWK@,$AWK,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@LN_S@,$LN_S,;t t +s,@LINT@,$LINT,;t t +s,@LINT_OPTS@,$LINT_OPTS,;t t +s,@APP_CLASS@,$APP_CLASS,;t t +s,@APPSDIR@,$APPSDIR,;t t +s,@no_appsdir@,$no_appsdir,;t t +s,@ICON_NAME@,$ICON_NAME,;t t +s,@ICON_SYMLINK@,$ICON_SYMLINK,;t t +s,@PIXMAPDIR@,$PIXMAPDIR,;t t +s,@no_pixmapdir@,$no_pixmapdir,;t t +s,@ICONDIR@,$ICONDIR,;t t +s,@no_icondir@,$no_icondir,;t t +s,@ICON_FORMAT@,$ICON_FORMAT,;t t +s,@ICON_THEME@,$ICON_THEME,;t t +s,@ICON_LIST@,$ICON_LIST,;t t +s,@desktop_utils@,$desktop_utils,;t t +s,@DESKTOP_FLAGS@,$DESKTOP_FLAGS,;t t +s,@DESKTOP_CATEGORY@,$DESKTOP_CATEGORY,;t t +s,@XTERM_PATH@,$XTERM_PATH,;t t +s,@XTERM_SYMLINK@,$XTERM_SYMLINK,;t t +s,@SINSTALL_OPTS@,$SINSTALL_OPTS,;t t +s,@X_CFLAGS@,$X_CFLAGS,;t t +s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t +s,@X_LIBS@,$X_LIBS,;t t +s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t +s,@ICON_SUFFIX@,$ICON_SUFFIX,;t t +s,@IMAKE@,$IMAKE,;t t +s,@IMAKE_CFLAGS@,$IMAKE_CFLAGS,;t t +s,@IMAKE_LOADFLAGS@,$IMAKE_LOADFLAGS,;t t +s,@GROFF_PATH@,$GROFF_PATH,;t t +s,@NROFF_PATH@,$NROFF_PATH,;t t +s,@TBL_PATH@,$TBL_PATH,;t t +s,@GROFF_NOTE@,$GROFF_NOTE,;t t +s,@NROFF_NOTE@,$NROFF_NOTE,;t t +s,@cf_man2html@,$cf_man2html,;t t +s,@MAN2HTML_NOTE@,$MAN2HTML_NOTE,;t t +s,@MAN2HTML_PATH@,$MAN2HTML_PATH,;t t +s,@MAN2HTML_TEMP@,$MAN2HTML_TEMP,;t t +s,@default_termid@,$default_termid,;t t +s,@default_TERM@,$default_TERM,;t t +s,@backarrow_is_bs@,$backarrow_is_bs,;t t +s,@backarrow_is_erase@,$backarrow_is_erase,;t t +s,@delete_is_del@,$delete_is_del,;t t +s,@initial_erase@,$initial_erase,;t t +s,@alt_sends_esc@,$alt_sends_esc,;t t +s,@meta_sends_esc@,$meta_sends_esc,;t t +s,@cf_tic_prog@,$cf_tic_prog,;t t +s,@no_ticprog@,$no_ticprog,;t t +s,@TERMINFO_DIR@,$TERMINFO_DIR,;t t +s,@SET_TERMINFO@,$SET_TERMINFO,;t t +s,@double_buffer@,$double_buffer,;t t +s,@FREETYPE_CONFIG@,$FREETYPE_CONFIG,;t t +s,@FREETYPE_OLD_CONFIG@,$FREETYPE_OLD_CONFIG,;t t +s,@FREETYPE_XFT_CONFIG@,$FREETYPE_XFT_CONFIG,;t t +s,@HAVE_TYPE_FCCHAR32@,$HAVE_TYPE_FCCHAR32,;t t +s,@HAVE_TYPE_XFTCHARSPEC@,$HAVE_TYPE_XFTCHARSPEC,;t t +s,@LUIT@,$LUIT,;t t +s,@ECHO_LT@,$ECHO_LT,;t t +s,@ECHO_LD@,$ECHO_LD,;t t +s,@RULE_CC@,$RULE_CC,;t t +s,@SHOW_CC@,$SHOW_CC,;t t +s,@ECHO_CC@,$ECHO_CC,;t t +s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@CHARPROC_DEPS@,$CHARPROC_DEPS,;t t +s,@EXTRAHDRS@,$EXTRAHDRS,;t t +s,@EXTRASRCS@,$EXTRASRCS,;t t +s,@EXTRAOBJS@,$EXTRAOBJS,;t t +s,@MAY_SETUID@,$MAY_SETUID,;t t +s,@NOT_SETUID@,$NOT_SETUID,;t t +s,@CTAGS@,$CTAGS,;t t +s,@ETAGS@,$ETAGS,;t t +s,@MAKE_LOWER_TAGS@,$MAKE_LOWER_TAGS,;t t +s,@MAKE_UPPER_TAGS@,$MAKE_UPPER_TAGS,;t t +s,@cf_ldd_prog@,$cf_ldd_prog,;t t +s,@EXTRA_LDFLAGS@,$EXTRA_LDFLAGS,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr $ac_end + $ac_max_sed_lines` + sed "1,${ac_BEG}d; ${ac_END}p; q" $tmp/subs.sed >$tmp/subs.next + if test -s $tmp/subs.next; then + grep '^s,@[^@,][^@,]*@,.*\\$' $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + grep "^s,@[^@,][^@,]*@,.*,;t t$" $tmp/subs.next >$tmp/subs.edit + if test ! -s $tmp/subs.edit; then + if test $ac_beg -gt 1; then + ac_end=`expr $ac_end - 1` + continue + fi + fi + fi + fi + + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:24464: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:24482: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:24495: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <<\EOF + ac_warn_datarootdir=no + if test x"$ac_file" != x-; then + for ac_item in $ac_file_inputs + do + ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' $ac_item` + if test -n "$ac_seen"; then + ac_used=`grep '@datarootdir@' $ac_item` + if test -z "$ac_used"; then + { echo "$as_me:24511: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + fi + ac_seen=`grep '${datarootdir}' $ac_item` + if test -n "$ac_seen"; then + { echo "$as_me:24520: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + done + fi + +if test "x$ac_warn_datarootdir" = xyes; then + ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" +fi + +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + cp $tmp/out $ac_file + + for ac_name in prefix exec_prefix datarootdir + do + ac_seen=`fgrep -n '${'$ac_name'[:=].*}' $ac_file` + if test -n "$ac_seen"; then + ac_init=`egrep '[ ]*'$ac_name'[ ]*=' $ac_file` + if test -z "$ac_init"; then + ac_seen=`echo "$ac_seen" |sed -e 's,^,'$ac_file':,'` + { echo "$as_me:24557: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&5 +echo "$as_me: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&2;} + fi + fi + done + egrep -n '@[a-z_][a-z_0-9]+@' $ac_file >$tmp/out + egrep -n '@[A-Z_][A-Z_0-9]+@' $ac_file >>$tmp/out + if test -s $tmp/out; then + ac_seen=`sed -e 's,^,'$ac_file':,' < $tmp/out` + { echo "$as_me:24568: WARNING: Some variables may not be substituted: +$ac_seen" >&5 +echo "$as_me: WARNING: Some variables may not be substituted: +$ac_seen" >&2;} + fi + else + cat $tmp/out + fi + rm -f $tmp/out + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_iB='\([ ]\),\1#\2define\3' +ac_iC=' ' +ac_iD='\4,;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:24617: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:24628: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:24641: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +sed 's/ac_d/ac_i/g' conftest.defines >>conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:24759: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/ports/xterm/xterm-359/configure.in b/ports/xterm/xterm-359/configure.in new file mode 100644 index 0000000..8d59b07 --- /dev/null +++ b/ports/xterm/xterm-359/configure.in @@ -0,0 +1,1179 @@ +dnl $XTermId: configure.in,v 1.369 2020/07/25 17:52:31 tom Exp $ +dnl +dnl ----------------------------------------------------------------------------- +dnl this file is part of xterm +dnl +dnl Copyright 1997-2019,2020 by Thomas E. Dickey +dnl +dnl All Rights Reserved +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the +dnl "Software"), to deal in the Software without restriction, including +dnl without limitation the rights to use, copy, modify, merge, publish, +dnl distribute, sublicense, and/or sell copies of the Software, and to +dnl permit persons to whom the Software is furnished to do so, subject to +dnl the following conditions: +dnl +dnl The above copyright notice and this permission notice shall be included +dnl in all copies or substantial portions of the Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +dnl IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +dnl CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +dnl TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +dnl SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +dnl +dnl Except as contained in this notice, the name(s) of the above copyright +dnl holders shall not be used in advertising or otherwise to promote the +dnl sale, use or other dealings in this Software without prior written +dnl authorization. +dnl --------------------------------------------------------------------------- +dnl Process this file with autoconf to produce a configure script. +dnl +AC_PREREQ(2.52.20200111) +AC_INIT +AC_CONFIG_SRCDIR([charproc.c]) +AC_CONFIG_HEADER(xtermcfg.h:xtermcfg.hin) +CF_CHECK_CACHE + +### checks for alternative programs + +dnl Only add to this case statement when a system has a compiler that is not +dnl detected by AC_PROG_CC. +case "$host_os" in +(openedition) : ${CFLAGS="-O2 -Wc,dll -Wl,EDIT=NO"} + : ${CPPFLAGS="-D_ALL_SOURCE"} + : ${LIBS="/usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x"} + : ${CC=c89};; +(darwin*) + : ${LDFLAGS}="${LDFLAGS} -Wl,-bind_at_load";; +esac + +CF_PROG_CC +AC_PROG_CPP +AC_PROG_AWK +AC_PROG_INSTALL +AC_PROG_LN_S +AC_ARG_PROGRAM +CF_PROG_LINT + +### checks for compiler characteristics +CF_XOPEN_SOURCE(700) +CF_SIGWINCH + +### checks for header files +AC_CHECK_HEADERS( \ +ncurses/curses.h \ +ncurses/term.h \ +stdlib.h \ +sys/ptem.h sys/ttydefaults.h \ +term.h \ +termios.h \ +unistd.h \ +wchar.h \ +) +AC_HEADER_TIME +AM_LANGINFO_CODESET + +### checks for typedefs +CF_SIG_ATOMIC_T +AC_CHECK_TYPE(time_t, long) +CF_TYPE_CC_T +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_UID_T +AC_TYPE_OFF_T + +### checks for library functions +AC_CHECK_FUNCS( \ + gethostname \ + getusershell \ + endusershell \ + getlogin \ + initgroups \ + mkdtemp \ + putenv \ + unsetenv \ + sched_yield \ + setpgid \ + strftime \ + tcgetattr \ + waitpid \ + wcswidth \ + wcwidth ) +CF_UTMP +CF_STRUCT_LASTLOG +CF_POSIX_SAVED_IDS + +CF_HELP_MESSAGE(Compile/Install Options:) +CF_FUNC_TGETENT + +CF_WITH_APP_CLASS(XTerm) +CF_WITH_APP_DEFAULTS +CF_WITH_ICON_NAME(mini.xterm) +CF_WITH_ICON_SYMLINK(xterm) + +# Install all icons except for the overused "terminal". +cf_cv_icon_list= +for my_item in $srcdir/icons/*.svg +do + test -f "$my_item" || continue + cf_icon_name=`echo $my_item |sed -e "s,.svg,," -e "s,^$srcdir/,,"` + case $cf_icon_name in + (*_48x48) + continue + ;; + esac + CF_VERBOSE(adding $cf_icon_name to icon-list) + cf_cv_icon_list="$cf_cv_icon_list $cf_icon_name" + if test -f "${cf_icon_name}_48x48.png" + then + CF_VERBOSE(adding ${cf_icon_name}_48x48 to icon-list) + cf_cv_icon_list="$cf_cv_icon_list ${cf_icon_name}_48x48" + fi +done +CF_WITH_ICON_THEME([$cf_cv_icon_list],,,icons/${ICON_NAME}_48x48) + +CF_DISABLE_DESKTOP(xterm) +CF_WITH_DESKTOP_CATEGORY(xterm, + [*rxvt*|*konsole|*[[Tt]]erminal], + [System|TerminalEmulator|*]) + +AC_MSG_CHECKING(for install-permissions reference) +AC_ARG_WITH(reference, + [ --with-reference=XXX program to use as permissions-reference], + [with_reference=$withval], + [with_reference=xterm]) +AC_MSG_RESULT($with_reference) + +with_full_paths=yes +CF_PATH_PROG(XTERM_PATH,$with_reference) + +# If any of --program-prefix, --program-suffix or --program-transform-name is +# given, accept an option tell the makefile to create a symbolic link, e.g., +# to "xterm" on install. +XTERM_SYMLINK=NONE +AC_SUBST(XTERM_SYMLINK) +if test "$program_transform_name" != "'s,,,'" ; then +cf_name=`echo "$program_transform_name" | sed -e '[s,\\$\\$,$,g]'` +cf_name=`echo xterm |sed -e "$cf_name"` +AC_MSG_CHECKING(for symbolic link to create to $cf_name) +AC_ARG_WITH(xterm-symlink, + [ --with-xterm-symlink=XXX make symbolic link to installed xterm], + [with_symlink=$withval], + [with_symlink=xterm]) +AC_MSG_RESULT($with_symlink) +test "$with_symlink" = yes && with_symlink=xterm +test -n "$with_symlink" && \ + test "$with_symlink" != no && \ + test "$with_symlink" != $cf_name && \ + XTERM_SYMLINK="$with_symlink" +fi + +AC_MSG_CHECKING(if you want to disable openpty) +CF_ARG_DISABLE(openpty, + [ --disable-openpty disable openpty, prefer other interfaces], + [disable_openpty=yes], + [disable_openpty=no], + no) +AC_MSG_RESULT($disable_openpty) + +AC_MSG_CHECKING(if you want to disable setuid) +CF_ARG_DISABLE(setuid, + [ --disable-setuid disable setuid in xterm, do not install setuid/setgid], + [disable_setuid=yes], + [disable_setuid=no], + no) +AC_MSG_RESULT($disable_setuid) + +AC_MSG_CHECKING(if you want to disable setgid) +CF_ARG_DISABLE(setgid, + [ --disable-setgid disable setgid in xterm, do not install setuid/setgid], + [disable_setgid=yes], + [disable_setgid=no], + no) +AC_MSG_RESULT($disable_setgid) + +AC_MSG_CHECKING(if you want to run xterm setuid to a given user) +AC_ARG_WITH(setuid, + [ --with-setuid=XXX use the given setuid user], + [use_given_setuid=$withval], + [use_given_setuid=no]) +AC_MSG_RESULT($use_given_setuid) + +if test "$use_given_setuid" != no ; then + if test "$use_given_setuid" = yes ; then + cf_cv_given_setuid=root + else + cf_cv_given_setuid=$use_given_setuid + fi + # inherit SINSTALL_OPTS from environment to allow packager to customize it. + SINSTALL_OPTS="$SINSTALL_OPTS u+s -u $cf_cv_given_setuid" +fi + +AC_MSG_CHECKING(if you want to run xterm setgid to match utmp/utmpx file) +AC_ARG_WITH(utmp-setgid, + [ --with-utmp-setgid=XXX use setgid to match utmp/utmpx file], + [use_utmp_setgid=$withval], + [use_utmp_setgid=no]) +AC_MSG_RESULT($use_utmp_setgid) + +if test "$use_utmp_setgid" != no ; then + if test "$use_utmp_setgid" = yes ; then + CF_UTMP_GROUP + else + cf_cv_utmp_group=$use_utmp_setgid + fi + if test "$cf_cv_posix_saved_ids" != yes ; then + AC_MSG_ERROR(Your system does not support POSIX saved-ids) + fi + AC_DEFINE(USE_UTMP_SETGID,1,[Define to 1 if we should use setgid to access utmp/utmpx]) + SINSTALL_OPTS="$SINSTALL_OPTS g+s -g $cf_cv_utmp_group" +fi + +AC_SUBST(SINSTALL_OPTS) + +AC_MSG_CHECKING(if you want to link with utempter) +AC_ARG_WITH(utempter, + [ --with-utempter use utempter library for access to utmp], + [use_utempter=$withval], + [use_utempter=no]) +AC_MSG_RESULT($use_utempter) + +if test "$use_utempter" = yes ; then + CF_UTEMPTER + test "$cf_cv_have_utempter" != yes && use_utempter=no +else + use_utempter=no +fi + +# Some configurations permit (or require) either setuid or setgid mode. +# Let the user decide. +if test "$use_utempter" = yes ; then + if test "${enable_setuid+set}" != set ; then + disable_setuid=yes + CF_VERBOSE([No --disable-setuid option given, force to yes]) + fi +fi + +### checks for external data +CF_ERRNO +CF_TTY_GROUP + +### checks for system services and user specified options + +AC_PATH_XTRA +CF_POSIX_WAIT +CF_SYSV +CF_SVR4 +CF_X_TOOLKIT + +AC_CHECK_HEADERS( \ + X11/DECkeysym.h \ + X11/Sunkeysym.h \ + X11/XF86keysym.h \ + X11/XKBlib.h \ + X11/TranslateI.h \ + X11/Xpoll.h \ + X11/extensions/XKB.h \ + ) + +CF_WITH_XPM +CF_WITH_XINERAMA +CF_X_ATHENA +CF_TYPE_FD_MASK +CF_TERMIO_C_ISPEED +CF_TERMIOS_TYPES + +# If we notice Xcursor, there is a workaround needed. +AC_CHECK_LIB(Xcursor, XcursorGetTheme,[AC_DEFINE(HAVE_LIB_XCURSOR,1,[Define to 1 if we have the Xcursor library])]) + +LIBS="$LIBS $X_EXTRA_LIBS" + +CF_FUNC_GRANTPT +CF_XKB_QUERY_EXTENSION +CF_XKB_KEYCODE_TO_KEYSYM +CF_XKB_BELL_EXT + +AC_CHECK_FUNCS(Xutf8LookupString, [],[ + EXTRAHDRS="$EXTRAHDRS xutf8.h" + EXTRASRCS="$EXTRASRCS xutf8.c" + EXTRAOBJS="$EXTRAOBJS xutf8.o" +]) + +CF_WITH_IMAKE_CFLAGS($(MAIN_DEFINES) $(VENDORMANDEFS)) +CF_WITH_MAN2HTML + +# If we have already established that there is a full termcap implementation, +# suppress the definitions for terminfo that we make have imported from the +# imake-file. +if test "x$cf_cv_lib_tgetent" != xno || test "x$cf_cv_lib_part_tgetent" != xno ; then + case "$IMAKE_CFLAGS" in + (*-DUSE_TERMINFO\ -DHAVE_TIGETSTR*) + CF_UNDO_CFLAGS(IMAKE_CFLAGS,terminfo,[-DUSE_TERMINFO[[ ]]*-DHAVE_TIGETSTR[[ ]]*]) + CF_UNDO_CFLAGS(CPPFLAGS,terminfo,[-DUSE_TERMINFO[[ ]]*-DHAVE_TIGETSTR[[ ]]*]) + ;; + esac +fi + +CF_HELP_MESSAGE(Terminal Configuration:) + +AC_MSG_CHECKING(for default terminal-id) +AC_ARG_WITH(terminal-id, + [ --with-terminal-id=V set default decTerminalID (default: vt420)], + [default_termid=$withval], + [default_termid=vt420]) +AC_MSG_RESULT($default_termid) +case $default_termid in +(vt*) default_termid=`echo $default_termid | sed -e 's/^..//'` + ;; +esac +AC_DEFINE_UNQUOTED(DFT_DECID,"$default_termid",[default terminal-id]) +AC_SUBST(default_termid) + +AC_MSG_CHECKING(for default terminal-type) +AC_ARG_WITH(terminal-type, + [ --with-terminal-type=T set default $TERM (default: xterm)], + [default_TERM=$withval], + [default_TERM=xterm]) +AC_MSG_RESULT($default_TERM) +AC_DEFINE_UNQUOTED(DFT_TERMTYPE,"$default_TERM",[default terminal-type]) +AC_SUBST(default_TERM) + +############################################################################### +AC_MSG_CHECKING(if backarrow-key should be BS) +CF_ARG_DISABLE(backarrow-key, + [ --enable-backarrow-key set default backarrowKey resource (default: true)], + [backarrow_is_bs=$enableval], + [backarrow_is_bs=yes]) +CF_XBOOL_RESULT(DEF_BACKARO_BS,backarrow_is_bs,[Define to 1 if backarrow-key should be BS]) + +AC_MSG_CHECKING(if backarrow-key should be treated as erase) +CF_ARG_ENABLE(backarrow-is-erase, + [ --enable-backarrow-is-erase set default backarrowKeyIsErase resource (default: false)], + [backarrow_is_erase=$enableval], + [backarrow_is_erase=no]) +CF_XBOOL_RESULT(DEF_BACKARO_ERASE,backarrow_is_erase,[Define to 1 if backarrow-key should be treated as erase]) + +AC_MSG_CHECKING(for default backspace/DEL setting) +AC_ARG_ENABLE(delete-is-del, + [ --enable-delete-is-del set default deleteIsDEL resource (default: maybe)], + [delete_is_del=$enableval], + [delete_is_del=maybe]) +CF_XBOOL_RESULT(DEFDELETE_DEL,delete_is_del,[Define to 1 if default backspace/DEL setting is DEL]) + +AC_MSG_CHECKING(for default pty initial erase setting) +AC_ARG_ENABLE(pty-erase, + [ --enable-pty-erase set default ptyInitialErase resource (default: maybe)], + [initial_erase=$enableval], + [initial_erase=False]) +CF_XBOOL_RESULT(DEF_INITIAL_ERASE,initial_erase,[Define to 1 if default pty initial erase setting is TRUE]) + +AC_MSG_CHECKING(if alt should send ESC) +CF_ARG_ENABLE(alt-sends-esc, + [ --enable-alt-sends-esc set default altSendsEscape resource (default: no)], + [alt_sends_esc=$enableval], + [alt_sends_esc=no]) +CF_XBOOL_RESULT(DEF_ALT_SENDS_ESC,alt_sends_esc,[Define to 1 if alt should send ESC]) + +AC_MSG_CHECKING(if meta should send ESC) +CF_ARG_ENABLE(meta-sends-esc, + [ --enable-meta-sends-esc set default metaSendsEscape resource (default: no)], + [meta_sends_esc=$enableval], + [meta_sends_esc=no]) +CF_XBOOL_RESULT(DEF_META_SENDS_ESC,meta_sends_esc,[Define to 1 if meta should send ESC]) + +############################################################################### +AC_CHECK_PROG(cf_tic_prog,tic,yes,no) +if test "$cf_tic_prog" = yes ; then + if test -n "$TERMINFO" + then + case "$TERMINFO" in + (/*) + test -d "$TERMINFO" || unset TERMINFO + ;; + (*) + unset TERMINFO + ;; + esac + fi + AC_MSG_CHECKING(for private terminfo-directory) + AC_ARG_WITH(own-terminfo, + [ --with-own-terminfo=P set default $TERMINFO (default: from environment)], + [TERMINFO_DIR=$withval], + [TERMINFO_DIR=${TERMINFO-none}]) + AC_MSG_RESULT($TERMINFO_DIR) + if test "$TERMINFO_DIR" = yes ; then + AC_MSG_WARN(no value given) + elif test "$TERMINFO_DIR" != none ; then + if test -d $TERMINFO_DIR ; then + AC_DEFINE_UNQUOTED(OWN_TERMINFO_DIR,"$TERMINFO_DIR",[Define to override default TERMINFO value]) + AC_MSG_CHECKING(if \$TERMINFO should also be set) + AC_ARG_ENABLE(env-terminfo, + [ --enable-env-terminfo setenv $TERMINFO if --with-own-terminfo gives value], + [cf_env_terminfo=yes], + [cf_env_terminfo=no]) + AC_MSG_RESULT($cf_env_terminfo) + test $cf_env_terminfo = yes && + AC_DEFINE(OWN_TERMINFO_ENV,1,[Define to 1 to enable setenv of $TERMINFO value]) + else + AC_MSG_WARN(not a directory) + fi + elif test "$prefix" != NONE ; then + TERMINFO_DIR='${prefix}/lib/terminfo' + elif test -d /usr/lib/terminfo ; then + TERMINFO_DIR=/usr/lib/terminfo + else + TERMINFO_DIR= + fi + SET_TERMINFO= + if test -n "$TERMINFO_DIR" ; then + TERMINFO_DIR='$(DESTDIR)'$TERMINFO_DIR + SET_TERMINFO='TERMINFO=$(TERMINFO_DIR)' + fi + no_ticprog= +else + no_ticprog="#" + TERMINFO_DIR= + SET_TERMINFO= +fi +AC_SUBST(no_ticprog) +AC_SUBST(TERMINFO_DIR) +AC_SUBST(SET_TERMINFO) + +############################################################################### +CF_HELP_MESSAGE(Optional Features:) + +AC_MSG_CHECKING(if you want active-icons) +CF_ARG_DISABLE(active-icon, + [ --disable-active-icon disable X11R6.3 active-icon feature], + [enable_active_icon=no], + [enable_active_icon=yes]) +AC_MSG_RESULT($enable_active_icon) +if test "$enable_active_icon" = no ; then + AC_DEFINE(NO_ACTIVE_ICON,1,[Define to 1 to disable X11R6.3 active-icon feature]) +fi + +AC_MSG_CHECKING(if you want ANSI color) +CF_ARG_DISABLE(ansi-color, + [ --disable-ansi-color disable ANSI color], + [enable_ansi_color=no], + [enable_ansi_color=yes]) +AC_MSG_RESULT($enable_ansi_color) +test "$enable_ansi_color" = no && AC_DEFINE(OPT_ISO_COLORS,0,[Define to 0 to disable ANSI color]) + +if test "$enable_ansi_color" = yes ; then + + AC_MSG_CHECKING(if you want 16 colors like aixterm) + CF_ARG_DISABLE(16-color, + [ --disable-16-color disable 16-color support], + [enable_16_color=no], + [enable_16_color=yes]) + AC_MSG_RESULT($enable_16_color) + test "$enable_16_color" = no && AC_DEFINE(OPT_AIX_COLORS,0,[Define to 0 to disable 16-color support]) + + AC_MSG_CHECKING(if you want 256 colors) + CF_ARG_DISABLE(256-color, + [ --disable-256-color disable 256-color support], + [enable_256_color=no], + [enable_256_color=yes]) + AC_MSG_RESULT($enable_256_color) + + if test "$enable_256_color" = yes ; then + + CHARPROC_DEPS="$CHARPROC_DEPS 256colres.h" + EXTRAHDRS="$EXTRAHDRS 256colres.h" + AC_DEFINE(OPT_256_COLORS,1,[Define to 1 to enable 256-color support]) + + AC_MSG_CHECKING(if you want direct-color support) + CF_ARG_DISABLE(direct-color, + [ --disable-direct-color disable direct-color support], + [enable_direct_color=no], + [enable_direct_color=yes]) + AC_MSG_RESULT($enable_direct_color) + if test "$enable_direct_color" = yes ; then + AC_DEFINE(OPT_DIRECT_COLOR,1,[Define to 1 to enable direct-color support]) + fi + + else + + AC_MSG_CHECKING(if you want 88 colors) + CF_ARG_DISABLE(88-color, + [ --disable-88-color disable 88-color support], + [enable_88_color=no], + [enable_88_color=yes]) + AC_MSG_RESULT($enable_88_color) + if test "$enable_88_color" = yes ; then + CHARPROC_DEPS="$CHARPROC_DEPS 88colres.h" + EXTRAHDRS="$EXTRAHDRS 88colres.h" + AC_DEFINE(OPT_88_COLORS,1,[Define to 1 to enable 88-color support]) + fi + + fi + +fi + +AC_MSG_CHECKING(if you want blinking cursor) +CF_ARG_DISABLE(blink-cursor, + [ --disable-blink-cursor disable support for blinking cursor], + [enable_blink_curs=no], + [enable_blink_curs=yes]) +AC_MSG_RESULT($enable_blink_curs) +test "$enable_blink_curs" = no && AC_DEFINE(OPT_BLINK_CURS,0,[Define to 0 to disable support for blinking cursor]) + +AC_MSG_CHECKING(if you want to ignore Linux's broken palette-strings) + +case $host_os in +(linux*) + assume_broken_osc=yes ;; +(*) + assume_broken_osc=no ;; +esac + +CF_ARG_OPTION(broken-osc, + [ --enable-broken-osc allow broken Linux OSC-strings], + [enable_broken_osc=$enableval], + [enable_broken_osc=$enableval], + [$assume_broken_osc]) +AC_MSG_RESULT($enable_broken_osc) +if test "$enable_broken_osc" = yes ; then + AC_DEFINE(OPT_BROKEN_OSC,1,[Define to 1 to allow broken Linux OSC-strings]) +else + AC_DEFINE(OPT_BROKEN_OSC,0,[Define to 0 to allow broken Linux OSC-strings]) +fi + +AC_MSG_CHECKING(if you want to allow broken string-terminators) +CF_ARG_ENABLE(broken-st, + [ --disable-broken-st disallow broken string-terminators], + [enable_broken_st=no], + [enable_broken_st=yes]) +AC_MSG_RESULT($enable_broken_st) +test "$enable_broken_st" = no && AC_DEFINE(OPT_BROKEN_ST,0,[Define to 0 to disallow broken string-terminators]) + +AC_MSG_CHECKING(if you want to compile-in icon data) +CF_ARG_ENABLE(builtin-xpms, + [ --enable-builtin-xpms compile-in icon data], + [enable_builtin_xpms=yes], + [enable_builtin_xpms=no]) +AC_MSG_RESULT($enable_builtin_xpms) +test "$enable_builtin_xpms" = yes && AC_DEFINE(OPT_BUILTIN_XPMS,1,[Define to 1 to compile-in icon data]) + +AC_MSG_CHECKING(if you want printable 128-159) +CF_ARG_DISABLE(c1-print, + [ --disable-c1-print disallow -k8 option for printable 128-159], + [enable_c1_print=no], + [enable_c1_print=yes]) +AC_MSG_RESULT($enable_c1_print) +test "$enable_c1_print" = no && AC_DEFINE(OPT_C1_PRINT,0,[Define to 0 to disallow -k8 option for printable 128-159]) + +if test "$enable_ansi_color" = yes ; then + + AC_MSG_CHECKING(if you want bold colors mapped like IBM PC) + CF_ARG_DISABLE(bold-color, + [ --disable-bold-color disable PC-style mapping of bold colors], + [enable_pc_color=no], + [enable_pc_color=yes]) + AC_MSG_RESULT($enable_pc_color) + test "$enable_pc_color" = no && AC_DEFINE(OPT_PC_COLORS,0,[Define to 0 to disable PC-style mapping of bold colors]) + + AC_MSG_CHECKING(if you want separate color-classes) + CF_ARG_DISABLE(color-class, + [ --disable-color-class disable separate color class resources], + [enable_color_class=no], + [enable_color_class=yes]) + AC_MSG_RESULT($enable_color_class) + test "$enable_color_class" = no && AC_DEFINE(OPT_COLOR_CLASS,0,[Define to 0 to disable separate color class resources]) + + AC_MSG_CHECKING(if you want color-mode enabled by default) + CF_ARG_DISABLE(color-mode, + [ --disable-color-mode disable default colorMode resource], + [default_colormode=no], + [default_colormode=yes]) + AC_MSG_RESULT($default_colormode) + test "$default_colormode" = no && AC_DEFINE(DFT_COLORMODE,0,[Define to 0 if you want color-mode enabled by default]) + +fi + +AC_MSG_CHECKING(if you want support for color highlighting) +CF_ARG_DISABLE(highlighting, + [ --disable-highlighting disable support for color highlighting], + [default_highlight=no], + [default_highlight=yes]) +AC_MSG_RESULT($default_highlight) +test "$default_highlight" = no && AC_DEFINE(OPT_HIGHLIGHT_COLOR,0,[Define to 1 if you want support for color highlighting]) + +AC_MSG_CHECKING(if you want support for doublesize characters) +CF_ARG_DISABLE(doublechars, + [ --disable-doublechars disable support for double-size chars], + [enable_doublechars=no], + [enable_doublechars=yes]) +AC_MSG_RESULT($enable_doublechars) +test "$enable_doublechars" = no && AC_DEFINE(OPT_DEC_CHRSET,0,[Define to 0 to disable support for double-size chars]) + +AC_MSG_CHECKING(if you want fallback-support for box characters) +CF_ARG_DISABLE(boxchars, + [ --disable-boxchars disable fallback-support for box chars], + [enable_boxchars=no], + [enable_boxchars=yes]) +AC_MSG_RESULT($enable_boxchars) +test "$enable_boxchars" = no && AC_DEFINE(OPT_BOX_CHARS,0,[Define to 0 to disable fallback-support for box chars]) + +AC_MSG_CHECKING(if you want to allow spawning new xterms) +CF_ARG_ENABLE(exec-xterm, + [ --enable-exec-xterm enable "spawn-new-terminal" action], + [enable_exec_xterm=yes], + [enable_exec_xterm=no]) +AC_MSG_RESULT($enable_exec_xterm) +if test "$enable_exec_xterm" = yes ; then + CF_PROCFS_CWD + if test "$cf_cv_procfs_cwd" = no ; then + AC_MSG_WARN(no suitable proc filesystem found) + else + AC_DEFINE_UNQUOTED(PROCFS_ROOT,"$cf_cv_procfs_cwd",[This is defined via the --enable-exec-xterm option]) + AC_DEFINE(OPT_EXEC_XTERM,1,[Define to 1 to enable "spawn-new-terminal" action]) + fi +fi + +CF_X_EXT +CF_X_EXT_DOUBLE_BUFFER +double_buffer=False +if test "$cf_x_ext_double_buffer" = yes ; then + AC_MSG_CHECKING(if you want to enable double-buffering in default resources) + CF_ARG_ENABLE(double-buffer, + [ --enable-double-buffer enable double-buffering in default resources], + [enable_double_bfr=yes], + [enable_double_bfr=no]) + AC_MSG_RESULT($enable_double_bfr) + if test "$enable_double_bfr" = yes ; then + AC_DEFINE(OPT_DOUBLE_BUFFER,1,[Define to 1 to enable double-buffering in default resources]) + double_buffer=True + fi +fi +AC_SUBST(double_buffer) + +AC_MSG_CHECKING(if you want to use FreeType library) +CF_ARG_DISABLE(freetype, + [ --disable-freetype disable freetype library-support], + [enable_freetype=no], + [enable_freetype=yes]) +AC_MSG_RESULT($enable_freetype) +if test "$enable_freetype" = yes ; then + CF_X_FONTCONFIG +else + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + +AC_MSG_CHECKING(if you want support for HP-style function keys) +CF_ARG_ENABLE(hp-fkeys, + [ --enable-hp-fkeys enable support for HP-style function keys], + [enable_hp_fkeys=yes], + [enable_hp_fkeys=no]) +AC_MSG_RESULT($enable_hp_fkeys) +if test "$enable_hp_fkeys" = yes ; then + AC_DEFINE(OPT_HP_FUNC_KEYS,1,[Define to 1 to enable support for HP-style function keys]) +fi + +AC_MSG_CHECKING(if you want support for SCO-style function keys) +CF_ARG_ENABLE(sco-fkeys, + [ --enable-sco-fkeys enable support for SCO-style function keys], + [enable_sco_fkeys=yes], + [enable_sco_fkeys=no]) +AC_MSG_RESULT($enable_sco_fkeys) +if test "$enable_sco_fkeys" = yes ; then + AC_DEFINE(OPT_SCO_FUNC_KEYS,1,[Define to 1 to enable support for SCO-style function keys]) +fi + +AC_MSG_CHECKING(if you want support for Sun-style function keys) +CF_ARG_DISABLE(sun-fkeys, + [ --disable-sun-fkeys disable support for Sun-style function keys], + [enable_sun_fkeys=no], + [enable_sun_fkeys=yes]) +AC_MSG_RESULT($enable_sun_fkeys) +if test "$enable_sun_fkeys" = no ; then + AC_DEFINE(OPT_SUN_FUNC_KEYS,0,[Define to 0 to disable support for Sun-style function keys]) +fi + +AC_MSG_CHECKING(if you want saved-lines stored as a FIFO) +CF_ARG_DISABLE(fifo-lines, + [ --disable-fifo-lines disable FIFO-storage for saved-lines], + [enable_fifo_lines=no], + [enable_fifo_lines=yes]) +AC_MSG_RESULT($enable_fifo_lines) +if test "$enable_fifo_lines" = yes ; then + AC_DEFINE(OPT_FIFO_LINES,1,[Define to 1 to disable FIFO-storage for saved-lines]) +fi + +AC_MSG_CHECKING(if you want support for internationalization) +CF_ARG_DISABLE(i18n, + [ --disable-i18n disable internationalization], + [enable_i18n=no], + [enable_i18n=yes]) +AC_MSG_RESULT($enable_i18n) +if test "$enable_i18n" = no ; then + AC_DEFINE(OPT_I18N_SUPPORT,0,[Define to 0 to disable internationalization]) +fi + +AC_MSG_CHECKING(if you want support for initial-erase setup) +CF_ARG_DISABLE(initial-erase, + [ --disable-initial-erase disable setup for stty erase], + [enable_ie=no], + [enable_ie=yes]) +AC_MSG_RESULT($enable_ie) +if test "$enable_ie" = no ; then + AC_DEFINE(OPT_INITIAL_ERASE,0,[Define to 0 to disable setup for stty erase]) +fi + +AC_MSG_CHECKING(if you want support for input-method) +CF_ARG_DISABLE(input-method, + [ --disable-input-method disable input-method], + [enable_ximp=no], + [enable_ximp=$enable_i18n]) +AC_MSG_RESULT($enable_ximp) +CF_INPUT_METHOD +test "$cf_cv_input_method" = no && enable_ximp=no +if test "$enable_ximp" != no ; then + if test "$enable_i18n" = no ; then + AC_MSG_WARN(input-methor relies upon internationalization) + enable_ximp=no + fi +fi +if test "$enable_ximp" = no ; then + AC_DEFINE(OPT_INPUT_METHOD,0,[Define to 0 to disable input-method]) +fi + +AC_MSG_CHECKING(if you want support for load-vt-fonts) +CF_ARG_ENABLE(load-vt-fonts, + [ --enable-load-vt-fonts enable load-vt-fonts() action], + [enable_load_vt_fonts=yes], + [enable_load_vt_fonts=no]) +AC_MSG_RESULT($enable_load_vt_fonts) +if test "$enable_load_vt_fonts" = yes ; then + AC_DEFINE(OPT_LOAD_VTFONTS,1,[Define to 1 to enable load-vt-fonts() action]) +fi + +AC_MSG_CHECKING(if you want support for logging) +CF_ARG_ENABLE(logging, + [ --enable-logging enable logging], + [enable_logging=yes], + [enable_logging=no]) +AC_MSG_RESULT($enable_logging) +if test "$enable_logging" = yes ; then + AC_DEFINE(ALLOWLOGGING,1,[if you want support for logging]) + AC_MSG_CHECKING(if you want to allow logging via a pipe) + CF_ARG_ENABLE(logfile-exec, + [ --enable-logfile-exec enable exec'd logfile filter], + [enable_log_exec=yes], + [enable_log_exec=no]) + AC_MSG_RESULT($enable_log_exec) + if test "$enable_log_exec" = yes ; then + AC_DEFINE(ALLOWLOGFILEEXEC,1,[if you want to allow logging via a pipe]) + fi +fi + +AC_MSG_CHECKING(if you want support for iconify/maximize translations) +CF_ARG_DISABLE(maximize, + [ --disable-maximize disable actions for iconify/deiconify/maximize/restore], + [enable_maximize=no], + [enable_maximize=yes]) +AC_MSG_RESULT($enable_maximize) +test "$enable_maximize" = no && AC_DEFINE(OPT_MAXIMIZE,0,[Define to 0 to disable actions for iconify/deiconify/maximize/restore]) + +AC_MSG_CHECKING(if you want NumLock to override keyboard tables) +CF_ARG_DISABLE(num-lock, + [ --disable-num-lock disable NumLock keypad support], + [enable_numlock=no], + [enable_numlock=yes]) +AC_MSG_RESULT($enable_numlock) +test "$enable_numlock" = no && AC_DEFINE(OPT_NUM_LOCK,0,[Define to 0 to disable NumLock keypad support]) + +AC_MSG_CHECKING(if you want support for get/set of base64 selection data) + +CF_ARG_DISABLE(paste64, + [ --disable-paste64 disable get/set base64 selection data], + [enable_paste64=no], + [enable_paste64=yes]) +AC_MSG_RESULT($enable_paste64) +if test "$enable_paste64" = yes ; then + AC_DEFINE(OPT_PASTE64,1,[Define to 1 to disable get/set base64 selection data]) +else + AC_DEFINE(OPT_PASTE64,0,[Define to 0 to disable get/set base64 selection data]) +fi + +AC_MSG_CHECKING(if you want support for pty-handshaking) + +CF_ARG_DISABLE(pty-handshake, + [ --disable-pty-handshake disable pty-handshake support], + [enable_pty_handshake=no], + [enable_pty_handshake=yes]) +AC_MSG_RESULT($enable_pty_handshake) +if test "$enable_pty_handshake" = yes ; then + AC_DEFINE(OPT_PTY_HANDSHAKE,1,[Define to 1 to disable pty-handshake support]) +else + AC_DEFINE(OPT_PTY_HANDSHAKE,0,[Define to 0 to disable pty-handshake support]) +fi + +AC_MSG_CHECKING(if you want support for mouse in readline applications) +CF_ARG_ENABLE(readline-mouse, + [ --enable-readline-mouse enable support for mouse in readline applications], + [enable_readline_mouse=yes], + [enable_readline_mouse=no]) +AC_MSG_RESULT($enable_readline_mouse) +if test "$enable_readline_mouse" = yes ; then + AC_DEFINE(OPT_READLINE,1,[Define to 1 to enable support for mouse in readline applications]) +fi + +AC_MSG_CHECKING(if you want support for regular-expression selections) +CF_ARG_DISABLE(regex, + [ --disable-regex disable regular-expression selections], + [enable_regex=no], + [enable_regex=yes]) +AC_MSG_RESULT($enable_regex) +if test "$enable_regex" = yes ; then + CF_WITH_PCRE2 + if test "$with_pcre2" = no ; then + CF_WITH_PCRE + if test "$with_pcre" = no ; then + CF_REGEX + if test "X$cf_cv_regex_hdrs" != "Xregex.h" ; then + AC_MSG_ERROR([Only POSIX, PCRE, or PCRE2 regular expressions are supported]) + fi + fi + fi + AC_DEFINE(OPT_SELECT_REGEX,1,[Define to 1 to enable regular-expression selections]) +fi + +AC_MSG_CHECKING(if you want support for right-scrollbar) +CF_ARG_DISABLE(rightbar, + [ --disable-rightbar disable right-scrollbar support], + [enable_rightbar=no], + [enable_rightbar=yes]) +AC_MSG_RESULT($enable_rightbar) +if test "$enable_rightbar" = yes ; then + AC_DEFINE(SCROLLBAR_RIGHT,1,[Define to 1 to enable right-scrollbar support]) +fi + +AC_MSG_CHECKING(if you want check for redundant name-change) +CF_ARG_DISABLE(samename, + [ --disable-samename disable check for redundant name-change], + [enable_samename=no], + [enable_samename=yes]) +AC_MSG_RESULT($enable_samename) +test "$enable_samename" = no && AC_DEFINE(OPT_SAME_NAME,0,[Define to 0 to disable check for redundant name-change]) + +AC_MSG_CHECKING(if you want support for selection-actions) +CF_ARG_DISABLE(selection-ops, + [ --disable-selection-ops disable selection-action operations], + [enable_selection_ops=no], + [enable_selection_ops=yes]) +AC_MSG_RESULT($enable_selection_ops) +test "$enable_selection_ops" = no && AC_DEFINE(OPT_SELECTION_OPS,0,[Define to 0 disable selection-action operations]) + +AC_MSG_CHECKING(if you want support for session management) +CF_ARG_DISABLE(session-mgt, + [ --disable-session-mgt disable support for session management], + [enable_session_mgt=no], + [enable_session_mgt=yes]) +AC_MSG_RESULT($enable_session_mgt) +test "$enable_session_mgt" = no && AC_DEFINE(OPT_SESSION_MGT,0,[Define to 0 to disable support for session management]) + +AC_MSG_CHECKING(if you want to use termcap function-keys) +CF_ARG_DISABLE(tcap-fkeys, + [ --disable-tcap-fkeys disable termcap function-keys support], + [enable_tcap_fkeys=no], + [enable_tcap_fkeys=yes]) +AC_MSG_RESULT($enable_tcap_fkeys) +test "$enable_tcap_fkeys" = yes && AC_DEFINE(OPT_TCAP_FKEYS,1,[Define to 1 to disable termcap function-keys support]) + +AC_MSG_CHECKING(if you want to use termcap-query/report) +CF_ARG_DISABLE(tcap-query, + [ --disable-tcap-query disable compiled-in termcap-query support], + [enable_tcap_query=no], + [enable_tcap_query=yes]) +AC_MSG_RESULT($enable_tcap_query) +test "$enable_tcap_query" = yes && AC_DEFINE(OPT_TCAP_QUERY,1,[Define to 1 to disable compiled-in termcap-query support]) + +AC_MSG_CHECKING(if you want support for tek4014) +CF_ARG_DISABLE(tek4014, + [ --disable-tek4014 disable tek4014 emulation], + [enable_tek4014=no], + [enable_tek4014=yes]) +AC_MSG_RESULT($enable_tek4014) +if test "$enable_tek4014" = no ; then + AC_DEFINE(OPT_TEK4014,0,[Define to 0 to disable tek4014 emulation]) +else + EXTRAHDRS="$EXTRAHDRS Tekparse.h" + EXTRASRCS="$EXTRASRCS TekPrsTbl.c Tekproc.c" + EXTRAOBJS="$EXTRAOBJS TekPrsTbl.o Tekproc.o" +fi + +AC_MSG_CHECKING(if you want pulldown menus with a toolbar) +CF_ARG_ENABLE(toolbar, + [ --enable-toolbar compile-in toolbar for pulldown menus], + [enable_toolbar=yes], + [enable_toolbar=no]) +AC_MSG_RESULT($enable_toolbar) +if test "$enable_toolbar" = yes ; then + AC_DEFINE(OPT_TOOLBAR,1,[Define to 1 to compile-in toolbar for pulldown menus]) +fi + +AC_MSG_CHECKING(if you want VT52 emulation) +CF_ARG_DISABLE(vt52, + [ --disable-vt52 disable VT52 emulation], + [enable_vt52=no], + [enable_vt52=yes]) +AC_MSG_RESULT($enable_vt52) +test "$enable_vt52" = no && AC_DEFINE(OPT_VT52_MODE,0,[Define to 0 to disable VT52 emulation]) + +AC_MSG_CHECKING(if you want wide-attribute support) +CF_ARG_DISABLE(wide-attrs, + [ --disable-wide-attrs disable wide-attribute support], + [enable_wattr=no], + [enable_wattr=yes]) +AC_MSG_RESULT($enable_wattr) + +if test x$enable_wattr = xno && test x$enable_direct_color = xyes ; then + AC_MSG_WARN(overriding wide-attributes to support direct color) + enable_wattr=yes +fi + +AC_MSG_CHECKING(if you want wide-character support) +CF_ARG_DISABLE(wide-chars, + [ --disable-wide-chars disable wide-character support], + [enable_wchar=no], + [enable_wchar=yes]) +AC_MSG_RESULT($enable_wchar) +test "x$enable_wattr" = xno && AC_DEFINE(OPT_WIDE_ATTRS,0,[Define to 0 to disable rarely-used SGR features]) + +AC_MSG_CHECKING(if you want only 16-bit character support) +CF_ARG_ENABLE(16bit-chars, + [ --enable-16bit-chars enable 16-bit character support], + [enable_16bit_chars=yes], + [enable_16bit_chars=no]) +AC_MSG_RESULT($enable_16bit_chars) + +if test "$enable_16bit_chars" = yes ; then + AC_DEFINE(OPT_WIDER_ICHAR,0,[Define to 0 to enable 16-bit character support]) + enable_wchar=yes +fi + +if test "$enable_wchar" = yes ; then + +AC_MSG_CHECKING(if you want to use mini-luit/Latin9 built-in support) +CF_ARG_ENABLE(mini-luit, + [ --enable-mini-luit enable mini-luit (built-in Latin9 support)], + [enable_mini_luit=yes], + [enable_mini_luit=no]) +AC_MSG_RESULT($enable_mini_luit) +if test "$enable_mini_luit" = yes ; then + AC_DEFINE(OPT_MINI_LUIT,1,[Define to 1 to enable mini-luit (built-in Latin9 support)]) +fi + +AC_MSG_CHECKING(if you want to use luit) +CF_ARG_DISABLE(luit, + [ --disable-luit enable luit filter (Unicode translation)], + [enable_luit=no], + [enable_luit=yes]) +AC_MSG_RESULT($enable_luit) +if test "$enable_luit" = yes ; then + AC_DEFINE(OPT_LUIT_PROG,1,[Define to 1 to enable luit filter (Unicode translation)]) + CF_PATH_PROG(LUIT,xterm-filter,bluit luit) +fi + + AC_DEFINE(OPT_WIDE_CHARS,1,[Define to 1 to enable wide-character support]) + EXTRAHDRS="$EXTRAHDRS charclass.h precompose.h wcwidth.h" + EXTRASRCS="$EXTRASRCS charclass.c precompose.c wcwidth.c" + EXTRAOBJS="$EXTRAOBJS charclass.o precompose.o wcwidth.o" +fi + +AC_MSG_CHECKING(if you want dynamic-abbreviation support) +CF_ARG_ENABLE(dabbrev, + [ --enable-dabbrev enable dynamic-abbreviation support], + [enable_dabbrev=yes], + [enable_dabbrev=no]) +AC_MSG_RESULT($enable_dabbrev) +if test "$enable_dabbrev" = yes ; then + AC_DEFINE(OPT_DABBREV,1,[Define to 1 to enable dynamic-abbreviation support]) +fi + +AC_MSG_CHECKING(if you want DECterm Locator support) +CF_ARG_ENABLE(dec-locator, + [ --enable-dec-locator enable DECterm Locator support], + [enable_dec_locator=yes], + [enable_dec_locator=no]) +AC_MSG_RESULT($enable_dec_locator) +if test "$enable_dec_locator" = yes ; then + AC_DEFINE(OPT_DEC_LOCATOR,1,[Define to 1 to enable DECterm Locator support]) +fi + +AC_MSG_CHECKING(if you want XHTML and SVG screen dump support) +CF_ARG_DISABLE(screen-dumps, + [ --disable-screen-dumps disable XHTML and SVG screen dumps], + [enable_screen_dumps=no], + [enable_screen_dumps=yes]) +AC_MSG_RESULT($enable_screen_dumps) +if test "$enable_screen_dumps" = yes ; then + EXTRASRCS="$EXTRASRCS html.c svg.c" + EXTRAOBJS="$EXTRAOBJS html.o svg.o" +else + AC_DEFINE(OPT_SCREEN_DUMPS,0,[Define to 0 to disable XHTML and SVG screen dump support]) +fi + +AC_MSG_CHECKING(if you want ReGIS graphics support) +CF_ARG_ENABLE(regis-graphics, + [ --enable-regis-graphics enable ReGIS graphics support], + [enable_regis_graphics=yes], + [enable_regis_graphics=no]) +AC_MSG_RESULT($enable_regis_graphics) +if test "$enable_regis_graphics" = yes ; then + AC_DEFINE(OPT_REGIS_GRAPHICS,1,[Define to 1 to enable ReGIS graphics support]) + EXTRAHDRS="$EXTRAHDRS graphics_regis.h" + EXTRASRCS="$EXTRASRCS graphics_regis.c" + EXTRAOBJS="$EXTRAOBJS graphics_regis.o" + CF_MATH_LIB +fi + +AC_MSG_CHECKING(if you want sixel graphics support) +CF_ARG_DISABLE(sixel-graphics, + [ --disable-sixel-graphics disable sixel graphics support], + [enable_sixel_graphics=no], + [enable_sixel_graphics=yes]) +AC_MSG_RESULT($enable_sixel_graphics) +if test "$enable_sixel_graphics" = yes ; then + AC_DEFINE(OPT_SIXEL_GRAPHICS,1,[Define to 1 to enable sixel graphics support]) + EXTRAHDRS="$EXTRAHDRS graphics_sixel.h" + EXTRASRCS="$EXTRASRCS graphics_sixel.c" + EXTRAOBJS="$EXTRAOBJS graphics_sixel.o" +fi + +if test "$enable_regis_graphics" = yes || test "$enable_sixel_graphics" = yes ; then + AC_DEFINE(OPT_GRAPHICS,1,[Defined to 1 to if any graphics mode is enabled]) + EXTRAHDRS="$EXTRAHDRS graphics.h" + EXTRASRCS="$EXTRASRCS graphics.c" + EXTRAOBJS="$EXTRAOBJS graphics.o" +fi + +AC_MSG_CHECKING(if you want VT420 rectangle support) +CF_ARG_DISABLE(rectangles, + [ --disable-rectangles disable VT420 rectangle support], + [enable_rectangles=no], + [enable_rectangles=yes]) +AC_MSG_RESULT($enable_rectangles) +if test "$enable_rectangles" = yes ; then + AC_DEFINE(OPT_DEC_RECTOPS,1,[Define to 1 to disable VT420 rectangle support]) +fi + +AC_MSG_CHECKING(if you want -ziconbeep option) +CF_ARG_DISABLE(ziconbeep, + [ --disable-ziconbeep disable -ziconbeep option], + [enable_ziconbeep=no], + [enable_ziconbeep=yes]) +AC_MSG_RESULT($enable_ziconbeep) +test "$enable_ziconbeep" = no && AC_DEFINE(OPT_ZICONBEEP,0,[Define to 0 to disable -ziconbeep option]) + +############################################################################### +CF_HELP_MESSAGE(Testing/development Options:) + +AC_MSG_CHECKING(if you want debugging traces) +CF_ARG_ENABLE(trace, + [ --enable-trace test: set to enable debugging traces], + [enable_trace=yes], + [enable_trace=no]) +AC_MSG_RESULT($enable_trace) +if test "$enable_trace" = yes ; then + AC_DEFINE(OPT_TRACE,1,[Define to 1 to enable debugging traces]) + EXTRASRCS="$EXTRASRCS trace.c" + EXTRAOBJS="$EXTRAOBJS trace.o" +fi + +CF_DISABLE_LEAKS +CF_DISABLE_ECHO + +AC_MSG_CHECKING(if you want magic cookie emulation) +CF_ARG_ENABLE(xmc-glitch, + [ --enable-xmc-glitch test: enable xmc magic-cookie emulation], + [enable_xmc=yes], + [enable_xmc=no]) +AC_MSG_RESULT($enable_xmc) +if test "$enable_xmc" = yes ; then + AC_DEFINE(OPT_XMC_GLITCH,1,[Define to 1 to enable xmc magic-cookie emulation]) + EXTRASRCS="$EXTRASRCS testxmc.c" + EXTRAOBJS="$EXTRAOBJS testxmc.o" +fi + +dnl FIXME - extra test needed to make tcap-fkeys work on HPUX +AC_CHECK_FUNCS(tigetstr) + +dnl only check for ncurses' use_extended_names if really not using termcap +if test -n "$cf_cv_lib_part_tgetent"; then + AC_CHECK_FUNCS(use_extended_names) +fi + +if test -n "$GCC" ; then +AC_MSG_CHECKING(if you want to turn on gcc warnings) +CF_ARG_ENABLE(warnings, + [ --enable-warnings test: turn on GCC compiler warnings], + [with_warnings=yes], + [with_warnings=no]) +AC_MSG_RESULT($with_warnings) +if test "$with_warnings" = yes +then + CF_GCC_ATTRIBUTES + CF_GCC_WARNINGS(Wdeclaration-after-statement Wextra Wno-unknown-pragmas Wswitch-enum Wno-cast-qual) +fi +fi + +AC_SUBST(EXTRA_CFLAGS) +AC_SUBST(CHARPROC_DEPS) +AC_SUBST(EXTRAHDRS) +AC_SUBST(EXTRASRCS) +AC_SUBST(EXTRAOBJS) + +test "$disable_setuid" = yes && AC_DEFINE(DISABLE_SETUID,1,[Define to 1 if you want to disable setuid]) +test "$disable_setgid" = yes && AC_DEFINE(DISABLE_SETGID,1,[Define to 1 if you want to disable setgid]) + +if test $disable_setuid = yes ; then + MAY_SETUID="#" + NOT_SETUID= +elif test $disable_setgid = yes ; then + MAY_SETUID="#" + NOT_SETUID= +else + MAY_SETUID= + NOT_SETUID="#" +fi + +AC_SUBST(MAY_SETUID) +AC_SUBST(NOT_SETUID) + +### remove from CPPFLAGS the optional features we define in xtermcfg.h +### or other conflicting symbols that may be defined via imake: +for cf_def in \ + __STDC__ \ + ALLOWLOGGING \ + ALLOWLOGFILEEXEC \ + OPT_LUIT_PROG \ + OPT_WIDE_CHARS \ + SCROLLBAR_RIGHT \ + USE_TTY_GROUP \ + USE_UTEMPTER \ + XRENDERFONT +do + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//` +done + +CF_MAKE_TAGS +CF_DISABLE_RPATH_HACK + +# Force plink.sh to not trim pcre's libraries, which have the same symbol +# names as the system regexp. +if test "$with_pcre" != no +then + LIBS=`echo "$LIBS" | sed -e 's/-lpcre/-kpcre/g'` +fi + +### output xtermcfg.h, etc +AC_CONFIG_FILES([Makefile df-install minstall:minstall.in]) +AC_OUTPUT diff --git a/ports/xterm/xterm-359/ctlseqs.ms b/ports/xterm/xterm-359/ctlseqs.ms new file mode 100644 index 0000000..fcb2f69 --- /dev/null +++ b/ports/xterm/xterm-359/ctlseqs.ms @@ -0,0 +1,4057 @@ +.\"#! troff -ms $1 -*- Nroff -*- +.\" "Xterm Control Sequences" document +.\" $XTermId: ctlseqs.ms,v 1.594 2020/08/03 23:44:47 tom Exp $ +.\" +.\" +.\" Copyright 1996-2019,2020 by Thomas E. Dickey +.\" +.\" All Rights Reserved +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining a +.\" copy of this software and associated documentation files (the +.\" "Software"), to deal in the Software without restriction, including +.\" without limitation the rights to use, copy, modify, merge, publish, +.\" distribute, sublicense, and/or sell copies of the Software, and to +.\" permit persons to whom the Software is furnished to do so, subject to +.\" the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be included +.\" in all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +.\" IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +.\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +.\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +.\" +.\" Except as contained in this notice, the name(s) of the above copyright +.\" holders shall not be used in advertising or otherwise to promote the +.\" sale, use or other dealings in this Software without prior written +.\" authorization. +.\" +.\" +.\" Copyright 1991, 1994 X Consortium +.\" +.\" Permission is hereby granted, free of charge, to any person obtaining +.\" a copy of this software and associated documentation files (the +.\" "Software"), to deal in the Software without restriction, including +.\" without limitation the rights to use, copy, modify, merge, publish, +.\" distribute, sublicense, and/or sell copies of the Software, and to +.\" permit persons to whom the Software is furnished to do so, subject to +.\" the following conditions: +.\" +.\" The above copyright notice and this permission notice shall be +.\" included in all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +.\" OTHER DEALINGS IN THE SOFTWARE. +.\" +.\" Except as contained in this notice, the name of the X Consortium shall +.\" not be used in advertising or otherwise to promote the sale, use or +.\" other dealings in this Software without prior written authorization +.\" from the X Consortium. +.\" +.\" X Window System is a trademark of X Consortium, Inc. +.\" +.\" Originally written by Edward Moy, University of California, +.\" Berkeley, edmoy@violet.berkeley.edu, for the X.V10R4 xterm. +.\" The X Consortium staff has since updated it for X11. +.\" Updated by Thomas E. Dickey for XFree86 3.2 - XFree86 4.3, and afterward. +.\" +.\" Run this file through troff and use the -ms macro package. +.\" +.ds XT XTerm +.ds xt xterm +.ds LF Patch #359 +.ds RF 2020/08/03 +.\" +.if n .pl 9999v \" no page breaks in nroff +.ND +.\" Start a list of controls +.de St +.nr pD \\n[PD] +.nr PD 0 +.nr PI 1.0i +.nr VS 16 +.sp +.. +.\" End a list of controls +.de Ed +.nr PD \\n[pD] +.nr VS 12 +.br +.. +.\" Bulleted paragraph +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 +.. +.\" Normal leading paragraph +.de lP +.if n .sp +.LP +.. +.\" Filler before ".IP" (how to pass parameters to that?) +.de iP +.br +.if n .sp +.. +.\" Normal internal paragraph +.de sP +.br +.if n .sp +.if t .sp 0.5 +.. +.\" Section header +.de Sh +.ds RH \\$1 +.iP +.SH +\\$1 +.. +.\" Subsection header +.de Ss +.iP +.if t .sp +.LP +.B +\\$* +.br +.. +.\" Escape single quotes in literal strings from groff's Unicode transform. +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' +.ds CH \" as nothing +.ds LH \*(XT Control Sequences +.nr s 6*\n(PS/10 +.ds L \s\nsBEL\s0 +.ds E \s\nsESC\s0 +.ds T \s\nsTAB\s0 +.ds X \s\nsETX\s0 +.ds N \s\nsENQ\s0 +.ds ET \s\nsETB\s0 +.ds C \s\nsCAN\s0 +.ds S \s\nsSUB\s0 +.\" space between chars +.ie t .ds s \| +.el .ds s " \" +.nr [W \w'\*L'u +.nr w \w'\*E'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*T'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*X'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*N'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*(ET'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*C'u +.if \nw>\n([W .nr [W \nw +.nr w \w'\*S'u +.if \nw>\n([W .nr [W \nw +.nr [W +\w'\|\|'u +.de [] +.nr w \w'\\$2' +.nr H \\n([Wu-\\nwu +.nr h \\nHu/2u +.\" do fancy box in troff +.ie t .ds \\$1 \(br\v'-1p'\(br\v'1p'\h'\\nhu'\\$2\h'\\nHu-\\nhu'\(br\l'-\\n([Wu\(ul'\v'-1p'\(br\l'-\\n([Wu\(rn'\v'1p'\*s +.el .ds \\$1 \\$2\*s +.. +.[] Et \v'-1p'\*X\v'1p' +.[] En \v'-1p'\*N\v'1p' +.[] Be \v'-1p'\*L\v'1p' +.[] AP \v'-1p'\s\nsAPC\s0\v'1p' +.[] Bs \v'-1p'\s\nsBS\s0\v'1p' +.[] Cs \v'-1p'\s\nsCSI\s0\v'1p' +.[] S2 \v'-1p'\s\nsSS2\s0\v'1p' +.[] S3 \v'-1p'\s\nsSS3\s0\v'1p' +.[] SS \v'-1p'\s\nsSOS\s0\v'1p' +.[] Eg \v'-1p'\s\nsEPA\s0\v'1p' +.[] Sg \v'-1p'\s\nsSPA\s0\v'1p' +.[] Dc \v'-1p'\s\nsDCS\s0\v'1p' +.[] Ht \v'-1p'\s\nsHTS\s0\v'1p' +.[] Id \v'-1p'\s\nsIND\s0\v'1p' +.[] Nl \v'-1p'\s\nsNEL\s0\v'1p' +.[] Os \v'-1p'\s\nsOSC\s0\v'1p' +.[] RI \v'-1p'\s\nsRI\s0\v'1p' +.[] PM \v'-1p'\s\nsPM\s0\v'1p' +.[] ST \v'-1p'\s\nsST\s0\v'1p' +.[] Ta \v'-1p'\*T\v'1p' +.[] Lf \v'-1p'\s\nsLF\s0\v'1p' +.[] Vt \v'-1p'\s\nsVT\s0\v'1p' +.[] Ff \v'-1p'\s\nsFF\s0\v'1p' +.[] Np \v'-1p'\s\nsNP\s0\v'1p' +.[] Cr \v'-1p'\s\nsCR\s0\v'1p' +.[] So \v'-1p'\s\nsSO\s0\v'1p' +.[] Sp \v'-1p'\s\nsSP\s0\v'1p' +.[] Si \v'-1p'\s\nsSI\s0\v'1p' +.[] Eb \v'-1p'\*(ET\v'1p' +.[] Ca \v'-1p'\*C\v'1p' +.[] Su \v'-1p'\*S\v'1p' +.[] Es \v'-1p'\*E\v'1p' +.[] Fs \v'-1p'\s\nsFS\s0\v'1p' +.[] Gs \v'-1p'\s\nsGS\s0\v'1p' +.[] Rs \v'-1p'\s\nsRS\s0\v'1p' +.[] Us \v'-1p'\s\nsUS\s0\v'1p' +.[] XX \v'-1p'\s\nsXX\s0\v'1p' +.[] $ $ +.[] # # +.[] % % +.[] (( ( +.[] ) ) +.[] * * +.[] + + +.[] , , +.[] - \- +.[] . . +.[] 0 0 +.[] 1 1 +.[] 2 2 +.[] 3 3 +.[] 4 4 +.[] 5 5 +.[] 6 6 +.[] 7 7 +.[] 8 8 +.[] 9 9 +.[] : : +.[] ; ; +.[] = = +.[] / / +.[] < < +.[] > > +.[] ? ? +.[] @ @ +.[] A A +.[] cB B +.[] C C +.[] D D +.[] E E +.[] F F +.[] G G +.[] H H +.[] I I +.[] J J +.[] K K +.[] L L +.[] M M +.[] N N +.[] O O +.[] P P +.[] Q Q +.[] R R +.[] S S +.[] T T +.[] V V +.[] W W +.[] XX X +.[] Y Y +.[] Z Z +.[] [[ [ +.[] ]] ] +.[] bS \\e +.[] { { +.[] ~ \(ti +.[] Dq \(dq +.[] & & +.[] ^ \(ha +.[] _ _ +.[] qu \&\(aq +.[] ` \` +.[] a a +.[] b b +.[] c c +.[] d d +.[] e e +.[] f f +.[] g g +.[] h h +.[] i i +.[] j j +.[] k k +.[] l l +.[] m m +.[] n n +.[] o o +.[] p p +.[] q q +.[] r r +.[] cs s +.[] t t +.[] u u +.[] v v +.[] w w +.[] x x +.[] y y +.[] z z +.[] | | +.[] } } +.[] ! ! +.ds Cc \fIC\fP +.ds Cb \fIC\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP +.ds Cx \fIC\v'.3m'\h'-.2m'\s-2x\s0\v'-.3m'\fP +.ds Cy \fIC\v'.3m'\h'-.2m'\s-2y\s0\v'-.3m'\fP +.ds Pa \fIP\v'.3m'\h'-.2m'\s-2a\s0\v'-.3m'\fP +.ds Pb \fIP\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP +.ds Pc \fIP\v'.3m'\h'-.2m'\s-2c\s0\v'-.3m'\fP +.ds Pd \fIP\v'.3m'\h'-.2m'\s-2d\s0\v'-.3m'\fP +.ds Pe \fIP\v'.3m'\h'-.2m'\s-2e\s0\v'-.3m'\fP +.ds Pg \fIP\v'.3m'\h'-.2m'\s-2g\s0\v'-.3m'\fP +.ds Ph \fIP\v'.3m'\h'-.2m'\s-2h\s0\v'-.3m'\fP +.ds Pi \fIP\v'.3m'\h'-.2m'\s-2i\s0\v'-.3m'\fP +.ds Pl \fIP\v'.3m'\h'-.2m'\s-2l\s0\v'-.3m'\fP +.ds Pm \fIP\v'.3m'\h'-.2m'\s-2m\s0\v'-.3m'\fP +.ds Pn \fIP\v'.3m'\h'-.2m'\s-2n\s0\v'-.3m'\fP +.ds Pp \fIP\v'.3m'\h'-.2m'\s-2p\s0\v'-.3m'\fP +.ds Pr \fIP\v'.3m'\h'-.2m'\s-2r\s0\v'-.3m'\fP +.ds Ps \fIP\v'.3m'\h'-.2m'\s-2s\s0\v'-.3m'\fP +.ds Pt \fIP\v'.3m'\h'-.2m'\s-2t\s0\v'-.3m'\fP +.ds Pu \fIP\v'.3m'\h'-.2m'\s-2u\s0\v'-.3m'\fP +.ds Pv \fIP\v'.3m'\h'-.2m'\s-2v\s0\v'-.3m'\fP +.ds Px \fIP\v'.3m'\h'-.2m'\s-2x\s0\v'-.3m'\fP +.ds Py \fIP\v'.3m'\h'-.2m'\s-2y\s0\v'-.3m'\fP +.ds Ix \fIx\fP +.ds Iy \fIy\fP +.ds Iw \fIw\fP +.ds Ih \fIh\fP +.ds Ir \fIr\fP +.ds Ic \fIc\fP +.ie t .nr LL 6.5i +.el .nr LL 72m +.if n .na +.TL +\*(XT Control Sequences +.AU +Edward Moy +.AI +University of California, Berkeley +.sp +Revised by +.AU +Stephen Gildea +.AI +X Consortium (1994) +.AU +Thomas Dickey +.AI +XFree86 Project (1996-2006) +invisible-island.net (2006-2020) +updated for \*(XT \*(LF (\*(RF) +.AU +. +.am BT \" add page numbers after first page +.ds CF % +.. +.Sh "Definitions" +.LP +Many controls use parameters, shown in italics. +If a control uses a single parameter, only one parameter name is listed. +Some parameters (along with separating \*; characters) may be optional. +Other characters in the control are required. +.\".iP +.IP \*(Cc +A single (required) character. +.\".iP +.IP \*(Ps +A single (usually optional) numeric parameter, composed of one or more digits. +.\".iP +.IP \*(Pm +Any number of single numeric parameters, separated by \*; character(s). +Individual values for the parameters are listed with \*(Ps . +.\".iP +.IP \*(Pt +A text parameter composed of printable characters. +. +.Sh "Control Bytes, Characters, and Sequences" +.LP +ECMA-48 (aka \*(``ISO 6429\*('') documents C1 (8-bit) and C0 (7-bit) codes. +Those are respectively codes 128 to 159 and 0 to 31. +ECMA-48 avoids referring to these codes as characters, +because that term is associated with \fIgraphic characters\fP. +Instead, it uses \*(``bytes\*('' and \*(``codes\*('', +with occasional lapses to \*(``characters\*('' +where the meaning cannot be mistaken. +.LP +Controls (including the escape code 27) are processed once: +.bP +This means that a C1 control can be mistaken for badly-formed UTF-8 +when the terminal runs +in UTF-8 mode because C1 controls are valid \fIcontinuation bytes\fP of +a UTF-8 encoded (multibyte) value. +.bP +It is not possible to use a C1 control obtained from decoding the UTF-8 text, +because that would require reprocessing the data. +Consequently there is no ambiguity in the way +this document uses the term \*(``character\*('' to refer to +bytes in a control sequence. +.LP +The order of processing is a necessary consequence of the way ECMA-48 +is designed: +.bP +Each byte sent to the terminal can be unambiguously determined to +fall into one of a few categories (C0, C1 and graphic characters). +.bP +ECMA-48 is \fImodal\fP; once it starts processing a control sequence, +the terminal continues until the sequence is complete, +or some byte is found which is not allowed in the sequence. +.bP +Intermediate, parameter and final bytes may +use the same codes as graphic characters, +but they are processed as part of a control sequence and are not actually +graphic characters. +.bP +Eight-bit controls can have intermediate, etc., bytes in the range 160 to 255. +Those can be treated as their counterparts in the range 32 to 127. +.bP +Single-byte controls can be handled separately from multi-byte +control sequences because ECMA-48's rules are unambiguous. +.IP +As a special case, ECMA-48 (section 9) mentions that the control functions +shift-in and shift-out are allowed to occur within a 7-bit multibyte control +sequence because those cannot alter the meaning of the control sequence. +.bP +Some controls (such as \*(Os) introduce a string mode, +which is ended on a \*(ST (string terminator). +.IP +ECMA-48 describes only correct behavior, +telling what types of characters are expected +at each stage of the control sequences. +It says that the action taken in error recovery is implementation-dependent. +\fI\*(XT\fP decodes control sequences using a state machine. +It handles errors in decoding +i.e., unexpected characters, +by resetting to the initial (ground) state. +That is different from the treatment of unimplemented +(but correctly formatted) features. +.IP +If an application does not send the string terminator, that is also an error +from the standpoint of a user. +To accommodate users of those applications, \fI\*(xt\fP has resource +settings which allow workarounds: +.RS +.bP +The Linux console's palette sequences do not use a string terminator. +The \fBbrokenLinuxOSC\fP resource setting tells \fI\*(xt\fP to ignore +those particular sequences. +.bP +The terminal should accept single-byte controls within the string. +But some applications omit a string terminator, +like the Linux console. +The \fBbrokenStringTerm\fP resource setting tells \fI\*(xt\fP to exit +string mode if it decodes a common control character such as carriage return +before the string terminator. +.RE +. +.Sh "C1 (8-Bit) Control Characters" +.LP +The \fI\*(xt\fP program recognizes both 8-bit and 7-bit control characters. +It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled. +The following pairs of 7-bit and 8-bit control characters are equivalent: +.St +.IP \\*(Es\\*D +Index (\*(Id is 0x84). +.iP +.IP \\*(Es\\*E +Next Line (\*(Nl is 0x85). +.iP +.IP \\*(Es\\*H +Tab Set (\*(Ht is 0x88). +.iP +.IP \\*(Es\\*M +Reverse Index (\*(RI is 0x8d). +.iP +.IP \\*(Es\\*N +Single Shift Select of G2 Character Set (\*(S2 is 0x8e), VT220. +This affects next character only. +.iP +.IP \\*(Es\\*O +Single Shift Select of G3 Character Set (\*(S3 is 0x8f), VT220. +This affects next character only. +.iP +.IP \\*(Es\\*P +Device Control String (\*(Dc is 0x90). +.iP +.IP \\*(Es\\*V +Start of Guarded Area (\*(Sg is 0x96). +.iP +.IP \\*(Es\\*W +End of Guarded Area (\*(Eg is 0x97). +.iP +.IP \\*(Es\\*(XX +Start of String (\*(SS is 0x98). +.iP +.IP \\*(Es\\*Z +Return Terminal ID (DECID is 0x9a). +Obsolete form of \*(Cs\*c (DA). +.iP +.IP \\*(Es\\*([[ +Control Sequence Introducer (\*(Cs is 0x9b). +.iP +.IP \\*(Es\\*(bS +String Terminator (\*(ST is 0x9c). +.iP +.IP \\*(Es\\*(]] +Operating System Command (\*(Os is 0x9d). +.iP +.IP \\*(Es\\*^ +Privacy Message (\*(PM is 0x9e). +.iP +.IP \\*(Es\\*_ +Application Program Command (\*(AP is 0x9f). +.Ed +.sp +.LP +These control characters are used in the vtXXX emulation. +. +.Sh "VT100 Mode" +.LP +In this document, \*(``VT100\*('' refers not only to VT100/VT102, +but also to the succession of upward-compatible terminals produced +by DEC (Digital Equipment Corporation) +from the mid-1970s for about twenty years. +For brevity, the document refers to the related models: + \*(``VT200\*('' as VT220/VT240, + \*(``VT300\*('' as VT320/VT340, + \*(``VT400\*('' as VT420, and + \*(``VT500\*('' as VT510/VT520/VT525. +.LP +Most of these control sequences are standard VT102 control sequences, +but there is support for later DEC VT terminals +(i.e., VT220, VT320, VT420, VT510), +as well as ECMA-48 and \fIaixterm\fP color controls. +The only VT102 feature not supported is auto-repeat, +since the only way X provides for this will affect all windows. +.LP +There are additional control sequences to provide +\fI\*(xt-\fPdependent functions, such as the scrollbar or window size. +Where the function is specified by DEC or ECMA-48, the code assigned +to it is given in parentheses. +.LP +The escape codes to designate and invoke +character sets are specified by ISO 2022 (see that document for a +discussion of character sets). +.LP +Many of the features are optional; +\fI\*(xt\fP can be configured and built without support for them. +. +.Ss Single-character functions +.St +.IP \\*(Be +Bell (\*(Be is Ctrl-G). +. +.iP +.IP \\*(Bs +Backspace (\*(Bs is Ctrl-H). +. +.iP +.IP \\*(Cr +Carriage Return (\*(Cr is Ctrl-M). +. +.iP +.IP \\*(En +Return Terminal Status (\*(En is Ctrl-E). +Default response is an empty string, but may be overridden +by a resource \fBanswerbackString\fP. +. +.iP +.IP \\*(Ff +Form Feed or New Page (\*(Np). +(\*(Ff is Ctrl-L). +\*(Ff is treated the same as \*(Lf. +. +.iP +.IP \\*(Lf +Line Feed or New Line (NL). +(\*(Lf is Ctrl-J). +. +.iP +.IP \\*(Si +Switch to \fIStandard Character Set\fP (Ctrl-O is Shift In or LS0). +This invokes the G0 character set (the default) as GL. +.br +VT200 and up implement LS0. +. +.iP +.IP \\*(So +Switch to \fIAlternate Character Set\fP (Ctrl-N is Shift Out or LS1). +This invokes the G1 character set as GL. +.br +VT200 and up implement LS1. +. +.iP +.IP \\*(Sp +Space. +. +.iP +.IP \\*(Ta +Horizontal Tab (\*(Ht is Ctrl-I). +. +.iP +.IP \\*(Vt +Vertical Tab (\*(Vt is Ctrl-K). +This is treated the same as LF. +.Ed +. +.Ss Controls beginning with \*(Es +.LP +This excludes controls where \*(Es is part of a 7-bit +equivalent to 8-bit C1 controls, ordered by the final character(s). +.St +.IP \\*(Es\\*(Sp\\*F +7-bit controls (S7C1T), VT220. +This tells the terminal to send C1 control characters as 7-bit sequences, +e.g., its responses to queries. +DEC VT200 and up always accept 8-bit control sequences except when +configured for VT100 mode. +. +.iP +.IP \\*(Es\\*(Sp\\*G +8-bit controls (S8C1T), VT220. +This tells the terminal to send C1 control characters as 8-bit sequences, +e.g., its responses to queries. +DEC VT200 and up always accept 8-bit control sequences except when +configured for VT100 mode. +. +.iP +.IP \\*(Es\\*(Sp\\*L +Set ANSI conformance level 1, ECMA-43. +. +.iP +.IP \\*(Es\\*(Sp\\*M +Set ANSI conformance level 2, ECMA-43. +. +.iP +.IP \\*(Es\\*(Sp\\*N +Set ANSI conformance level 3, ECMA-43. +. +.iP +.IP \\*(Es\\*#\\*3 +DEC double-height line, top half (DECDHL), VT100. +. +.iP +.IP \\*(Es\\*#\\*4 +DEC double-height line, bottom half (DECDHL), VT100. +. +.iP +.IP \\*(Es\\*#\\*5 +DEC single-width line (DECSWL), VT100. +. +.iP +.IP \\*(Es\\*#\\*6 +DEC double-width line (DECDWL), VT100. +. +.iP +.IP \\*(Es\\*#\\*8 +DEC Screen Alignment Test (DECALN), VT100. +. +.iP +.IP \\*(Es\\*%\\*@ +Select default character set. +That is ISO 8859-1 (ISO 2022). +. +.iP +.IP \\*(Es\\*%\\*G +Select UTF-8 character set, ISO 2022. +. +.iP +.IP \\*(Es\\*(((\\*(Cc +Designate G0 Character Set, VT100, ISO 2022. +.br +Final character \*(Cc for designating 94-character sets. +In this list, +.RS +.bP +\*0, \*A and \*(cB were introduced in the VT100, +.bP +most were introduced in the VT200 series, +.bP +a few were introduced in the VT300 series, and +.bP +a few more were introduced in the VT500 series. +.RE +.br +The VT220 character sets, +together with a few others (such as Portuguese) are activated by +the National Replacement Character Set (NRCS) controls. +The term \*(``replacement\*('' says that the character set is formed +by replacing some of the characters in a set +(termed the \fIMultinational Character Set\fP) +with more useful ones for a given language. +The ASCII and DEC Supplemental character sets make up the two +halves of the Multinational Character set, +initially mapped to GL and GR. +.br +The valid final characters \*(Cc for this control are: + \*(Cc = \*A \(-> United Kingdom (UK), VT100. + \*(Cc = \*(cB \(-> United States (USASCII), VT100. + \*(Cc = \*C or \*5 \(-> Finnish, VT200. + \*(Cc = \*H or \*7 \(-> Swedish, VT200. + \*(Cc = \*K \(-> German, VT200. + \*(Cc = \*Q or \*9 \(-> French Canadian, VT200. + \*(Cc = \*R or \*f \(-> French, VT200. + \*(Cc = \*Y \(-> Italian, VT200. + \*(Cc = \*Z \(-> Spanish, VT200. + \*(Cc = \*4 \(-> Dutch, VT200. + \*(Cc = \*(Dq\*> \(-> Greek, VT500. + \*(Cc = \*%\*2 \(-> Turkish, VT500. + \*(Cc = \*%\*6 \(-> Portuguese, VT300. + \*(Cc = \*%\*= \(-> Hebrew, VT500. + \*(Cc = \*= \(-> Swiss, VT200. + \*(Cc = \*`, \*E or \*6 \(-> Norwegian/Danish, VT200. +.br +The final character \*A is a special case, +since the same final character is +used by the VT300-control for the 96-character British Latin-1. +.br +There are a few other 94-character sets: + \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set, VT100. + \*(Cc = \*< \(-> DEC Supplemental, VT200. + \*(Cc = \*> \(-> DEC Technical, VT300. +.br +These are documented as NRCS: + \*(Cc = \*(Dq\*4 \(-> DEC Hebrew, VT500. + \*(Cc = \*(Dq\*? \(-> DEC Greek, VT500. + \*(Cc = \*%\*0 \(-> DEC Turkish, VT500. + \*(Cc = \*%\*5 \(-> DEC Supplemental Graphics, VT300. + \*(Cc = \*&\*4 \(-> DEC Cyrillic, VT500. +.br +The VT520 reference manual lists a few more, +but no documentation has been found for the mappings: + \*(Cc = \*%\*3 \(-> SCS NRCS, VT500. + \*(Cc = \*&\*5 \(-> DEC Russian, VT500. +.iP +.IP \\*(Es\\*)\\*(Cc +Designate G1 Character Set, ISO 2022, VT100. +.br +The same character sets apply as for \*(Es\*(((\*(Cc. +. +.iP +.IP \\*(Es\\**\\*(Cc +Designate G2 Character Set, ISO 2022, VT220. +.br +The same character sets apply as for \*(Es\*(((\*(Cc. +. +.iP +.IP \\*(Es\\*+\\*(Cc +Designate G3 Character Set, ISO 2022, VT220. +.br +The same character sets apply as for \*(Es\*(((\*(Cc. +. +.iP +.IP \\*(Es\\*-\\*(Cc +Designate G1 Character Set, VT300. +.br +These controls apply only to 96-character sets. +Unlike the 94-character sets, these can have different values than +ASCII space and DEL for the mapping of 0x20 and 0x7f. +The valid final characters \*(Cc for this control are: + \*(Cc = \*A \(-> ISO Latin-1 Supplemental, VT300. + \*(Cc = \*F \(-> ISO Greek Supplemental, VT500. + \*(Cc = \*H \(-> ISO Hebrew Supplemental, VT500. + \*(Cc = \*L \(-> ISO Latin-Cyrillic, VT500. + \*(Cc = \*M \(-> ISO Latin-5 Supplemental, VT500. +. +.iP +.IP \\*(Es\\*.\\*(Cc +Designate G2 Character Set, VT300. +.br +The same character sets apply as for \*(Es\*-\*(Cc. +. +.iP +.IP \\*(Es\\*/\\*(Cc +Designate G3 Character Set, VT300. +.br +The same character sets apply as for \*(Es\*-\*(Cc. +. +.iP +.IP \\*(Es\\*6 +Back Index (DECBI), VT420 and up. +. +.iP +.IP \\*(Es\\*7 +Save Cursor (DECSC), VT100. +. +.iP +.IP \\*(Es\\*8 +Restore Cursor (DECRC), VT100. +. +.iP +.IP \\*(Es\\*9 +Forward Index (DECFI), VT420 and up. +. +.iP +.IP \\*(Es\\*= +Application Keypad (DECKPAM). +. +.iP +.IP \\*(Es\\*> +Normal Keypad (DECKPNM), VT100. +. +.iP +.IP \\*(Es\\*F +Cursor to lower left corner of screen. +This is enabled by the \fBhpLowerleftBugCompat\fP resource. +. +.iP +.IP \\*(Es\\*c +Full Reset (RIS), VT100. +. +.iP +.IP \\*(Es\\*l +Memory Lock (per HP terminals). +Locks memory above the cursor. +. +.iP +.IP \\*(Es\\*m +Memory Unlock (per HP terminals). +. +.iP +.IP \\*(Es\\*n +Invoke the G2 Character Set as GL (LS2) as GL. +. +.iP +.IP \\*(Es\\*o +Invoke the G3 Character Set as GL (LS3) as GL. +. +.iP +.IP \\*(Es\\*| +Invoke the G3 Character Set as GR (LS3R). +. +.iP +.IP \\*(Es\\*} +Invoke the G2 Character Set as GR (LS2R). +. +.iP +.IP \\*(Es\\*~ +Invoke the G1 Character Set as GR (LS1R), VT100. +.Ed +. +.Ss Application Program-Command functions +.St +.IP \\*(AP\\*(Pt\\*s\\*(ST +None. +\fI\*(xt\fP implements no \*(AP functions; \*(Pt is ignored. +\*(Pt need not be printable characters. +.Ed +.\" +.Ss Device-Control functions +.St +.IP \\*(Dc\\*(Ps\\*s\\*;\\*(Ps\\*s\\*|\\*(Pt\\*s\\*(ST +User-Defined Keys (DECUDK), VT220 and up. +.iP +The first parameter: + \*(Ps = \*0 \(-> Clear all UDK definitions before starting (default). + \*(Ps = \*1 \(-> Erase Below (default). +.iP +The second parameter: + \*(Ps = \*0 \(<- Lock the keys (default). + \*(Ps = \*1 \(<- Do not lock. +.iP +The third parameter is a ';'-separated list of strings denoting +the key-code separated by a '/' from the hex-encoded key value. +The key codes correspond to the DEC function-key codes (e.g., F6=17). +. +.iP +.IP \\*(Dc\\*$\\*q\\*(Pt\\*s\\*(ST +Request Status String (DECRQSS), VT420 and up. +.br +The string following the \*(``q\*('' is one of the following: + \*m \(-> SGR + \*(Dq\*p \(-> DECSCL + \*(Sp\*q \(-> DECSCUSR + \*(Dq\*q \(-> DECSCA + \*r \(-> DECSTBM + \*(cs \(-> DECSLRM + \*t \(-> DECSLPP + \*$\*| \(-> DECSCPP + \**\*| \(-> DECSNLS +.br +\fI\*(xt\fP responds with +\*(Dc\*1\*$\*r\*(Pt\*s\*(ST +for valid requests, replacing the \*(Pt with the corresponding \*(Cs +string, +or +\*(Dc\*0\*$\*r\*(Pt\*s\*(ST +for invalid requests. +.iP +.IP \\*(Dc\\*(Ps\\*s\\*$\\*t\\*(Pt\\*s\\*(ST +Restore presentation status (DECRSPS), VT320 and up. +The control can be converted from a response from DECCIR or DECTABSR +by changing the first \*(``u\*('' to a \*(``t\*('' + \*(Ps = \*1 \(-> DECCIR + \*(Ps = \*2 \(-> DECTABSR +. +.iP +.IP \\*(Dc\\*+\\*Q\\*(Pt\\*s\\*(ST +Request resource values (XTGETXRES), \fI\*(xt\fP. +The string following the \*(``Q\*('' is a list of names +encoded in hexadecimal (2 digits per character) +separated by \*; +which correspond to \fI\*(xt\fP resource names. +Only boolean, numeric and string resources are supported by this query. +.sP +\fI\*(xt\fP responds with +.br +\*(Dc\*1\*+\*R\*(Pt\*s\*(ST +for valid requests, adding to \*(Pt an \*=, +and the value of the corresponding resource that \fI\*(xt\fP is using, +or +.br +\*(Dc\*0\*+\*R\*(Pt\*s\*(ST +for invalid requests. +.br +The strings are encoded in hexadecimal (2 digits per character). +.Ed +. +.iP +.IP \\*(Dc\\*+\\*p\\*(Pt\\*s\\*(ST +Set Termcap/Terminfo Data (XTSETTCAP), \fI\*(xt\fP. +The string following the \*(``p\*('' is a name to use for retrieving data from +the terminal database. +The data will be used for the \*(``tcap\*('' keyboard +configuration's function- and special-keys, as well as by the +Request Termcap/Terminfo String control. +. +.iP +.IP \\*(Dc\\*+\\*q\\*(Pt\\*s\\*(ST +Request Termcap/Terminfo String (XTGETTCAP), \fI\*(xt\fP. +The string following the \*(``q\*('' is a list of names +encoded in hexadecimal (2 digits per character) +separated by \*; +which correspond to termcap or terminfo key names. +.br +A few special features are also recognized, which are not key names: +.RS +.bP +\fICo\fP for termcap colors (or \fIcolors\fP for terminfo colors), +and +.bP +\fITN\fP for termcap name (or \fIname\fP for terminfo name). +.bP +\fIRGB\fP for the ncurses direct-color extension. +.br +Only a terminfo name is provided, +since termcap applications cannot use this information. +.RE +.sP +\fI\*(xt\fP responds with +.br +\*(Dc\*1\*+\*r\*(Pt\*s\*(ST +for valid requests, adding to \*(Pt an \*=, +and the value of the corresponding string that \fI\*(xt\fP would send, +or +.br +\*(Dc\*0\*+\*r\*(Pt\*s\*(ST +for invalid requests. +.br +The strings are encoded in hexadecimal (2 digits per character). +.Ed +.\" +.Ss Functions using \*(Cs, ordered by the final character(s) +.St +.IP \\*(Cs\\*(Ps\\*s\\*@ +Insert \*(Ps (Blank) Character(s) (default = 1) (ICH). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*@ +Shift left \*(Ps columns(s) (default = 1) (SL), ECMA-48. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*A +Cursor Up \*(Ps Times (default = 1) (CUU). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*A +Shift right \*(Ps columns(s) (default = 1) (SR), ECMA-48. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(cB +Cursor Down \*(Ps Times (default = 1) (CUD). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*C +Cursor Forward \*(Ps Times (default = 1) (CUF). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*D +Cursor Backward \*(Ps Times (default = 1) (CUB). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*E +Cursor Next Line \*(Ps Times (default = 1) (CNL). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*F +Cursor Preceding Line \*(Ps Times (default = 1) (CPL). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*G +Cursor Character Absolute [column] (default = [row,1]) (CHA). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*H +Cursor Position [row;column] (default = [1,1]) (CUP). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*I +Cursor Forward Tabulation \*(Ps tab stops (default = 1) (CHT). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*J +Erase in Display (ED), VT100. + \*(Ps = \*0 \(-> Erase Below (default). + \*(Ps = \*1 \(-> Erase Above. + \*(Ps = \*2 \(-> Erase All. + \*(Ps = \*3 \(-> Erase Saved Lines, \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*?\\*(Ps\\*s\\*J +Erase in Display (DECSED), VT220. + \*(Ps = \*0 \(-> Selective Erase Below (default). + \*(Ps = \*1 \(-> Selective Erase Above. + \*(Ps = \*2 \(-> Selective Erase All. + \*(Ps = \*3 \(-> Selective Erase Saved Lines, \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*K +Erase in Line (EL), VT100. + \*(Ps = \*0 \(-> Erase to Right (default). + \*(Ps = \*1 \(-> Erase to Left. + \*(Ps = \*2 \(-> Erase All. +. +.iP +.IP \\*(Cs\\*?\\*(Ps\\*s\\*K +Erase in Line (DECSEL), VT220. + \*(Ps = \*0 \(-> Selective Erase to Right (default). + \*(Ps = \*1 \(-> Selective Erase to Left. + \*(Ps = \*2 \(-> Selective Erase All. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*L +Insert \*(Ps Line(s) (default = 1) (IL). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*M +Delete \*(Ps Line(s) (default = 1) (DL). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*P +Delete \*(Ps Character(s) (default = 1) (DCH). +. +.iP +.IP \\*(Cs\\*#\\*P +.IP \\*(Cs\\*(Pm\\*s\\*#\\*P +Push current dynamic- and ANSI-palette colors onto stack +(XTPUSHCOLORS), \fI\*(xt\fP. +Parameters (integers in the range 1 through 10, since the default 0 will push) +may be used to store the palette into the stack without pushing. +. +.iP +.IP \\*(Cs\\*#\\*Q +.IP \\*(Cs\\*(Pm\\*s\\*#\\*Q +Pop stack to set dynamic- and ANSI-palette colors +(XTPOPCOLORS), \fI\*(xt\fP. +Parameters (integers in the range 1 through 10, since the default 0 will pop) +may be used to restore the palette from the stack without popping. +. +.iP +.IP \\*(Cs\\*#\\*R +Report the current entry on the palette stack, and the number of +palettes stored on the stack, using the same form as XTPOPCOLOR +(default = 0) +(XTREPORTCOLORS), \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*S +Scroll up \*(Ps lines (default = 1) (SU), VT420, ECMA-48. +. +.iP +.IP \\*(Cs\\*?\\*(Pi\\*s\\*;\\*(Pa\\*s\\*;\\*(Pv\\*s\\*S +Set or request graphics attribute (XTSMGRAPHICS), \fI\*(xt\fP. +If configured to support either \fBSixel Graphics\fP or \fBReGIS Graphics\fP, +\fI\*(xt\fP accepts a three-parameter control sequence, where \*(Pi, +\*(Pa and \*(Pv are the \fIitem\fP, \fIaction\fP and \fIvalue\fP: +.sP + \*(Pi = \*1 \(-> item is number of color registers. + \*(Pi = \*2 \(-> item is Sixel graphics geometry (in pixels). + \*(Pi = \*3 \(-> item is ReGIS graphics geometry (in pixels). +.sP + \*(Pa = \*1 \(-> read attribute. + \*(Pa = \*2 \(-> reset to default. + \*(Pa = \*3 \(-> set to value in \*(Pv. + \*(Pa = \*4 \(-> read the maximum allowed value. +.sP + \*(Pv is ignored by \fI\*(xt\fP except when setting (\*(Pa == \*3). + \*(Pv = \fIn\fP \(<- A single integer is used for color registers. + \*(Pv = \fIwidth\fP\*s\*;\fIheight\fP \(<- Two integers for graphics geometry. +.sP +\fI\*(xt\fP replies with a control sequence of the same form: +.ID +\*(Cs\*?\*(Pi\*s\*;\*(Ps\*s\*;\*(Pv\*s\*S +.DE +where \*(Ps is the status: + \*(Ps = \*0 \(<- success. + \*(Ps = \*1 \(<- error in \*(Pi. + \*(Ps = \*2 \(<- error in \*(Pa. + \*(Ps = \*3 \(<- failure. +.sP +On success, \*(Pv represents the value read or set. +.sP +\fBNotes\fP: +.RS +.bP +The current implementation allows reading the graphics sizes, +but disallows modifying those sizes because that is done once, +using resource-values. +.bP +Graphics geometry is not necessarily the same as \*(``window size\*('' +(see the dtterm window manipulation extensions). +For example, \fI\*(xt\fP limits the maximum graphics geometry at compile time +(1000x1000 as of version 328) +although the window size can be larger. +.bP +While resizing a window will always change the current +graphics geometry, the reverse is not true. +Setting graphics geometry does not affect the window size. +.RE +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*T +Scroll down \*(Ps lines (default = 1) (SD), VT420. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*T +Initiate highlight mouse tracking (XTHIMOUSE), \*(xt. +Parameters are [func;startx;starty;firstrow;lastrow]. +See the section \fBMouse Tracking\fP. +. +.iP +.IP \\*(Cs\\*>\\*(Pm\\*s\\*T +Reset title mode features to default value (XTRMTITLE), \fI\*(xt\fP. +Normally, \*(``reset\*('' disables the feature. +It is possible to disable the ability to reset features +by compiling a different default for the title modes into \fI\*(xt\fP. +.iP + \*(Ps = \*0 \(-> Do not set window/icon labels using hexadecimal. + \*(Ps = \*1 \(-> Do not query window/icon labels using hexadecimal. + \*(Ps = \*2 \(-> Do not set window/icon labels using UTF-8. + \*(Ps = \*3 \(-> Do not query window/icon labels using UTF-8. +.iP +(See discussion of \fBTitle Modes\fP). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(XX +Erase \*(Ps Character(s) (default = 1) (ECH). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*Z +Cursor Backward Tabulation \*(Ps tab stops (default = 1) (CBT). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*^ +Scroll down \*(Ps lines (default = 1) (SD), ECMA-48. +.br +This was a publication error in the original ECMA-48 5th edition (1991) +corrected in 2003. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*` +Character Position Absolute [column] (default = [row,1]) (HPA). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*a +Character Position Relative [columns] (default = [row,col+1]) (HPR). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*b +Repeat the preceding graphic character \*(Ps times (REP). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*c +Send Device Attributes (Primary DA). + \*(Ps = \*0 or omitted \(-> request attributes from terminal. +The response depends on the \fBdecTerminalID\fP resource setting. + \(->\ \*(Cs\*?\*1\*;\*2\*c (\*(``VT100 with Advanced Video Option\*('') + \(->\ \*(Cs\*?\*1\*;\*0\*c (\*(``VT101 with No Options\*('') + \(->\ \*(Cs\*?\*4\*;\*6\*c (\*(``VT132 with Advanced Video and Graphics\*('') + \(->\ \*(Cs\*?\*6\*c (\*(``VT102\*('') + \(->\ \*(Cs\*?\*7\*c (\*(``VT131\*('') + \(->\ \*(Cs\*?\*1\*2\*;\*(Ps\*s\*c (\*(``VT125\*('') + \(->\ \*(Cs\*?\*6\*2\*;\*(Ps\*s\*c (\*(``VT220\*('') + \(->\ \*(Cs\*?\*6\*3\*;\*(Ps\*s\*c (\*(``VT320\*('') + \(->\ \*(Cs\*?\*6\*4\*;\*(Ps\*s\*c (\*(``VT420\*('') +.iP +The VT100-style response parameters do not mean anything by themselves. +VT220 (and higher) parameters do, +telling the host what features the terminal supports: + \*(Ps = \*1 \(-> 132-columns. + \*(Ps = \*2 \(-> Printer. + \*(Ps = \*3 \(-> ReGIS graphics. + \*(Ps = \*4 \(-> Sixel graphics. + \*(Ps = \*6 \(-> Selective erase. + \*(Ps = \*8 \(-> User-defined keys. + \*(Ps = \*9 \(-> National Replacement Character sets. + \*(Ps = \*1\*5 \(-> Technical characters. + \*(Ps = \*1\*6 \(-> Locator port. + \*(Ps = \*1\*7 \(-> Terminal state interrogation. + \*(Ps = \*1\*8 \(-> User windows. + \*(Ps = \*2\*1 \(-> Horizontal scrolling. + \*(Ps = \*2\*2 \(-> ANSI color, e.g., VT525. + \*(Ps = \*2\*8 \(-> Rectangular editing. + \*(Ps = \*2\*9 \(-> ANSI text locator (i.e., DEC Locator mode). +.iP +\fI\*(XT\fP supports part of the \fIUser windows\fP feature, +providing a single page (which corresponds to its visible window). +Rather than resizing the font to change the number of lines/columns in +a fixed-size display, \fI\*(xt\fP uses the window extension controls +(DECSNLS, DECSCPP, DECSLPP) to adjust its visible window's size. +The \*(``cursor coupling\*('' controls (DECHCCM, DECPCCM, DECVCCM) are ignored. +. +.iP +.IP \\*(Cs\\*=\\*(Ps\\*s\\*c +Send Device Attributes (Tertiary DA). + \*(Ps = \*0 \(-> report Terminal Unit ID (default), VT400. +\*(XT uses zeros for the site code and serial number in its DECRPTUI response. +. +.iP +.IP \\*(Cs\\*>\\*(Ps\\*s\\*c +Send Device Attributes (Secondary DA). + \*(Ps = \*0 or omitted \(-> request the terminal's identification code. +The response depends on the \fBdecTerminalID\fP resource setting. +It should apply only to VT220 and up, but \fI\*(xt\fP extends this to VT100. + \(-> \*(Cs\*s\*>\*(Pp\*s\*;\*(Pv\*s\*;\*(Pc\*s\*c +.br +where \*(Pp denotes the terminal type + \*(Pp = \*0 \(-> \*(``VT100\*(''. + \*(Pp = \*1 \(-> \*(``VT220\*(''. + \*(Pp = \*2 \(-> \*(``VT240\*('' or \*(``VT241\*(''. + \*(Pp = \*1\*8 \(-> \*(``VT330\*(''. + \*(Pp = \*1\*9 \(-> \*(``VT340\*(''. + \*(Pp = \*2\*4 \(-> \*(``VT320\*(''. + \*(Pp = \*3\*2 \(-> \*(``VT382\*(''. + \*(Pp = \*4\*1 \(-> \*(``VT420\*(''. + \*(Pp = \*6\*1 \(-> \*(``VT510\*(''. + \*(Pp = \*6\*4 \(-> \*(``VT520\*(''. + \*(Pp = \*6\*5 \(-> \*(``VT525\*(''. +.iP +and \*(Pv is the firmware version (for \fI\*(xt\fP, this was originally +the XFree86 patch number, starting with 95). +In a DEC terminal, \*(Pc indicates the ROM cartridge +registration number and is always zero. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*d +Line Position Absolute [row] (default = [1,column]) (VPA). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*e +Line Position Relative [rows] (default = [row+1,column]) (VPR). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*f +Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*g +Tab Clear (TBC). + \*(Ps = \*0 \(-> Clear Current Column (default). + \*(Ps = \*3 \(-> Clear All. +. +.iP +.IP \\*(Cs\\*(Pm\\*s\\*h +Set Mode (SM). + \*(Ps = \*2 \(-> Keyboard Action Mode (AM). + \*(Ps = \*4 \(-> Insert Mode (IRM). + \*(Ps = \*1\*2 \(-> Send/receive (SRM). + \*(Ps = \*2\*0 \(-> Automatic Newline (LNM). +. +.iP +.IP \\*(Cs\\*?\\*(Pm\\*s\\*h +DEC Private Mode Set (DECSET). + \*(Ps = \*1 \(-> Application Cursor Keys (DECCKM), VT100. + \*(Ps = \*2 \(-> Designate USASCII for character sets G0-G3 (DECANM), VT100, +and set VT100 mode. + \*(Ps = \*3 \(-> 132 Column Mode (DECCOLM), VT100. + \*(Ps = \*4 \(-> Smooth (Slow) Scroll (DECSCLM), VT100. + \*(Ps = \*5 \(-> Reverse Video (DECSCNM), VT100. + \*(Ps = \*6 \(-> Origin Mode (DECOM), VT100. + \*(Ps = \*7 \(-> Auto-wrap Mode (DECAWM), VT100. + \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM), VT100. + \*(Ps = \*9 \(-> Send Mouse X & Y on button press. +See the section \fBMouse Tracking\fP. +This is the X10 \fI\*(xt\fP mouse protocol. + \*(Ps = \*1\*0 \(-> Show toolbar (rxvt). + \*(Ps = \*1\*2 \(-> Start Blinking Cursor (AT&T 610). + \*(Ps = \*1\*3 \(-> Start Blinking Cursor (set only via resource or menu). + \*(Ps = \*1\*4 \(-> Enable XOR of Blinking Cursor control sequence and menu. + \*(Ps = \*1\*8 \(-> Print form feed (DECPFF), VT220. + \*(Ps = \*1\*9 \(-> Set print extent to full screen (DECPEX), VT220. + \*(Ps = \*2\*5 \(-> Show Cursor (DECTCEM), VT220. + \*(Ps = \*3\*0 \(-> Show scrollbar (rxvt). + \*(Ps = \*3\*5 \(-> Enable font-shifting functions (rxvt). + \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK), VT240, \fI\*(xt\fP. + \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode, \fI\*(xt\fP. + \*(Ps = \*4\*1 \(-> \fBmore\fP(1) fix (see \fBcurses\fP resource). + \*(Ps = \*4\*2 \(-> Enable National Replacement Character sets +(DECNRCM), VT220. + \*(Ps = \*4\*4 \(-> Turn On Margin Bell, \fI\*(xt\fP. + \*(Ps = \*4\*5 \(-> Reverse-wraparound Mode, \fI\*(xt\fP. + \*(Ps = \*4\*6 \(-> Start Logging, \fI\*(xt\fP. +This is normally disabled by a compile-time option. + \*(Ps = \*4\*7 \(-> Use \fIAlternate Screen Buffer\fP, \fI\*(xt\fP. +This may be disabled by the \fBtiteInhibit\fP resource. + \*(Ps = \*6\*6 \(-> Application keypad (DECNKM), VT320. + \*(Ps = \*6\*7 \(-> Backarrow key sends backspace (DECBKM), VT340, VT420. +This sets the \fBbackarrowKey\fP resource to \*(``true\*(''. + \*(Ps = \*6\*9 \(-> Enable left and right margin mode (DECLRMM), VT420 and up. + \*(Ps = \*8\*0 \(-> Enable \fISixel Scrolling\fP (DECSDM). + \*(Ps = \*9\*5 \(-> Do not clear screen when DECCOLM is set/reset +(DECNCSM), VT510 and up. + \*(Ps = \*1\*0\*0\*0 \(-> Send Mouse X & Y on button press and release. +See the section \fBMouse Tracking\fP. +This is the X11 \fI\*(xt\fP mouse protocol. + \*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*2 \(-> Use Cell Motion Mouse Tracking, \fI\*(xt\fP. +See the section \fBButton-event tracking\fP. + \*(Ps = \*1\*0\*0\*3 \(-> Use All Motion Mouse Tracking, \fI\*(xt\fP. +See the section \fBAny-event tracking\fP. + \*(Ps = \*1\*0\*0\*4 \(-> Send \fBFocusIn/FocusOut\fP events, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*5 \(-> Enable UTF-8 Mouse Mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*6 \(-> Enable SGR Mouse Mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*7 \(-> Enable \fIAlternate Scroll Mode\fP, \fI\*(xt\fP. +This corresponds to the \fBalternateScroll\fP resource. + \*(Ps = \*1\*0\*1\*0 \(-> Scroll to bottom on tty output (rxvt). +This sets the \fBscrollTtyOutput\fP resource to \*(``true\*(''. + \*(Ps = \*1\*0\*1\*1 \(-> Scroll to bottom on key press (rxvt). +This sets the \fBscrollKey\fP resource to \*(``true\*(''. + \*(Ps = \*1\*0\*1\*5 \(-> Enable urxvt Mouse Mode. + \*(Ps = \*1\*0\*1\*6 \(-> Enable SGR Mouse PixelMode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*3\*4 \(-> Interpret \*(``meta\*('' key, \fI\*(xt\fP. +This sets the eighth bit of keyboard input +(and enables the \fBeightBitInput\fP resource). + \*(Ps = \*1\*0\*3\*5 \(-> Enable special modifiers for Alt and NumLock keys, +\fI\*(xt\fP. +This enables the \fBnumLock\fP resource. + \*(Ps = \*1\*0\*3\*6 \(-> Send \*(Es when Meta modifies a key, \fI\*(xt\fP. +This enables the \fBmetaSendsEscape\fP resource. + \*(Ps = \*1\*0\*3\*7 \(-> Send DEL from the editing-keypad Delete key, +\fI\*(xt\fP. + \*(Ps = \*1\*0\*3\*9 \(-> Send \*(Es when Alt modifies a key, \fI\*(xt\fP. +This enables the \fBaltSendsEscape\fP resource, \fI\*(xt\fP. + \*(Ps = \*1\*0\*4\*0 \(-> Keep selection even if not highlighted, \fI\*(xt\fP. +This enables the \fBkeepSelection\fP resource. + \*(Ps = \*1\*0\*4\*1 \(-> Use the CLIPBOARD selection, \fI\*(xt\fP. +This enables the \fBselectToClipboard\fP resource. + \*(Ps = \*1\*0\*4\*2 \(-> Enable Urgency window manager hint +when Control-G is received, \fI\*(xt\fP. +This enables the \fBbellIsUrgent\fP resource. + \*(Ps = \*1\*0\*4\*3 \(-> Enable raising of the window +when Control-G is received, \fI\*(xt\fP. +This enables the \fBpopOnBell\fP resource. + \*(Ps = \*1\*0\*4\*4 \(-> Reuse the most recent data copied to CLIPBOARD, +\fI\*(xt\fP. +This enables the \fBkeepClipboard\fP resource. + \*(Ps = \*1\*0\*4\*6 \(-> Enable switching to/from +\fIAlternate Screen Buffer\fP, \fI\*(xt\fP. +This works for terminfo-based systems, updating the \fBtiteInhibit\fP resource. + \*(Ps = \*1\*0\*4\*7 \(-> Use \fIAlternate Screen Buffer\fP, \fI\*(xt\fP. +This may be disabled by the \fBtiteInhibit\fP resource. + \*(Ps = \*1\*0\*4\*8 \(-> Save cursor as in DECSC, \fI\*(xt\fP. +This may be disabled by the \fBtiteInhibit\fP resource. + \*(Ps = \*1\*0\*4\*9 \(-> Save cursor as in DECSC, \fI\*(xt\fP. +After saving the cursor, switch to +the \fIAlternate Screen Buffer\fP, clearing it first. +This may be +disabled by the \fBtiteInhibit\fP resource. +This control combines the effects of the \*1\*0\*4\*7 and \*1\*0\*4\*8 modes. +Use this with terminfo-based applications rather than the \*4\*7 mode. + \*(Ps = \*1\*0\*5\*0 \(-> Set terminfo/termcap function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*5\*1 \(-> Set Sun function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*5\*2 \(-> Set HP function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*5\*3 \(-> Set SCO function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*6\*0 \(-> Set legacy keyboard emulation, i.e, X11R6, +\fI\*(xt\fP. + \*(Ps = \*1\*0\*6\*1 \(-> Set VT220 keyboard emulation, \fI\*(xt\fP. + \*(Ps = \*2\*0\*0\*4 \(-> Set bracketed paste mode, \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*i +Media Copy (MC). + \*(Ps = \*0 \(-> Print screen (default). + \*(Ps = \*4 \(-> Turn off printer controller mode. + \*(Ps = \*5 \(-> Turn on printer controller mode. + \*(Ps = \*1\*0 \(-> HTML screen dump, \fI\*(xt\fP. + \*(Ps = \*1\*1 \(-> SVG screen dump, \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*?\\*(Ps\\*s\\*i +Media Copy (MC), DEC-specific. + \*(Ps = \*1 \(-> Print line containing cursor. + \*(Ps = \*4 \(-> Turn off autoprint mode. + \*(Ps = \*5 \(-> Turn on autoprint mode. + \*(Ps = \*1\*0 \(-> Print composed display, ignores DECPEX. + \*(Ps = \*1\*1 \(-> Print all pages. +. +.iP +.IP \\*(Cs\\*(Pm\\*s\\*l +Reset Mode (RM). + \*(Ps = \*2 \(-> Keyboard Action Mode (AM). + \*(Ps = \*4 \(-> Replace Mode (IRM). + \*(Ps = \*1\*2 \(-> Send/receive (SRM). + \*(Ps = \*2\*0 \(-> Normal Linefeed (LNM). +. +.iP +.IP \\*(Cs\\*?\\*(Pm\\*s\\*l +DEC Private Mode Reset (DECRST). + \*(Ps = \*1 \(-> Normal Cursor Keys (DECCKM), VT100. + \*(Ps = \*2 \(-> Designate VT52 mode (DECANM), VT100. + \*(Ps = \*3 \(-> 80 Column Mode (DECCOLM), VT100. + \*(Ps = \*4 \(-> Jump (Fast) Scroll (DECSCLM), VT100. + \*(Ps = \*5 \(-> Normal Video (DECSCNM), VT100. + \*(Ps = \*6 \(-> Normal Cursor Mode (DECOM), VT100. + \*(Ps = \*7 \(-> No Auto-wrap Mode (DECAWM), VT100. + \*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM), VT100. + \*(Ps = \*9 \(-> Don't send Mouse X & Y on button press, \fI\*(xt\fP. + \*(Ps = \*1\*0 \(-> Hide toolbar (rxvt). + \*(Ps = \*1\*2 \(-> Stop Blinking Cursor (AT&T 610). + \*(Ps = \*1\*3 \(-> Disable Blinking Cursor (reset only via resource or menu). + \*(Ps = \*1\*4 \(-> Disable XOR of Blinking Cursor control sequence and menu. + \*(Ps = \*1\*8 \(-> Don't print form feed (DECPFF), VT220. + \*(Ps = \*1\*9 \(-> Limit print to scrolling region (DECPEX), VT220. + \*(Ps = \*2\*5 \(-> Hide Cursor (DECTCEM), VT220. + \*(Ps = \*3\*0 \(-> Don't show scrollbar (rxvt). + \*(Ps = \*3\*5 \(-> Disable font-shifting functions (rxvt). + \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode, \fI\*(xt\fP. + \*(Ps = \*4\*1 \(-> No \fBmore\fP(1) fix (see \fBcurses\fP resource). + \*(Ps = \*4\*2 \(-> Disable National Replacement Character sets (DECNRCM), +VT220. + \*(Ps = \*4\*4 \(-> Turn Off Margin Bell, \fI\*(xt\fP. + \*(Ps = \*4\*5 \(-> No Reverse-wraparound Mode, \fI\*(xt\fP. + \*(Ps = \*4\*6 \(-> Stop Logging, \fI\*(xt\fP. +This is normally disabled by a compile-time option. + \*(Ps = \*4\*7 \(-> Use Normal Screen Buffer, \fI\*(xt\fP. + \*(Ps = \*6\*6 \(-> Numeric keypad (DECNKM), VT320. + \*(Ps = \*6\*7 \(-> Backarrow key sends delete (DECBKM), VT340, VT420. +This sets the \fBbackarrowKey\fP resource to \*(``false\*(''. + \*(Ps = \*6\*9 \(-> Disable left and right margin mode (DECLRMM), +VT420 and up. + \*(Ps = \*8\*0 \(-> Disable \fISixel Scrolling\fP (DECSDM). + \*(Ps = \*9\*5 \(-> Clear screen when DECCOLM is set/reset (DECNCSM), +VT510 and up. + \*(Ps = \*1\*0\*0\*0 \(-> Don't send Mouse X & Y on button press and +release. +See the section \fBMouse Tracking\fP. + \*(Ps = \*1\*0\*0\*1 \(-> Don't use Hilite Mouse Tracking, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*2 \(-> Don't use Cell Motion Mouse Tracking, \fI\*(xt\fP. See the section \fBButton-event tracking\fP. + \*(Ps = \*1\*0\*0\*3 \(-> Don't use All Motion Mouse Tracking, \fI\*(xt\fP. See the section \fBAny-event tracking\fP. + \*(Ps = \*1\*0\*0\*4 \(-> Don't send \fBFocusIn/FocusOut\fP events, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*5 \(-> Disable UTF-8 Mouse Mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*6 \(-> Disable SGR Mouse Mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*0\*7 \(-> Disable \fIAlternate Scroll Mode\fP, \fI\*(xt\fP. +This corresponds to the \fBalternateScroll\fP resource. + \*(Ps = \*1\*0\*1\*0 \(-> Don't scroll to bottom on tty output (rxvt). +This sets the \fBscrollTtyOutput\fP resource to \*(``false\*(''. + \*(Ps = \*1\*0\*1\*1 \(-> Don't scroll to bottom on key press (rxvt). +This sets the \fBscrollKey\fP resource to \*(``false\*(''. + \*(Ps = \*1\*0\*1\*5 \(-> Disable urxvt Mouse Mode. + \*(Ps = \*1\*0\*1\*6 \(-> Disable SGR Mouse Pixel-Mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*3\*4 \(-> Don't interpret \*(``meta\*('' key, \fI\*(xt\fP. +This disables the \fBeightBitInput\fP resource. + \*(Ps = \*1\*0\*3\*5 \(-> Disable special modifiers for +Alt and NumLock keys, \fI\*(xt\fP. +This disables the \fBnumLock\fP resource. + \*(Ps = \*1\*0\*3\*6 \(-> Don't send \*(Es when Meta modifies a key, +\fI\*(xt\fP. +This disables the \fBmetaSendsEscape\fP resource. + \*(Ps = \*1\*0\*3\*7 \(-> Send VT220 Remove from the editing-keypad +\fIDelete\fP key, \fI\*(xt\fP. + \*(Ps = \*1\*0\*3\*9 \(-> Don't send \*(Es +when Alt modifies a key, \fI\*(xt\fP. +This disables the \fBaltSendsEscape\fP resource. + \*(Ps = \*1\*0\*4\*0 \(-> Do not keep selection +when not highlighted, \fI\*(xt\fP. +This disables the \fBkeepSelection\fP resource. + \*(Ps = \*1\*0\*4\*1 \(-> Use the PRIMARY selection, \fI\*(xt\fP. +This disables the \fBselectToClipboard\fP resource. + \*(Ps = \*1\*0\*4\*2 \(-> Disable Urgency window manager hint +when Control-G is received, \fI\*(xt\fP. +This disables the \fBbellIsUrgent\fP resource. + \*(Ps = \*1\*0\*4\*3 \(-> Disable raising of the window +when Control-G is received, \fI\*(xt\fP. +This disables the \fBpopOnBell\fP resource. + \*(Ps = \*1\*0\*4\*6 \(-> Disable switching to/from +\fIAlternate Screen Buffer\fP, \fI\*(xt\fP. +This works for terminfo-based systems, updating the \fBtiteInhibit\fP resource. +If currently using the \fIAlternate Screen Buffer\fP, +\fI\*(xt\fP switches to the Normal Screen Buffer. + \*(Ps = \*1\*0\*4\*7 \(-> Use Normal Screen Buffer, \fI\*(xt\fP. +Clear the screen first if in the \fIAlternate Screen Buffer\fP. +This may be disabled by the \fBtiteInhibit\fP resource. + \*(Ps = \*1\*0\*4\*8 \(-> Restore cursor as in DECRC, \fI\*(xt\fP. +This may be disabled by the \fBtiteInhibit\fP resource. + \*(Ps = \*1\*0\*4\*9 \(-> Use Normal Screen Buffer and restore cursor +as in DECRC, \fI\*(xt\fP. +This may be disabled by the \fBtiteInhibit\fP resource. +This combines the effects of the \*1\*0\*4\*7 and \*1\*0\*4\*8 modes. +Use this with terminfo-based applications rather than the \*4\*7 mode. + \*(Ps = \*1\*0\*5\*0 \(-> Reset terminfo/termcap function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*5\*1 \(-> Reset Sun function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*5\*2 \(-> Reset HP function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*5\*3 \(-> Reset SCO function-key mode, \fI\*(xt\fP. + \*(Ps = \*1\*0\*6\*0 \(-> Reset legacy keyboard emulation, i.e, X11R6, \fI\*(xt\fP. + \*(Ps = \*1\*0\*6\*1 \(-> Reset keyboard emulation to Sun/PC style, \fI\*(xt\fP. + \*(Ps = \*2\*0\*0\*4 \(-> Reset bracketed paste mode, \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*(Pm\\*s\\*m +Character Attributes (SGR). + \*(Ps = \*0 \(-> Normal (default), VT100. + \*(Ps = \*1 \(-> Bold, VT100. + \*(Ps = \*2 \(-> Faint, decreased intensity, ECMA-48 2nd. + \*(Ps = \*3 \(-> Italicized, ECMA-48 2nd. + \*(Ps = \*4 \(-> Underlined, VT100. + \*(Ps = \*5 \(-> Blink, VT100. +.br +This appears as Bold in X11R6 xterm. + \*(Ps = \*7 \(-> Inverse, VT100. + \*(Ps = \*8 \(-> Invisible, i.e., hidden, ECMA-48 2nd, VT300. + \*(Ps = \*9 \(-> Crossed-out characters, ECMA-48 3rd. + \*(Ps = \*2\*1 \(-> Doubly-underlined, ECMA-48 3rd. + \*(Ps = \*2\*2 \(-> Normal (neither bold nor faint), ECMA-48 3rd. + \*(Ps = \*2\*3 \(-> Not italicized, ECMA-48 3rd. + \*(Ps = \*2\*4 \(-> Not underlined, ECMA-48 3rd. + \*(Ps = \*2\*5 \(-> Steady (not blinking), ECMA-48 3rd. + \*(Ps = \*2\*7 \(-> Positive (not inverse), ECMA-48 3rd. + \*(Ps = \*2\*8 \(-> Visible, i.e., not hidden, ECMA-48 3rd, VT300. + \*(Ps = \*2\*9 \(-> Not crossed-out, ECMA-48 3rd. + \*(Ps = \*3\*0 \(-> Set foreground color to Black. + \*(Ps = \*3\*1 \(-> Set foreground color to Red. + \*(Ps = \*3\*2 \(-> Set foreground color to Green. + \*(Ps = \*3\*3 \(-> Set foreground color to Yellow. + \*(Ps = \*3\*4 \(-> Set foreground color to Blue. + \*(Ps = \*3\*5 \(-> Set foreground color to Magenta. + \*(Ps = \*3\*6 \(-> Set foreground color to Cyan. + \*(Ps = \*3\*7 \(-> Set foreground color to White. + \*(Ps = \*3\*9 \(-> Set foreground color to default, ECMA-48 3rd. + \*(Ps = \*4\*0 \(-> Set background color to Black. + \*(Ps = \*4\*1 \(-> Set background color to Red. + \*(Ps = \*4\*2 \(-> Set background color to Green. + \*(Ps = \*4\*3 \(-> Set background color to Yellow. + \*(Ps = \*4\*4 \(-> Set background color to Blue. + \*(Ps = \*4\*5 \(-> Set background color to Magenta. + \*(Ps = \*4\*6 \(-> Set background color to Cyan. + \*(Ps = \*4\*7 \(-> Set background color to White. + \*(Ps = \*4\*9 \(-> Set background color to default, ECMA-48 3rd. +.sP +Some of the above note the edition of ECMA-48 which first describes +a feature. +In its successive editions from 1979 to 1991 +(\fI2nd\fP 1979, \fI3rd\fP 1984, \fI4th\fP 1986, and \fI5th\fP 1991), +ECMA-48 listed codes through \*6\*5 +(skipping several toward the end of the range). +Most of the ECMA-48 codes not implemented in \fI\*(xt\fP +were never implemented in a hardware terminal. +Several (such as \*3\*9 and \*4\*9) are either noted in ECMA-48 +as implementation defined, or described in vague terms. +.sP +The successive editions of ECMA-48 give little attention to +changes from one edition to the next, +except to comment on features which have become obsolete. +ECMA-48 1st (1976) is unavailable; +there is no reliable source of information which states whether +\*(``ANSI\*('' color was defined in that edition, +or later (1979). +The VT100 (1978) implemented the most commonly used non-color video attributes +which are given in the 2nd edition. +.sP +While 8-color support is described in ECMA-48 2nd edition, +the VT500 series (introduced in 1993) +were the first DEC terminals implementing \*(``ANSI\*('' color. +The DEC terminal's use of color is known to differ from \fI\*(xt\fP; +useful documentation on this series +became available too late to influence \fI\*(xt\fP. +.sP +If 16-color support is compiled, the following \fIaixterm\fP controls apply. +Assume that \fI\*(xt\fP's resources +are set so that the ISO color codes are the first 8 of a set of 16. +Then the \fIaixterm\fP colors are the bright versions of the ISO colors: +.iP + \*(Ps = \*9\*0 \(-> Set foreground color to Black. + \*(Ps = \*9\*1 \(-> Set foreground color to Red. + \*(Ps = \*9\*2 \(-> Set foreground color to Green. + \*(Ps = \*9\*3 \(-> Set foreground color to Yellow. + \*(Ps = \*9\*4 \(-> Set foreground color to Blue. + \*(Ps = \*9\*5 \(-> Set foreground color to Magenta. + \*(Ps = \*9\*6 \(-> Set foreground color to Cyan. + \*(Ps = \*9\*7 \(-> Set foreground color to White. + \*(Ps = \*1\*0\*0 \(-> Set background color to Black. + \*(Ps = \*1\*0\*1 \(-> Set background color to Red. + \*(Ps = \*1\*0\*2 \(-> Set background color to Green. + \*(Ps = \*1\*0\*3 \(-> Set background color to Yellow. + \*(Ps = \*1\*0\*4 \(-> Set background color to Blue. + \*(Ps = \*1\*0\*5 \(-> Set background color to Magenta. + \*(Ps = \*1\*0\*6 \(-> Set background color to Cyan. + \*(Ps = \*1\*0\*7 \(-> Set background color to White. +.sP +If \fI\*(xt\fP is compiled with the 16-color support disabled, it supports +the following, from \fIrxvt\fP: + \*(Ps = \*1\*0\*0 \(-> Set foreground and background color to default. +.sP +\fI\*(XT\fP maintains a color palette +whose entries are identified by an index beginning with zero. +If 88- or 256-color support is compiled, the following apply: +.RS +.bP +All parameters are decimal integers. +.bP +RGB values range from zero (0) to 255. +.bP +The 88- and 256-color support uses \fIsubparameters\fP described in ISO-8613-6 +for \fIindexed\fP color. +ISO-8613-6 also mentions \fIdirect color\fP, using a similar scheme. +\fI\*(xt\fP supports that, too. +.bP +\fI\*(xt\fP allows either colons (standard) or semicolons (legacy) +to separate the subparameters +(but after the first colon, colons must be used). +.RE +.sP +The indexed- and direct-color features are summarized in the FAQ, +which explains why semicolon is accepted as a subparameter delimiter: +.ID 2 +.\" https://invisible-island.net/xterm/xterm.faq.html#color_by_number +\fICan I set a color by its number?\fP +.DE +.sP +These ISO-8613-6 controls (marked in ECMA-48 5th edition as +\*(``reserved for future standardization\*('') +are supported by \fI\*(xt\fP: + \*(Ps = \*3\*8\*:\*2\*:\*(Pi\*s\*:\*(Pr\*s\*:\*(Pg\*s\*:\*(Pb \(-> Set foreground +color using RGB values. +If \fI\*(xt\fP is not compiled with direct-color support, +it uses the closest match in its palette +for the given RGB \*(Pr/\*(Pg/\*(Pb. +The color space identifier \*(Pi is ignored. + \*(Ps = \*3\*8\*:\*5\*:\*(Ps \(-> Set foreground color to \*(Ps, +using indexed color. + \*(Ps = \*4\*8\*:\*2\*:\*(Pi\*s\*:\*(Pr\*s\*:\*(Pg\*s\*:\*(Pb \(-> Set background +color using RGB values. +If \fI\*(xt\fP is not compiled with direct-color support, +it uses the closest match in its palette +for the given RGB \*(Pr/\*(Pg/\*(Pb. +The color space identifier \*(Pi is ignored. + \*(Ps = \*4\*8\*:\*5\*:\*(Ps \(-> Set background color to \*(Ps, +using indexed color. +.sP +This variation on ISO-8613-6 is supported for compatibility with KDE konsole: + \*(Ps = \*3\*8\*;\*2\*;\*(Pr\*s\*;\*(Pg\*s\*;\*(Pb \(-> Set foreground color +using RGB values. +If \fI\*(xt\fP is not compiled with direct-color support, +it uses the closest match in its palette +for the given RGB \*(Pr/\*(Pg/\*(Pb. + \*(Ps = \*4\*8\*;\*2\*;\*(Pr\*s\*;\*(Pg\*s\*;\*(Pb \(-> Set background color +using RGB values. +If \fI\*(xt\fP is not compiled with direct-color support, +it uses the closest match in its palette +for the given RGB \*(Pr/\*(Pg/\*(Pb. +.sP +In each case, +if \fI\*(xt\fP is compiled with direct-color support, +and the resource \fBdirectColor\fP is true, then +rather than choosing the closest match, +\fI\*(xt\fP asks the X server to directly render a given color. +. +.iP +.IP \\*(Cs\\*>\\*(Pp\\*s\\*;\*(Pv\\*s\\*m +.IP \\*(Cs\\*>\\*(Pp\\*s\\*m +Set/reset key modifier options (XTMODKEYS), \fI\*(xt\fP. +Set or reset resource-values used by \fI\*(xt\fP to decide whether to +construct escape sequences holding information about the modifiers +pressed with a given key. +.iP +.IP +The first parameter \*(Pp identifies the resource to set/reset. +The second parameter \*(Pv is the value to assign to the resource. +.iP +.IP +If the second parameter is omitted, the resource is reset to its initial value. +Values \*3 and \*5 are reserved for keypad-keys and string-keys. +.iP + \*(Pp = \*0 \(-> \fBmodifyKeyboard\fP. + \*(Pp = \*1 \(-> \fBmodifyCursorKeys\fP. + \*(Pp = \*2 \(-> \fBmodifyFunctionKeys\fP. + \*(Pp = \*4 \(-> \fBmodifyOtherKeys\fP. +.iP +.IP +If no parameters are given, all resources are reset to their initial values. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*n +Device Status Report (DSR). + \*(Ps = \*5 \(-> Status Report. +.br +Result (\*(``OK\*('') is +\*(Cs\*0\*n + \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column]. +.br +Result is +\*(Cs\*(Ir\*s\*;\*(Ic\*s\*R +.iP +.IP +\fBNote\fP: +it is possible for this sequence to be sent by a function key. +For example, with the default keyboard configuration +the shifted F1 key may send (with shift-, control-, alt-modifiers) +.iP + \*(Cs\*1\*;\*2\*s\*R, or + \*(Cs\*1\*;\*5\*s\*R, or + \*(Cs\*1\*;\*6\*s\*R, etc. +.iP +.IP +The second parameter encodes the modifiers; values range from 2 to 16. +See the section \fBPC-Style Function Keys\fP for the codes. +The \fBmodifyFunctionKeys\fP and \fBmodifyKeyboard\fP resources +can change the form of the string sent from the modified F1 key. +. +.iP +.IP \\*(Cs\\*>\\*(Ps\\*s\\*n +Disable key modifier options, \fI\*(xt\fP. +These modifiers may be enabled via the +\*(Cs\*>\*(Pm\*s\*m +sequence. +This control sequence corresponds to a resource value of \*(``\-1\*('', +which cannot be set with the other sequence. +.iP +.IP +The parameter identifies the resource to be disabled: +.iP + \*(Ps = \*0 \(-> \fBmodifyKeyboard\fP. + \*(Ps = \*1 \(-> \fBmodifyCursorKeys\fP. + \*(Ps = \*2 \(-> \fBmodifyFunctionKeys\fP. + \*(Ps = \*4 \(-> \fBmodifyOtherKeys\fP. +.iP +If the parameter is omitted, \fBmodifyFunctionKeys\fP is disabled. +When \fBmodifyFunctionKeys\fP is disabled, \fI\*(xt\fP uses the +modifier keys to make an extended sequence of function keys rather +than adding a parameter to each function key to denote the modifiers. +. +.iP +.IP \\*(Cs\\*?\\*(Ps\\*s\\*n +Device Status Report (DSR, DEC-specific). + \*(Ps = \*6 \(-> Report Cursor Position (DECXCPR). +The response [row;column] is returned as +.br +\*(Cs\*?\*(Ir\*s\*;\*(Ic\*s\*R +.br +(assumes the default page, i.e., \*(``1\*(''). + \*(Ps = \*1\*5 \(-> Report Printer status. +The response is +.br +\*(Cs\*?\*1\*0\*n (ready). +or +.br +\*(Cs\*?\*1\*1\*n (not ready). + \*(Ps = \*2\*5 \(-> Report UDK status. +The response is +.br +\*(Cs\*?\*2\*0\*n (unlocked) +.br +or +.br +\*(Cs\*?\*2\*1\*n (locked). + \*(Ps = \*2\*6 \(-> Report Keyboard status. +The response is +.br +\*(Cs\*?\*2\*7\*;\*1\*;\*0\*;\*0\*n (North American). +.iP +.IP +The last two parameters apply to VT300 & up (keyboard ready) and +VT400 & up (LK01) respectively. +.iP + \*(Ps = \*5\*3 \(-> Report Locator status. +The response is +\*(Cs\*?\*5\*3\*n Locator available, if compiled-in, or +\*(Cs\*?\*5\*0\*n No Locator, if not. + \*(Ps = \*5\*5 \(-> Report Locator status. +The response is +\*(Cs\*?\*5\*3\*n Locator available, if compiled-in, or +\*(Cs\*?\*5\*0\*n No Locator, if not. + \*(Ps = \*5\*6 \(-> Report Locator type. +The response is +\*(Cs\*?\*5\*7\*;\*1\*n Mouse, if compiled-in, or +\*(Cs\*?\*5\*7\*;\*0\*n Cannot identify, if not. + \*(Ps = \*6\*2 \(-> Report macro space (DECMSR). +The response is +\*(Cs\*(Pn\*s\**\*s\*{. + \*(Ps = \*6\*3 \(-> Report memory checksum (DECCKSR), VT420 and up. +The response is +\*(Dc\*(Pt\*s\*!\*~x\*sx\*sx\*sx\*s\*(ST. +.br + \*(Pt is the request id (from an optional parameter to the request). + The x's are hexadecimal digits 0-9 and A-F. + \*(Ps = \*7\*5 \(-> Report data integrity. +The response is +\*(Cs\*?\*7\*0\*n (ready, no errors). + \*(Ps = \*8\*5 \(-> Report multi-session configuration. +The response is +\*(Cs\*?\*8\*3\*n (not configured for multiple-session operation). +. +.iP +.IP \\*(Cs\\*>\\*(Ps\\*s\\*p +Set resource value \fBpointerMode\fP (XTSMPOINTER), \*(xt. +This is used by \fI\*(xt\fP to decide whether to +hide the pointer cursor as the user types. +.iP +Valid values for the parameter: + \*(Ps = \*0 \(-> never hide the pointer. + \*(Ps = \*1 \(-> hide if the mouse tracking mode is not enabled. + \*(Ps = \*2 \(-> always hide the pointer, except when leaving the window. + \*(Ps = \*3 \(-> always hide the pointer, even if leaving/entering the window. +.iP +If no parameter is given, \fI\*(xt\fP uses the default, +which is \*1. +. +.iP +.IP \\*(Cs\\*!\\*p +Soft terminal reset (DECSTR), VT220 and up. +. +.iP +.IP \\*(Cs\\*(Pl\\*s\\*;\\*(Pc\\*s\\*(Dq\\*p +Set conformance level (DECSCL), VT220 and up. +.iP +The first parameter selects the conformance level. +Valid values are: + \*(Pl = \*6\*1 \(-> level 1, e.g., VT100. + \*(Pl = \*6\*2 \(-> level 2, e.g., VT200. + \*(Pl = \*6\*3 \(-> level 3, e.g., VT300. + \*(Pl = \*6\*4 \(-> level 4, e.g., VT400. + \*(Pl = \*6\*5 \(-> level 5, e.g., VT500. +.iP +The second parameter selects the C1 control transmission mode. +This is an optional parameter, ignored in conformance level 1. +Valid values are: + \*(Pc = \*0 \(-> 8-bit controls. + \*(Pc = \*1 \(-> 7-bit controls (DEC factory default). + \*(Pc = \*2 \(-> 8-bit controls. +.iP +The 7-bit and 8-bit control modes can also be set by S7C1T and S8C1T, +but DECSCL is preferred. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*$\\*p +.br +Request ANSI mode (DECRQM). +For VT300 and up, reply DECRPM is +.br + \*(Cs\*(Ps\*;\*(Pm\*s\*$\*y +.br +where \*(Ps is the mode number as in SM/RM, +and \*(Pm is the mode value: +.br + 0 - not recognized + 1 - set + 2 - reset + 3 - permanently set + 4 - permanently reset +. +.iP +.IP \\*(Cs\\*?\\*(Ps\\*s\\*$\\*p +Request DEC private mode (DECRQM). +For VT300 and up, reply DECRPM is +.br + \*(Cs\*?\*(Ps\*;\*(Pm\*s\*$\*y +.br +where \*(Ps is the mode number as in DECSET/DECSET, +\*(Pm is the mode value as in the ANSI DECRQM. +.br +Two private modes are read-only (i.e., \*1\*3 and \*1\*4), +provided only for reporting their values using this control sequence. +They correspond to the resources \fBcursorBlink\fP and \fBcursorBlinkXOR\fP. +. +.IP \\*(Cs\\*#\\*p +.br +.IP \\*(Cs\\*(Pm\\*s\\*#\\*p +Push video attributes onto stack (XTPUSHSGR), \fI\*(xt\fP. +This is an alias for \*(Cs\*#\*{, +used to work around language limitations of C#. +. +.iP +.IP \\*(Cs\\*>\\*(Ps\\*s\\*q +\*(Ps = \*0 \(-> Report \fI\*(xt\fP name and version (XTVERSION). +The response is a DSR sequence identifying the version: \*(Dc\*>\*|text \*(ST +.iP +.IP \\*(Cs\\*(Ps\\*s\\*q +Load LEDs (DECLL), VT100. + \*(Ps = \*0 \(-> Clear all LEDS (default). + \*(Ps = \*1 \(-> Light Num Lock. + \*(Ps = \*2 \(-> Light Caps Lock. + \*(Ps = \*3 \(-> Light Scroll Lock. + \*(Ps = \*2\*1 \(-> Extinguish Num Lock. + \*(Ps = \*2\*2 \(-> Extinguish Caps Lock. + \*(Ps = \*2\*3 \(-> Extinguish Scroll Lock. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*q +Set cursor style (DECSCUSR), VT520. + \*(Ps = \*0 \(-> blinking block. + \*(Ps = \*1 \(-> blinking block (default). + \*(Ps = \*2 \(-> steady block. + \*(Ps = \*3 \(-> blinking underline. + \*(Ps = \*4 \(-> steady underline. + \*(Ps = \*5 \(-> blinking bar, \fI\*(xt\fP. + \*(Ps = \*6 \(-> steady bar, \fI\*(xt\fP. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(Dq\\*q +Select character protection attribute (DECSCA), VT220. +Valid values for the parameter: + \*(Ps = \*0 \(-> DECSED and DECSEL can erase (default). + \*(Ps = \*1 \(-> DECSED and DECSEL cannot erase. + \*(Ps = \*2 \(-> DECSED and DECSEL can erase. +. +.iP +.IP \\*(Cs\\*#\\*q +Pop video attributes from stack (XTPOPSGR), \fI\*(xt\fP. +This is an alias for \*(Cs\*#\*}, +used to work around language limitations of C#. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*r +Set Scrolling Region [top;bottom] (default = full size of window) +(DECSTBM), VT100. +. +.iP +.IP \\*(Cs\\*?\\*(Pm\\*s\\*r +Restore DEC Private Mode Values (XTRESTORE), \*(xt. +The value of \*(Ps previously saved is restored. +\*(Ps values are the same as for DECSET. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*;\\*(Ps\\*s\\*$\\*r +Change Attributes in Rectangular Area (DECCARA), VT400 and up. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. + \*(Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7. +. +.iP +.IP \\*(Cs\\*(cs +Save cursor, available only when DECLRMM is disabled (SCOSC, also ANSI.SYS). +. +.iP +.IP \\*(Cs\\*(Pl\\*s\\*;\\*(Pr\\*s\\*(cs +Set left and right margins (DECSLRM), VT420 and up. +This is available only when DECLRMM is enabled. +. +.iP +.IP \\*(Cs\\*?\\*(Pm\\*s\\*(cs +Save DEC Private Mode Values (XTSAVE), \*(xt. +\*(Ps values are the same as for DECSET. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*t +Window manipulation (XTWINOPS), \fIdtterm\fP, extended by \fI\*(xt\fP. +These controls may be disabled using the \fBallowWindowOps\fP resource. +.iP +\fI\*(xt\fP uses \fIExtended Window Manager Hints\fP (EWMH) to maximize +the window. +Some window managers have incomplete support for EWMH. +For instance, \fIfvwm\fP, \fIflwm\fP and \fIquartz-wm\fP advertise +support for maximizing windows horizontally or vertically, but +in fact equate those to the maximize operation. +.iP +Valid values for the first (and any additional parameters) are: + \*(Ps = \*1 \(-> De-iconify window. + \*(Ps = \*2 \(-> Iconify window. + \*(Ps = \*3\*;\*s\fIx\*s\*;\*sy\fP \(-> Move window to [x, y]. + \*(Ps = \*4\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the \fI\*(xt\fP +window to given height and width in pixels. +Omitted parameters reuse the current height or width. +Zero parameters use the display's height or width. + \*(Ps = \*5 \(-> Raise the \fI\*(xt\fP window to the +front of the stacking order. + \*(Ps = \*6 \(-> Lower the \fI\*(xt\fP window to the +bottom of the stacking order. + \*(Ps = \*7 \(-> Refresh the \fI\*(xt\fP window. + \*(Ps = \*8\*;\*s\fIheight\*s\*;\*swidth\fP \(-> Resize the text area to +given height and width in characters. +Omitted parameters reuse the current height or width. +Zero parameters use the display's height or width. + \*(Ps = \*9\*;\*s\*0 \(-> Restore maximized window. + \*(Ps = \*9\*;\*s\*1 \(-> Maximize window (i.e., resize to screen size). + \*(Ps = \*9\*;\*s\*2 \(-> Maximize window vertically. + \*(Ps = \*9\*;\*s\*3 \(-> Maximize window horizontally. + \*(Ps = \*1\*0\*;\*s\*0 \(-> Undo full-screen mode. + \*(Ps = \*1\*0\*;\*s\*1 \(-> Change to full-screen. + \*(Ps = \*1\*0\*;\*s\*2 \(-> Toggle full-screen. + \*(Ps = \*1\*1 \(-> Report \fI\*(xt\fP window state. +.br +If the \fI\*(xt\fP window is non-iconified, it returns \*(Cs\*1\*t. +.br +If the \fI\*(xt\fP window is iconified, it returns \*(Cs\*2\*t. + \*(Ps = \*1\*3 \(-> Report \fI\*(xt\fP window position. +.br +Note: X Toolkit positions can be negative, +but the reported values are unsigned, in the range 0-65535. +Negative values correspond to 32768-65535. +.br +Result is +\*(Cs\*3\*;\*(Ix\*s\*;\*(Iy\*s\*t + \*(Ps = \*1\*3\*;\*s\*2 \(-> Report \fI\*(xt\fP text-area position. +.br +Result is +\*(Cs\*3\*;\*(Ix\*s\*;\*(Iy\*s\*t + \*(Ps = \*1\*4 \(-> Report \fI\*(xt\fP text area size in pixels. +.br +Result is +\*(Cs\*s\*4\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t + \*(Ps = \*1\*4\*;\*s\*2 \(-> Report \fI\*(xt\fP window size in pixels. +.br +Normally \fI\*(xt\fP's \fIwindow\fP is larger than its \fItext area\fP, +since it includes the frame (or decoration) applied by the +window manager, as well as the area used by a scroll-bar. +.br +Result is +\*(Cs\*s\*4\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t + \*(Ps = \*1\*5 \(-> Report size of the screen in pixels. +.br +Result is +\*(Cs\*s\*5\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t + \*(Ps = \*1\*6 \(-> Report \fI\*(xt\fP character cell size in pixels. +.br +Result is +\*(Cs\*s\*6\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t + \*(Ps = \*1\*8 \(-> Report the size of the text area in characters. +.br +Result is +\*(Cs\*s\*8\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t + \*(Ps = \*1\*9 \(-> Report the size of the screen in characters. +.br +Result is +\*(Cs\*s\*9\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t + \*(Ps = \*2\*0 \(-> Report \fI\*(xt\fP window's icon label. +.br +Result is +\*(Os\*s\*L\*s\fIlabel\fP\*s\*(ST + \*(Ps = \*2\*1 \(-> Report \fI\*(xt\fP window's title. +.br +Result is +\*(Os\*s\*l\*s\fIlabel\fP\*s\*(ST + \*(Ps = \*2\*2\*;\*0 \(-> Save \fI\*(xt\fP icon and window title +on stack. + \*(Ps = \*2\*2\*;\*1 \(-> Save \fI\*(xt\fP icon title on stack. + \*(Ps = \*2\*2\*;\*2 \(-> Save \fI\*(xt\fP window title on stack. + \*(Ps = \*2\*3\*;\*0 \(-> Restore \fI\*(xt\fP icon and window title +from stack. + \*(Ps = \*2\*3\*;\*1 \(-> Restore \fI\*(xt\fP icon title from stack. + \*(Ps = \*2\*3\*;\*2 \(-> Restore \fI\*(xt\fP window title from stack. + \*(Ps >= \*2\*4 \(-> Resize to \*(Ps lines (DECSLPP), VT340 and VT420. +.br +\fI\*(xt\fP adapts this by resizing its window. +. +.iP +.IP \\*(Cs\\*>\\*(Pm\\*s\\*t +This \fI\*(xt\fP control +sets one or more features of the title modes (XTSMTITLE), \*(xt. +Each parameter enables a single feature. + \*(Ps = \*0 \(-> Set window/icon labels using hexadecimal. + \*(Ps = \*1 \(-> Query window/icon labels using hexadecimal. + \*(Ps = \*2 \(-> Set window/icon labels using UTF-8. + \*(Ps = \*3 \(-> Query window/icon labels using UTF-8. +(See discussion of \fBTitle Modes\fP) +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*t +Set warning-bell volume (DECSWBV), VT520. + \*(Ps = \*0 or \*1 \(-> off. + \*(Ps = \*2, \*3 or \*4 \(-> low. + \*(Ps = \*5, \*6, \*7, or \*8 \(-> high. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*;\\*(Ps\\*s\\*$\\*t +Reverse Attributes in Rectangular Area (DECRARA), VT400 and up. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. + \*(Ps denotes the attributes to reverse, i.e., 1, 4, 5, 7. +. +.iP +.IP \\*(Cs\\*u +Restore cursor (SCORC, also ANSI.SYS). +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(Sp\\*u +Set margin-bell volume (DECSMBV), VT520. + \*(Ps = \*0, \*5, \*6, \*7, or \*8 \(-> high. + \*(Ps = \*1 \(-> off. + \*(Ps = \*2, \*3 or \*4 \(-> low. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*;\\*(Pp\\*s\\*;\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pp\\*s\\*$\\*v +Copy Rectangular Area (DECCRA), VT400 and up. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. + \*(Pp denotes the source page. + \*(Pt\*s\*;\*(Pl denotes the target location. + \*(Pp denotes the target page. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*$\\*w +Request presentation state report (DECRQPSR), VT320 and up. + \*(Ps = \*0 \(-> error. + \*(Ps = \*1 \(-> cursor information report (DECCIR). +.br +Response is +.br + \*(Dc\*1\*$\*u\*(Pt\*s\*(ST +.br +Refer to the VT420 programming manual, +which requires six pages to document the data string \*(Pt, + \*(Ps = \*2 \(-> tab stop report (DECTABSR). +.br +Response is +.br + \*(Dc\*2\*$\*u\*(Pt\*s\*(ST +.br +The data string \*(Pt is a list of the tab-stops, +separated by \*(``/\*('' characters. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*(qu\\*w +Enable Filter Rectangle (DECEFR), VT420 and up. +.br +Parameters are [top;left;bottom;right]. +.br +Defines the coordinates of a filter rectangle and activates it. +Anytime the locator is detected outside of the filter rectangle, +an outside rectangle event is generated and the rectangle is disabled. +Filter rectangles are always treated as \*(``one-shot\*('' events. +Any parameters that are omitted default to the current locator position. +If all parameters are omitted, any locator motion will be reported. +DECELR always cancels any previous rectangle definition. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*x +Request Terminal Parameters (DECREQTPARM). +.br +if \*(Ps is a \*(``0\*('' (default) or \*(``1\*('', +and \fI\*(xt\fR is emulating VT100, +the control sequence elicits a response of the same form +whose parameters describe the terminal: + \*(Ps \(-> the given \*(Ps incremented by 2. + \*(Pn = \*1 \(<- no parity. + \*(Pn = \*1 \(<- eight bits. + \*(Pn = \*1 \(<- \*2\*8 transmit 38.4k baud. + \*(Pn = \*1 \(<- \*2\*8 receive 38.4k baud. + \*(Pn = \*1 \(<- clock multiplier. + \*(Pn = \*0 \(<- STP flags. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\**\\*x +Select Attribute Change Extent (DECSACE), VT420 and up. + \*(Ps = \*0 \(-> from start to end position, wrapped. + \*(Ps = \*1 \(-> from start to end position, wrapped. + \*(Ps = \*2 \(-> rectangle (exact). +. +.iP +.IP \\*(Cs\\*(Pc\\*s\\*;\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*$\\*x +Fill Rectangular Area (DECFRA), VT420 and up. + \*(Pc is the character to use. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*#\\*y +Select checksum extension (XTCHECKSUM), \fI\*(xt\fP. +The bits of \*(Ps modify the calculation of the checksum returned by DECRQCRA: + \*0 \(-> do not negate the result. + \*1 \(-> do not report the VT100 video attributes. + \*2 \(-> do not omit checksum for blanks. + \*3 \(-> omit checksum for cells not explicitly initialized. + \*4 \(-> do not mask cell value to 8 bits or ignore combining characters. + \*5 \(-> do not mask cell value to 7 bits. +. +.iP +.IP \\*(Cs\\*(Pi\\*s\\*;\\*(Pg\\*s\\*;\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\**\\*y +Request Checksum of Rectangular Area (DECRQCRA), VT420 and up. +Response is +.br +\*(Dc\*(Pi\*s\*!\*~x\*sx\*sx\*sx\*s\*(ST +.br + \*(Pi is the request id. + \*(Pg is the page number. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. + The x's are hexadecimal digits 0-9 and A-F. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Pu\\*s\\*(qu\\*z +Enable Locator Reporting (DECELR). +.br +Valid values for the first parameter: + \*(Ps = \*0 \(-> Locator disabled (default). + \*(Ps = \*1 \(-> Locator enabled. + \*(Ps = \*2 \(-> Locator enabled for one report, then disabled. +.br +The second parameter specifies the coordinate unit for locator reports. +.br +Valid values for the second parameter: + \*(Pu = \*0 or omitted \(-> default to character cells. + \*(Pu = \*1 \(<- device physical pixels. + \*(Pu = \*2 \(<- character cells. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*$\\*z +Erase Rectangular Area (DECERA), VT400 and up. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. +. +.iP +.IP \\*(Cs\\*(Pm\\*s\\*(qu\\*{ +Select Locator Events (DECSLE). +.br +Valid values for the first (and any additional parameters) are: + \*(Ps = \*0 \(-> only respond to explicit host requests (DECRQLP). +This is default. +It also cancels any filter rectangle. + \*(Ps = \*1 \(-> report button down transitions. + \*(Ps = \*2 \(-> do not report button down transitions. + \*(Ps = \*3 \(-> report button up transitions. + \*(Ps = \*4 \(-> do not report button up transitions. +. +.iP +.IP \\*(Cs\\*#\\*{ +.br +.IP \\*(Cs\\*(Pm\\*s\\*#\\*{ +Push video attributes onto stack (XTPUSHSGR), \fI\*(xt\fP. +The optional parameters correspond to the SGR encoding for video attributes, +except for colors (which do not have a unique SGR code): + \*(Ps = \*1 \(-> Bold. + \*(Ps = \*2 \(-> Faint. + \*(Ps = \*3 \(-> Italicized. + \*(Ps = \*4 \(-> Underlined. + \*(Ps = \*5 \(-> Blink. + \*(Ps = \*7 \(-> Inverse. + \*(Ps = \*8 \(-> Invisible. + \*(Ps = \*9 \(-> Crossed-out characters. + \*(Ps = \*2\*1 \(-> Doubly-underlined. + \*(Ps = \*3\*0 \(-> Foreground color. + \*(Ps = \*3\*1 \(-> Background color. +.iP +.IP +If no parameters are given, all of the video attributes are saved. +The stack is limited to 10 levels. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*$\\*{ +Selective Erase Rectangular Area (DECSERA), VT400 and up. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. +. +.iP +.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*#\\*| +Report selected graphic rendition (XTREPORTSGR), \fI\*(xt\fP. +The response is an SGR sequence which contains the attributes which +are common to all cells in a rectangle. + \*(Pt\*s\*;\*(Pl\*s\*;\*(Pb\*s\*;\*(Pr denotes the rectangle. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*$\\*| +Select columns per page (DECSCPP), VT340. + \*(Ps = \*0 \(-> 80 columns, default if \*(Ps omitted. + \*(Ps = \*8\*0 \(-> 80 columns. + \*(Ps = \*1\*3\*2 \(-> 132 columns. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(qu\\*| +Request Locator Position (DECRQLP). +.br +Valid values for the parameter are: + \*(Ps = \*0, 1 or omitted \(-> transmit a single DECLRP locator report. +.sP +If Locator Reporting has been enabled by a DECELR, \fI\*(xt\fP will respond +with a DECLRP Locator Report. +This report is also generated on button +up and down events if they have been enabled with a DECSLE, or when +the locator is detected outside of a filter rectangle, if filter rectangles +have been enabled with a DECEFR. +.sP + \(<- \*(Cs\*(Pe\*s\*;\*(Pb\*s\*;\*(Pr\*s\*;\*(Pc\*s\*;\*(Pp\*s\*&\*s\*w +.sP +Parameters are [\fIevent\fP;\fIbutton\fP;\fIrow\fP;\fIcolumn\fP;\fIpage\fP]. +.br +Valid values for the event: + \*(Pe = \*0 \(<- locator unavailable - no other parameters sent. + \*(Pe = \*1 \(<- request - \fI\*(xt\fP received a DECRQLP. + \*(Pe = \*2 \(<- left button down. + \*(Pe = \*3 \(<- left button up. + \*(Pe = \*4 \(<- middle button down. + \*(Pe = \*5 \(<- middle button up. + \*(Pe = \*6 \(<- right button down. + \*(Pe = \*7 \(<- right button up. + \*(Pe = \*8 \(<- M4 button down. + \*(Pe = \*9 \(<- M4 button up. + \*(Pe = \*1\*0 \(<- locator outside filter rectangle. +.br +The \*(``\fIbutton\fP\*('' parameter is a bitmask indicating +which buttons are pressed: + \*(Pb = \*0 \(<- no buttons down. + \*(Pb & \*1 \(<- right button down. + \*(Pb & \*2 \(<- middle button down. + \*(Pb & \*4 \(<- left button down. + \*(Pb & \*8 \(<- M4 button down. +.br +The \*(``\fIrow\fP\*('' and \*(``\fIcolumn\fP\*('' parameters +are the coordinates of the locator position in the \fI\*(xt\fP window, +encoded as ASCII decimal. +.br +The \*(``\fIpage\fP\*('' parameter is not used by \*(xt. +.iP +.IP \\*(Cs\\*(Ps\\*s\\**\\*| +Select number of lines per screen (DECSNLS), VT420 and up. +.iP +.IP \\*(Cs\\*#\\*} +Pop video attributes from stack (XTPOPSGR), \fI\*(xt\fP. +Popping restores the video-attributes which were saved using XTPUSHSGR +to their previous state. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(qu\\*} +Insert \*(Ps Column(s) (default = 1) (DECIC), VT420 and up. +. +.iP +.IP \\*(Cs\\*(Ps\\*s\\*(qu\\*~ +Delete \*(Ps Column(s) (default = 1) (DECDC), VT420 and up. +. +.Ed +. +.Ss Operating System Commands +.St +. +.IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be +.iP +.IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(ST +Set Text Parameters. +Some control sequences return information: +.RS +.bP +For colors and font, +if \*(Pt is a \*(``?\*('', +the control sequence elicits a response which consists +of the control sequence which would set the corresponding value. +.bP +The \fIdtterm\fP control sequences allow you to determine the icon name +and window title. +.RE +.sP +\*(XT accepts either \*(Be or \*(ST for terminating \*(Os sequences, +and when returning information, uses the same terminator used in a query. +While the latter is preferred, +the former is supported for legacy applications: +.RS +.bP +Although documented in the changes for X.V10R4 (December 1986), +\*(Be as a string terminator dates from X11R4 (December 1989). +.bP +Since XFree86-3.1.2Ee (August 1996), \*(xt has accepted \*(ST +(the documented string terminator in ECMA-48). +.RE +.sP +\*(Ps specifies the type of operation to perform: + \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt. + \*(Ps = \*1 \(-> Change Icon Name to \*(Pt. + \*(Ps = \*2 \(-> Change Window Title to \*(Pt. + \*(Ps = \*3 \(-> Set X property on top-level window. +\*(Pt should be in the form +\*(``\fIprop=value\fP\*('', or just +\*(``\fIprop\fP\*('' to delete the property. + \*(Ps = \*4\*;\fIc\fP\*s\*;\fIspec\fP \(-> Change Color Number \fIc\fP to +the color specified by \fIspec\fP. +This can be a name or RGB specification as per \fIXParseColor\fP. +Any number of \fIc\fP/\fIspec\fP pairs may be given. +The color numbers correspond to the ANSI colors 0-7, +their bright versions 8-15, +and if supported, the remainder of the 88-color or 256-color table. +.sP +If a \*(``?\*('' is given rather than a name or RGB specification, +\fI\*(xt\fP replies with a control sequence of the same form which can be used +to set the corresponding color. +Because more than one pair of color number and specification can +be given in one control sequence, \fI\*(xt\fR can make more than one reply. +.sP + \*(Ps = \*5\*;\fIc\fP\*s\*;\fIspec\fP \(-> Change Special Color Number \fIc\fP to +the color specified by \fIspec\fP. +This can be a name or RGB specification as per \fIXParseColor\fP. +Any number of \fIc\fP/\fIspec\fP pairs may be given. +The special colors can also be set by adding the maximum number of colors +to these codes in an \*(Os\*4 control: +.sP +.in +2n + \*(Pc = \*0 \(<- resource \fBcolorBD\fP (BOLD). + \*(Pc = \*1 \(<- resource \fBcolorUL\fP (UNDERLINE). + \*(Pc = \*2 \(<- resource \fBcolorBL\fP (BLINK). + \*(Pc = \*3 \(<- resource \fBcolorRV\fP (REVERSE). + \*(Pc = \*4 \(<- resource \fBcolorIT\fP (ITALIC). +.in -2n +.sP + \*(Ps = \*6\*;\fIc\fP\*s\*;\fIf\fP \(-> Enable/disable Special Color Number \fIc\fP. +The second parameter tells \fI\*(xt\fP to enable the corresponding color +mode if nonzero, disable it if zero. +\*(Os\*6 is the same as \*(Os\*1\*0\*6. +.sP +The 10 colors (below) which may be set or queried +using \*1\*0 through \*1\*9 are +denoted \fIdynamic colors\fR, since the corresponding control sequences +were the first means for setting \fI\*(xt\fR's colors dynamically, +i.e., after it was started. +They are not the same as the ANSI colors +(however, the dynamic text foreground and background colors +are used when ANSI colors are reset using SGR \*3\*9 and \*4\*9, respectively). +These controls may be disabled using the \fBallowColorOps\fP resource. +At least one parameter is expected for \*(Pt. +Each successive parameter changes the next color in the list. +The value of \*(Ps tells the starting point in the list. +The colors are specified by name or RGB specification as per \fIXParseColor\fP. +.sP +If a \*(``?\*('' is given rather than a name or RGB specification, +\fI\*(xt\fP replies with a control sequence of the same form which can be used +to set the corresponding dynamic color. +Because more than one pair of color number and specification can +be given in one control sequence, \fI\*(xt\fR can make more than one reply. +.sP + \*(Ps = \*1\*0 \(-> Change VT100 text foreground color to \*(Pt. + \*(Ps = \*1\*1 \(-> Change VT100 text background color to \*(Pt. + \*(Ps = \*1\*2 \(-> Change text cursor color to \*(Pt. + \*(Ps = \*1\*3 \(-> Change pointer foreground color to \*(Pt. + \*(Ps = \*1\*4 \(-> Change pointer background color to \*(Pt. + \*(Ps = \*1\*5 \(-> Change Tektronix foreground color to \*(Pt. + \*(Ps = \*1\*6 \(-> Change Tektronix background color to \*(Pt. + \*(Ps = \*1\*7 \(-> Change highlight background color to \*(Pt. + \*(Ps = \*1\*8 \(-> Change Tektronix cursor color to \*(Pt. + \*(Ps = \*1\*9 \(-> Change highlight foreground color to \*(Pt. +.sP + \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt. +This is normally disabled by a compile-time option. +.sP + \*(Ps = \*5\*0 \(-> Set Font to \*(Pt. +These controls may be disabled using the \fBallowFontOps\fP resource. +If \*(Pt begins with a \*(``#\*('', index in the font menu, relative (if the +next character is a plus or minus sign) or absolute. +A number is +expected but not required after the sign (the default is the current +entry for relative, zero for absolute indexing). +.sP +The same rule (plus or minus sign, optional number) is used when +querying the font. +The remainder of \*(Pt is ignored. +.sP +A font can be specified after a \*(``#\*('' index expression, +by adding a space and then the font specifier. +.sP +If the \fBTrueType Fonts\fP menu entry is set (the \fBrenderFont\fP resource), +then this control sets/queries the \fBfaceName\fP resource. +.sP + \*(Ps = \*5\*1 \(-> reserved for Emacs shell. +.sP + \*(Ps = \*5\*2 \(-> Manipulate Selection Data. +These controls may be disabled using the \fBallowWindowOps\fP resource. +The parameter \*(Pt is parsed as +.br + \*(Pc\*s\*;\*(Pd +.br +The first, \*(Pc, may contain zero or more characters from the +set \*c, \*p, \*q, \*(cs, \*0, \*1, \*2, \*3, \*4, \*5, \*6, and \*7. +It is used to construct a list of selection parameters for +clipboard, +primary, +secondary, +select, +or cut buffers 0 through 7 respectively, +in the order given. +If the parameter is empty, \fI\*(xt\fP uses \*(cs\*0, +to specify the configurable primary/clipboard selection and cut buffer 0. +.sP +The second parameter, \*(Pd, gives the selection data. +Normally this is a string encoded in base64 (RFC-4648). +The data becomes the new selection, +which is then available for pasting by other applications. +.sP +If the second parameter is a \*?, +\fI\*(xt\fP replies to the host with the selection +data encoded using the same protocol. +It uses the first selection +found by asking successively +for each item from the list of selection parameters. +.sP +If the second parameter is neither a base64 string nor \*?, +then the selection is cleared. +.sP + \*(Ps = \*1\*0\*4\*;\fIc\fP \(-> Reset Color Number \fIc\fP. It is reset to +the color specified by the corresponding X resource. +Any number of \fIc\fP parameters may be given. +These parameters correspond to the ANSI colors 0-7, +their bright versions 8-15, +and if supported, the remainder of the 88-color or 256-color table. +If no parameters are given, the entire table will be reset. +.sP + \*(Ps = \*1\*0\*5\*;\fIc\fP \(-> Reset Special Color Number \fIc\fP. +It is reset to the color specified by the corresponding X resource. +Any number of \fIc\fP parameters may be given. +These parameters correspond to the special colors which can be set +using an \*(Os\*5 control (or by adding the maximum number of colors +using an \*(Os\*4 control). +.sP + \*(Ps = \*1\*0\*6\*;\fIc\fP\*s\*;\fIf\fP \(-> Enable/disable Special Color Number \fIc\fP. +The second parameter tells \fI\*(xt\fP to enable the corresponding color +mode if nonzero, disable it if zero. +.sP +.in +2n + \*(Pc = \*0 \(<- resource \fBcolorBDMode\fP (BOLD). + \*(Pc = \*1 \(<- resource \fBcolorULMode\fP (UNDERLINE). + \*(Pc = \*2 \(<- resource \fBcolorBLMode\fP (BLINK). + \*(Pc = \*3 \(<- resource \fBcolorRVMode\fP (REVERSE). + \*(Pc = \*4 \(<- resource \fBcolorITMode\fP (ITALIC). + \*(Pc = \*5 \(<- resource \fBcolorAttrMode\fP (Override ANSI). +.in -2n +.sP +The \fIdynamic colors\fR can also be reset to their default (resource) values: + \*(Ps = \*1\*1\*0 \(-> Reset VT100 text foreground color. + \*(Ps = \*1\*1\*1 \(-> Reset VT100 text background color. + \*(Ps = \*1\*1\*2 \(-> Reset text cursor color. + \*(Ps = \*1\*1\*3 \(-> Reset pointer foreground color. + \*(Ps = \*1\*1\*4 \(-> Reset pointer background color. + \*(Ps = \*1\*1\*5 \(-> Reset Tektronix foreground color. + \*(Ps = \*1\*1\*6 \(-> Reset Tektronix background color. + \*(Ps = \*1\*1\*7 \(-> Reset highlight color. + \*(Ps = \*1\*1\*8 \(-> Reset Tektronix cursor color. + \*(Ps = \*1\*1\*9 \(-> Reset highlight foreground color. +.sP + \*(Ps = \*I\*s\*;\fIc\fP \(-> Set icon to file. +Sun shelltool, CDE dtterm. +.br +The file is expected to be XPM format, +and uses the same search logic as the \fBiconHint\fP resource. +.sP + \*(Ps = \*l\*s\*;\fIc\fP \(-> Set window title. +Sun shelltool, CDE dtterm. +.sP + \*(Ps = \*L\*s\*;\fIc\fP \(-> Set icon label. +Sun shelltool, CDE dtterm. +.Ed +. +.Ss Privacy Message +.St +.IP \\*(PM\\*(Pt\\*s\\*(ST +\fI\*(xt\fP implements no \*(PM functions; \*(Pt is ignored. +\*(Pt need not be printable characters. +.Ed +. +.Sh "Alt and Meta Keys" +.LP +Many keyboards have keys labeled \*(``Alt\*(''. +Few have keys labeled \*(``Meta\*(''. +However, \fI\*(xt\fP's default translations use the \fIMeta\fP modifier. +Common keyboard configurations assign the \fIMeta\fP modifier +to an \*(``Alt\*('' key. +By using \fIxmodmap\fP one may have the modifier assigned to a different key, +and have \*(``real\*('' alt and meta keys. +Here is an example: +.ID +.ft CW +! put meta on mod3 to distinguish it from alt +keycode 64 = Alt_L +clear mod1 +add mod1 = Alt_L +keycode 115 = Meta_L +clear mod3 +add mod3 = Meta_L +.ft 1 +.DE +.LP +The \fBmetaSendsEscape\fP resource +(and \fBaltSendsEscape\fP if \fBaltIsNotMeta\fP is set) +can be used to control the way the \fIMeta\fP modifier applies to ordinary +keys unless the \fBmodifyOtherKeys\fP resource is set: +.bP +prefix a key with the \*(Es character. +.bP +shift the key from codes 0-127 to 128-255 by adding 128. +.LP +When \fBmodifyOtherKeys\fP is set, +ordinary keys may be sent as escape sequences: +.bP +When \fBmodifyOtherKeys\fP is set to 1, +only the alt- and meta-modifiers apply. +For example, \fIalt-Tab\fP sends +\*(Cs\*2\*7\*;\*3\*;\*9\*~ +(the second parameter is \*(``3\*('' for \fIalt\fP, +and the third parameter is the ASCII value of tab, \*(``9\*(''). +.bP +When \fBmodifyOtherKeys\fP is set to 2, +all of the modifiers apply. +For example, \fIshift-Tab\fP sends +\*(Cs\*2\*7\*;\*2\*;\*9\*~ +rather than +\*(Cs\*Z +(the second parameter is \*(``2\*('' for \fIshift\fP). +.LP +The \fBformatOtherKeys\fP resource tells \fI\*n\fP to change the +format of the escape sequences sent when \fBmodifyOtherKeys\fP applies. +When \fBmodifyOtherKeys\fP is set to 1, +for example \fIalt-Tab\fP sends +\*(Cs\*9\*;\*3\*u +(changing the order of parameters). +One drawback to this format is that applications may confuse it with +\*(Cs\*u (restore-cursor). +.LP +The \fI\*(xt\fP FAQ sections +.br +.ID 3 +.\" https://invisible-island.net/xterm/xterm.faq.html#xterm_modother +\fIHow can my program distinguish control-I from tab?\fP +.ID 3 +.\" https://invisible-island.net/xterm/modified-keys.html +\fIXTerm - \*(``Other\*('' Modified Keys\fP +.DE +.br +go into greater detail on this topic. +.LP +The table shows the result for a given character \*(``x\*('' with modifiers +according to the default translations with the resources set on or off. +This assumes \fBaltIsNotMeta\fP is set: +.\" page-eject to work around grohtml bugs +.if t .bp +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) . +_ +.TH +.T& +l | l | l | l . +key altSendsEscape metaSendsEscape result +_ +x off off x +Meta-x off off shift +Alt-x off off shift +Alt+Meta-x off off shift +x ON off x +Meta-x ON off shift +Alt-x ON off \*(Es x +Alt+Meta-x ON off \*(Es shift +x off ON x +Meta-x off ON \*(Es x +Alt-x off ON shift +Alt+Meta-x off ON \*(Es shift +x ON ON x +Meta-x ON ON \*(Es x +Alt-x ON ON \*(Es x +Alt+Meta-x ON ON \*(Es x +_ +.TE +.Sh "PC-Style Function Keys" +.LP +If \fI\*(xt\fP does minimal translation of the function keys, +it usually does this +with a PC-style keyboard, so PC-style function keys result. +Sun keyboards are similar to PC keyboards. +Both have cursor and scrolling operations printed on the keypad, +which duplicate the smaller cursor and scrolling keypads. +.LP +X does not predefine NumLock (used for VT220 keyboards) or Alt (used as +an extension for the Sun/PC keyboards) as modifiers. +These keys are recognized as modifiers when enabled +by the \fBnumLock\fP resource, +or by the \*(``DECSET \*1\*0\*3\*5\*('' control sequence. +.LP +The cursor keys transmit the following escape sequences depending on the +mode specified via the DECCKM escape sequence. +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) . +Key Normal Application +_ +.TH +.T& +l | l | l . +Cursor Up \*(Cs\*A \*(S3\*A +Cursor Down \*(Cs\*(cB \*(S3\*(cB +Cursor Right \*(Cs\*C \*(S3\*C +Cursor Left \*(Cs\*D \*(S3\*D +_ +.TE +The home- and end-keys +(unlike PageUp and other keys also on the 6-key editing keypad) +are considered \*(``cursor keys\*('' by \fI\*(xt\fP. +Their mode is also controlled by the DECCKM escape sequence: +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) . +Key Normal Application +_ +.TH +.T& +l | l | l . +Home \*(Cs\*H \*(S3\*H +End \*(Cs\*F \*(S3\*F +_ +.TE +.LP +The application keypad transmits the following escape sequences depending on the +mode specified via the DECKPNM and DECKPAM escape sequences. +Use the NumLock key to override the application mode. +.LP +Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), +but are supported by +the program. +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) . +Key Numeric Application Terminfo Termcap +_ +.TH +.T& +l | l | l | l | l . +Space \*(Sp \*(S3\*(Sp - - +Tab \*(Ta \*(S3\*I - - +Enter \*(Cr \*(S3\*M kent @8 +PF1 \*(S3\*P \*(S3\*P kf1 k1 +PF2 \*(S3\*Q \*(S3\*Q kf2 k2 +PF3 \*(S3\*R \*(S3\*R kf3 k3 +PF4 \*(S3\*S \*(S3\*S kf4 k4 +* \f1(multiply)\fP \** \*(S3\*j - - ++ \f1(add)\fP \*+ \*(S3\*k - - +, \f1(comma)\fP \*, \*(S3\*l - - +- \f1(minus)\fP \*- \*(S3\*m - - +\&. \f1(Delete)\fP \*. \*(Cs\*3\*~ - - +/ \f1(divide)\fP \*/ \*(S3\*o - - +0 \f1(Insert)\fP \*0 \*(Cs\*2\*~ - - +1 \f1(End)\fP \*1 \*(S3\*F kc1 K4 +2 \f1(DownArrow)\fP \*2 \*(Cs\*(cB - - +3 \f1(PageDown)\fP \*3 \*(Cs\*6\*~ kc3 K5 +4 \f1(LeftArrow)\fP \*4 \*(Cs\*D - - +5 \f1(Begin)\fP \*5 \*(Cs\*E kb2 K2 +6 \f1(RightArrow)\fP \*6 \*(Cs\*C - - +7 \f1(Home)\fP \*7 \*(S3\*H ka1 K1 +8 \f1(UpArrow)\fP \*8 \*(Cs\*A - - +9 \f1(PageUp)\fP \*9 \*(Cs\*5\*~ ka3 K3 += (equal) \*= \*(S3\*(XX - - +_ +.TE +.br +They also provide 12 function keys, as well as a few other special-purpose keys: +.TS H +center; +lf3w(2c) lf3w(2c) . +Key Escape Sequence +_ +.TH +.T& +l | l . +F1 \*(S3\*P +F2 \*(S3\*Q +F3 \*(S3\*R +F4 \*(S3\*S +F5 \*(Cs\*1\*5\*~ +F6 \*(Cs\*1\*7\*~ +F7 \*(Cs\*1\*8\*~ +F8 \*(Cs\*1\*9\*~ +F9 \*(Cs\*2\*0\*~ +F10 \*(Cs\*2\*1\*~ +F11 \*(Cs\*2\*3\*~ +F12 \*(Cs\*2\*4\*~ +_ +.TE +.sP +Note that F1 through F4 are prefixed with \*(S3, +while the other keys are prefixed with \*(Cs. +Older versions of \fI\*(xt\fP implement different escape sequences +for F1 through F4, with a \*(Cs prefix. +These can be activated by setting the \fBoldXtermFKeys\fP resource. +However, since they do not correspond to any hardware terminal, +they have been deprecated. +(The DEC VT220 reserves F1 through F5 for local functions such as \fISetup\fP). +.TS H +center; +lf3w(2c) lf3w(2c) . +Key Escape Sequence +_ +.TH +.T& +l | l . +F1 \*(Cs\*1\*1\*~ +F2 \*(Cs\*1\*2\*~ +F3 \*(Cs\*1\*3\*~ +F4 \*(Cs\*1\*4\*~ +_ +.TE +In normal mode, i.e., a Sun/PC keyboard +when the \fBsunKeyboard\fP resource is false +(and none of the other keyboard resources +such as \fBoldXtermFKeys\fP resource is set), +\fI\*(xt\fP encodes function key modifiers +as parameters appended before the \fIfinal\fP character of the control sequence. +As a special case, +the \*(S3 sent before F1 through F4 is altered to \*(Cs when sending +a function key modifier as a parameter. +.TS H +center; +cf3w(2c) lf3w(2c) . +Code Modifiers +_ +.TH +.T& +c | l . +2 Shift +3 Alt +4 Shift + Alt +5 Control +6 Shift + Control +7 Alt + Control +8 Shift + Alt + Control +9 Meta +10 Meta + Shift +11 Meta + Alt +12 Meta + Alt + Shift +13 Meta + Ctrl +14 Meta + Ctrl + Shift +15 Meta + Ctrl + Alt +16 Meta + Ctrl + Alt + Shift +_ +.TE +For example, shift-F5 would be sent as +\*(Cs\*1\*5\*;\*2\*~ +.LP +If the \fBalwaysUseMods\fP resource is set, the Meta modifier also is +recognized, making parameters 9 through 16. +.LP +The codes used for the \fIPC-style function keys\fP were inspired +by a feature of the VT510, referred to in its reference manual as DECFNK. +In the DECFNK scheme, codes 2-8 identify modifiers for function-keys +and cursor-, editing-keypad keys. +Unlike \fI\*(xt\fP, the VT510 limits the modifiers which can be used +with cursor- and editing-keypad keys. +Although the name \*(``DECFNK\*('' implies that it is a mode, +the VT510 manual mentions it only as a feature, +which (like \fI\*(xt\fP) interacts with the DECUDK feature. +Unlike \fI\*(xt\fP, VT510/VT520 provide an extension to DECUDK +(DECPFK and DECPAK) +which apparently was the reason for the feature in those terminals, +i.e., for identifying a programmable key +rather than making it simple for applications to obtain modifier information. +It is not described in the related VT520 manual. +Neither manual was readily available +at the time the feature was added to \fI\*(xt\fP. +.LP +On the other hand, the VT510 and VT520 reference manuals +do document a related feature. +That is its emulation of the SCO console, +which is similar to the \*(``xterm-sco\*('' terminal description. +The SCO console function-keys are less useful to +applications developers than the approach used by \fI\*(xt\fP because +.bP +the relationship between modifiers and the characters sent by function-keys +is not readily apparent, and +.bP +the scheme is not extensible, i.e., it is an \fIad hoc\fP +assignment limited to two modifiers (\fIshift\fP and \fIcontrol\fP). +.Sh "VT220-Style Function Keys" +.LP +However, \fI\*(xt\fP is most useful as a DEC VT102 or VT220 emulator. +Set the \fBsunKeyboard\fP resource to true to force a Sun/PC keyboard +to act like a VT220 keyboard. +.LP +The VT102/VT220 application keypad transmits unique escape sequences in +application mode, which are distinct from the cursor and scrolling keypad: +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) . +Key Numeric Application VT100? +_ +.TH +.T& +l | l | l | l . +Space \*(Sp \*(S3\*(Sp no +Tab \*(Ta \*(S3\*I no +Enter \*(Cr \*(S3\*M yes +PF1 \*(S3\*P \*(S3\*P yes +PF2 \*(S3\*Q \*(S3\*Q yes +PF3 \*(S3\*R \*(S3\*R yes +PF4 \*(S3\*S \*(S3\*S yes +* \f1(multiply)\fP \** \*(S3\*j no ++ \f1(add)\fP \*+ \*(S3\*k no +, \f1(comma)\fP \*, \*(S3\*l yes +- \f1(minus)\fP \*- \*(S3\*m yes +\&. \f1(period)\fP \*. \*(S3\*n yes +/ \f1(divide)\fP \*/ \*(S3\*o no +0 \*0 \*(S3\*p yes +1 \*1 \*(S3\*q yes +2 \*2 \*(S3\*r yes +3 \*3 \*(S3\*(cs yes +4 \*4 \*(S3\*t yes +5 \*5 \*(S3\*u yes +6 \*6 \*(S3\*v yes +7 \*7 \*(S3\*w yes +8 \*8 \*(S3\*x yes +9 \*9 \*(S3\*y yes += (equal) \*= \*(S3\*(XX no +_ +.TE +.LP +The VT100/VT220 keypad did not have all of those keys. +They were implemented in \fI\*(xt\fP in X11R1 (1987), +defining a mapping of all X11 keys which might be provided on a keypad. +For instance, a Sun4/II type-4 keyboard provided +\*(``=\*('' (equal), +\*(``/\*('' (divide), and +\*(``*\*('' (multiply). +.LP +While the VT420 provided the same keypad, +the VT520 used a PC-keyboard. +Because that keyboard's keypad lacks the \*(``,\*('' (comma), +it was not possible to use EDT's delete-character function with the keypad. +\fI\*(XT\fP solves that problem for the VT220-keyboard configuration +by mapping +.sP + \fICtrl\fP \*+ to \*, and + \fICtrl\fP \*- to \*- +.LP +The VT220 provides a 6-key editing keypad, +which is analogous to that on the PC keyboard. +It is not affected by DECCKM or DECKPNM/DECKPAM: +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) . +Key Normal Application +_ +.TH +.T& +l | l | l . +\f1Insert\fP \*(Cs\*2\*~ \*(Cs\*2\*~ +\f1Delete\fP \*(Cs\*3\*~ \*(Cs\*3\*~ +\f1Home\fP \*(Cs\*1\*~ \*(Cs\*1\*~ +\f1End\fP \*(Cs\*4\*~ \*(Cs\*4\*~ +\f1PageUp\fP \*(Cs\*5\*~ \*(Cs\*5\*~ +\f1PageDown\fP \*(Cs\*6\*~ \*(Cs\*6\*~ +_ +.TE +.LP +The VT220 provides 8 additional function keys. +With a Sun/PC keyboard, access these keys by Control/F1 for F13, etc. +.TS H +center; +lf3w(2c) lf3w(2c) . +Key Escape Sequence +_ +.TH +.T& +l | l . +F13 \*(Cs\*2\*5\*~ +F14 \*(Cs\*2\*6\*~ +F15 \*(Cs\*2\*8\*~ +F16 \*(Cs\*2\*9\*~ +F17 \*(Cs\*3\*1\*~ +F18 \*(Cs\*3\*2\*~ +F19 \*(Cs\*3\*3\*~ +F20 \*(Cs\*3\*4\*~ +_ +.TE +.Sh "VT52-Style Function Keys" +.LP +A VT52 does not have function keys, +but it does have a numeric keypad and cursor keys. +They differ from the other emulations by the prefix. +Also, the cursor keys do not change: +.TS H +center; +lf3w(2c) lf3w(2c) . +Key Normal/Application +_ +.TH +.T& +l | l . +Cursor Up \*(Es\*A +Cursor Down \*(Es\*(cB +Cursor Right \*(Es\*C +Cursor Left \*(Es\*D +_ +.TE +The keypad is similar: +.TS H +center; +lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) . +Key Numeric Application VT52? +_ +.TH +.T& +l | l | l | l . +Space \*(Sp \*(Es\*?\*(Sp no +Tab \*(Ta \*(Es\*?\*I no +Enter \*(Cr \*(Es\*?\*M no +PF1 \*(Es\*P \*(Es\*P yes +PF2 \*(Es\*Q \*(Es\*Q yes +PF3 \*(Es\*R \*(Es\*R yes +PF4 \*(Es\*S \*(Es\*S no +* \f1(multiply)\fP \** \*(Es\*?\*j no ++ \f1(add)\fP \*+ \*(Es\*?\*k no +, \f1(comma)\fP \*, \*(Es\*?\*l no +- \f1(minus)\fP \*- \*(Es\*?\*m no +\&. \f1(period)\fP \*. \*(Es\*?\*n yes +/ \f1(divide)\fP \*/ \*(Es\*?\*o no +0 \*0 \*(Es\*?\*p yes +1 \*1 \*(Es\*?\*q yes +2 \*2 \*(Es\*?\*r yes +3 \*3 \*(Es\*?\*(cs yes +4 \*4 \*(Es\*?\*t yes +5 \*5 \*(Es\*?\*u yes +6 \*6 \*(Es\*?\*v yes +7 \*7 \*(Es\*?\*w yes +8 \*8 \*(Es\*?\*x yes +9 \*9 \*(Es\*?\*y yes += (equal) \*= \*(Es\*?\*(XX no +_ +.TE +.Sh "Sun-Style Function Keys" +.LP +The \fI\*(xt\fP program provides support for Sun keyboards more directly, by +a menu toggle that causes it to send Sun-style function key codes +rather than VT220. +Note, however, that the \fIsun\fP and \fIVT100\fP emulations are not really +compatible. +For example, their wrap-margin behavior differs. +.LP +Only function keys are altered; keypad and cursor keys are the same. +The emulation responds identically. +See the xterm-sun terminfo entry for details. +.Sh "HP-Style Function Keys" +.LP +Similarly, \fI\*(xt\fP can be compiled to support HP keyboards. +See the xterm-hp terminfo entry for details. +.Sh "The Alternate Screen Buffer" +.LP +\fI\*(XT\fP maintains two screen buffers. +The Normal Screen Buffer allows you to scroll back to view saved lines +of output up to the maximum set by the \fBsaveLines\fP resource. +The \fIAlternate Screen Buffer\fP is exactly as large as the display, +contains no additional saved lines. +When the \fIAlternate Screen Buffer\fP is active, +you cannot scroll back to view saved lines. +\fI\*(XT\fP provides control sequences and menu entries +for switching between the two. +.LP +Most full-screen applications use terminfo or termcap to obtain +strings used to start/stop full-screen mode, +i.e., \fIsmcup\fP and \fIrmcup\fP for terminfo, +or the corresponding \fIti\fP and \fIte\fP for termcap. +The \fBtiteInhibit\fP resource removes the \fIti\fP and \fIte\fP strings +from the TERMCAP string which is set in the environment for some platforms. +That is not done when \fI\*(xt\fP is built with terminfo libraries because +terminfo does not provide the whole text of the termcap data in one piece. +It would not work for terminfo anyway, since terminfo data is not passed +in environment variables; +setting an environment variable in this manner would have no effect on +the application's ability to switch +between \fINormal\fP and \fIAlternate Screen\fP buffers. +Instead, the newer private mode controls +(such as \*1\*0\*4\*9) +for switching between \fINormal\fP +and \fIAlternate Screen\fP buffers simply disable the switching. +They add other features such as clearing the display for the same reason: +to make the details of switching independent of the application that +requests the switch. +. +.Sh "Bracketed Paste Mode" +.LP +When bracketed paste mode is set, +pasted text is bracketed with control sequences +so that the program can differentiate pasted text from typed-in text. +When bracketed paste mode is set, +the program will receive: + \*(Es\*([[\*2\*0\*0\*~, +.br +followed by the pasted text, followed by + \*(Es\*([[\*2\*0\*1\*~. +. +.Sh "Title Modes" +.LP +The window- and icon-labels can be set or queried using control sequences. +As a VT220-emulator, \fI\*(xt\fP \*(``should\*('' limit +the character encoding for +the corresponding strings to ISO-8859-1. +Indeed, it used to be the case (and was documented) that +window titles had to be ISO-8859-1. +This is no longer the case. +However, there are many applications which still assume that titles are +set using ISO-8859-1. +So that is the default behavior. +.LP +If \fI\*(xt\fP is running with UTF-8 encoding, +it is possible to use window- and icon-labels encoded using UTF-8. +That is because the underlying X libraries (and many, but not all) +window managers support this feature. +.LP +The \fButf8Title\fP X resource setting tells \fI\*(xt\fP to disable +a reconversion of the title string back to ISO-8859-1, +allowing the title strings to be interpreted as UTF-8. +The same feature can be enabled using the title mode control sequence +described in this summary. +.LP +Separate from the ability to set the titles, +\fI\*(xt\fP provides the ability to query the titles, +returning them either in ISO-8859-1 or UTF-8. +This choice is available only while \fI\*(xt\fP is using UTF-8 encoding. +.LP +Finally, the characters sent to, or returned by a title control +are less constrained than the rest of the control sequences. +To make them more manageable (and constrained), for use in shell scripts, +\fI\*(xt\fP has an optional feature which decodes the string from hexadecimal +(for setting titles) or for encoding the title into hexadecimal when querying +the value. +. +.Sh "Mouse Tracking" +.LP +The VT widget can be set to send the mouse position and other +information on button presses. +These modes are typically used by +editors and other full-screen applications that want to make use of +the mouse. +.LP +There are two sets of mutually exclusive modes: +.bP +mouse protocol +.bP +protocol encoding +.LP +The mouse protocols include +DEC Locator mode, enabled by the +DECELR \*(Cs\*(Ps\*s\*;\*(Ps\*s\*(qu\*s\*z +control sequence, and is not described here +(control sequences are summarized above). +The remaining five modes of the mouse protocols +are each enabled (or disabled) by a different parameter in +the +\*(``DECSET \*(Cs\*?\*(Pm\*s\*h\*('' +or +\*(``DECRST \*(Cs\*?\*(Pm\*s\*l\*('' +control sequence. +.LP +Manifest constants for the parameter values +are defined in \fIxcharmouse.h\fP as follows: +. +.ID +.ft CW +#define SET_X10_MOUSE 9 +#define SET_VT200_MOUSE 1000 +#define SET_VT200_HIGHLIGHT_MOUSE 1001 +#define SET_BTN_EVENT_MOUSE 1002 +#define SET_ANY_EVENT_MOUSE 1003 +.sP +#define SET_FOCUS_EVENT_MOUSE 1004 +.sP +#define SET_ALTERNATE_SCROLL 1007 +.sP +#define SET_EXT_MODE_MOUSE 1005 +#define SET_SGR_EXT_MODE_MOUSE 1006 +#define SET_URXVT_EXT_MODE_MOUSE 1015 +#define SET_PIXEL_POSITION_MOUSE 1016 +.ft 1 +.DE +.br +The motion reporting modes are strictly \fI\*(xt\fP extensions, and are not +part of any standard, though they are analogous to the DEC VT200 DECELR +locator reports. +.LP +Normally, +parameters (such as pointer position and button number) for all mouse +tracking escape sequences generated by \fI\*(xt\fP +encode numeric parameters in a single character as +\fIvalue\fP+32. +For example, \*! specifies the value 1. +The upper left character position on the terminal is denoted as 1,1. +This scheme dates back to X10, +though the normal mouse-tracking (from X11) is more elaborate. +.Ss X10 compatibility mode +.LP +X10 compatibility mode sends an escape sequence only on button press, +encoding the location and the mouse button pressed. +It is enabled by specifying parameter 9 to DECSET. +On button press, \fI\*(xt\fP sends +\*(Cs\*M\*(Cb\*(Cx\*(Cy (6 characters). +.bP +\*(Cb is \fIbutton\fP\-1, where \fIbutton\fP is 1, 2 or 3. +.bP +\*(Cx and \*(Cy are the \fIx\fP and \fIy\fP coordinates of the mouse when the +button was pressed. +.Ss Normal tracking mode +.LP +Normal tracking mode sends an escape sequence on both button press and +release. +Modifier key (shift, ctrl, meta) information is also sent. +It is enabled by specifying parameter 1000 to DECSET. +On button press or release, \fI\*(xt\fP sends +\*(Cs\*M\*(Cb\*(Cx\*(Cy. +.bP +The low two bits of \*(Cb encode button information: +0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. +.bP +The next three bits encode the modifiers which were down when the button was +pressed and are added together: 4=Shift, 8=Meta, 16=Control. +Note however that the shift and control bits are normally unavailable +because \fI\*(xt\fP uses the control modifier with mouse for popup menus, +and the shift modifier is used in the default translations for button events. +The \fIMeta\fP modifier recognized by \fI\*(xt\fP is the \fImod1\fP mask, +and is not necessarily the \*(``Meta\*('' key (see \fBxmodmap\fP(1)). +.bP +\*(Cx and \*(Cy are the x and y coordinates of the mouse event, encoded as +in X10 mode. +.Ss Wheel mice +.LP +Wheel mice may return buttons 4 and 5. +Those buttons are represented by the same event codes +as buttons 1 and 2 respectively, +except that 64 is added to the event code. +Release events for the wheel buttons are not reported. +.LP +By default, +the wheel mouse events (buttons 4 and 5) +are translated to \fIscroll-back\fP +and \fIscroll-forw\fP actions, respectively. +Those actions normally scroll the whole window, +as if the scrollbar was used. +.LP +However if \fIAlternate Scroll\fP mode is set, +then cursor up/down controls are sent when the terminal is displaying +the \fIAlternate Screen Buffer\fP. +The initial state of \fIAlternate Scroll\fP mode is set +using the \fBalternateScroll\fP resource. +.Ss Other buttons +.LP +Some wheel mice can send additional button events, +e.g., by tilting the scroll wheel left and right. +.LP +Additional buttons are encoded like the wheel mice, +.bP +by adding 64 (for buttons 6 and 7), or +.bP +by adding 128 (for buttons 8 through 11). +.LP +Past button 11, the encoding is ambiguous because the same code +may correspond to different button/modifier combinations. +.LP +It is not possible to use these buttons (6-11) in \fI\*(xt\fP's +\fBtranslations\fP resource because their names are not in the X Toolkit's +symbol table. +However, applications can check for the reports, e.g., +button 7 (left) and button 6 (right) with a Logitech mouse. +.Ss Highlight tracking +.LP +Mouse highlight tracking notifies a program of a button press, receives a +range of lines from the program, highlights the region covered by +the mouse within that range until button release, and then sends the +program the release coordinates. +It is enabled by specifying parameter 1001 to DECSET. +Highlighting is performed only for button 1, though other button events +can be received. +.sP +\fBWarning\fP: +this mode requires a cooperating program, else \fI\*(xt\fP will hang. +.LP +On button press, the same information as for normal tracking is +generated; \fI\*(xt\fP then waits for the program to send mouse +tracking information. +\fIAll X events are ignored until the proper escape sequence is\fP +\fIreceived from the pty:\fP +.br +\*(Cs\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*T +.LP +The parameters are \fIfunc, startx, starty, firstrow,\fP and \fIlastrow\fP: +.bP +\fIfunc\fP is non-zero to initiate highlight tracking and zero to abort. +.bP +\fIstartx\fP and \fIstarty\fP give the starting x and y location for +the highlighted region. +.bP +The ending location tracks the mouse, but +will never be above row \fIfirstrow\fP and will always be above row +\fIlastrow.\fP +(The top of the screen is row 1.) +.LP +When the button is released, \fI\*(xt\fP reports the ending position +one of two ways: +.bP +if the start and end coordinates are the same locations: +.sP +\*(Cs\*t\*(Cx\*(Cy +.bP +otherwise: +.sP +\*(Cs\*T\*(Cx\*(Cy\*(Cx\*(Cy\*(Cx\*(Cy +.LP +The parameters are \fIstartx, starty, endx, endy, mousex,\fP and \fImousey\fP: +.bP +\fIstartx, starty, endx, \fPand\fI endy\fP give the starting and +ending character positions of the region. +.bP +\fImousex\fP and \fImousey\fP +give the location of the mouse at button up, which may not be over a +character. +.Ss Button-event tracking +.LP +Button-event tracking is essentially the same as normal tracking, but +\fI\*(xt\fP also reports button-motion events. +Motion events +are reported only if the mouse pointer has moved to a different character +cell. +It is enabled by specifying parameter 1002 to DECSET. +On button press or release, \fI\*(xt\fP sends the same codes used by normal +tracking mode. +.bP +On button-motion events, \fI\*(xt\fP adds 32 to the event code +(the third character, \*(Cb). +.bP +The other bits of the event code specify +button and modifier keys as in normal mode. +For example, motion into cell x,y with button 1 +down is reported as +.sP +\*(Cs\*M\*@\*(Cx\*(Cy +.sP +(\ \*@ = 32 + 0 (button 1) + 32 (motion indicator)\ ). +Similarly, motion with button 3 +down is reported as +.sP +\*(Cs\*M\*(cB\*(Cx\*(Cy +.sP +(\ \*(cB = 32 + 2 (button 3) + 32 (motion indicator)\ ). +.Ss Any-event tracking +.LP +Any-event mode is the same as button-event mode, except that all motion +events are reported, even if no mouse button is down. +It is enabled by specifying 1003 to DECSET. +.Ss FocusIn/FocusOut +.LP +FocusIn/FocusOut can be combined with any of the mouse events since +it uses a different protocol. +When set, it causes \fI\*(xt\fP to send +\*(Cs\*I when the terminal gains focus, and +\*(Cs\*O when it loses focus. +.Ss Extended coordinates +.LP +The original X10 mouse protocol limits the \*(Cx and \*(Cy ordinates +to 223 (=255\ -\ 32). +\fI\*(XT\fP supports more than one scheme for extending this range, +by changing the protocol encoding: +.IP "UTF-8 (1005)" +This enables UTF-8 encoding for \*(Cx and \*(Cy under +all tracking modes, expanding the maximum encodable position from 223 to 2015. +For positions less than 95, the resulting output is identical under both modes. +Under extended mouse mode, positions greater than 95 +generate \*(``extra\*('' bytes which will confuse +applications which do not treat their input as a UTF-8 stream. +Likewise, \*(Cb will be UTF-8 encoded, +to reduce confusion with wheel mouse events. +.IP +Under normal mouse mode, positions outside (160,94) result in +byte pairs which can be interpreted as a single UTF-8 character; +applications +which do treat their input as UTF-8 will almost certainly be confused +unless extended mouse mode is active. +.IP +This scheme has the drawback that the encoded coordinates will not +pass through \fBluit\fP(1) unchanged, +e.g., for locales using non-UTF-8 encoding. +.IP "SGR (1006)" +The normal mouse response is altered to use +.RS +.bP +\*(Cs\*< +followed by semicolon-separated +.bP +encoded button value, +.bP +\*(Px and \*(Py ordinates and +.bP +a final character which +is \*M for button press +and \*m for button release. +.RE +.IP +The encoded button value in this case does not add 32 since +that was useful only in the X10 scheme for ensuring that the +byte containing the button value is a printable code. +.RS +.bP +The modifiers are encoded in the same way. +.bP +A different final character is used for button release +to resolve the X10 ambiguity regarding which button was released. +.RE +.IP +The highlight tracking responses are also modified to an SGR-like format, +using the same SGR-style scheme and button-encodings. +.IP "URXVT (1015)" +The normal mouse response is altered to use +.RS +.bP +\*(Cs +followed by semicolon-separated +.bP +encoded button value, +.bP +the \*(Px and \*(Py ordinates and final character \*M. +.RE +.IP +This uses the same button encoding as X10, but printing it as +a decimal integer rather than as a single byte. +.IP +However, \*(Cs\*M can be mistaken for DL (delete lines), +while the highlight tracking \*(Cs\*T can be mistaken for SD (scroll down), +and the Window manipulation controls. +For these reasons, the 1015 control is not recommended; +it is not an improvement over 1006. +.IP "SGR-Pixels (1016)" +Use the same mouse response format as the 1006 control, +but report position in \fIpixels\fP rather than character \fIcells\fP. +. +.Sh "Sixel Graphics" +.LP +If \fI\*(xt\fP is configured as +VT240, +VT241, +VT330, +VT340 or +VT382 +using the \fBdecTerminalID\fP resource, +it supports Sixel Graphics controls, a palleted bitmap graphics system +using sets of six vertical pixels as the basic element. +.St +.IP \\*(Cs\\*(Ps\\*s\\*c +Send Device Attributes (Primary DA), \fI\*(xt\fP. +\fI\*(xt\fP responds to Send Device Attributes (Primary DA) with these +additional codes: + \*(Ps = \*4 \(-> Sixel graphics. +.iP +.IP \\*(Cs\\*?\\*(Pm\\*s\\*h +Set Mode, \fI\*(xt\fP. +\fI\*(xt\fP has these additional private Set Mode values: + \*(Ps = \*8\*0 \(-> Sixel scrolling. + \*(Ps = \*1\*0\*7\*0 \(-> use private color registers for each graphic. + \*(Ps = \*8\*4\*5\*2 \(-> Sixel scrolling leaves cursor to right of graphic. +.iP +.IP \\*(Dc\\*(Pa\\*s\\*;\\*(Pb\\*s\\*;\\*(Ph\\*s\\*q\\*s\\*(Ps..\\*(Ps\fP\\*s\\*(ST +Send SIXEL image, DEC graphics terminals, \fI\*(xt\fP. +See: +.ID 3 +\fIVT330/VT340 Programmer Reference Manual Volume 2:\fP +\fIGraphics Programming\fP +.\" https://vt100.net/docs/vt3xx-gp/chapter14.html +\fIChapter 14 Graphics Programming\fP +.DE +The sixel data device control string has three positional parameters, +following the \*q with sixel data. + \*(Pa \(-> pixel aspect ratio + \*(Pb \(-> background color option + \*(Ph \(-> horizontal grid size (ignored). + \*(Ps \(-> sixel data +.Ed +. +.Sh "ReGIS Graphics" +.LP +If \fI\*(xt\fP is configured as +VT125, +VT240, +VT241, +VT330 or +VT340 +using the \fBdecTerminalID\fP resource, +it supports Remote Graphic Instruction Set, a graphics description language. +.St +.IP \\*(Cs\\*(Ps\\*s\\*c +Send Device Attributes (Primary DA), DEC graphics terminals, \fI\*(xt\fP. +\fI\*(xt\fP responds to Send Device Attributes (Primary DA) with these +additional codes: + \*(Ps = \*3 \(-> ReGIS graphics. +.iP +.IP \\*(Cs\\*?\\*(Pm\\*s\\*h +Set Mode, \fI\*(xt\fP. +\fI\*(xt\fP has these additional private Set Mode values: + \*(Ps = \*1\*0\*7\*0 \(-> use private color registers for each graphic. +.iP +.IP \\*(Dc\\*(Pm\\*s\\*p\\*(Pr..\\*(Pr\fP\\*s\\*(ST +Enter or exit ReGIS, VT300, \fI\*(xt\fP. +See: +.ID 3 +\fIVT330/VT340 Programmer Reference Manual Volume 2:\fP +\fIGraphics Programming\fP +.\" https://vt100.net/docs/vt3xx-gp/chapter1.html +\fIChapter 1 Introduction to ReGIS\fP +.DE +The ReGIS data device control string has one positional parameter +with four possible values: + \*(Pm = 0 \(-> resume command, use fullscreen mode. + \*(Pm = 1 \(-> start new command, use fullscreen mode. + \*(Pm = 2 \(-> resume command, use command display mode. + \*(Pm = 3 \(-> start new command, use command display mode. +.Ed +. +.Sh "Tektronix 4014 Mode" +.LP +Most of these sequences are standard Tektronix 4014 control sequences. +Graph mode supports the 12-bit addressing of the Tektronix 4014. +The major features missing are +the write-through and defocused modes. +This document does not describe the commands used in the various +Tektronix plotting modes but does describe the commands to switch modes. +.LP +Some of the sequences are specific to \fI\*(xt\fP. +The Tektronix emulation was added in X10R4 (1986). +The VT240, introduced two years earlier, also supported Tektronix 4010/4014. +Unlike \fI\*(xt\fP, the VT240 documentation implies +(there is an obvious error in +section 6.9 \*(``Entering and Exiting 4010/4014 Mode\*('') +that exiting back to ANSI mode is done by +resetting private mode \*3\*8 (DECTEK) +rather than \*(Es\*(Et. +A real Tektronix 4014 would not respond to either. +.St +.IP \\*(Be +Bell (Ctrl-G). +.iP +.IP \\*(Bs +Backspace (Ctrl-H). +.iP +.IP \\*(Ta +Horizontal Tab (Ctrl-I). +.iP +.IP \\*(Lf +Line Feed or New Line (Ctrl-J). +.iP +.IP \\*(Vt +Cursor up (Ctrl-K). +.iP +.IP \\*(Ff +Form Feed or New Page (Ctrl-L). +.iP +.IP \\*(Cr +Carriage Return (Ctrl-M). +.iP +.IP \\*(Es\\*(Et +Switch to VT100 Mode (\*(Es Ctrl-C). +.iP +.IP \\*(Es\\*(En +Return Terminal Status (\*(Es Ctrl-E). +.iP +.IP \\*(Es\\*(Ff +PAGE (Clear Screen) (\*(Es Ctrl-L). +.iP +.IP \\*(Es\\*(So +Begin 4015 APL mode (\*(Es Ctrl-N). +This is ignored by \fI\*(xt\fP. +.iP +.IP \\*(Es\\*(Si +End 4015 APL mode (\*(Es Ctrl-O). +This is ignored by \fI\*(xt\fP. +.iP +.IP \\*(Es\\*(Eb +COPY (Save Tektronix Codes to file COPY\fIyyyy-mm-dd.hh:mm:ss\fP). + \*(Eb (end transmission block) is the same as Ctrl-W. +.iP +.IP \\*(Es\\*(Ca +Bypass Condition (\*(Es Ctrl-X). +.iP +.IP \\*(Es\\*(Su +GIN mode (\*(Es Ctrl-Z). +.iP +.IP \\*(Es\\*(Fs +Special Point Plot Mode (\*(Es Ctrl-\e). +.iP +.IP \\*(Es\\*8 +Select Large Character Set. +.iP +.IP \\*(Es\\*9 +Select #2 Character Set. +.iP +.IP \\*(Es\\*: +Select #3 Character Set. +.iP +.IP \\*(Es\\*; +Select Small Character Set. +.iP +.IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be +Set Text Parameters of VT window. + \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt. + \*(Ps = \*1 \(-> Change Icon Name to \*(Pt. + \*(Ps = \*2 \(-> Change Window Title to \*(Pt. + \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt. +This is normally disabled by a compile-time option. +.iP +.IP \\*(Es\\*` +Normal Z Axis and Normal (solid) Vectors. +.iP +.IP \\*(Es\\*a +Normal Z Axis and Dotted Line Vectors. +.iP +.IP \\*(Es\\*b +Normal Z Axis and Dot-Dashed Vectors. +.iP +.IP \\*(Es\\*c +Normal Z Axis and Short-Dashed Vectors. +.iP +.IP \\*(Es\\*d +Normal Z Axis and Long-Dashed Vectors. +.iP +.IP \\*(Es\\*h +Defocused Z Axis and Normal (solid) Vectors. +.iP +.IP \\*(Es\\*i +Defocused Z Axis and Dotted Line Vectors. +.iP +.IP \\*(Es\\*j +Defocused Z Axis and Dot-Dashed Vectors. +.iP +.IP \\*(Es\\*k +Defocused Z Axis and Short-Dashed Vectors. +.iP +.IP \\*(Es\\*l +Defocused Z Axis and Long-Dashed Vectors. +.iP +.IP \\*(Es\\*p +Write-Thru Mode and Normal (solid) Vectors. +.iP +.IP \\*(Es\\*q +Write-Thru Mode and Dotted Line Vectors. +.iP +.IP \\*(Es\\*r +Write-Thru Mode and Dot-Dashed Vectors. +.iP +.IP \\*(Es\\*(cs +Write-Thru Mode and Short-Dashed Vectors. +.iP +.IP \\*(Es\\*t +Write-Thru Mode and Long-Dashed Vectors. +.iP +.IP \\*(Fs +Point Plot Mode (Ctrl-\e). +.iP +.IP \\*(Gs +Graph Mode (Ctrl-]). +.iP +.IP \\*(Rs +Incremental Plot Mode (Ctrl-\*^). +.iP +.IP \\*(Us +Alpha Mode (Ctrl-_). +.Ed +. +. +.Sh "VT52 Mode" +.LP +Parameters for cursor movement are at the end of the \*(Es\*Y escape sequence. +Each ordinate is encoded in a single character as \fIvalue\fP+32. +For example, \*! is 1. +The screen coordinate system is 0-based. +.St +.IP \\*(Es\\*< +Exit VT52 mode (Enter VT100 mode). +.iP +.IP \\*(Es\\*= +Enter alternate keypad mode. +.iP +.IP \\*(Es\\*> +Exit alternate keypad mode. +.iP +.IP \\*(Es\\*A +Cursor up. +.iP +.IP \\*(Es\\*(cB +Cursor down. +.iP +.IP \\*(Es\\*C +Cursor right. +.iP +.IP \\*(Es\\*D +Cursor left. +.iP +.IP \\*(Es\\*F +Enter graphics mode. +.iP +.IP \\*(Es\\*G +Exit graphics mode. +.iP +.IP \\*(Es\\*H +Move the cursor to the home position. +.iP +.IP \\*(Es\\*I +Reverse line feed. +.iP +.IP \\*(Es\\*J +Erase from the cursor to the end of the screen. +.iP +.IP \\*(Es\\*K +Erase from the cursor to the end of the line. +.iP +.IP \\*(Es\\*Y\\*(Ps\\*s\\*(Ps +Move the cursor to given row and column. +.iP +.IP \\*(Es\\*Z +Identify. + \(-> \*(Es\*s\*/\*s\*Z (\*(``I am a VT52.\*(''). +.Ed +. +.Sh "Further reading" +.Ss "Technical manuals" +.LP +Manuals for \fIhardware\fP terminals are more readily available than +similarly-detailed documentation for terminal \fIemulators\fP +such as \fIaixterm\fP, \fIshelltool\fP, \fIdtterm\fP. +.LP +However long, the technical manuals have problems: +.bP +DEC's manuals did not provide a comprehensive comparison of the features +in different model. +.IP +Peter Sichel's \fIHost Interface Functions Checklist\fP +spreadsheet is useful for noting +which model introduced a given feature (although there are a few apparent +errors such as the DECRQSS feature cited for VT320 +whereas the technical manual omits it). +.bP +Sometimes the manuals disagree. +For example, DEC's standard document (DEC STD 070) for terminals says +that DECSCL performs a \fIsoft\fP reset (DECSTR), +while the VT420 manual says it does a \fIhard\fP reset (RIS). +.bP +Sometimes the manuals are simply incorrect. +For example, testing a DEC VT420 in 1996 showed that the documented +code for a valid or invalid response to DECRQSS was reversed. +.IP +The VT420 test results were incorporated into \fIvttest\fP program. +At the time, DEC STD 070 was not available, +but it also agrees with \fIvttest\fP. +Later, documentation for the DEC VT525 was shown to have the same flaw. +.bP +Not all details are clear even in DEC STD 070 +(which is more than twice the length of the +VT520 programmer's reference manual, +and almost three times longer than the VT420 reference manual). +However, as an internal standards document, +DEC STD 070 is more likely to describe the actual behavior of DEC's terminals +than the more polished user's guides. +.LP +That said, here are technical manuals +which have been used in developing \fI\*(xt\fP. +Not all were available initially. +In August 1996 for instance, the technical references were +limited to +EK-VT220-HR-002 and +EK-VT420-UG.002. +Shortly after, +Richard Shuford sent a copy of +EK-VT3XX-TP-001. +Still later (beginning in 2003), Paul Williams' vt100.net site +provided +EK-VT102-UG-003, +EK-VT220-RM-002, +EK-VT420-RM-002, +EK-VT520-RM A01, +EK-VT100-TM-003, and +EK-VT102-UG-003. +The remaining documents were found on the bitsavers site. +.bP +.\" http://www.bitsavers.org/pdf/dec/terminal/vt52/EK-VT5X-OP-001_DECscope_Users_Manual_Mar77.pdf +\fIDECscope User's Manual\fP. +.br +Digital Equipment Corporation +(EK-VT5X-OP-001 1975). +.bP +.\" http://www.bitsavers.org/pdf/dec/terminal/vt100/EK-VT100-TM-003_VT100_Technical_Manual_Jul82.pdf +\fIVT100 Series Video Terminal Technical Manual\fP. +.br +Digital Equipment Corporation +(EK-VT100-TM-003, July 1982). +.bP +.\" https://vt100.net/docs/vt100-ug/ +\fIVT100 User Guide\fP. +.br +Digital Equipment Corporation +(EK-VT100-UG-003, June 1981). +.bP +.\" https://vt100.net/docs/vt102-ug/ +\fIVT102 User Guide\fP. +.br +Digital Equipment Corporation +(EK-VT102-UG-003, February 1982). +.bP +.\" http://manx-docs.org/details.php/1,2954 +\fIVT220 Programmer Pocket Guide\fP. +.br +Digital Equipment Corporation +(EK-VT220-HR-002, July 1984). +.bP +.\" https://vt100.net/docs/vt220-rm/ +\fIVT220 Programmer Reference Manual\fP. +.br +Digital Equipment Corporation +(EK-VT220-RM-002, August 1984). +.bP +.\" http://www.bitsavers.org/pdf/dec/terminal/vt240/EK-VT240-RM-002_VT240_Programmer_Reference_Manual_Oct84.pdf +\fIVT240 Programmer Reference Manual\fP. +.br +Digital Equipment Corporation +(EK-VT240-RM-002, October 1984). +.bP +.\" http://www.bitsavers.org/pdf/dec/terminal/vt340/EK-VT3XX-TP-001_VT330_VT340_Text_Programming_Mar87.pdf +\fIVT330/VT340 Programmer Reference Manual\fP +.br +\fIVolume 1: Text Programming\fP. +.br +Digital Equipment Corporation +(EK-VT3XX-TP-001, March 1987). +.bP +.\" https://vt100.net/docs/vt3xx-gp/ +\fIVT330/VT340 Programmer Reference Manual\fP +.br +\fIVolume 2: Graphics Programming\fP. +.br +Digital Equipment Corporation +(EK-VT3XX-GP-001, March 1987). +.bP +.\" http://www.bitsavers.org/pdf/dec/terminal/vt420/EK-VT420-UG-001_Installing_and_Using_The_VT420_Video_Terminal_Nov89.pdf +\fIInstalling and Using\fP +.br +\fIThe VT420 Video Terminal\fP +.br +\fI(North American Model)\fP. +.br +Digital Equipment Corporation +(EK-VT420-UG.002, February 1990). +.bP +.\" http://manx-docs.org/collections/mds-199909/cd3/term/vt420rm2.pdf +\fIVT420 Programmer Reference Manual\fP. +.br +Digital Equipment Corporation +(EK-VT420-RM-002, February 1992). +.bP +.\" https://vt100.net/docs/vt510-rm/ +\fIVT510 Video Terminal\fP +.br +\fIProgrammer Information\fP. +.br +Digital Equipment Corporation +(EK-VT510-RM B01, November 1993). +.bP +.\" http://www.bitsavers.org/pdf/dec/terminal/vt5xx/EK-VT520-RM_VT520_VT525_Programmer_Information_Jul94.pdf +\fIVT520/VT525 Video Terminal\fP +.br +\fIProgrammer Information\fP. +.br +Digital Equipment Corporation +(EK-VT520-RM A01, July 1994). +.bP +.\" http://www.vaxhaven.com/images/f/f7/EK-PPLV2-PM-B01.pdf +\fIDigital ANSI-Compliant Printing Protocol\fP +.br +\fILevel 2 Programming Reference Manual\fP +.br +Digital Equipment Corporation +(EK-PPLV2-PM B01, August 1994). +.bP +.\" https://vt100.net/manx/details/5,5479 +\fI4014 and 4014-1 Computer Display Terminal\fP +.br +\fIUser's Manual\fP. +.br +Tektronix, Inc. +(070-1647-00, November 1979). +.Ss "Standards" +.LP +The DEC terminal family (VT100 through VT525) is upward-compatible, +using standards plus \fIextensions\fP, e.g., \*(``private modes\*(''. +Not all commonly-used features are standard. +For example, scrolling regions are not found in ECMA-48. +.LP +Again, it is possible to find discrepancies in the standards: +.bP +The printed ECMA-48 5th edition (1991) +and the first PDF produced for that edition (April 1998) +state that SD (scroll down) ends with 05/14, i.e., \*^, +which disagrees with DEC's VT420 hardware implementation and +DEC's manuals which use 05/04 \*T. +(A few other terminals such as AT&T 5620 and IBM 5151 also used 05/04, +but the documentation and dates are lacking). +.IP +ECMA created a new PDF in April 2003 which changed that detail to use \*T, +and later in 2008 provided PDFs of the earlier editions which used \*T. +.bP +The VT320, VT420, VT520 manuals claim that DECSCL does a +hard reset (RIS). +.IP +Both the VT220 manual and DEC STD 070 (which documents +levels 1-4 in detail) state that it is a soft reset, e.g., DECSTR. +.LP +Here are the relevant standards: +.bP +.\" https://www.ecma-international.org/publications/standards/Ecma-035.htm +\fIECMA-35: Character Code Structure and Extension Techniques\fP +.br +(6th Edition, December 1994). +.bP +.\" http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-043.pdf +\fIECMA-43: 8-bit Coded Character Set Structure and Rules\fP +.br +(3rd Edition, December 1991). +.\" same as dpANS X3.134.1 +.bP +.\" https://www.ecma-international.org/publications/standards/Ecma-048.htm +\fIECMA-48: Control Functions for Coded Character Sets\fP +.br +(5th Edition, June 1991). +.bP +.\" http://www.bitsavers.org/pdf/dec/standards/EL-SM070-00_DEC_STD_070_Video_Systems_Reference_Manual_Dec91.pdf +\fIDEC STD 070 Video Systems Reference Manual\fP. +.br +Digital Equipment Corporation +(A-MN-ELSM070-00-0000 Rev H, December 3, 1991). +.Ss "Miscellaneous" +.LP +A few hardware terminals survived into the 1990s only as terminal emulators. +Documentation for these and other terminal emulators +which have influenced \fI\*(xt\fP +are generally available only in +less-accessible and less-detailed manual pages. +.bP +\fI\*(XT\fP supports control sequences for manipulating its \fIwindow\fP +which were implemented by Sun's \fIshelltool\fP program. +This was part of SunView (SunOS 3.0, 1986). +The change-notes for \fI\*(xt\fP's \fIresize\fP program in X10.4 (1986) +mention its use of these \*(``Sun tty emulation escape sequences\*('' +for resizing the window. +The X10.4 \fI\*(xt\fP program recognized these sequences for resizing +the terminal, except for the iconify/deiconify pair. +SunView also introduced the SIGWINCH signal, +used by the X10.4 \fI\*(xt\fP and mentioned in its \fICHANGES\fP file: +.iP +.RS +The window size is passed to the operating system via TIOCSWINSZ (4.3) or +TIOCSSIZE (sun). +A SIGWINCH signal is sent if the vtXXX window is resized. +.RE +.IP +While support for the Sun control-sequences remained in \fIresize\fP, +the next release of \fI\*(xt\fP (X11R1 in 1987) +omitted the code for interpreting them. +.IP +Later, the SunView program was adapted for +the \fIOPEN LOOK\fP environment introduced 1988-1990. +.IP +Still later, in 1995, \fIOPEN LOOK\fP was abandoned in favor of \fICDE\fP. +The \fICDE\fP terminal emulator \fIdtterm\fP implemented those controls, +with a couple of additions. +.IP +Starting in July 1996, +\fI\*(xt\fP re-implemented those control sequences +(based on the \fIdtterm\fP manual pages) +and further extended the group of window controls. +.IP +There were two sets of controls +(\*(Cs\*(Ps\*s\fI[\fP\*s\*;\*(Pm\*s\*;\*(Pm\*s\fI]\fP\*s\*t, +and \*(Os\*(Ps\*s\fItext\fP\*s\*(ST) implemented +by \fIshelltool\fP, documented in appendix E of both +\fIPHIGS Programming Manual\fP (1992), and the unpublished +\fIX Window System User's Guide (OPEN LOOK Edition)\fP (1995). +The \fICDE\fP program kept those, +and added a few new ones. +.TS +l l l l l +_ _ _ _ _ +l c c c l. +\fBCode\fR \fBSun\fR \fBCDE \*(XT Description\fP +\*(Cs\*1\*t yes yes yes de-iconify +\*(Cs\*2\*t yes yes yes iconify +\*(Cs\*3\*t yes yes yes move window to pixel-position +\*(Cs\*4\*t yes yes yes resize window in pixels +\*(Cs\*5\*t yes yes yes raise window to front of stack +\*(Cs\*6\*t yes yes yes raise window to back of stack +\*(Cs\*7\*t yes yes yes refresh window +\*(Cs\*8\*t yes yes yes resize window in chars +\*(Cs\*9\*t - - yes maximize/unmaximize window +\*(Cs\*1\*0\*t - - yes to/from full-screen +\*(Cs\*1\*1\*t yes yes yes report if window is iconified +\*(Cs\*1\*2\*t - - - - +\*(Cs\*1\*3\*t yes yes yes report window position +\*(Cs\*1\*4\*t yes yes yes report window size in pixels +\*(Cs\*1\*5\*t - - yes report screen size in pixels +\*(Cs\*1\*6\*t - - yes report character cell in pixels +\*(Cs\*1\*7\*t - - - - +\*(Cs\*1\*8\*t yes yes yes report window size in chars +\*(Cs\*1\*9\*t - - yes report screen size in chars +\*(Cs\*2\*0\*t - yes yes report icon label +\*(Cs\*2\*1\*t - yes yes report window title +\*(Cs\*2\*2\*t - - yes save window/icon title +\*(Cs\*2\*3\*t - - yes restore window/icon title +\*(Cs\*2\*4\*t - - yes resize window (DECSLPP) +\*(Os\*0\*(ST - yes yes set window and icon title +\*(Os\*1\*(ST - yes yes set icon label +\*(Os\*2\*(ST - yes yes set window title +\*(Os\*3\*(ST - n/a yes set X server property +\*(Os\*I\*(ST yes yes yes set icon to file +\*(Os\*l\*(ST yes yes yes set window title +\*(Os\*L\*(ST yes yes yes set icon label +.TE +.br +Besides the Sun-derived OSC controls for setting window title and icon label, +\fIdtterm\fP also supported the \fI\*(xt\fP controls for the same feature. +.IP +The \fICDE\fP source was unavailable for inspection until 2012, +so that clarification of the details of the window operations +relied upon \fIvttest\fP. +.bP +The control sequences for saving/restoring the cursor and +for saving/restoring \*(``DEC Private Mode Values\*('' may appear to be +related (since the \*(``save\*('' controls both end with \*(cs), +but that is coincidental. +The latter was introduced in X10.4: +.iP +.RS +.ft C +.na +.hy 0 +Most Dec Private mode settings can be saved away internally using \\E[?ns, +where n is the same number to set or reset the Dec Private mode. The +mode can be restored using \\E[?nr. This can be used in termcap for vi, for +example, to turn off saving of lines, but restore whatever the original +state was on exit. +.hy +.ad +.ft R +.RE +.IP +while the SCOSC/SCORC pair was added in 1995 by XFree86 +(and documented long afterwards). +.bP +The \fIaixterm\fP manual page gives the format of the control sequence +for foreground and background colors 8-15, +but does not specify what those colors are. +That is implied by the description's mention of \fIHFT\fP: +.iP +.RS +.na +.hy 0 +.ft C +The aixterm command provides a standard terminal type for programs that +do not interact directly with Enhanced X-Windows. +This command provides +an emulation for a VT102 terminal or a high function terminal (HFT). +The VT102 mode is activated by the -v flag. +.ft R +.ad +.RE +.hy +.IP +Unlike \fI\*(xt\fP, there are no resource names for the 16 colors, +leaving the reader to assume that the mapping is hard-coded. +The control sequences for colors 8-15 are not specified by ECMA-48, +but rather (as done in other instances by \fI\*(xt\fP) chosen to +not conflict with current or future standards. +. +.if n .pl \n(nlu+1v diff --git a/ports/xterm/xterm-359/ctlseqs.txt b/ports/xterm/xterm-359/ctlseqs.txt new file mode 100644 index 0000000..efc7cf4 --- /dev/null +++ b/ports/xterm/xterm-359/ctlseqs.txt @@ -0,0 +1,3032 @@ + + + + + + + + + + XTerm Control Sequences + + + Edward Moy + University of California, Berkeley + + Revised by + + Stephen Gildea + X Consortium (1994) + + Thomas Dickey + XFree86 Project (1996-2006) + invisible-island.net (2006-2020) + updated for XTerm Patch #359 (2020/08/03) + + + + +Definitions + +Many controls use parameters, shown in italics. If a control uses a +single parameter, only one parameter name is listed. Some parameters +(along with separating ; characters) may be optional. Other characters +in the control are required. + +C A single (required) character. + +Ps A single (usually optional) numeric parameter, composed of one or + more digits. + +Pm Any number of single numeric parameters, separated by ; charac- + ter(s). Individual values for the parameters are listed with Ps . + +Pt A text parameter composed of printable characters. + + +Control Bytes, Characters, and Sequences + +ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes. +Those are respectively codes 128 to 159 and 0 to 31. ECMA-48 avoids +referring to these codes as characters, because that term is associated +with graphic characters. Instead, it uses "bytes" and "codes", with +occasional lapses to "characters" where the meaning cannot be mistaken. + +Controls (including the escape code 27) are processed once: + +o This means that a C1 control can be mistaken for badly-formed UTF-8 + when the terminal runs in UTF-8 mode because C1 controls are valid + continuation bytes of a UTF-8 encoded (multibyte) value. + +o It is not possible to use a C1 control obtained from decoding the + UTF-8 text, because that would require reprocessing the data. Con- + sequently there is no ambiguity in the way this document uses the + term "character" to refer to bytes in a control sequence. + +The order of processing is a necessary consequence of the way ECMA-48 is +designed: + +o Each byte sent to the terminal can be unambiguously determined to + fall into one of a few categories (C0, C1 and graphic characters). + +o ECMA-48 is modal; once it starts processing a control sequence, the + terminal continues until the sequence is complete, or some byte is + found which is not allowed in the sequence. + +o Intermediate, parameter and final bytes may use the same codes as + graphic characters, but they are processed as part of a control + sequence and are not actually graphic characters. + +o Eight-bit controls can have intermediate, etc., bytes in the range + 160 to 255. Those can be treated as their counterparts in the range + 32 to 127. + +o Single-byte controls can be handled separately from multi-byte con- + trol sequences because ECMA-48's rules are unambiguous. + + As a special case, ECMA-48 (section 9) mentions that the control + functions shift-in and shift-out are allowed to occur within a 7-bit + multibyte control sequence because those cannot alter the meaning of + the control sequence. + +o Some controls (such as OSC ) introduce a string mode, which is ended + on a ST (string terminator). + + ECMA-48 describes only correct behavior, telling what types of char- + acters are expected at each stage of the control sequences. It says + that the action taken in error recovery is implementation-dependent. + XTerm decodes control sequences using a state machine. It handles + errors in decoding i.e., unexpected characters, by resetting to the + initial (ground) state. That is different from the treatment of + unimplemented (but correctly formatted) features. + + If an application does not send the string terminator, that is also + an error from the standpoint of a user. To accommodate users of + those applications, xterm has resource settings which allow work- + arounds: + + o The Linux console's palette sequences do not use a string termi- + nator. The brokenLinuxOSC resource setting tells xterm to + ignore those particular sequences. + + o The terminal should accept single-byte controls within the + string. But some applications omit a string terminator, like + the Linux console. The brokenStringTerm resource setting tells + xterm to exit string mode if it decodes a common control charac- + ter such as carriage return before the string terminator. + + +C1 (8-Bit) Control Characters + +The xterm program recognizes both 8-bit and 7-bit control characters. +It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled. +The following pairs of 7-bit and 8-bit control characters are equiva- +lent: + +ESC D + Index (IND is 0x84). + +ESC E + Next Line (NEL is 0x85). + +ESC H + Tab Set (HTS is 0x88). + +ESC M + Reverse Index (RI is 0x8d). + +ESC N + Single Shift Select of G2 Character Set (SS2 is 0x8e), VT220. + This affects next character only. + +ESC O + Single Shift Select of G3 Character Set (SS3 is 0x8f), VT220. + This affects next character only. + +ESC P + Device Control String (DCS is 0x90). + +ESC V + Start of Guarded Area (SPA is 0x96). + +ESC W + End of Guarded Area (EPA is 0x97). + +ESC X + Start of String (SOS is 0x98). + +ESC Z + Return Terminal ID (DECID is 0x9a). Obsolete form of CSI c (DA). + +ESC [ + Control Sequence Introducer (CSI is 0x9b). + +ESC \ + String Terminator (ST is 0x9c). + +ESC ] + Operating System Command (OSC is 0x9d). + +ESC ^ + Privacy Message (PM is 0x9e). + +ESC _ + Application Program Command (APC is 0x9f). + + +These control characters are used in the vtXXX emulation. + + +VT100 Mode + +In this document, "VT100" refers not only to VT100/VT102, but also to +the succession of upward-compatible terminals produced by DEC (Digital +Equipment Corporation) from the mid-1970s for about twenty years. For +brevity, the document refers to the related models: + "VT200" as VT220/VT240, + "VT300" as VT320/VT340, + "VT400" as VT420, and + "VT500" as VT510/VT520/VT525. + +Most of these control sequences are standard VT102 control sequences, +but there is support for later DEC VT terminals (i.e., VT220, VT320, +VT420, VT510), as well as ECMA-48 and aixterm color controls. The only +VT102 feature not supported is auto-repeat, since the only way X pro- +vides for this will affect all windows. + +There are additional control sequences to provide xterm-dependent func- +tions, such as the scrollbar or window size. Where the function is +specified by DEC or ECMA-48, the code assigned to it is given in paren- +theses. + +The escape codes to designate and invoke character sets are specified by +ISO 2022 (see that document for a discussion of character sets). + +Many of the features are optional; xterm can be configured and built +without support for them. + + +Single-character functions + +BEL Bell (BEL is Ctrl-G). + +BS Backspace (BS is Ctrl-H). + +CR Carriage Return (CR is Ctrl-M). + +ENQ Return Terminal Status (ENQ is Ctrl-E). Default response is + an empty string, but may be overridden by a resource answer- + backString. + +FF Form Feed or New Page (NP ). (FF is Ctrl-L). FF is treated + the same as LF . + +LF Line Feed or New Line (NL). (LF is Ctrl-J). + +SI Switch to Standard Character Set (Ctrl-O is Shift In or LS0). + This invokes the G0 character set (the default) as GL. + VT200 and up implement LS0. + +SO Switch to Alternate Character Set (Ctrl-N is Shift Out or + LS1). This invokes the G1 character set as GL. + VT200 and up implement LS1. + +SP Space. + +TAB Horizontal Tab (HTS is Ctrl-I). + +VT Vertical Tab (VT is Ctrl-K). This is treated the same as LF. + + +Controls beginning with ESC + +This excludes controls where ESC is part of a 7-bit equivalent to 8-bit +C1 controls, ordered by the final character(s). + +ESC SP F 7-bit controls (S7C1T), VT220. This tells the terminal to + send C1 control characters as 7-bit sequences, e.g., its + responses to queries. DEC VT200 and up always accept 8-bit + control sequences except when configured for VT100 mode. + +ESC SP G 8-bit controls (S8C1T), VT220. This tells the terminal to + send C1 control characters as 8-bit sequences, e.g., its + responses to queries. DEC VT200 and up always accept 8-bit + control sequences except when configured for VT100 mode. + +ESC SP L Set ANSI conformance level 1, ECMA-43. + +ESC SP M Set ANSI conformance level 2, ECMA-43. + +ESC SP N Set ANSI conformance level 3, ECMA-43. + +ESC # 3 DEC double-height line, top half (DECDHL), VT100. + +ESC # 4 DEC double-height line, bottom half (DECDHL), VT100. + +ESC # 5 DEC single-width line (DECSWL), VT100. + +ESC # 6 DEC double-width line (DECDWL), VT100. + +ESC # 8 DEC Screen Alignment Test (DECALN), VT100. + +ESC % @ Select default character set. That is ISO 8859-1 (ISO 2022). + +ESC % G Select UTF-8 character set, ISO 2022. + +ESC ( C Designate G0 Character Set, VT100, ISO 2022. + Final character C for designating 94-character sets. In this + list, + o 0 , A and B were introduced in the VT100, + o most were introduced in the VT200 series, + o a few were introduced in the VT300 series, and + o a few more were introduced in the VT500 series. + The VT220 character sets, together with a few others (such as + Portuguese) are activated by the National Replacement Charac- + ter Set (NRCS) controls. The term "replacement" says that the + character set is formed by replacing some of the characters in + a set (termed the Multinational Character Set) with more use- + ful ones for a given language. The ASCII and DEC Supplemental + character sets make up the two halves of the Multinational + Character set, initially mapped to GL and GR. + The valid final characters C for this control are: + C = A -> United Kingdom (UK), VT100. + C = B -> United States (USASCII), VT100. + C = C or 5 -> Finnish, VT200. + C = H or 7 -> Swedish, VT200. + C = K -> German, VT200. + C = Q or 9 -> French Canadian, VT200. + C = R or f -> French, VT200. + C = Y -> Italian, VT200. + C = Z -> Spanish, VT200. + C = 4 -> Dutch, VT200. + C = " > -> Greek, VT500. + C = % 2 -> Turkish, VT500. + C = % 6 -> Portuguese, VT300. + C = % = -> Hebrew, VT500. + C = = -> Swiss, VT200. + C = ` , E or 6 -> Norwegian/Danish, VT200. + The final character A is a special case, since the same final + character is used by the VT300-control for the 96-character + British Latin-1. + There are a few other 94-character sets: + C = 0 -> DEC Special Character and Line Drawing Set, VT100. + C = < -> DEC Supplemental, VT200. + C = > -> DEC Technical, VT300. + These are documented as NRCS: + C = " 4 -> DEC Hebrew, VT500. + C = " ? -> DEC Greek, VT500. + C = % 0 -> DEC Turkish, VT500. + C = % 5 -> DEC Supplemental Graphics, VT300. + C = & 4 -> DEC Cyrillic, VT500. + The VT520 reference manual lists a few more, but no documenta- + tion has been found for the mappings: + C = % 3 -> SCS NRCS, VT500. + C = & 5 -> DEC Russian, VT500. + +ESC ) C Designate G1 Character Set, ISO 2022, VT100. + The same character sets apply as for ESC ( C. + +ESC * C Designate G2 Character Set, ISO 2022, VT220. + The same character sets apply as for ESC ( C. + +ESC + C Designate G3 Character Set, ISO 2022, VT220. + The same character sets apply as for ESC ( C. + +ESC - C Designate G1 Character Set, VT300. + These controls apply only to 96-character sets. Unlike the + 94-character sets, these can have different values than ASCII + space and DEL for the mapping of 0x20 and 0x7f. The valid + final characters C for this control are: + C = A -> ISO Latin-1 Supplemental, VT300. + C = F -> ISO Greek Supplemental, VT500. + C = H -> ISO Hebrew Supplemental, VT500. + C = L -> ISO Latin-Cyrillic, VT500. + C = M -> ISO Latin-5 Supplemental, VT500. + +ESC . C Designate G2 Character Set, VT300. + The same character sets apply as for ESC - C. + +ESC / C Designate G3 Character Set, VT300. + The same character sets apply as for ESC - C. + +ESC 6 Back Index (DECBI), VT420 and up. + +ESC 7 Save Cursor (DECSC), VT100. + +ESC 8 Restore Cursor (DECRC), VT100. + +ESC 9 Forward Index (DECFI), VT420 and up. + +ESC = Application Keypad (DECKPAM). + +ESC > Normal Keypad (DECKPNM), VT100. + +ESC F Cursor to lower left corner of screen. This is enabled by the + hpLowerleftBugCompat resource. + +ESC c Full Reset (RIS), VT100. + +ESC l Memory Lock (per HP terminals). Locks memory above the cur- + sor. + +ESC m Memory Unlock (per HP terminals). + +ESC n Invoke the G2 Character Set as GL (LS2) as GL. + +ESC o Invoke the G3 Character Set as GL (LS3) as GL. + +ESC | Invoke the G3 Character Set as GR (LS3R). + +ESC } Invoke the G2 Character Set as GR (LS2R). + +ESC ~ Invoke the G1 Character Set as GR (LS1R), VT100. + + +Application Program-Command functions + +APC Pt ST None. xterm implements no APC functions; Pt is ignored. Pt + need not be printable characters. + + +Device-Control functions + +DCS Ps ; Ps | Pt ST + User-Defined Keys (DECUDK), VT220 and up. + + The first parameter: + Ps = 0 -> Clear all UDK definitions before starting + (default). + Ps = 1 -> Erase Below (default). + + The second parameter: + Ps = 0 <- Lock the keys (default). + Ps = 1 <- Do not lock. + + The third parameter is a ';'-separated list of strings denot- + ing the key-code separated by a '/' from the hex-encoded key + value. The key codes correspond to the DEC function-key codes + (e.g., F6=17). + +DCS $ q Pt ST + Request Status String (DECRQSS), VT420 and up. + The string following the "q" is one of the following: + m -> SGR + " p -> DECSCL + SP q -> DECSCUSR + " q -> DECSCA + r -> DECSTBM + s -> DECSLRM + t -> DECSLPP + $ | -> DECSCPP + * | -> DECSNLS + xterm responds with DCS 1 $ r Pt ST for valid requests, + replacing the Pt with the corresponding CSI string, or DCS 0 $ + r Pt ST for invalid requests. + +DCS Ps $ t Pt ST + Restore presentation status (DECRSPS), VT320 and up. The con- + trol can be converted from a response from DECCIR or DECTABSR + by changing the first "u" to a "t" + Ps = 1 -> DECCIR + Ps = 2 -> DECTABSR + +DCS + Q Pt ST + Request resource values (XTGETXRES), xterm. The string fol- + lowing the "Q" is a list of names encoded in hexadecimal (2 + digits per character) separated by ; which correspond to xterm + resource names. Only boolean, numeric and string resources + are supported by this query. + + xterm responds with + DCS 1 + R Pt ST for valid requests, adding to Pt an = , and + the value of the corresponding resource that xterm is using, + or + DCS 0 + R Pt ST for invalid requests. + The strings are encoded in hexadecimal (2 digits per charac- + ter). + + +DCS + p Pt ST + Set Termcap/Terminfo Data (XTSETTCAP), xterm. The string fol- + lowing the "p" is a name to use for retrieving data from the + terminal database. The data will be used for the "tcap" key- + board configuration's function- and special-keys, as well as + by the Request Termcap/Terminfo String control. + + +DCS + q Pt ST + Request Termcap/Terminfo String (XTGETTCAP), xterm. The + string following the "q" is a list of names encoded in hexa- + decimal (2 digits per character) separated by ; which corre- + spond to termcap or terminfo key names. + A few special features are also recognized, which are not key + names: + + o Co for termcap colors (or colors for terminfo colors), and + + o TN for termcap name (or name for terminfo name). + + o RGB for the ncurses direct-color extension. + Only a terminfo name is provided, since termcap applica- + tions cannot use this information. + + xterm responds with + DCS 1 + r Pt ST for valid requests, adding to Pt an = , and + the value of the corresponding string that xterm would send, + or + DCS 0 + r Pt ST for invalid requests. + The strings are encoded in hexadecimal (2 digits per charac- + ter). + + +Functions using CSI , ordered by the final character(s) + +CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH). + +CSI Ps SP @ + Shift left Ps columns(s) (default = 1) (SL), ECMA-48. + +CSI Ps A Cursor Up Ps Times (default = 1) (CUU). + +CSI Ps SP A + Shift right Ps columns(s) (default = 1) (SR), ECMA-48. + +CSI Ps B Cursor Down Ps Times (default = 1) (CUD). + +CSI Ps C Cursor Forward Ps Times (default = 1) (CUF). + +CSI Ps D Cursor Backward Ps Times (default = 1) (CUB). + +CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL). + +CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL). + +CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA). + +CSI Ps ; Ps H + Cursor Position [row;column] (default = [1,1]) (CUP). + +CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1) (CHT). + +CSI Ps J Erase in Display (ED), VT100. + Ps = 0 -> Erase Below (default). + Ps = 1 -> Erase Above. + Ps = 2 -> Erase All. + Ps = 3 -> Erase Saved Lines, xterm. + +CSI ? Ps J + Erase in Display (DECSED), VT220. + Ps = 0 -> Selective Erase Below (default). + Ps = 1 -> Selective Erase Above. + Ps = 2 -> Selective Erase All. + Ps = 3 -> Selective Erase Saved Lines, xterm. + +CSI Ps K Erase in Line (EL), VT100. + Ps = 0 -> Erase to Right (default). + Ps = 1 -> Erase to Left. + Ps = 2 -> Erase All. + +CSI ? Ps K + Erase in Line (DECSEL), VT220. + Ps = 0 -> Selective Erase to Right (default). + Ps = 1 -> Selective Erase to Left. + Ps = 2 -> Selective Erase All. + +CSI Ps L Insert Ps Line(s) (default = 1) (IL). + +CSI Ps M Delete Ps Line(s) (default = 1) (DL). + +CSI Ps P Delete Ps Character(s) (default = 1) (DCH). + +CSI # P +CSI Pm # P + Push current dynamic- and ANSI-palette colors onto stack + (XTPUSHCOLORS), xterm. Parameters (integers in the range 1 + through 10, since the default 0 will push) may be used to + store the palette into the stack without pushing. + +CSI # Q +CSI Pm # Q + Pop stack to set dynamic- and ANSI-palette colors (XTPOPCOL- + ORS), xterm. Parameters (integers in the range 1 through 10, + since the default 0 will pop) may be used to restore the pal- + ette from the stack without popping. + +CSI # R Report the current entry on the palette stack, and the number + of palettes stored on the stack, using the same form as XTPOP- + COLOR (default = 0) (XTREPORTCOLORS), xterm. + +CSI Ps S Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48. + +CSI ? Pi ; Pa ; Pv S + Set or request graphics attribute (XTSMGRAPHICS), xterm. If + configured to support either Sixel Graphics or ReGIS Graphics, + xterm accepts a three-parameter control sequence, where Pi, Pa + and Pv are the item, action and value: + + Pi = 1 -> item is number of color registers. + Pi = 2 -> item is Sixel graphics geometry (in pixels). + Pi = 3 -> item is ReGIS graphics geometry (in pixels). + + Pa = 1 -> read attribute. + Pa = 2 -> reset to default. + Pa = 3 -> set to value in Pv. + Pa = 4 -> read the maximum allowed value. + + Pv is ignored by xterm except when setting (Pa == 3 ). + Pv = n <- A single integer is used for color registers. + Pv = width ; height <- Two integers for graphics geometry. + + xterm replies with a control sequence of the same form: + + CSI ? Pi ; Ps ; Pv S + + where Ps is the status: + Ps = 0 <- success. + Ps = 1 <- error in Pi. + Ps = 2 <- error in Pa. + Ps = 3 <- failure. + + On success, Pv represents the value read or set. + + Notes: + o The current implementation allows reading the graphics + sizes, but disallows modifying those sizes because that is + done once, using resource-values. + o Graphics geometry is not necessarily the same as "window + size" (see the dtterm window manipulation extensions). + For example, xterm limits the maximum graphics geometry at + compile time (1000x1000 as of version 328) although the + window size can be larger. + o While resizing a window will always change the current + graphics geometry, the reverse is not true. Setting + graphics geometry does not affect the window size. + +CSI Ps T Scroll down Ps lines (default = 1) (SD), VT420. + +CSI Ps ; Ps ; Ps ; Ps ; Ps T + Initiate highlight mouse tracking (XTHIMOUSE), xterm. Parame- + ters are [func;startx;starty;firstrow;lastrow]. See the sec- + tion Mouse Tracking. + +CSI > Pm T + Reset title mode features to default value (XTRMTITLE), xterm. + Normally, "reset" disables the feature. It is possible to + disable the ability to reset features by compiling a different + default for the title modes into xterm. + + Ps = 0 -> Do not set window/icon labels using hexadecimal. + Ps = 1 -> Do not query window/icon labels using hexadeci- + mal. + Ps = 2 -> Do not set window/icon labels using UTF-8. + Ps = 3 -> Do not query window/icon labels using UTF-8. + + (See discussion of Title Modes). + +CSI Ps X Erase Ps Character(s) (default = 1) (ECH). + +CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). + +CSI Ps ^ Scroll down Ps lines (default = 1) (SD), ECMA-48. + This was a publication error in the original ECMA-48 5th edi- + tion (1991) corrected in 2003. + +CSI Ps ` Character Position Absolute [column] (default = [row,1]) + (HPA). + +CSI Ps a Character Position Relative [columns] (default = [row,col+1]) + (HPR). + +CSI Ps b Repeat the preceding graphic character Ps times (REP). + +CSI Ps c Send Device Attributes (Primary DA). + Ps = 0 or omitted -> request attributes from terminal. The + response depends on the decTerminalID resource setting. + -> CSI ? 1 ; 2 c ("VT100 with Advanced Video Option") + -> CSI ? 1 ; 0 c ("VT101 with No Options") + -> CSI ? 4 ; 6 c ("VT132 with Advanced Video and Graphics") + -> CSI ? 6 c ("VT102") + -> CSI ? 7 c ("VT131") + -> CSI ? 1 2 ; Ps c ("VT125") + -> CSI ? 6 2 ; Ps c ("VT220") + -> CSI ? 6 3 ; Ps c ("VT320") + -> CSI ? 6 4 ; Ps c ("VT420") + + The VT100-style response parameters do not mean anything by + themselves. VT220 (and higher) parameters do, telling the + host what features the terminal supports: + Ps = 1 -> 132-columns. + Ps = 2 -> Printer. + Ps = 3 -> ReGIS graphics. + Ps = 4 -> Sixel graphics. + Ps = 6 -> Selective erase. + Ps = 8 -> User-defined keys. + Ps = 9 -> National Replacement Character sets. + Ps = 1 5 -> Technical characters. + Ps = 1 6 -> Locator port. + Ps = 1 7 -> Terminal state interrogation. + Ps = 1 8 -> User windows. + Ps = 2 1 -> Horizontal scrolling. + Ps = 2 2 -> ANSI color, e.g., VT525. + Ps = 2 8 -> Rectangular editing. + Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode). + + XTerm supports part of the User windows feature, providing a + single page (which corresponds to its visible window). Rather + than resizing the font to change the number of lines/columns + in a fixed-size display, xterm uses the window extension con- + trols (DECSNLS, DECSCPP, DECSLPP) to adjust its visible win- + dow's size. The "cursor coupling" controls (DECHCCM, DECPCCM, + DECVCCM) are ignored. + +CSI = Ps c + Send Device Attributes (Tertiary DA). + Ps = 0 -> report Terminal Unit ID (default), VT400. XTerm + uses zeros for the site code and serial number in its DECRPTUI + response. + +CSI > Ps c + Send Device Attributes (Secondary DA). + Ps = 0 or omitted -> request the terminal's identification + code. The response depends on the decTerminalID resource set- + ting. It should apply only to VT220 and up, but xterm extends + this to VT100. + -> CSI > Pp ; Pv ; Pc c + where Pp denotes the terminal type + Pp = 0 -> "VT100". + Pp = 1 -> "VT220". + Pp = 2 -> "VT240" or "VT241". + Pp = 1 8 -> "VT330". + Pp = 1 9 -> "VT340". + Pp = 2 4 -> "VT320". + Pp = 3 2 -> "VT382". + Pp = 4 1 -> "VT420". + Pp = 6 1 -> "VT510". + Pp = 6 4 -> "VT520". + Pp = 6 5 -> "VT525". + + and Pv is the firmware version (for xterm, this was originally + the XFree86 patch number, starting with 95). In a DEC termi- + nal, Pc indicates the ROM cartridge registration number and is + always zero. + +CSI Ps d Line Position Absolute [row] (default = [1,column]) (VPA). + +CSI Ps e Line Position Relative [rows] (default = [row+1,column]) + (VPR). + +CSI Ps ; Ps f + Horizontal and Vertical Position [row;column] (default = + [1,1]) (HVP). + +CSI Ps g Tab Clear (TBC). + Ps = 0 -> Clear Current Column (default). + Ps = 3 -> Clear All. + +CSI Pm h Set Mode (SM). + Ps = 2 -> Keyboard Action Mode (AM). + Ps = 4 -> Insert Mode (IRM). + Ps = 1 2 -> Send/receive (SRM). + Ps = 2 0 -> Automatic Newline (LNM). + +CSI ? Pm h + DEC Private Mode Set (DECSET). + Ps = 1 -> Application Cursor Keys (DECCKM), VT100. + Ps = 2 -> Designate USASCII for character sets G0-G3 + (DECANM), VT100, and set VT100 mode. + Ps = 3 -> 132 Column Mode (DECCOLM), VT100. + Ps = 4 -> Smooth (Slow) Scroll (DECSCLM), VT100. + Ps = 5 -> Reverse Video (DECSCNM), VT100. + Ps = 6 -> Origin Mode (DECOM), VT100. + Ps = 7 -> Auto-wrap Mode (DECAWM), VT100. + Ps = 8 -> Auto-repeat Keys (DECARM), VT100. + Ps = 9 -> Send Mouse X & Y on button press. See the sec- + tion Mouse Tracking. This is the X10 xterm mouse protocol. + Ps = 1 0 -> Show toolbar (rxvt). + Ps = 1 2 -> Start Blinking Cursor (AT&T 610). + Ps = 1 3 -> Start Blinking Cursor (set only via resource or + menu). + Ps = 1 4 -> Enable XOR of Blinking Cursor control sequence + and menu. + Ps = 1 8 -> Print form feed (DECPFF), VT220. + Ps = 1 9 -> Set print extent to full screen (DECPEX), + VT220. + Ps = 2 5 -> Show Cursor (DECTCEM), VT220. + Ps = 3 0 -> Show scrollbar (rxvt). + Ps = 3 5 -> Enable font-shifting functions (rxvt). + Ps = 3 8 -> Enter Tektronix Mode (DECTEK), VT240, xterm. + Ps = 4 0 -> Allow 80 -> 132 Mode, xterm. + Ps = 4 1 -> more(1) fix (see curses resource). + Ps = 4 2 -> Enable National Replacement Character sets + (DECNRCM), VT220. + Ps = 4 4 -> Turn On Margin Bell, xterm. + Ps = 4 5 -> Reverse-wraparound Mode, xterm. + Ps = 4 6 -> Start Logging, xterm. This is normally dis- + abled by a compile-time option. + Ps = 4 7 -> Use Alternate Screen Buffer, xterm. This may + be disabled by the titeInhibit resource. + Ps = 6 6 -> Application keypad (DECNKM), VT320. + Ps = 6 7 -> Backarrow key sends backspace (DECBKM), VT340, + VT420. This sets the backarrowKey resource to "true". + Ps = 6 9 -> Enable left and right margin mode (DECLRMM), + VT420 and up. + Ps = 8 0 -> Enable Sixel Scrolling (DECSDM). + Ps = 9 5 -> Do not clear screen when DECCOLM is set/reset + (DECNCSM), VT510 and up. + Ps = 1 0 0 0 -> Send Mouse X & Y on button press and + release. See the section Mouse Tracking. This is the X11 + xterm mouse protocol. + Ps = 1 0 0 1 -> Use Hilite Mouse Tracking, xterm. + Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking, xterm. See + the section Button-event tracking. + Ps = 1 0 0 3 -> Use All Motion Mouse Tracking, xterm. See + the section Any-event tracking. + Ps = 1 0 0 4 -> Send FocusIn/FocusOut events, xterm. + Ps = 1 0 0 5 -> Enable UTF-8 Mouse Mode, xterm. + Ps = 1 0 0 6 -> Enable SGR Mouse Mode, xterm. + Ps = 1 0 0 7 -> Enable Alternate Scroll Mode, xterm. This + corresponds to the alternateScroll resource. + Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt). + This sets the scrollTtyOutput resource to "true". + Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt). This + sets the scrollKey resource to "true". + Ps = 1 0 1 5 -> Enable urxvt Mouse Mode. + Ps = 1 0 1 6 -> Enable SGR Mouse PixelMode, xterm. + Ps = 1 0 3 4 -> Interpret "meta" key, xterm. This sets the + eighth bit of keyboard input (and enables the eightBitInput + resource). + Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num- + Lock keys, xterm. This enables the numLock resource. + Ps = 1 0 3 6 -> Send ESC when Meta modifies a key, xterm. + This enables the metaSendsEscape resource. + Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete + key, xterm. + Ps = 1 0 3 9 -> Send ESC when Alt modifies a key, xterm. + This enables the altSendsEscape resource, xterm. + Ps = 1 0 4 0 -> Keep selection even if not highlighted, + xterm. This enables the keepSelection resource. + Ps = 1 0 4 1 -> Use the CLIPBOARD selection, xterm. This + enables the selectToClipboard resource. + Ps = 1 0 4 2 -> Enable Urgency window manager hint when + Control-G is received, xterm. This enables the bellIsUrgent + resource. + Ps = 1 0 4 3 -> Enable raising of the window when Control-G + is received, xterm. This enables the popOnBell resource. + Ps = 1 0 4 4 -> Reuse the most recent data copied to CLIP- + BOARD, xterm. This enables the keepClipboard resource. + Ps = 1 0 4 6 -> Enable switching to/from Alternate Screen + Buffer, xterm. This works for terminfo-based systems, updat- + ing the titeInhibit resource. + Ps = 1 0 4 7 -> Use Alternate Screen Buffer, xterm. This + may be disabled by the titeInhibit resource. + Ps = 1 0 4 8 -> Save cursor as in DECSC, xterm. This may + be disabled by the titeInhibit resource. + Ps = 1 0 4 9 -> Save cursor as in DECSC, xterm. After sav- + ing the cursor, switch to the Alternate Screen Buffer, clear- + ing it first. This may be disabled by the titeInhibit + resource. This control combines the effects of the 1 0 4 7 + and 1 0 4 8 modes. Use this with terminfo-based applications + rather than the 4 7 mode. + Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode, + xterm. + Ps = 1 0 5 1 -> Set Sun function-key mode, xterm. + Ps = 1 0 5 2 -> Set HP function-key mode, xterm. + Ps = 1 0 5 3 -> Set SCO function-key mode, xterm. + Ps = 1 0 6 0 -> Set legacy keyboard emulation, i.e, X11R6, + xterm. + Ps = 1 0 6 1 -> Set VT220 keyboard emulation, xterm. + Ps = 2 0 0 4 -> Set bracketed paste mode, xterm. + +CSI Ps i Media Copy (MC). + Ps = 0 -> Print screen (default). + Ps = 4 -> Turn off printer controller mode. + Ps = 5 -> Turn on printer controller mode. + Ps = 1 0 -> HTML screen dump, xterm. + Ps = 1 1 -> SVG screen dump, xterm. + +CSI ? Ps i + Media Copy (MC), DEC-specific. + Ps = 1 -> Print line containing cursor. + Ps = 4 -> Turn off autoprint mode. + Ps = 5 -> Turn on autoprint mode. + Ps = 1 0 -> Print composed display, ignores DECPEX. + Ps = 1 1 -> Print all pages. + +CSI Pm l Reset Mode (RM). + Ps = 2 -> Keyboard Action Mode (AM). + Ps = 4 -> Replace Mode (IRM). + Ps = 1 2 -> Send/receive (SRM). + Ps = 2 0 -> Normal Linefeed (LNM). + +CSI ? Pm l + DEC Private Mode Reset (DECRST). + Ps = 1 -> Normal Cursor Keys (DECCKM), VT100. + Ps = 2 -> Designate VT52 mode (DECANM), VT100. + Ps = 3 -> 80 Column Mode (DECCOLM), VT100. + Ps = 4 -> Jump (Fast) Scroll (DECSCLM), VT100. + Ps = 5 -> Normal Video (DECSCNM), VT100. + Ps = 6 -> Normal Cursor Mode (DECOM), VT100. + Ps = 7 -> No Auto-wrap Mode (DECAWM), VT100. + Ps = 8 -> No Auto-repeat Keys (DECARM), VT100. + Ps = 9 -> Don't send Mouse X & Y on button press, xterm. + Ps = 1 0 -> Hide toolbar (rxvt). + Ps = 1 2 -> Stop Blinking Cursor (AT&T 610). + Ps = 1 3 -> Disable Blinking Cursor (reset only via + resource or menu). + Ps = 1 4 -> Disable XOR of Blinking Cursor control sequence + and menu. + Ps = 1 8 -> Don't print form feed (DECPFF), VT220. + Ps = 1 9 -> Limit print to scrolling region (DECPEX), + VT220. + Ps = 2 5 -> Hide Cursor (DECTCEM), VT220. + Ps = 3 0 -> Don't show scrollbar (rxvt). + Ps = 3 5 -> Disable font-shifting functions (rxvt). + Ps = 4 0 -> Disallow 80 -> 132 Mode, xterm. + Ps = 4 1 -> No more(1) fix (see curses resource). + Ps = 4 2 -> Disable National Replacement Character sets + (DECNRCM), VT220. + Ps = 4 4 -> Turn Off Margin Bell, xterm. + Ps = 4 5 -> No Reverse-wraparound Mode, xterm. + Ps = 4 6 -> Stop Logging, xterm. This is normally disabled + by a compile-time option. + Ps = 4 7 -> Use Normal Screen Buffer, xterm. + Ps = 6 6 -> Numeric keypad (DECNKM), VT320. + Ps = 6 7 -> Backarrow key sends delete (DECBKM), VT340, + VT420. This sets the backarrowKey resource to "false". + Ps = 6 9 -> Disable left and right margin mode (DECLRMM), + VT420 and up. + Ps = 8 0 -> Disable Sixel Scrolling (DECSDM). + Ps = 9 5 -> Clear screen when DECCOLM is set/reset (DEC- + NCSM), VT510 and up. + Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and + release. See the section Mouse Tracking. + Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking, xterm. + Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking, + xterm. See the section Button-event tracking. + Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking, xterm. + See the section Any-event tracking. + Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events, xterm. + Ps = 1 0 0 5 -> Disable UTF-8 Mouse Mode, xterm. + Ps = 1 0 0 6 -> Disable SGR Mouse Mode, xterm. + Ps = 1 0 0 7 -> Disable Alternate Scroll Mode, xterm. This + corresponds to the alternateScroll resource. + Ps = 1 0 1 0 -> Don't scroll to bottom on tty output + (rxvt). This sets the scrollTtyOutput resource to "false". + Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt). + This sets the scrollKey resource to "false". + Ps = 1 0 1 5 -> Disable urxvt Mouse Mode. + Ps = 1 0 1 6 -> Disable SGR Mouse Pixel-Mode, xterm. + Ps = 1 0 3 4 -> Don't interpret "meta" key, xterm. This + disables the eightBitInput resource. + Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num- + Lock keys, xterm. This disables the numLock resource. + Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key, + xterm. This disables the metaSendsEscape resource. + Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad + Delete key, xterm. + Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key, + xterm. This disables the altSendsEscape resource. + Ps = 1 0 4 0 -> Do not keep selection when not highlighted, + xterm. This disables the keepSelection resource. + Ps = 1 0 4 1 -> Use the PRIMARY selection, xterm. This + disables the selectToClipboard resource. + Ps = 1 0 4 2 -> Disable Urgency window manager hint when + Control-G is received, xterm. This disables the bellIsUrgent + resource. + Ps = 1 0 4 3 -> Disable raising of the window when Control- + G is received, xterm. This disables the popOnBell resource. + Ps = 1 0 4 6 -> Disable switching to/from Alternate Screen + Buffer, xterm. This works for terminfo-based systems, updat- + ing the titeInhibit resource. If currently using the Alter- + nate Screen Buffer, xterm switches to the Normal Screen Buf- + fer. + Ps = 1 0 4 7 -> Use Normal Screen Buffer, xterm. Clear the + screen first if in the Alternate Screen Buffer. This may be + disabled by the titeInhibit resource. + Ps = 1 0 4 8 -> Restore cursor as in DECRC, xterm. This + may be disabled by the titeInhibit resource. + Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor + as in DECRC, xterm. This may be disabled by the titeInhibit + resource. This combines the effects of the 1 0 4 7 and 1 0 4 + 8 modes. Use this with terminfo-based applications rather + than the 4 7 mode. + Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode, + xterm. + Ps = 1 0 5 1 -> Reset Sun function-key mode, xterm. + Ps = 1 0 5 2 -> Reset HP function-key mode, xterm. + Ps = 1 0 5 3 -> Reset SCO function-key mode, xterm. + Ps = 1 0 6 0 -> Reset legacy keyboard emulation, i.e, + X11R6, xterm. + Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style, + xterm. + Ps = 2 0 0 4 -> Reset bracketed paste mode, xterm. + +CSI Pm m Character Attributes (SGR). + Ps = 0 -> Normal (default), VT100. + Ps = 1 -> Bold, VT100. + Ps = 2 -> Faint, decreased intensity, ECMA-48 2nd. + Ps = 3 -> Italicized, ECMA-48 2nd. + Ps = 4 -> Underlined, VT100. + Ps = 5 -> Blink, VT100. + This appears as Bold in X11R6 xterm. + Ps = 7 -> Inverse, VT100. + Ps = 8 -> Invisible, i.e., hidden, ECMA-48 2nd, VT300. + Ps = 9 -> Crossed-out characters, ECMA-48 3rd. + Ps = 2 1 -> Doubly-underlined, ECMA-48 3rd. + Ps = 2 2 -> Normal (neither bold nor faint), ECMA-48 3rd. + Ps = 2 3 -> Not italicized, ECMA-48 3rd. + Ps = 2 4 -> Not underlined, ECMA-48 3rd. + Ps = 2 5 -> Steady (not blinking), ECMA-48 3rd. + Ps = 2 7 -> Positive (not inverse), ECMA-48 3rd. + Ps = 2 8 -> Visible, i.e., not hidden, ECMA-48 3rd, VT300. + Ps = 2 9 -> Not crossed-out, ECMA-48 3rd. + Ps = 3 0 -> Set foreground color to Black. + Ps = 3 1 -> Set foreground color to Red. + Ps = 3 2 -> Set foreground color to Green. + Ps = 3 3 -> Set foreground color to Yellow. + Ps = 3 4 -> Set foreground color to Blue. + Ps = 3 5 -> Set foreground color to Magenta. + Ps = 3 6 -> Set foreground color to Cyan. + Ps = 3 7 -> Set foreground color to White. + Ps = 3 9 -> Set foreground color to default, ECMA-48 3rd. + Ps = 4 0 -> Set background color to Black. + Ps = 4 1 -> Set background color to Red. + Ps = 4 2 -> Set background color to Green. + Ps = 4 3 -> Set background color to Yellow. + Ps = 4 4 -> Set background color to Blue. + Ps = 4 5 -> Set background color to Magenta. + Ps = 4 6 -> Set background color to Cyan. + Ps = 4 7 -> Set background color to White. + Ps = 4 9 -> Set background color to default, ECMA-48 3rd. + + Some of the above note the edition of ECMA-48 which first + describes a feature. In its successive editions from 1979 to + 1991 (2nd 1979, 3rd 1984, 4th 1986, and 5th 1991), ECMA-48 + listed codes through 6 5 (skipping several toward the end of + the range). Most of the ECMA-48 codes not implemented in + xterm were never implemented in a hardware terminal. Several + (such as 3 9 and 4 9 ) are either noted in ECMA-48 as imple- + mentation defined, or described in vague terms. + + The successive editions of ECMA-48 give little attention to + changes from one edition to the next, except to comment on + features which have become obsolete. ECMA-48 1st (1976) is + unavailable; there is no reliable source of information which + states whether "ANSI" color was defined in that edition, or + later (1979). The VT100 (1978) implemented the most commonly + used non-color video attributes which are given in the 2nd + edition. + + While 8-color support is described in ECMA-48 2nd edition, the + VT500 series (introduced in 1993) were the first DEC terminals + implementing "ANSI" color. The DEC terminal's use of color is + known to differ from xterm; useful documentation on this + series became available too late to influence xterm. + + If 16-color support is compiled, the following aixterm con- + trols apply. Assume that xterm's resources are set so that + the ISO color codes are the first 8 of a set of 16. Then the + aixterm colors are the bright versions of the ISO colors: + + Ps = 9 0 -> Set foreground color to Black. + Ps = 9 1 -> Set foreground color to Red. + Ps = 9 2 -> Set foreground color to Green. + Ps = 9 3 -> Set foreground color to Yellow. + Ps = 9 4 -> Set foreground color to Blue. + Ps = 9 5 -> Set foreground color to Magenta. + Ps = 9 6 -> Set foreground color to Cyan. + Ps = 9 7 -> Set foreground color to White. + Ps = 1 0 0 -> Set background color to Black. + Ps = 1 0 1 -> Set background color to Red. + Ps = 1 0 2 -> Set background color to Green. + Ps = 1 0 3 -> Set background color to Yellow. + Ps = 1 0 4 -> Set background color to Blue. + Ps = 1 0 5 -> Set background color to Magenta. + Ps = 1 0 6 -> Set background color to Cyan. + Ps = 1 0 7 -> Set background color to White. + + If xterm is compiled with the 16-color support disabled, it + supports the following, from rxvt: + Ps = 1 0 0 -> Set foreground and background color to + default. + + XTerm maintains a color palette whose entries are identified + by an index beginning with zero. If 88- or 256-color support + is compiled, the following apply: + o All parameters are decimal integers. + o RGB values range from zero (0) to 255. + o The 88- and 256-color support uses subparameters described + in ISO-8613-6 for indexed color. ISO-8613-6 also mentions + direct color, using a similar scheme. xterm supports + that, too. + o xterm allows either colons (standard) or semicolons + (legacy) to separate the subparameters (but after the + first colon, colons must be used). + + The indexed- and direct-color features are summarized in the + FAQ, which explains why semicolon is accepted as a subparame- + ter delimiter: + + Can I set a color by its number? + + + These ISO-8613-6 controls (marked in ECMA-48 5th edition as + "reserved for future standardization") are supported by xterm: + Ps = 3 8 : 2 : Pi : Pr : Pg : Pb -> Set foreground color + using RGB values. If xterm is not compiled with direct-color + support, it uses the closest match in its palette for the + given RGB Pr/Pg/Pb. The color space identifier Pi is ignored. + Ps = 3 8 : 5 : Ps -> Set foreground color to Ps, using + indexed color. + Ps = 4 8 : 2 : Pi : Pr : Pg : Pb -> Set background color + using RGB values. If xterm is not compiled with direct-color + support, it uses the closest match in its palette for the + given RGB Pr/Pg/Pb. The color space identifier Pi is ignored. + Ps = 4 8 : 5 : Ps -> Set background color to Ps, using + indexed color. + + This variation on ISO-8613-6 is supported for compatibility + with KDE konsole: + Ps = 3 8 ; 2 ; Pr ; Pg ; Pb -> Set foreground color using + RGB values. If xterm is not compiled with direct-color sup- + port, it uses the closest match in its palette for the given + RGB Pr/Pg/Pb. + Ps = 4 8 ; 2 ; Pr ; Pg ; Pb -> Set background color using + RGB values. If xterm is not compiled with direct-color sup- + port, it uses the closest match in its palette for the given + RGB Pr/Pg/Pb. + + In each case, if xterm is compiled with direct-color support, + and the resource directColor is true, then rather than choos- + ing the closest match, xterm asks the X server to directly + render a given color. + +CSI > Pp ; Pv m +CSI > Pp m + Set/reset key modifier options (XTMODKEYS), xterm. Set or + reset resource-values used by xterm to decide whether to con- + struct escape sequences holding information about the modi- + fiers pressed with a given key. + + The first parameter Pp identifies the resource to set/reset. + The second parameter Pv is the value to assign to the + resource. + + If the second parameter is omitted, the resource is reset to + its initial value. Values 3 and 5 are reserved for keypad- + keys and string-keys. + + Pp = 0 -> modifyKeyboard. + Pp = 1 -> modifyCursorKeys. + Pp = 2 -> modifyFunctionKeys. + Pp = 4 -> modifyOtherKeys. + + If no parameters are given, all resources are reset to their + initial values. + +CSI Ps n Device Status Report (DSR). + Ps = 5 -> Status Report. + Result ("OK") is CSI 0 n + Ps = 6 -> Report Cursor Position (CPR) [row;column]. + Result is CSI r ; c R + + Note: it is possible for this sequence to be sent by a func- + tion key. For example, with the default keyboard configura- + tion the shifted F1 key may send (with shift-, control-, alt- + modifiers) + + CSI 1 ; 2 R , or + CSI 1 ; 5 R , or + CSI 1 ; 6 R , etc. + + The second parameter encodes the modifiers; values range from + 2 to 16. See the section PC-Style Function Keys for the + codes. The modifyFunctionKeys and modifyKeyboard resources + can change the form of the string sent from the modified F1 + key. + +CSI > Ps n + Disable key modifier options, xterm. These modifiers may be + enabled via the CSI > Pm m sequence. This control sequence + corresponds to a resource value of "-1", which cannot be set + with the other sequence. + + The parameter identifies the resource to be disabled: + + Ps = 0 -> modifyKeyboard. + Ps = 1 -> modifyCursorKeys. + Ps = 2 -> modifyFunctionKeys. + Ps = 4 -> modifyOtherKeys. + + If the parameter is omitted, modifyFunctionKeys is disabled. + When modifyFunctionKeys is disabled, xterm uses the modifier + keys to make an extended sequence of function keys rather than + adding a parameter to each function key to denote the modi- + fiers. + +CSI ? Ps n + Device Status Report (DSR, DEC-specific). + Ps = 6 -> Report Cursor Position (DECXCPR). The response + [row;column] is returned as + CSI ? r ; c R + (assumes the default page, i.e., "1"). + Ps = 1 5 -> Report Printer status. The response is + CSI ? 1 0 n (ready). or + CSI ? 1 1 n (not ready). + Ps = 2 5 -> Report UDK status. The response is + CSI ? 2 0 n (unlocked) + or + CSI ? 2 1 n (locked). + Ps = 2 6 -> Report Keyboard status. The response is + CSI ? 2 7 ; 1 ; 0 ; 0 n (North American). + + The last two parameters apply to VT300 & up (keyboard ready) + and VT400 & up (LK01) respectively. + + Ps = 5 3 -> Report Locator status. The response is CSI ? 5 + 3 n Locator available, if compiled-in, or CSI ? 5 0 n No + Locator, if not. + Ps = 5 5 -> Report Locator status. The response is CSI ? 5 + 3 n Locator available, if compiled-in, or CSI ? 5 0 n No + Locator, if not. + Ps = 5 6 -> Report Locator type. The response is CSI ? 5 7 + ; 1 n Mouse, if compiled-in, or CSI ? 5 7 ; 0 n Cannot iden- + tify, if not. + Ps = 6 2 -> Report macro space (DECMSR). The response is + CSI Pn * { . + Ps = 6 3 -> Report memory checksum (DECCKSR), VT420 and up. + The response is DCS Pt ! ~ x x x x ST . + Pt is the request id (from an optional parameter to the + request). + The x's are hexadecimal digits 0-9 and A-F. + Ps = 7 5 -> Report data integrity. The response is CSI ? 7 + 0 n (ready, no errors). + Ps = 8 5 -> Report multi-session configuration. The + response is CSI ? 8 3 n (not configured for multiple-session + operation). + +CSI > Ps p + Set resource value pointerMode (XTSMPOINTER), xterm. This is + used by xterm to decide whether to hide the pointer cursor as + the user types. + + Valid values for the parameter: + Ps = 0 -> never hide the pointer. + Ps = 1 -> hide if the mouse tracking mode is not enabled. + Ps = 2 -> always hide the pointer, except when leaving the + window. + Ps = 3 -> always hide the pointer, even if leaving/entering + the window. + + If no parameter is given, xterm uses the default, which is 1 . + +CSI ! p Soft terminal reset (DECSTR), VT220 and up. + +CSI Pl ; Pc " p + Set conformance level (DECSCL), VT220 and up. + + The first parameter selects the conformance level. Valid val- + ues are: + Pl = 6 1 -> level 1, e.g., VT100. + Pl = 6 2 -> level 2, e.g., VT200. + Pl = 6 3 -> level 3, e.g., VT300. + Pl = 6 4 -> level 4, e.g., VT400. + Pl = 6 5 -> level 5, e.g., VT500. + + The second parameter selects the C1 control transmission mode. + This is an optional parameter, ignored in conformance level 1. + Valid values are: + Pc = 0 -> 8-bit controls. + Pc = 1 -> 7-bit controls (DEC factory default). + Pc = 2 -> 8-bit controls. + + The 7-bit and 8-bit control modes can also be set by S7C1T and + S8C1T, but DECSCL is preferred. + +CSI Ps $ p + Request ANSI mode (DECRQM). For VT300 and up, reply DECRPM is + CSI Ps; Pm $ y + where Ps is the mode number as in SM/RM, and Pm is the mode + value: + 0 - not recognized + 1 - set + 2 - reset + 3 - permanently set + 4 - permanently reset + +CSI ? Ps $ p + Request DEC private mode (DECRQM). For VT300 and up, reply + DECRPM is + CSI ? Ps; Pm $ y + where Ps is the mode number as in DECSET/DECSET, Pm is the + mode value as in the ANSI DECRQM. + Two private modes are read-only (i.e., 1 3 and 1 4 ), pro- + vided only for reporting their values using this control + sequence. They correspond to the resources cursorBlink and + cursorBlinkXOR. +CSI # p +CSI Pm # p + Push video attributes onto stack (XTPUSHSGR), xterm. This is + an alias for CSI # { , used to work around language limita- + tions of C#. + +CSI > Ps q + Ps = 0 -> Report xterm name and version (XTVERSION). The + response is a DSR sequence identifying the version: DCS > | + text ST + +CSI Ps q Load LEDs (DECLL), VT100. + Ps = 0 -> Clear all LEDS (default). + Ps = 1 -> Light Num Lock. + Ps = 2 -> Light Caps Lock. + Ps = 3 -> Light Scroll Lock. + Ps = 2 1 -> Extinguish Num Lock. + Ps = 2 2 -> Extinguish Caps Lock. + Ps = 2 3 -> Extinguish Scroll Lock. + +CSI Ps SP q + Set cursor style (DECSCUSR), VT520. + Ps = 0 -> blinking block. + Ps = 1 -> blinking block (default). + Ps = 2 -> steady block. + Ps = 3 -> blinking underline. + Ps = 4 -> steady underline. + Ps = 5 -> blinking bar, xterm. + Ps = 6 -> steady bar, xterm. + +CSI Ps " q + Select character protection attribute (DECSCA), VT220. Valid + values for the parameter: + Ps = 0 -> DECSED and DECSEL can erase (default). + Ps = 1 -> DECSED and DECSEL cannot erase. + Ps = 2 -> DECSED and DECSEL can erase. + +CSI # q Pop video attributes from stack (XTPOPSGR), xterm. This is an + alias for CSI # } , used to work around language limitations + of C#. + +CSI Ps ; Ps r + Set Scrolling Region [top;bottom] (default = full size of win- + dow) (DECSTBM), VT100. + +CSI ? Pm r + Restore DEC Private Mode Values (XTRESTORE), xterm. The value + of Ps previously saved is restored. Ps values are the same as + for DECSET. + +CSI Pt ; Pl ; Pb ; Pr ; Ps $ r + Change Attributes in Rectangular Area (DECCARA), VT400 and up. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7. + +CSI s Save cursor, available only when DECLRMM is disabled (SCOSC, + also ANSI.SYS). + +CSI Pl ; Pr s + Set left and right margins (DECSLRM), VT420 and up. This is + available only when DECLRMM is enabled. + +CSI ? Pm s + Save DEC Private Mode Values (XTSAVE), xterm. Ps values are + the same as for DECSET. + +CSI Ps ; Ps ; Ps t + Window manipulation (XTWINOPS), dtterm, extended by xterm. + These controls may be disabled using the allowWindowOps + resource. + + xterm uses Extended Window Manager Hints (EWMH) to maximize + the window. Some window managers have incomplete support for + EWMH. For instance, fvwm, flwm and quartz-wm advertise sup- + port for maximizing windows horizontally or vertically, but in + fact equate those to the maximize operation. + + Valid values for the first (and any additional parameters) + are: + Ps = 1 -> De-iconify window. + Ps = 2 -> Iconify window. + Ps = 3 ; x ; y -> Move window to [x, y]. + Ps = 4 ; height ; width -> Resize the xterm window to + given height and width in pixels. Omitted parameters reuse + the current height or width. Zero parameters use the dis- + play's height or width. + Ps = 5 -> Raise the xterm window to the front of the stack- + ing order. + Ps = 6 -> Lower the xterm window to the bottom of the + stacking order. + Ps = 7 -> Refresh the xterm window. + Ps = 8 ; height ; width -> Resize the text area to given + height and width in characters. Omitted parameters reuse the + current height or width. Zero parameters use the display's + height or width. + Ps = 9 ; 0 -> Restore maximized window. + Ps = 9 ; 1 -> Maximize window (i.e., resize to screen + size). + Ps = 9 ; 2 -> Maximize window vertically. + Ps = 9 ; 3 -> Maximize window horizontally. + Ps = 1 0 ; 0 -> Undo full-screen mode. + Ps = 1 0 ; 1 -> Change to full-screen. + Ps = 1 0 ; 2 -> Toggle full-screen. + Ps = 1 1 -> Report xterm window state. + If the xterm window is non-iconified, it returns CSI 1 t . + If the xterm window is iconified, it returns CSI 2 t . + Ps = 1 3 -> Report xterm window position. + Note: X Toolkit positions can be negative, but the reported + values are unsigned, in the range 0-65535. Negative values + correspond to 32768-65535. + Result is CSI 3 ; x ; y t + Ps = 1 3 ; 2 -> Report xterm text-area position. + Result is CSI 3 ; x ; y t + Ps = 1 4 -> Report xterm text area size in pixels. + Result is CSI 4 ; height ; width t + Ps = 1 4 ; 2 -> Report xterm window size in pixels. + Normally xterm's window is larger than its text area, since it + includes the frame (or decoration) applied by the window man- + ager, as well as the area used by a scroll-bar. + Result is CSI 4 ; height ; width t + Ps = 1 5 -> Report size of the screen in pixels. + Result is CSI 5 ; height ; width t + Ps = 1 6 -> Report xterm character cell size in pixels. + Result is CSI 6 ; height ; width t + Ps = 1 8 -> Report the size of the text area in characters. + Result is CSI 8 ; height ; width t + Ps = 1 9 -> Report the size of the screen in characters. + Result is CSI 9 ; height ; width t + Ps = 2 0 -> Report xterm window's icon label. + Result is OSC L label ST + Ps = 2 1 -> Report xterm window's title. + Result is OSC l label ST + Ps = 2 2 ; 0 -> Save xterm icon and window title on stack. + Ps = 2 2 ; 1 -> Save xterm icon title on stack. + Ps = 2 2 ; 2 -> Save xterm window title on stack. + Ps = 2 3 ; 0 -> Restore xterm icon and window title from + stack. + Ps = 2 3 ; 1 -> Restore xterm icon title from stack. + Ps = 2 3 ; 2 -> Restore xterm window title from stack. + Ps >= 2 4 -> Resize to Ps lines (DECSLPP), VT340 and VT420. + xterm adapts this by resizing its window. + +CSI > Pm t + This xterm control sets one or more features of the title + modes (XTSMTITLE), xterm. Each parameter enables a single + feature. + Ps = 0 -> Set window/icon labels using hexadecimal. + Ps = 1 -> Query window/icon labels using hexadecimal. + Ps = 2 -> Set window/icon labels using UTF-8. + Ps = 3 -> Query window/icon labels using UTF-8. (See dis- + cussion of Title Modes) + +CSI Ps SP t + Set warning-bell volume (DECSWBV), VT520. + Ps = 0 or 1 -> off. + Ps = 2 , 3 or 4 -> low. + Ps = 5 , 6 , 7 , or 8 -> high. + +CSI Pt ; Pl ; Pb ; Pr ; Ps $ t + Reverse Attributes in Rectangular Area (DECRARA), VT400 and + up. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + Ps denotes the attributes to reverse, i.e., 1, 4, 5, 7. + +CSI u Restore cursor (SCORC, also ANSI.SYS). + +CSI Ps SP u + Set margin-bell volume (DECSMBV), VT520. + Ps = 0 , 5 , 6 , 7 , or 8 -> high. + Ps = 1 -> off. + Ps = 2 , 3 or 4 -> low. + +CSI Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ v + Copy Rectangular Area (DECCRA), VT400 and up. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + Pp denotes the source page. + Pt ; Pl denotes the target location. + Pp denotes the target page. + +CSI Ps $ w + Request presentation state report (DECRQPSR), VT320 and up. + Ps = 0 -> error. + Ps = 1 -> cursor information report (DECCIR). + Response is + DCS 1 $ u Pt ST + Refer to the VT420 programming manual, which requires six + pages to document the data string Pt, + Ps = 2 -> tab stop report (DECTABSR). + Response is + DCS 2 $ u Pt ST + The data string Pt is a list of the tab-stops, separated by + "/" characters. + +CSI Pt ; Pl ; Pb ; Pr ' w + Enable Filter Rectangle (DECEFR), VT420 and up. + Parameters are [top;left;bottom;right]. + Defines the coordinates of a filter rectangle and activates + it. Anytime the locator is detected outside of the filter + rectangle, an outside rectangle event is generated and the + rectangle is disabled. Filter rectangles are always treated + as "one-shot" events. Any parameters that are omitted default + to the current locator position. If all parameters are omit- + ted, any locator motion will be reported. DECELR always can- + cels any previous rectangle definition. + +CSI Ps x Request Terminal Parameters (DECREQTPARM). + if Ps is a "0" (default) or "1", and xterm is emulating VT100, + the control sequence elicits a response of the same form whose + parameters describe the terminal: + Ps -> the given Ps incremented by 2. + Pn = 1 <- no parity. + Pn = 1 <- eight bits. + Pn = 1 <- 2 8 transmit 38.4k baud. + Pn = 1 <- 2 8 receive 38.4k baud. + Pn = 1 <- clock multiplier. + Pn = 0 <- STP flags. + +CSI Ps * x + Select Attribute Change Extent (DECSACE), VT420 and up. + Ps = 0 -> from start to end position, wrapped. + Ps = 1 -> from start to end position, wrapped. + Ps = 2 -> rectangle (exact). + +CSI Pc ; Pt ; Pl ; Pb ; Pr $ x + Fill Rectangular Area (DECFRA), VT420 and up. + Pc is the character to use. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + +CSI Ps # y + Select checksum extension (XTCHECKSUM), xterm. The bits of Ps + modify the calculation of the checksum returned by DECRQCRA: + 0 -> do not negate the result. + 1 -> do not report the VT100 video attributes. + 2 -> do not omit checksum for blanks. + 3 -> omit checksum for cells not explicitly initialized. + 4 -> do not mask cell value to 8 bits or ignore combining + characters. + 5 -> do not mask cell value to 7 bits. + +CSI Pi ; Pg ; Pt ; Pl ; Pb ; Pr * y + Request Checksum of Rectangular Area (DECRQCRA), VT420 and up. + Response is + DCS Pi ! ~ x x x x ST + Pi is the request id. + Pg is the page number. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + The x's are hexadecimal digits 0-9 and A-F. + +CSI Ps ; Pu ' z + Enable Locator Reporting (DECELR). + Valid values for the first parameter: + Ps = 0 -> Locator disabled (default). + Ps = 1 -> Locator enabled. + Ps = 2 -> Locator enabled for one report, then disabled. + The second parameter specifies the coordinate unit for locator + reports. + Valid values for the second parameter: + Pu = 0 or omitted -> default to character cells. + Pu = 1 <- device physical pixels. + Pu = 2 <- character cells. + +CSI Pt ; Pl ; Pb ; Pr $ z + Erase Rectangular Area (DECERA), VT400 and up. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + +CSI Pm ' { + Select Locator Events (DECSLE). + Valid values for the first (and any additional parameters) + are: + Ps = 0 -> only respond to explicit host requests (DECRQLP). + This is default. It also cancels any filter rectangle. + Ps = 1 -> report button down transitions. + Ps = 2 -> do not report button down transitions. + Ps = 3 -> report button up transitions. + Ps = 4 -> do not report button up transitions. + +CSI # { +CSI Pm # { + Push video attributes onto stack (XTPUSHSGR), xterm. The + optional parameters correspond to the SGR encoding for video + attributes, except for colors (which do not have a unique SGR + code): + Ps = 1 -> Bold. + Ps = 2 -> Faint. + Ps = 3 -> Italicized. + Ps = 4 -> Underlined. + Ps = 5 -> Blink. + Ps = 7 -> Inverse. + Ps = 8 -> Invisible. + Ps = 9 -> Crossed-out characters. + Ps = 2 1 -> Doubly-underlined. + Ps = 3 0 -> Foreground color. + Ps = 3 1 -> Background color. + + If no parameters are given, all of the video attributes are + saved. The stack is limited to 10 levels. + +CSI Pt ; Pl ; Pb ; Pr $ { + Selective Erase Rectangular Area (DECSERA), VT400 and up. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + +CSI Pt ; Pl ; Pb ; Pr # | + Report selected graphic rendition (XTREPORTSGR), xterm. The + response is an SGR sequence which contains the attributes + which are common to all cells in a rectangle. + Pt ; Pl ; Pb ; Pr denotes the rectangle. + +CSI Ps $ | + Select columns per page (DECSCPP), VT340. + Ps = 0 -> 80 columns, default if Ps omitted. + Ps = 8 0 -> 80 columns. + Ps = 1 3 2 -> 132 columns. + +CSI Ps ' | + Request Locator Position (DECRQLP). + Valid values for the parameter are: + Ps = 0 , 1 or omitted -> transmit a single DECLRP locator + report. + + If Locator Reporting has been enabled by a DECELR, xterm will + respond with a DECLRP Locator Report. This report is also + generated on button up and down events if they have been + enabled with a DECSLE, or when the locator is detected outside + of a filter rectangle, if filter rectangles have been enabled + with a DECEFR. + + <- CSI Pe ; Pb ; Pr ; Pc ; Pp & w + + Parameters are [event;button;row;column;page]. + Valid values for the event: + Pe = 0 <- locator unavailable - no other parameters sent. + Pe = 1 <- request - xterm received a DECRQLP. + Pe = 2 <- left button down. + Pe = 3 <- left button up. + Pe = 4 <- middle button down. + Pe = 5 <- middle button up. + Pe = 6 <- right button down. + Pe = 7 <- right button up. + Pe = 8 <- M4 button down. + Pe = 9 <- M4 button up. + Pe = 1 0 <- locator outside filter rectangle. + The "button" parameter is a bitmask indicating which buttons + are pressed: + Pb = 0 <- no buttons down. + Pb & 1 <- right button down. + Pb & 2 <- middle button down. + Pb & 4 <- left button down. + Pb & 8 <- M4 button down. + The "row" and "column" parameters are the coordinates of the + locator position in the xterm window, encoded as ASCII deci- + mal. + The "page" parameter is not used by xterm. + +CSI Ps * | + Select number of lines per screen (DECSNLS), VT420 and up. + +CSI # } Pop video attributes from stack (XTPOPSGR), xterm. Popping + restores the video-attributes which were saved using XTPUSHSGR + to their previous state. + +CSI Ps ' } + Insert Ps Column(s) (default = 1) (DECIC), VT420 and up. + +CSI Ps ' ~ + Delete Ps Column(s) (default = 1) (DECDC), VT420 and up. + + +Operating System Commands + +OSC Ps ; Pt BEL + +OSC Ps ; Pt ST + Set Text Parameters. Some control sequences return informa- + tion: + o For colors and font, if Pt is a "?", the control sequence + elicits a response which consists of the control sequence + which would set the corresponding value. + o The dtterm control sequences allow you to determine the + icon name and window title. + + XTerm accepts either BEL or ST for terminating OSC + sequences, and when returning information, uses the same ter- + minator used in a query. While the latter is preferred, the + former is supported for legacy applications: + o Although documented in the changes for X.V10R4 (December + 1986), BEL as a string terminator dates from X11R4 + (December 1989). + o Since XFree86-3.1.2Ee (August 1996), xterm has accepted ST + (the documented string terminator in ECMA-48). + + Ps specifies the type of operation to perform: + Ps = 0 -> Change Icon Name and Window Title to Pt. + Ps = 1 -> Change Icon Name to Pt. + Ps = 2 -> Change Window Title to Pt. + Ps = 3 -> Set X property on top-level window. Pt should be + in the form "prop=value", or just "prop" to delete the prop- + erty. + Ps = 4 ; c ; spec -> Change Color Number c to the color + specified by spec. This can be a name or RGB specification as + per XParseColor. Any number of c/spec pairs may be given. + The color numbers correspond to the ANSI colors 0-7, their + bright versions 8-15, and if supported, the remainder of the + 88-color or 256-color table. + + If a "?" is given rather than a name or RGB specification, + xterm replies with a control sequence of the same form which + can be used to set the corresponding color. Because more than + one pair of color number and specification can be given in one + control sequence, xterm can make more than one reply. + + Ps = 5 ; c ; spec -> Change Special Color Number c to the + color specified by spec. This can be a name or RGB specifica- + tion as per XParseColor. Any number of c/spec pairs may be + given. The special colors can also be set by adding the maxi- + mum number of colors to these codes in an OSC 4 control: + + Pc = 0 <- resource colorBD (BOLD). + Pc = 1 <- resource colorUL (UNDERLINE). + Pc = 2 <- resource colorBL (BLINK). + Pc = 3 <- resource colorRV (REVERSE). + Pc = 4 <- resource colorIT (ITALIC). + + Ps = 6 ; c ; f -> Enable/disable Special Color Number c. + The second parameter tells xterm to enable the corresponding + color mode if nonzero, disable it if zero. OSC 6 is the same + as OSC 1 0 6 . + + The 10 colors (below) which may be set or queried using 1 0 + through 1 9 are denoted dynamic colors, since the correspond- + ing control sequences were the first means for setting xterm's + colors dynamically, i.e., after it was started. They are not + the same as the ANSI colors (however, the dynamic text fore- + ground and background colors are used when ANSI colors are + reset using SGR 3 9 and 4 9 , respectively). These controls + may be disabled using the allowColorOps resource. At least + one parameter is expected for Pt. Each successive parameter + changes the next color in the list. The value of Ps tells the + starting point in the list. The colors are specified by name + or RGB specification as per XParseColor. + + If a "?" is given rather than a name or RGB specification, + xterm replies with a control sequence of the same form which + can be used to set the corresponding dynamic color. Because + more than one pair of color number and specification can be + given in one control sequence, xterm can make more than one + reply. + + Ps = 1 0 -> Change VT100 text foreground color to Pt. + Ps = 1 1 -> Change VT100 text background color to Pt. + Ps = 1 2 -> Change text cursor color to Pt. + Ps = 1 3 -> Change pointer foreground color to Pt. + Ps = 1 4 -> Change pointer background color to Pt. + Ps = 1 5 -> Change Tektronix foreground color to Pt. + Ps = 1 6 -> Change Tektronix background color to Pt. + Ps = 1 7 -> Change highlight background color to Pt. + Ps = 1 8 -> Change Tektronix cursor color to Pt. + Ps = 1 9 -> Change highlight foreground color to Pt. + + Ps = 4 6 -> Change Log File to Pt. This is normally dis- + abled by a compile-time option. + + Ps = 5 0 -> Set Font to Pt. These controls may be disabled + using the allowFontOps resource. If Pt begins with a "#", + index in the font menu, relative (if the next character is a + plus or minus sign) or absolute. A number is expected but not + required after the sign (the default is the current entry for + relative, zero for absolute indexing). + + The same rule (plus or minus sign, optional number) is used + when querying the font. The remainder of Pt is ignored. + + A font can be specified after a "#" index expression, by + adding a space and then the font specifier. + + If the TrueType Fonts menu entry is set (the renderFont + resource), then this control sets/queries the faceName + resource. + + Ps = 5 1 -> reserved for Emacs shell. + + Ps = 5 2 -> Manipulate Selection Data. These controls may + be disabled using the allowWindowOps resource. The parameter + Pt is parsed as + Pc ; Pd + The first, Pc, may contain zero or more characters from the + set c , p , q , s , 0 , 1 , 2 , 3 , 4 , 5 , 6 , and 7 . It is + used to construct a list of selection parameters for clip- + board, primary, secondary, select, or cut buffers 0 through 7 + respectively, in the order given. If the parameter is empty, + xterm uses s 0 , to specify the configurable primary/clipboard + selection and cut buffer 0. + + The second parameter, Pd, gives the selection data. Normally + this is a string encoded in base64 (RFC-4648). The data + becomes the new selection, which is then available for pasting + by other applications. + + If the second parameter is a ? , xterm replies to the host + with the selection data encoded using the same protocol. It + uses the first selection found by asking successively for each + item from the list of selection parameters. + + If the second parameter is neither a base64 string nor ? , + then the selection is cleared. + + Ps = 1 0 4 ; c -> Reset Color Number c. It is reset to the + color specified by the corresponding X resource. Any number + of c parameters may be given. These parameters correspond to + the ANSI colors 0-7, their bright versions 8-15, and if sup- + ported, the remainder of the 88-color or 256-color table. If + no parameters are given, the entire table will be reset. + + Ps = 1 0 5 ; c -> Reset Special Color Number c. It is reset + to the color specified by the corresponding X resource. Any + number of c parameters may be given. These parameters corre- + spond to the special colors which can be set using an OSC 5 + control (or by adding the maximum number of colors using an + OSC 4 control). + + Ps = 1 0 6 ; c ; f -> Enable/disable Special Color Number c. + The second parameter tells xterm to enable the corresponding + color mode if nonzero, disable it if zero. + + Pc = 0 <- resource colorBDMode (BOLD). + Pc = 1 <- resource colorULMode (UNDERLINE). + Pc = 2 <- resource colorBLMode (BLINK). + Pc = 3 <- resource colorRVMode (REVERSE). + Pc = 4 <- resource colorITMode (ITALIC). + Pc = 5 <- resource colorAttrMode (Override ANSI). + + The dynamic colors can also be reset to their default + (resource) values: + Ps = 1 1 0 -> Reset VT100 text foreground color. + Ps = 1 1 1 -> Reset VT100 text background color. + Ps = 1 1 2 -> Reset text cursor color. + Ps = 1 1 3 -> Reset pointer foreground color. + Ps = 1 1 4 -> Reset pointer background color. + Ps = 1 1 5 -> Reset Tektronix foreground color. + Ps = 1 1 6 -> Reset Tektronix background color. + Ps = 1 1 7 -> Reset highlight color. + Ps = 1 1 8 -> Reset Tektronix cursor color. + Ps = 1 1 9 -> Reset highlight foreground color. + + Ps = I ; c -> Set icon to file. Sun shelltool, CDE dtterm. + The file is expected to be XPM format, and uses the same + search logic as the iconHint resource. + + Ps = l ; c -> Set window title. Sun shelltool, CDE dtterm. + + Ps = L ; c -> Set icon label. Sun shelltool, CDE dtterm. + + +Privacy Message + +PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not + be printable characters. + + +Alt and Meta Keys + +Many keyboards have keys labeled "Alt". Few have keys labeled "Meta". +However, xterm's default translations use the Meta modifier. Common +keyboard configurations assign the Meta modifier to an "Alt" key. By +using xmodmap one may have the modifier assigned to a different key, and +have "real" alt and meta keys. Here is an example: + + ! put meta on mod3 to distinguish it from alt + keycode 64 = Alt_L + clear mod1 + add mod1 = Alt_L + keycode 115 = Meta_L + clear mod3 + add mod3 = Meta_L + + +The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set) +can be used to control the way the Meta modifier applies to ordinary +keys unless the modifyOtherKeys resource is set: + +o prefix a key with the ESC character. + +o shift the key from codes 0-127 to 128-255 by adding 128. + +When modifyOtherKeys is set, ordinary keys may be sent as escape +sequences: + +o When modifyOtherKeys is set to 1, only the alt- and meta-modifiers + apply. For example, alt-Tab sends CSI 2 7 ; 3 ; 9 ~ (the second + parameter is "3" for alt, and the third parameter is the ASCII value + of tab, "9"). + +o When modifyOtherKeys is set to 2, all of the modifiers apply. For + example, shift-Tab sends CSI 2 7 ; 2 ; 9 ~ rather than CSI Z (the + second parameter is "2" for shift). + +The formatOtherKeys resource tells n to change the format of the escape +sequences sent when modifyOtherKeys applies. When modifyOtherKeys is +set to 1, for example alt-Tab sends CSI 9 ; 3 u (changing the order of +parameters). One drawback to this format is that applications may con- +fuse it with CSI u (restore-cursor). + +The xterm FAQ sections + + How can my program distinguish control-I from tab? + + XTerm - "Other" Modified Keys + +go into greater detail on this topic. + +The table shows the result for a given character "x" with modifiers +according to the default translations with the resources set on or off. +This assumes altIsNotMeta is set: + + ----------------------------------------------------------- + key altSendsEscape metaSendsEscape result + -----------+----------------+-----------------+------------ + x | off | off | x + Meta-x | off | off | shift + Alt-x | off | off | shift + Alt+Meta-x | off | off | shift + x | ON | off | x + Meta-x | ON | off | shift + Alt-x | ON | off | ESC x + Alt+Meta-x | ON | off | ESC shift + x | off | ON | x + Meta-x | off | ON | ESC x + Alt-x | off | ON | shift + Alt+Meta-x | off | ON | ESC shift + x | ON | ON | x + Meta-x | ON | ON | ESC x + Alt-x | ON | ON | ESC x + Alt+Meta-x | ON | ON | ESC x + -----------+----------------+-----------------+------------ + + + +PC-Style Function Keys + +If xterm does minimal translation of the function keys, it usually does +this with a PC-style keyboard, so PC-style function keys result. Sun +keyboards are similar to PC keyboards. Both have cursor and scrolling +operations printed on the keypad, which duplicate the smaller cursor and +scrolling keypads. + +X does not predefine NumLock (used for VT220 keyboards) or Alt (used as +an extension for the Sun/PC keyboards) as modifiers. These keys are +recognized as modifiers when enabled by the numLock resource, or by the +"DECSET 1 0 3 5 " control sequence. + +The cursor keys transmit the following escape sequences depending on the +mode specified via the DECCKM escape sequence. + + Key Normal Application + -------------+----------+------------- + Cursor Up | CSI A | SS3 A + Cursor Down | CSI B | SS3 B + Cursor Right | CSI C | SS3 C + Cursor Left | CSI D | SS3 D + -------------+----------+------------- + +The home- and end-keys (unlike PageUp and other keys also on the 6-key +editing keypad) are considered "cursor keys" by xterm. Their mode is +also controlled by the DECCKM escape sequence: + + Key Normal Application + ---------+----------+------------- + Home | CSI H | SS3 H + End | CSI F | SS3 F + ---------+----------+------------- + + +The application keypad transmits the following escape sequences depend- +ing on the mode specified via the DECKPNM and DECKPAM escape sequences. +Use the NumLock key to override the application mode. + +Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are +supported by the program. + + Key Numeric Application Terminfo Termcap + ---------------+----------+-------------+----------+---------- + Space | SP | SS3 SP | - | - + Tab | TAB | SS3 I | - | - + Enter | CR | SS3 M | kent | @8 + PF1 | SS3 P | SS3 P | kf1 | k1 + PF2 | SS3 Q | SS3 Q | kf2 | k2 + PF3 | SS3 R | SS3 R | kf3 | k3 + PF4 | SS3 S | SS3 S | kf4 | k4 + * (multiply) | * | SS3 j | - | - + + (add) | + | SS3 k | - | - + , (comma) | , | SS3 l | - | - + - (minus) | - | SS3 m | - | - + . (Delete) | . | CSI 3 ~ | - | - + / (divide) | / | SS3 o | - | - + 0 (Insert) | 0 | CSI 2 ~ | - | - + 1 (End) | 1 | SS3 F | kc1 | K4 + 2 (DownArrow) | 2 | CSI B | - | - + 3 (PageDown) | 3 | CSI 6 ~ | kc3 | K5 + 4 (LeftArrow) | 4 | CSI D | - | - + 5 (Begin) | 5 | CSI E | kb2 | K2 + 6 (RightArrow) | 6 | CSI C | - | - + 7 (Home) | 7 | SS3 H | ka1 | K1 + 8 (UpArrow) | 8 | CSI A | - | - + 9 (PageUp) | 9 | CSI 5 ~ | ka3 | K3 + = (equal) | = | SS3 X | - | - + ---------------+----------+-------------+----------+---------- + +They also provide 12 function keys, as well as a few other special-pur- +pose keys: + + Key Escape Sequence + ---------+----------------- + F1 | SS3 P + F2 | SS3 Q + F3 | SS3 R + F4 | SS3 S + F5 | CSI 1 5 ~ + F6 | CSI 1 7 ~ + F7 | CSI 1 8 ~ + F8 | CSI 1 9 ~ + F9 | CSI 2 0 ~ + F10 | CSI 2 1 ~ + F11 | CSI 2 3 ~ + F12 | CSI 2 4 ~ + ---------+----------------- + + +Note that F1 through F4 are prefixed with SS3 , while the other keys are +prefixed with CSI . Older versions of xterm implement different escape +sequences for F1 through F4, with a CSI prefix. These can be activated +by setting the oldXtermFKeys resource. However, since they do not cor- +respond to any hardware terminal, they have been deprecated. (The DEC +VT220 reserves F1 through F5 for local functions such as Setup). + + Key Escape Sequence + ---------+----------------- + F1 | CSI 1 1 ~ + F2 | CSI 1 2 ~ + F3 | CSI 1 3 ~ + F4 | CSI 1 4 ~ + ---------+----------------- + +In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is +false (and none of the other keyboard resources such as oldXtermFKeys +resource is set), xterm encodes function key modifiers as parameters +appended before the final character of the control sequence. As a spe- +cial case, the SS3 sent before F1 through F4 is altered to CSI when +sending a function key modifier as a parameter. + + Code Modifiers + ---------+--------------------------- + 2 | Shift + 3 | Alt + 4 | Shift + Alt + 5 | Control + 6 | Shift + Control + 7 | Alt + Control + 8 | Shift + Alt + Control + 9 | Meta + 10 | Meta + Shift + 11 | Meta + Alt + 12 | Meta + Alt + Shift + 13 | Meta + Ctrl + 14 | Meta + Ctrl + Shift + 15 | Meta + Ctrl + Alt + 16 | Meta + Ctrl + Alt + Shift + ---------+--------------------------- + +For example, shift-F5 would be sent as CSI 1 5 ; 2 ~ + +If the alwaysUseMods resource is set, the Meta modifier also is recog- +nized, making parameters 9 through 16. + +The codes used for the PC-style function keys were inspired by a feature +of the VT510, referred to in its reference manual as DECFNK. In the +DECFNK scheme, codes 2-8 identify modifiers for function-keys and cur- +sor-, editing-keypad keys. Unlike xterm, the VT510 limits the modifiers +which can be used with cursor- and editing-keypad keys. Although the +name "DECFNK" implies that it is a mode, the VT510 manual mentions it +only as a feature, which (like xterm) interacts with the DECUDK feature. +Unlike xterm, VT510/VT520 provide an extension to DECUDK (DECPFK and +DECPAK) which apparently was the reason for the feature in those termi- +nals, i.e., for identifying a programmable key rather than making it +simple for applications to obtain modifier information. It is not +described in the related VT520 manual. Neither manual was readily +available at the time the feature was added to xterm. + +On the other hand, the VT510 and VT520 reference manuals do document a +related feature. That is its emulation of the SCO console, which is +similar to the "xterm-sco" terminal description. The SCO console func- +tion-keys are less useful to applications developers than the approach +used by xterm because + +o the relationship between modifiers and the characters sent by func- + tion-keys is not readily apparent, and + +o the scheme is not extensible, i.e., it is an ad hoc assignment lim- + ited to two modifiers (shift and control). + + +VT220-Style Function Keys + +However, xterm is most useful as a DEC VT102 or VT220 emulator. Set the +sunKeyboard resource to true to force a Sun/PC keyboard to act like a +VT220 keyboard. + +The VT102/VT220 application keypad transmits unique escape sequences in +application mode, which are distinct from the cursor and scrolling key- +pad: + + Key Numeric Application VT100? + -------------+----------+-------------+---------- + Space | SP | SS3 SP | no + Tab | TAB | SS3 I | no + Enter | CR | SS3 M | yes + PF1 | SS3 P | SS3 P | yes + PF2 | SS3 Q | SS3 Q | yes + PF3 | SS3 R | SS3 R | yes + PF4 | SS3 S | SS3 S | yes + * (multiply) | * | SS3 j | no + + (add) | + | SS3 k | no + , (comma) | , | SS3 l | yes + - (minus) | - | SS3 m | yes + . (period) | . | SS3 n | yes + / (divide) | / | SS3 o | no + 0 | 0 | SS3 p | yes + 1 | 1 | SS3 q | yes + 2 | 2 | SS3 r | yes + 3 | 3 | SS3 s | yes + 4 | 4 | SS3 t | yes + 5 | 5 | SS3 u | yes + 6 | 6 | SS3 v | yes + 7 | 7 | SS3 w | yes + 8 | 8 | SS3 x | yes + 9 | 9 | SS3 y | yes + = (equal) | = | SS3 X | no + -------------+----------+-------------+---------- + + +The VT100/VT220 keypad did not have all of those keys. They were imple- +mented in xterm in X11R1 (1987), defining a mapping of all X11 keys +which might be provided on a keypad. For instance, a Sun4/II type-4 +keyboard provided "=" (equal), "/" (divide), and "*" (multiply). + +While the VT420 provided the same keypad, the VT520 used a PC-keyboard. +Because that keyboard's keypad lacks the "," (comma), it was not possi- +ble to use EDT's delete-character function with the keypad. XTerm +solves that problem for the VT220-keyboard configuration by mapping + + Ctrl + to , and + Ctrl - to - + +The VT220 provides a 6-key editing keypad, which is analogous to that on +the PC keyboard. It is not affected by DECCKM or DECKPNM/DECKPAM: + + Key Normal Application + ---------+----------+------------- + Insert | CSI 2 ~ | CSI 2 ~ + Delete | CSI 3 ~ | CSI 3 ~ + Home | CSI 1 ~ | CSI 1 ~ + End | CSI 4 ~ | CSI 4 ~ + PageUp | CSI 5 ~ | CSI 5 ~ + PageDown | CSI 6 ~ | CSI 6 ~ + ---------+----------+------------- + + +The VT220 provides 8 additional function keys. With a Sun/PC keyboard, +access these keys by Control/F1 for F13, etc. + + Key Escape Sequence + ---------+----------------- + F13 | CSI 2 5 ~ + F14 | CSI 2 6 ~ + F15 | CSI 2 8 ~ + F16 | CSI 2 9 ~ + F17 | CSI 3 1 ~ + F18 | CSI 3 2 ~ + F19 | CSI 3 3 ~ + F20 | CSI 3 4 ~ + ---------+----------------- + + + +VT52-Style Function Keys + +A VT52 does not have function keys, but it does have a numeric keypad +and cursor keys. They differ from the other emulations by the prefix. +Also, the cursor keys do not change: + + Key Normal/Application + -------------+-------------------- + Cursor Up | ESC A + Cursor Down | ESC B + Cursor Right | ESC C + Cursor Left | ESC D + -------------+-------------------- + +The keypad is similar: + + Key Numeric Application VT52? + -------------+----------+-------------+---------- + Space | SP | ESC ? SP | no + Tab | TAB | ESC ? I | no + Enter | CR | ESC ? M | no + PF1 | ESC P | ESC P | yes + PF2 | ESC Q | ESC Q | yes + PF3 | ESC R | ESC R | yes + PF4 | ESC S | ESC S | no + * (multiply) | * | ESC ? j | no + + (add) | + | ESC ? k | no + , (comma) | , | ESC ? l | no + - (minus) | - | ESC ? m | no + . (period) | . | ESC ? n | yes + / (divide) | / | ESC ? o | no + 0 | 0 | ESC ? p | yes + 1 | 1 | ESC ? q | yes + 2 | 2 | ESC ? r | yes + 3 | 3 | ESC ? s | yes + 4 | 4 | ESC ? t | yes + 5 | 5 | ESC ? u | yes + 6 | 6 | ESC ? v | yes + 7 | 7 | ESC ? w | yes + 8 | 8 | ESC ? x | yes + 9 | 9 | ESC ? y | yes + = (equal) | = | ESC ? X | no + -------------+----------+-------------+---------- + + + +Sun-Style Function Keys + +The xterm program provides support for Sun keyboards more directly, by a +menu toggle that causes it to send Sun-style function key codes rather +than VT220. Note, however, that the sun and VT100 emulations are not +really compatible. For example, their wrap-margin behavior differs. + +Only function keys are altered; keypad and cursor keys are the same. +The emulation responds identically. See the xterm-sun terminfo entry +for details. + + +HP-Style Function Keys + +Similarly, xterm can be compiled to support HP keyboards. See the +xterm-hp terminfo entry for details. + + +The Alternate Screen Buffer + +XTerm maintains two screen buffers. The Normal Screen Buffer allows you +to scroll back to view saved lines of output up to the maximum set by +the saveLines resource. The Alternate Screen Buffer is exactly as large +as the display, contains no additional saved lines. When the Alternate +Screen Buffer is active, you cannot scroll back to view saved lines. +XTerm provides control sequences and menu entries for switching between +the two. + +Most full-screen applications use terminfo or termcap to obtain strings +used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo, +or the corresponding ti and te for termcap. The titeInhibit resource +removes the ti and te strings from the TERMCAP string which is set in +the environment for some platforms. That is not done when xterm is +built with terminfo libraries because terminfo does not provide the +whole text of the termcap data in one piece. It would not work for ter- +minfo anyway, since terminfo data is not passed in environment vari- +ables; setting an environment variable in this manner would have no +effect on the application's ability to switch between Normal and Alter- +nate Screen buffers. Instead, the newer private mode controls (such as +1 0 4 9 ) for switching between Normal and Alternate Screen buffers sim- +ply disable the switching. They add other features such as clearing the +display for the same reason: to make the details of switching indepen- +dent of the application that requests the switch. + + +Bracketed Paste Mode + +When bracketed paste mode is set, pasted text is bracketed with control +sequences so that the program can differentiate pasted text from typed- +in text. When bracketed paste mode is set, the program will receive: + ESC [ 2 0 0 ~ , +followed by the pasted text, followed by + ESC [ 2 0 1 ~ . + + +Title Modes + +The window- and icon-labels can be set or queried using control +sequences. As a VT220-emulator, xterm "should" limit the character +encoding for the corresponding strings to ISO-8859-1. Indeed, it used +to be the case (and was documented) that window titles had to be +ISO-8859-1. This is no longer the case. However, there are many appli- +cations which still assume that titles are set using ISO-8859-1. So +that is the default behavior. + +If xterm is running with UTF-8 encoding, it is possible to use window- +and icon-labels encoded using UTF-8. That is because the underlying X +libraries (and many, but not all) window managers support this feature. + +The utf8Title X resource setting tells xterm to disable a reconversion +of the title string back to ISO-8859-1, allowing the title strings to be +interpreted as UTF-8. The same feature can be enabled using the title +mode control sequence described in this summary. + +Separate from the ability to set the titles, xterm provides the ability +to query the titles, returning them either in ISO-8859-1 or UTF-8. This +choice is available only while xterm is using UTF-8 encoding. + +Finally, the characters sent to, or returned by a title control are less +constrained than the rest of the control sequences. To make them more +manageable (and constrained), for use in shell scripts, xterm has an +optional feature which decodes the string from hexadecimal (for setting +titles) or for encoding the title into hexadecimal when querying the +value. + + +Mouse Tracking + +The VT widget can be set to send the mouse position and other informa- +tion on button presses. These modes are typically used by editors and +other full-screen applications that want to make use of the mouse. + +There are two sets of mutually exclusive modes: + +o mouse protocol + +o protocol encoding + +The mouse protocols include DEC Locator mode, enabled by the DECELR CSI +Ps ; Ps ' z control sequence, and is not described here (control +sequences are summarized above). The remaining five modes of the mouse +protocols are each enabled (or disabled) by a different parameter in the +"DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence. + +Manifest constants for the parameter values are defined in xcharmouse.h +as follows: + + #define SET_X10_MOUSE 9 + #define SET_VT200_MOUSE 1000 + #define SET_VT200_HIGHLIGHT_MOUSE 1001 + #define SET_BTN_EVENT_MOUSE 1002 + #define SET_ANY_EVENT_MOUSE 1003 + + #define SET_FOCUS_EVENT_MOUSE 1004 + + #define SET_ALTERNATE_SCROLL 1007 + + #define SET_EXT_MODE_MOUSE 1005 + #define SET_SGR_EXT_MODE_MOUSE 1006 + #define SET_URXVT_EXT_MODE_MOUSE 1015 + #define SET_PIXEL_POSITION_MOUSE 1016 + +The motion reporting modes are strictly xterm extensions, and are not +part of any standard, though they are analogous to the DEC VT200 DECELR +locator reports. + +Normally, parameters (such as pointer position and button number) for +all mouse tracking escape sequences generated by xterm encode numeric +parameters in a single character as value+32. For example, ! specifies +the value 1. The upper left character position on the terminal is +denoted as 1,1. This scheme dates back to X10, though the normal mouse- +tracking (from X11) is more elaborate. + + +X10 compatibility mode + +X10 compatibility mode sends an escape sequence only on button press, +encoding the location and the mouse button pressed. It is enabled by +specifying parameter 9 to DECSET. On button press, xterm sends CSI M +CbCxCy (6 characters). + +o Cb is button-1, where button is 1, 2 or 3. + +o Cx and Cy are the x and y coordinates of the mouse when the button + was pressed. + + +Normal tracking mode + +Normal tracking mode sends an escape sequence on both button press and +release. Modifier key (shift, ctrl, meta) information is also sent. It +is enabled by specifying parameter 1000 to DECSET. On button press or +release, xterm sends CSI M CbCxCy. + +o The low two bits of Cb encode button information: 0=MB1 pressed, + 1=MB2 pressed, 2=MB3 pressed, 3=release. + +o The next three bits encode the modifiers which were down when the + button was pressed and are added together: 4=Shift, 8=Meta, 16=Con- + trol. Note however that the shift and control bits are normally + unavailable because xterm uses the control modifier with mouse for + popup menus, and the shift modifier is used in the default transla- + tions for button events. The Meta modifier recognized by xterm is + the mod1 mask, and is not necessarily the "Meta" key (see + xmodmap(1)). + +o Cx and Cy are the x and y coordinates of the mouse event, encoded as + in X10 mode. + + +Wheel mice + +Wheel mice may return buttons 4 and 5. Those buttons are represented by +the same event codes as buttons 1 and 2 respectively, except that 64 is +added to the event code. Release events for the wheel buttons are not +reported. + +By default, the wheel mouse events (buttons 4 and 5) are translated to +scroll-back and scroll-forw actions, respectively. Those actions nor- +mally scroll the whole window, as if the scrollbar was used. + +However if Alternate Scroll mode is set, then cursor up/down controls +are sent when the terminal is displaying the Alternate Screen Buffer. +The initial state of Alternate Scroll mode is set using the alternate- +Scroll resource. + + +Other buttons + +Some wheel mice can send additional button events, e.g., by tilting the +scroll wheel left and right. + +Additional buttons are encoded like the wheel mice, + +o by adding 64 (for buttons 6 and 7), or + +o by adding 128 (for buttons 8 through 11). + +Past button 11, the encoding is ambiguous because the same code may cor- +respond to different button/modifier combinations. + +It is not possible to use these buttons (6-11) in xterm's translations +resource because their names are not in the X Toolkit's symbol table. +However, applications can check for the reports, e.g., button 7 (left) +and button 6 (right) with a Logitech mouse. + + +Highlight tracking + +Mouse highlight tracking notifies a program of a button press, receives +a range of lines from the program, highlights the region covered by the +mouse within that range until button release, and then sends the program +the release coordinates. It is enabled by specifying parameter 1001 to +DECSET. Highlighting is performed only for button 1, though other but- +ton events can be received. + +Warning: this mode requires a cooperating program, else xterm will hang. + +On button press, the same information as for normal tracking is gener- +ated; xterm then waits for the program to send mouse tracking informa- +tion. All X events are ignored until the proper escape sequence is +received from the pty: +CSI Ps ; Ps ; Ps ; Ps ; Ps T + +The parameters are func, startx, starty, firstrow, and lastrow: + +o func is non-zero to initiate highlight tracking and zero to abort. + +o startx and starty give the starting x and y location for the high- + lighted region. + +o The ending location tracks the mouse, but will never be above row + firstrow and will always be above row lastrow. (The top of the + screen is row 1.) + +When the button is released, xterm reports the ending position one of +two ways: + +o if the start and end coordinates are the same locations: + + CSI t CxCy + +o otherwise: + + CSI T CxCyCxCyCxCy + +The parameters are startx, starty, endx, endy, mousex, and mousey: + +o startx, starty, endx, and endy give the starting and ending charac- + ter positions of the region. + +o mousex and mousey give the location of the mouse at button up, which + may not be over a character. + + +Button-event tracking + +Button-event tracking is essentially the same as normal tracking, but +xterm also reports button-motion events. Motion events are reported +only if the mouse pointer has moved to a different character cell. It +is enabled by specifying parameter 1002 to DECSET. On button press or +release, xterm sends the same codes used by normal tracking mode. + +o On button-motion events, xterm adds 32 to the event code (the third + character, Cb). + +o The other bits of the event code specify button and modifier keys as + in normal mode. For example, motion into cell x,y with button 1 + down is reported as + + CSI M @ CxCy + + ( @ = 32 + 0 (button 1) + 32 (motion indicator) ). Similarly, + motion with button 3 down is reported as + + CSI M B CxCy + + ( B = 32 + 2 (button 3) + 32 (motion indicator) ). + + +Any-event tracking + +Any-event mode is the same as button-event mode, except that all motion +events are reported, even if no mouse button is down. It is enabled by +specifying 1003 to DECSET. + + +FocusIn/FocusOut + +FocusIn/FocusOut can be combined with any of the mouse events since it +uses a different protocol. When set, it causes xterm to send CSI I +when the terminal gains focus, and CSI O when it loses focus. + + +Extended coordinates + +The original X10 mouse protocol limits the Cx and Cy ordinates to 223 +(=255 - 32). XTerm supports more than one scheme for extending this +range, by changing the protocol encoding: + +UTF-8 (1005) + This enables UTF-8 encoding for Cx and Cy under all tracking + modes, expanding the maximum encodable position from 223 to + 2015. For positions less than 95, the resulting output is + identical under both modes. Under extended mouse mode, posi- + tions greater than 95 generate "extra" bytes which will con- + fuse applications which do not treat their input as a UTF-8 + stream. Likewise, Cb will be UTF-8 encoded, to reduce confu- + sion with wheel mouse events. + + Under normal mouse mode, positions outside (160,94) result in + byte pairs which can be interpreted as a single UTF-8 charac- + ter; applications which do treat their input as UTF-8 will + almost certainly be confused unless extended mouse mode is + active. + + This scheme has the drawback that the encoded coordinates will + not pass through luit(1) unchanged, e.g., for locales using + non-UTF-8 encoding. + +SGR (1006) + The normal mouse response is altered to use + + o CSI < followed by semicolon-separated + + o encoded button value, + + o Px and Py ordinates and + + o a final character which is M for button press and m for + button release. + + The encoded button value in this case does not add 32 since + that was useful only in the X10 scheme for ensuring that the + byte containing the button value is a printable code. + + o The modifiers are encoded in the same way. + + o A different final character is used for button release to + resolve the X10 ambiguity regarding which button was + released. + + The highlight tracking responses are also modified to an SGR- + like format, using the same SGR-style scheme and button-encod- + ings. + +URXVT (1015) + The normal mouse response is altered to use + + o CSI followed by semicolon-separated + + o encoded button value, + + o the Px and Py ordinates and final character M . + + This uses the same button encoding as X10, but printing it as + a decimal integer rather than as a single byte. + + However, CSI M can be mistaken for DL (delete lines), while + the highlight tracking CSI T can be mistaken for SD (scroll + down), and the Window manipulation controls. For these rea- + sons, the 1015 control is not recommended; it is not an + improvement over 1006. + +SGR-Pixels (1016) + Use the same mouse response format as the 1006 control, but + report position in pixels rather than character cells. + + +Sixel Graphics + +If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the +decTerminalID resource, it supports Sixel Graphics controls, a palleted +bitmap graphics system using sets of six vertical pixels as the basic +element. + +CSI Ps c Send Device Attributes (Primary DA), xterm. xterm responds to + Send Device Attributes (Primary DA) with these additional + codes: + Ps = 4 -> Sixel graphics. + +CSI ? Pm h + Set Mode, xterm. xterm has these additional private Set Mode + values: + Ps = 8 0 -> Sixel scrolling. + Ps = 1 0 7 0 -> use private color registers for each + graphic. + Ps = 8 4 5 2 -> Sixel scrolling leaves cursor to right of + graphic. + +DCS Pa ; Pb ; Ph q Ps..Ps ST + Send SIXEL image, DEC graphics terminals, xterm. See: + + VT330/VT340 Programmer Reference Manual Volume 2: + Graphics Programming + Chapter 14 Graphics Programming + + The sixel data device control string has three positional + parameters, following the q with sixel data. + Pa -> pixel aspect ratio + Pb -> background color option + Ph -> horizontal grid size (ignored). + Ps -> sixel data + + +ReGIS Graphics + +If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the +decTerminalID resource, it supports Remote Graphic Instruction Set, a +graphics description language. + +CSI Ps c Send Device Attributes (Primary DA), DEC graphics terminals, + xterm. xterm responds to Send Device Attributes (Primary DA) + with these additional codes: + Ps = 3 -> ReGIS graphics. + +CSI ? Pm h + Set Mode, xterm. xterm has these additional private Set Mode + values: + Ps = 1 0 7 0 -> use private color registers for each + graphic. + +DCS Pm p Pr..Pr ST + Enter or exit ReGIS, VT300, xterm. See: + + VT330/VT340 Programmer Reference Manual Volume 2: + Graphics Programming + Chapter 1 Introduction to ReGIS + + The ReGIS data device control string has one positional param- + eter with four possible values: + Pm = 0 -> resume command, use fullscreen mode. + Pm = 1 -> start new command, use fullscreen mode. + Pm = 2 -> resume command, use command display mode. + Pm = 3 -> start new command, use command display mode. + + +Tektronix 4014 Mode + +Most of these sequences are standard Tektronix 4014 control sequences. +Graph mode supports the 12-bit addressing of the Tektronix 4014. The +major features missing are the write-through and defocused modes. This +document does not describe the commands used in the various Tektronix +plotting modes but does describe the commands to switch modes. + +Some of the sequences are specific to xterm. The Tektronix emulation +was added in X10R4 (1986). The VT240, introduced two years earlier, +also supported Tektronix 4010/4014. Unlike xterm, the VT240 documenta- +tion implies (there is an obvious error in section 6.9 "Entering and +Exiting 4010/4014 Mode") that exiting back to ANSI mode is done by +resetting private mode 3 8 (DECTEK) rather than ESC ETX . A real Tek- +tronix 4014 would not respond to either. + +BEL Bell (Ctrl-G). + +BS Backspace (Ctrl-H). + +TAB Horizontal Tab (Ctrl-I). + +LF Line Feed or New Line (Ctrl-J). + +VT Cursor up (Ctrl-K). + +FF Form Feed or New Page (Ctrl-L). + +CR Carriage Return (Ctrl-M). + +ESC ETX Switch to VT100 Mode (ESC Ctrl-C). + +ESC ENQ Return Terminal Status (ESC Ctrl-E). + +ESC FF PAGE (Clear Screen) (ESC Ctrl-L). + +ESC SO Begin 4015 APL mode (ESC Ctrl-N). This is ignored by xterm. + +ESC SI End 4015 APL mode (ESC Ctrl-O). This is ignored by xterm. + +ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss). + ETB (end transmission block) is the same as Ctrl-W. + +ESC CAN Bypass Condition (ESC Ctrl-X). + +ESC SUB GIN mode (ESC Ctrl-Z). + +ESC FS Special Point Plot Mode (ESC Ctrl-\). + +ESC 8 Select Large Character Set. + +ESC 9 Select #2 Character Set. + +ESC : Select #3 Character Set. + +ESC ; Select Small Character Set. + +OSC Ps ; Pt BEL + Set Text Parameters of VT window. + Ps = 0 -> Change Icon Name and Window Title to Pt. + Ps = 1 -> Change Icon Name to Pt. + Ps = 2 -> Change Window Title to Pt. + Ps = 4 6 -> Change Log File to Pt. This is normally dis- + abled by a compile-time option. + +ESC ` Normal Z Axis and Normal (solid) Vectors. + +ESC a Normal Z Axis and Dotted Line Vectors. + +ESC b Normal Z Axis and Dot-Dashed Vectors. + +ESC c Normal Z Axis and Short-Dashed Vectors. + +ESC d Normal Z Axis and Long-Dashed Vectors. + +ESC h Defocused Z Axis and Normal (solid) Vectors. + +ESC i Defocused Z Axis and Dotted Line Vectors. + +ESC j Defocused Z Axis and Dot-Dashed Vectors. + +ESC k Defocused Z Axis and Short-Dashed Vectors. + +ESC l Defocused Z Axis and Long-Dashed Vectors. + +ESC p Write-Thru Mode and Normal (solid) Vectors. + +ESC q Write-Thru Mode and Dotted Line Vectors. + +ESC r Write-Thru Mode and Dot-Dashed Vectors. + +ESC s Write-Thru Mode and Short-Dashed Vectors. + +ESC t Write-Thru Mode and Long-Dashed Vectors. + +FS Point Plot Mode (Ctrl-\). + +GS Graph Mode (Ctrl-]). + +RS Incremental Plot Mode (Ctrl-^ ). + +US Alpha Mode (Ctrl-_). + + +VT52 Mode + +Parameters for cursor movement are at the end of the ESC Y escape +sequence. Each ordinate is encoded in a single character as value+32. +For example, ! is 1. The screen coordinate system is 0-based. + +ESC < Exit VT52 mode (Enter VT100 mode). + +ESC = Enter alternate keypad mode. + +ESC > Exit alternate keypad mode. + +ESC A Cursor up. + +ESC B Cursor down. + +ESC C Cursor right. + +ESC D Cursor left. + +ESC F Enter graphics mode. + +ESC G Exit graphics mode. + +ESC H Move the cursor to the home position. + +ESC I Reverse line feed. + +ESC J Erase from the cursor to the end of the screen. + +ESC K Erase from the cursor to the end of the line. + +ESC Y Ps Ps + Move the cursor to given row and column. + +ESC Z Identify. + -> ESC / Z ("I am a VT52."). + + +Further reading + + +Technical manuals + +Manuals for hardware terminals are more readily available than simi- +larly-detailed documentation for terminal emulators such as aixterm, +shelltool, dtterm. + +However long, the technical manuals have problems: + +o DEC's manuals did not provide a comprehensive comparison of the fea- + tures in different model. + + Peter Sichel's Host Interface Functions Checklist spreadsheet is + useful for noting which model introduced a given feature (although + there are a few apparent errors such as the DECRQSS feature cited + for VT320 whereas the technical manual omits it). + +o Sometimes the manuals disagree. For example, DEC's standard docu- + ment (DEC STD 070) for terminals says that DECSCL performs a soft + reset (DECSTR), while the VT420 manual says it does a hard reset + (RIS). + +o Sometimes the manuals are simply incorrect. For example, testing a + DEC VT420 in 1996 showed that the documented code for a valid or + invalid response to DECRQSS was reversed. + + The VT420 test results were incorporated into vttest program. At + the time, DEC STD 070 was not available, but it also agrees with + vttest. Later, documentation for the DEC VT525 was shown to have + the same flaw. + +o Not all details are clear even in DEC STD 070 (which is more than + twice the length of the VT520 programmer's reference manual, and + almost three times longer than the VT420 reference manual). How- + ever, as an internal standards document, DEC STD 070 is more likely + to describe the actual behavior of DEC's terminals than the more + polished user's guides. + +That said, here are technical manuals which have been used in developing +xterm. Not all were available initially. In August 1996 for instance, +the technical references were limited to EK-VT220-HR-002 and EK- +VT420-UG.002. Shortly after, Richard Shuford sent a copy of EK-VT3XX- +TP-001. Still later (beginning in 2003), Paul Williams' vt100.net site +provided EK-VT102-UG-003, EK-VT220-RM-002, EK-VT420-RM-002, EK-VT520-RM +A01, EK-VT100-TM-003, and EK-VT102-UG-003. The remaining documents were +found on the bitsavers site. + +o DECscope User's Manual. + Digital Equipment Corporation (EK-VT5X-OP-001 1975). + +o VT100 Series Video Terminal Technical Manual. + Digital Equipment Corporation (EK-VT100-TM-003, July 1982). + +o VT100 User Guide. + Digital Equipment Corporation (EK-VT100-UG-003, June 1981). + +o VT102 User Guide. + Digital Equipment Corporation (EK-VT102-UG-003, February 1982). + +o VT220 Programmer Pocket Guide. + Digital Equipment Corporation (EK-VT220-HR-002, July 1984). + +o VT220 Programmer Reference Manual. + Digital Equipment Corporation (EK-VT220-RM-002, August 1984). + +o VT240 Programmer Reference Manual. + Digital Equipment Corporation (EK-VT240-RM-002, October 1984). + +o VT330/VT340 Programmer Reference Manual + Volume 1: Text Programming. + Digital Equipment Corporation (EK-VT3XX-TP-001, March 1987). + +o VT330/VT340 Programmer Reference Manual + Volume 2: Graphics Programming. + Digital Equipment Corporation (EK-VT3XX-GP-001, March 1987). + +o Installing and Using + The VT420 Video Terminal + (North American Model). + Digital Equipment Corporation (EK-VT420-UG.002, February 1990). + +o VT420 Programmer Reference Manual. + Digital Equipment Corporation (EK-VT420-RM-002, February 1992). + +o VT510 Video Terminal + Programmer Information. + Digital Equipment Corporation (EK-VT510-RM B01, November 1993). + +o VT520/VT525 Video Terminal + Programmer Information. + Digital Equipment Corporation (EK-VT520-RM A01, July 1994). + +o Digital ANSI-Compliant Printing Protocol + Level 2 Programming Reference Manual + Digital Equipment Corporation (EK-PPLV2-PM B01, August 1994). + +o 4014 and 4014-1 Computer Display Terminal + User's Manual. + Tektronix, Inc. (070-1647-00, November 1979). + + +Standards + +The DEC terminal family (VT100 through VT525) is upward-compatible, +using standards plus extensions, e.g., "private modes". Not all com- +monly-used features are standard. For example, scrolling regions are +not found in ECMA-48. + +Again, it is possible to find discrepancies in the standards: + +o The printed ECMA-48 5th edition (1991) and the first PDF produced + for that edition (April 1998) state that SD (scroll down) ends with + 05/14, i.e., ^ , which disagrees with DEC's VT420 hardware implemen- + tation and DEC's manuals which use 05/04 T . (A few other terminals + such as AT&T 5620 and IBM 5151 also used 05/04, but the documenta- + tion and dates are lacking). + + ECMA created a new PDF in April 2003 which changed that detail to + use T , and later in 2008 provided PDFs of the earlier editions + which used T . + +o The VT320, VT420, VT520 manuals claim that DECSCL does a hard reset + (RIS). + + Both the VT220 manual and DEC STD 070 (which documents levels 1-4 in + detail) state that it is a soft reset, e.g., DECSTR. + +Here are the relevant standards: + +o ECMA-35: Character Code Structure and Extension Techniques + (6th Edition, December 1994). + +o ECMA-43: 8-bit Coded Character Set Structure and Rules + (3rd Edition, December 1991). + +o ECMA-48: Control Functions for Coded Character Sets + (5th Edition, June 1991). + +o DEC STD 070 Video Systems Reference Manual. + Digital Equipment Corporation (A-MN-ELSM070-00-0000 Rev H, December + 3, 1991). + + +Miscellaneous + +A few hardware terminals survived into the 1990s only as terminal emula- +tors. Documentation for these and other terminal emulators which have +influenced xterm are generally available only in less-accessible and +less-detailed manual pages. + +o XTerm supports control sequences for manipulating its window which + were implemented by Sun's shelltool program. This was part of Sun- + View (SunOS 3.0, 1986). The change-notes for xterm's resize program + in X10.4 (1986) mention its use of these "Sun tty emulation escape + sequences" for resizing the window. The X10.4 xterm program recog- + nized these sequences for resizing the terminal, except for the + iconify/deiconify pair. SunView also introduced the SIGWINCH sig- + nal, used by the X10.4 xterm and mentioned in its CHANGES file: + + The window size is passed to the operating system via TIOCSWINSZ + (4.3) or TIOCSSIZE (sun). A SIGWINCH signal is sent if the + vtXXX window is resized. + + While support for the Sun control-sequences remained in resize, the + next release of xterm (X11R1 in 1987) omitted the code for inter- + preting them. + + Later, the SunView program was adapted for the OPEN LOOK environment + introduced 1988-1990. + + Still later, in 1995, OPEN LOOK was abandoned in favor of CDE. The + CDE terminal emulator dtterm implemented those controls, with a cou- + ple of additions. + + Starting in July 1996, xterm re-implemented those control sequences + (based on the dtterm manual pages) and further extended the group of + window controls. + + There were two sets of controls (CSI Ps [ ; Pm ; Pm ] t , and OSC Ps + text ST ) implemented by shelltool, documented in appendix E of both + PHIGS Programming Manual (1992), and the unpublished X Window System + User's Guide (OPEN LOOK Edition) (1995). The CDE program kept + those, and added a few new ones. + + Code Sun CDE XTerm Description + ----------------------------------------------------------------- + CSI 1 t yes yes yes de-iconify + CSI 2 t yes yes yes iconify + CSI 3 t yes yes yes move window to pixel-position + CSI 4 t yes yes yes resize window in pixels + CSI 5 t yes yes yes raise window to front of stack + CSI 6 t yes yes yes raise window to back of stack + CSI 7 t yes yes yes refresh window + CSI 8 t yes yes yes resize window in chars + CSI 9 t - - yes maximize/unmaximize window + CSI 1 0 t - - yes to/from full-screen + CSI 1 1 t yes yes yes report if window is iconified + CSI 1 2 t - - - - + CSI 1 3 t yes yes yes report window position + CSI 1 4 t yes yes yes report window size in pixels + CSI 1 5 t - - yes report screen size in pixels + CSI 1 6 t - - yes report character cell in pixels + CSI 1 7 t - - - - + CSI 1 8 t yes yes yes report window size in chars + CSI 1 9 t - - yes report screen size in chars + CSI 2 0 t - yes yes report icon label + CSI 2 1 t - yes yes report window title + CSI 2 2 t - - yes save window/icon title + CSI 2 3 t - - yes restore window/icon title + CSI 2 4 t - - yes resize window (DECSLPP) + OSC 0 ST - yes yes set window and icon title + OSC 1 ST - yes yes set icon label + OSC 2 ST - yes yes set window title + OSC 3 ST - n/a yes set X server property + OSC I ST yes yes yes set icon to file + OSC l ST yes yes yes set window title + OSC L ST yes yes yes set icon label + + Besides the Sun-derived OSC controls for setting window title and + icon label, dtterm also supported the xterm controls for the same + feature. + + The CDE source was unavailable for inspection until 2012, so that + clarification of the details of the window operations relied upon + vttest. + +o The control sequences for saving/restoring the cursor and for sav- + ing/restoring "DEC Private Mode Values" may appear to be related + (since the "save" controls both end with s ), but that is coinciden- + tal. The latter was introduced in X10.4: + + Most Dec Private mode settings can be saved away internally + using \E[?ns, where n is the same number to set or reset the Dec + Private mode. The mode can be restored using \E[?nr. This can + be used in termcap for vi, for example, to turn off saving of + lines, but restore whatever the original state was on exit. + + while the SCOSC/SCORC pair was added in 1995 by XFree86 (and docu- + mented long afterwards). + +o The aixterm manual page gives the format of the control sequence for + foreground and background colors 8-15, but does not specify what + those colors are. That is implied by the description's mention of + HFT: + + The aixterm command provides a standard terminal type for + programs that do not interact directly with Enhanced X-Windows. + This command provides an emulation for a VT102 terminal or a + high function terminal (HFT). The VT102 mode is activated by + the -v flag. + + Unlike xterm, there are no resource names for the 16 colors, leaving + the reader to assume that the mapping is hard-coded. The control + sequences for colors 8-15 are not specified by ECMA-48, but rather + (as done in other instances by xterm) chosen to not conflict with + current or future standards. diff --git a/ports/xterm/xterm-359/cursor.c b/ports/xterm/xterm-359/cursor.c new file mode 100644 index 0000000..6867c0f --- /dev/null +++ b/ports/xterm/xterm-359/cursor.c @@ -0,0 +1,468 @@ +/* $XTermId: cursor.c,v 1.77 2019/07/12 01:11:59 tom Exp $ */ + +/* + * Copyright 2002-2018,2019 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* cursor.c */ + +#include +#include +#include + +#include + +/* + * Moves the cursor to the specified position, checking for bounds. + * (this includes scrolling regions) + * The origin is considered to be 0, 0 for this procedure. + */ +void +CursorSet(TScreen *screen, int row, int col, unsigned flags) +{ + int use_row = row; + int use_col = col; + int max_col = screen->max_col; + int max_row = screen->max_row; + + if (flags & ORIGIN) { + use_col += screen->lft_marg; + max_col = screen->rgt_marg; + } + use_col = (use_col < 0 ? 0 : use_col); + set_cur_col(screen, (use_col <= max_col ? use_col : max_col)); + + if (flags & ORIGIN) { + use_row += screen->top_marg; + max_row = screen->bot_marg; + } + use_row = (use_row < 0 ? 0 : use_row); + set_cur_row(screen, (use_row <= max_row ? use_row : max_row)); + + ResetWrap(screen); + + TRACE(("CursorSet(%d,%d) margins V[%d..%d] H[%d..%d] -> %d,%d %s\n", + row, col, + screen->top_marg, + screen->bot_marg, + screen->lft_marg, + screen->rgt_marg, + screen->cur_row, + screen->cur_col, + ((flags & ORIGIN) ? "origin" : "normal"))); +} + +/* + * moves the cursor left n, no wrap around + */ +void +CursorBack(XtermWidget xw, int n) +{ +#define WRAP_MASK (REVERSEWRAP | WRAPAROUND) + TScreen *screen = TScreenOf(xw); + int rev; + int left = ScrnLeftMargin(xw); + int before = screen->cur_col; + + if ((rev = ((xw->flags & WRAP_MASK) == WRAP_MASK)) != 0 + && screen->do_wrap) { + n--; + } + + /* if the cursor is already before the left-margin, we have to let it go */ + if (before < left) + left = 0; + + if ((screen->cur_col -= n) < left) { + if (rev) { + int in_row = ScrnRightMargin(xw) - left + 1; + int offset = (in_row * screen->cur_row) + screen->cur_col - left; + if ((before == left) && + ScrnIsColInMargins(screen, before) && + ScrnIsRowInMargins(screen, screen->cur_row) && + screen->cur_row == screen->top_marg) { + offset = (screen->bot_marg + 1) * in_row - 1; + } else if (offset < 0) { + int length = in_row * MaxRows(screen); + offset += ((-offset) / length + 1) * length; + } + set_cur_row(screen, (offset / in_row)); + set_cur_col(screen, (offset % in_row) + left); + do_xevents(xw); + } else { + set_cur_col(screen, left); + } + } + ResetWrap(screen); +} + +/* + * moves the cursor forward n, no wraparound + */ +void +CursorForward(XtermWidget xw, int n) +{ + TScreen *screen = TScreenOf(xw); +#if OPT_DEC_CHRSET + LineData *ld = getLineData(screen, screen->cur_row); +#endif + int next = screen->cur_col + n; + int max; + + if (IsLeftRightMode(xw)) { + max = screen->rgt_marg; + if (screen->cur_col > max) + max = screen->max_col; + } else { + max = LineMaxCol(screen, ld); + } + + if (next > max) + next = max; + + set_cur_col(screen, next); + ResetWrap(screen); +} + +/* + * moves the cursor down n, no scrolling. + * Won't pass bottom margin or bottom of screen. + */ +void +CursorDown(TScreen *screen, int n) +{ + int max; + int next = screen->cur_row + n; + + max = (screen->cur_row > screen->bot_marg ? + screen->max_row : screen->bot_marg); + if (next > max) + next = max; + if (next > screen->max_row) + next = screen->max_row; + + set_cur_row(screen, next); + ResetWrap(screen); +} + +/* + * moves the cursor up n, no linestarving. + * Won't pass top margin or top of screen. + */ +void +CursorUp(TScreen *screen, int n) +{ + int min; + int next = screen->cur_row - n; + + min = ((screen->cur_row < screen->top_marg) + ? 0 + : screen->top_marg); + if (next < min) + next = min; + if (next < 0) + next = 0; + + set_cur_row(screen, next); + ResetWrap(screen); +} + +/* + * Moves cursor down amount lines, scrolls if necessary. + * Won't leave scrolling region. No carriage return. + */ +void +xtermIndex(XtermWidget xw, int amount) +{ + TScreen *screen = TScreenOf(xw); + + /* + * indexing when below scrolling region is cursor down. + * if cursor high enough, no scrolling necessary. + */ + if (screen->cur_row > screen->bot_marg + || screen->cur_row + amount <= screen->bot_marg + || (IsLeftRightMode(xw) + && !ScrnIsColInMargins(screen, screen->cur_col))) { + CursorDown(screen, amount); + } else { + int j; + CursorDown(screen, j = screen->bot_marg - screen->cur_row); + xtermScroll(xw, amount - j); + } +} + +/* + * Moves cursor up amount lines, reverse scrolls if necessary. + * Won't leave scrolling region. No carriage return. + */ +void +RevIndex(XtermWidget xw, int amount) +{ + TScreen *screen = TScreenOf(xw); + + /* + * reverse indexing when above scrolling region is cursor up. + * if cursor low enough, no reverse indexing needed + */ + if (screen->cur_row < screen->top_marg + || screen->cur_row - amount >= screen->top_marg + || (IsLeftRightMode(xw) + && !ScrnIsColInMargins(screen, screen->cur_col))) { + CursorUp(screen, amount); + } else { + RevScroll(xw, amount - (screen->cur_row - screen->top_marg)); + CursorUp(screen, screen->cur_row - screen->top_marg); + } +} + +/* + * Moves Cursor To First Column In Line + * (Note: xterm doesn't implement SLH, SLL which would affect use of this) + */ +void +CarriageReturn(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int left = ScrnLeftMargin(xw); + int col; + + if (xw->flags & ORIGIN) { + col = left; + } else if (screen->cur_col >= left) { + col = left; + } else { + /* + * If origin-mode is not active, it is possible to use cursor + * addressing outside the margins. In that case we will go to the + * first column rather than following the margin. + */ + col = 0; + } + + set_cur_col(screen, col); + ResetWrap(screen); + do_xevents(xw); +} + +/* + * When resizing the window, if we're showing the alternate screen, we still + * have to adjust the saved cursor from the normal screen to account for + * shifting of the saved-line region in/out of the viewable window. + */ +void +AdjustSavedCursor(XtermWidget xw, int adjust) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->whichBuf) { + SavedCursor *sc = &screen->sc[0]; + + if (adjust > 0) { + TRACE(("AdjustSavedCursor %d -> %d\n", sc->row, sc->row - adjust)); + sc->row += adjust; + } + } +} + +/* + * Save Cursor and Attributes + */ +void +CursorSave(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + SavedCursor *sc = &screen->sc[screen->whichBuf]; + + sc->saved = True; + sc->row = screen->cur_row; + sc->col = screen->cur_col; + sc->flags = xw->flags; + sc->curgl = screen->curgl; + sc->curgr = screen->curgr; + sc->wrap_flag = screen->do_wrap; +#if OPT_ISO_COLORS + sc->cur_foreground = xw->cur_foreground; + sc->cur_background = xw->cur_background; + sc->sgr_foreground = xw->sgr_foreground; + sc->sgr_38_xcolors = xw->sgr_38_xcolors; +#endif + saveCharsets(screen, sc->gsets); +} + +/* + * We save/restore all visible attributes, plus wrapping, origin mode, and the + * selective erase attribute. + */ +#define DECSC_FLAGS (ATTRIBUTES|ORIGIN|PROTECTED) + +/* + * Restore Cursor and Attributes + */ +void +CursorRestore(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + SavedCursor *sc = &screen->sc[screen->whichBuf]; + + /* Restore the character sets, unless we never did a save-cursor op. + * In that case, we'll reset the character sets. + */ + if (sc->saved) { + restoreCharsets(screen, sc->gsets); + screen->curgl = sc->curgl; + screen->curgr = sc->curgr; + } else { + resetCharsets(screen); + } + + UIntClr(xw->flags, DECSC_FLAGS); + UIntSet(xw->flags, sc->flags & DECSC_FLAGS); + if ((xw->flags & ORIGIN)) { + CursorSet(screen, + sc->row - screen->top_marg, + ((xw->flags & LEFT_RIGHT) + ? sc->col - screen->lft_marg + : sc->col), + xw->flags); + } else { + CursorSet(screen, sc->row, sc->col, xw->flags); + } + screen->do_wrap = sc->wrap_flag; /* after CursorSet/ResetWrap */ + +#if OPT_ISO_COLORS + xw->sgr_foreground = sc->sgr_foreground; + xw->sgr_38_xcolors = sc->sgr_38_xcolors; + SGR_Foreground(xw, (xw->flags & FG_COLOR) ? sc->cur_foreground : -1); + SGR_Background(xw, (xw->flags & BG_COLOR) ? sc->cur_background : -1); +#endif +} + +/* + * Move the cursor to the first column of the n-th next line. + */ +void +CursorNextLine(XtermWidget xw, int count) +{ + TScreen *screen = TScreenOf(xw); + + CursorDown(screen, count < 1 ? 1 : count); + CarriageReturn(xw); + do_xevents(xw); +} + +/* + * Move the cursor to the first column of the n-th previous line. + */ +void +CursorPrevLine(XtermWidget xw, int count) +{ + TScreen *screen = TScreenOf(xw); + + CursorUp(screen, count < 1 ? 1 : count); + CarriageReturn(xw); + do_xevents(xw); +} + +/* + * Return col/row values which can be passed to CursorSet() preserving the + * current col/row, e.g., accounting for DECOM. + */ +int +CursorCol(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int result = screen->cur_col; + if (xw->flags & ORIGIN) { + result -= ScrnLeftMargin(xw); + if (result < 0) + result = 0; + } + return result; +} + +int +CursorRow(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + int result = screen->cur_row; + if (xw->flags & ORIGIN) { + result -= screen->top_marg; + if (result < 0) + result = 0; + } + return result; +} + +#if OPT_TRACE +int +set_cur_row(TScreen *screen, int value) +{ + TRACE(("set_cur_row %d vs %d\n", value, screen ? screen->max_row : -1)); + + assert(screen != 0); + assert(value >= 0); + assert(value <= screen->max_row); + screen->cur_row = value; + return value; +} + +int +set_cur_col(TScreen *screen, int value) +{ + TRACE(("set_cur_col %d vs %d\n", value, screen ? screen->max_col : -1)); + + assert(screen != 0); + assert(value >= 0); + assert(value <= screen->max_col); + screen->cur_col = value; + return value; +} +#endif /* OPT_TRACE */ diff --git a/ports/xterm/xterm-359/cursor.o b/ports/xterm/xterm-359/cursor.o new file mode 100644 index 0000000..14a4b1b Binary files /dev/null and b/ports/xterm/xterm-359/cursor.o differ diff --git a/ports/xterm/xterm-359/data.c b/ports/xterm/xterm-359/data.c new file mode 100644 index 0000000..deb8358 --- /dev/null +++ b/ports/xterm/xterm-359/data.c @@ -0,0 +1,128 @@ +/* $XTermId: data.c,v 1.98 2017/12/18 23:38:05 tom Exp $ */ + +/* + * Copyright 2002-2016,2017 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#include + +Widget toplevel; /* top-most widget in xterm */ + +#if OPT_TEK4014 +Char *Tpushb; +Char *Tpushback; +TekLink *tekRefreshList; +TekWidget tekWidget; +Widget tekshellwidget; +int T_lastx = -1; +int T_lasty = -1; +int Ttoggled = 0; +jmp_buf Tekend; +#endif + +char *ProgramName; + +Arg ourTopLevelShellArgs[] = +{ + {XtNallowShellResize, (XtArgVal) True}, + {XtNinput, (XtArgVal) True}, +}; +Cardinal number_ourTopLevelShellArgs = 2; + +Atom wm_delete_window; /* for ICCCM delete window */ + +Boolean guard_keyboard_type = False; +XTERM_RESOURCE resource; + +PtyData *VTbuffer; + +jmp_buf VTend; + +#ifdef DEBUG +int debug = 0; /* true causes error messages to be displayed */ +#endif /* DEBUG */ + +XtAppContext app_con; +XtermWidget term; /* master data structure for client */ + +int hold_screen; +SIG_ATOMIC_T need_cleanup = False; +SIG_ATOMIC_T caught_intr = False; + +int am_slave = -1; /* set to file-descriptor if we're a slave process */ +int max_plus1; +PtySelect Select_mask; +PtySelect X_mask; +PtySelect pty_mask; +char *ptydev; +char *ttydev; + +#if HANDLE_STRUCT_NOTIFY +int mapstate = -1; +#endif /* HANDLE_STRUCT_NOTIFY */ + +#ifdef HAVE_LIB_XCURSOR +char *xterm_cursor_theme; +#endif + +#if OPT_SESSION_MGT +int ice_fd = -1; +#endif + +#ifdef USE_IGNORE_RC +int ignore_unused; +#endif + +#if OPT_DIRECT_COLOR +CellColor initCColor = +{0, 0}; +#else +CellColor initCColor = 0; +#endif diff --git a/ports/xterm/xterm-359/data.h b/ports/xterm/xterm-359/data.h new file mode 100644 index 0000000..6ff2b38 --- /dev/null +++ b/ports/xterm/xterm-359/data.h @@ -0,0 +1,260 @@ +/* $XTermId: data.h,v 1.138 2019/10/06 20:16:02 tom Exp $ */ + +/* + * Copyright 2002-2018,2019 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef included_data_h +#define included_data_h 1 + +#include + +extern Widget toplevel; + +extern XtAppContext app_con; + +#ifdef VMS +/* actually in vms.c */ +extern int tt_width; +extern int tt_length; +extern int tt_changed; +extern int tt_pasting; +extern int tt_new_output; +#define VMS_TERM_BUFFER_SIZE 500 +struct q_head { + int flink; + int blink; +}; +extern struct q_head read_queue; +#endif + +#if OPT_TEK4014 +extern Char *Tpushb; +extern Char *Tpushback; +extern TekLink *tekRefreshList; +extern TekWidget tekWidget; +extern Widget tekshellwidget; +extern int T_lastx; +extern int T_lasty; +extern int Ttoggled; +extern jmp_buf Tekend; +#endif + +extern char *ptydev; +extern char *ttydev; +extern int hold_screen; + +extern PtyData *VTbuffer; +extern int am_slave; +extern int max_plus1; +extern jmp_buf VTend; + +#ifdef DEBUG +extern int debug; +#endif /* DEBUG */ + +extern PtySelect Select_mask; +extern PtySelect X_mask; +extern PtySelect pty_mask; + +extern int ice_fd; + +extern XtermWidget term; + +extern SIG_ATOMIC_T need_cleanup; +extern SIG_ATOMIC_T caught_intr; + +#if defined(HAVE_XKB_BELL_EXT) +#include /* has the prototype */ +#include /* has the XkbBI_xxx definitions */ +#endif + +#ifndef XkbBI_Info +#define XkbBI_Info 0 +#define XkbBI_MinorError 1 +#define XkbBI_MajorError 2 +#define XkbBI_TerminalBell 9 +#define XkbBI_MarginBell 10 +#endif + +extern char *ProgramName; +extern Arg ourTopLevelShellArgs[]; +extern Cardinal number_ourTopLevelShellArgs; +extern Atom wm_delete_window; + +extern CellColor initCColor; + +#if HANDLE_STRUCT_NOTIFY +/* Flag icon name with "*** " on window output when iconified. + * I'd like to do something like reverse video, but I don't + * know how to tell this to window managers in general. + * + * mapstate can be IsUnmapped, !IsUnmapped, or -1; + * -1 means no change; the other two are set by event handlers + * and indicate a new mapstate. !IsMapped is done in the handler. + * we worry about IsUnmapped when output occurs. -IAN! + */ +extern int mapstate; +#endif /* HANDLE_STRUCT_NOTIFY */ + +#ifdef HAVE_LIB_XCURSOR +extern char *xterm_cursor_theme; +#endif + +typedef struct XTERM_RESOURCE { + char *icon_geometry; + char *title; + char *icon_hint; + char *icon_name; + char *term_name; + char *tty_modes; + char *valid_shells; + + int minBufSize; + int maxBufSize; + + Boolean hold_screen; /* true if we keep window open */ + Boolean utmpInhibit; + Boolean utmpDisplayId; + Boolean messages; + + String menuLocale; + String omitTranslation; + + String keyboardType; + +#if OPT_PRINT_ON_EXIT + int printModeNow; + int printModeOnXError; + int printOptsNow; + int printOptsOnXError; + String printFileNow; + String printFileOnXError; +#endif + + Boolean oldKeyboard; /* placeholder for decode_keyboard_type */ +#if OPT_SUNPC_KBD + Boolean sunKeyboard; +#endif +#if OPT_HP_FUNC_KEYS + Boolean hpFunctionKeys; +#endif +#if OPT_SCO_FUNC_KEYS + Boolean scoFunctionKeys; +#endif +#if OPT_SUN_FUNC_KEYS + Boolean sunFunctionKeys; /* %%% should be VT100 widget resource? */ +#endif +#if OPT_TCAP_FKEYS + Boolean termcapKeys; +#endif + +#if OPT_INITIAL_ERASE + Boolean ptyInitialErase; /* if true, use pty's sense of erase char */ + Boolean backarrow_is_erase; /* override backspace/delete */ +#endif + Boolean useInsertMode; +#if OPT_ZICONBEEP + int zIconBeep; /* beep level when output while iconified */ + char *zIconFormat; /* format for icon name */ +#endif +#if OPT_PTY_HANDSHAKE + Boolean wait_for_map; + Boolean wait_for_map0; /* ...initial value of .wait_for_map */ + Boolean ptyHandshake; /* use pty-handshaking */ + Boolean ptySttySize; /* reset TTY size after pty handshake */ +#endif +#if OPT_REPORT_CCLASS + Boolean reportCClass; /* show character-class information */ +#endif +#if OPT_REPORT_COLORS + Boolean reportColors; /* show color information as allocated */ +#endif +#if OPT_REPORT_FONTS + Boolean reportFonts; /* show bitmap-font information as loaded */ +#endif +#if OPT_XRES_QUERY + Boolean reportXRes; /* show vt100 resources after initialization */ +#endif +#if OPT_REPORT_ICONS + Boolean reportIcons; /* show icon information as loaded */ +#endif +#if OPT_SAME_NAME + Boolean sameName; /* Don't change the title or icon name if it is + * the same. This prevents flicker on the + * screen at the cost of an extra request to + * the server. + */ +#endif +#if OPT_SESSION_MGT + Boolean sessionMgt; +#endif +#if OPT_TOOLBAR + Boolean toolBar; +#endif +#if OPT_MAXIMIZE + Boolean maximized; + String fullscreen_s; /* resource for "fullscreen" */ + int fullscreen; /* derived from fullscreen_s */ +#endif +#if USE_DOUBLE_BUFFER + Boolean buffered; + int buffered_fps; +#endif +} XTERM_RESOURCE; + +extern Boolean guard_keyboard_type; +extern XTERM_RESOURCE resource; + +#ifdef USE_IGNORE_RC +extern int ignore_unused; +#endif + +#endif /* included_data_h */ diff --git a/ports/xterm/xterm-359/data.o b/ports/xterm/xterm-359/data.o new file mode 100644 index 0000000..2072966 Binary files /dev/null and b/ports/xterm/xterm-359/data.o differ diff --git a/ports/xterm/xterm-359/df-install b/ports/xterm/xterm-359/df-install new file mode 100644 index 0000000..0ddd965 --- /dev/null +++ b/ports/xterm/xterm-359/df-install @@ -0,0 +1,162 @@ +#!/bin/sh +# $XTermId: df-install.in,v 1.16 2020/08/02 19:47:55 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2011-2018,2020 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# Install desktop-files, substituting the category to customize the file +# to the current system's conventions. +# +# Parameters are passed to the desktop-file-install program. The last +# parameter is the name of the ".desktop" file to install. + +failed() { + echo "? $*" >&2 + exit 1 +} + +OPTS= + +if test $# != 0 +then + APP_NAME=$1 + shift 1 +fi + +if test $# != 0 +then + ICON_NAME=$1 + shift 1 +fi + +TOOL=desktop-file-install + +CDPATH=: +export CDPATH + +while test $# != 0 +do + case .$1 in #(vi + *.desktop) #(vi + if test $# = 1 + then + OLD_FILE=$1 + else + OPTS="$OPTS $1" + fi + ;; + .DESTDIR=*) #(vi + if test "$1" != "DESTDIR=" + then + DESTDIR=`echo "$1" | sed -e 's,^DESTDIR=,,'` + fi + ;; + *) + OPTS="$OPTS $1" + ;; + esac + shift 1 +done + +# If DESTDIR is set (either as an environment variable, or command-line +# parameter), attempt to determine the full pathname (needed by the installer) +# to tell it to use the alternate location. Because the installer has no +# useful options for this purpose, we search along the path to find the tool, +# and from that get the prefix, and assume that was the extent of customization +# when the tool was configured/installed. +if test -n "$DESTDIR" +then + if test -d "$DESTDIR" + then + prefix= + + save_IFS="$IFS" + IFS=':' + for P in $PATH + do + test -z "$P" && P=. + if test -f "$P/$TOOL" + then + prefix=`echo "$P" | sed -e 's,/[^/]*$,,'` + break + fi + done + IFS="$save_IFS" + + test -z "$prefix" && failed "could not find $TOOL in PATH" + + TARGET="${DESTDIR}${prefix}/share/applications" + mkdir -p "$TARGET" + + OPTS="$OPTS --dir=${TARGET}" + else + failed "DESTDIR is not a directory: $DESTDIR" + fi +fi + +MY_TEMP=tempdir$$ +rm -rf $MY_TEMP + +if test -z "$OLD_FILE" +then + failed "not found: $OLD_FILE" +elif ! mkdir $MY_TEMP +then + failed "cannot mkdir: $MY_TEMP" +fi + +# The newer dfi whines about deprecation of encoding, but no release provides +# --version or equivalent. really. +if desktop-file-install --help-all >/dev/null 2>&1 +then + NO_ENCODING="#Encoding" +else + NO_ENCODING="Encoding" +fi + +NEW_FILE=`basename "$OLD_FILE"` +sed \ + -e '/^Encoding=/s%Encoding%'"$NO_ENCODING"'%' \ + -e '/^[^#]*Icon=/s%=.*%='"$ICON_NAME"'%' \ + -e '/^[^#]*Category=/s%=.*%=%' \ + -e '/^[^#]*Categories=/s%=.*%=%' \ + -e '/^[^#]/s%xterm%'"$APP_NAME"'%g' \ + -e '/^[^#]/s%XTerm%XTerm%g' \ + "$OLD_FILE" >"$MY_TEMP/$NEW_FILE" +diff -u "$OLD_FILE" "$MY_TEMP/$NEW_FILE" +cd $MY_TEMP || exit 1 + +"$TOOL" $OPTS "$NEW_FILE" + +cd .. +rm -rf $MY_TEMP + +# vi:ts=4 sw=4 diff --git a/ports/xterm/xterm-359/df-install.in b/ports/xterm/xterm-359/df-install.in new file mode 100644 index 0000000..a1d5535 --- /dev/null +++ b/ports/xterm/xterm-359/df-install.in @@ -0,0 +1,162 @@ +#!/bin/sh +# $XTermId: df-install.in,v 1.16 2020/08/02 19:47:55 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2011-2018,2020 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# Install desktop-files, substituting the category to customize the file +# to the current system's conventions. +# +# Parameters are passed to the desktop-file-install program. The last +# parameter is the name of the ".desktop" file to install. + +failed() { + echo "? $*" >&2 + exit 1 +} + +OPTS= + +if test $# != 0 +then + APP_NAME=$1 + shift 1 +fi + +if test $# != 0 +then + ICON_NAME=$1 + shift 1 +fi + +TOOL=desktop-file-install + +CDPATH=: +export CDPATH + +while test $# != 0 +do + case .$1 in #(vi + *.desktop) #(vi + if test $# = 1 + then + OLD_FILE=$1 + else + OPTS="$OPTS $1" + fi + ;; + .DESTDIR=*) #(vi + if test "$1" != "DESTDIR=" + then + DESTDIR=`echo "$1" | sed -e 's,^DESTDIR=,,'` + fi + ;; + *) + OPTS="$OPTS $1" + ;; + esac + shift 1 +done + +# If DESTDIR is set (either as an environment variable, or command-line +# parameter), attempt to determine the full pathname (needed by the installer) +# to tell it to use the alternate location. Because the installer has no +# useful options for this purpose, we search along the path to find the tool, +# and from that get the prefix, and assume that was the extent of customization +# when the tool was configured/installed. +if test -n "$DESTDIR" +then + if test -d "$DESTDIR" + then + prefix= + + save_IFS="$IFS" + IFS=':' + for P in $PATH + do + test -z "$P" && P=. + if test -f "$P/$TOOL" + then + prefix=`echo "$P" | sed -e 's,/[^/]*$,,'` + break + fi + done + IFS="$save_IFS" + + test -z "$prefix" && failed "could not find $TOOL in PATH" + + TARGET="${DESTDIR}${prefix}/share/applications" + mkdir -p "$TARGET" + + OPTS="$OPTS --dir=${TARGET}" + else + failed "DESTDIR is not a directory: $DESTDIR" + fi +fi + +MY_TEMP=tempdir$$ +rm -rf $MY_TEMP + +if test -z "$OLD_FILE" +then + failed "not found: $OLD_FILE" +elif ! mkdir $MY_TEMP +then + failed "cannot mkdir: $MY_TEMP" +fi + +# The newer dfi whines about deprecation of encoding, but no release provides +# --version or equivalent. really. +if desktop-file-install --help-all >/dev/null 2>&1 +then + NO_ENCODING="#Encoding" +else + NO_ENCODING="Encoding" +fi + +NEW_FILE=`basename "$OLD_FILE"` +sed \ + -e '/^Encoding=/s%Encoding%'"$NO_ENCODING"'%' \ + -e '/^[^#]*Icon=/s%=.*%='"$ICON_NAME"'%' \ + -e '/^[^#]*Category=/s%=.*%=@DESKTOP_CATEGORY@%' \ + -e '/^[^#]*Categories=/s%=.*%=@DESKTOP_CATEGORY@%' \ + -e '/^[^#]/s%xterm%'"$APP_NAME"'%g' \ + -e '/^[^#]/s%XTerm%@APP_CLASS@%g' \ + "$OLD_FILE" >"$MY_TEMP/$NEW_FILE" +diff -u "$OLD_FILE" "$MY_TEMP/$NEW_FILE" +cd $MY_TEMP || exit 1 + +"$TOOL" $OPTS "$NEW_FILE" + +cd .. +rm -rf $MY_TEMP + +# vi:ts=4 sw=4 diff --git a/ports/xterm/xterm-359/doublechr.c b/ports/xterm/xterm-359/doublechr.c new file mode 100644 index 0000000..ce5a0cd --- /dev/null +++ b/ports/xterm/xterm-359/doublechr.c @@ -0,0 +1,379 @@ +/* $XTermId: doublechr.c,v 1.102 2020/06/02 23:51:56 tom Exp $ */ + +/* + * Copyright 1997-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#include +#include +#include + +#include + +#define WhichCgsId(flag) (((flag) & BOLD) ? gcCBold : gcCNorm) + +/* + * The first column is all that matters for double-size characters (since the + * controls apply to a whole line). However, it's easier to maintain the + * information for special fonts by writing to all cells. + */ +#if OPT_DEC_CHRSET + +static void +repaint_line(XtermWidget xw, unsigned newChrSet) +{ + TScreen *screen = TScreenOf(xw); + LineData *ld; + int curcol = screen->cur_col; + int currow = screen->cur_row; + int width = MaxCols(screen); + unsigned len = (unsigned) width; + + assert(width > 0); + + /* + * Ignore repetition. + */ + if (!IsLeftRightMode(xw) + && (ld = getLineData(screen, currow)) != 0) { + unsigned oldChrSet = GetLineDblCS(ld); + + if (oldChrSet != newChrSet) { + TRACE(("repaint_line(%2d,%2d) (%s -> %s)\n", currow, screen->cur_col, + visibleDblChrset(oldChrSet), + visibleDblChrset(newChrSet))); + HideCursor(); + + /* If switching from single-width, keep the cursor in the visible part + * of the line. + */ + if (CSET_DOUBLE(newChrSet)) { + width /= 2; + if (curcol > width) + curcol = width; + } + + /* + * ScrnRefresh won't paint blanks for us if we're switching between a + * single-size and double-size font. So we paint our own. + */ + ClearCurBackground(xw, + currow, + 0, + 1, + len, + (unsigned) LineFontWidth(screen, ld)); + + SetLineDblCS(ld, newChrSet); + + set_cur_col(screen, 0); + ScrnUpdate(xw, currow, 0, 1, (int) len, True); + set_cur_col(screen, curcol); + } + } +} +#endif + +/* + * Set the line to double-height characters. The 'top' flag denotes whether + * we'll be using it for the top (true) or bottom (false) of the line. + */ +void +xterm_DECDHL(XtermWidget xw, Bool top) +{ +#if OPT_DEC_CHRSET + repaint_line(xw, (unsigned) (top ? CSET_DHL_TOP : CSET_DHL_BOT)); +#else + (void) xw; + (void) top; +#endif +} + +/* + * Set the line to single-width characters (the normal state). + */ +void +xterm_DECSWL(XtermWidget xw) +{ +#if OPT_DEC_CHRSET + repaint_line(xw, CSET_SWL); +#else + (void) xw; +#endif +} + +/* + * Set the line to double-width characters + */ +void +xterm_DECDWL(XtermWidget xw) +{ +#if OPT_DEC_CHRSET + repaint_line(xw, CSET_DWL); +#else + (void) xw; +#endif +} + +/* + * Reset all lines on the screen to single-width/single-height. + */ +void +xterm_ResetDouble(XtermWidget xw) +{ +#if OPT_DEC_CHRSET + TScreen *screen = TScreenOf(xw); + Boolean changed = False; + unsigned code; + int row; + + for (row = 0; row < screen->max_row; ++row) { + LineData *ld; + + if ((ld = getLineData(screen, ROW2INX(screen, row))) != 0) { + code = GetLineDblCS(ld); + if (code != CSET_SWL) { + SetLineDblCS(ld, CSET_SWL); + changed = True; + } + } + } + if (changed) { + xtermRepaint(xw); + } +#else + (void) xw; +#endif +} + +#if OPT_DEC_CHRSET +static void +discard_font(XtermWidget xw, int n) +{ + TScreen *screen = TScreenOf(xw); + XTermFonts *data = getDoubleFont(screen, n); + + TRACE(("discard_font chrset=%d %s\n", data->chrset, + (data->fn != 0) ? data->fn : "")); + + data->chrset = 0; + data->flags = 0; + if (data->fn != 0) { + free(data->fn); + data->fn = 0; + } + xtermCloseFont(xw, data); + + screen->fonts_used -= 1; + while (n < screen->fonts_used) { + screen->double_fonts[n] = screen->double_fonts[n + 1]; + ++n; + } +} + +/* push back existing fonts and create a new entry */ +static XTermFonts * +pushback_font(XtermWidget xw, XTermFonts * source) +{ + TScreen *screen = TScreenOf(xw); + XTermFonts *data = getDoubleFont(screen, 0); + int n; + + if (screen->fonts_used >= screen->cache_doublesize) { + TRACE(("pushback_font: discard oldest\n")); + discard_font(xw, screen->fonts_used - 1); + } else { + screen->fonts_used += 1; + } + + for (n = screen->fonts_used; n > 0; n--) + data[n] = data[n - 1]; + data[0] = *source; + + TRACE(("pushback_font -> (NEW:%d)\n", screen->fonts_used)); + + return data; +} + +static int +xterm_Double_index(XTermDraw * params) +{ + XTermDraw local = *params; + int n; + int result = -1; + TScreen *screen = TScreenOf(local.xw); + XTermFonts *data = getDoubleFont(screen, 0); + + local.attr_flags &= BOLD; + TRACE(("xterm_Double_index chrset=%#x, flags=%#x\n", local.this_chrset, local.attr_flags)); + + for (n = 0; n < screen->fonts_used; n++) { + if (data[n].chrset == (unsigned) local.this_chrset + && data[n].flags == local.attr_flags) { + if (n != 0) { + XTermFonts save; + TRACE(("...xterm_Double_index -> %d (OLD:%d)\n", n, screen->fonts_used)); + save = data[n]; + while (n > 0) { + data[n] = data[n - 1]; + n--; + } + data[n] = save; + } + result = n; + break; + } + } + + return result; +} + +/* + * Lookup/cache a GC for the double-size character display. We save up to + * NUM_CHRSET values. + */ +GC +xterm_DoubleGC(XTermDraw * params, GC old_gc, int *inxp) +{ + TScreen *screen = TScreenOf(params->xw); + VTwin *cgsWin = WhichVWin(screen); + char *name; + GC result = 0; + + if ((name = xtermSpecialFont(params)) + != 0) { + CgsEnum cgsId = WhichCgsId(params->attr_flags); + Boolean found = False; + XTermFonts *data = 0; + int n; + + if ((n = xterm_Double_index(params)) >= 0) { + data = getDoubleFont(screen, n); + if (data->fn != 0) { + if (!strcmp(data->fn, name) + && data->fs != 0) { + found = True; + free(name); + name = NULL; + } else { + discard_font(params->xw, n); + } + } + } + + if (!found && name != NULL) { + XTermFonts temp; + + TRACE(("xterm_DoubleGC %s %d: %s\n", + (params->attr_flags & BOLD) ? "BOLD" : "NORM", n, name)); + + memset(&temp, 0, sizeof(temp)); + temp.fn = name; + temp.chrset = params->this_chrset; + temp.flags = (params->attr_flags & BOLD); + temp.warn = fwResource; + + if (!xtermOpenFont(params->xw, name, &temp, False)) { + XTermDraw local = *params; + char *nname; + + /* Retry with * in resolutions */ + local.draw_flags |= NORESOLUTION; + nname = xtermSpecialFont(&local); + if (nname != 0) { + found = (Boolean) xtermOpenFont(params->xw, nname, &temp, + False); + free(nname); + } + } else { + found = True; + } + free(name); + + if (found) { + n = 0; + data = pushback_font(params->xw, &temp); + } + + TRACE(("-> %s\n", found ? "OK" : "FAIL")); + } + + if (found) { + setCgsCSet(params->xw, cgsWin, cgsId, params->this_chrset); + setCgsFont(params->xw, cgsWin, cgsId, data); + setCgsFore(params->xw, cgsWin, cgsId, getCgsFore(params->xw, + cgsWin, old_gc)); + setCgsBack(params->xw, cgsWin, cgsId, getCgsBack(params->xw, + cgsWin, old_gc)); + result = getCgsGC(params->xw, cgsWin, cgsId); + *inxp = n; + } else if (params->attr_flags & BOLD) { + UIntClr(params->attr_flags, BOLD); + result = xterm_DoubleGC(params, old_gc, inxp); + } + } + + return result; +} + +#if OPT_RENDERFONT +/* + * Like xterm_DoubleGC(), but returning an Xft font. + */ +XftFont * +xterm_DoubleFT(XTermDraw * params, unsigned chrset, unsigned attr_flags) +{ + XftFont *result; + TScreen *screen = TScreenOf(params->xw); + unsigned num = (chrset & CSET_DWL); + + if ((attr_flags &= BOLD) != 0) + num |= 4; + + if ((result = screen->double_xft_fonts[num]) == 0) { + result = getDoubleXftFont(params, chrset, attr_flags); + screen->double_xft_fonts[num] = result; + } + return result; +} + +void +freeall_DoubleFT(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + unsigned num; + + for (num = 0; num < XtNumber(screen->double_xft_fonts); ++num) { + closeCachedXft(screen, screen->double_xft_fonts[num]); + screen->double_xft_fonts[num] = 0; + } +} +#endif /* OPT_RENDERFONT */ + +#endif /* OPT_DEC_CHRSET */ diff --git a/ports/xterm/xterm-359/doublechr.o b/ports/xterm/xterm-359/doublechr.o new file mode 100644 index 0000000..63e3e25 Binary files /dev/null and b/ports/xterm/xterm-359/doublechr.o differ diff --git a/ports/xterm/xterm-359/error.h b/ports/xterm/xterm-359/error.h new file mode 100644 index 0000000..d2aabd7 --- /dev/null +++ b/ports/xterm/xterm-359/error.h @@ -0,0 +1,105 @@ +/* $XTermId: error.h,v 1.26 2012/10/05 00:17:51 tom Exp $ */ + +/* + * Copyright 1997-2011,2012 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + * + * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + * + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and its + * documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appear in all copies and that + * both that copyright notice and this permission notice appear in + * supporting documentation, and that the name of Digital Equipment + * Corporation not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior permission. + * + * + * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR + * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +/* @(#)error.h X10/6.6 11/6/86 */ + +/* main.c */ +#define ERROR_FIONBIO 11 /* main: ioctl() failed on FIONBIO */ +#define ERROR_F_GETFL 12 /* main: ioctl() failed on F_GETFL */ +#define ERROR_F_SETFL 13 /* main: ioctl() failed on F_SETFL */ +#define ERROR_OPDEVTTY 14 /* spawn: open() failed on /dev/tty */ +#define ERROR_TIOCGETP 15 /* spawn: ioctl() failed on TIOCGETP */ +#define ERROR_PTSNAME 17 /* spawn: ptsname() failed */ +#define ERROR_OPPTSNAME 18 /* spawn: open() failed on ptsname */ +#define ERROR_PTEM 19 /* spawn: ioctl() failed on I_PUSH/"ptem" */ +#define ERROR_CONSEM 20 /* spawn: ioctl() failed on I_PUSH/"consem" */ +#define ERROR_LDTERM 21 /* spawn: ioctl() failed on I_PUSH/"ldterm" */ +#define ERROR_TTCOMPAT 22 /* spawn: ioctl() failed on I_PUSH/"ttcompat" */ +#define ERROR_TIOCSETP 23 /* spawn: ioctl() failed on TIOCSETP */ +#define ERROR_TIOCSETC 24 /* spawn: ioctl() failed on TIOCSETC */ +#define ERROR_TIOCSETD 25 /* spawn: ioctl() failed on TIOCSETD */ +#define ERROR_TIOCSLTC 26 /* spawn: ioctl() failed on TIOCSLTC */ +#define ERROR_TIOCLSET 27 /* spawn: ioctl() failed on TIOCLSET */ +#define ERROR_INIGROUPS 28 /* spawn: initgroups() failed */ +#define ERROR_FORK 29 /* spawn: fork() failed */ +#define ERROR_EXEC 30 /* spawn: exec() failed */ +#define ERROR_PTYS 32 /* get_pty: not enough ptys */ +#define ERROR_PTY_EXEC 34 /* waiting for initial map */ +#define ERROR_SETUID 35 /* spawn: setuid() failed */ +#define ERROR_INIT 36 /* spawn: can't initialize window */ +#define ERROR_TIOCKSET 46 /* spawn: ioctl() failed on TIOCKSET */ +#define ERROR_TIOCKSETC 47 /* spawn: ioctl() failed on TIOCKSETC */ +#define ERROR_LUMALLOC 49 /* luit: command-line malloc failed */ + +/* charproc.c */ +#define ERROR_SELECT 50 /* in_put: select() failed */ +#define ERROR_VINIT 54 /* VTInit: can't initialize window */ +#define ERROR_KMMALLOC1 57 /* HandleKeymapChange: malloc failed */ + +/* Tekproc.c */ +#define ERROR_TSELECT 60 /* Tinput: select() failed */ +#define ERROR_TINIT 64 /* TekInit: can't initialize window */ + +/* button.c */ +#define ERROR_BMALLOC2 71 /* SaltTextAway: malloc() failed */ + +/* misc.c */ +#define ERROR_LOGEXEC 80 /* StartLog: exec() failed */ +#define ERROR_XERROR 83 /* xerror: XError event */ +#define ERROR_XIOERROR 84 /* xioerror: X I/O error */ +#define ERROR_ICEERROR 85 /* ice_error: ICE I/O error */ + +/* screen.c */ +#define ERROR_SCALLOC 90 /* Alloc: calloc() failed on base */ +#define ERROR_SCALLOC2 91 /* Alloc: calloc() failed on rows */ +#define ERROR_SAVE_PTR 102 /* ScrnPointers: malloc/realloc() failed */ diff --git a/ports/xterm/xterm-359/fontutils.c b/ports/xterm/xterm-359/fontutils.c new file mode 100644 index 0000000..1d9e1fb --- /dev/null +++ b/ports/xterm/xterm-359/fontutils.c @@ -0,0 +1,5525 @@ +/* $XTermId: fontutils.c,v 1.687 2020/06/26 23:27:42 tom Exp $ */ + +/* + * Copyright 1998-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +/* + * A portion of this module (for FontNameProperties) was adapted from EMU 1.3; + * it constructs font names with specific properties changed, e.g., for bold + * and double-size characters. + */ + +#define RES_OFFSET(field) XtOffsetOf(SubResourceRec, field) + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#define NoFontWarning(data) (data)->warn = fwAlways + +#define SetFontWidth(screen,dst,src) (dst)->f_width = (src) +#define SetFontHeight(screen,dst,src) (dst)->f_height = dimRound((double)((screen)->scale_height * (float) (src))) + +/* from X11/Xlibint.h - not all vendors install this file */ +#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ + (((cs)->rbearing|(cs)->lbearing| \ + (cs)->ascent|(cs)->descent) == 0)) + +#define CI_GET_CHAR_INFO_1D(fs,col,cs) \ +{ \ + cs = 0; \ + if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ + } \ + if (CI_NONEXISTCHAR(cs)) cs = 0; \ + } \ +} + +#define CI_GET_CHAR_INFO_2D(fs,row,col,cs) \ +{ \ + cs = 0; \ + if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ + col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[((row - fs->min_byte1) * \ + (fs->max_char_or_byte2 - \ + fs->min_char_or_byte2 + 1)) + \ + (col - fs->min_char_or_byte2)]; \ + } \ + if (CI_NONEXISTCHAR(cs)) cs = 0; \ + } \ +} + +#define FREE_FNAME(field) \ + if (fonts == 0 || myfonts.field != fonts->field) { \ + FREE_STRING(myfonts.field); \ + myfonts.field = 0; \ + } + +/* + * A structure to hold the relevant properties from a font + * we need to make a well formed font name for it. + */ +typedef struct { + /* registry, foundry, family */ + const char *beginning; + /* weight */ + const char *weight; + /* slant */ + const char *slant; + /* wideness */ + const char *wideness; + /* add style */ + const char *add_style; + int pixel_size; + const char *point_size; + int res_x; + int res_y; + const char *spacing; + int average_width; + /* charset registry, charset encoding */ + char *end; +} FontNameProperties; + +#if OPT_WIDE_CHARS && (OPT_RENDERFONT || (OPT_TRACE > 1)) +#define MY_UCS(code,high,wide,name) { code, high, wide, #name } +static const struct { + unsigned code, high, wide; + const char *name; +} unicode_boxes[] = { + + MY_UCS(0x2500, 0, 1, box drawings light horizontal), + MY_UCS(0x2502, 1, 0, box drawings light vertical), + MY_UCS(0x250c, 2, 2, box drawings light down and right), + MY_UCS(0x2510, 2, 2, box drawings light down and left), + MY_UCS(0x2514, 2, 2, box drawings light up and right), + MY_UCS(0x2518, 2, 2, box drawings light up and left), + MY_UCS(0x251c, 1, 2, box drawings light vertical and right), + MY_UCS(0x2524, 1, 2, box drawings light vertical and left), + MY_UCS(0x252c, 2, 1, box drawings light down and horizontal), + MY_UCS(0x2534, 2, 1, box drawings light up and horizontal), + MY_UCS(0x253c, 1, 1, box drawings light vertical and horizontal), + { + 0, 0, 0, NULL + } +}; + +#undef MY_UCS +#endif /* OPT_WIDE_CHARS */ + +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS +static Boolean merge_sublist(char ***, char **); +#endif + +static void save2FontList(XtermWidget, const char *, XtermFontNames *, + VTFontEnum, const char *, Bool); + +#if OPT_RENDERFONT +static void fillInFaceSize(XtermWidget, int); +#endif + +#if OPT_SHIFT_FONTS +static int lookupOneFontSize(XtermWidget, int); +#endif + +#if OPT_TRACE +static void +set_font_height(TScreen *screen, VTwin *win, int height) +{ + SetFontHeight(screen, win, height); + TRACE(("SetFontHeight %d\n", win->f_height)); +#undef SetFontHeight +#define SetFontHeight(screen, win, height) set_font_height(screen, win, height) +} + +static void +set_font_width(TScreen *screen, VTwin *win, int width) +{ + (void) screen; + SetFontWidth(screen, win, width); + TRACE(("SetFontWidth %d\n", win->f_width)); +#undef SetFontWidth +#define SetFontWidth(screen, win, height) set_font_width(screen, win, height) +} +#endif + +#if OPT_REPORT_FONTS || OPT_WIDE_CHARS +static unsigned +countGlyphs(XFontStruct *fp) +{ + unsigned count = 0; + + if (fp != 0) { + if (fp->min_byte1 == 0 && fp->max_byte1 == 0) { + count = fp->max_char_or_byte2 - fp->min_char_or_byte2 + 1; + } else if (fp->min_char_or_byte2 < 256 + && fp->max_char_or_byte2 < 256) { + unsigned first = (fp->min_byte1 << 8) + fp->min_char_or_byte2; + unsigned last = (fp->max_byte1 << 8) + fp->max_char_or_byte2; + count = last + 1 - first; + } + } + return count; +} +#endif + +#if OPT_WIDE_CHARS +/* + * Verify that the wide-bold font is at least a bold font with roughly as many + * glyphs as the wide font. The counts should be the same, but settle for + * filtering out the worst of the font mismatches. + */ +static Bool +compatibleWideCounts(XFontStruct *wfs, XFontStruct *wbfs) +{ + unsigned count_w = countGlyphs(wfs); + unsigned count_wb = countGlyphs(wbfs); + if (count_w <= 256 || + count_wb <= 256 || + ((count_w / 4) * 3) > count_wb) { + TRACE(("...font server lied (count wide %u vs wide-bold %u)\n", + count_w, count_wb)); + return False; + } + return True; +} +#endif /* OPT_WIDE_CHARS */ + +#if OPT_BOX_CHARS +static void +setupPackedFonts(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Bool value = False; + +#if OPT_RENDERFONT + if (xw->work.render_font == True) { + int e; + + for (e = 0; e < fMAX; ++e) { + XTermXftFonts *data = getMyXftFont(xw, e, screen->menu_font_number); + if (data != 0) { + if (data->map.mixed) { + screen->allow_packing = True; + break; + } + } + } + } +#endif /* OPT_RENDERFONT */ + + value = screen->allow_packing; + + SetItemSensitivity(fontMenuEntries[fontMenu_font_packedfont].widget, value); +} +#endif + +typedef struct _nameList { + struct _nameList *next; + char *name; +} NameList; + +static NameList *derived_fonts; + +static Boolean +is_derived_font_name(const char *name) +{ + Boolean result = False; + NameList *list; + if (!IsEmpty(name)) { + for (list = derived_fonts; list != 0; list = list->next) { + if (!x_strcasecmp(name, list->name)) { + result = True; + break; + } + } + } + return result; +} + +void +xtermDerivedFont(const char *name) +{ + if (!IsEmpty(name) && !is_derived_font_name(name)) { + NameList *list = TypeCalloc(NameList); + list->name = x_strdup(name); + list->next = derived_fonts; + derived_fonts = list; + } +} + +/* + * Returns the fields from start to stop in a dash- separated string. This + * function will modify the source, putting '\0's in the appropriate place and + * moving the beginning forward to after the '\0' + * + * This will NOT work for the last field (but we won't need it). + */ +static char * +n_fields(char **source, int start, int stop) +{ + int i; + char *str, *str1; + + /* + * find the start-1th dash + */ + for (i = start - 1, str = *source; i; i--, str++) { + if ((str = strchr(str, '-')) == 0) + return 0; + } + + /* + * find the stopth dash + */ + for (i = stop - start + 1, str1 = str; i; i--, str1++) { + if ((str1 = strchr(str1, '-')) == 0) + return 0; + } + + /* + * put a \0 at the end of the fields + */ + *(str1 - 1) = '\0'; + + /* + * move source forward + */ + *source = str1; + + return str; +} + +static Boolean +check_fontname(const char *name) +{ + Boolean result = True; + + if (IsEmpty(name)) { + TRACE(("fontname missing\n")); + result = False; + } + return result; +} + +/* + * Gets the font properties from a given font structure. We use the FONT name + * to find them out, since that seems easier. + * + * Returns a pointer to a static FontNameProperties structure + * or NULL on error. + */ +static FontNameProperties * +get_font_name_props(Display *dpy, XFontStruct *fs, char **result) +{ + static FontNameProperties props; + static char *last_name; + + Atom fontatom; + char *name; + char *str; + + if (fs == NULL) + return NULL; + + /* + * first get the full font name + */ + name = 0; + fontatom = XInternAtom(dpy, "FONT", False); + if (fontatom != 0) { + XFontProp *fp; + int i; + + for (i = 0, fp = fs->properties; i < fs->n_properties; i++, fp++) { + if (fp->name == fontatom) { + name = XGetAtomName(dpy, fp->card32); + break; + } + } + } + + if (name == 0) + return 0; + + /* + * XGetAtomName allocates memory - don't leak + */ + if (last_name != 0) + XFree(last_name); + last_name = name; + + if (result != 0) { + if (!check_fontname(name)) + return 0; + if (*result != 0) + free(*result); + *result = x_strdup(name); + } + + /* + * Now split it up into parts and put them in + * their places. Since we are using parts of + * the original string, we must not free the Atom Name + */ + + /* registry, foundry, family */ + if ((props.beginning = n_fields(&name, 1, 3)) == 0) + return 0; + + /* weight is the next */ + if ((props.weight = n_fields(&name, 1, 1)) == 0) + return 0; + + /* slant */ + if ((props.slant = n_fields(&name, 1, 1)) == 0) + return 0; + + /* width */ + if ((props.wideness = n_fields(&name, 1, 1)) == 0) + return 0; + + /* add style */ + if ((props.add_style = n_fields(&name, 1, 1)) == 0) + return 0; + + /* pixel size */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.pixel_size = atoi(str)) == 0) + return 0; + + /* point size */ + if ((props.point_size = n_fields(&name, 1, 1)) == 0) + return 0; + + /* res_x */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.res_x = atoi(str)) == 0) + return 0; + + /* res_y */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.res_y = atoi(str)) == 0) + return 0; + + /* spacing */ + if ((props.spacing = n_fields(&name, 1, 1)) == 0) + return 0; + + /* average width */ + if ((str = n_fields(&name, 1, 1)) == 0) + return 0; + if ((props.average_width = atoi(str)) == 0) + return 0; + + /* the rest: charset registry and charset encoding */ + props.end = name; + + return &props; +} + +#define ALLOCHUNK(n) ((n | 127) + 1) + +static void +alloca_fontname(char **result, size_t next) +{ + size_t last = (*result != 0) ? strlen(*result) : 0; + size_t have = (*result != 0) ? ALLOCHUNK(last) : 0; + size_t want = last + next + 2; + + if (want >= have) { + want = ALLOCHUNK(want); + if (last != 0) { + char *save = *result; + *result = TypeRealloc(char, want, *result); + if (*result == 0) + free(save); + } else { + if ((*result = TypeMallocN(char, want)) != 0) + **result = '\0'; + } + } +} + +static void +append_fontname_str(char **result, const char *value) +{ + if (value == 0) + value = "*"; + alloca_fontname(result, strlen(value)); + if (*result != 0) { + if (**result != '\0') + strcat(*result, "-"); + strcat(*result, value); + } +} + +static void +append_fontname_num(char **result, int value) +{ + if (value < 0) { + append_fontname_str(result, "*"); + } else { + char temp[100]; + sprintf(temp, "%d", value); + append_fontname_str(result, temp); + } +} + +/* + * Take the given font props and try to make a well formed font name specifying + * the same base font and size and everything, but with different weight/width + * according to the parameters. The return value is allocated, should be freed + * by the caller. + */ +static char * +derive_font_name(FontNameProperties *props, + const char *use_weight, + int use_average_width, + const char *use_encoding) +{ + char *result = 0; + + append_fontname_str(&result, props->beginning); + append_fontname_str(&result, use_weight); + append_fontname_str(&result, props->slant); + append_fontname_str(&result, 0); + append_fontname_str(&result, 0); + append_fontname_num(&result, props->pixel_size); + append_fontname_str(&result, props->point_size); + append_fontname_num(&result, props->res_x); + append_fontname_num(&result, props->res_y); + append_fontname_str(&result, props->spacing); + append_fontname_num(&result, use_average_width); + append_fontname_str(&result, use_encoding); + + xtermDerivedFont(result); + return result; +} + +static char * +bold_font_name(FontNameProperties *props, int use_average_width) +{ + return derive_font_name(props, "bold", use_average_width, props->end); +} + +#if OPT_WIDE_ATTRS +static char * +italic_font_name(FontNameProperties *props, const char *slant) +{ + FontNameProperties myprops = *props; + myprops.slant = slant; + return derive_font_name(&myprops, props->weight, myprops.average_width, props->end); +} + +static Boolean +open_italic_font(XtermWidget xw, int n, FontNameProperties *fp, XTermFonts * data) +{ + static const char *slant[] = + { + "o", + "i" + }; + Cardinal pass; + Boolean result = False; + + NoFontWarning(data); + for (pass = 0; pass < XtNumber(slant); ++pass) { + char *name; + if ((name = italic_font_name(fp, slant[pass])) != 0) { + TRACE(("open_italic_font %s %s\n", + whichFontEnum((VTFontEnum) n), name)); + if (xtermOpenFont(xw, name, data, False)) { + result = (data->fs != 0); +#if OPT_REPORT_FONTS + if (resource.reportFonts) { + printf("opened italic version of %s:\n\t%s\n", + whichFontEnum((VTFontEnum) n), + name); + } +#endif + } + free(name); + if (result) + break; + } + } +#if OPT_TRACE + if (result) { + XFontStruct *fs = data->fs; + if (fs != 0) { + TRACE(("...actual size %dx%d (ascent %d, descent %d)\n", + fs->ascent + + fs->descent, + fs->max_bounds.width, + fs->ascent, + fs->descent)); + } + } +#endif + return result; +} +#endif + +#if OPT_WIDE_CHARS +#define derive_wide_font(props, weight) \ + derive_font_name(props, weight, props->average_width * 2, "ISO10646-1") + +static char * +wide_font_name(FontNameProperties *props) +{ + return derive_wide_font(props, "medium"); +} + +static char * +widebold_font_name(FontNameProperties *props) +{ + return derive_wide_font(props, "bold"); +} +#endif /* OPT_WIDE_CHARS */ + +#if OPT_DEC_CHRSET +/* + * Take the given font props and try to make a well formed font name specifying + * the same base font but changed depending on the given attributes and chrset. + * + * For double width fonts, we just double the X-resolution, for double height + * fonts we double the pixel-size and Y-resolution + */ +char * +xtermSpecialFont(XTermDraw * params) +{ + TScreen *screen = TScreenOf(params->xw); +#if OPT_TRACE + static char old_spacing[80]; + static FontNameProperties old_props; +#endif + FontNameProperties *props; + char *result = 0; + const char *weight; + int pixel_size; + int res_x; + int res_y; + + props = get_font_name_props(screen->display, + GetNormalFont(screen, fNorm)->fs, 0); + if (props == 0) + return result; + + pixel_size = props->pixel_size; + res_x = props->res_x; + res_y = props->res_y; + if (params->attr_flags & BOLD) + weight = "bold"; + else + weight = props->weight; + + if (CSET_DOUBLE(params->this_chrset)) + res_x *= 2; + + if (params->this_chrset == CSET_DHL_TOP + || params->this_chrset == CSET_DHL_BOT) { + res_y *= 2; + pixel_size *= 2; + } +#if OPT_TRACE + if (old_props.res_x != res_x + || old_props.res_x != res_y + || old_props.pixel_size != pixel_size + || strcmp(old_props.spacing, props->spacing)) { + TRACE(("xtermSpecialFont(atts = %#x, draw = %#x, chrset = %#x)\n", + params->attr_flags, params->draw_flags, params->this_chrset)); + TRACE(("res_x = %d\n", res_x)); + TRACE(("res_y = %d\n", res_y)); + TRACE(("point_size = %s\n", props->point_size)); + TRACE(("pixel_size = %d\n", pixel_size)); + TRACE(("spacing = %s\n", props->spacing)); + old_props.res_x = res_x; + old_props.res_y = res_y; + old_props.pixel_size = pixel_size; + old_props.spacing = old_spacing; + sprintf(old_spacing, "%.*s", (int) sizeof(old_spacing) - 2, props->spacing); + } +#endif + + append_fontname_str(&result, props->beginning); + append_fontname_str(&result, weight); + append_fontname_str(&result, props->slant); + append_fontname_str(&result, props->wideness); + append_fontname_str(&result, props->add_style); + append_fontname_num(&result, pixel_size); + append_fontname_str(&result, props->point_size); + append_fontname_num(&result, (params->draw_flags & NORESOLUTION) ? -1 : res_x); + append_fontname_num(&result, (params->draw_flags & NORESOLUTION) ? -1 : res_y); + append_fontname_str(&result, props->spacing); + append_fontname_str(&result, 0); + append_fontname_str(&result, props->end); + + xtermDerivedFont(result); + return result; +} +#endif /* OPT_DEC_CHRSET */ + +/* + * Case-independent comparison for font-names, including wildcards. + * XLFD allows '?' as a wildcard, but we do not handle that (no one seems + * to use it). + */ +static Bool +same_font_name(const char *pattern, const char *match) +{ + Bool result = False; + + if (pattern && match) { + while (*pattern && *match) { + if (*pattern == *match) { + pattern++; + match++; + } else if (*pattern == '*' || *match == '*') { + if (same_font_name(pattern + 1, match)) { + return True; + } else if (same_font_name(pattern, match + 1)) { + return True; + } else { + return False; + } + } else { + int p = x_toupper(*pattern++); + int m = x_toupper(*match++); + if (p != m) + return False; + } + } + result = (*pattern == *match); /* both should be NUL */ + } + return result; +} + +/* + * Double-check the fontname that we asked for versus what the font server + * actually gave us. The larger fixed fonts do not always have a matching bold + * font, and the font server may try to scale another font or otherwise + * substitute a mismatched font. + * + * If we cannot get what we requested, we will fallback to the original + * behavior, which simulates bold by overstriking each character at one pixel + * offset. + */ +static int +got_bold_font(Display *dpy, XFontStruct *fs, String requested) +{ + char *actual = 0; + int got; + + if (get_font_name_props(dpy, fs, &actual) == 0) + got = 0; + else + got = same_font_name(requested, actual); + free(actual); + return got; +} + +/* + * Check normal/bold (or wide/wide-bold) font pairs to see if we will be able + * to check for missing glyphs in a comparable manner. + */ +static int +comparable_metrics(XFontStruct *normal, XFontStruct *bold) +{ +#define DATA "comparable_metrics: " + int result = 0; + + if (normal == 0 || bold == 0) { + ; + } else if (normal->all_chars_exist) { + if (bold->all_chars_exist) { + result = 1; + } else { + TRACE((DATA "all chars exist in normal font, but not in bold\n")); + } + } else if (normal->per_char != 0) { + if (bold->per_char != 0) { + result = 1; + } else { + TRACE((DATA "normal font has per-char metrics, but not bold\n")); + } + } else { + TRACE((DATA "normal font is not very good!\n")); + result = 1; /* give in (we're not going in reverse) */ + } + return result; +#undef DATA +} + +/* + * If the font server tries to adjust another font, it may not adjust it + * properly. Check that the bounding boxes are compatible. Otherwise we'll + * leave trash on the display when we mix normal and bold fonts. + */ +static int +same_font_size(XtermWidget xw, XFontStruct *nfs, XFontStruct *bfs) +{ + TScreen *screen = TScreenOf(xw); + int result = 0; + + if (nfs != 0 && bfs != 0) { + TRACE(("same_font_size height %d/%d, min %d/%d max %d/%d\n", + nfs->ascent + nfs->descent, + bfs->ascent + bfs->descent, + nfs->min_bounds.width, bfs->min_bounds.width, + nfs->max_bounds.width, bfs->max_bounds.width)); + result = screen->free_bold_box + || ((nfs->ascent + nfs->descent) == (bfs->ascent + bfs->descent) + && (nfs->min_bounds.width == bfs->min_bounds.width + || nfs->min_bounds.width == bfs->min_bounds.width + 1) + && (nfs->max_bounds.width == bfs->max_bounds.width + || nfs->max_bounds.width == bfs->max_bounds.width + 1)); + } + return result; +} + +/* + * Check if the font looks like it has fixed width + */ +static int +is_fixed_font(XFontStruct *fs) +{ + if (fs) + return (fs->min_bounds.width == fs->max_bounds.width); + return 1; +} + +static int +differing_widths(XFontStruct *a, XFontStruct *b) +{ + int result = 0; + if (a != NULL && b != NULL && a->max_bounds.width != b->max_bounds.width) + result = 1; + return result; +} + +/* + * Check if the font looks like a double width font (i.e. contains + * characters of width X and 2X + */ +#if OPT_WIDE_CHARS +static int +is_double_width_font(XFontStruct *fs) +{ + return (fs != NULL && ((2 * fs->min_bounds.width) == fs->max_bounds.width)); +} +#else +#define is_double_width_font(fs) 0 +#endif + +#if OPT_WIDE_CHARS && OPT_RENDERFONT && defined(HAVE_TYPE_FCCHAR32) +#define HALF_WIDTH_TEST_STRING "1234567890" + +/* '1234567890' in Chinese characters in UTF-8 */ +#define FULL_WIDTH_TEST_STRING "\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89" \ + "\xe5\x9b\x9b\xe4\xba\x94" \ + "\xef\xa7\x91\xe4\xb8\x83\xe5\x85\xab" \ + "\xe4\xb9\x9d\xef\xa6\xb2" + +/* '1234567890' in Korean script in UTF-8 */ +#define FULL_WIDTH_TEST_STRING2 "\xec\x9d\xbc\xec\x9d\xb4\xec\x82\xbc" \ + "\xec\x82\xac\xec\x98\xa4" \ + "\xec\x9c\xa1\xec\xb9\xa0\xed\x8c\x94" \ + "\xea\xb5\xac\xec\x98\x81" + +#define HALF_WIDTH_CHAR1 0x0031 /* '1' */ +#define HALF_WIDTH_CHAR2 0x0057 /* 'W' */ +#define FULL_WIDTH_CHAR1 0x4E00 /* CJK Ideograph 'number one' */ +#define FULL_WIDTH_CHAR2 0xAC00 /* Korean script syllable 'Ka' */ + +static Bool +is_double_width_font_xft(Display *dpy, XftFont *font) +{ + XGlyphInfo gi1, gi2; + FcChar32 c1 = HALF_WIDTH_CHAR1, c2 = HALF_WIDTH_CHAR2; + String fwstr = FULL_WIDTH_TEST_STRING; + String hwstr = HALF_WIDTH_TEST_STRING; + + /* Some Korean fonts don't have Chinese characters at all. */ + if (!XftCharExists(dpy, font, FULL_WIDTH_CHAR1)) { + if (!XftCharExists(dpy, font, FULL_WIDTH_CHAR2)) + return False; /* Not a CJK font */ + else /* a Korean font without CJK Ideographs */ + fwstr = FULL_WIDTH_TEST_STRING2; + } + + XftTextExtents32(dpy, font, &c1, 1, &gi1); + XftTextExtents32(dpy, font, &c2, 1, &gi2); + if (gi1.xOff != gi2.xOff) /* Not a fixed-width font */ + return False; + + XftTextExtentsUtf8(dpy, + font, + (_Xconst FcChar8 *) hwstr, + (int) strlen(hwstr), + &gi1); + XftTextExtentsUtf8(dpy, + font, + (_Xconst FcChar8 *) fwstr, + (int) strlen(fwstr), + &gi2); + + /* + * fontconfig and Xft prior to 2.2(?) set the width of half-width + * characters identical to that of full-width character in CJK double-width + * (bi-width / monospace) font even though the former is half as wide as + * the latter. This was fixed sometime before the release of fontconfig + * 2.2 in early 2003. See + * http://bugzilla.mozilla.org/show_bug.cgi?id=196312 + * In the meantime, we have to check both possibilities. + */ + return ((2 * gi1.xOff == gi2.xOff) || (gi1.xOff == gi2.xOff)); +} +#else +#define is_double_width_font_xft(dpy, xftfont) 0 +#endif + +#define EmptyFont(fs) (fs != 0 \ + && ((fs)->ascent + (fs)->descent == 0 \ + || (fs)->max_bounds.width == 0)) + +#define FontSize(fs) (((fs)->ascent + (fs)->descent) \ + * (fs)->max_bounds.width) + +const VTFontNames * +xtermFontName(const char *normal) +{ + static VTFontNames data; + FREE_STRING(data.f_n); + memset(&data, 0, sizeof(data)); + if (normal) + data.f_n = x_strdup(normal); + return &data; +} + +const VTFontNames * +defaultVTFontNames(XtermWidget xw) +{ + static VTFontNames data; + memset(&data, 0, sizeof(data)); + data.f_n = DefaultFontN(xw); + data.f_b = DefaultFontB(xw); +#if OPT_WIDE_CHARS + data.f_w = DefaultFontW(xw); + data.f_wb = DefaultFontWB(xw); +#endif + return &data; +} + +static void +cache_menu_font_name(TScreen *screen, int fontnum, int which, const char *name) +{ + if (name != 0) { + String last = screen->menu_font_names[fontnum][which]; + if (last != 0) { + if (strcmp(last, name)) { + FREE_STRING(last); + TRACE(("caching menu fontname %d.%d %s\n", fontnum, which, name)); + screen->menu_font_names[fontnum][which] = x_strdup(name); + } + } else { + TRACE(("caching menu fontname %d.%d %s\n", fontnum, which, name)); + screen->menu_font_names[fontnum][which] = x_strdup(name); + } + } +} + +static void +cannotFont(XtermWidget xw, const char *who, const char *tag, const char *name) +{ + static NameList *reported; + NameList *list; + + switch (xw->misc.fontWarnings) { + case fwNever: + return; + case fwResource: + if (is_derived_font_name(name)) + return; + break; + case fwAlways: + break; + } + for (list = reported; list != 0; list = list->next) { + if (!x_strcasecmp(name, list->name)) { + return; + } + } + if ((list = TypeMalloc(NameList)) != 0) { + list->name = x_strdup(name); + list->next = reported; + reported = list; + } + xtermWarning("cannot %s%s%s %sfont \"%s\"\n", + who, *tag ? " " : "", tag, + is_derived_font_name(name) ? "derived " : "", + name); +} + +#if OPT_RENDERFONT +static void +noUsableXft(XtermWidget xw, const char *name) +{ + switch (xw->misc.fontWarnings) { + case fwNever: + return; + case fwResource: + /* these combinations of wide/bold/italic are all "derived" */ + return; + case fwAlways: + break; + } + xtermWarning("did not find a usable %s TrueType font\n", name); +} +#endif + +/* + * Open the given font and verify that it is non-empty. Return a null on + * failure. + */ +Bool +xtermOpenFont(XtermWidget xw, + const char *name, + XTermFonts * result, + Bool force) +{ + Bool code = False; + TScreen *screen = TScreenOf(xw); + + TRACE(("xtermOpenFont %d:%d '%s'\n", + result->warn, xw->misc.fontWarnings, NonNull(name))); + if (!IsEmpty(name)) { + if ((result->fs = XLoadQueryFont(screen->display, name)) != 0) { + code = True; + if (EmptyFont(result->fs)) { + xtermCloseFont(xw, result); + code = False; + } else { + result->fn = x_strdup(name); + } + } else if (XmuCompareISOLatin1(name, DEFFONT) != 0) { + if (result->warn <= xw->misc.fontWarnings +#if OPT_RENDERFONT + && !UsingRenderFont(xw) +#endif + ) { + cannotFont(xw, "load", "", name); + } else { + TRACE(("xtermOpenFont: cannot load font '%s'\n", name)); + } + if (force) { + NoFontWarning(result); + code = xtermOpenFont(xw, DEFFONT, result, True); + } + } + } + NoFontWarning(result); + return code; +} + +/* + * Close the font and free the font info. + */ +void +xtermCloseFont(XtermWidget xw, XTermFonts * fnt) +{ + if (fnt != 0 && fnt->fs != 0) { + TScreen *screen = TScreenOf(xw); + + clrCgsFonts(xw, WhichVWin(screen), fnt); + XFreeFont(screen->display, fnt->fs); + xtermFreeFontInfo(fnt); + } +} + +/* + * Close and free the font (as well as any aliases). + */ +static void +xtermCloseFont2(XtermWidget xw, XTermFonts * fnts, int which) +{ + XFontStruct *thisFont = fnts[which].fs; + + if (thisFont != 0) { + int k; + + xtermCloseFont(xw, &fnts[which]); + for (k = 0; k < fMAX; ++k) { + if (k != which) { + if (thisFont == fnts[k].fs) { + xtermFreeFontInfo(&fnts[k]); + } + } + } + } +} + +/* + * Close the listed fonts, noting that some may use copies of the pointer. + */ +void +xtermCloseFonts(XtermWidget xw, XTermFonts * fnts) +{ + int j; + + for (j = 0; j < fMAX; ++j) { + xtermCloseFont2(xw, fnts, j); + } +} + +/* + * Make a copy of the source, assuming the XFontStruct's to be unique, but + * ensuring that the names are reallocated to simplify freeing. + */ +void +xtermCopyFontInfo(XTermFonts * target, XTermFonts * source) +{ + xtermFreeFontInfo(target); + target->chrset = source->chrset; + target->flags = source->flags; + target->fn = x_strdup(source->fn); + target->fs = source->fs; + target->warn = source->warn; +} + +void +xtermFreeFontInfo(XTermFonts * target) +{ + target->chrset = 0; + target->flags = 0; + if (target->fn != 0) { + free(target->fn); + target->fn = 0; + } + target->fs = 0; +} + +#if OPT_REPORT_FONTS +static void +reportXCharStruct(const char *tag, XCharStruct * cs) +{ + printf("\t\t%s:\n", tag); + printf("\t\t\tlbearing: %d\n", cs->lbearing); + printf("\t\t\trbearing: %d\n", cs->rbearing); + printf("\t\t\twidth: %d\n", cs->width); + printf("\t\t\tascent: %d\n", cs->ascent); + printf("\t\t\tdescent: %d\n", cs->descent); +} + +static void +reportOneVTFont(const char *tag, + XTermFonts * fnt) +{ + if (!IsEmpty(fnt->fn) && fnt->fs != 0) { + XFontStruct *fs = fnt->fs; + unsigned first_char = 0; + unsigned last_char = 0; + + if (fs->max_byte1 == 0) { + first_char = fs->min_char_or_byte2; + last_char = fs->max_char_or_byte2; + } else { + first_char = (fs->min_byte1 * 256) + fs->min_char_or_byte2; + last_char = (fs->max_byte1 * 256) + fs->max_char_or_byte2; + } + + printf("\t%s: %s\n", tag, NonNull(fnt->fn)); + printf("\t\tall chars: %s\n", fs->all_chars_exist ? "yes" : "no"); + printf("\t\tdefault char: %d\n", fs->default_char); + printf("\t\tdirection: %d\n", fs->direction); + printf("\t\tascent: %d\n", fs->ascent); + printf("\t\tdescent: %d\n", fs->descent); + printf("\t\tfirst char: %u\n", first_char); + printf("\t\tlast char: %u\n", last_char); + printf("\t\tmaximum-chars: %u\n", countGlyphs(fs)); + if (FontLacksMetrics(fnt)) { + printf("\t\tmissing-chars: ?\n"); + printf("\t\tpresent-chars: ?\n"); + } else { + unsigned missing = 0; + unsigned ch; + for (ch = first_char; ch <= last_char; ++ch) { + if (xtermMissingChar(ch, fnt)) { + ++missing; + } + } + printf("\t\tmissing-chars: %u\n", missing); + printf("\t\tpresent-chars: %u\n", countGlyphs(fs) - missing); + } + printf("\t\tmin_byte1: %d\n", fs->min_byte1); + printf("\t\tmax_byte1: %d\n", fs->max_byte1); + printf("\t\tproperties: %d\n", fs->n_properties); + reportXCharStruct("min_bounds", &(fs->min_bounds)); + reportXCharStruct("max_bounds", &(fs->max_bounds)); + /* TODO: report fs->properties and fs->per_char */ + } +} + +static void +reportVTFontInfo(XtermWidget xw, int fontnum) +{ + if (resource.reportFonts) { + TScreen *screen = TScreenOf(xw); + + if (fontnum) { + printf("Loaded VTFonts(font%d)\n", fontnum); + } else { + printf("Loaded VTFonts(default)\n"); + } + + reportOneVTFont("fNorm", GetNormalFont(screen, fNorm)); + reportOneVTFont("fBold", GetNormalFont(screen, fBold)); +#if OPT_WIDE_CHARS + reportOneVTFont("fWide", GetNormalFont(screen, fWide)); + reportOneVTFont("fWBold", GetNormalFont(screen, fWBold)); +#endif + } +} +#endif + +void +xtermUpdateFontGCs(XtermWidget xw, MyGetFont myfunc) +{ + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + Pixel new_normal = getXtermFG(xw, xw->flags, xw->cur_foreground); + Pixel new_revers = getXtermBG(xw, xw->flags, xw->cur_background); + + setCgsFore(xw, win, gcNorm, new_normal); + setCgsBack(xw, win, gcNorm, new_revers); + setCgsFont(xw, win, gcNorm, myfunc(screen, fNorm)); + + copyCgs(xw, win, gcBold, gcNorm); + setCgsFont2(xw, win, gcBold, myfunc(screen, fBold), fBold); + + setCgsFore(xw, win, gcNormReverse, new_revers); + setCgsBack(xw, win, gcNormReverse, new_normal); + setCgsFont(xw, win, gcNormReverse, myfunc(screen, fNorm)); + + copyCgs(xw, win, gcBoldReverse, gcNormReverse); + setCgsFont2(xw, win, gcBoldReverse, myfunc(screen, fBold), fBold); + + if_OPT_WIDE_CHARS(screen, { + XTermFonts *wide_xx = myfunc(screen, fWide); + XTermFonts *bold_xx = myfunc(screen, fWBold); + if (wide_xx->fs != 0 + && bold_xx->fs != 0) { + setCgsFore(xw, win, gcWide, new_normal); + setCgsBack(xw, win, gcWide, new_revers); + setCgsFont(xw, win, gcWide, wide_xx); + + copyCgs(xw, win, gcWBold, gcWide); + setCgsFont(xw, win, gcWBold, bold_xx); + + setCgsFore(xw, win, gcWideReverse, new_revers); + setCgsBack(xw, win, gcWideReverse, new_normal); + setCgsFont(xw, win, gcWideReverse, wide_xx); + + copyCgs(xw, win, gcWBoldReverse, gcWideReverse); + setCgsFont(xw, win, gcWBoldReverse, bold_xx); + } + }); +} + +#if OPT_WIDE_ATTRS +unsigned +xtermUpdateItalics(XtermWidget xw, unsigned new_attrs, unsigned old_attrs) +{ + if ((new_attrs & ATR_ITALIC) && !(old_attrs & ATR_ITALIC)) { + xtermLoadItalics(xw); + xtermUpdateFontGCs(xw, getItalicFont); + } else if (!(new_attrs & ATR_ITALIC) && (old_attrs & ATR_ITALIC)) { + xtermUpdateFontGCs(xw, getNormalFont); + } + return new_attrs; +} +#endif + +#if OPT_TRACE +static void +show_font_misses(const char *name, XTermFonts * fp) +{ + if (fp->fs != 0) { + if (FontLacksMetrics(fp)) { + TRACE(("%s font lacks metrics\n", name)); + } else if (FontIsIncomplete(fp)) { + TRACE(("%s font is incomplete\n", name)); + } else { + TRACE(("%s font is complete\n", name)); + } + } else { + TRACE(("%s font is missing\n", name)); + } +} +#endif + +static Bool +loadNormFP(XtermWidget xw, + char **nameOutP, + XTermFonts * infoOut, + int fontnum) +{ + Bool status = True; + + TRACE(("loadNormFP (%s)\n", NonNull(*nameOutP))); + + if (!xtermOpenFont(xw, + *nameOutP, + infoOut, + (fontnum == fontMenu_default))) { + /* + * If we are opening the default font, and it happens to be missing, + * force that to the compiled-in default font, e.g., "fixed". If we + * cannot open the font, disable it from the menu. + */ + if (fontnum != fontMenu_fontsel) { + SetItemSensitivity(fontMenuEntries[fontnum].widget, False); + } + status = False; + } + return status; +} + +static Bool +loadBoldFP(XtermWidget xw, + char **nameOutP, + XTermFonts * infoOut, + const char *nameRef, + XTermFonts * infoRef, + int fontnum) +{ + TScreen *screen = TScreenOf(xw); + Bool status = True; + + TRACE(("loadBoldFP (%s)\n", NonNull(*nameOutP))); + + if (!check_fontname(*nameOutP)) { + FontNameProperties *fp; + char *normal = x_strdup(nameRef); + + fp = get_font_name_props(screen->display, infoRef->fs, &normal); + if (fp != 0) { + NoFontWarning(infoOut); + *nameOutP = bold_font_name(fp, fp->average_width); + if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) { + free(*nameOutP); + *nameOutP = bold_font_name(fp, -1); + xtermOpenFont(xw, *nameOutP, infoOut, False); + } + TRACE(("...derived bold '%s'\n", NonNull(*nameOutP))); + } + if (fp == 0 || infoOut->fs == 0) { + xtermCopyFontInfo(infoOut, infoRef); + TRACE(("...cannot load a matching bold font\n")); + } else if (comparable_metrics(infoRef->fs, infoOut->fs) + && same_font_size(xw, infoRef->fs, infoOut->fs) + && got_bold_font(screen->display, infoOut->fs, *nameOutP)) { + TRACE(("...got a matching bold font\n")); + cache_menu_font_name(screen, fontnum, fBold, *nameOutP); + } else { + xtermCloseFont2(xw, infoOut - fBold, fBold); + *infoOut = *infoRef; + TRACE(("...did not get a matching bold font\n")); + } + free(normal); + } else if (!xtermOpenFont(xw, *nameOutP, infoOut, False)) { + xtermCopyFontInfo(infoOut, infoRef); + TRACE(("...cannot load bold font '%s'\n", NonNull(*nameOutP))); + } else { + cache_menu_font_name(screen, fontnum, fBold, *nameOutP); + } + + /* + * Most of the time this call to load the font will succeed, even if + * there is no wide font : the X server doubles the width of the + * normal font, or similar. + * + * But if it did fail for some reason, then nevermind. + */ + if (EmptyFont(infoOut->fs)) + status = False; /* can't use a 0-sized font */ + + if (!same_font_size(xw, infoRef->fs, infoOut->fs) + && (is_fixed_font(infoRef->fs) && is_fixed_font(infoOut->fs))) { + TRACE(("...ignoring mismatched normal/bold fonts\n")); + xtermCloseFont2(xw, infoOut - fBold, fBold); + xtermCopyFontInfo(infoOut, infoRef); + } + + return status; +} + +#if OPT_WIDE_CHARS +static Bool +loadWideFP(XtermWidget xw, + char **nameOutP, + XTermFonts * infoOut, + const char *nameRef, + XTermFonts * infoRef, + int fontnum) +{ + TScreen *screen = TScreenOf(xw); + Bool status = True; + + TRACE(("loadWideFP (%s)\n", NonNull(*nameOutP))); + + if (!check_fontname(*nameOutP) + && (screen->utf8_fonts && !is_double_width_font(infoRef->fs))) { + char *normal = x_strdup(nameRef); + FontNameProperties *fp = get_font_name_props(screen->display, + infoRef->fs, &normal); + if (fp != 0) { + *nameOutP = wide_font_name(fp); + NoFontWarning(infoOut); + } + free(normal); + } + + if (check_fontname(*nameOutP)) { + if (xtermOpenFont(xw, *nameOutP, infoOut, False) + && is_derived_font_name(*nameOutP) + && EmptyFont(infoOut->fs)) { + xtermCloseFont2(xw, infoOut - fWide, fWide); + } + if (infoOut->fs == 0) { + xtermCopyFontInfo(infoOut, infoRef); + } else { + TRACE(("...%s wide %s\n", + is_derived_font_name(*nameOutP) ? "derived" : "given", + NonNull(*nameOutP))); + cache_menu_font_name(screen, fontnum, fWide, *nameOutP); + } + } else { + xtermCopyFontInfo(infoOut, infoRef); + } + return status; +} + +static Bool +loadWBoldFP(XtermWidget xw, + char **nameOutP, + XTermFonts * infoOut, + const char *wideNameRef, XTermFonts * wideInfoRef, + const char *boldNameRef, XTermFonts * boldInfoRef, + int fontnum) +{ + TScreen *screen = TScreenOf(xw); + Bool status = True; + char *bold = NULL; + + TRACE(("loadWBoldFP (%s)\n", NonNull(*nameOutP))); + + if (!check_fontname(*nameOutP)) { + FontNameProperties *fp; + fp = get_font_name_props(screen->display, boldInfoRef->fs, &bold); + if (fp != 0) { + *nameOutP = widebold_font_name(fp); + NoFontWarning(infoOut); + } + } + + if (check_fontname(*nameOutP)) { + + if (xtermOpenFont(xw, *nameOutP, infoOut, False) + && is_derived_font_name(*nameOutP) + && !compatibleWideCounts(wideInfoRef->fs, infoOut->fs)) { + xtermCloseFont2(xw, infoOut - fWBold, fWBold); + } + + if (infoOut->fs == 0) { + if (is_derived_font_name(*nameOutP)) + free(*nameOutP); + if (IsEmpty(wideNameRef)) { + *nameOutP = x_strdup(boldNameRef); + xtermCopyFontInfo(infoOut, boldInfoRef); + TRACE(("...cannot load wide-bold, use bold %s\n", + NonNull(boldNameRef))); + } else { + *nameOutP = x_strdup(wideNameRef); + xtermCopyFontInfo(infoOut, wideInfoRef); + TRACE(("...cannot load wide-bold, use wide %s\n", + NonNull(wideNameRef))); + } + } else { + TRACE(("...%s wide/bold %s\n", + is_derived_font_name(*nameOutP) ? "derived" : "given", + NonNull(*nameOutP))); + cache_menu_font_name(screen, fontnum, fWBold, *nameOutP); + } + } else if (is_double_width_font(boldInfoRef->fs)) { + xtermCopyFontInfo(infoOut, boldInfoRef); + TRACE(("...bold font is double-width, use it %s\n", NonNull(boldNameRef))); + } else { + xtermCopyFontInfo(infoOut, wideInfoRef); + TRACE(("...cannot load wide bold font, use wide %s\n", NonNull(wideNameRef))); + } + + free(bold); + + if (EmptyFont(infoOut->fs)) { + status = False; /* can't use a 0-sized font */ + } else { + if ((!comparable_metrics(wideInfoRef->fs, infoOut->fs) + || (!same_font_size(xw, wideInfoRef->fs, infoOut->fs) + && is_fixed_font(wideInfoRef->fs) + && is_fixed_font(infoOut->fs)))) { + TRACE(("...ignoring mismatched normal/bold wide fonts\n")); + xtermCloseFont2(xw, infoOut - fWBold, fWBold); + xtermCopyFontInfo(infoOut, wideInfoRef); + } + } + + return status; +} +#endif + +int +xtermLoadFont(XtermWidget xw, + const VTFontNames * fonts, + Bool doresize, + int fontnum) +{ + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + + VTFontNames myfonts; + XTermFonts fnts[fMAX]; + char *tmpname = NULL; + Boolean proportional = False; + + memset(&myfonts, 0, sizeof(myfonts)); + memset(fnts, 0, sizeof(fnts)); + + if (fonts != 0) + myfonts = *fonts; + if (!check_fontname(myfonts.f_n)) + return 0; + + if (fontnum == fontMenu_fontescape + && myfonts.f_n != screen->MenuFontName(fontnum)) { + if ((tmpname = x_strdup(myfonts.f_n)) == 0) + return 0; + } + + TRACE(("Begin Cgs - xtermLoadFont(%s)\n", myfonts.f_n)); + releaseWindowGCs(xw, win); + +#define DbgResource(name, field, index) \ + TRACE(("xtermLoadFont #%d "name" %s%s\n", \ + fontnum, \ + (fnts[index].warn == fwResource) ? "*" : " ", \ + NonNull(myfonts.field))) + DbgResource("normal", f_n, fNorm); + DbgResource("bold ", f_b, fBold); +#if OPT_WIDE_CHARS + DbgResource("wide ", f_w, fWide); + DbgResource("w/bold", f_wb, fWBold); +#endif + + if (!loadNormFP(xw, + &myfonts.f_n, + &fnts[fNorm], + fontnum)) + goto bad; + + if (!loadBoldFP(xw, + &myfonts.f_b, + &fnts[fBold], + myfonts.f_n, + &fnts[fNorm], + fontnum)) + goto bad; + + /* + * If there is no widefont specified, fake it by doubling AVERAGE_WIDTH + * of normal fonts XLFD, and asking for it. This plucks out 18x18ja + * and 12x13ja as the corresponding fonts for 9x18 and 6x13. + */ + if_OPT_WIDE_CHARS(screen, { + + if (!loadWideFP(xw, + &myfonts.f_w, + &fnts[fWide], + myfonts.f_n, + &fnts[fNorm], + fontnum)) + goto bad; + + if (!loadWBoldFP(xw, + &myfonts.f_wb, + &fnts[fWBold], + myfonts.f_w, + &fnts[fWide], + myfonts.f_b, + &fnts[fBold], + fontnum)) + goto bad; + + }); + + /* + * Normal/bold fonts should be the same width. Also, the min/max + * values should be the same. + */ + if (fnts[fNorm].fs != 0 + && fnts[fBold].fs != 0 + && (!is_fixed_font(fnts[fNorm].fs) + || !is_fixed_font(fnts[fBold].fs) + || differing_widths(fnts[fNorm].fs, fnts[fBold].fs))) { + TRACE(("Proportional font! normal %d/%d, bold %d/%d\n", + fnts[fNorm].fs->min_bounds.width, + fnts[fNorm].fs->max_bounds.width, + fnts[fBold].fs->min_bounds.width, + fnts[fBold].fs->max_bounds.width)); + proportional = True; + } + + if_OPT_WIDE_CHARS(screen, { + if (fnts[fWide].fs != 0 + && fnts[fWBold].fs != 0 + && (!is_fixed_font(fnts[fWide].fs) + || !is_fixed_font(fnts[fWBold].fs) + || differing_widths(fnts[fWide].fs, fnts[fWBold].fs))) { + TRACE(("Proportional font! wide %d/%d, wide bold %d/%d\n", + fnts[fWide].fs->min_bounds.width, + fnts[fWide].fs->max_bounds.width, + fnts[fWBold].fs->min_bounds.width, + fnts[fWBold].fs->max_bounds.width)); + proportional = True; + } + }); + + /* TODO : enforce that the width of the wide font is 2* the width + of the narrow font */ + + /* + * If we're switching fonts, free the old ones. Otherwise we'll leak + * the memory that is associated with the old fonts. The + * XLoadQueryFont call allocates a new XFontStruct. + */ + xtermCloseFonts(xw, screen->fnts); +#if OPT_WIDE_ATTRS + xtermCloseFonts(xw, screen->ifnts); + screen->ifnts_ok = False; +#endif + + xtermCopyFontInfo(GetNormalFont(screen, fNorm), &fnts[fNorm]); + xtermCopyFontInfo(GetNormalFont(screen, fBold), &fnts[fBold]); +#if OPT_WIDE_CHARS + xtermCopyFontInfo(GetNormalFont(screen, fWide), &fnts[fWide]); + if (fnts[fWBold].fs == NULL) + xtermCopyFontInfo(GetNormalFont(screen, fWide), &fnts[fWide]); + xtermCopyFontInfo(GetNormalFont(screen, fWBold), &fnts[fWBold]); +#endif + + xtermUpdateFontGCs(xw, getNormalFont); + +#if OPT_BOX_CHARS + screen->allow_packing = proportional; + setupPackedFonts(xw); +#endif + screen->fnt_prop = (Boolean) (proportional && !(screen->force_packed)); + screen->fnt_boxes = 1; + +#if OPT_BOX_CHARS + /* + * xterm uses character positions 1-31 of a font for the line-drawing + * characters. Check that they are all present. The null character + * (0) is special, and is not used. + */ +#if OPT_RENDERFONT + if (UsingRenderFont(xw)) { + /* + * FIXME: we shouldn't even be here if we're using Xft. + */ + screen->fnt_boxes = 0; + TRACE(("assume Xft missing line-drawing chars\n")); + } else +#endif + { + unsigned ch; + +#if OPT_TRACE +#define TRACE_MISS(index) show_font_misses(#index, &fnts[index]) + TRACE_MISS(fNorm); + TRACE_MISS(fBold); +#if OPT_WIDE_CHARS + TRACE_MISS(fWide); + TRACE_MISS(fWBold); +#endif +#endif + +#if OPT_WIDE_CHARS + if (screen->utf8_mode || screen->unicode_font) { + UIntSet(screen->fnt_boxes, 2); + for (ch = 1; ch < 32; ch++) { + unsigned n = dec2ucs(screen, ch); + if ((n != UCS_REPL) + && (n != ch) + && (screen->fnt_boxes & 2)) { + if (xtermMissingChar(n, &fnts[fNorm]) || + xtermMissingChar(n, &fnts[fBold])) { + UIntClr(screen->fnt_boxes, 2); + TRACE(("missing graphics character #%d, U+%04X\n", + ch, n)); + break; + } + } + } + } +#endif + + for (ch = 1; ch < 32; ch++) { + if (xtermMissingChar(ch, &fnts[fNorm])) { + TRACE(("missing normal char #%d\n", ch)); + UIntClr(screen->fnt_boxes, 1); + break; + } + if (xtermMissingChar(ch, &fnts[fBold])) { + TRACE(("missing bold char #%d\n", ch)); + UIntClr(screen->fnt_boxes, 1); + break; + } + } + + TRACE(("Will %suse internal line-drawing characters (mode %d)\n", + screen->fnt_boxes ? "not " : "", + screen->fnt_boxes)); + } +#endif + + if (screen->always_bold_mode) { + screen->enbolden = screen->bold_mode; + } else { + screen->enbolden = screen->bold_mode + && ((fnts[fNorm].fs == fnts[fBold].fs) + || same_font_name(myfonts.f_n, myfonts.f_b)); + } + TRACE(("Will %suse 1-pixel offset/overstrike to simulate bold\n", + screen->enbolden ? "" : "not ")); + + set_menu_font(False); + screen->menu_font_number = fontnum; + set_menu_font(True); + if (tmpname) { /* if setting escape or sel */ + if (screen->MenuFontName(fontnum)) + FREE_STRING(screen->MenuFontName(fontnum)); + screen->MenuFontName(fontnum) = tmpname; + if (fontnum == fontMenu_fontescape) { + update_font_escape(); + } +#if OPT_SHIFT_FONTS + screen->menu_font_sizes[fontnum] = FontSize(fnts[fNorm].fs); +#endif + } + set_cursor_gcs(xw); + xtermUpdateFontInfo(xw, doresize); + TRACE(("Success Cgs - xtermLoadFont\n")); +#if OPT_REPORT_FONTS + reportVTFontInfo(xw, fontnum); +#endif + FREE_FNAME(f_n); + FREE_FNAME(f_b); +#if OPT_WIDE_CHARS + FREE_FNAME(f_w); + FREE_FNAME(f_wb); +#endif + if (fnts[fNorm].fn == fnts[fBold].fn) { + free(fnts[fNorm].fn); + } else { + free(fnts[fNorm].fn); + free(fnts[fBold].fn); + } +#if OPT_WIDE_CHARS + free(fnts[fWide].fn); + free(fnts[fWBold].fn); +#endif + xtermSetWinSize(xw); + return 1; + + bad: + if (tmpname) + free(tmpname); + +#if OPT_RENDERFONT + if ((fontnum == fontMenu_fontsel) && (fontnum != screen->menu_font_number)) { + int old_fontnum = screen->menu_font_number; +#if OPT_TOOLBAR + SetItemSensitivity(fontMenuEntries[fontnum].widget, True); +#endif + Bell(xw, XkbBI_MinorError, 0); + myfonts.f_n = screen->MenuFontName(old_fontnum); + return xtermLoadFont(xw, &myfonts, doresize, old_fontnum); + } else if (x_strcasecmp(myfonts.f_n, DEFFONT)) { + int code; + + myfonts.f_n = x_strdup(DEFFONT); + TRACE(("...recovering for TrueType fonts\n")); + code = xtermLoadFont(xw, &myfonts, doresize, fontnum); + if (code) { + if (fontnum != fontMenu_fontsel) { + SetItemSensitivity(fontMenuEntries[fontnum].widget, + UsingRenderFont(xw)); + } + TRACE(("...recovered size %dx%d\n", + FontHeight(screen), + FontWidth(screen))); + } + return code; + } +#endif + + releaseWindowGCs(xw, win); + + xtermCloseFonts(xw, fnts); + TRACE(("Fail Cgs - xtermLoadFont\n")); + return 0; +} + +#if OPT_WIDE_ATTRS +/* + * (Attempt to) load matching italics for the current normal/bold/etc fonts. + * If the attempt fails for a given style, use the non-italic font. + */ +void +xtermLoadItalics(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + + if (!screen->ifnts_ok) { + int n; + FontNameProperties *fp; + XTermFonts *data; + + screen->ifnts_ok = True; + for (n = 0; n < fMAX; ++n) { + switch (n) { + case fNorm: + /* FALLTHRU */ + case fBold: + /* FALLTHRU */ +#if OPT_WIDE_CHARS + case fWide: + /* FALLTHRU */ + case fWBold: +#endif + /* FALLTHRU */ + data = getItalicFont(screen, n); + + /* + * FIXME - need to handle font-leaks + */ + data->fs = 0; + if (getNormalFont(screen, n)->fs != 0 && + (fp = get_font_name_props(screen->display, + getNormalFont(screen, n)->fs, + 0)) != 0) { + if (!open_italic_font(xw, n, fp, data)) { + if (n > 0) { + xtermCopyFontInfo(data, + getItalicFont(screen, n - 1)); + } else { + xtermOpenFont(xw, + getNormalFont(screen, n)->fn, + data, False); + } + } + } + break; + } + } + } +} +#endif + +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS +/* + * Collect font-names that we can modify with the load-vt-fonts() action. + */ +#define MERGE_SUBFONT(dst,src,name) \ + if (IsEmpty(dst.name)) { \ + TRACE(("MERGE_SUBFONT " #dst "." #name " merge \"%s\"\n", NonNull(src.name))); \ + dst.name = x_strdup(src.name); \ + } else { \ + TRACE(("MERGE_SUBFONT " #dst "." #name " found \"%s\"\n", NonNull(dst.name))); \ + } +#define MERGE_SUBLIST(dst,src,name) \ + if (merge_sublist(&(dst.fonts.x11.name), src.fonts.x11.name)) { \ + TRACE(("MERGE_SUBLIST " #dst "." #name " merge \"%s\"\n", src.fonts.x11.name[0])); \ + } else { \ + TRACE(("MERGE_SUBLIST " #dst "." #name " found \"%s\"\n", dst.fonts.x11.name[0])); \ + } + +#define INFER_SUBFONT(dst,src,name) \ + if (IsEmpty(dst.name)) { \ + TRACE(("INFER_SUBFONT " #dst "." #name " will infer\n")); \ + dst.name = x_strdup(""); \ + } else { \ + TRACE(("INFER_SUBFONT " #dst "." #name " found \"%s\"\n", NonNull(dst.name))); \ + } + +#define FREE_MENU_FONTS(dst) \ + TRACE(("FREE_MENU_FONTS " #dst "\n")); \ + for (n = fontMenu_default; n <= fontMenu_lastBuiltin; ++n) { \ + for (m = 0; m < fMAX; ++m) { \ + FREE_STRING(dst.menu_font_names[n][m]); \ + dst.menu_font_names[n][m] = 0; \ + } \ + } + +#define COPY_MENU_FONTS(dst,src) \ + TRACE(("COPY_MENU_FONTS " #src " to " #dst "\n")); \ + for (n = fontMenu_default; n <= fontMenu_lastBuiltin; ++n) { \ + for (m = 0; m < fMAX; ++m) { \ + FREE_STRING(dst.menu_font_names[n][m]); \ + dst.menu_font_names[n][m] = x_strdup(src.menu_font_names[n][m]); \ + } \ + TRACE((".. " #dst ".menu_fonts_names[%d] = %s\n", n, NonNull(dst.menu_font_names[n][fNorm]))); \ + } + +#define COPY_DEFAULT_FONTS(target, source) \ + TRACE(("COPY_DEFAULT_FONTS " #source " to " #target "\n")); \ + xtermCopyVTFontNames(&target.default_font, &source.default_font) + +#define COPY_X11_FONTLISTS(target, source) \ + TRACE(("COPY_X11_FONTLISTS " #source " to " #target "\n")); \ + xtermCopyFontLists(xw, &target.fonts.x11, &source.fonts.x11) + +static void +xtermCopyVTFontNames(VTFontNames * target, VTFontNames * source) +{ +#define COPY_IT(name,field) \ + TRACE((".. "#name" = %s\n", NonNull(source->field))); \ + free(target->field); \ + target->field = x_strdup(source->field) + + TRACE(("xtermCopyVTFontNames\n")); + + COPY_IT(font, f_n); + COPY_IT(boldFont, f_b); + +#if OPT_WIDE_CHARS + COPY_IT(wideFont, f_w); + COPY_IT(wideBoldFont, f_wb); +#endif +#undef COPY_IT +} + +static void +xtermCopyFontLists(XtermWidget xw, VTFontList * target, VTFontList * source) +{ +#define COPY_IT(name,field) \ + copyFontList(&(target->field), source->field); \ + TRACE_ARGV(".. " #name, source->field) + + (void) xw; + TRACE(("xtermCopyFontLists %s ->%s\n", + whichFontList(xw, source), + whichFontList(xw, target))); + + COPY_IT(font, list_n); + COPY_IT(fontBold, list_b); +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + COPY_IT(fontItal, list_i); + COPY_IT(fontBtal, list_bi); +#endif +#if OPT_WIDE_CHARS + COPY_IT(wideFont, list_w); + COPY_IT(wideBoldFont, list_wb); + COPY_IT(wideItalFont, list_wi); + COPY_IT(wideBtalFont, list_wbi); +#endif +#undef COPY_IT +} + +void +xtermSaveVTFonts(XtermWidget xw) +{ + TScreen *screen = TScreenOf(xw); + Cardinal n, m; + + if (!screen->savedVTFonts) { + + screen->savedVTFonts = True; + TRACE(("xtermSaveVTFonts saving original\n")); + COPY_DEFAULT_FONTS(screen->cacheVTFonts, xw->misc); + COPY_X11_FONTLISTS(screen->cacheVTFonts, xw->work); + COPY_MENU_FONTS(screen->cacheVTFonts, xw->screen); + } +} + +#define SAME_STRING(x,y) ((x) == (y) || ((x) && (y) && !strcmp(x, y))) +#define SAME_MEMBER(n) SAME_STRING(a->n, b->n) + +static Boolean +sameSubResources(SubResourceRec * a, SubResourceRec * b) +{ + Boolean result = True; + + if (!SAME_MEMBER(default_font.f_n) + || !SAME_MEMBER(default_font.f_b) +#if OPT_WIDE_CHARS + || !SAME_MEMBER(default_font.f_w) + || !SAME_MEMBER(default_font.f_wb) +#endif + ) { + TRACE(("sameSubResources: default_font differs\n")); + result = False; + } else { + int n; + + for (n = 0; n < NMENUFONTS; ++n) { + if (!SAME_MEMBER(menu_font_names[n][fNorm])) { + TRACE(("sameSubResources: menu_font_names[%d] differs\n", n)); + result = False; + break; + } + } + } + + return result; +} + +/* + * Load the "VT" font names from the given subresource name/class. These + * correspond to the VT100 resources. + */ +static Bool +xtermLoadVTFonts(XtermWidget xw, String myName, String myClass) +{ + SubResourceRec subresourceRec; + SubResourceRec referenceRec; + + /* + * These are duplicates of the VT100 font resources, but with a special + * application/classname passed in to distinguish them. + */ + static XtResource font_resources[] = + { + Sres(XtNfont, XtCFont, default_font.f_n, DEFFONT), + Sres(XtNboldFont, XtCBoldFont, default_font.f_b, DEFBOLDFONT), +#if OPT_WIDE_CHARS + Sres(XtNwideFont, XtCWideFont, default_font.f_w, DEFWIDEFONT), + Sres(XtNwideBoldFont, XtCWideBoldFont, default_font.f_wb, DEFWIDEBOLDFONT), +#endif + Sres(XtNfont1, XtCFont1, MenuFontName(fontMenu_font1), NULL), + Sres(XtNfont2, XtCFont2, MenuFontName(fontMenu_font2), NULL), + Sres(XtNfont3, XtCFont3, MenuFontName(fontMenu_font3), NULL), + Sres(XtNfont4, XtCFont4, MenuFontName(fontMenu_font4), NULL), + Sres(XtNfont5, XtCFont5, MenuFontName(fontMenu_font5), NULL), + Sres(XtNfont6, XtCFont6, MenuFontName(fontMenu_font6), NULL), + }; + Cardinal n, m; + Bool status = True; + TScreen *screen = TScreenOf(xw); + + TRACE(("called xtermLoadVTFonts(name=%s, class=%s)\n", + NonNull(myName), NonNull(myClass))); + + xtermSaveVTFonts(xw); + + if (IsEmpty(myName)) { + TRACE(("xtermLoadVTFonts restoring original\n")); + COPY_DEFAULT_FONTS(xw->misc, screen->cacheVTFonts); + COPY_X11_FONTLISTS(xw->work, screen->cacheVTFonts); + FREE_MENU_FONTS(xw->screen); + COPY_MENU_FONTS(xw->screen, screen->cacheVTFonts); + } else { + TRACE(("xtermLoadVTFonts(%s, %s)\n", myName, myClass)); + + memset(&referenceRec, 0, sizeof(referenceRec)); + memset(&subresourceRec, 0, sizeof(subresourceRec)); + XtGetSubresources((Widget) xw, (XtPointer) &subresourceRec, + myName, myClass, + font_resources, + (Cardinal) XtNumber(font_resources), + NULL, (Cardinal) 0); + + /* + * XtGetSubresources returns no status, so we compare the returned + * data against a zero'd struct to see if any data is returned. + */ + if (memcmp(&referenceRec, &subresourceRec, sizeof(referenceRec)) + && !sameSubResources(&(screen->cacheVTFonts), &subresourceRec)) { + + screen->mergedVTFonts = True; + + /* + * To make it simple, reallocate the strings returned by + * XtGetSubresources. We can free our own strings, but not theirs. + */ + ALLOC_STRING(subresourceRec.default_font.f_n); + ALLOC_STRING(subresourceRec.default_font.f_b); +#if OPT_WIDE_CHARS + ALLOC_STRING(subresourceRec.default_font.f_w); + ALLOC_STRING(subresourceRec.default_font.f_wb); +#endif + for (n = fontMenu_font1; n <= fontMenu_lastBuiltin; ++n) { + ALLOC_STRING(subresourceRec.MenuFontName(n)); + } + + /* + * Now, save the string to a font-list for consistency + */ +#define ALLOC_SUBLIST(which,field) \ + save2FontList(xw, "cached", \ + &(subresourceRec.fonts), \ + which, \ + subresourceRec.default_font.field, False) + + ALLOC_SUBLIST(fNorm, f_n); + ALLOC_SUBLIST(fBold, f_b); +#if OPT_WIDE_CHARS + ALLOC_SUBLIST(fWide, f_w); + ALLOC_SUBLIST(fWBold, f_wb); +#endif + + /* + * If a particular resource value was not found, use the original. + */ + MERGE_SUBFONT(subresourceRec, xw->misc, default_font.f_n); + INFER_SUBFONT(subresourceRec, xw->misc, default_font.f_b); + MERGE_SUBLIST(subresourceRec, xw->work, list_n); + MERGE_SUBLIST(subresourceRec, xw->work, list_b); +#if OPT_WIDE_CHARS + INFER_SUBFONT(subresourceRec, xw->misc, default_font.f_w); + INFER_SUBFONT(subresourceRec, xw->misc, default_font.f_wb); + MERGE_SUBLIST(subresourceRec, xw->work, list_w); + MERGE_SUBLIST(subresourceRec, xw->work, list_wb); +#endif + for (n = fontMenu_font1; n <= fontMenu_lastBuiltin; ++n) { + MERGE_SUBFONT(subresourceRec, xw->screen, MenuFontName(n)); + } + + /* + * Finally, copy the subresource data to the widget. + */ + COPY_DEFAULT_FONTS(xw->misc, subresourceRec); + COPY_X11_FONTLISTS(xw->work, subresourceRec); + FREE_MENU_FONTS(xw->screen); + COPY_MENU_FONTS(xw->screen, subresourceRec); + + FREE_STRING(screen->MenuFontName(fontMenu_default)); + FREE_STRING(screen->menu_font_names[0][fBold]); + screen->MenuFontName(fontMenu_default) = x_strdup(DefaultFontN(xw)); + screen->menu_font_names[0][fBold] = x_strdup(DefaultFontB(xw)); +#if OPT_WIDE_CHARS + FREE_STRING(screen->menu_font_names[0][fWide]); + FREE_STRING(screen->menu_font_names[0][fWBold]); + screen->menu_font_names[0][fWide] = x_strdup(DefaultFontW(xw)); + screen->menu_font_names[0][fWBold] = x_strdup(DefaultFontWB(xw)); +#endif + /* + * And remove our copies of strings. + */ + FREE_STRING(subresourceRec.default_font.f_n); + FREE_STRING(subresourceRec.default_font.f_b); +#if OPT_WIDE_CHARS + FREE_STRING(subresourceRec.default_font.f_w); + FREE_STRING(subresourceRec.default_font.f_wb); +#endif + for (n = fontMenu_font1; n <= fontMenu_lastBuiltin; ++n) { + FREE_STRING(subresourceRec.MenuFontName(n)); + } + } else { + TRACE(("...no resources found\n")); + status = False; + } + } + TRACE((".. xtermLoadVTFonts: %d\n", status)); + return status; +} + +#if OPT_WIDE_CHARS +static Bool +isWideFont(XFontStruct *fp, const char *tag, Bool nullOk) +{ + Bool result = False; + + (void) tag; + if (okFont(fp)) { + unsigned count = countGlyphs(fp); + TRACE(("isWideFont(%s) found %d cells\n", tag, count)); + result = (count > 256) ? True : False; + } else { + result = nullOk; + } + return result; +} + +/* + * If the current fonts are not wide, load the UTF8 fonts. + * + * Called during initialization (for wide-character mode), the fonts have not + * been setup, so we pass nullOk=True to isWideFont(). + * + * Called after initialization, e.g., in response to the UTF-8 menu entry + * (starting from narrow character mode), it checks if the fonts are not wide. + */ +Bool +xtermLoadWideFonts(XtermWidget xw, Bool nullOk) +{ + TScreen *screen = TScreenOf(xw); + Bool result; + + if (EmptyFont(GetNormalFont(screen, fWide)->fs)) { + result = (isWideFont(GetNormalFont(screen, fNorm)->fs, "normal", nullOk) + && isWideFont(GetNormalFont(screen, fBold)->fs, "bold", nullOk)); + } else { + result = (isWideFont(GetNormalFont(screen, fWide)->fs, "wide", nullOk) + && isWideFont(GetNormalFont(screen, fWBold)->fs, + "wide-bold", nullOk)); + if (result && !screen->utf8_latin1) { + result = (isWideFont(GetNormalFont(screen, fNorm)->fs, "normal", nullOk) + && isWideFont(GetNormalFont(screen, fBold)->fs, + "bold", nullOk)); + } + } + if (!result) { + TRACE(("current fonts are not all wide%s\n", nullOk ? " nullOk" : "")); + result = xtermLoadVTFonts(xw, XtNutf8Fonts, XtCUtf8Fonts); + } + TRACE(("xtermLoadWideFonts:%d\n", result)); + return result; +} +#endif /* OPT_WIDE_CHARS */ + +/* + * Restore the default fonts, i.e., if we had switched to wide-fonts. + */ +Bool +xtermLoadDefaultFonts(XtermWidget xw) +{ + Bool result; + result = xtermLoadVTFonts(xw, NULL, NULL); + TRACE(("xtermLoadDefaultFonts:%d\n", result)); + return result; +} +#endif /* OPT_LOAD_VTFONTS || OPT_WIDE_CHARS */ + +#if OPT_LOAD_VTFONTS +void +HandleLoadVTFonts(Widget w, + XEvent *event GCC_UNUSED, + String *params, + Cardinal *param_count) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + static char empty[] = ""; /* appease strict compilers */ + + TScreen *screen = TScreenOf(xw); + char name_buf[80]; + String name = (String) ((*param_count > 0) ? params[0] : empty); + char *myName = MyStackAlloc(strlen(name) + 1, name_buf); + + TRACE(("HandleLoadVTFonts(%d)\n", *param_count)); + if (myName != 0) { + char class_buf[80]; + String convert = (String) ((*param_count > 1) ? params[1] : myName); + char *myClass = MyStackAlloc(strlen(convert) + 1, class_buf); + + strcpy(myName, name); + if (myClass != 0) { + strcpy(myClass, convert); + if (*param_count == 1) + myClass[0] = x_toupper(myClass[0]); + + if (xtermLoadVTFonts(xw, myName, myClass)) { + int n; + /* + * When switching fonts, try to preserve the font-menu + * selection, since it is less surprising to do that (if + * the font-switching can be undone) than to switch to + * "Default". + */ + int font_number = screen->menu_font_number; + if (font_number > fontMenu_lastBuiltin) + font_number = fontMenu_lastBuiltin; + for (n = 0; n < NMENUFONTS; ++n) { + screen->menu_font_sizes[n] = 0; + } + if (font_number == fontMenu_default) { + SetVTFont(xw, font_number, True, defaultVTFontNames(xw)); + } else { + SetVTFont(xw, font_number, True, NULL); + } + } + MyStackFree(myClass, class_buf); + } + MyStackFree(myName, name_buf); + } + } +} +#endif /* OPT_LOAD_VTFONTS */ + +/* + * Set the limits for the box that outlines the cursor. + */ +void +xtermSetCursorBox(TScreen *screen) +{ + static XPoint VTbox[NBOX]; + XPoint *vp; + int fw = FontWidth(screen) - 1; + int fh = FontHeight(screen) - 1; + int ww = isCursorBar(screen) ? 1 : fw; + int hh = isCursorUnderline(screen) ? 1 : fh; + + vp = &VTbox[1]; + (vp++)->x = (short) ww; + (vp++)->y = (short) hh; + (vp++)->x = (short) -ww; + vp->y = (short) -hh; + + screen->box = VTbox; +} + +#if OPT_RENDERFONT + +#define CACHE_XFT(dst,src) if (src.font != 0) {\ + int err = checkXftWidth(xw, &(dst[fontnum]), &src);\ + TRACE(("Xft metrics %s[%d] = %d (%d,%d)%s advance %d, actual %d%s%s\n",\ + #dst,\ + fontnum,\ + src.font->height,\ + src.font->ascent,\ + src.font->descent,\ + ((src.font->ascent + src.font->descent) > src.font->height ? "*" : ""),\ + src.font->max_advance_width,\ + dst[fontnum].map.min_width,\ + dst[fontnum].map.mixed ? " mixed" : "",\ + err ? " ERROR" : ""));\ + if (err) {\ + xtermCloseXft(screen, &src);\ + memset((&dst[fontnum]), 0, sizeof(dst[fontnum]));\ + failed += err;\ + }\ + } + +#if OPT_REPORT_FONTS +static FcChar32 +xtermXftFirstChar(XftFont *xft) +{ + FcChar32 map[FC_CHARSET_MAP_SIZE]; + FcChar32 next; + FcChar32 first; + int i; + + first = FcCharSetFirstPage(xft->charset, map, &next); + for (i = 0; i < FC_CHARSET_MAP_SIZE; i++) { + if (map[i]) { + FcChar32 bits = map[i]; + first += (FcChar32) i *32; + while (!(bits & 0x1)) { + bits >>= 1; + first++; + } + break; + } + } + return first; +} + +static FcChar32 +xtermXftLastChar(XftFont *xft) +{ + FcChar32 this, last, next; + FcChar32 map[FC_CHARSET_MAP_SIZE]; + int i; + last = FcCharSetFirstPage(xft->charset, map, &next); + while ((this = FcCharSetNextPage(xft->charset, map, &next)) != FC_CHARSET_DONE) + last = this; + last &= (FcChar32) ~ 0xff; + for (i = FC_CHARSET_MAP_SIZE - 1; i >= 0; i--) { + if (map[i]) { + FcChar32 bits = map[i]; + last += (FcChar32) i *32 + 31; + while (!(bits & 0x80000000)) { + last--; + bits <<= 1; + } + break; + } + } + return (FcChar32) last; +} +#endif /* OPT_REPORT_FONTS */ + +#if OPT_TRACE + +#if !OPT_WIDE_CHARS +static Char * +convertToUTF8(Char *buffer, int c) +{ + buffer[0] = (Char) c; + buffer[1] = 0; + return buffer; +} +#endif + +static void +dumpXft(XtermWidget xw, XTermXftFonts *data) +{ + XftFont *xft = data->font; + TScreen *screen = TScreenOf(xw); + VTwin *win = WhichVWin(screen); + + FcChar32 c; + FcChar32 first = xtermXftFirstChar(xft); + FcChar32 last = xtermXftLastChar(xft); + FcChar32 dump; + unsigned count = 0; + unsigned too_high = 0; + unsigned too_wide = 0; + Boolean skip = False; + + TRACE(("dumpXft {{\n")); + TRACE(("\tdata range U+%04X..U+%04X\n", first, last)); + TRACE(("\tcode\tcells\tdimensions\n")); +#if OPT_TRACE < 2 + dump = 255; +#else + dump = last; +#endif + for (c = first; c <= last; ++c) { + if (FcCharSetHasChar(xft->charset, c)) { + int width = CharWidth(c); + XGlyphInfo extents; + Boolean big_x; + Boolean big_y; + + XftTextExtents32(XtDisplay(xw), xft, &c, 1, &extents); + big_x = (extents.width > win->f_width); + big_y = (extents.height > win->f_height); + + if (c <= dump) { + Char buffer[80]; + + *convertToUTF8(buffer, c) = '\0'; + TRACE(("%s%s\tU+%04X\t%d\t%.1f x %.1f\t%s\n", + (big_y ? "y" : ""), + (big_x ? "x" : ""), + c, width, + ((double) extents.height) / win->f_height, + ((double) extents.width) / win->f_width, + buffer)); + } else if (!skip) { + skip = True; + TRACE(("\t...skipping\n")); + } + if (big_y) + ++too_high; + if (big_x) + ++too_wide; + ++count; + } + } + TRACE(("}} %u total, %u too-high, %u too-wide\n", count, too_high, too_wide)); +} +#define DUMP_XFT(xw, data) dumpXft(xw, data) +#else +#define DUMP_XFT(xw, data) /* nothing */ +#endif + +/* + * Check if this is a FC_COLOR font, which fontconfig misrepresents to "fix" a + * problem with web browsers. As of 2018/12 (4 years later), Xft does not work + * with that. Even with this workaround, fontconfig has at least one bug which + * causes it to crash (Debian #917034). + */ +#ifdef FC_COLOR +#define GetFcBool(pattern, what) \ + (FcPatternGetBool(pattern, what, 0, &fcbogus) == FcResultMatch) + +static Boolean +isBogusXft(XftFont *font) +{ + Boolean result = False; + if (font != 0) { + FcBool fcbogus; + if (GetFcBool(font->pattern, FC_COLOR) && fcbogus) { + TRACE(("...matched color-bitmap font\n")); + result = True; + } else if (GetFcBool(font->pattern, FC_OUTLINE) && !fcbogus) { + TRACE(("...matched non-outline font\n")); + /* This is legal for regular bitmap fonts - fontconfig attempts to + * find a match - but problematic for misencoded color-bitmap fonts. + */ + } + } + return result; +} +#endif + +#if OPT_BOX_CHARS +static void +setBrokenBoxChars(XtermWidget xw, Bool state) +{ + TRACE(("setBrokenBoxChars %s\n", BtoS(state))); + term->work.broken_box_chars = (Boolean) state; + TScreenOf(xw)->broken_box_chars = (Boolean) state; + update_font_boxchars(); +} + +#else +#define setBrokenBoxChars(xw, state) /* nothing */ +#endif + +static Boolean +checkedXftWidth(Display *dpy, + XTermXftFonts *source, + unsigned limit, + Dimension *width, + FcChar32 c) +{ + Boolean result = False; + + if (FcCharSetHasChar(source->font->charset, c)) { + XGlyphInfo extents; + + result = True; + XftTextExtents32(dpy, source->font, &c, 1, &extents); + if (*width < extents.width && extents.width <= limit) { + *width = extents.width; + } + } + return result; +} + +static int +checkXftWidth(XtermWidget xw, XTermXftFonts *target, XTermXftFonts *source) +{ + FcChar32 c; + FcChar32 last = xtermXftLastChar(source->font); + Dimension limit = (Dimension) source->font->max_advance_width; + Dimension width = 0; + Dimension width2 = 0; + int failed = 0; +#if OPT_WIDE_CHARS + Cardinal n; +#endif + + target->font = source->font; + target->pattern = source->pattern; + target->map.min_width = 0; + target->map.max_width = limit; + +#if OPT_WIDE_CHARS + /* + * Check if the line-drawing characters are all provided in the font. + * If so, take that into account for the cell-widths. + */ + for (n = 0; n < XtNumber(unicode_boxes) - 1; ++n) { + if (!checkedXftWidth(XtDisplay(xw), + source, + limit, + &width2, unicode_boxes[n].code)) { + width2 = 0; + TRACE(("font omits U+%04X line-drawing symbol\n", + unicode_boxes[n].code)); + break; + } + } +#else + (void) width2; +#endif + + if (width2 > 0) { + Dimension check = (Dimension) (limit + 1) / 2; + TRACE(("font provides VT100-style line-drawing\n")); + /* + * The "VT100 line-drawing" characters happen to be all "ambiguous + * width" in Unicode's scheme. That means that they could be twice as + * wide as the Latin-1 characters. + */ +#define FC_ERR(n) (1.2 * (n)) + if (width2 > FC_ERR(check)) { + TRACE(("line-drawing characters appear to be double-width (ignore)\n")); + setBrokenBoxChars(xw, True); + } else if (width2 > width) { + width = width2; + } + } else { + TRACE(("font does NOT provide VT100-style line-drawing\n")); + setBrokenBoxChars(xw, True); + } + + /* + * For each printable code, ask what its width is. Given the maximum width + * for those, we have a reasonable estimate of the single-column width. + * + * Ignore control characters - their extent information is misleading. + */ + for (c = 32; c < 256; ++c) { + if (CharWidth(c) <= 0) + continue; + if (FcCharSetHasChar(source->font->charset, c)) { + (void) checkedXftWidth(XtDisplay(xw), + source, + target->map.max_width, + &width, c); + } + } + + /* + * Sometimes someone uses a symbol font which has no useful ASCII or + * Latin-1 characters. Allow that, in case they did it intentionally. + */ + if (width == 0) { + failed = 1; + if (last >= 256) { + width = target->map.max_width; + } + } + target->map.min_width = width; + target->map.mixed = (target->map.max_width >= (target->map.min_width + 1)); + return failed; +} + +#if OPT_REPORT_FONTS +static void +reportXftFonts(XtermWidget xw, + XftFont *fp, + const char *name, + const char *tag, + XftPattern *match) +{ + if (resource.reportFonts) { + char buffer[1024]; + FcChar32 first_char = xtermXftFirstChar(fp); + FcChar32 last_char = xtermXftLastChar(fp); + FcChar32 ch; + unsigned missing = 0; + + printf("Loaded XftFonts(%s[%s])\n", name, tag); + + for (ch = first_char; ch <= last_char; ++ch) { + if (xtermXftMissing(xw, fp, ch)) { + ++missing; + } + } + printf("\t\tfirst char: %u\n", first_char); + printf("\t\tlast char: %u\n", last_char); + printf("\t\tmissing-chars: %u\n", missing); + printf("\t\tpresent-chars: %u\n", (last_char - first_char) + 1 - missing); + + if (XftNameUnparse(match, buffer, (int) sizeof(buffer))) { + char *target; + char *source = buffer; + while ((target = strtok(source, ":")) != 0) { + printf("\t%s\n", target); + source = 0; + } + } + fflush(stdout); + } +} +#else +#define reportXftFonts(xw, result, name, tag, match) /* empty */ +#endif /* OPT_REPORT_FONTS */ + +/* + * Xft discards the pattern-match during open-pattern if the result happens to + * match a currently-open file, but provides no clue to the caller when it does + * this. That is, closing a font-file may leave the data in Xft's cache, while + * opening a file may free the data used for the match. + * + * Because of this problem, we cannot reliably refer to the pattern-match data + * if it may have been seen before. + */ +Boolean +maybeXftCache(XtermWidget xw, XftFont *font) +{ + Boolean result = False; + if (font != 0) { + TScreen *screen = TScreenOf(xw); + ListXftFonts *p; + for (p = screen->list_xft_fonts; p != 0; p = p->next) { + if (p->font == font) { + result = True; + break; + } + } + if (!result) { + p = TypeXtMalloc(ListXftFonts); + if (p != 0) { + p->font = font; + p->next = screen->list_xft_fonts; + screen->list_xft_fonts = p; + } + } + } + return result; +} + +/* + * Drop an entry from the cache, and close the font. + */ +void +closeCachedXft(TScreen *screen, XftFont *font) +{ + if (font != 0) { + ListXftFonts *p, *q; + + for (p = screen->list_xft_fonts, q = 0; p != 0; q = p, p = p->next) { + if (p->font == font) { + XftFontClose(screen->display, font); + if (q != 0) { + q->next = p->next; + } else { + screen->list_xft_fonts = p->next; + } + free(p); + break; + } + } + } +} + +static XftFont * +xtermOpenXft(XtermWidget xw, const char *name, XftPattern *pat, const char *tag) +{ + TScreen *screen = TScreenOf(xw); + Display *dpy = screen->display; + XftResult status; + XftFont *result = 0; + + TRACE(("xtermOpenXft(name=%s, tag=%s)\n", name, tag)); + if (pat != 0) { + XftPattern *match; + + FcConfigSubstitute(NULL, pat, FcMatchPattern); + XftDefaultSubstitute(dpy, DefaultScreen(dpy), pat); + + match = FcFontMatch(NULL, pat, &status); + if (match != 0) { + Boolean maybeReopened = False; + result = XftFontOpenPattern(dpy, match); +#ifdef FC_COLOR + if (result != 0) { + if (isBogusXft(result)) { + XftFontClose(dpy, result); + result = 0; + maybeReopened = True; + } + } +#endif + if (result != 0) { + TRACE(("...matched %s font\n", tag)); + if (!maybeXftCache(xw, result)) { + reportXftFonts(xw, result, name, tag, match); + } + } else { + TRACE(("...could not open %s font\n", tag)); + if (!maybeReopened) + XftPatternDestroy(match); + if (xw->misc.fontWarnings >= fwAlways) { + cannotFont(xw, "open", tag, name); + } + } + } else { + TRACE(("...did not match %s font\n", tag)); + if (xw->misc.fontWarnings >= fwResource) { + cannotFont(xw, "match", tag, name); + } + } + } + return result; +} + +#if OPT_SHIFT_FONTS +/* + * Don't make a dependency on the math library for a single function. + * (Newton Raphson). + */ +static double +dimSquareRoot(double value) +{ + double result = 0.0; + if (value > 0.0) { + int n; + double older = value; + for (n = 0; n < 10; ++n) { + double delta = (older * older - value) / (2.0 * older); + double newer = older - delta; + older = newer; + result = newer; + if (delta > -0.001 && delta < 0.001) + break; + } + } + return result; +} +#endif + +#ifdef DEBUG_XFT +static void +trace_xft_glyph(TScreen *screen, XftFont *font, FT_Face face, int code, const char *name) +{ + if (!XftGlyphExists(screen->display, font, code)) { + TRACE(("Xft glyph U+%04X missing :%s\n", code, name)); + } else if (FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) { + FT_GlyphSlot g = face->glyph; + TRACE(("Xft glyph U+%04X size(%3d,%3d) at(%3d,%3d) :%s\n", + code, + g->bitmap.rows, g->bitmap.width, + g->bitmap_top, g->bitmap_left, + name)); + } +} + +#if OPT_WIDE_CHARS +static void +trace_xft_line_drawing(TScreen *screen, XftFont *font, FT_Face face) +{ + int n; + for (n = 0; unicode_boxes[n].code != 0; ++n) { + trace_xft_glyph(screen, font, face, unicode_boxes[n].code, + unicode_boxes[n].name); + } +} +#else +#define trace_xft_line_drawing(screen, font, face) /* nothing */ +#endif +#endif /* DEBUG_XFT */ + +/* + * Check if the line-drawing characters do not fill the bounding box. If so, + * they're not useful. + */ +#if OPT_BOX_CHARS +static void +linedrawing_gaps(XtermWidget xw, XftFont *font) +{ + Boolean broken; + +#if OPT_WIDE_CHARS + TScreen *screen = TScreenOf(xw); + int n; + FT_Face face; + face = XftLockFace(font); + broken = False; + for (n = 0; unicode_boxes[n].code; ++n) { + unsigned code = unicode_boxes[n].code; + + if (!XftGlyphExists(screen->display, font, code)) { + TRACE(("Xft glyph U+%04X is missing\n", code)); + broken = True; + break; + } + + if (FT_Load_Char(face, code, FT_LOAD_RENDER) == 0) { + FT_GlyphSlot g = face->glyph; + TRACE(("Xft glyph U+%04X size(%3d,%3d) at(%3d,%3d) :%s\n", + code, + g->bitmap.rows, g->bitmap.width, + g->bitmap_top, g->bitmap_left, + unicode_boxes[n].name)); + /* + * While it is possible for badly-designed fonts to have line + * drawing characters which do not meet, FreeType aggravates the + * situation with its rounding. Check for an obvious case where + * the weights at the ends of a vertical line do not add up. That + * shows up as two under-weight rows at the beginning/end of the + * bitmap. + */ + if (code == 0x2502) { + unsigned r, c; + unsigned mids = 0, ends = 0; + unsigned char *data = g->bitmap.buffer; + + switch (g->bitmap.pixel_mode) { + case FT_PIXEL_MODE_MONO: + /* FALLTHRU */ + case FT_PIXEL_MODE_GRAY: + for (r = 0; r < (unsigned) g->bitmap.rows; ++r) { + unsigned k = r * (unsigned) g->bitmap.pitch; + unsigned sum = 0; + for (c = 0; c < (unsigned) g->bitmap.width; ++c) { + unsigned xx = 0; + switch (g->bitmap.pixel_mode) { + case FT_PIXEL_MODE_MONO: + xx = (data[k + (c / 8)] >> (c % 8)) & 1; + break; + case FT_PIXEL_MODE_GRAY: + xx = data[k + c]; + break; + } + sum += xx; + TRACE2((" %2x", xx)); + } + TRACE2((" = %u\n", sum)); + if (r > 0 && (r + 1) < (unsigned) g->bitmap.rows) { + mids = sum; + } else { + ends += sum; + } + } + TRACE(("...compare middle %u vs ends %u\n", mids, ends)); + if ((mids > ends) && (g->bitmap.rows < 16)) + broken = True; + break; + default: + TRACE(("FIXME pixel_mode %d not handled\n", + g->bitmap.pixel_mode)); + break; + } + if (broken) + break; + } + /* + * The factor of two accounts for line-drawing that goes through + * the middle of a cell, possibly leaving half of the cell unused. + * A horizontal line has to extend the full width of the cell. + */ + switch (unicode_boxes[n].high) { + case 1: + if ((unsigned) g->bitmap.rows < (unsigned) FontHeight(screen)) { + TRACE(("...bitmap is shorter than full-cell (%u vs %u)\n", + (unsigned) g->bitmap.rows, + (unsigned) FontHeight(screen))); + broken = True; + } + break; + case 2: + if ((unsigned) (g->bitmap.rows * 2) < (unsigned) FontHeight(screen)) { + TRACE(("...bitmap is too short for half-cell (%u vs %u)\n", + (unsigned) (g->bitmap.rows * 2), + (unsigned) FontHeight(screen))); + broken = True; + } + break; + } + switch (unicode_boxes[n].wide) { + case 1: + if ((unsigned) g->bitmap.width < (unsigned) FontWidth(screen)) { + TRACE(("...bitmap is narrower than full-cell (%u vs %u)\n", + (unsigned) g->bitmap.width, + (unsigned) FontWidth(screen))); + broken = True; + } + break; + case 2: + if ((unsigned) (g->bitmap.width * 2) < (unsigned) FontWidth(screen)) { + TRACE(("...bitmap is too narrow for half-cell (%u vs %u)\n", + (unsigned) (g->bitmap.width * 2), + (unsigned) FontWidth(screen))); + broken = True; + } + break; + } + if (broken) + break; + } + } + XftUnlockFace(font); +#else + (void) font; + broken = True; +#endif + + if (broken) { + TRACE(("Xft line-drawing would not work\n")); + setBrokenBoxChars(xw, True); + } +} +#endif /* OPT_BOX_CHARS */ + +/* + * Given the Xft font metrics, determine the actual font size. This is used + * for each font to ensure that normal, bold and italic fonts follow the same + * rule. + */ +static void +setRenderFontsize(XtermWidget xw, VTwin *win, XftFont *font, const char *tag) +{ + if (font != 0) { + TScreen *screen = TScreenOf(xw); + int width, height, ascent, descent; +#ifdef DEBUG_XFT + int n; + FT_Face face; + FT_Size size; + FT_Size_Metrics metrics; + Boolean scalable; + Boolean is_fixed; + Boolean debug_xft = False; + + face = XftLockFace(font); + size = face->size; + metrics = size->metrics; + is_fixed = FT_IS_FIXED_WIDTH(face); + scalable = FT_IS_SCALABLE(face); + trace_xft_line_drawing(screen, font, face); + for (n = 32; n < 127; ++n) { + char name[80]; + sprintf(name, "letter \"%c\"", n); + trace_xft_glyph(screen, font, face, n, name); + } + XftUnlockFace(font); + + /* freetype's inconsistent for this sign */ + metrics.descender = -metrics.descender; + +#define TR_XFT "Xft metrics: " +#define D_64(name) ((double)(metrics.name)/64.0) +#define M_64(a,b) ((font->a * 64) != metrics.b) +#define BOTH(a,b) D_64(b), M_64(a,b) ? "*" : "" + + debug_xft = (M_64(ascent, ascender) + || M_64(descent, descender) + || M_64(height, height) + || M_64(max_advance_width, max_advance)); + + TRACE(("Xft font is %sscalable, %sfixed-width\n", + is_fixed ? "" : "not ", + scalable ? "" : "not ")); + + if (debug_xft) { + TRACE(("Xft font size %d+%d vs %d by %d\n", + font->ascent, + font->descent, + font->height, + font->max_advance_width)); + TRACE((TR_XFT "ascender %6.2f%s\n", BOTH(ascent, ascender))); + TRACE((TR_XFT "descender %6.2f%s\n", BOTH(descent, descender))); + TRACE((TR_XFT "height %6.2f%s\n", BOTH(height, height))); + TRACE((TR_XFT "max_advance %6.2f%s\n", BOTH(max_advance_width, max_advance))); + } else { + TRACE((TR_XFT "matches font\n")); + } +#endif + + width = font->max_advance_width; + height = font->height; + ascent = font->ascent; + descent = font->descent; + if (screen->force_xft_height && height < ascent + descent) { + TRACE(("...height is less than ascent + descent (%u vs %u)\n", + height, ascent + descent)); + if ((ascent + descent) > (height + 1)) { + /* this happens less than 10% of the time */ + --ascent; + --descent; + TRACE(("...decrement both ascent and descent before retry\n")); + } else if (ascent > descent) { + /* this is the usual case */ + --ascent; + TRACE(("...decrement ascent before retry\n")); + } else { + /* this could happen, though rare... */ + --descent; + TRACE(("...decrement descent before retry\n")); + } + height = ascent + descent; + font->ascent = ascent; + font->descent = descent; + TRACE(("...updated height %d vs %d (ascent %d, descent %d)\n", + height, ascent + descent, ascent, descent)); + } + if (is_double_width_font_xft(screen->display, font)) { + TRACE(("...reduce width from %d to %d\n", width, width >> 1)); + width >>= 1; + } + if (tag == 0) { + SetFontWidth(screen, win, width); + SetFontHeight(screen, win, height); + win->f_ascent = ascent; + win->f_descent = descent; + TRACE(("setRenderFontsize result %dx%d (%d+%d)\n", + width, height, ascent, descent)); + } else if (win->f_width < width || + win->f_height < height || + win->f_ascent < ascent || + win->f_descent < descent) { + TRACE(("setRenderFontsize %s changed %dx%d (%d+%d) to %dx%d (%d+%d)\n", + tag, + win->f_width, win->f_height, win->f_ascent, win->f_descent, + width, height, ascent, descent)); + + SetFontWidth(screen, win, width); + SetFontHeight(screen, win, height); + win->f_ascent = ascent; + win->f_descent = descent; + } else { + TRACE(("setRenderFontsize %s unchanged\n", tag)); + } +#if OPT_BOX_CHARS + if (!screen->broken_box_chars && (tag == 0)) { + linedrawing_gaps(xw, font); + } +#endif + } +} +#endif + +static void +checkFontInfo(int value, const char *tag, int failed) +{ + if (value == 0 || failed) { + if (value == 0) { + xtermWarning("Selected font has no non-zero %s for ISO-8859-1 encoding\n", tag); + exit(1); + } else { + xtermWarning("Selected font has no valid %s for ISO-8859-1 encoding\n", tag); + } + } +} + +#if OPT_RENDERFONT +void +xtermCloseXft(TScreen *screen, XTermXftFonts *pub) +{ + if (pub->font != 0) { + Cardinal n; + + closeCachedXft(screen, pub->font); + pub->font = 0; + + if (pub->pattern) { + XftPatternDestroy(pub->pattern); + pub->pattern = 0; + } + if (pub->fontset) { + XftFontSetDestroy(pub->fontset); + pub->fontset = 0; + } + + for (n = 0; n < pub->limit; ++n) { + if (pub->cache[n].font) { + closeCachedXft(screen, pub->cache[n].font); + } + } + } +} + +/* + * Get the faceName/faceNameDoublesize resource setting. + */ +String +getFaceName(XtermWidget xw, Bool wideName) +{ +#if OPT_RENDERWIDE + String result = (wideName + ? FirstItemOf(xw->work.fonts.xft.list_w) + : CurrentXftFont(xw)); +#else + String result = CurrentXftFont(xw); + (void) wideName; +#endif + return x_nonempty(result); +} + +/* + * If we change the faceName, we'll have to re-acquire all of the fonts that + * are derived from it. + */ +void +setFaceName(XtermWidget xw, const char *value) +{ + TScreen *screen = TScreenOf(xw); + Boolean changed = (Boolean) ((CurrentXftFont(xw) == 0) + || strcmp(CurrentXftFont(xw), value)); + + if (changed) { + int n; + + CurrentXftFont(xw) = x_strdup(value); + for (n = 0; n < NMENUFONTS; ++n) { + int e; + xw->misc.face_size[n] = -1.0; + for (e = 0; e < fMAX; ++e) { + xtermCloseXft(screen, getMyXftFont(xw, e, n)); + } + } + } +} +#endif + +/* + * Compute useful values for the font/window sizes + */ +void +xtermComputeFontInfo(XtermWidget xw, + VTwin *win, + XFontStruct *font, + int sbwidth) +{ + TScreen *screen = TScreenOf(xw); + + int i, j, width, height; +#if OPT_RENDERFONT + int fontnum = screen->menu_font_number; +#endif + int failed = 0; + +#if OPT_RENDERFONT + /* + * xterm contains a lot of references to fonts, assuming they are fixed + * size. This chunk of code overrides the actual font-selection (see + * drawXtermText()), if the user has selected render-font. All of the + * font-loading for fixed-fonts still goes on whether or not this chunk + * overrides it. + */ + if (UsingRenderFont(xw) && fontnum >= 0) { + String face_name = getFaceName(xw, False); + XTermXftFonts norm = screen->renderFontNorm[fontnum]; + XTermXftFonts bold = screen->renderFontBold[fontnum]; + XTermXftFonts ital = screen->renderFontItal[fontnum]; + XTermXftFonts btal = screen->renderFontBtal[fontnum]; +#if OPT_RENDERWIDE + XTermXftFonts wnorm = screen->renderWideNorm[fontnum]; + XTermXftFonts wbold = screen->renderWideBold[fontnum]; + XTermXftFonts wital = screen->renderWideItal[fontnum]; + XTermXftFonts wbtal = screen->renderWideBtal[fontnum]; +#endif + + if (norm.font == 0 && !IsEmpty(face_name)) { + XftPattern *pat; + double face_size; + + TRACE(("xtermComputeFontInfo font %d: norm(face %s, size %.1f)\n", + fontnum, face_name, + xw->misc.face_size[fontnum])); + + TRACE(("Using Xft %d\n", XftVersion)); + TRACE(("Using FontConfig %d\n", FC_VERSION)); + + fillInFaceSize(xw, fontnum); + face_size = (double) xw->misc.face_size[fontnum]; + + /* + * By observation (there is no documentation), XftPatternBuild is + * cumulative. Build the bold- and italic-patterns on top of the + * normal pattern. + */ +#ifdef FC_COLOR +#define NormXftPattern \ + XFT_FAMILY, XftTypeString, "mono", \ + FC_COLOR, XftTypeBool, FcFalse, \ + FC_OUTLINE, XftTypeBool, FcTrue, \ + XFT_SIZE, XftTypeDouble, face_size +#else +#define NormXftPattern \ + XFT_FAMILY, XftTypeString, "mono", \ + XFT_SIZE, XftTypeDouble, face_size +#endif + +#define BoldXftPattern(norm) \ + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, \ + XFT_CHAR_WIDTH, XftTypeInteger, norm.font->max_advance_width + +#define ItalXftPattern(norm) \ + XFT_SLANT, XftTypeInteger, XFT_SLANT_ITALIC, \ + XFT_CHAR_WIDTH, XftTypeInteger, norm.font->max_advance_width + +#define BtalXftPattern(norm) \ + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, \ + XFT_SLANT, XftTypeInteger, XFT_SLANT_ITALIC, \ + XFT_CHAR_WIDTH, XftTypeInteger, norm.font->max_advance_width + +#if OPT_WIDE_ATTRS +#define HAVE_ITALICS 1 +#define FIND_ITALICS ((pat = XftNameParse(face_name)) != 0) +#elif OPT_ISO_COLORS +#define HAVE_ITALICS 1 +#define FIND_ITALICS (screen->italicULMode && (pat = XftNameParse(face_name)) != 0) +#else +#define HAVE_ITALICS 0 +#endif + +#if OPT_DEC_CHRSET + freeall_DoubleFT(xw); +#endif + if ((pat = XftNameParse(face_name)) != 0) { +#define OPEN_XFT(name, tag) name.font = xtermOpenXft(xw, face_name, name.pattern, tag) + norm.pattern = XftPatternDuplicate(pat); + XftPatternBuild(norm.pattern, + NormXftPattern, + (void *) 0); + OPEN_XFT(norm, "normal"); + + if (norm.font != 0) { + bold.pattern = XftPatternDuplicate(pat); + XftPatternBuild(bold.pattern, + NormXftPattern, + BoldXftPattern(norm), + (void *) 0); + OPEN_XFT(bold, "bold"); + +#if HAVE_ITALICS + if (FIND_ITALICS) { + ital.pattern = XftPatternDuplicate(pat); + XftPatternBuild(ital.pattern, + NormXftPattern, + ItalXftPattern(norm), + (void *) 0); + OPEN_XFT(ital, "italic"); + btal.pattern = XftPatternDuplicate(pat); + XftPatternBuild(btal.pattern, + NormXftPattern, + BtalXftPattern(norm), + (void *) 0); + OPEN_XFT(btal, "bold-italic"); + } +#endif + + /* + * FIXME: just assume that the corresponding font has no + * graphics characters. + */ + if (screen->fnt_boxes) { + screen->fnt_boxes = 0; + TRACE(("Xft opened - will %suse internal line-drawing characters\n", + screen->fnt_boxes ? "not " : "")); + } + } + + CACHE_XFT(screen->renderFontNorm, norm); + + CACHE_XFT(screen->renderFontBold, bold); + if (norm.font != 0 && !bold.font) { + noUsableXft(xw, "bold"); + XftPatternDestroy(bold.pattern); + bold.pattern = XftPatternDuplicate(pat); + XftPatternBuild(bold.pattern, + NormXftPattern, + (void *) 0); + OPEN_XFT(bold, "bold"); + failed = 0; + CACHE_XFT(screen->renderFontBold, bold); + } +#if HAVE_ITALICS + CACHE_XFT(screen->renderFontItal, ital); + if (norm.font != 0 && !ital.font) { + noUsableXft(xw, "italic"); + XftPatternDestroy(ital.pattern); + ital.pattern = XftPatternDuplicate(pat); + XftPatternBuild(ital.pattern, + NormXftPattern, + (void *) 0); + OPEN_XFT(ital, "italics"); + failed = 0; + CACHE_XFT(screen->renderFontItal, ital); + } + CACHE_XFT(screen->renderFontBtal, btal); + if (norm.font != 0 && !btal.font) { + noUsableXft(xw, "bold italic"); + XftPatternDestroy(btal.pattern); + btal.pattern = XftPatternDuplicate(pat); + XftPatternBuild(btal.pattern, + NormXftPattern, + (void *) 0); + OPEN_XFT(btal, "bold-italics"); + failed = 0; + CACHE_XFT(screen->renderFontBtal, btal); + } +#endif + XftPatternDestroy(pat); + } else { + failed = 1; + } +#undef OPEN_XFT + + /* + * See xtermXftDrawString(). A separate double-width font is nice + * to have, but not essential. + */ +#if OPT_RENDERWIDE + if (norm.font != 0 && screen->wide_chars) { + int char_width = norm.font->max_advance_width * 2; + double aspect = ((FirstItemOf(xw->work.fonts.xft.list_w) + || screen->renderFontNorm[fontnum].map.mixed) + ? 1.0 + : 2.0); + + face_name = getFaceName(xw, True); + TRACE(("xtermComputeFontInfo wide(face %s, char_width %d)\n", + NonNull(face_name), + char_width)); + +#define WideXftPattern \ + XFT_FAMILY, XftTypeString, "mono", \ + XFT_SIZE, XftTypeDouble, face_size, \ + XFT_SPACING, XftTypeInteger, XFT_MONO, \ + XFT_CHAR_WIDTH, XftTypeInteger, char_width, \ + FC_ASPECT, XftTypeDouble, aspect + + if (!IsEmpty(face_name) && (pat = XftNameParse(face_name)) + != 0) { +#define OPEN_XFT(name, tag) name.font = xtermOpenXft(xw, face_name, name.pattern, tag) + wnorm.pattern = XftPatternDuplicate(pat); + XftPatternBuild(wnorm.pattern, + WideXftPattern, + (void *) 0); + OPEN_XFT(wnorm, "wide"); + + if (wnorm.font != 0) { + wbold.pattern = XftPatternDuplicate(pat); + XftPatternBuild(wbold.pattern, + WideXftPattern, + BoldXftPattern(wnorm), + (void *) 0); + OPEN_XFT(wbold, "wide-bold"); + +#if HAVE_ITALICS + if (FIND_ITALICS) { + wital.pattern = XftPatternDuplicate(pat); + XftPatternBuild(wital.pattern, + WideXftPattern, + ItalXftPattern(wnorm), + (void *) 0); + OPEN_XFT(wital, "wide-italic"); + } + CACHE_XFT(screen->renderWideBtal, wbtal); + if (!wbtal.font) { + noUsableXft(xw, "wide bold"); + XftPatternDestroy(wbtal.pattern); + wbtal.pattern = XftPatternDuplicate(pat); + XftPatternBuild(wbtal.pattern, + WideXftPattern, + (void *) 0); + OPEN_XFT(wbtal, "wide-bold-italics"); + failed = 0; + CACHE_XFT(screen->renderWideBtal, wbtal); + } +#endif + } + + CACHE_XFT(screen->renderWideNorm, wnorm); + + CACHE_XFT(screen->renderWideBold, wbold); + if (wnorm.font != 0 && !wbold.font) { + noUsableXft(xw, "wide-bold"); + XftPatternDestroy(wbold.pattern); + wbold.pattern = XftPatternDuplicate(pat); + XftPatternBuild(bold.pattern, + WideXftPattern, + (void *) 0); + OPEN_XFT(wbold, "wide-bold"); + failed = 0; + CACHE_XFT(screen->renderWideBold, bold); + } + + CACHE_XFT(screen->renderWideItal, wital); + if (wnorm.font != 0 && !wital.font) { + noUsableXft(xw, "wide-italic"); + XftPatternDestroy(wital.pattern); + wital.pattern = XftPatternDuplicate(pat); + XftPatternBuild(wital.pattern, + WideXftPattern, + (void *) 0); + OPEN_XFT(wital, "wide-italic"); + failed = 0; + CACHE_XFT(screen->renderWideItal, wital); + } + + XftPatternDestroy(pat); + } +#undef OPEN_XFT + } +#endif /* OPT_RENDERWIDE */ + } + if (norm.font == 0) { + TRACE(("...no TrueType font found for number %d, disable menu entry\n", fontnum)); + xw->work.render_font = False; + update_font_renderfont(); + /* now we will fall through into the bitmap fonts */ + } else { + setBrokenBoxChars(xw, False); + setRenderFontsize(xw, win, norm.font, NULL); + setRenderFontsize(xw, win, bold.font, "bold"); + setRenderFontsize(xw, win, ital.font, "ital"); + setRenderFontsize(xw, win, btal.font, "btal"); +#if OPT_BOX_CHARS + setupPackedFonts(xw); + + if (screen->force_packed) { + XTermXftFonts *use = &(screen->renderFontNorm[fontnum]); + SetFontHeight(screen, win, use->font->ascent + use->font->descent); + SetFontWidth(screen, win, use->map.min_width); + TRACE(("...packed TrueType font %dx%d vs %d\n", + win->f_height, + win->f_width, + use->map.max_width)); + } +#endif + DUMP_XFT(xw, &(screen->renderFontNorm[fontnum])); + } + } + /* + * Are we handling a bitmap font? + */ + else +#endif /* OPT_RENDERFONT */ + { + if (is_double_width_font(font) && !(screen->fnt_prop)) { + SetFontWidth(screen, win, font->min_bounds.width); + } else { + SetFontWidth(screen, win, font->max_bounds.width); + } + SetFontHeight(screen, win, font->ascent + font->descent); + win->f_ascent = font->ascent; + win->f_descent = font->descent; + } + i = 2 * screen->border + sbwidth; + j = 2 * screen->border; + width = MaxCols(screen) * win->f_width + i; + height = MaxRows(screen) * win->f_height + j; + win->fullwidth = (Dimension) width; + win->fullheight = (Dimension) height; + win->width = width - i; + win->height = height - j; + + TRACE(("xtermComputeFontInfo window %dx%d (full %dx%d), fontsize %dx%d (asc %d, dsc %d)\n", + win->height, + win->width, + win->fullheight, + win->fullwidth, + win->f_height, + win->f_width, + win->f_ascent, + win->f_descent)); + + checkFontInfo(win->f_height, "height", failed); + checkFontInfo(win->f_width, "width", failed); +} + +/* save this information as a side-effect for double-sized characters */ +static void +xtermSaveFontInfo(TScreen *screen, XFontStruct *font) +{ + screen->fnt_wide = (Dimension) (font->max_bounds.width); + screen->fnt_high = (Dimension) (font->ascent + font->descent); + TRACE(("xtermSaveFontInfo %dx%d\n", screen->fnt_high, screen->fnt_wide)); +} + +/* + * After loading a new font, update the structures that use its size. + */ +void +xtermUpdateFontInfo(XtermWidget xw, Bool doresize) +{ + TScreen *screen = TScreenOf(xw); + + int scrollbar_width; + VTwin *win = &(screen->fullVwin); + +#if USE_DOUBLE_BUFFER + discardRenderDraw(TScreenOf(xw)); +#endif /* USE_DOUBLE_BUFFER */ + + scrollbar_width = (xw->misc.scrollbar + ? (screen->scrollWidget->core.width + + BorderWidth(screen->scrollWidget)) + : 0); + xtermComputeFontInfo(xw, win, GetNormalFont(screen, fNorm)->fs, scrollbar_width); + xtermSaveFontInfo(screen, GetNormalFont(screen, fNorm)->fs); + + if (doresize) { + if (VWindow(screen)) { + xtermClear(xw); + } + TRACE(("xtermUpdateFontInfo {{\n")); + DoResizeScreen(xw); /* set to the new natural size */ + ResizeScrollBar(xw); + Redraw(); + TRACE(("... }} xtermUpdateFontInfo\n")); +#ifdef SCROLLBAR_RIGHT + updateRightScrollbar(xw); +#endif + } + xtermSetCursorBox(screen); +} + +#if OPT_BOX_CHARS || OPT_REPORT_FONTS + +/* + * Returns true if the given character is missing from the specified font. + */ +Bool +xtermMissingChar(unsigned ch, XTermFonts * font) +{ + Bool result = False; + XFontStruct *fs = font->fs; + XCharStruct *pc = 0; + + if (fs == NULL) { + result = True; + } else if (fs->max_byte1 == 0) { +#if OPT_WIDE_CHARS + if (ch < 256) +#endif + { + CI_GET_CHAR_INFO_1D(fs, E2A(ch), pc); + } + } +#if OPT_WIDE_CHARS + else { + unsigned row = (ch >> 8); + unsigned col = (ch & 0xff); + CI_GET_CHAR_INFO_2D(fs, row, col, pc); + } +#endif + + if (pc == 0 || CI_NONEXISTCHAR(pc)) { + TRACE2(("xtermMissingChar %#04x (!exists), %d cells\n", + ch, CharWidth(ch))); + result = True; + } + if (ch < KNOWN_MISSING) { + font->known_missing[ch] = (Char) (result ? 2 : 1); + } + return result; +} +#endif + +#if OPT_BOX_CHARS +/* + * The grid is arbitrary, enough resolution that nothing's lost in + * initialization. + */ +#define BOX_HIGH 60 +#define BOX_WIDE 60 + +#define MID_HIGH (BOX_HIGH/2) +#define MID_WIDE (BOX_WIDE/2) + +#define CHR_WIDE ((9*BOX_WIDE)/10) +#define CHR_HIGH ((9*BOX_HIGH)/10) + +/* + * ...since we'll scale the values anyway. + */ +#define Scale_XY(n,d,f) ((int)(n) * ((int)(f))) / (d) +#define SCALED_X(n) Scale_XY(n, BOX_WIDE, font_width) +#define SCALED_Y(n) Scale_XY(n, BOX_HIGH, font_height) +#define SCALE_X(n) n = SCALED_X(n) +#define SCALE_Y(n) n = SCALED_Y(n) + +#define SEG(x0,y0,x1,y1) x0,y0, x1,y1 + +/* + * Draw the given graphic character, if it is simple enough (i.e., a + * line-drawing character). + */ +void +xtermDrawBoxChar(XTermDraw * params, + unsigned ch, + GC gc, + int x, + int y, + int cells) +{ + TScreen *screen = TScreenOf(params->xw); + /* *INDENT-OFF* */ + static const short glyph_ht[] = { + SEG(1*BOX_WIDE/10, 0, 1*BOX_WIDE/10,5*MID_HIGH/6), /* H */ + SEG(6*BOX_WIDE/10, 0, 6*BOX_WIDE/10,5*MID_HIGH/6), + SEG(1*BOX_WIDE/10,5*MID_HIGH/12,6*BOX_WIDE/10,5*MID_HIGH/12), + SEG(2*BOX_WIDE/10, MID_HIGH, CHR_WIDE, MID_HIGH), /* T */ + SEG(6*BOX_WIDE/10, MID_HIGH, 6*BOX_WIDE/10, CHR_HIGH), + -1 + }, glyph_ff[] = { + SEG(1*BOX_WIDE/10, 0, 6*BOX_WIDE/10, 0), /* F */ + SEG(1*BOX_WIDE/10,5*MID_HIGH/12,6*CHR_WIDE/12,5*MID_HIGH/12), + SEG(1*BOX_WIDE/10, 0, 0*BOX_WIDE/3, 5*MID_HIGH/6), + SEG(1*BOX_WIDE/3, MID_HIGH, CHR_WIDE, MID_HIGH), /* F */ + SEG(1*BOX_WIDE/3, 8*MID_HIGH/6,10*CHR_WIDE/12,8*MID_HIGH/6), + SEG(1*BOX_WIDE/3, MID_HIGH, 1*BOX_WIDE/3, CHR_HIGH), + -1 + }, glyph_lf[] = { + SEG(1*BOX_WIDE/10, 0, 1*BOX_WIDE/10,9*MID_HIGH/12), /* L */ + SEG(1*BOX_WIDE/10,9*MID_HIGH/12,6*BOX_WIDE/10,9*MID_HIGH/12), + SEG(1*BOX_WIDE/3, MID_HIGH, CHR_WIDE, MID_HIGH), /* F */ + SEG(1*BOX_WIDE/3, 8*MID_HIGH/6,10*CHR_WIDE/12,8*MID_HIGH/6), + SEG(1*BOX_WIDE/3, MID_HIGH, 1*BOX_WIDE/3, CHR_HIGH), + -1 + }, glyph_nl[] = { + SEG(1*BOX_WIDE/10,5*MID_HIGH/6, 1*BOX_WIDE/10, 0), /* N */ + SEG(1*BOX_WIDE/10, 0, 5*BOX_WIDE/6, 5*MID_HIGH/6), + SEG(5*BOX_WIDE/6, 5*MID_HIGH/6, 5*BOX_WIDE/6, 0), + SEG(1*BOX_WIDE/3, MID_HIGH, 1*BOX_WIDE/3, CHR_HIGH), /* L */ + SEG(1*BOX_WIDE/3, CHR_HIGH, CHR_WIDE, CHR_HIGH), + -1 + }, glyph_vt[] = { + SEG(1*BOX_WIDE/10, 0, 5*BOX_WIDE/12,5*MID_HIGH/6), /* V */ + SEG(5*BOX_WIDE/12,5*MID_HIGH/6, 5*BOX_WIDE/6, 0), + SEG(2*BOX_WIDE/10, MID_HIGH, CHR_WIDE, MID_HIGH), /* T */ + SEG(6*BOX_WIDE/10, MID_HIGH, 6*BOX_WIDE/10, CHR_HIGH), + -1 + }, plus_or_minus[] = + { + SEG( 0, 5*BOX_HIGH/6, CHR_WIDE, 5*BOX_HIGH/6), + SEG( MID_WIDE, 2*BOX_HIGH/6, MID_WIDE, 4*BOX_HIGH/6), + SEG( 0, 3*BOX_HIGH/6, CHR_WIDE, 3*BOX_HIGH/6), + -1 + }, lower_right_corner[] = + { + SEG( 0, MID_HIGH, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, 0), + -1 + }, upper_right_corner[] = + { + SEG( 0, MID_HIGH, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), + -1 + }, upper_left_corner[] = + { + SEG( MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), + -1 + }, lower_left_corner[] = + { + SEG( MID_WIDE, 0, MID_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_WIDE, BOX_WIDE, MID_HIGH), + -1 + }, cross[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + -1 + }, scan_line_1[] = + { + SEG( 0, 0, BOX_WIDE, 0), + -1 + }, scan_line_3[] = + { + SEG( 0, BOX_HIGH/4, BOX_WIDE, BOX_HIGH/4), + -1 + }, scan_line_7[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + -1 + }, scan_line_9[] = + { + SEG( 0, 3*BOX_HIGH/4, BOX_WIDE, 3*BOX_HIGH/4), + -1 + }, horizontal_line[] = + { + SEG( 0, BOX_HIGH, BOX_WIDE, BOX_HIGH), + -1 + }, left_tee[] = + { + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + SEG( MID_WIDE, MID_HIGH, BOX_WIDE, MID_HIGH), + -1 + }, right_tee[] = + { + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + SEG( MID_WIDE, MID_HIGH, 0, MID_HIGH), + -1 + }, bottom_tee[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, 0, MID_WIDE, MID_HIGH), + -1 + }, top_tee[] = + { + SEG( 0, MID_HIGH, BOX_WIDE, MID_HIGH), + SEG( MID_WIDE, MID_HIGH, MID_WIDE, BOX_HIGH), + -1 + }, vertical_line[] = + { + SEG( MID_WIDE, 0, MID_WIDE, BOX_HIGH), + -1 + }, less_than_or_equal[] = + { + SEG( CHR_WIDE, BOX_HIGH/3, 0, MID_HIGH), + SEG( CHR_WIDE, 2*BOX_HIGH/3, 0, MID_HIGH), + SEG( 0, 3*BOX_HIGH/4, CHR_WIDE, 3*BOX_HIGH/4), + -1 + }, greater_than_or_equal[] = + { + SEG( 0, BOX_HIGH/3, CHR_WIDE, MID_HIGH), + SEG( 0, 2*BOX_HIGH/3, CHR_WIDE, MID_HIGH), + SEG( 0, 3*BOX_HIGH/4, CHR_WIDE, 3*BOX_HIGH/4), + -1 + }, greek_pi[] = + { + SEG( 0, MID_HIGH, CHR_WIDE, MID_HIGH), + SEG(5*CHR_WIDE/6, MID_HIGH, 5*CHR_WIDE/6, CHR_HIGH), + SEG(2*CHR_WIDE/6, MID_HIGH, 2*CHR_WIDE/6, CHR_HIGH), + -1 + }, not_equal_to[] = + { + SEG(2*BOX_WIDE/3, 1*BOX_HIGH/3, 1*BOX_WIDE/3, CHR_HIGH), + SEG( 0, 2*BOX_HIGH/3, CHR_WIDE, 2*BOX_HIGH/3), + SEG( 0, MID_HIGH, CHR_WIDE, MID_HIGH), + -1 + }; + /* *INDENT-ON* */ + + static const short *lines[] = + { + 0, /* 00 (unused) */ + 0, /* 01 diamond */ + 0, /* 02 box */ + glyph_ht, /* 03 HT */ + glyph_ff, /* 04 FF */ + 0, /* 05 CR */ + glyph_lf, /* 06 LF */ + 0, /* 07 degrees (small circle) */ + plus_or_minus, /* 08 */ + glyph_nl, /* 09 */ + glyph_vt, /* 0A */ + lower_right_corner, /* 0B */ + upper_right_corner, /* 0C */ + upper_left_corner, /* 0D */ + lower_left_corner, /* 0E */ + cross, /* 0F */ + scan_line_1, /* 10 */ + scan_line_3, /* 11 */ + scan_line_7, /* 12 */ + scan_line_9, /* 13 */ + horizontal_line, /* 14 */ + left_tee, /* 15 */ + right_tee, /* 16 */ + bottom_tee, /* 17 */ + top_tee, /* 18 */ + vertical_line, /* 19 */ + less_than_or_equal, /* 1A */ + greater_than_or_equal, /* 1B */ + greek_pi, /* 1C */ + not_equal_to, /* 1D */ + 0, /* 1E LB */ + 0, /* 1F bullet */ + }; + + GC gc2; + CgsEnum cgsId = (ch == 2) ? gcDots : gcLine; + VTwin *cgsWin = WhichVWin(screen); + const short *p; + unsigned font_width = (((params->draw_flags & DOUBLEWFONT) ? 2U : 1U) + * screen->fnt_wide); + unsigned font_height = (((params->draw_flags & DOUBLEHFONT) ? 2U : 1U) + * screen->fnt_high); + + if (cells > 1) + font_width *= (unsigned) cells; + +#if OPT_WIDE_CHARS + /* + * Try to show line-drawing characters if we happen to be in UTF-8 + * mode, but have gotten an old-style font. + */ + if (screen->utf8_mode +#if OPT_RENDERFONT + && !UsingRenderFont(params->xw) +#endif + && (ch > 127) + && (ch != UCS_REPL)) { + int which = (params->attr_flags & BOLD) ? fBold : fNorm; + unsigned n; + for (n = 1; n < 32; n++) { + if (xtermMissingChar(n, getNormalFont(screen, which))) + continue; + if (dec2ucs(screen, n) != ch) + continue; + TRACE(("...use xterm-style linedrawing U+%04X ->%d\n", ch, n)); + ch = n; + break; + } + } +#endif + +#if OPT_VT52_MODE + if (!(screen->vtXX_level)) { + switch (ch) { + case 6: + ch = 7; + break; + default: + ch = 256; + break; + } + } +#endif + + TRACE(("DRAW_BOX(%d) cell %dx%d at %d,%d%s\n", + ch, font_height, font_width, y, x, + (ch >= (sizeof(lines) / sizeof(lines[0])) + ? "-BAD" + : ""))); + + if (cgsId == gcDots) { + setCgsFont(params->xw, cgsWin, cgsId, getCgsFont(params->xw, cgsWin, gc)); + setCgsFore(params->xw, cgsWin, cgsId, getCgsFore(params->xw, cgsWin, gc)); + setCgsBack(params->xw, cgsWin, cgsId, getCgsBack(params->xw, cgsWin, gc)); + } else { + setCgsFont(params->xw, cgsWin, cgsId, getCgsFont(params->xw, cgsWin, gc)); + setCgsFore(params->xw, cgsWin, cgsId, getCgsBack(params->xw, cgsWin, gc)); + setCgsBack(params->xw, cgsWin, cgsId, getCgsBack(params->xw, cgsWin, gc)); + } + gc2 = getCgsGC(params->xw, cgsWin, cgsId); + + if (!(params->draw_flags & NOBACKGROUND)) { + XFillRectangle(screen->display, VDrawable(screen), gc2, x, y, + font_width, + font_height); + } + + setCgsFont(params->xw, cgsWin, cgsId, getCgsFont(params->xw, cgsWin, gc)); + setCgsFore(params->xw, cgsWin, cgsId, getCgsFore(params->xw, cgsWin, gc)); + setCgsBack(params->xw, cgsWin, cgsId, getCgsBack(params->xw, cgsWin, gc)); + gc2 = getCgsGC(params->xw, cgsWin, cgsId); + + XSetLineAttributes(screen->display, gc2, + (params->attr_flags & BOLD) + ? ((font_height > 12) + ? font_height / 12 + : 1) + : ((font_height > 16) + ? font_height / 16 + : 1), + LineSolid, + CapProjecting, + JoinMiter); + + if (ch == 1) { /* diamond */ + XPoint points[5]; + int npoints = 5, n; + + points[0].x = MID_WIDE; + points[0].y = BOX_HIGH / 4; + + points[1].x = 8 * BOX_WIDE / 8; + points[1].y = MID_HIGH; + + points[2].x = points[0].x; + points[2].y = 3 * BOX_HIGH / 4; + + points[3].x = 0 * BOX_WIDE / 8; + points[3].y = points[1].y; + + points[4].x = points[0].x; + points[4].y = points[0].y; + + for (n = 0; n < npoints; ++n) { + points[n].x = (short) SCALED_X(points[n].x); + points[n].y = (short) SCALED_Y(points[n].y); + points[n].x = (short) (points[n].x + x); + points[n].y = (short) (points[n].y + y); + } + + XFillPolygon(screen->display, + VDrawable(screen), gc2, + points, npoints, + Convex, CoordModeOrigin); + } else if (ch == 7) { /* degrees */ + unsigned width = (BOX_WIDE / 3); + int x_coord = MID_WIDE - (int) (width / 2); + int y_coord = MID_HIGH - (int) width; + + SCALE_X(x_coord); + SCALE_Y(y_coord); + width = (unsigned) SCALED_X(width); + + XDrawArc(screen->display, + VDrawable(screen), gc2, + x + x_coord, y + y_coord, width, width, + 0, + 360 * 64); + } else if (ch == 0x1f) { /* bullet */ + unsigned width = 7 * BOX_WIDE / 10; + int x_coord = MID_WIDE - (int) (width / 3); + int y_coord = MID_HIGH - (int) (width / 3); + + SCALE_X(x_coord); + SCALE_Y(y_coord); + width = (unsigned) SCALED_X(width); + + XDrawArc(screen->display, + VDrawable(screen), gc2, + x + x_coord, y + y_coord, width, width, + 0, + 360 * 64); + } else if (ch < (sizeof(lines) / sizeof(lines[0])) + && (p = lines[ch]) != 0) { + int coord[4]; + int n = 0; + while (*p >= 0) { + coord[n++] = *p++; + if (n == 4) { + SCALE_X(coord[0]); + SCALE_Y(coord[1]); + SCALE_X(coord[2]); + SCALE_Y(coord[3]); + XDrawLine(screen->display, + VDrawable(screen), gc2, + x + coord[0], y + coord[1], + x + coord[2], y + coord[3]); + n = 0; + } + } + } else if (screen->force_all_chars) { + /* bounding rectangle, for debugging */ + XDrawRectangle(screen->display, VDrawable(screen), gc2, x, y, + font_width - 1, + font_height - 1); + } +} +#endif /* OPT_BOX_CHARS */ + +#if OPT_RENDERFONT +/* + * Check if the glyph is defined in the given font, and (try to) filter out + * cases where double-width glyphs are stuffed into a single-width outline. + */ +static Boolean +foundXftGlyph(XtermWidget xw, XftFont *font, unsigned wc) +{ + TScreen *screen = TScreenOf(xw); + Boolean result = False; + + if (font != 0 && XftGlyphExists(screen->display, font, wc)) { + int expect; + + if ((expect = CharWidth(wc)) > 0) { + XGlyphInfo gi; + int actual; + + XftTextExtents32(screen->display, font, &wc, 1, &gi); + /* + * Some (more than a few) fonts are sloppy; allow 10% outside + * the bounding box to accommodate them. + */ + actual = ((gi.xOff * 10) >= (11 * FontWidth(screen))) ? 2 : 1; + if (actual <= expect) { + /* allow double-cell if wcwidth agrees */ + result = True; + } else { + TRACE(("SKIP U+%04X %d vs %d (%d vs %d)\n", + wc, gi.xOff, FontWidth(screen), actual, expect)); + } + } else { + result = True; + } + } + return result; +} + +static void +markXftOpened(XtermWidget xw, XTermXftFonts *which, Cardinal n, unsigned wc) +{ + if (which->cache[n].usage != xcOpened) { + which->opened++; + which->cache[n].usage = xcOpened; + /* XFT_DEBUG=3 will show useful context for this */ + if (getenv("XFT_DEBUG") != 0) { + printf("xterm: matched U+%04X in fontset #%d [%u:%u]\n", + wc, n + 1, + which->opened, + xw->work.max_fontsets); + } + } +} + +/* + * Check if the given character has a glyph known to Xft. If it is missing, + * try first to replace the font with a fallback that provides the glyph. + */ +XftFont * +findXftGlyph(XtermWidget xw, XftFont *given, unsigned wc) +{ + TScreen *screen = TScreenOf(xw); + XTermXftFonts *which = 0; + XftFont *result = 0; + /* workaround for interface changes... */ + int fontnum = screen->menu_font_number; + static int table[] = + { + offsetof(TScreen, renderFontNorm), + offsetof(TScreen, renderFontBold), + offsetof(TScreen, renderFontItal), + offsetof(TScreen, renderFontBtal), +#if OPT_RENDERWIDE + offsetof(TScreen, renderWideNorm), + offsetof(TScreen, renderWideBold), + offsetof(TScreen, renderWideItal), + offsetof(TScreen, renderWideBtal), +#endif + }; + Cardinal n; + FcResult status; + const char *tag = 0; + + /* if fontsets are not wanted, just leave */ + if (xw->work.max_fontsets == 0) { + return 0; + } + + /* ignore codes in private use areas */ + if ((wc >= 0xe000 && wc <= 0xf8ff) + || (wc >= 0xf0000 && wc <= 0xffffd) + || (wc >= 0x100000 && wc <= 0x10fffd)) { + return 0; + } + /* the end of the BMP is reserved for non-characters */ + if (wc >= 0xfff0 && wc <= 0xffff) { + return 0; + } + + for (n = 0; n < XtNumber(table); ++n) { + XTermXftFonts *check = (XTermXftFonts *) ((void *) ((char *) screen + + table[n])); + if (check[fontnum].font == given) { + which = &check[fontnum]; + tag = whichFontEnum(n); + break; + } + } + if (which != 0) { + if (which->fontset == 0) { + FcFontSet *sortedFonts; + FcPattern *myPattern; + int j; + + myPattern = FcPatternDuplicate(which->pattern); + + FcPatternAddBool(myPattern, FC_SCALABLE, FcTrue); + FcPatternAddInteger(myPattern, FC_CHAR_WIDTH, given->max_advance_width); + + FcConfigSubstitute(FcConfigGetCurrent(), + myPattern, + FcMatchPattern); + FcDefaultSubstitute(myPattern); + + which->fontset = FcFontSetCreate(); + + sortedFonts = FcFontSort(0, myPattern, FcTrue, 0, &status); + + if (!sortedFonts || sortedFonts->nfont <= 0) { + xtermWarning("did not find any usable TrueType font\n"); + return 0; + } + which->limit = (unsigned) sortedFonts->nfont; + which->cache = TypeCallocN(XTermXftCache, (which->limit + 1)); + for (j = 0; j < sortedFonts->nfont; j++) { + FcPattern *font_pattern; + + font_pattern = FcFontRenderPrepare(FcConfigGetCurrent(), + myPattern, + sortedFonts->fonts[j]); + if (font_pattern) + FcFontSetAdd(which->fontset, font_pattern); + } + + FcFontSetSortDestroy(sortedFonts); + FcPatternDestroy(myPattern); + } + if (which->fontset != 0) { + XftFont *check; + Cardinal empty = which->limit; + + for (n = 0; n < which->limit; ++n) { + XftCache usage = which->cache[n].usage; + if (usage == xcEmpty) { + if (empty > n) + empty = n; + } else if (usage == xcOpened + || (usage == xcUnused + && (which->opened < xw->work.max_fontsets))) { + check = which->cache[n].font; + if (foundXftGlyph(xw, check, wc)) { + markXftOpened(xw, which, n, wc); + result = check; + TRACE_FALLBACK(xw, "old", wc, (int) n, result); + break; + } + } + } + + if ((result == 0) + && (empty < which->limit) + && (which->opened < xw->work.max_fontsets)) { + FcPattern *myPattern = 0; + FcPattern *myReport = 0; + + for (n = empty; n < which->limit; ++n) { + if (which->cache[n].usage >= xcBogus) + continue; + if (resource.reportFonts) { + myReport = FcPatternDuplicate(which->fontset->fonts[n]); + } + myPattern = FcPatternDuplicate(which->fontset->fonts[n]); + check = XftFontOpenPattern(screen->display, myPattern); + closeCachedXft(screen, which->cache[n].font); + (void) maybeXftCache(xw, check); + which->cache[n].font = check; + which->cache[n].usage = xcBogus; + if (check == 0) + continue; /* shouldn't happen... */ +#ifdef FC_COLOR + if (isBogusXft(check)) { + continue; + } +#endif + if (foundXftGlyph(xw, check, wc)) { + markXftOpened(xw, which, n, wc); + reportXftFonts(xw, check, "fallback", tag, myReport); + result = check; + TRACE_FALLBACK(xw, "new", wc, (int) n, result); + break; + } + /* + * The slot is opened, but we are not using it. + */ + which->cache[n].usage = xcUnused; + } + } + } + } + return result; +} + +/* + * Check if the given character has a glyph known to Xft. If it is missing, + * return true. + * + * see xc/lib/Xft/xftglyphs.c + */ +Bool +xtermXftMissing(XtermWidget xw, XftFont *font, unsigned wc) +{ + Bool result = False; + + if (font != 0) { + TScreen *screen = TScreenOf(xw); + if (!XftGlyphExists(screen->display, font, wc)) { +#if OPT_WIDE_CHARS + TRACE2(("xtermXftMissing %d (dec=%#x, ucs=%#x)\n", + wc, ucs2dec(screen, wc), dec2ucs(screen, wc))); +#else + TRACE2(("xtermXftMissing %d\n", wc)); +#endif + result = True; + } + } + return result; +} +#endif /* OPT_RENDERFONT */ + +#if OPT_WIDE_CHARS +#define MY_UCS(ucs,dec) case ucs: result = dec; break +unsigned +ucs2dec(TScreen *screen, unsigned ch) +{ + unsigned result = ch; + + (void) screen; + if ((ch > 127) + && (ch != UCS_REPL)) { +#if OPT_VT52_MODE + if (screen != 0 && !(screen->vtXX_level)) { + /* + * Intentionally empty: it would be possible to use the built-in + * line-drawing fallback in xtermDrawBoxChar(), but for testing + * ncurses, this is good enough. + */ + ; + } else +#endif + switch (ch) { + MY_UCS(0x25ae, 0); /* black vertical rectangle */ + MY_UCS(0x25c6, 1); /* black diamond */ + MY_UCS(0x2592, 2); /* medium shade */ + MY_UCS(0x2409, 3); /* symbol for horizontal tabulation */ + MY_UCS(0x240c, 4); /* symbol for form feed */ + MY_UCS(0x240d, 5); /* symbol for carriage return */ + MY_UCS(0x240a, 6); /* symbol for line feed */ + MY_UCS(0x00b0, 7); /* degree sign */ + MY_UCS(0x00b1, 8); /* plus-minus sign */ + MY_UCS(0x2424, 9); /* symbol for newline */ + MY_UCS(0x240b, 10); /* symbol for vertical tabulation */ + MY_UCS(0x2518, 11); /* box drawings light up and left */ + MY_UCS(0x2510, 12); /* box drawings light down and left */ + MY_UCS(0x250c, 13); /* box drawings light down and right */ + MY_UCS(0x2514, 14); /* box drawings light up and right */ + MY_UCS(0x253c, 15); /* box drawings light vertical and horizontal */ + MY_UCS(0x23ba, 16); /* box drawings scan 1 */ + MY_UCS(0x23bb, 17); /* box drawings scan 3 */ + MY_UCS(0x2500, 18); /* box drawings light horizontal */ + MY_UCS(0x23bc, 19); /* box drawings scan 7 */ + MY_UCS(0x23bd, 20); /* box drawings scan 9 */ + MY_UCS(0x251c, 21); /* box drawings light vertical and right */ + MY_UCS(0x2524, 22); /* box drawings light vertical and left */ + MY_UCS(0x2534, 23); /* box drawings light up and horizontal */ + MY_UCS(0x252c, 24); /* box drawings light down and horizontal */ + MY_UCS(0x2502, 25); /* box drawings light vertical */ + MY_UCS(0x2264, 26); /* less-than or equal to */ + MY_UCS(0x2265, 27); /* greater-than or equal to */ + MY_UCS(0x03c0, 28); /* greek small letter pi */ + MY_UCS(0x2260, 29); /* not equal to */ + MY_UCS(0x00a3, 30); /* pound sign */ + MY_UCS(0x00b7, 31); /* middle dot */ + } + } + return result; +} + +#undef MY_UCS +#define MY_UCS(ucs,dec) case dec: result = ucs; break + +unsigned +dec2ucs(TScreen *screen, unsigned ch) +{ + unsigned result = ch; + + (void) screen; + if (xtermIsDecGraphic(ch)) { +#if OPT_VT52_MODE + if (screen != 0 && !(screen->vtXX_level)) { + switch (ch) { + MY_UCS(0x0020, 0); /* nbsp, treat as blank */ + MY_UCS(0x0020, 1); /* reserved, treat as blank */ + MY_UCS(0x25ae, 2); /* black vertical rectangle */ + MY_UCS(0x215f, 3); /* "1/" */ + MY_UCS(0x0020, 4); /* "3/", not in Unicode, ignore */ + MY_UCS(0x0020, 5); /* "5/", not in Unicode, ignore */ + MY_UCS(0x0020, 6); /* "7/", not in Unicode, ignore */ + MY_UCS(0x00b0, 7); /* degree sign */ + MY_UCS(0x00b1, 8); /* plus-minus sign */ + MY_UCS(0x2192, 9); /* right-arrow */ + MY_UCS(0x2026, 10); /* ellipsis */ + MY_UCS(0x00f7, 11); /* divide by */ + MY_UCS(0x2193, 12); /* down arrow */ + MY_UCS(0x23ba, 13); /* bar at scan 0 */ + MY_UCS(0x23ba, 14); /* bar at scan 1 */ + MY_UCS(0x23bb, 15); /* bar at scan 2 */ + MY_UCS(0x23bb, 16); /* bar at scan 3 */ + MY_UCS(0x23bc, 17); /* bar at scan 4 */ + MY_UCS(0x23bc, 18); /* bar at scan 5 */ + MY_UCS(0x23bd, 19); /* bar at scan 6 */ + MY_UCS(0x23bd, 20); /* bar at scan 7 */ + MY_UCS(0x2080, 21); /* subscript 0 */ + MY_UCS(0x2081, 22); /* subscript 1 */ + MY_UCS(0x2082, 23); /* subscript 2 */ + MY_UCS(0x2083, 24); /* subscript 3 */ + MY_UCS(0x2084, 25); /* subscript 4 */ + MY_UCS(0x2085, 26); /* subscript 5 */ + MY_UCS(0x2086, 27); /* subscript 6 */ + MY_UCS(0x2087, 28); /* subscript 7 */ + MY_UCS(0x2088, 29); /* subscript 8 */ + MY_UCS(0x2089, 30); /* subscript 9 */ + MY_UCS(0x00b6, 31); /* paragraph */ + } + } else +#endif + switch (ch) { + MY_UCS(0x25ae, 0); /* black vertical rectangle */ + MY_UCS(0x25c6, 1); /* black diamond */ + MY_UCS(0x2592, 2); /* medium shade */ + MY_UCS(0x2409, 3); /* symbol for horizontal tabulation */ + MY_UCS(0x240c, 4); /* symbol for form feed */ + MY_UCS(0x240d, 5); /* symbol for carriage return */ + MY_UCS(0x240a, 6); /* symbol for line feed */ + MY_UCS(0x00b0, 7); /* degree sign */ + MY_UCS(0x00b1, 8); /* plus-minus sign */ + MY_UCS(0x2424, 9); /* symbol for newline */ + MY_UCS(0x240b, 10); /* symbol for vertical tabulation */ + MY_UCS(0x2518, 11); /* box drawings light up and left */ + MY_UCS(0x2510, 12); /* box drawings light down and left */ + MY_UCS(0x250c, 13); /* box drawings light down and right */ + MY_UCS(0x2514, 14); /* box drawings light up and right */ + MY_UCS(0x253c, 15); /* box drawings light vertical and horizontal */ + MY_UCS(0x23ba, 16); /* box drawings scan 1 */ + MY_UCS(0x23bb, 17); /* box drawings scan 3 */ + MY_UCS(0x2500, 18); /* box drawings light horizontal */ + MY_UCS(0x23bc, 19); /* box drawings scan 7 */ + MY_UCS(0x23bd, 20); /* box drawings scan 9 */ + MY_UCS(0x251c, 21); /* box drawings light vertical and right */ + MY_UCS(0x2524, 22); /* box drawings light vertical and left */ + MY_UCS(0x2534, 23); /* box drawings light up and horizontal */ + MY_UCS(0x252c, 24); /* box drawings light down and horizontal */ + MY_UCS(0x2502, 25); /* box drawings light vertical */ + MY_UCS(0x2264, 26); /* less-than or equal to */ + MY_UCS(0x2265, 27); /* greater-than or equal to */ + MY_UCS(0x03c0, 28); /* greek small letter pi */ + MY_UCS(0x2260, 29); /* not equal to */ + MY_UCS(0x00a3, 30); /* pound sign */ + MY_UCS(0x00b7, 31); /* middle dot */ + } + } + return result; +} + +#endif /* OPT_WIDE_CHARS */ + +#if OPT_RENDERFONT || OPT_SHIFT_FONTS +static int +lookupOneFontSize(XtermWidget xw, int fontnum) +{ + TScreen *screen = TScreenOf(xw); + + if (screen->menu_font_sizes[fontnum] == 0) { + XTermFonts fnt; + + memset(&fnt, 0, sizeof(fnt)); + screen->menu_font_sizes[fontnum] = -1; + if (xtermOpenFont(xw, screen->MenuFontName(fontnum), &fnt, True)) { + if (fontnum <= fontMenu_lastBuiltin + || strcmp(fnt.fn, DEFFONT)) { + screen->menu_font_sizes[fontnum] = FontSize(fnt.fs); + if (screen->menu_font_sizes[fontnum] <= 0) + screen->menu_font_sizes[fontnum] = -1; + } + xtermCloseFont(xw, &fnt); + } + } + return (screen->menu_font_sizes[fontnum] > 0); +} + +/* + * Cache the font-sizes so subsequent larger/smaller font actions will go fast. + */ +static void +lookupFontSizes(XtermWidget xw) +{ + int n; + + for (n = 0; n < NMENUFONTS; n++) { + (void) lookupOneFontSize(xw, n); + } +} +#endif /* OPT_RENDERFONT || OPT_SHIFT_FONTS */ + +#if OPT_RENDERFONT +static double +defaultFaceSize(void) +{ + double result; + float value; + + if (sscanf(DEFFACESIZE, "%f", &value) == 1) + result = (double) value; + else + result = 14.0; + return result; +} + +static void +fillInFaceSize(XtermWidget xw, int fontnum) +{ + TScreen *screen = TScreenOf(xw); + double face_size = (double) xw->misc.face_size[fontnum]; + + if (face_size <= 0.0) { +#if OPT_SHIFT_FONTS + /* + * If the user is switching font-sizes, make it follow by + * default the same ratios to the default as the fixed fonts + * would, for easy comparison. There will be some differences + * since the fixed fonts have a variety of height/width ratios, + * but this is simpler than adding another resource value - and + * as noted above, the data for the fixed fonts are available. + */ + (void) lookupOneFontSize(xw, 0); + if (fontnum == fontMenu_default) { + face_size = defaultFaceSize(); + } else if (lookupOneFontSize(xw, fontnum) + && (screen->menu_font_sizes[0] + != screen->menu_font_sizes[fontnum])) { + double ratio; + long num = screen->menu_font_sizes[fontnum]; + long den = screen->menu_font_sizes[0]; + + if (den <= 0) + den = 1; + ratio = dimSquareRoot((double) num / (double) den); + + face_size = (ratio * (double) xw->misc.face_size[0]); + TRACE(("scaled[%d] using %3ld/%ld = %.2f -> %f\n", + fontnum, num, den, ratio, face_size)); + } else +#endif + { +#define LikeBitmap(s) (((s) / 78.0) * (double) xw->misc.face_size[fontMenu_default]) + switch (fontnum) { + case fontMenu_font1: + face_size = LikeBitmap(2.0); + break; + case fontMenu_font2: + face_size = LikeBitmap(35.0); + break; + case fontMenu_font3: + face_size = LikeBitmap(60.0); + break; + default: + face_size = defaultFaceSize(); + break; + case fontMenu_font4: + face_size = LikeBitmap(90.0); + break; + case fontMenu_font5: + face_size = LikeBitmap(135.0); + break; + case fontMenu_font6: + face_size = LikeBitmap(200.0); + break; + } + TRACE(("builtin[%d] -> %f\n", fontnum, face_size)); + } + xw->misc.face_size[fontnum] = (float) face_size; + } +} + +/* no selection or escape */ +#define NMENU_RENDERFONTS (fontMenu_lastBuiltin + 1) + +/* + * Workaround for breakage in font-packages - check if all of the bitmap font + * sizes are the same, and if we're using TrueType fonts. + */ +static Boolean +useFaceSizes(XtermWidget xw) +{ + Boolean result = False; + + TRACE(("useFaceSizes {{\n")); + if (UsingRenderFont(xw)) { + Boolean nonzero = True; + int n; + + for (n = 0; n < NMENU_RENDERFONTS; ++n) { + if (xw->misc.face_size[n] <= (float) 0.0) { + nonzero = False; + break; + } + } + if (!nonzero) { + Boolean broken_fonts = True; + TScreen *screen = TScreenOf(xw); + long first; + + lookupFontSizes(xw); + first = screen->menu_font_sizes[0]; + for (n = 0; n < NMENUFONTS; n++) { + if (screen->menu_font_sizes[n] > 0 + && screen->menu_font_sizes[n] != first) { + broken_fonts = False; + break; + } + } + + if (broken_fonts) { + + TRACE(("bitmap fonts are broken - set faceSize resources\n")); + for (n = 0; n < NMENUFONTS; n++) { + fillInFaceSize(xw, n); + } + + } + } + result = True; + } + TRACE(("...}}useFaceSizes %d\n", result)); + return result; +} +#endif /* OPT_RENDERFONT */ + +#if OPT_SHIFT_FONTS +/* + * Find the index of a larger/smaller font (according to the sign of 'relative' + * and its magnitude), starting from the 'old' index. + */ +int +lookupRelativeFontSize(XtermWidget xw, int old, int relative) +{ + TScreen *screen = TScreenOf(xw); + int m = -1; + + TRACE(("lookupRelativeFontSize(old=%d, relative=%d)\n", old, relative)); + if (!IsIcon(screen)) { +#if OPT_RENDERFONT + if (useFaceSizes(xw)) { + TRACE(("...using FaceSize\n")); + if (relative != 0) { + int n; + for (n = 0; n < NMENU_RENDERFONTS; ++n) { + fillInFaceSize(xw, n); + if (xw->misc.face_size[n] > 0 && + xw->misc.face_size[n] != xw->misc.face_size[old]) { + int cmp_0 = ((xw->misc.face_size[n] > + xw->misc.face_size[old]) + ? relative + : -relative); + int cmp_m = ((m < 0) + ? 1 + : ((xw->misc.face_size[n] < + xw->misc.face_size[m]) + ? relative + : -relative)); + if (cmp_0 > 0 && cmp_m > 0) { + m = n; + } + } + } + } + } else +#endif + { + TRACE(("...using bitmap areas\n")); + lookupFontSizes(xw); + if (relative != 0) { + int n; + for (n = 0; n < NMENUFONTS; ++n) { + if (screen->menu_font_sizes[n] > 0 && + screen->menu_font_sizes[n] != + screen->menu_font_sizes[old]) { + int cmp_0 = ((screen->menu_font_sizes[n] > + screen->menu_font_sizes[old]) + ? relative + : -relative); + int cmp_m = ((m < 0) + ? 1 + : ((screen->menu_font_sizes[n] < + screen->menu_font_sizes[m]) + ? relative + : -relative)); + if (cmp_0 > 0 && cmp_m > 0) { + m = n; + } + } + } + } + } + TRACE(("...new index %d\n", m)); + if (m >= 0) { + if (relative > 1) + m = lookupRelativeFontSize(xw, m, relative - 1); + else if (relative < -1) + m = lookupRelativeFontSize(xw, m, relative + 1); + } + } + return m; +} + +/* ARGSUSED */ +void +HandleLargerFont(Widget w, + XEvent *event GCC_UNUSED, + String *params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + XtermWidget xw; + + TRACE(("Handle larger-vt-font for %p\n", (void *) w)); + if ((xw = getXtermWidget(w)) != 0) { + if (xw->misc.shift_fonts) { + TScreen *screen = TScreenOf(xw); + int m; + + m = lookupRelativeFontSize(xw, screen->menu_font_number, 1); + if (m >= 0) { + SetVTFont(xw, m, True, NULL); + } else { + Bell(xw, XkbBI_MinorError, 0); + } + } + } +} + +/* ARGSUSED */ +void +HandleSmallerFont(Widget w, + XEvent *event GCC_UNUSED, + String *params GCC_UNUSED, + Cardinal *param_count GCC_UNUSED) +{ + XtermWidget xw; + + TRACE(("Handle smaller-vt-font for %p\n", (void *) w)); + if ((xw = getXtermWidget(w)) != 0) { + if (xw->misc.shift_fonts) { + TScreen *screen = TScreenOf(xw); + int m; + + m = lookupRelativeFontSize(xw, screen->menu_font_number, -1); + if (m >= 0) { + SetVTFont(xw, m, True, NULL); + } else { + Bell(xw, XkbBI_MinorError, 0); + } + } + } +} +#endif /* OPT_SHIFT_FONTS */ + +int +xtermGetFont(const char *param) +{ + int fontnum; + + switch (param[0]) { + case 'd': + case 'D': + case '0': + fontnum = fontMenu_default; + break; + case '1': + fontnum = fontMenu_font1; + break; + case '2': + fontnum = fontMenu_font2; + break; + case '3': + fontnum = fontMenu_font3; + break; + case '4': + fontnum = fontMenu_font4; + break; + case '5': + fontnum = fontMenu_font5; + break; + case '6': + fontnum = fontMenu_font6; + break; + case 'e': + case 'E': + fontnum = fontMenu_fontescape; + break; + case 's': + case 'S': + fontnum = fontMenu_fontsel; + break; + default: + fontnum = -1; + break; + } + return fontnum; +} + +/* ARGSUSED */ +void +HandleSetFont(Widget w, + XEvent *event GCC_UNUSED, + String *params, + Cardinal *param_count) +{ + XtermWidget xw; + + if ((xw = getXtermWidget(w)) != 0) { + int fontnum; + VTFontNames fonts; + + memset(&fonts, 0, sizeof(fonts)); + + if (*param_count == 0) { + fontnum = fontMenu_default; + } else { + Cardinal maxparams = 1; /* total number of params allowed */ + int result = xtermGetFont(params[0]); + + switch (result) { + case fontMenu_default: /* FALLTHRU */ + case fontMenu_font1: /* FALLTHRU */ + case fontMenu_font2: /* FALLTHRU */ + case fontMenu_font3: /* FALLTHRU */ + case fontMenu_font4: /* FALLTHRU */ + case fontMenu_font5: /* FALLTHRU */ + case fontMenu_font6: /* FALLTHRU */ + break; + case fontMenu_fontescape: +#if OPT_WIDE_CHARS + maxparams = 5; +#else + maxparams = 3; +#endif + break; + case fontMenu_fontsel: + maxparams = 2; + break; + default: + Bell(xw, XkbBI_MinorError, 0); + return; + } + fontnum = result; + + if (*param_count > maxparams) { /* see if extra args given */ + Bell(xw, XkbBI_MinorError, 0); + return; + } + switch (*param_count) { /* assign 'em */ +#if OPT_WIDE_CHARS + case 5: + fonts.f_wb = x_strdup(params[4]); + /* FALLTHRU */ + case 4: + fonts.f_w = x_strdup(params[3]); +#endif + /* FALLTHRU */ + case 3: + fonts.f_b = x_strdup(params[2]); + /* FALLTHRU */ + case 2: + fonts.f_n = x_strdup(params[1]); + break; + } + } + + SetVTFont(xw, fontnum, True, &fonts); + } +} + +void +SetVTFont(XtermWidget xw, + int which, + Bool doresize, + const VTFontNames * fonts) +{ + TScreen *screen = TScreenOf(xw); + + TRACE(("SetVTFont(which=%d, f_n=%s, f_b=%s)\n", which, + (fonts && fonts->f_n) ? fonts->f_n : "", + (fonts && fonts->f_b) ? fonts->f_b : "")); + + if (IsIcon(screen)) { + Bell(xw, XkbBI_MinorError, 0); + } else if (which >= 0 && which < NMENUFONTS) { + VTFontNames myfonts; + + memset(&myfonts, 0, sizeof(myfonts)); + if (fonts != 0) + myfonts = *fonts; + + if (which == fontMenu_fontsel) { /* go get the selection */ + FindFontSelection(xw, myfonts.f_n, False); + } else { + int oldFont = screen->menu_font_number; + +#define USE_CACHED(field, name) \ + if (myfonts.field == 0) { \ + myfonts.field = x_strdup(screen->menu_font_names[which][name]); \ + TRACE(("set myfonts." #field " from menu_font_names[%d][" #name "] %s\n", \ + which, NonNull(myfonts.field))); \ + } else { \ + TRACE(("set myfonts." #field " reused\n")); \ + } +#define SAVE_FNAME(field, name) \ + if (myfonts.field != 0) { \ + if (screen->menu_font_names[which][name] == 0 \ + || strcmp(screen->menu_font_names[which][name], myfonts.field)) { \ + TRACE(("updating menu_font_names[%d][" #name "] to \"%s\"\n", \ + which, myfonts.field)); \ + FREE_STRING(screen->menu_font_names[which][name]); \ + screen->menu_font_names[which][name] = x_strdup(myfonts.field); \ + } \ + } + + USE_CACHED(f_n, fNorm); + USE_CACHED(f_b, fBold); +#if OPT_WIDE_CHARS + USE_CACHED(f_w, fWide); + USE_CACHED(f_wb, fWBold); +#endif + if (xtermLoadFont(xw, + &myfonts, + doresize, which)) { + /* + * If successful, save the data so that a subsequent query via + * OSC-50 will return the expected values. + */ + SAVE_FNAME(f_n, fNorm); + SAVE_FNAME(f_b, fBold); +#if OPT_WIDE_CHARS + SAVE_FNAME(f_w, fWide); + SAVE_FNAME(f_wb, fWBold); +#endif + } else { + (void) xtermLoadFont(xw, + xtermFontName(screen->MenuFontName(oldFont)), + doresize, oldFont); + Bell(xw, XkbBI_MinorError, 0); + } + FREE_FNAME(f_n); + FREE_FNAME(f_b); +#if OPT_WIDE_CHARS + FREE_FNAME(f_w); + FREE_FNAME(f_wb); +#endif + } + } else { + Bell(xw, XkbBI_MinorError, 0); + } + return; +} + +#if OPT_RENDERFONT +static void +trimSizeFromFace(char *face_name, float *face_size) +{ + char *first = strstr(face_name, ":size="); + if (first == 0) { + first = face_name; + } else { + first++; + } + if (!strncmp(first, "size=", (size_t) 5)) { + char *last = strchr(first, ':'); + char mark; + float value; + char extra; + TRACE(("...before trimming, font = \"%s\"\n", face_name)); + if (last == 0) + last = first + strlen(first); + mark = *last; + *last = '\0'; + if (sscanf(first, "size=%g%c", &value, &extra) == 1) { + TRACE(("...trimmed size from font: %g\n", value)); + if (face_size != 0) + *face_size = value; + } + if (mark) { + while ((*first++ = *++last) != '\0') { + ; + } + } else { + if (first != face_name) + --first; + *first = '\0'; + } + TRACE(("...after trimming, font = \"%s\"\n", face_name)); + } +} +#endif + +/* + * Save a font specification to the proper list. + */ +static void +save2FontList(XtermWidget xw, + const char *name, + XtermFontNames * fontnames, + VTFontEnum which, + const char *source, + Bool ttf) +{ + char *value; + size_t plen; + Bool marked = False; + Bool use_ttf = ttf; + + (void) xw; + + if (source == 0) + source = ""; + while (isspace(CharOf(*source))) + ++source; + + /* fontconfig patterns can contain ':' separators, but we'll treat + * a leading prefix specially to denote whether the pattern might be + * XLFD ("x" or "xlfd") versus Xft ("xft"). + */ + for (plen = 0; source[plen] != '\0'; ++plen) { + if (source[plen] == ':') { + marked = True; + switch (plen) { + case 0: + ++plen; /* trim leading ':' */ + break; + case 1: + if (!strncmp(source, "x", plen)) { + ++plen; + use_ttf = False; + } else { + marked = False; + } + break; + case 3: + if (!strncmp(source, "xft", plen)) { + ++plen; + use_ttf = True; + } else { + marked = False; + } + break; + case 4: + if (!strncmp(source, "xlfd", plen)) { + ++plen; + use_ttf = False; + } else { + marked = False; + } + break; + default: + marked = False; + plen = 0; + break; + } + break; + } + } + if (!marked) + plen = 0; + value = x_strtrim(source + plen); + if (value != 0) { + Bool success = False; +#if OPT_RENDERFONT + VTFontList *target = (use_ttf + ? &(fontnames->xft) + : &(fontnames->x11)); +#else + VTFontList *target = &(fontnames->x11); +#endif + char ***list = 0; + char **next = 0; + size_t count = 0; + + (void) use_ttf; + switch (which) { + case fNorm: + list = &(target->list_n); + break; + case fBold: + list = &(target->list_b); + break; +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + case fItal: + list = &(target->list_i); + break; + case fBtal: + list = &(target->list_bi); + break; +#endif +#if OPT_WIDE_CHARS + case fWide: + list = &(target->list_w); + break; + case fWBold: + list = &(target->list_wb); + break; + case fWItal: + list = &(target->list_wi); + break; + case fWBtal: + list = &(target->list_wbi); + break; +#endif + case fMAX: + list = 0; + break; + } + + if (list != 0) { + success = True; + if (*list != 0) { + while ((*list)[count] != 0) { + if (IsEmpty((*list)[count])) { + TRACE(("... initial %s\n", value)); + free((*list)[count]); + break; + } else if (!strcmp(value, (*list)[count])) { + TRACE(("... duplicate %s\n", value)); + success = False; + break; + } + ++count; + } + } + if (success) { + next = realloc(*list, sizeof(char *) * (count + 2)); + if (next != 0) { +#if OPT_RENDERFONT + if (use_ttf) { + trimSizeFromFace(value, + (count == 0 && which == fNorm) + ? &(xw->misc.face_size[0]) + : (float *) 0); + } +#endif + next[count++] = value; + next[count] = 0; + *list = next; + TRACE(("... saved %s %s %lu:%s\n", + whichFontList(xw, target), + whichFontList2(xw, *list), + (unsigned long) count, + value)); + } else { + fprintf(stderr, + "realloc failure in save2FontList(%s)\n", + name); + freeFontList(list); + success = False; + } + } + } + if (success) { +#if (MAX_XFT_FONTS == MAX_XLFD_FONTS) + size_t limit = MAX_XFT_FONTS; +#else + size_t limit = use_ttf ? MAX_XFT_FONTS : MAX_XLFD_FONTS; +#endif + if (count > limit && *x_skip_blanks(value)) { + fprintf(stderr, "%s: too many fonts for %s, ignoring %s\n", + ProgramName, + whichFontEnum(which), + value); + if (list && *list) { + free((*list)[limit]); + (*list)[limit] = 0; + } + } + } else { + free(value); + } + } +} + +/* + * In principle, any of the font-name resources could be extended to be a list + * of font-names. That would be bad for performance, but as a basis for an + * extension, parse the font-name as a comma-separated list, creating/updating + * an array of font-names. + */ +void +allocFontList(XtermWidget xw, + const char *name, + XtermFontNames * target, + VTFontEnum which, + const char *source, + Bool ttf) +{ + char *blob; + + blob = x_strdup(source); + if (blob != 0) { + int n; + int pass; + char **list = 0; + + TRACE(("allocFontList %s %s '%s'\n", whichFontEnum(which), name, blob)); + + for (pass = 0; pass < 2; ++pass) { + unsigned count = 0; + if (pass) + list[0] = blob; + for (n = 0; blob[n] != '\0'; ++n) { + if (blob[n] == ',') { + ++count; + if (pass != 0) { + blob[n] = '\0'; + list[count] = blob + n + 1; + } + } + } + if (!pass) { + if (count == 0 && *blob == '\0') + break; + list = TypeCallocN(char *, count + 2); + if (list == 0) + break; + } + } + if (list) { + for (n = 0; list[n] != 0; ++n) { + if (*list[n]) { + save2FontList(xw, name, target, which, list[n], ttf); + } + } + free(list); + } + } + free(blob); +} + +static void +initFontList(XtermWidget xw, + const char *name, + XtermFontNames * target, + Bool ttf) +{ + int which; + + TRACE(("initFontList(%s)\n", name)); + for (which = 0; which < fMAX; ++which) { + save2FontList(xw, name, target, (VTFontEnum) which, "", ttf); + } +} + +void +initFontLists(XtermWidget xw) +{ + TRACE(("initFontLists\n")); + initFontList(xw, "x11 font", &(xw->work.fonts), False); +#if OPT_RENDERFONT + initFontList(xw, "xft font", &(xw->work.fonts), True); +#endif +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS + initFontList(xw, "cached font", + &(xw->screen.cacheVTFonts.fonts), False); +#endif +} + +void +copyFontList(char ***targetp, char **source) +{ + freeFontList(targetp); + + if (source != 0) { + int pass; + size_t count; + + for (pass = 0; pass < 2; ++pass) { + for (count = 0; source[count] != 0; ++count) { + if (pass) + (*targetp)[count] = x_strdup(source[count]); + } + if (!pass) { + ++count; + *targetp = TypeCallocN(char *, count); + } + } + } else { + *targetp = TypeCallocN(char *, 2); + (*targetp)[0] = x_strdup(""); + } +} + +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS +static Boolean +merge_sublist(char ***targetp, char **source) +{ + Boolean result = False; + if ((*targetp == 0 || IsEmpty(**targetp)) && !IsEmpty(*source)) { + copyFontList(targetp, source); + result = True; + } + return result; +} +#endif + +void +freeFontList(char ***targetp) +{ + if (targetp != 0) { + char **target = *targetp; + if (target != 0) { + int n; + for (n = 0; target[n] != 0; ++n) { + free(target[n]); + } + free(target); + *targetp = 0; + } + } +} + +void +freeFontLists(VTFontList * lists) +{ + int which; + + TRACE(("freeFontLists\n")); + for (which = 0; which < fMAX; ++which) { + char ***target = 0; + switch (which) { + case fNorm: + target = &(lists->list_n); + break; + case fBold: + target = &(lists->list_b); + break; +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + case fItal: + target = &(lists->list_i); + break; + case fBtal: + target = &(lists->list_bi); + break; +#endif +#if OPT_WIDE_CHARS + case fWide: + target = &(lists->list_w); + break; + case fWBold: + target = &(lists->list_wb); + break; + case fWItal: + target = &(lists->list_wi); + break; + case fWBtal: + target = &(lists->list_wbi); + break; +#endif + default: + target = 0; + break; + } + freeFontList(target); + } +} + +/* + * Return a pointer to the XLFD font information for a given font class. + * XXX make this allocate the font on demand. + */ +XTermFonts * +getNormalFont(TScreen *screen, int which) +{ + XTermFonts *result = 0; + if (which >= 0 && which < fMAX) + result = GetNormalFont(screen, which); + return result; +} + +#if OPT_DEC_CHRSET +XTermFonts * +getDoubleFont(TScreen *screen, int which) +{ + XTermFonts *result = 0; + if ((int) which >= 0 && which < NUM_CHRSET) + result = GetDoubleFont(screen, which); + return result; +} + +#if OPT_RENDERFONT +XftFont * +getDoubleXftFont(XTermDraw * params, unsigned chrset, unsigned attr_flags) +{ + XftFont *result = 0; + + XtermWidget xw = params->xw; + TScreen *screen = TScreenOf(xw); + XftPattern *top_pattern; + int fontnum = screen->menu_font_number; + const char *face_name = getFaceName(xw, False); + + if (chrset != CSET_SWL + && (top_pattern = XftNameParse(face_name)) != 0) { + double face_size = (double) xw->misc.face_size[fontnum]; + XftPattern *sub_pattern = XftPatternDuplicate(top_pattern); + + switch (chrset) { + case CSET_DHL_TOP: + /* FALLTHRU */ + case CSET_DHL_BOT: + face_size *= 2; + XftPatternBuild(sub_pattern, + NormXftPattern, + (void *) 0); + break; + case CSET_DWL: + XftPatternBuild(sub_pattern, + NormXftPattern, + FC_ASPECT, XftTypeDouble, 2.0, + (void *) 0); + break; + } + if (attr_flags & BOLD) { + XftPatternBuild(sub_pattern, + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, + (void *) 0); + } + result = xtermOpenXft(xw, face_name, sub_pattern, "doublesize"); + } + return result; +} +#endif +#endif /* OPT_DEC_CHRSET */ + +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE +XTermFonts * +getItalicFont(TScreen *screen, int which) +{ + XTermFonts *result = 0; +#if OPT_WIDE_ATTRS + if (which >= 0 && which < fMAX) + result = GetItalicFont(screen, which); +#else + (void) screen; + (void) which; +#endif + return result; +} +#endif + +#if OPT_RENDERFONT +/* + * This returns a pointer to everything known about a given Xft font. + * XXX make this allocate the font on demand. + */ +XTermXftFonts * +getMyXftFont(XtermWidget xw, int which, int fontnum) +{ + TScreen *screen = TScreenOf(xw); + XTermXftFonts *result = 0; + if (fontnum >= 0 && fontnum < NMENUFONTS) { + switch ((VTFontEnum) which) { + case fNorm: + result = &(screen->renderFontNorm[fontnum]); + break; + case fBold: + result = &(screen->renderFontBold[fontnum]); + break; +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + case fItal: + result = &(screen->renderFontItal[fontnum]); + break; + case fBtal: + result = &(screen->renderFontBtal[fontnum]); + break; +#endif +#if OPT_WIDE_CHARS + case fWide: + result = &(screen->renderWideNorm[fontnum]); + break; + case fWBold: + result = &(screen->renderWideBold[fontnum]); + break; + case fWItal: + result = &(screen->renderWideItal[fontnum]); + break; + case fWBtal: + result = &(screen->renderWideBtal[fontnum]); + break; +#endif + case fMAX: + break; + } + } + return result; +} + +XftFont * +getXftFont(XtermWidget xw, VTFontEnum which, int fontnum) +{ + XTermXftFonts *data = getMyXftFont(xw, (int) which, fontnum); + XftFont *result = 0; + if (data != 0) + result = data->font; + return result; +} +#endif + +const char * +whichFontEnum(VTFontEnum value) +{ + const char *result = "?"; +#define DATA(name) case name: result = #name; break + switch (value) { + DATA(fNorm); + DATA(fBold); +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + DATA(fItal); + DATA(fBtal); +#endif +#if OPT_WIDE_CHARS + DATA(fWide); + DATA(fWBold); + DATA(fWItal); + DATA(fWBtal); +#endif + DATA(fMAX); + } +#undef DATA + return result; +} + +const char * +whichFontList(XtermWidget xw, VTFontList * value) +{ + const char *result = "?"; + if (value == &(xw->work.fonts.x11)) + result = "x11_fontnames"; +#if OPT_RENDERFONT + else if (value == &(xw->work.fonts.xft)) + result = "xft_fontnames"; +#endif +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS + else if (value == &(xw->screen.cacheVTFonts.fonts.x11)) + result = "cached_fontnames"; +#endif + return result; +} + +static const char * +whichFontList2s(VTFontList * list, char **value) +{ + const char *result = 0; +#define DATA(name) if (value == (list->name)) result = #name + DATA(list_n); + DATA(list_b); +#if OPT_WIDE_ATTRS || OPT_RENDERWIDE + DATA(list_i); + DATA(list_bi); +#endif +#if OPT_WIDE_CHARS + DATA(list_w); + DATA(list_wb); + DATA(list_wi); + DATA(list_wbi); +#endif +#undef DATA + return result; +} + +const char * +whichFontList2(XtermWidget xw, char **value) +{ + const char *result = 0; +#define DATA(name) (result = whichFontList2s(&(xw->name), value)) + if (DATA(work.fonts.x11) == 0) { +#if OPT_RENDERFONT + if (DATA(work.fonts.xft) == 0) +#endif +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS + if (DATA(screen.cacheVTFonts.fonts.x11) == 0) +#endif + result = "?"; + } +#undef DATA + return result; +} diff --git a/ports/xterm/xterm-359/fontutils.h b/ports/xterm/xterm-359/fontutils.h new file mode 100644 index 0000000..9d530c5 --- /dev/null +++ b/ports/xterm/xterm-359/fontutils.h @@ -0,0 +1,178 @@ +/* $XTermId: fontutils.h,v 1.134 2019/11/12 10:05:06 tom Exp $ */ + +/* + * Copyright 1998-2018,2019 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#ifndef included_fontutils_h +#define included_fontutils_h 1 + +#include +/* *INDENT-OFF* */ + +extern Bool xtermLoadDefaultFonts (XtermWidget /* xw */); +extern Bool xtermOpenFont (XtermWidget /* xw */, const char */* name */, XTermFonts * /* result */, Bool /* force */); +extern XTermFonts * getDoubleFont (TScreen * /* screen */, int /* which */); +extern XTermFonts * getItalicFont (TScreen * /* screen */, int /* which */); +extern XTermFonts * getNormalFont (TScreen * /* screen */, int /* which */); +extern const VTFontNames * defaultVTFontNames(XtermWidget /* xw */); +extern const VTFontNames * xtermFontName (const char */* normal */); +extern const char * whichFontEnum (VTFontEnum /* value */); +extern const char * whichFontList (XtermWidget /* xw */, VTFontList * /* value */); +extern const char * whichFontList2(XtermWidget /* xw */, char ** /* value */); +extern int lookupRelativeFontSize (XtermWidget /* xw */, int /* old */, int /* relative */); +extern int xtermGetFont (const char * /* param */); +extern int xtermLoadFont (XtermWidget /* xw */, const VTFontNames */* fonts */, Bool /* doresize */, int /* fontnum */); +extern void HandleSetFont PROTO_XT_ACTIONS_ARGS; +extern void SetVTFont (XtermWidget /* xw */, int /* i */, Bool /* doresize */, const VTFontNames */* fonts */); +extern void allocFontList (XtermWidget /* xw */, const char * /* name */, XtermFontNames * /* target */, VTFontEnum /* which */, const char * /* source */, Bool /* ttf */); +extern void copyFontList (char *** /* targetp */, char ** /* source */); +extern void initFontLists (XtermWidget /* xw */); +extern void freeFontList (char *** /* targetp */); +extern void freeFontLists (VTFontList * /* lists */); +extern void xtermCloseFont (XtermWidget /* xw */, XTermFonts * /* fnt */); +extern void xtermCloseFonts (XtermWidget /* xw */, XTermFonts * /* fnts[fMAX] */); +extern void xtermComputeFontInfo (XtermWidget /* xw */, VTwin */* win */, XFontStruct */* font */, int /* sbwidth */); +extern void xtermCopyFontInfo (XTermFonts * /* target */, XTermFonts * /* source */); +extern void xtermDerivedFont (const char * /* name */); +extern void xtermFreeFontInfo (XTermFonts * /* target */); +extern void xtermSetCursorBox (TScreen * /* screen */); +extern void xtermUpdateFontGCs (XtermWidget /* xw */, MyGetFont /* myfunc */); +extern void xtermUpdateFontInfo (XtermWidget /* xw */, Bool /* doresize */); + +#define getIconicFont(screen) (&((screen)->fnt_icon)) + +/* use these when "which" is constant, or known in-limits */ +#define GetNormalFont(screen, which) (&((screen)->fnts[which])) +#define GetDoubleFont(screen, which) (&((screen)->double_fonts[which])) +#if OPT_WIDE_ATTRS +#define GetItalicFont(screen, which) (&((screen)->ifnts[which])) +#else +#define GetItalicFont(screen, which) 0 +#endif + +#define FirstItemOf(vector) ((vector) ? (vector)[0] : 0) +#define CurrentXftFont(xw) ((xw)->work.fonts.xft.list_n[0]) +#define DefaultFontN(xw) ((xw)->work.fonts.x11.list_n[0]) +#define DefaultFontB(xw) ((xw)->work.fonts.x11.list_b[0]) +#define DefaultFontW(xw) ((xw)->work.fonts.x11.list_w[0]) +#define DefaultFontWB(xw) ((xw)->work.fonts.x11.list_wb[0]) + +#if OPT_DEC_CHRSET +extern char *xtermSpecialFont (XTermDraw * /* params */); +#endif + +#define FontLacksMetrics(font) \ + ((font)->fs != 0 \ + && ((font)->fs->per_char == 0)) + +#define FontIsIncomplete(font) \ + ((font)->fs != 0 \ + && (font)->fs->per_char != 0 \ + && !(font)->fs->all_chars_exist) + +#if OPT_BOX_CHARS + +#define ForceBoxChars(screen,ch) \ + (xtermIsDecGraphic(ch) \ + && (screen)->force_box_chars) + + /* + * Keep track of (some) characters to make the check for missing + * characters faster. If the character is known to be missing, + * the cache value is '2'. If we have checked the character, the + * cached value is '1'. + */ +#if OPT_WIDE_CHARS +#define CheckedKnownMissing(font, ch) \ + (((ch) < KNOWN_MISSING) && ((font)->known_missing[(Char)(ch)] > 0)) +#else +#define CheckedKnownMissing(font, ch) \ + ((font)->known_missing[(Char)(ch)] > 0) +#endif + +#define IsXtermMissingChar(screen, ch, font) \ + (CheckedKnownMissing(font, ch) \ + ? ((font)->known_missing[(Char)(ch)] > 1) \ + : ((FontIsIncomplete(font) && xtermMissingChar(ch, font)) \ + || ForceBoxChars(screen, ch))) + +extern void xtermDrawBoxChar (XTermDraw * /* params */, unsigned /* ch */, GC /* gc */, int /* x */, int /* y */, int /* cols */); +#else +#define IsXtermMissingChar(screen, ch, font) False +#endif + +#if OPT_BOX_CHARS || OPT_REPORT_FONTS +extern Bool xtermMissingChar (unsigned /* ch */, XTermFonts */* font */); +#endif + +#if OPT_LOAD_VTFONTS +extern void HandleLoadVTFonts PROTO_XT_ACTIONS_ARGS; +#endif + +#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS +extern Bool xtermLoadWideFonts (XtermWidget /* w */, Bool /* nullOk */); +extern void xtermSaveVTFonts (XtermWidget /* xw */); +#endif + +#define xtermIsDecGraphic(ch) ((ch) > 0 && (ch) < 32) + +#if OPT_RENDERFONT +extern Boolean maybeXftCache(XtermWidget /* xw */, XftFont * /* font */); +extern Bool xtermXftMissing (XtermWidget /* xw */, XftFont * /* font */, unsigned /* wc */); +extern XTermXftFonts *getMyXftFont (XtermWidget /* xw */, int /* which */, int /* fontnum */); +extern XftFont *findXftGlyph (XtermWidget /* xw */, XftFont * /* given */, unsigned /* wc */); +extern XftFont *getXftFont (XtermWidget /* xw */, VTFontEnum /* which */, int /* fontnum */); +extern void closeCachedXft (TScreen * /* screen */, XftFont * /* font */); +extern void xtermCloseXft (TScreen * /* screen */, XTermXftFonts * /* pub */); +#if OPT_DEC_CHRSET +extern XftFont * getDoubleXftFont(XTermDraw * /* params */, unsigned /* chrset */, unsigned /* attr_flags */); +#endif +#endif + +#if OPT_SHIFT_FONTS +extern String getFaceName (XtermWidget /* xw */, Bool /* wideName */); +extern void HandleLargerFont PROTO_XT_ACTIONS_ARGS; +extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS; +extern void setFaceName (XtermWidget /* xw */, const char * /*value */); +#endif + +#if OPT_WIDE_ATTRS +extern unsigned xtermUpdateItalics (XtermWidget /* xw */, unsigned /* new_attrs */, unsigned /* old_attrs */); +extern void xtermLoadItalics (XtermWidget /* xw */); +#endif + +#if OPT_WIDE_CHARS +extern unsigned ucs2dec (TScreen * /* screen */, unsigned /* ch */); +extern unsigned dec2ucs (TScreen * /* screen */, unsigned /* ch */); +#endif + +/* *INDENT-ON* */ + +#endif /* included_fontutils_h */ diff --git a/ports/xterm/xterm-359/fontutils.o b/ports/xterm/xterm-359/fontutils.o new file mode 100644 index 0000000..66ea694 Binary files /dev/null and b/ports/xterm/xterm-359/fontutils.o differ diff --git a/ports/xterm/xterm-359/gen-charsets.pl b/ports/xterm/xterm-359/gen-charsets.pl new file mode 100755 index 0000000..2456a74 --- /dev/null +++ b/ports/xterm/xterm-359/gen-charsets.pl @@ -0,0 +1,105 @@ +#! /usr/bin/perl -w +# $XTermId: gen-charsets.pl,v 1.2 2018/08/22 22:59:15 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2018 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# Translate a Unicode mapping, e.g., for one of the ISO-8859-x codepages, +# into the form used in charsets.c for converting characters. +use strict; + +$| = 1; + +sub do_file($) { + my $file = shift; + my $undef = hex(0x2426); + open( FP, $file ) || do { + print STDERR "Can't open $file: $!\n"; + return; + }; + my @data = ; + close(FP); + my $name = $file; + $name =~ s,^.*/,,; + $name =~ s/\..*$//; + $name =~ s/^(8859)/ISO-$1/; + $name =~ s/-/_/g; + printf "#define map_%s(code) \\\n", $name; + printf "\tswitch (code) { \\\n"; + my @target; + my @noteof; + + for my $n ( 0 .. $#data ) { + chomp $data[$n]; + $data[$n] =~ s/^\s*//; + $data[$n] =~ s/\s*$//; + next if ( $data[$n] =~ /^#/ ); + next if ( $data[$n] eq "" ); + if ( $data[$n] !~ /^0x[[:xdigit:]]+\s+0x[[:xdigit:]]+\s*#/i ) { + printf STDERR "?? %d:%s\n", $n + 1, $data[$n]; + next; + } + + my $source = $data[$n]; + $source =~ s/\s.*//; + $source = hex($source); + next if ( $source < 160 or $source > 255 ); + $source -= 128; + + my $target = $data[$n]; + $target =~ s/^[^\s]+\s+(0x[[:xdigit:]]+).*$/$1/i; + $target = hex($target); + + my $noteof = $data[$n]; + $noteof =~ s/^[^#]+#\s*//; + + $target[$source] = $target; + $noteof[$source] = $noteof; + } + my $lo = $target[32] ? 32 : 33; + my $hi = $target[127] ? 127 : 126; + for my $n ( $lo .. $hi ) { + if ( defined $target[$n] ) { + printf "\t UNI(0x%02x, 0x%04x);\t/* %s */ \\\n", $n, + $target[$n], $noteof[$n]; + } + else { + printf "\t XXX(0x%02x, UNDEF);\t/* undefined */ \\\n", $n; + } + } + printf "\t}\n"; +} + +while ( $#ARGV >= 0 ) { + &do_file( shift @ARGV ); +} + +1; diff --git a/ports/xterm/xterm-359/gen-pc-fkeys.pl b/ports/xterm/xterm-359/gen-pc-fkeys.pl new file mode 100755 index 0000000..1cc5b47 --- /dev/null +++ b/ports/xterm/xterm-359/gen-pc-fkeys.pl @@ -0,0 +1,364 @@ +#! /usr/bin/perl -w +# $XTermId: gen-pc-fkeys.pl,v 1.22 2007/11/30 23:03:55 tom Exp $ +# ----------------------------------------------------------------------------- +# this file is part of xterm +# +# Copyright 2004-2005,2007 by Thomas E. Dickey +# +# All Rights Reserved +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the +# sale, use or other dealings in this Software without prior written +# authorization. +# ----------------------------------------------------------------------------- +# +# Construct a list of function-key definitions corresponding to xterm's +# Sun/PC keyboard. This uses ncurses' infocmp to obtain the strings (including +# extensions) to modify (and verify). +use strict; + +my($max_modifier, $terminfo); +my(@old_fkeys, $opt_fkeys, $min_fkeys, $max_fkeys); +my(%old_ckeys, $opt_ckeys, $min_ckeys, $max_ckeys); +my(%old_ekeys, $opt_ekeys, $min_ekeys, $max_ekeys); + +my(@ckey_names); +@ckey_names = ( + 'kcud1', 'kcub1', 'kcuf1', 'kcuu1', # 1 = no modifiers + 'kDN', 'kLFT', 'kRIT', 'kUP', # 2 = shift + # make_ckey_names() repeats this row, appending the modifier code + ); +my %ckey_names; +my(@ckey_known); +@ckey_known = ( + 'kind', 'kLFT', 'kRIT', 'kri', # 2 = shift (standard) + ); + +my(@ekey_names); +@ekey_names = ( + 'khome', 'kend', 'knp', 'kpp', 'kdch1', 'kich1', # 1 = no modifiers + 'kHOM', 'kEND', 'kNXT', 'kPRV', 'kDC', 'kIC', # 2 = shift + # make_ekey_names() repeats this row, appending the modifier code +); +my %ekey_names; + +$min_fkeys=12; # the number of "real" function keys on your keyboard +$max_fkeys=64; # the number of function-keys terminfo can support +$max_modifier=8; # modifier 1 + (1=shift, 2=alt, 4=control 8=meta) + +$min_ckeys=4; # the number of "real" cursor keys on your keyboard +$max_ckeys=($min_ckeys * ($max_modifier - 1)); + +$min_ekeys=6; # the number of "real" editing keys on your keyboard +$max_ekeys=($min_ekeys * ($max_modifier - 1)); + +$opt_ckeys=2; # xterm's modifyCursorKeys resource +$opt_ekeys=2; # xterm's modifyCursorKeys resource +$opt_fkeys=2; # xterm's modifyFunctionKeys resource +$terminfo="xterm-new"; # the terminfo entry to use + +# apply the given modifier to the terminfo string, return the result +sub modify_fkey($$$) { + my $code = $_[0]; + my $text = $_[1]; + my $opts = $_[2]; + if (not defined($text)) { + $text = ""; + } elsif ($code != 1) { + $text =~ s/\\EO/\\E\[/ if ($opts >= 1); + + my $piece = substr $text, 0, length ($text) - 1; + my $final = substr $text, length ($text) - 1; + my $check = substr $piece, length ($piece) - 1; + if ($check =~ /[0-9]/) { + $code = ";" . $code; + } elsif ( $check =~ /\[/ and $opts >= 2) { + $code = "1;" . $code; + } + if ( $opts >= 3 ) { + $code = ">" . $code; + } + $text = $piece . $code . $final; + $text =~ s/([\d;]+)>/>$1/; + } + return $text; +} + +# compute the next modifier value - +# Cycling through the modifiers is not just like counting. Users prefer +# pressing one modifier (even if using Emacs). So first we cycle through +# the individual modifiers, then for completeness two, three, etc. +sub next_modifier { + my $code = $_[0]; + my $mask = $code - 1; + if ($mask == 0) { + $mask = 1; # shift + } elsif ($mask == 1) { + $mask = 4; # control + } elsif ($mask == 2) { + $mask = 3; # shift+alt + } elsif ($mask == 4) { + $mask = 5; # shift+control + } elsif ($mask == 5) { + $mask = 2; # alt + } + # printf ("# next_modifier(%d) = %d\n", $code, $mask + 1); + return $mask + 1; +} + +sub make_ckey_names() { + my ($j, $k); + my $min = $min_ckeys * 2; + my $max = $max_ckeys - 1; + + # printf "# make_ckey_names\n"; + for $j ($min..$max) { + $k = 1 + substr($j / $min_ckeys, 0, 1); + $ckey_names[$j] = $ckey_names[$min_ckeys + ($j % $min_ckeys)] . $k; + # printf "# make %d:%s\n", $j, $ckey_names[$j]; + } + for $j (0..$#ckey_names) { + # printf "# %d:%s\n", $j, $ckey_names[$j]; + $ckey_names{$ckey_names[$j]} = $j; + } +} + +sub make_ekey_names() { + my ($j, $k); + my $min = $min_ekeys * 2; + my $max = $max_ekeys - 1; + + # printf "# make_ekey_names\n"; + for $j ($min..$max) { + $k = 1 + substr($j / $min_ekeys, 0, 1); + $ekey_names[$j] = $ekey_names[$min_ekeys + ($j % $min_ekeys)] . $k; + # printf "# make %d:%s\n", $j, $ekey_names[$j]; + } + for $j (0..$#ekey_names) { + # printf "# %d:%s\n", $j, $ekey_names[$j]; + $ekey_names{$ekey_names[$j]} = $j; + } +} + +# Read the terminfo entry's list of function keys $old_fkeys[]. +# We could handle $old_fkeys[0], but choose to start numbering from 1. +sub readterm($) { + my $term = $_[0]; + my($key, $n, $str); + my(@list) = `infocmp -x -1 $term`; + + for $n (0..$#list) { + chop $list[$n]; + $list[$n] =~ s/^[[:space:]]//; + + $key = $list[$n]; + $key =~ s/=.*//; + + $str = $list[$n]; + $str =~ s/^[^=]+=//; + $str =~ s/,$//; + + if ( $list[$n] =~ /^kf[[:digit:]]+=/ ) { + $key =~ s/^kf//; + # printf "# $n:%s(%d)(%s)\n", $list[$n], $key, $str; + $old_fkeys[$key] = $str; + } elsif ( $key =~ /^kc[[:alpha:]]+1/ + or $key =~ /^k(LFT|RIT|UP|DN)\d?/) { + # printf "# $n:%s(%d)(%s)\n", $list[$n], $key, $str; + $old_ckeys{$key} = $str; + } elsif ( defined $ekey_names{$key} ) { + # printf "# $n:%s(%s)(%s)\n", $list[$n], $key, $str; + $old_ekeys{$key} = $str; + } + } + # printf ("last index:%d\n", $#old_fkeys); +} + +# read the whole terminfo to ensure we get the non-modified stuff, then read +# the part that contains modifiers. +sub read_part($) { + my $part = $_[0]; + + %old_ckeys = (); + @old_fkeys = (); + readterm($terminfo); + readterm($part); +} + +sub nameof_ckeys($) { + my $opts = $_[0]; + my $optname = "xterm+pcc" . ($opts >= 0 ? $opts : "n"); + return $optname; +} + +sub generate_ckeys($) { + my $opts = $_[0]; + my($modifier, $cur_ckey, $index); + + printf "%s|fragment with modifyCursorKeys:%s,\n", + nameof_ckeys($opts), $opts; + + # show the standard cursor definitions + $modifier = 1; + for ($index = 0; $index < $min_ckeys; ++$index) { + $cur_ckey = $index + ($modifier * $min_ckeys); + my $name = $ckey_known[$index]; + my $input = $old_ckeys{$ckey_names[$index]}; + my $result = modify_fkey($modifier + 1, $input, $opts); + printf "\t%s=%s,\n", $name, $result; + if (defined $old_ckeys{$name}) { + if ($old_ckeys{$name} ne $result) { + printf "# found %s=%s\n", $name, $old_ckeys{$name}; + } + } + } + + # show the extended cursor definitions + for ($index = 0; $index < $min_ckeys; ++$index) { + for ($modifier = 1; $modifier < $max_modifier; ++$modifier) { + $cur_ckey = $index + ($modifier * $min_ckeys); + if (defined $ckey_names[$cur_ckey] and + $ckey_names[$cur_ckey] ne "kLFT" and + $ckey_names[$cur_ckey] ne "kRIT" ) { + my $name = $ckey_names[$cur_ckey]; + my $input = $old_ckeys{$ckey_names[$index]}; + my $result = modify_fkey($modifier + 1, $input, $opts); + printf "\t%s=%s,\n", $name, $result; + if (defined $old_ckeys{$name}) { + if ($old_ckeys{$name} ne $result) { + printf "# found %s=%s\n", $name, $old_ckeys{$name}; + } + } + } + } + } +} + +sub nameof_ekeys($) { + my $opts = $_[0]; + my $optname = "xterm+pce" . ($opts >= 0 ? $opts : "n"); + return $optname; +} + +sub generate_ekeys($) { + my $opts = $_[0]; + my($modifier, $cur_ekey, $index); + + printf "%s|fragment with modifyCursorKeys:%s,\n", + nameof_ekeys($opts), $opts; + + for ($index = 0; $index < $min_ekeys; ++$index) { + for ($modifier = 1; $modifier < $max_modifier; ++$modifier) { + $cur_ekey = $index + ($modifier * $min_ekeys); + if (defined $ekey_names[$cur_ekey] ) { + my $name = $ekey_names[$cur_ekey]; + my $input = $old_ekeys{$ekey_names[$index]}; + my $result = modify_fkey($modifier + 1, $input, $opts); + printf "\t%s=%s,\n", $name, $result; + if (defined $old_ekeys{$name}) { + if ($old_ekeys{$name} ne $result) { + printf "# found %s=%s\n", $name, $old_ekeys{$name}; + } + } + } + } + } +} + +sub nameof_fkeys($) { + my $opts = $_[0]; + my $optname = "xterm+pcf" . ($opts >= 0 ? $opts : "n"); + return $optname; +} + +sub generate_fkeys($) { + my $opts = $_[0]; + my($modifier, $cur_fkey); + + printf "%s|fragment with modifyFunctionKeys:%s and ctrlFKeys:10,\n", + nameof_fkeys($opts), $opts; + + for ($cur_fkey = 1, $modifier = 1; $cur_fkey < $max_fkeys; ++$cur_fkey) { + my $index = (($cur_fkey - 1) % $min_fkeys); + if ($index == 0 && $cur_fkey != 1) { + $modifier = next_modifier($modifier); + } + if (defined $old_fkeys[$index + 1]) { + my $input = $old_fkeys[$index + 1]; + my $result = modify_fkey($modifier, $input, $opts); + printf "\tkf%d=%s,\n", $cur_fkey, $result; + if (defined $old_fkeys[$cur_fkey]) { + if ($old_fkeys[$cur_fkey] ne $result) { + printf "# found kf%d=%s\n", $cur_fkey, $old_fkeys[$cur_fkey]; + } + } + } + } +} + +sub show_default() { + readterm($terminfo); + + printf "xterm+pcfkeys|fragment for PC-style keys,\n"; + printf "\tuse=%s,\n", nameof_ckeys($opt_ckeys); + printf "\tuse=%s,\n", nameof_ekeys($opt_ekeys); + printf "\tuse=%s,\n", nameof_fkeys($opt_fkeys); + + generate_ckeys($opt_ckeys); + generate_ekeys($opt_ekeys); + generate_fkeys($opt_fkeys); +} + +sub show_nondefault() +{ + my $opts; + + for ($opts = 0; $opts <= 3; ++$opts) { + if ($opts != $opt_ckeys) { + read_part(nameof_ckeys($opts)); + generate_ckeys($opts); + } + } + + for ($opts = 0; $opts <= 3; ++$opts) { + if ($opts != $opt_ekeys) { + read_part(nameof_ekeys($opts)); + generate_ekeys($opts); + } + } + + for ($opts = 0; $opts <= 3; ++$opts) { + if ($opts != $opt_fkeys) { + read_part(nameof_fkeys($opts)); + generate_fkeys($opts); + } + } +} + +make_ckey_names(); +make_ekey_names(); + +printf "# gen-pc-fkeys.pl\n"; +printf "# %s:timode\n", "vile"; +show_default(); +show_nondefault(); diff --git a/ports/xterm/xterm-359/graphics.c b/ports/xterm/xterm-359/graphics.c new file mode 100644 index 0000000..7b32592 --- /dev/null +++ b/ports/xterm/xterm-359/graphics.c @@ -0,0 +1,1815 @@ +/* $XTermId: graphics.c,v 1.90 2020/08/06 19:57:58 tom Exp $ */ + +/* + * Copyright 2013-2019,2020 by Ross Combs + * Copyright 2013-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#include + +#include +#include +#include + +#include +#include + +#include +#include + +#undef DUMP_BITMAP +#undef DUMP_COLORS +#undef DEBUG_PALETTE +#undef DEBUG_PIXEL +#undef DEBUG_REFRESH + +/* + * graphics TODO list + * + * ReGIS: + * - ship a default alphabet zero font instead of scaling Xft fonts + * - input cursors + * - output cursors + * - mouse/tablet/arrow-key input + * - fix graphic pages for ReGIS -- they should also apply to text and sixel graphics + * - fix interpolated curves to more closely match implementation (identical despite direction and starting point) + * - non-ASCII alphabets + * - enter/leave anywhere in a command + * - locator key definitions (DECLKD) + * - command display mode + * - re-rasterization on window resize + * - macros + * - improved fills for narrow angles (track actual lines not just pixels) + * - hardcopy/screen-capture support (need dialog of some sort for safety) + * - error reporting + * + * sixel: + * - fix problem where new_row < 0 during sixel parsing (see FIXME) + * - screen-capture support (need dialog of some sort for safety) + * + * VT55/VT105 waveform graphics + * - everything + * + * Tektronix: + * - color (VT340 4014 emulation, 41xx, IRAF GTERM, and also MS-DOS Kermit color support) + * - polygon fill (41xx) + * - clear area extension + * - area fill extension + * - pixel operations (RU/RS/RP) + * - research other 41xx and 42xx extensions + * + * common graphics features: + * - handle light/dark screen modes (CSI?5[hl]) + * - update text fg/bg color which overlaps images + * - handle graphic updates in scroll regions (verify effect on graphics) + * - handle rectangular area copies (verify they work with graphics) + * - invalidate graphics under graphic if same origin, at least as big, and bg not transparent + * - invalidate graphic if completely scrolled past end of scrollback + * - invalidate graphic if all pixels are transparent/erased + * - invalidate graphic if completely scrolled out of alt buffer + * - posturize requested colors to match hardware palettes (e.g. only four possible shades on VT240) + * - color register report/restore + * - ability to select/copy graphics for pasting in other programs + * - ability to show non-scroll-mode sixel graphics in a separate window + * - ability to show ReGIS graphics in a separate window + * - ability to show Tektronix graphics in VT100 window + * - truncate graphics at bottom edge of terminal? + * - locator events (DECEFR DECSLE DECELR DECLRP) + * - locator controller mode (CSI6i / CSI7i) + * + * new escape sequences: + * - way to query text font size without "window ops" (or make "window ops" permissions more fine grained) + * - way to query and set the number of graphics pages + * + * ReGIS extensions: + * - non-integer text scaling + * - free distortionless text rotation (vs. simulating the distortion and aligning to 45deg increments) + * - font characteristics: bold/underline/italic + * - remove/increase arbitrary limits (pattern size, pages, alphabets, stack size, font names, etc.) + * - shade/fill with borders + * - sprites (copy portion of page into/out of buffer with scaling and rotation) + * - ellipses + * - 2D patterns + * - option to set actual graphic size (not just coordinate range) + * - gradients (for lines and fills) + * - line width (RLogin has this and it is mentioned in docs for the DEC ReGIS to Postscript converter) + * - transparency + * - background color as stackable write control + * - true color (virtual color registers created upon lookup) + * - anti-aliasing + * - variable-width (proportional) text + */ + +/* font sizes: + * VT510: + * 80 Columns 132 Columns Maximum Number of Lines + * 10 x 16 6 x 16 26 lines + keyboard indicator line + * 10 x 13 6 x 13 26 lines + keyboard indicator line + * 10 x 10 6 x 10 42 lines + keyboard indicator line + * 10 x 8 6 x 8 53 lines + keyboard indicator line + */ + +typedef struct allocated_color_register { + struct allocated_color_register *next; + Pixel pix; + short r, g, b; +} AllocatedColorRegister; + +#define LOOKUP_WIDTH 16 +static AllocatedColorRegister *allocated_colors[LOOKUP_WIDTH][LOOKUP_WIDTH][LOOKUP_WIDTH]; + +#define FOR_EACH_SLOT(ii) for (ii = 0U; ii < MAX_GRAPHICS; ii++) + +static ColorRegister *shared_color_registers; +static Graphic *displayed_graphics[MAX_GRAPHICS]; +static unsigned next_graphic_id = 0U; +static unsigned used_graphics; /* 0 to MAX_GRAPHICS */ + +#define DiffColor(this,that) \ + (this.r != that.r || \ + this.g != that.g || \ + this.b != that.b) + +static ColorRegister null_color = +{-1, -1, -1}; + +static ColorRegister * +allocRegisters(void) +{ + return TypeCallocN(ColorRegister, MAX_COLOR_REGISTERS); +} + +static Graphic * +freeGraphic(Graphic *obj) +{ + if (obj) { + if (obj->pixels) + free(obj->pixels); + if (obj->private_color_registers) + free(obj->private_color_registers); + free(obj); + } + return NULL; +} + +static Graphic * +allocGraphic(int max_w, int max_h) +{ + Graphic *result = TypeCalloc(Graphic); + if (result) { + result->max_width = max_w; + result->max_height = max_h; + if (!(result->pixels = TypeCallocN(RegisterNum, + (size_t) max_w * (size_t) max_h))) { + result = freeGraphic(result); + } else if (!(result->private_color_registers = allocRegisters())) { + result = freeGraphic(result); + } + } + return result; +} + +#define getActiveSlot(n) \ + (((n) < MAX_GRAPHICS && \ + displayed_graphics[n] && \ + displayed_graphics[n]->valid) \ + ? displayed_graphics[n] \ + : NULL) + +static Graphic * +getInactiveSlot(const TScreen *screen, unsigned n) +{ + if (n < MAX_GRAPHICS && + (!displayed_graphics[n] || + !displayed_graphics[n]->valid)) { + if (!displayed_graphics[n]) { + displayed_graphics[n] = allocGraphic(screen->graphics_max_wide, + screen->graphics_max_high); + used_graphics += (displayed_graphics[n] != NULL); + } + return displayed_graphics[n]; + } + return NULL; +} + +static ColorRegister * +getSharedRegisters(void) +{ + if (!shared_color_registers) + shared_color_registers = allocRegisters(); + return shared_color_registers; +} + +static void +deactivateSlot(unsigned n) +{ + if ((n < MAX_GRAPHICS) && displayed_graphics[n]) { + displayed_graphics[n] = freeGraphic(displayed_graphics[n]); + used_graphics--; + } +} + +extern RegisterNum +read_pixel(Graphic *graphic, int x, int y) +{ + if (x < 0 || x >= graphic->actual_width || + y < 0 || y >= graphic->actual_height) { + return COLOR_HOLE; + } + + return graphic->pixels[y * graphic->max_width + x]; +} + +#define _draw_pixel(G, X, Y, C) \ + do { \ + (G)->pixels[(Y) * (G)->max_width + (X)] = (RegisterNum) (C); \ + } while (0) + +void +draw_solid_pixel(Graphic *graphic, int x, int y, unsigned color) +{ + assert(color <= MAX_COLOR_REGISTERS); + +#ifdef DEBUG_PIXEL + TRACE(("drawing pixel at %d,%d color=%hu (hole=%hu, [%d,%d,%d])\n", + x, + y, + color, + COLOR_HOLE, + ((color != COLOR_HOLE) + ? (unsigned) graphic->color_registers[color].r : 0U), + ((color != COLOR_HOLE) + ? (unsigned) graphic->color_registers[color].g : 0U), + ((color != COLOR_HOLE) + ? (unsigned) graphic->color_registers[color].b : 0U))); +#endif + if (x >= 0 && x < graphic->actual_width && + y >= 0 && y < graphic->actual_height) { + _draw_pixel(graphic, x, y, color); + if (color < MAX_COLOR_REGISTERS) + graphic->color_registers_used[color] = 1; + } +} + +void +draw_solid_rectangle(Graphic *graphic, int x1, int y1, int x2, int y2, unsigned color) +{ + int x, y; + int tmp; + + assert(color <= MAX_COLOR_REGISTERS); + + if (x1 > x2) { + EXCHANGE(x1, x2, tmp); + } + if (y1 > y2) { + EXCHANGE(y1, y2, tmp); + } + + if (x2 < 0 || x1 >= graphic->actual_width || + y2 < 0 || y1 >= graphic->actual_height) + return; + + if (x1 < 0) + x1 = 0; + if (x2 >= graphic->actual_width) + x2 = graphic->actual_width - 1; + if (y1 < 0) + y1 = 0; + if (y2 >= graphic->actual_height) + y2 = graphic->actual_height - 1; + + if (color < MAX_COLOR_REGISTERS) + graphic->color_registers_used[color] = 1; + for (y = y1; y <= y2; y++) + for (x = x1; x <= x2; x++) + _draw_pixel(graphic, x, y, color); +} + +#if 0 /* unused */ +void +draw_solid_line(Graphic *graphic, int x1, int y1, int x2, int y2, unsigned color) +{ + int x, y; + int dx, dy; + int dir, diff; + + assert(color <= MAX_COLOR_REGISTERS); + + dx = abs(x1 - x2); + dy = abs(y1 - y2); + + if (dx > dy) { + if (x1 > x2) { + int tmp; + EXCHANGE(x1, x2, tmp); + EXCHANGE(y1, y2, tmp); + } + if (y1 < y2) + dir = 1; + else if (y1 > y2) + dir = -1; + else + dir = 0; + + diff = 0; + y = y1; + for (x = x1; x <= x2; x++) { + if (diff >= dx) { + diff -= dx; + y += dir; + } + diff += dy; + draw_solid_pixel(graphic, x, y, color); + } + } else { + if (y1 > y2) { + int tmp; + EXCHANGE(x1, x2, tmp); + EXCHANGE(y1, y2, tmp); + } + if (x1 < x2) + dir = 1; + else if (x1 > x2) + dir = -1; + else + dir = 0; + + diff = 0; + x = x1; + for (y = y1; y <= y2; y++) { + if (diff >= dy) { + diff -= dy; + x += dir; + } + diff += dx; + draw_solid_pixel(graphic, x, y, color); + } + } +} +#endif + +void +copy_overlapping_area(Graphic *graphic, int src_ul_x, int src_ul_y, + int dst_ul_x, int dst_ul_y, unsigned w, unsigned h, + unsigned default_color) +{ + int sx, ex, dx; + int sy, ey, dy; + int xx, yy; + RegisterNum color; + + if (dst_ul_x <= src_ul_x) { + sx = 0; + ex = (int) w - 1; + dx = +1; + } else { + sx = (int) w - 1; + ex = 0; + dx = -1; + } + + if (dst_ul_y <= src_ul_y) { + sy = 0; + ey = (int) h - 1; + dy = +1; + } else { + sy = (int) h - 1; + ey = 0; + dy = -1; + } + + for (yy = sy; yy != ey + dy; yy += dy) { + int dst_y = dst_ul_y + yy; + int src_y = src_ul_y + yy; + if (dst_y < 0 || dst_y >= (int) graphic->actual_height) + continue; + + for (xx = sx; xx != ex + dx; xx += dx) { + int dst_x = dst_ul_x + xx; + int src_x = src_ul_x + xx; + if (dst_x < 0 || dst_x >= (int) graphic->actual_width) + continue; + + if (src_x < 0 || src_x >= (int) graphic->actual_width || + src_y < 0 || src_y >= (int) graphic->actual_height) + color = (RegisterNum) default_color; + else + color = graphic->pixels[(unsigned) (src_y * + graphic->max_width) + + (unsigned) src_x]; + + graphic->pixels[(unsigned) (dst_y * graphic->max_width) + + (unsigned) dst_x] = color; + } + } +} + +static void +set_color_register(ColorRegister *color_registers, + unsigned color, + int r, + int g, + int b) +{ + ColorRegister *reg = &color_registers[color]; + reg->r = (short) r; + reg->g = (short) g; + reg->b = (short) b; +} + +/* Graphics which don't use private colors will act as if they are using a + * device-wide color palette. + */ +static void +set_shared_color_register(unsigned color, int r, int g, int b) +{ + unsigned ii; + + assert(color < MAX_COLOR_REGISTERS); + + set_color_register(getSharedRegisters(), color, r, g, b); + + if (!used_graphics) + return; + + FOR_EACH_SLOT(ii) { + Graphic *graphic; + + if (!(graphic = getActiveSlot(ii))) + continue; + if (graphic->private_colors) + continue; + + if (graphic->color_registers_used[ii]) { + graphic->dirty = 1; + } + } +} + +void +update_color_register(Graphic *graphic, + unsigned color, + int r, + int g, + int b) +{ + assert(color < MAX_COLOR_REGISTERS); + + if (graphic->private_colors) { + set_color_register(graphic->private_color_registers, + color, r, g, b); + if (graphic->color_registers_used[color]) { + graphic->dirty = 1; + } + graphic->color_registers_used[color] = 1; + } else { + set_shared_color_register(color, r, g, b); + } +} + +#define SQUARE(X) ( (X) * (X) ) + +RegisterNum +find_color_register(ColorRegister const *color_registers, int r, int g, int b) +{ + unsigned i; + unsigned closest_index; + unsigned closest_distance; + + /* I have no idea what algorithm DEC used for this. + * The documentation warns that it is unpredictable, especially with values + * far away from any allocated color so it is probably a very simple + * heuristic rather than something fancy like finding the minimum distance + * in a linear perceptive color space. + */ + closest_index = MAX_COLOR_REGISTERS; + closest_distance = 0U; + for (i = 0U; i < MAX_COLOR_REGISTERS; i++) { + unsigned d = (unsigned) (SQUARE(2 * (color_registers[i].r - r)) + + SQUARE(3 * (color_registers[i].g - g)) + + SQUARE(1 * (color_registers[i].b - b))); + if (closest_index == MAX_COLOR_REGISTERS || d < closest_distance) { + closest_index = i; + closest_distance = d; + } + } + + TRACE(("found closest color register to %d,%d,%d: %u (distance %u value %d,%d,%d)\n", + r, g, b, + closest_index, + closest_distance, + color_registers[closest_index].r, + color_registers[closest_index].g, + color_registers[closest_index].b)); + return (RegisterNum) closest_index; +} + +static void +init_color_registers(ColorRegister *color_registers, int graphics_id) +{ + TRACE(("setting initial colors for terminal %d\n", graphics_id)); + { + unsigned i; + + for (i = 0U; i < MAX_COLOR_REGISTERS; i++) { + set_color_register(color_registers, (RegisterNum) i, 0, 0, 0); + } + } + + /* + * default color registers: + * (mono) (color) + * VK100/GIGI (fixed) + * VT125: + * 0: 0% 0% + * 1: 33% blue + * 2: 66% red + * 3: 100% green + * VT240: + * 0: 0% 0% + * 1: 33% blue + * 2: 66% red + * 3: 100% green + * VT241: + * 0: 0% 0% + * 1: 33% blue + * 2: 66% red + * 3: 100% green + * VT330: + * 0: 0% 0% (bg for light on dark mode) + * 1: 33% blue (red?) + * 2: 66% red (green?) + * 3: 100% green (yellow?) (fg for light on dark mode) + * VT340: + * 0: 0% 0% (bg for light on dark mode) + * 1: 14% blue + * 2: 29% red + * 3: 43% green + * 4: 57% magenta + * 5: 71% cyan + * 6: 86% yellow + * 7: 100% 50% (fg for light on dark mode) + * 8: 0% 25% + * 9: 14% gray-blue + * 10: 29% gray-red + * 11: 43% gray-green + * 12: 57% gray-magenta + * 13: 71% gray-cyan + * 14: 86% gray-yellow + * 15: 100% 75% ("white") + * VT382: + * ? (FIXME: B&W only?) + * dxterm: + * ? + */ + switch (graphics_id) { + case 125: + case 241: + set_color_register(color_registers, 0, 0, 0, 0); + set_color_register(color_registers, 1, 0, 0, 100); + set_color_register(color_registers, 2, 0, 100, 0); + set_color_register(color_registers, 3, 100, 0, 0); + break; + case 240: + case 330: + set_color_register(color_registers, 0, 0, 0, 0); + set_color_register(color_registers, 1, 33, 33, 33); + set_color_register(color_registers, 2, 66, 66, 66); + set_color_register(color_registers, 3, 100, 100, 100); + break; + case 340: + default: + set_color_register(color_registers, 0, 0, 0, 0); + set_color_register(color_registers, 1, 20, 20, 80); + set_color_register(color_registers, 2, 80, 13, 13); + set_color_register(color_registers, 3, 20, 80, 20); + set_color_register(color_registers, 4, 80, 20, 80); + set_color_register(color_registers, 5, 20, 80, 80); + set_color_register(color_registers, 6, 80, 80, 20); + set_color_register(color_registers, 7, 53, 53, 53); + set_color_register(color_registers, 8, 26, 26, 26); + set_color_register(color_registers, 9, 33, 33, 60); + set_color_register(color_registers, 10, 60, 26, 26); + set_color_register(color_registers, 11, 33, 60, 33); + set_color_register(color_registers, 12, 60, 33, 60); + set_color_register(color_registers, 13, 33, 60, 60); + set_color_register(color_registers, 14, 60, 60, 33); + set_color_register(color_registers, 15, 80, 80, 80); + break; + case 382: /* FIXME: verify */ + set_color_register(color_registers, 0, 0, 0, 0); + set_color_register(color_registers, 1, 100, 100, 100); + break; + } + +#ifdef DEBUG_PALETTE + { + unsigned i; + + for (i = 0U; i < MAX_COLOR_REGISTERS; i++) { + TRACE(("initial value for register %03u: %d,%d,%d\n", + i, + color_registers[i].r, + color_registers[i].g, + color_registers[i].b)); + } + } +#endif +} + +unsigned +get_color_register_count(TScreen const *screen) +{ + unsigned num_color_registers; + + if (screen->numcolorregisters >= 0) { + num_color_registers = (unsigned) screen->numcolorregisters; + } else { + num_color_registers = 0U; + } + + if (num_color_registers > 1U) { + if (num_color_registers > MAX_COLOR_REGISTERS) + return MAX_COLOR_REGISTERS; + return num_color_registers; + } + + /* + * color capabilities: + * VK100/GIGI 1 plane (12x1 pixel attribute blocks) colorspace is 8 fixed colors (black, white, red, green, blue, cyan, yellow, magenta) + * VT125 2 planes (4 registers) colorspace is (64?) (color), ? (grayscale) + * VT240 2 planes (4 registers) colorspace is 4 shades (grayscale) + * VT241 2 planes (4 registers) colorspace is ? (color), ? shades (grayscale) + * VT330 2 planes (4 registers) colorspace is 4 shades (grayscale) + * VT340 4 planes (16 registers) colorspace is r16g16b16 (color), 16 shades (grayscale) + * VT382 1 plane (two fixed colors: black and white) FIXME: verify + * dxterm ? + */ + switch (screen->graphics_id) { + case 125: + return 4U; + case 240: + return 4U; + case 241: + return 4U; + case 330: + return 4U; + case 340: + return 16U; + case 382: + return 2U; + default: + /* unknown graphics model -- might as well be generous */ + return MAX_COLOR_REGISTERS; + } +} + +static void +init_graphic(Graphic *graphic, + unsigned type, + int graphics_id, + int charrow, + int charcol, + unsigned num_color_registers, + int private_colors) +{ + const unsigned max_pixels = (unsigned) (graphic->max_width * + graphic->max_height); + unsigned i; + + TRACE(("init_graphic at %d,%d\n", charrow, charcol)); + + graphic->hidden = 0; + graphic->dirty = 1; + for (i = 0U; i < max_pixels; i++) + graphic->pixels[i] = COLOR_HOLE; + memset(graphic->color_registers_used, 0, sizeof(graphic->color_registers_used)); + + /* + * text and graphics interactions: + * VK100/GIGI text writes on top of graphics buffer, color attribute shared with text + * VT240,VT241,VT330,VT340 text writes on top of graphics buffer + * VT382 text writes on top of graphics buffer FIXME: verify + * VT125 graphics buffer overlaid on top of text in B&W display, text not present in color display + */ + + /* + * dimensions (ReGIS logical, physical): + * VK100/GIGI 768x4?? 768x240(status?) + * VT125 768x460 768x230(+10status) (1:2 aspect ratio, ReGIS halves vertical addresses through "odd y emulation") + * VT240 800x460 800x230(+10status) (1:2 aspect ratio, ReGIS halves vertical addresses through "odd y emulation") + * VT241 800x460 800x230(+10status) (1:2 aspect ratio, ReGIS halves vertical addresses through "odd y emulation") + * VT330 800x480 800x480(+?status) + * VT340 800x480 800x480(+?status) + * VT382 960x750 sixel only + * dxterm ?x? ?x? variable? + */ + + graphic->actual_width = 0; + graphic->actual_height = 0; + + graphic->pixw = 1; + graphic->pixh = 1; + + graphic->valid_registers = num_color_registers; + TRACE(("%d color registers\n", graphic->valid_registers)); + + graphic->private_colors = private_colors; + if (graphic->private_colors) { + TRACE(("using private color registers\n")); + init_color_registers(graphic->private_color_registers, graphics_id); + graphic->color_registers = graphic->private_color_registers; + } else { + TRACE(("using shared color registers\n")); + graphic->color_registers = getSharedRegisters(); + } + + graphic->charrow = charrow; + graphic->charcol = charcol; + graphic->type = type; + graphic->valid = 0; +} + +Graphic * +get_new_graphic(XtermWidget xw, int charrow, int charcol, unsigned type) +{ + TScreen const *screen = TScreenOf(xw); + int bufferid = screen->whichBuf; + int graphics_id = GraphicsId(screen); + Graphic *graphic = NULL; + unsigned ii; + + FOR_EACH_SLOT(ii) { + if ((graphic = getInactiveSlot(screen, ii))) { + TRACE(("using fresh graphic index=%u id=%u\n", ii, next_graphic_id)); + break; + } + } + + /* if none are free, recycle the graphic scrolled back the farthest */ + if (!graphic) { + int min_charrow = 0; + Graphic *min_graphic = NULL; + + FOR_EACH_SLOT(ii) { + if (!(graphic = getActiveSlot(ii))) + continue; + if (!min_graphic || graphic->charrow < min_charrow) { + min_charrow = graphic->charrow; + min_graphic = graphic; + } + } + TRACE(("recycling old graphic index=%u id=%u\n", ii, next_graphic_id)); + graphic = min_graphic; + } + + if (graphic) { + unsigned num_color_registers; + num_color_registers = get_color_register_count(screen); + graphic->xw = xw; + graphic->bufferid = bufferid; + graphic->id = next_graphic_id++; + init_graphic(graphic, + type, + graphics_id, + charrow, + charcol, + num_color_registers, + screen->privatecolorregisters); + } + return graphic; +} + +Graphic * +get_new_or_matching_graphic(XtermWidget xw, + int charrow, + int charcol, + int actual_width, + int actual_height, + unsigned type) +{ + TScreen const *screen = TScreenOf(xw); + int bufferid = screen->whichBuf; + Graphic *graphic; + unsigned ii; + + FOR_EACH_SLOT(ii) { + TRACE(("checking slot=%u for graphic at %d,%d %dx%d bufferid=%d type=%u\n", ii, + charrow, charcol, + actual_width, actual_height, + bufferid, type)); + if ((graphic = getActiveSlot(ii))) { + if (graphic->type == type && + graphic->bufferid == bufferid && + graphic->charrow == charrow && + graphic->charcol == charcol && + graphic->actual_width == actual_width && + graphic->actual_height == actual_height) { + TRACE(("found existing graphic slot=%u id=%u\n", ii, graphic->id)); + return graphic; + } + TRACE(("not a match: graphic at %d,%d %dx%d bufferid=%d type=%u\n", + graphic->charrow, graphic->charcol, + graphic->actual_width, graphic->actual_height, + graphic->bufferid, graphic->type)); + } + } + + /* if no match get a new graphic */ + if ((graphic = get_new_graphic(xw, charrow, charcol, type))) { + graphic->actual_width = actual_width; + graphic->actual_height = actual_height; + TRACE(("no match; created graphic at %d,%d %dx%d bufferid=%d type=%u\n", + graphic->charrow, graphic->charcol, + graphic->actual_width, graphic->actual_height, + graphic->bufferid, graphic->type)); + } + return graphic; +} + +#define ScaleForXColor(s) (unsigned short) ((long)(s) * 65535 / CHANNEL_MAX) + +static int +save_allocated_color(const ColorRegister *reg, XtermWidget xw, Pixel *pix) +{ + unsigned const rr = ((unsigned) reg->r * (LOOKUP_WIDTH - 1)) / CHANNEL_MAX; + unsigned const gg = ((unsigned) reg->g * (LOOKUP_WIDTH - 1)) / CHANNEL_MAX; + unsigned const bb = ((unsigned) reg->b * (LOOKUP_WIDTH - 1)) / CHANNEL_MAX; + XColor xcolor; + AllocatedColorRegister *new_color; + + xcolor.pixel = 0UL; + xcolor.red = ScaleForXColor(reg->r); + xcolor.green = ScaleForXColor(reg->g); + xcolor.blue = ScaleForXColor(reg->b); + xcolor.flags = DoRed | DoGreen | DoBlue; + if (!allocateBestRGB(xw, &xcolor)) { + TRACE(("unable to allocate xcolor\n")); + *pix = 0UL; + return 0; + } else { + *pix = xcolor.pixel; + + if (!(new_color = malloc(sizeof(*new_color)))) { + TRACE(("unable to save pixel %lu\n", (unsigned long) *pix)); + return 0; + } else { + new_color->r = reg->r; + new_color->g = reg->g; + new_color->b = reg->b; + new_color->pix = *pix; + new_color->next = allocated_colors[rr][gg][bb]; + + allocated_colors[rr][gg][bb] = new_color; + + return 1; + } + } +} + +/* FIXME: with so many possible colors we need to determine + * when to free them to be nice to PseudoColor displays + */ +static Pixel +color_register_to_xpixel(const ColorRegister *reg, XtermWidget xw) +{ + Pixel result; + unsigned const rr = ((unsigned) reg->r * (LOOKUP_WIDTH - 1)) / CHANNEL_MAX; + unsigned const gg = ((unsigned) reg->g * (LOOKUP_WIDTH - 1)) / CHANNEL_MAX; + unsigned const bb = ((unsigned) reg->b * (LOOKUP_WIDTH - 1)) / CHANNEL_MAX; + const AllocatedColorRegister *search; + + for (search = allocated_colors[rr][gg][bb]; search; search = search->next) { + if (search->r == reg->r && + search->g == reg->g && + search->b == reg->b) { + return search->pix; + } + } + + save_allocated_color(reg, xw, &result); + return result; +} + +static void +refresh_graphic(TScreen const *screen, + Graphic const *graphic, + ColorRegister *buffer, + int refresh_x, + int refresh_y, + int refresh_w, + int refresh_h, + int draw_x, + int draw_y, + int draw_w, + int draw_h) +{ + int const pw = graphic->pixw; + int const ph = graphic->pixh; + int const graph_x = graphic->charcol * FontWidth(screen); + int const graph_y = graphic->charrow * FontHeight(screen); + int const graph_w = graphic->actual_width; + int const graph_h = graphic->actual_height; + int const mw = graphic->max_width; + int r, c; + int holes, total, out_of_range; + RegisterNum regnum; + + TRACE(("refreshing graphic %u from %d,%d %dx%d (valid=%d, size=%dx%d, scale=%dx%d max=%dx%d)\n", + graphic->id, + graph_x, graph_y, draw_w, draw_h, + graphic->valid, + graphic->actual_width, + graphic->actual_height, + pw, ph, + graphic->max_width, + graphic->max_height)); + + TRACE(("refresh pixmap starts at %d,%d\n", refresh_x, refresh_y)); + + holes = total = 0; + out_of_range = 0; + for (r = 0; r < graph_h; r++) { + int pmy = graph_y + r * ph; + + if (pmy + ph - 1 < draw_y) + continue; + if (pmy > draw_y + draw_h - 1) + break; + + if (pmy < draw_y || pmy > draw_y + draw_h - 1 || + pmy < refresh_y || pmy > refresh_y + refresh_h - 1) { + out_of_range++; + continue; + } + + for (c = 0; c < graph_w; c++) { + int pmx = graph_x + c * pw; + + if (pmx + pw - 1 < draw_x) + continue; + if (pmx > draw_x + draw_w - 1) + break; + + if (pmx < draw_x || pmx > draw_x + draw_w - 1 || + pmx < refresh_x || pmx > refresh_x + refresh_w - 1) { + out_of_range++; + continue; + } + + total++; + regnum = graphic->pixels[r * mw + c]; + if (regnum == COLOR_HOLE) { + holes++; + } else { + buffer[(pmy - refresh_y) * refresh_w + + (pmx - refresh_x)] = + graphic->color_registers[regnum]; + } + } + } + + TRACE(("done refreshing graphic: %d of %d refreshed pixels were holes; %d were out of pixmap range\n", + holes, total, out_of_range)); +} + +#ifdef DEBUG_REFRESH + +#define BASEX(X) ( (draw_x - base_x) + (X) ) +#define BASEY(Y) ( (draw_y - base_y) + (Y) ) + +static void +outline_refresh(TScreen const *screen, + Graphic const *graphic, + Pixmap output_pm, + GC graphics_gc, + int base_x, + int base_y, + int draw_x, + int draw_y, + int draw_w, + int draw_h) +{ + Display *const display = screen->display; + int const pw = graphic->pixw; + int const ph = graphic->pixh; + XGCValues xgcv; + XColor def; + + def.red = (unsigned short) ((1.0 - 0.1 * (rand() / (double) + RAND_MAX) * 65535.0)); + def.green = (unsigned short) ((0.7 + 0.2 * (rand() / (double) + RAND_MAX)) * 65535.0); + def.blue = (unsigned short) ((0.1 + 0.1 * (rand() / (double) + RAND_MAX)) * 65535.0); + def.flags = DoRed | DoGreen | DoBlue; + if (allocateBestRGB(graphic->xw, &def)) { + xgcv.foreground = def.pixel; + XChangeGC(display, graphics_gc, GCForeground, &xgcv); + } + + XDrawLine(display, output_pm, graphics_gc, + BASEX(0), BASEY(0), + BASEX(draw_w - 1), BASEY(0)); + XDrawLine(display, output_pm, graphics_gc, + BASEX(0), BASEY(draw_h - 1), + BASEX(draw_w - 1), BASEY(draw_h - 1)); + + XDrawLine(display, output_pm, graphics_gc, + BASEX(0), BASEY(0), + BASEX(0), BASEY(draw_h - 1)); + XDrawLine(display, output_pm, graphics_gc, + BASEX(draw_w - 1), BASEY(0), + BASEX(draw_w - 1), BASEY(draw_h - 1)); + + XDrawLine(display, output_pm, graphics_gc, + BASEX(draw_w - 1), BASEY(0), + BASEX(0), BASEY(draw_h - 1)); + XDrawLine(display, output_pm, graphics_gc, + BASEX(draw_w - 1), BASEY(draw_h - 1), + BASEX(0), BASEY(0)); + + def.red = (short) (0.7 * 65535.0); + def.green = (short) (0.1 * 65535.0); + def.blue = (short) (1.0 * 65535.0); + def.flags = DoRed | DoGreen | DoBlue; + if (allocateBestRGB(graphic->xw, &def)) { + xgcv.foreground = def.pixel; + XChangeGC(display, graphics_gc, GCForeground, &xgcv); + } + XFillRectangle(display, output_pm, graphics_gc, + BASEX(0), + BASEY(0), + (unsigned) pw, (unsigned) ph); + XFillRectangle(display, output_pm, graphics_gc, + BASEX(draw_w - 1 - pw), + BASEY(draw_h - 1 - ph), + (unsigned) pw, (unsigned) ph); +} +#endif + +/* + * Primary color hues: + * blue: 0 degrees + * red: 120 degrees + * green: 240 degrees + */ +void +hls2rgb(int h, int l, int s, short *r, short *g, short *b) +{ + const int hs = ((h + 240) / 60) % 6; + const double lv = l / 100.0; + const double sv = s / 100.0; + double c, x, m, c2; + double r1, g1, b1; + + if (s == 0) { + *r = *g = *b = (short) l; + return; + } + + c2 = (2.0 * lv) - 1.0; + if (c2 < 0.0) + c2 = -c2; + c = (1.0 - c2) * sv; + x = (hs & 1) ? c : 0.0; + m = lv - 0.5 * c; + + switch (hs) { + case 0: + r1 = c; + g1 = x; + b1 = 0.0; + break; + case 1: + r1 = x; + g1 = c; + b1 = 0.0; + break; + case 2: + r1 = 0.0; + g1 = c; + b1 = x; + break; + case 3: + r1 = 0.0; + g1 = x; + b1 = c; + break; + case 4: + r1 = x; + g1 = 0.0; + b1 = c; + break; + case 5: + r1 = c; + g1 = 0.0; + b1 = x; + break; + default: + TRACE(("Bad HLS input: [%d,%d,%d], returning white\n", h, l, s)); + *r = (short) 100; + *g = (short) 100; + *b = (short) 100; + return; + } + + *r = (short) ((r1 + m) * 100.0 + 0.5); + *g = (short) ((g1 + m) * 100.0 + 0.5); + *b = (short) ((b1 + m) * 100.0 + 0.5); + + if (*r < 0) + *r = 0; + else if (*r > 100) + *r = 100; + if (*g < 0) + *g = 0; + else if (*g > 100) + *g = 100; + if (*b < 0) + *b = 0; + else if (*b > 100) + *b = 100; +} + +void +dump_graphic(Graphic const *graphic) +{ +#if defined(DUMP_COLORS) || defined(DUMP_BITMAP) + RegisterNum color; +#endif +#ifdef DUMP_BITMAP + int r, c; + ColorRegister const *reg; +#endif + + (void) graphic; + + TRACE(("graphic stats: id=%u charrow=%d charcol=%d actual_width=%d actual_height=%d pixw=%d pixh=%d\n", + graphic->id, + graphic->charrow, + graphic->charcol, + graphic->actual_width, + graphic->actual_height, + graphic->pixw, + graphic->pixh)); + +#ifdef DUMP_COLORS + TRACE(("graphic colors:\n")); + for (color = 0; color < graphic->valid_registers; color++) { + TRACE(("%03u: %d,%d,%d\n", + color, + graphic->color_registers[color].r, + graphic->color_registers[color].g, + graphic->color_registers[color].b)); + } +#endif + +#ifdef DUMP_BITMAP + TRACE(("graphic pixels:\n")); + for (r = 0; r < graphic->actual_height; r++) { + for (c = 0; c < graphic->actual_width; c++) { + color = graphic->pixels[r * graphic->max_width + c]; + if (color == COLOR_HOLE) { + TRACE(("?")); + } else { + reg = &graphic->color_registers[color]; + if (reg->r + reg->g + reg->b > 200) { + TRACE(("#")); + } else if (reg->r + reg->g + reg->b > 150) { + TRACE(("%%")); + } else if (reg->r + reg->g + reg->b > 100) { + TRACE((":")); + } else if (reg->r + reg->g + reg->b > 80) { + TRACE((".")); + } else { + TRACE((" ")); + } + } + } + TRACE(("\n")); + } + + TRACE(("\n")); +#endif +} + +/* Erase the portion of any displayed graphic overlapping with a rectangle + * of the given size and location in pixels relative to the start of the + * graphic. This is used to allow text to "erase" graphics underneath it. + */ +static void +erase_graphic(Graphic *graphic, int x, int y, int w, int h) +{ + RegisterNum hole = COLOR_HOLE; + int pw, ph; + int r, c; + int rbase, cbase; + + pw = graphic->pixw; + ph = graphic->pixh; + + TRACE(("erasing graphic %d,%d %dx%d\n", x, y, w, h)); + + rbase = 0; + for (r = 0; r < graphic->actual_height; r++) { + if (rbase + ph - 1 >= y + && rbase <= y + h - 1) { + cbase = 0; + for (c = 0; c < graphic->actual_width; c++) { + if (cbase + pw - 1 >= x + && cbase <= x + w - 1) { + graphic->pixels[r * graphic->max_width + c] = hole; + } + cbase += pw; + } + } + rbase += ph; + } +} + +static int +compare_graphic_ids(const void *left, const void *right) +{ + const Graphic *l = *(const Graphic *const *) left; + const Graphic *r = *(const Graphic *const *) right; + + if (!l->valid || !r->valid) + return 0; + + if (l->bufferid < r->bufferid) + return -1; + else if (l->bufferid > r->bufferid) + return 1; + + if (l->id < r->id) + return -1; + else + return 1; +} + +static void +clip_area(int *orig_x, int *orig_y, int *orig_w, int *orig_h, + int clip_x, int clip_y, int clip_w, int clip_h) +{ + if (*orig_x < clip_x) { + const int diff = clip_x - *orig_x; + *orig_x += diff; + *orig_w -= diff; + } + if (*orig_w > 0 && *orig_x + *orig_w > clip_x + clip_w) { + *orig_w -= (*orig_x + *orig_w) - (clip_x + clip_w); + } + + if (*orig_y < clip_y) { + const int diff = clip_y - *orig_y; + *orig_y += diff; + *orig_h -= diff; + } + if (*orig_h > 0 && *orig_y + *orig_h > clip_y + clip_h) { + *orig_h -= (*orig_y + *orig_h) - (clip_y + clip_h); + } +} + +/* the coordinates are relative to the screen */ +static void +refresh_graphics(XtermWidget xw, + int leftcol, + int toprow, + int ncols, + int nrows, + int skip_clean) +{ + TScreen *const screen = TScreenOf(xw); + Display *const display = screen->display; + Window const drawable = VDrawable(screen); + int const scroll_y = screen->topline * FontHeight(screen); + int const refresh_x = leftcol * FontWidth(screen); + int const refresh_y = toprow * FontHeight(screen) + scroll_y; + int const refresh_w = ncols * FontWidth(screen); + int const refresh_h = nrows * FontHeight(screen); + int draw_x_min, draw_x_max; + int draw_y_min, draw_y_max; + Graphic *ordered_graphics[MAX_GRAPHICS]; + unsigned ii, jj; + unsigned active_count; + unsigned holes, non_holes; + int xx, yy; + ColorRegister *buffer; + + active_count = 0; + FOR_EACH_SLOT(ii) { + Graphic *graphic; + if (!(graphic = getActiveSlot(ii))) + continue; + TRACE(("refreshing graphic %d on buffer %d, current buffer %d\n", + graphic->id, graphic->bufferid, screen->whichBuf)); + if (screen->whichBuf == 0) { + if (graphic->bufferid != 0) { + TRACE(("skipping graphic %d from alt buffer (%d) when drawing screen=%d\n", + graphic->id, graphic->bufferid, screen->whichBuf)); + continue; + } + } else { + if (graphic->bufferid == 0 && graphic->charrow >= 0) { + TRACE(("skipping graphic %d from normal buffer (%d) when drawing screen=%d because it is not in scrollback area\n", + graphic->id, graphic->bufferid, screen->whichBuf)); + continue; + } + if (graphic->bufferid == 1 && + graphic->charrow + (graphic->actual_height + + FontHeight(screen) - 1) / + FontHeight(screen) < 0) { + TRACE(("skipping graphic %d from alt buffer (%d) when drawing screen=%d because it is completely in scrollback area\n", + graphic->id, graphic->bufferid, screen->whichBuf)); + continue; + } + } + if (graphic->hidden) + continue; + ordered_graphics[active_count++] = graphic; + } + + if (active_count == 0) + return; + if (active_count > 1) { + qsort(ordered_graphics, + (size_t) active_count, + sizeof(ordered_graphics[0]), + compare_graphic_ids); + } + + if (skip_clean) { + unsigned skip_count; + + for (jj = 0; jj < active_count; ++jj) { + if (ordered_graphics[jj]->dirty) + break; + } + skip_count = jj; + if (skip_count == active_count) + return; + + active_count -= skip_count; + for (jj = 0; jj < active_count; ++jj) { + ordered_graphics[jj] = ordered_graphics[jj + skip_count]; + } + } + + if (!(buffer = malloc(sizeof(*buffer) * + (unsigned) refresh_w * (unsigned) refresh_h))) { + TRACE(("unable to allocate %dx%d buffer for graphics refresh\n", + refresh_w, refresh_h)); + return; + } + for (yy = 0; yy < refresh_h; yy++) { + for (xx = 0; xx < refresh_w; xx++) { + buffer[yy * refresh_w + xx] = null_color; + } + } + + TRACE(("refresh: screen->topline=%d leftcol=%d toprow=%d nrows=%d ncols=%d (%d,%d %dx%d)\n", + screen->topline, + leftcol, toprow, + nrows, ncols, + refresh_x, refresh_y, + refresh_w, refresh_h)); + + { + int const altarea_x = 0; + int const altarea_y = 0; + int const altarea_w = Width(screen) * FontWidth(screen); + int const altarea_h = Height(screen) * FontHeight(screen); + + int const scrollarea_x = 0; + int const scrollarea_y = scroll_y; + int const scrollarea_w = Width(screen) * FontWidth(screen); + int const scrollarea_h = -scroll_y; + + int const mainarea_x = 0; + int const mainarea_y = scroll_y; + int const mainarea_w = Width(screen) * FontWidth(screen); + int const mainarea_h = -scroll_y + Height(screen) * FontHeight(screen); + + draw_x_min = refresh_x + refresh_w; + draw_x_max = refresh_x - 1; + draw_y_min = refresh_y + refresh_h; + draw_y_max = refresh_y - 1; + for (jj = 0; jj < active_count; ++jj) { + Graphic *graphic = ordered_graphics[jj]; + int draw_x = graphic->charcol * FontWidth(screen); + int draw_y = graphic->charrow * FontHeight(screen); + int draw_w = graphic->actual_width; + int draw_h = graphic->actual_height; + + if (screen->whichBuf != 0) { + if (graphic->bufferid != 0) { + /* clip to alt buffer */ + clip_area(&draw_x, &draw_y, &draw_w, &draw_h, + altarea_x, altarea_y, altarea_w, altarea_h); + } else { + /* clip to scrollback area */ + clip_area(&draw_x, &draw_y, &draw_w, &draw_h, + scrollarea_x, scrollarea_y, + scrollarea_w, scrollarea_h); + } + } else { + /* clip to scrollback + normal area */ + clip_area(&draw_x, &draw_y, &draw_w, &draw_h, + mainarea_x, mainarea_y, + mainarea_w, mainarea_h); + } + + clip_area(&draw_x, &draw_y, &draw_w, &draw_h, + refresh_x, refresh_y, refresh_w, refresh_h); + + TRACE(("refresh: graph=%u\n", jj)); + TRACE((" refresh_x=%d refresh_y=%d refresh_w=%d refresh_h=%d\n", + refresh_x, refresh_y, refresh_w, refresh_h)); + TRACE((" draw_x=%d draw_y=%d draw_w=%d draw_h=%d\n", + draw_x, draw_y, draw_w, draw_h)); + + if (draw_w > 0 && draw_h > 0) { + refresh_graphic(screen, graphic, buffer, + refresh_x, refresh_y, + refresh_w, refresh_h, + draw_x, draw_y, + draw_w, draw_h); + if (draw_x < draw_x_min) + draw_x_min = draw_x; + if (draw_x + draw_w - 1 > draw_x_max) + draw_x_max = draw_x + draw_w - 1; + if (draw_y < draw_y_min) + draw_y_min = draw_y; + if (draw_y + draw_h - 1 > draw_y_max) + draw_y_max = draw_y + draw_h - 1; + } + graphic->dirty = 0; + } + } + + if (draw_x_max < refresh_x || + draw_x_min > refresh_x + refresh_w - 1 || + draw_y_max < refresh_y || + draw_y_min > refresh_y + refresh_h - 1) { + free(buffer); + return; + } + + holes = 0U; + non_holes = 0U; + { + int y_min = draw_y_min - refresh_y; + int y_max = draw_y_max - refresh_y; + int x_min = draw_x_min - refresh_x; + int x_max = draw_x_max - refresh_x; + const ColorRegister *base = buffer + (y_min * refresh_w); + + for (yy = y_min; yy <= y_max; yy++) { + const ColorRegister *scan = base + x_min; + for (xx = x_min; xx <= x_max; xx++) { + if (scan->r < 0 || scan->g < 0 || scan->b < 0) { + holes++; + } else { + non_holes++; + } + ++scan; + } + base += refresh_w; + } + } + + if (non_holes < 1U) { + TRACE(("refresh: visible graphics areas are erased; nothing to do\n")); + free(buffer); + return; + } + + /* + * If we have any holes we can't just copy an image rectangle, and masking + * with bitmaps is very expensive. This fallback is surprisingly faster + * than the XPutImage version in some cases, but I don't know why. + * (This is even though there's no X11 primitive for drawing a horizontal + * line of height one and no attempt is made to handle multiple lines at + * once.) + */ + if (holes > 0U) { + GC graphics_gc; + XGCValues xgcv; + ColorRegister last_color; + ColorRegister gc_color; + int run; + + memset(&xgcv, 0, sizeof(xgcv)); + xgcv.graphics_exposures = False; + graphics_gc = XCreateGC(display, drawable, GCGraphicsExposures, &xgcv); + if (graphics_gc == None) { + TRACE(("unable to allocate GC for graphics refresh\n")); + free(buffer); + return; + } + + last_color = null_color; + gc_color = null_color; + run = 0; + for (yy = draw_y_min - refresh_y; yy <= draw_y_max - refresh_y; yy++) { + for (xx = draw_x_min - refresh_x; xx <= draw_x_max - refresh_x; + xx++) { + const ColorRegister color = buffer[yy * refresh_w + xx]; + + if (color.r < 0 || color.g < 0 || color.b < 0) { + last_color = color; + if (run > 0) { + XDrawLine(display, drawable, graphics_gc, + OriginX(screen) + refresh_x + xx - run, + (OriginY(screen) - scroll_y) + refresh_y + yy, + OriginX(screen) + refresh_x + xx - 1, + (OriginY(screen) - scroll_y) + refresh_y + yy); + run = 0; + } + continue; + } + + if (DiffColor(color, last_color)) { + last_color = color; + if (run > 0) { + XDrawLine(display, drawable, graphics_gc, + OriginX(screen) + refresh_x + xx - run, + (OriginY(screen) - scroll_y) + refresh_y + yy, + OriginX(screen) + refresh_x + xx - 1, + (OriginY(screen) - scroll_y) + refresh_y + yy); + run = 0; + } + + if (DiffColor(color, gc_color)) { + xgcv.foreground = + color_register_to_xpixel(&color, xw); + XChangeGC(display, graphics_gc, GCForeground, &xgcv); + gc_color = color; + } + } + run++; + } + if (run > 0) { + last_color = null_color; + XDrawLine(display, drawable, graphics_gc, + OriginX(screen) + refresh_x + xx - run, + (OriginY(screen) - scroll_y) + refresh_y + yy, + OriginX(screen) + refresh_x + xx - 1, + (OriginY(screen) - scroll_y) + refresh_y + yy); + run = 0; + } + } + + XFreeGC(display, graphics_gc); + } else { + XGCValues xgcv; + GC graphics_gc; + ColorRegister old_colors[2]; + Pixel fg, old_result[2]; + XImage *image; + char *imgdata; + unsigned image_w, image_h; + int nn; + + memset(&xgcv, 0, sizeof(xgcv)); + xgcv.graphics_exposures = False; + graphics_gc = XCreateGC(display, drawable, GCGraphicsExposures, &xgcv); + if (graphics_gc == None) { + TRACE(("unable to allocate GC for graphics refresh\n")); + free(buffer); + return; + } + + /* FIXME: is it worth reusing the GC/Image/imagedata across calls? */ + /* FIXME: is it worth using shared memory when available? */ + image_w = (unsigned) draw_x_max + 1U - (unsigned) draw_x_min; + image_h = (unsigned) draw_y_max + 1U - (unsigned) draw_y_min; + image = XCreateImage(display, xw->visInfo->visual, + (unsigned) xw->visInfo->depth, + ZPixmap, 0, NULL, + image_w, image_h, + (int) (sizeof(int) * 8U), 0); + if (!image) { + TRACE(("unable to allocate XImage for graphics refresh\n")); + XFreeGC(display, graphics_gc); + free(buffer); + return; + } + imgdata = malloc((size_t) (image_h * (unsigned) image->bytes_per_line)); + if (!imgdata) { + TRACE(("unable to allocate XImage for graphics refresh\n")); + XDestroyImage(image); + XFreeGC(display, graphics_gc); + free(buffer); + return; + } + image->data = imgdata; + + fg = 0U; + nn = 0; + + /* two-level cache cuts down on lookup-calls */ + old_result[0] = 0U; + old_result[1] = 0U; + old_colors[0] = null_color; + old_colors[1] = null_color; + + for (yy = draw_y_min - refresh_y; yy <= draw_y_max - refresh_y; yy++) { + for (xx = draw_x_min - refresh_x; xx <= draw_x_max - refresh_x; + xx++) { + const ColorRegister color = buffer[yy * refresh_w + xx]; + + if (DiffColor(color, old_colors[nn])) { + if (DiffColor(color, old_colors[!nn])) { + nn = !nn; + fg = color_register_to_xpixel(&color, xw); + old_result[nn] = fg; + old_colors[nn] = color; + } else { + nn = !nn; + fg = old_result[nn]; + } + } + + XPutPixel(image, + xx + refresh_x - draw_x_min, + yy + refresh_y - draw_y_min, fg); + } + } + + XPutImage(display, drawable, graphics_gc, image, + 0, 0, + OriginX(screen) + draw_x_min, + (OriginY(screen) - scroll_y) + draw_y_min, + image_w, image_h); + free(imgdata); + image->data = NULL; + XDestroyImage(image); + XFreeGC(display, graphics_gc); + } + + free(buffer); + XFlush(display); +} + +void +refresh_displayed_graphics(XtermWidget xw, + int leftcol, + int toprow, + int ncols, + int nrows) +{ + refresh_graphics(xw, leftcol, toprow, ncols, nrows, 0); +} + +void +refresh_modified_displayed_graphics(XtermWidget xw) +{ + TScreen const *screen = TScreenOf(xw); + refresh_graphics(xw, 0, 0, MaxCols(screen), MaxRows(screen), 1); +} + +void +scroll_displayed_graphics(XtermWidget xw, int rows) +{ + if (used_graphics) { + TScreen const *screen = TScreenOf(xw); + unsigned ii; + + TRACE(("graphics scroll: moving all up %d rows\n", rows)); + /* FIXME: VT125 ReGIS graphics are fixed at the upper left of the display; need to verify */ + + FOR_EACH_SLOT(ii) { + Graphic *graphic; + + if (!(graphic = getActiveSlot(ii))) + continue; + if (graphic->bufferid != screen->whichBuf) + continue; + if (graphic->hidden) + continue; + + graphic->charrow -= rows; + } + } +} + +void +pixelarea_clear_displayed_graphics(TScreen const *screen, + int winx, + int winy, + int w, + int h) +{ + unsigned ii; + + if (!used_graphics) + return; + + FOR_EACH_SLOT(ii) { + Graphic *graphic; + /* FIXME: are these coordinates (scrolled) screen-relative? */ + int const scroll_y = (screen->whichBuf == 0 + ? screen->topline * FontHeight(screen) + : 0); + int graph_x; + int graph_y; + int x, y; + + if (!(graphic = getActiveSlot(ii))) + continue; + if (graphic->bufferid != screen->whichBuf) + continue; + if (graphic->hidden) + continue; + + graph_x = graphic->charcol * FontWidth(screen); + graph_y = graphic->charrow * FontHeight(screen); + x = winx - graph_x; + y = (winy - scroll_y) - graph_y; + + TRACE(("pixelarea clear graphics: screen->topline=%d winx=%d winy=%d w=%d h=%d x=%d y=%d\n", + screen->topline, + winx, winy, + w, h, + x, y)); + erase_graphic(graphic, x, y, w, h); + } +} + +void +chararea_clear_displayed_graphics(TScreen const *screen, + int leftcol, + int toprow, + int ncols, + int nrows) +{ + if (used_graphics) { + int const x = leftcol * FontWidth(screen); + int const y = toprow * FontHeight(screen); + int const w = ncols * FontWidth(screen); + int const h = nrows * FontHeight(screen); + + TRACE(("chararea clear graphics: screen->topline=%d leftcol=%d toprow=%d nrows=%d ncols=%d x=%d y=%d w=%d h=%d\n", + screen->topline, + leftcol, toprow, + nrows, ncols, + x, y, w, h)); + pixelarea_clear_displayed_graphics(screen, x, y, w, h); + } +} + +void +reset_displayed_graphics(TScreen const *screen) +{ + init_color_registers(getSharedRegisters(), GraphicsId(screen)); + + if (used_graphics) { + unsigned ii; + + TRACE(("resetting all graphics\n")); + FOR_EACH_SLOT(ii) { + deactivateSlot(ii); + } + } +} + +#ifdef NO_LEAKS +void +noleaks_graphics(void) +{ + unsigned ii; + + FOR_EACH_SLOT(ii) { + deactivateSlot(ii); + } +} +#endif diff --git a/ports/xterm/xterm-359/graphics.h b/ports/xterm/xterm-359/graphics.h new file mode 100644 index 0000000..90bedf4 --- /dev/null +++ b/ports/xterm/xterm-359/graphics.h @@ -0,0 +1,127 @@ +/* $XTermId: graphics.h,v 1.23 2016/05/29 16:11:41 tom Exp $ */ + +/* + * Copyright 2013-2015,2016 by Ross Combs + * Copyright 2013-2015,2016 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#ifndef included_graphics_h +#define included_graphics_h +/* *INDENT-OFF* */ + +#include + +#if OPT_GRAPHICS + +#define CHANNEL_MAX 100 + +typedef struct { + short r, g, b; +} ColorRegister; + +typedef unsigned short RegisterNum; + +#define MAX_COLOR_REGISTERS 1024U +#define COLOR_HOLE ((RegisterNum)MAX_COLOR_REGISTERS) + +#define MAX_GRAPHICS 16U + +typedef struct { + RegisterNum *pixels; + ColorRegister *private_color_registers; + ColorRegister *color_registers; + char color_registers_used[MAX_COLOR_REGISTERS]; + XtermWidget xw; + int max_width; /* largest image which can be stored */ + int max_height; /* largest image which can be stored */ + unsigned valid_registers; /* for wrap-around behavior */ + int actual_width; /* size of image before scaling */ + int actual_height; /* size of image before scaling */ + int private_colors; /* if not using the shared color registers */ + int charrow; /* upper left starting point in characters */ + int charcol; /* upper left starting point in characters */ + int pixw; /* width of graphic pixels in screen pixels */ + int pixh; /* height of graphic pixels in screen pixels */ + int bufferid; /* which screen buffer the graphic is associated with */ + unsigned type; /* type of graphic 0==sixel, 1...NUM_REGIS_PAGES==ReGIS page */ + unsigned id; /* sequential id used for preserving layering */ + int valid; /* if the graphic has been initialized */ + int dirty; /* if the graphic needs to be redrawn */ + int hidden; /* if the graphic should not be displayed */ +} Graphic; + +extern Graphic *get_new_graphic(XtermWidget /* xw */, int /* charrow */, int /* charcol */, unsigned /* type */); +extern Graphic *get_new_or_matching_graphic(XtermWidget /* xw */, int /* charrow */, int /* charcol */, int /* actual_width */, int /* actual_height */, unsigned /* type */); +extern RegisterNum read_pixel(Graphic */* graphic */, int /* x */, int /* y */); +extern void draw_solid_pixel(Graphic */* graphic */, int /* x */, int /* y */, unsigned /* color */); +extern void draw_solid_rectangle(Graphic */* graphic */, int /* x1 */, int /* y1 */, int /* x2 */, int /* y2 */, unsigned /* color */); +extern void draw_solid_line(Graphic */* graphic */, int /* x1 */, int /* y1 */, int /* x2 */, int /* y2 */, unsigned /* color */); +extern void copy_overlapping_area(Graphic */* graphic */, int /* src_x */, int /* src_y */, int /* dst_x */, int /* dst_y */, unsigned /* w */, unsigned /* h */, unsigned /* default_color */); +extern void hls2rgb(int /* h */, int /* l */, int /* s */, short */* r */, short */* g */, short */* b */); +extern void dump_graphic(Graphic const */* graphic */); +extern unsigned get_color_register_count(TScreen const */* screen */); +extern void update_color_register(Graphic */* graphic */, unsigned /* color */, int /* r */, int /* g */, int /* b */); +extern RegisterNum find_color_register(ColorRegister const */* color_registers */, int /* r */, int /* g */, int /* b */); +extern void chararea_clear_displayed_graphics(TScreen const */* screen */, int /* leftcol */, int /* toprow */, int /* ncols */, int /* nrows */); +extern void pixelarea_clear_displayed_graphics(TScreen const */* screen */, int /* winx */, int /* winy */, int /* w */, int /* h */); +extern void refresh_displayed_graphics(XtermWidget /* xw */, int /* leftcol */, int /* toprow */, int /* ncols */, int /* nrows */); +extern void refresh_modified_displayed_graphics(XtermWidget /* xw */); +extern void reset_displayed_graphics(TScreen const */* screen */); +extern void scroll_displayed_graphics(XtermWidget /* xw */, int /* rows */); + +#ifdef NO_LEAKS +extern void noleaks_graphics(void); +#endif + +#else + +#define get_new_graphic(xw, charrow, charcol, type) /* nothing */ +#define get_new_or_matching_graphic(xw, charrow, charcol, actual_width, actual_height, type) /* nothing */ +#define read_pixel(graphic, x, y) /* nothing */ +#define draw_solid_pixel(graphic, x, y, color) /* nothing */ +#define draw_solid_rectangle(graphic, x1, y1, x2, y2, color) /* nothing */ +#define draw_solid_line(graphic, x1, y1, x2, y2, color) /* nothing */ +#define copy_overlapping_area(graphic, src_x, src_y, dst_x, dst_y, w, h, default_color) /* nothing */ +#define hls2rgb(h, l, s, r, g, b) /* nothing */ +#define dump_graphic(graphic) /* nothing */ +#define get_color_register_count(screen) /* nothing */ +#define update_color_register(graphic, color, r, g, b) /* nothing */ +#define find_color_register(color_registers, r, g, b) /* nothing */ +#define chararea_clear_displayed_graphics(screen, leftcol, toprow, ncols, nrows) /* nothing */ +#define pixelarea_clear_displayed_graphics(screen, winx, winy, w, h) /* nothing */ +#define refresh_displayed_graphics(xw, leftcol, toprow, ncols, nrows) /* nothing */ +#define refresh_modified_displayed_graphics(xw) /* nothing */ +#define reset_displayed_graphics(screen) /* nothing */ +#define scroll_displayed_graphics(xw, rows) /* nothing */ + +#endif + +/* *INDENT-ON* */ + +#endif /* included_graphics_h */ diff --git a/ports/xterm/xterm-359/graphics.o b/ports/xterm/xterm-359/graphics.o new file mode 100644 index 0000000..82e2b40 Binary files /dev/null and b/ports/xterm/xterm-359/graphics.o differ diff --git a/ports/xterm/xterm-359/graphics_regis.c b/ports/xterm/xterm-359/graphics_regis.c new file mode 100644 index 0000000..f942e72 --- /dev/null +++ b/ports/xterm/xterm-359/graphics_regis.c @@ -0,0 +1,7520 @@ +/* $XTermId: graphics_regis.c,v 1.121 2020/08/04 00:46:08 tom Exp $ */ + +/* + * Copyright 2014-2019,2020 by Ross Combs + * Copyright 2014-2019,2020 by Thomas E. Dickey + * + * All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the + * sale, use or other dealings in this Software without prior written + * authorization. + */ + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +/* get rid of shadowing warnings (we will not draw Bessel functions) */ +#define y1 my_y1 +#define y0 my_y0 + +#define SCALE_FIXED_POINT 16U + +#undef DEBUG_PARSING +#undef DEBUG_ALPHABET_LOOKUP +#undef DEBUG_ALPHABETS +#undef DEBUG_BEZIER +#undef DEBUG_SPLINE_SEGMENTS +#undef DEBUG_SPLINE_POINTS +#undef DEBUG_SPLINE_WITH_ROTATION +#undef DEBUG_SPLINE_WITH_OVERDRAW +#undef DEBUG_ARC_POINTS +#undef DEBUG_ARC_CENTER +#undef DEBUG_ARC_START +#undef DEBUG_ARC_END +#undef DEBUG_SPECIFIC_CHAR_METRICS +#define IS_DEBUG_CHAR(CH) ((CH) == 'W') /* glyphs to dump to terminal */ +#undef DEBUG_COMPUTED_FONT_METRICS +#undef DEBUG_FONT_NAME +#undef DEBUG_FONT_SIZE_SEARCH +#undef DEBUG_XFT_GLYPH +#undef DEBUG_USER_GLYPH +#undef DEBUG_LOAD + +/* controls for extensions over VT3x0 limitations */ +#define ENABLE_RGB_COLORSPECS +#undef ENABLE_FREE_ROTATION +#undef ENABLE_DISTORTIONLESS_ROTATION +#define ENABLE_UPLOAD_ALPHABET_FROM_FONT +#define ENABLE_UPLOAD_ALPHABET_ZERO +#define ENABLE_USER_FONT_SIZE +#define ENABLE_VARIABLE_ITALICS + +#define MIN_ITERATIONS_BEFORE_REFRESH 10U +#define MIN_MS_BEFORE_REFRESH 33 +/* *INDENT-OFF* */ +typedef struct RegisPoint { + int x, y; +} RegisPoint; + +typedef struct RegisWriteControls { + unsigned pv_multiplier; + unsigned pattern; + unsigned pattern_multiplier; + unsigned invert_pattern; + unsigned plane_mask; + unsigned write_style; + RegisterNum foreground; + unsigned shading_enabled; + char shading_character; + int shading_reference; + unsigned shading_reference_dim; + unsigned line_width; +} RegisWriteControls; + +typedef struct RegisTextControls { + unsigned alphabet_num; + unsigned character_set_l; /* default: "(B" (ASCII) */ + unsigned character_set_r; /* default: "-@" (Latin-1) */ + unsigned character_display_w; + unsigned character_display_h; + unsigned character_unit_cell_w; + unsigned character_unit_cell_h; + int character_inc_x; + int character_inc_y; + int string_rotation; + int character_rotation; + int slant; /* for italic/oblique */ +} RegisTextControls; + +#define FixedCopy(dst, src, len) strncpy(dst, src, len - 1)[len - 1] = '\0' +#define CopyFontname(dst, src) FixedCopy(dst, src, (size_t) REGIS_FONTNAME_LEN) + +#define MAX_REGIS_PAGES 8U + +#define MAX_REGIS_ALPHABETS 8U +#define REGIS_ALPHABET_NAME_LEN 11U +#define REGIS_FONTNAME_LEN 256U +/* enough for a 16x24 font (about 100KB) */ +#define MAX_REGIS_ALPHABET_BYTES (256U * 16U * 24U) +#define MAX_GLYPH_PIXELS 8192U +#define MAX_GLYPHS 256U +#define INVALID_ALPHABET_NUM ~0U + +typedef struct RegisAlphabet { + unsigned alphabet_num; + unsigned pixw, pixh; + char name[REGIS_ALPHABET_NAME_LEN]; + char fontname[REGIS_FONTNAME_LEN]; + int use_font; + int loaded[MAX_GLYPHS]; + Char *bytes; +} RegisAlphabet; + +typedef struct RegisDataFragment { + char const *start; + unsigned pos; + unsigned len; +} RegisDataFragment; +/* *INDENT-ON* */ + +#define POSITION_STACK_SIZE 16U +#define DUMMY_STACK_X -32768 +#define DUMMY_STACK_Y -32768 + +#define CURVE_POSITION_ARC_EDGE 0U +#define CURVE_POSITION_ARC_CENTER 1U +#define CURVE_POSITION_OPEN_CURVE 2U +#define CURVE_POSITION_CLOSED_CURVE 3U + +#define MAX_INPUT_CURVE_POINTS 16U +#define MAX_CURVE_POINTS (MAX_INPUT_CURVE_POINTS + 4U) + +#define MAX_FILL_POINTS 2048U + +typedef struct RegisParseState { + RegisDataFragment input; + char *temp; + unsigned templen; + char command; + char option; + /* position stack */ + int stack_x[POSITION_STACK_SIZE]; + int stack_y[POSITION_STACK_SIZE]; + unsigned stack_next; /* next empty position */ + /* curve options */ + int curve_mode; + int arclen; + int x_points[MAX_CURVE_POINTS]; + int y_points[MAX_CURVE_POINTS]; + unsigned num_points; + /* load options */ + char load_name[REGIS_ALPHABET_NAME_LEN]; + unsigned load_alphabet; + unsigned load_w, load_h; + unsigned load_index; + unsigned load_glyph; + unsigned load_row; + /* text options */ + unsigned text_tilt_state; +} RegisParseState; + +#define TEXT_TILT_STATE_READY 0U +#define TEXT_TILT_STATE_GOT_D 1U +#define TEXT_TILT_STATE_GOT_DS 2U +#define TEXT_TILT_STATE_GOT_DSD 3U + +typedef struct RegisGraphicsContext { + XtermWidget current_widget; + Graphic *destination_graphic; + Graphic *display_graphic; + int graphics_id; + int x_off, y_off; + int x_div, y_div; + int width, height; + unsigned all_planes; + RegisterNum background; + char const *builtin_font; + RegisAlphabet alphabets[MAX_REGIS_ALPHABETS]; + RegisWriteControls persistent_write_controls; + RegisWriteControls temporary_write_controls; + RegisTextControls persistent_text_controls; + RegisTextControls temporary_text_controls; + RegisTextControls *current_text_controls; + int multi_input_mode; + int graphics_output_cursor_x; + int graphics_output_cursor_y; + unsigned pattern_count; + unsigned pattern_bit; + int fill_mode; + RegisPoint fill_points[MAX_FILL_POINTS]; + unsigned fill_point_count; + unsigned destination_page; + unsigned display_page; + int force_refresh; +} RegisGraphicsContext; + +static RegisGraphicsContext persistent_context; +static RegisParseState persistent_state; + +#define MAX_PATTERN_BITS 8U + +#define WRITE_STYLE_OVERLAY 1U +#define WRITE_STYLE_REPLACE 2U +#define WRITE_STYLE_COMPLEMENT 3U +#define WRITE_STYLE_ERASE 4U + +#define WRITE_SHADING_REF_Y 0U +#define WRITE_SHADING_REF_X 1U +#define WRITE_SHADING_REF_NONE 2U + +/* keypress event example: http://iraf.net/forum/viewtopic.php?showtopic=61692 */ + +#define MIN2(X, Y) ( (X) < (Y) ? (X) : (Y) ) +#define MIN3(X, Y, Z) ( MIN2(MIN2((X), (Y)), MIN2((Y), (Z))) ) +#define MAX2(X, Y) ( (X) > (Y) ? (X) : (Y) ) +#define MAX3(X, Y, Z) ( MAX2(MAX2((X), (Y)), MAX2((Y), (Z))) ) + +#define ROT_LEFT_N(V, N) ( (((V) << ((N) & 3U )) & 255U) | \ + ((V) >> (8U - ((N) & 3U))) ) +#define ROT_LEFT(V) ( (((V) << 1U) & 255U) | ((V) >> 7U) ) + +/* convert user coordinates to absolute pixel coordinates */ +#define SCALE_XCOORD(C, X, S) ( ( (X) * ((C)->width - 1) ) / ( (C)->x_div * (S) ) ) +#define SCALE_YCOORD(C, Y, S) ( ( (Y) * ((C)->height - 1) ) / ( (C)->y_div * (S) ) ) +#define TRANSLATE_XCOORD(C, X, S) SCALE_XCOORD((C), (X) - (C)->x_off * (S), (S) ) +#define TRANSLATE_YCOORD(C, Y, S) SCALE_YCOORD((C), (Y) - (C)->y_off * (S), (S) ) + +#if 0 +/* convert absolute pixel coordinate to user coordinates */ +#define SCALE_XPIX(C, X, S) ( ( (X) * ((C)->x_div * (S) ) ) / ((C)->width - 1) ) +#define SCALE_YPIX(C, Y, S) ( ( (Y) * ((C)->y_div * (S) ) ) / ((C)->height - 1) ) +#define TRANSLATE_XPIX(C, X, S) ( SCALE_XPIX((C), (X), (S) ) + (C)->x_off * (S) ) +#define TRANSLATE_YPIX(C, Y, S) ( SCALE_YPIX((C), (Y), (S) ) + (C)->y_off * (S) ) +#endif + +#define READ_PIXEL(C, X, Y) read_pixel((C)->destination_graphic, (X), (Y)) +#define DRAW_PIXEL(C, X, Y, COL) draw_solid_pixel((C)->destination_graphic, (X), (Y), (COL)) +#define DRAW_ALL(C, COL) \ + draw_solid_rectangle((C)->destination_graphic, 0, 0, (C)->width, (C)->height, (COL)) + +static unsigned get_shade_character_pixel(Char const *pixels, + unsigned w, unsigned h, + unsigned smaxf, unsigned scale, + int slant_dx, int px, int py); +static void get_bitmap_of_character(RegisGraphicsContext const *context, + int ch, unsigned maxw, unsigned maxh, + Char *pixels, + unsigned *w, unsigned *h, + unsigned max_pixels); + +static void +init_regis_load_state(RegisParseState *state) +{ + state->load_index = MAX_REGIS_ALPHABETS; + state->load_w = 8U; + state->load_h = 10U; + state->load_alphabet = 1U; /* FIXME: is this the correct default */ + state->load_name[0] = '\0'; + state->load_glyph = (unsigned) (Char) '\0'; + state->load_row = 0U; +} + +static void +init_regis_parse_state(RegisParseState *state) +{ + state->command = '_'; + state->option = '_'; + state->stack_next = 0U; + state->load_index = MAX_REGIS_ALPHABETS; + init_regis_load_state(state); +} + +static int +ifloor(double d) +{ + double dl = floor(d); + return (int) dl; +} + +static int +isqrt(double d) +{ + double dl = sqrt(d); + return (int) dl; +} + +static void +draw_regis_pixel(RegisGraphicsContext *context, int x, int y, + unsigned value) +{ + unsigned color = 0; + + switch (context->temporary_write_controls.write_style) { + case WRITE_STYLE_OVERLAY: + /* + * Update pixels with foreground when pattern is 1, + * don't change when pattern is 0. + */ + if (!value) { + return; + } + + if (context->temporary_write_controls.invert_pattern) { + color = context->background; + } else { + color = context->temporary_write_controls.foreground; + } + break; + + case WRITE_STYLE_REPLACE: + /* + * Update pixels with foreground when pattern is 1, + * set to background when pattern is 0. + */ + { + unsigned fg, bg; + + if (context->temporary_write_controls.invert_pattern) { + fg = context->background; + bg = context->temporary_write_controls.foreground; + } else { + fg = context->temporary_write_controls.foreground; + bg = context->background; + } + color = value ? fg : bg; + } + break; + + case WRITE_STYLE_COMPLEMENT: + /* + * Update pixels with background when pattern is 1, + * don't change when pattern is 0. + */ + if (!value) { + return; + } + + color = READ_PIXEL(context, x, y); + if (color == COLOR_HOLE) + color = context->background; + color = color ^ context->all_planes; + break; + + case WRITE_STYLE_ERASE: + /* Update pixels to foreground. */ + if (context->temporary_write_controls.invert_pattern) { + color = context->temporary_write_controls.foreground; + } else { + color = context->background; + } + break; + } + + if (context->temporary_write_controls.plane_mask != context->all_planes) { + unsigned old_color = READ_PIXEL(context, x, y); + if (old_color == COLOR_HOLE) + old_color = context->background; + color = (color & context->temporary_write_controls.plane_mask) | + (old_color & ~context->temporary_write_controls.plane_mask); + } + + DRAW_PIXEL(context, x, y, color); +} + +static void +shade_pattern_to_pixel(RegisGraphicsContext *context, unsigned dim, int ref, + int x, int y) +{ + unsigned value; + + if (dim == WRITE_SHADING_REF_X) { + int delta = x > ref ? 1 : -1; + int curr_x; + + context->pattern_bit = 1U << (((unsigned) y) & 7U); + for (curr_x = ref; curr_x != x + delta; curr_x += delta) { + value = context->temporary_write_controls.pattern & + context->pattern_bit; + draw_regis_pixel(context, curr_x, y, value); + } + } else if (dim == WRITE_SHADING_REF_Y) { + int delta = y > ref ? 1 : -1; + int curr_y; + + for (curr_y = ref; curr_y != y + delta; curr_y += delta) { + context->pattern_bit = 1U << (((unsigned) curr_y) & 7U); + value = context->temporary_write_controls.pattern & + context->pattern_bit; + draw_regis_pixel(context, x, curr_y, value); + } + } else { + TRACE(("ERROR: shading requested, but there is no reference axis\n")); + } +} + +static void +shade_char_to_pixel(RegisGraphicsContext *context, Char const *pixels, + unsigned w, unsigned h, unsigned dim, int ref, int x, int y) +{ + unsigned xmaxf = context->current_text_controls->character_unit_cell_w; + unsigned ymaxf = context->current_text_controls->character_unit_cell_h; + unsigned smaxf; + unsigned s; + unsigned scale; + unsigned value; + + if (xmaxf > ymaxf) { + smaxf = ymaxf; + s = h; + } else { + smaxf = xmaxf; + s = w; + } + scale = (s << SCALE_FIXED_POINT) / smaxf; + + if (dim == WRITE_SHADING_REF_X) { + int delta = x > ref ? 1 : -1; + int curr_x; + + for (curr_x = ref; curr_x != x + delta; curr_x += delta) { + value = get_shade_character_pixel(pixels, w, h, smaxf, scale, 0, + curr_x, y); + draw_regis_pixel(context, curr_x, y, value); + } + } else if (dim == WRITE_SHADING_REF_Y) { + int delta = y > ref ? 1 : -1; + int curr_y; + + for (curr_y = ref; curr_y != y + delta; curr_y += delta) { + value = get_shade_character_pixel(pixels, w, h, smaxf, scale, 0, x, + curr_y); + draw_regis_pixel(context, x, curr_y, value); + } + } else { + TRACE(("ERROR: shading requested, but there is no reference axis\n")); + } +} + +static void +draw_patterned_pixel(RegisGraphicsContext *context, int x, int y) +{ + if (context->pattern_count >= + context->temporary_write_controls.pattern_multiplier) { + context->pattern_count = 0U; + context->pattern_bit = ROT_LEFT(context->pattern_bit); + } + context->pattern_count++; + + draw_regis_pixel(context, x, y, + context->temporary_write_controls.pattern & + context->pattern_bit); +} + +static void +shade_to_pixel(RegisGraphicsContext *context, unsigned dim, int ref, + int x, int y) +{ + if (context->temporary_write_controls.shading_character != '\0') { + unsigned xmaxf = context->current_text_controls->character_unit_cell_w; + unsigned ymaxf = context->current_text_controls->character_unit_cell_h; + char ch = context->temporary_write_controls.shading_character; + Char pixels[MAX_GLYPH_PIXELS]; + unsigned w, h; + + get_bitmap_of_character(context, ch, xmaxf, ymaxf, pixels, &w, &h, + MAX_GLYPH_PIXELS); + if (w > 0 && h > 0) { + shade_char_to_pixel(context, pixels, w, h, dim, ref, x, y); + } + } else { + shade_pattern_to_pixel(context, dim, ref, x, y); + } +} + +static void +draw_or_save_patterned_pixel(RegisGraphicsContext *context, int x, int y) +{ + if (context->fill_mode == 1) { + if (context->fill_point_count >= MAX_FILL_POINTS) { + TRACE(("point %d,%d can not be added to filled polygon\n", + x, y)); + return; + } + if (context->fill_point_count > 0U && + context->fill_points[context->fill_point_count - 1U].x == x && + context->fill_points[context->fill_point_count - 1U].y == y) { + return; + } + context->fill_points[context->fill_point_count].x = x; + context->fill_points[context->fill_point_count].y = y; + context->fill_point_count++; + return; + } + + if (context->temporary_write_controls.shading_enabled) { + unsigned dim = context->temporary_write_controls.shading_reference_dim; + int ref = context->temporary_write_controls.shading_reference; + + shade_to_pixel(context, dim, ref, x, y); + return; + } + + draw_patterned_pixel(context, x, y); +} + +static int +sort_points(void const *l, void const *r) +{ + RegisPoint const *const lp = l; + RegisPoint const *const rp = r; + + if (lp->y < rp->y) + return -1; + if (lp->y > rp->y) + return +1; + if (lp->x < rp->x) + return -1; + if (lp->x > rp->x) + return +1; + return 0; +} + +static void +draw_shaded_polygon(RegisGraphicsContext *context) +{ + unsigned p; + int old_x, old_y; + int inside; + Char pixels[MAX_GLYPH_PIXELS]; + unsigned w = 1, h = 1; + + char ch = context->temporary_write_controls.shading_character; + unsigned xmaxf = context->current_text_controls->character_unit_cell_w; + unsigned ymaxf = context->current_text_controls->character_unit_cell_h; + + get_bitmap_of_character(context, ch, xmaxf, ymaxf, pixels, &w, &h, + MAX_GLYPH_PIXELS); + if (w < 1U || h < 1U) { + return; + } + + qsort(context->fill_points, (size_t) context->fill_point_count, + sizeof(context->fill_points[0]), sort_points); + + old_x = DUMMY_STACK_X; + old_y = DUMMY_STACK_Y; + inside = 0; + for (p = 0U; p < context->fill_point_count; p++) { + int new_x = context->fill_points[p].x; + int new_y = context->fill_points[p].y; +#if 0 + printf("got %d,%d (%d,%d) inside=%d\n", new_x, new_y, old_x, old_y, inside); +#endif + + /* + * FIXME: This is using pixels to represent lines which loses + * information about exact slope and how many lines are present which + * causes misbehavior with some inputs (especially complex polygons). + * It also takes more room than remembering vertices, but I'd rather + * not have to implement line segments for arcs. Maybe store a count + * at each vertex instead (doesn't fix the slope problem). + */ + /* + * FIXME: Change this to only draw inside of polygons, and round + * points in a uniform direction to avoid overlapping drawing. As an + * option we could continue to support drawing the outline. + */ + if (new_y != old_y) { + if (inside) { + /* + * Just draw the vertical line when there is not a matching + * edge on the right side. + */ + shade_char_to_pixel(context, pixels, w, h, + WRITE_SHADING_REF_X, + old_x, old_x, old_y); + } + inside = 1; + } else { + if (inside) { + shade_char_to_pixel(context, pixels, w, h, + WRITE_SHADING_REF_X, + old_x, new_x, new_y); + } + if (new_x > old_x + 1) { + inside = !inside; + } + } + + old_x = new_x; + old_y = new_y; + } + + context->destination_graphic->dirty = 1; +} + +static void +draw_filled_polygon(RegisGraphicsContext *context) +{ + unsigned p; + int old_x, old_y; + int inside; + + qsort(context->fill_points, (size_t) context->fill_point_count, + sizeof(context->fill_points[0]), sort_points); + + old_x = DUMMY_STACK_X; + old_y = DUMMY_STACK_Y; + inside = 0; + for (p = 0U; p < context->fill_point_count; p++) { + int new_x = context->fill_points[p].x; + int new_y = context->fill_points[p].y; +#if 0 + printf("got %d,%d (%d,%d) inside=%d\n", new_x, new_y, old_x, old_y, inside); +#endif + + /* + * FIXME: This is using pixels to represent lines which loses + * information about exact slope and how many lines are present which + * causes misbehavior with some inputs (especially complex polygons). + * It also takes more room than remembering vertices, but I'd rather + * not have to implement line segments for arcs. Maybe store a count + * at each vertex instead (doesn't fix the slope problem). + */ + /* + * FIXME: Change this to only draw inside of polygons, and round + * points in a uniform direction to avoid overlapping drawing. As an + * option we could continue to support drawing the outline. + */ + if (new_y != old_y) { + if (inside) { + /* + * Just draw the vertical line when there is not a matching + * edge on the right side. + */ + shade_pattern_to_pixel(context, WRITE_SHADING_REF_X, + old_x, old_x, old_y); + } + inside = 1; + } else { + if (inside) { + shade_pattern_to_pixel(context, WRITE_SHADING_REF_X, + old_x, new_x, new_y); + } + if (new_x > old_x + 1) { + inside = !inside; + } + } + + old_x = new_x; + old_y = new_y; + } + + context->destination_graphic->dirty = 1; +} + +static void +draw_patterned_line(RegisGraphicsContext *context, int x1, int y1, + int x2, int y2) +{ + int x, y; + int dx, dy; + int dir, diff; + + dx = abs(x1 - x2); + dy = abs(y1 - y2); + + if (dx > dy) { + if (x1 > x2) { + int tmp; + EXCHANGE(x1, x2, tmp); + EXCHANGE(y1, y2, tmp); + } + if (y1 < y2) + dir = 1; + else if (y1 > y2) + dir = -1; + else + dir = 0; + + diff = 0; + y = y1; + for (x = x1; x <= x2; x++) { + if (diff >= dx) { + diff -= dx; + y += dir; + } + diff += dy; + draw_or_save_patterned_pixel(context, x, y); + } + } else { + if (y1 > y2) { + int tmp; + EXCHANGE(y1, y2, tmp); + EXCHANGE(x1, x2, tmp); + } + if (x1 < x2) + dir = 1; + else if (x1 > x2) + dir = -1; + else + dir = 0; + + diff = 0; + x = x1; + for (y = y1; y <= y2; y++) { + if (diff >= dy) { + diff -= dy; + x += dir; + } + diff += dx; + draw_or_save_patterned_pixel(context, x, y); + } + } + + context->destination_graphic->dirty = 1; +} + +typedef struct { + int dxx; + int dxy; + int dyx; + int dyy; +} quadmap_coords; + +static void +draw_patterned_arc(RegisGraphicsContext *context, + int cx, int cy, + int ex, int ey, + int a_start, int a_length, + int *ex_final, int *ey_final) +{ + const double third = hypot((double) (cx - ex), (double) (cy - ey)); + const int radius = (int) third; + const int ra = radius; + const int rb = radius; + const quadmap_coords neg_quadmap[4] = + { + {-1, 0, 0, +1}, + {0, -1, -1, 0}, + {+1, 0, 0, -1}, + {0, +1, +1, 0}, + }; + const quadmap_coords pos_quadmap[4] = + { + {-1, 0, 0, -1}, + {0, -1, +1, 0}, + {+1, 0, 0, +1}, + {0, +1, -1, 0}, + }; + const quadmap_coords *quadmap; + int total_points; + int half_degree; + int points_start, points_stop; + int points; + unsigned iterations; + long rx, ry; + long dx, dy; + int x, y; + long e2; + long error; + + TRACE(("orig a_length=%d a_start=%d\n", a_length, a_start)); + if (a_length == 0) + return; + if (a_length > 0) { + quadmap = pos_quadmap; + } else { + quadmap = neg_quadmap; + if (a_start != 0) + a_start = 3600 - a_start; + a_length = abs(a_length); + } + TRACE(("positive a_length=%d a_start=%d\n", a_length, a_start)); + + rx = -ra; + ry = 0; + e2 = rb; + dx = (2 * rx + 1) * e2 * e2; + dy = rx * rx; + error = dx + dy; + total_points = 0; + do { + total_points += 4; + e2 = 2 * error; + if (e2 >= dx) { + rx++; + dx += 2 * rb * rb; + error += dx; + } + if (e2 <= dy) { + ry++; + dy += 2 * ra * ra; + error += dy; + } + } + while (rx <= 0); + + /* FIXME: This is apparently not accurate enough because some arcs start or + * end a few pixels off. Maybe compare line slopes in the loop below + * instead? + */ + half_degree = total_points * 5; + points_start = (total_points * a_start - half_degree) / 3600; + points_stop = (total_points * a_start + + total_points * a_length + half_degree) / 3600; + TRACE(("drawing arc with %d points clockwise from %g degrees for %g degrees (from point %d to %d out of %d)\n", + total_points, a_start / 10.0, a_length / 10.0, points_start, points_stop, + total_points)); + + /* FIXME: The four pixels at the cardinal directions are double-drawn. */ + points = 0; + for (iterations = 0U; iterations < 8U; iterations++) { + int q2 = iterations & 0x3; + + rx = -ra; + ry = 0; + e2 = rb; + dx = (2 * rx + 1) * e2 * e2; + dy = rx * rx; + error = dx + dy; + do { +#ifdef DEBUG_ARC_POINTS + double rad = atan2( + (double) (quadmap[q2].dyx * rx + + quadmap[q2].dyy * ry), + (double) (quadmap[q2].dxx * rx + + quadmap[q2].dxy * ry)); + double deg = (360.0 * rad / (2.0 * M_PI)); + if (deg < 0.0) + deg += 360.0; +#endif + + if (points >= points_start && points <= points_stop) { + x = (int) (cx + + quadmap[q2].dxx * rx + + quadmap[q2].dxy * ry); + y = (int) (cy + + quadmap[q2].dyx * rx + + quadmap[q2].dyy * ry); +#ifdef DEBUG_ARC_POINTS + TRACE(("drawing point %u at %d,%d (%.5g deg)\n", + points, x, y, deg)); +#endif + draw_or_save_patterned_pixel(context, x, y); + if (ex_final) + *ex_final = x; + if (ey_final) + *ey_final = y; + } else { +#ifdef DEBUG_ARC_POINTS + x = (int) (cx + quadmap[q2].dxx * rx + quadmap[q2].dxy * ry); + y = (int) (cy + quadmap[q2].dyx * rx + quadmap[q2].dyy * ry); + TRACE(("skipping point %u at %d,%d which is outside of range (%.5g deg)\n", + points, x, y, deg)); +#endif + } + points++; + + e2 = 2 * error; + if (e2 >= dx) { + rx++; + dx += 2 * rb * rb; + error += dx; + } + if (e2 <= dy) { + ry++; + dy += 2 * ra * ra; + error += dy; + } + } + while (rx <= 0); + } + + context->destination_graphic->dirty = 1; +} + +/* + * The plot* functions are based on optimized rasterization primitives written + * by Zingl Alois. + * See http://members.chello.at/easyfilter/bresenham.html + */ + +/* + * FIXME: + * This is a terrible temporary hack. The plot functions below can be adapted + * to work like the other rasterization functions but there's no point in doing + * that until we know we don't have to write something completely different. + */ +static RegisGraphicsContext *global_context; +static void +setPixel(int x, int y) +{ + draw_or_save_patterned_pixel(global_context, x, y); +} + +static void +plotLine(int x0, int y0, int x1, int y1) +{ + int dx = abs(x1 - x0), sx = x0 < x1 ? 1 : -1; + int dy = -abs(y1 - y0), sy = y0 < y1 ? 1 : -1; + int err = dx + dy; /* error value e_xy */ + + for (;;) { /* loop */ + int e2; + setPixel(x0, y0); + e2 = 2 * err; + if (e2 >= dy) { /* e_xy+e_x > 0 */ + if (x0 == x1) + break; + err += dy; + x0 += sx; + } + if (e2 <= dx) { /* e_xy+e_y < 0 */ + if (y0 == y1) + break; + err += dx; + y0 += sy; + } + } +} + +static void +plotQuadBezierSeg(int x0, int y0, int x1, int y1, int x2, int y2) +{ /* plot a limited quadratic Bezier segment */ + int sx = x2 - x1; + int sy = y2 - y1; + long xx = (x0 - x1); /* relative values for checks */ + long yy = (y0 - y1); + double cur = (double) (xx * sy - yy * sx); /* curvature */ + + assert(xx * sx <= 0 && yy * sy <= 0); /* sign of gradient must not change */ + + if (sx * (long) sx + sy * (long) sy > xx * xx + yy * yy) { /* begin with longer part */ + x2 = x0; + x0 = sx + x1; + y2 = y0; + y0 = sy + y1; + cur = -cur; /* swap P0 P2 */ + } + if (cur != 0.0) { /* no straight line */ + long xy; + double dx, dy, err; + + xx += sx; + xx *= (sx = (x0 < x2) ? 1 : -1); /* x step direction */ + yy += sy; + yy *= (sy = (y0 < y2) ? 1 : -1); /* y step direction */ + xy = 2 * xx * yy; + xx *= xx; + yy *= yy; /* differences 2nd degree */ + if (cur * sx * sy < 0) { /* negated curvature? */ + xx = -xx; + yy = -yy; + xy = -xy; + cur = -cur; + } + /* differences 1st degree */ + dx = ((4.0 * sy * cur * (x1 - x0)) + (double) xx) - (double) xy; + dy = ((4.0 * sx * cur * (y0 - y1)) + (double) yy) - (double) xy; + xx += xx; + yy += yy; + err = dx + dy + (double) xy; /* error 1st step */ + do { + setPixel(x0, y0); /* plot curve */ + if (x0 == x2 && y0 == y2) + return; /* last pixel -> curve finished */ + y1 = (2 * err) < dx; /* save value for test of y step */ + if ((2 * err) > dy) { + x0 += sx; + dx -= (double) xy; + dy += (double) yy; + err += dy; + } /* x step */ + if (y1) { + y0 += sy; + dy -= (double) xy; + dx += (double) xx; + err += dx; + } /* y step */ + } while (dy < 0 && dx > 0); /* gradient negates -> algorithm fails */ + } + plotLine(x0, y0, x2, y2); /* plot remaining part to end */ +} + +#if 0 +static void +plotQuadBezier(int x0, int y0, int x1, int y1, int x2, int y2) +{ /* plot any quadratic Bezier curve */ + int x = x0 - x1; + int y = y0 - y1; + double t = x0 - 2 * x1 + x2; + double r; + + if ((long) x * (x2 - x1) > 0) { /* horizontal cut at P4? */ + if ((long) y * (y2 - y1) > 0) /* vertical cut at P6 too? */ + if (fabs((y0 - 2 * y1 + y2) / t * x) > abs(y)) { /* which first? */ + x0 = x2; + x2 = x + x1; + y0 = y2; + y2 = y + y1; /* swap points */ + } /* now horizontal cut at P4 comes first */ + t = (x0 - x1) / t; + r = (1 - t) * ((1 - t) * y0 + 2.0 * t * y1) + t * t * y2; /* By(t=P4) */ + t = (x0 * x2 - x1 * x1) * t / (x0 - x1); /* gradient dP4/dx=0 */ + x = ifloor(t + 0.5); + y = ifloor(r + 0.5); + r = (y1 - y0) * (t - x0) / (x1 - x0) + y0; /* intersect P3 | P0 P1 */ + plotQuadBezierSeg(x0, y0, x, ifloor(r + 0.5), x, y); + r = (y1 - y2) * (t - x2) / (x1 - x2) + y2; /* intersect P4 | P1 P2 */ + x0 = x1 = x; + y0 = y; + y1 = ifloor(r + 0.5); /* P0 = P4, P1 = P8 */ + } + if ((long) (y0 - y1) * (y2 - y1) > 0) { /* vertical cut at P6? */ + t = y0 - 2 * y1 + y2; + t = (y0 - y1) / t; + r = (1 - t) * ((1 - t) * x0 + 2.0 * t * x1) + t * t * x2; /* Bx(t=P6) */ + t = (y0 * y2 - y1 * y1) * t / (y0 - y1); /* gradient dP6/dy=0 */ + x = ifloor(r + 0.5); + y = ifloor(t + 0.5); + r = (x1 - x0) * (t - y0) / (y1 - y0) + x0; /* intersect P6 | P0 P1 */ + plotQuadBezierSeg(x0, y0, ifloor(r + 0.5), y, x, y); + r = (x1 - x2) * (t - y2) / (y1 - y2) + x2; /* intersect P7 | P1 P2 */ + x0 = x; + x1 = ifloor(r + 0.5); + y0 = y1 = y; /* P0 = P6, P1 = P7 */ + } + plotQuadBezierSeg(x0, y0, x1, y1, x2, y2); /* remaining part */ +} +#endif + +static void +plotCubicBezierSeg(int x0, int y0, + double x1, double y1, + double x2, double y2, + int x3, int y3) +{ /* plot limited cubic Bezier segment */ + int f, fx, fy, tt; + int leg = 1; + int sx = x0 < x3 ? 1 : -1; + int sy = y0 < y3 ? 1 : -1; /* step direction */ + double xc = -fabs(x0 + x1 - x2 - x3); + double xa = xc - 4 * sx * (x1 - x2); + double xb = sx * (x0 - x1 - x2 + x3); + double yc = -fabs(y0 + y1 - y2 - y3); + double ya = yc - 4 * sy * (y1 - y2); + double yb = sy * (y0 - y1 - y2 + y3); + double ab, ac, bc, cb, xx, xy, yy, dx, dy, ex, *pxy; + double EP = 0.01; + /* check for curve restrains */ + /* slope P0-P1 == P2-P3 and (P0-P3 == P1-P2 or no slope change) */ + assert((x1 - x0) * (x2 - x3) < EP && + ((x3 - x0) * (x1 - x2) < EP || xb * xb < xa * xc + EP)); + assert((y1 - y0) * (y2 - y3) < EP && + ((y3 - y0) * (y1 - y2) < EP || yb * yb < ya * yc + EP)); + + if (xa == 0.0 && ya == 0.0) { /* quadratic Bezier */ + sx = ifloor((3 * x1 - x0 + 1) / 2); + sy = ifloor((3 * y1 - y0 + 1) / 2); /* new midpoint */ + plotQuadBezierSeg(x0, y0, sx, sy, x3, y3); + return; + } + x1 = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) + 1; /* line lengths */ + x2 = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3) + 1; + do { /* loop over both ends */ + ab = xa * yb - xb * ya; + ac = xa * yc - xc * ya; + bc = xb * yc - xc * yb; + ex = ab * (ab + ac - 3 * bc) + ac * ac; /* P0 part of self-intersection loop? */ + f = ((ex > 0.0) + ? 1 + : isqrt(1 + 1024 / x1)); /* calculate resolution */ + ab *= f; + ac *= f; + bc *= f; + ex *= f * f; /* increase resolution */ + xy = 9 * (ab + ac + bc) / 8; + cb = 8 * (xa - ya); /* init differences of 1st degree */ + dx = 27 * (8 * ab * (yb * yb - ya * yc) + + ex * (ya + 2 * yb + yc)) / 64 - ya * ya * (xy - ya); + dy = 27 * (8 * ab * (xb * xb - xa * xc) - + ex * (xa + 2 * xb + xc)) / 64 - xa * xa * (xy + xa); + /* init differences of 2nd degree */ + xx = 3 * (3 * ab * (3 * yb * yb - ya * ya - 2 * ya * yc) - + ya * (3 * ac * (ya + yb) + ya * cb)) / 4; + yy = 3 * (3 * ab * (3 * xb * xb - xa * xa - 2 * xa * xc) - + xa * (3 * ac * (xa + xb) + xa * cb)) / 4; + xy = xa * ya * (6 * ab + 6 * ac - 3 * bc + cb); + ac = ya * ya; + cb = xa * xa; + xy = 3 * (xy + 9 * f * (cb * yb * yc - xb * xc * ac) - + 18 * xb * yb * ab) / 8; + + if (ex < 0) { /* negate values if inside self-intersection loop */ + dx = -dx; + dy = -dy; + xx = -xx; + yy = -yy; + xy = -xy; + ac = -ac; + cb = -cb; + } /* init differences of 3rd degree */ + ab = 6 * ya * ac; + ac = -6 * xa * ac; + bc = 6 * ya * cb; + cb = -6 * xa * cb; + dx += xy; + ex = dx + dy; + dy += xy; /* error of 1st step */ + + for (pxy = &xy, fx = fy = f; x0 != x3 && y0 != y3;) { + setPixel(x0, y0); /* plot curve */ + do { /* move sub-steps of one pixel */ + if (dx > *pxy || dy < *pxy) + goto exit; /* confusing values */ + y1 = 2 * ex - dy; /* save value for test of y step */ + if (2 * ex >= dx) { /* x sub-step */ + fx--; + ex += dx += xx; + dy += xy += ac; + yy += bc; + xx += ab; + } + if (y1 <= 0) { /* y sub-step */ + fy--; + ex += dy += yy; + dx += xy += bc; + xx += ac; + yy += cb; + } + } while (fx > 0 && fy > 0); /* pixel complete? */ + if (2 * fx <= f) { + x0 += sx; + fx += f; + } /* x step */ + if (2 * fy <= f) { + y0 += sy; + fy += f; + } /* y step */ + if (pxy == &xy && dx < 0 && dy > 0) + pxy = &EP; /* pixel ahead valid */ + } + exit: + EXCHANGE(x0, x3, tt); + sx = -sx; + xb = -xb; /* swap legs */ + EXCHANGE(y0, y3, tt); + sy = -sy; + yb = -yb; + x1 = x2; + } while (leg--); /* try other end */ + plotLine(x0, y0, x3, y3); /* remaining part in case of cusp or crunode */ +} + +static void +plotCubicBezier(int x0, int y0, int x1, int y1, + int x2, int y2, int x3, int y3) +{ /* plot any cubic Bezier curve */ + int n = 0, i = 0; + long xc = x0 + x1 - x2 - x3; + long xa = xc - 4 * (x1 - x2); + long xb = x0 - x1 - x2 + x3; + long xd = xb + 4 * (x1 + x2); + long yc = y0 + y1 - y2 - y3; + long ya = yc - 4 * (y1 - y2); + long yb = y0 - y1 - y2 + y3; + long yd = yb + 4 * (y1 + y2); + double fx0 = x0; + double fy0 = y0; + double t1 = (double) (xb * xb - xa * xc), t2, t[5]; + +#ifdef DEBUG_BEZIER + printf("plotCubicBezier(%d,%d, %d,%d, %d,%d, %d,%d\n", + x0, y0, x1, y1, x2, y2, x3, y3); +#endif + /* sub-divide curve at gradient sign changes */ + if (xa == 0) { /* horizontal */ + if (labs(xc) < 2 * labs(xb)) + t[n++] = (double) xc / (2.0 * (double) xb); /* one change */ + } else if (t1 > 0.0) { /* two changes */ + t2 = sqrt(t1); + t1 = ((double) xb - t2) / (double) xa; + if (fabs(t1) < 1.0) + t[n++] = t1; + t1 = ((double) xb + t2) / (double) xa; + if (fabs(t1) < 1.0) + t[n++] = t1; + } + t1 = (double) (yb * yb - ya * yc); + if (ya == 0) { /* vertical */ + if (labs(yc) < 2 * labs(yb)) + t[n++] = (double) yc / (2.0 * (double) yb); /* one change */ + } else if (t1 > 0.0) { /* two changes */ + t2 = sqrt(t1); + t1 = ((double) yb - t2) / (double) ya; + if (fabs(t1) < 1.0) + t[n++] = t1; + t1 = ((double) yb + t2) / (double) ya; + if (fabs(t1) < 1.0) + t[n++] = t1; + } + for (i = 1; i < n; i++) /* bubble sort of 4 points */ + if ((t1 = t[i - 1]) > t[i]) { + t[i - 1] = t[i]; + t[i] = t1; + i = 0; + } + + t1 = -1.0; + t[n] = 1.0; /* begin / end point */ + for (i = 0; i <= n; i++) { /* plot each segment separately */ + double fx1, fx2, fx3; + double fy1, fy2, fy3; + + t2 = t[i]; /* sub-divide at t[i-1], t[i] */ + fx1 = (t1 * (t1 * (double) xb - (double) (2 * xc)) - + t2 * (t1 * (t1 * (double) xa - (double) (2 * xb)) + (double) + xc) + (double) xd) / 8 - fx0; + fy1 = (t1 * (t1 * (double) yb - (double) (2 * yc)) - + t2 * (t1 * (t1 * (double) ya - (double) (2 * yb)) + (double) + yc) + (double) yd) / 8 - fy0; + fx2 = (t2 * (t2 * (double) xb - (double) (2 * xc)) - + t1 * (t2 * (t2 * (double) xa - (double) (2 * xb)) + (double) + xc) + (double) xd) / 8 - fx0; + fy2 = (t2 * (t2 * (double) yb - (double) (2 * yc)) - + t1 * (t2 * (t2 * (double) ya - (double) (2 * yb)) + (double) + yc) + (double) yd) / 8 - fy0; + fx0 -= fx3 = (t2 * (t2 * ((double) (3 * xb) - t2 * (double) xa) - + (double) (3 * xc)) + (double) xd) / 8; + fy0 -= fy3 = (t2 * (t2 * ((double) (3 * yb) - t2 * (double) ya) - + (double) (3 * yc)) + (double) yd) / 8; + x3 = ifloor(fx3 + 0.5); + y3 = ifloor(fy3 + 0.5); /* scale bounds to int */ + if (fx0 != 0.0) { + fx1 *= fx0 = (x0 - x3) / fx0; + fx2 *= fx0; + } + if (fy0 != 0.0) { + fy1 *= fy0 = (y0 - y3) / fy0; + fy2 *= fy0; + } + if (x0 != x3 || y0 != y3) /* segment t1 - t2 */ + plotCubicBezierSeg(x0, y0, + x0 + fx1, y0 + fy1, + x0 + fx2, y0 + fy2, + x3, y3); + x0 = x3; + y0 = y3; + fx0 = fx3; + fy0 = fy3; + t1 = t2; + } +} + +#if 0 +static void +plotQuadSpline(int n, int x[], int y[], int skip_segments) +{ /* plot quadratic spline, destroys input arrays x,y */ +#define M_MAX 12 + double mi = 1, m[M_MAX]; /* diagonal constants of matrix */ + int i, x0, y0, x1, y1, x2, y2; +#ifdef DEBUG_SPLINE_SEGMENTS + int color = 0; +#endif + + assert(n > 1); /* need at least 3 points P[0]..P[n] */ + +#ifdef DEBUG_SPLINE_POINTS + { + int save_pattern; + + i = 0; + global_context->temporary_write_controls.foreground = 11; + save_pattern = global_context->temporary_write_controls.pattern; + global_context->temporary_write_controls.pattern = 0xff; + draw_patterned_arc(global_context, x[i], y[i], x[i] + 2, y[i], 0, + 3600, NULL, NULL); + i++; + global_context->temporary_write_controls.foreground = 15; + for (; i < n; i++) { + draw_patterned_arc(global_context, + x[i], y[i], + x[i] + 2, y[i], + 0, 3600, NULL, NULL); + } + global_context->temporary_write_controls.foreground = 10; + draw_patterned_arc(global_context, x[i], y[n], x[i] + 2, y[i], 0, + 3600, NULL, NULL); + global_context->temporary_write_controls.pattern = save_pattern; + } +#endif + + x2 = x[n]; + y2 = y[n]; + + x[1] = x0 = 8 * x[1] - 2 * x[0]; /* first row of matrix */ + y[1] = y0 = 8 * y[1] - 2 * y[0]; + + for (i = 2; i < n; i++) { /* forward sweep */ + if (i - 2 < M_MAX) + m[i - 2] = mi = 1.0 / (6.0 - mi); + x[i] = x0 = ifloor(8 * x[i] - x0 * mi + 0.5); /* store yi */ + y[i] = y0 = ifloor(8 * y[i] - y0 * mi + 0.5); + } + x1 = ifloor((x0 - 2 * x2) / (5.0 - mi) + 0.5); /* correction last row */ + y1 = ifloor((y0 - 2 * y2) / (5.0 - mi) + 0.5); + + for (i = n - 2; i > 0; i--) { /* back substitution */ + if (i <= M_MAX) + mi = m[i - 1]; + x0 = ifloor((x[i] - x1) * mi + 0.5); /* next corner */ + y0 = ifloor((y[i] - y1) * mi + 0.5); +#ifdef DEBUG_SPLINE_SEGMENTS + color++; + global_context->temporary_write_controls.foreground = color; +#endif + if ((n - 2) - i < skip_segments) + plotQuadBezier((x0 + x1) / 2, (y0 + y1) / 2, x1, y1, x2, y2); + x2 = (x0 + x1) / 2; + x1 = x0; + y2 = (y0 + y1) / 2; + y1 = y0; + } +#ifdef DEBUG_SPLINE_SEGMENTS + color++; + global_context->temporary_write_controls.foreground = color; +#endif + if (skip_segments > 0) + plotQuadBezier(x[0], y[0], x1, y1, x2, y2); +} +#endif + +static void +plotCubicSpline(int n, int x[], int y[], int skip_first_last) +{ +#define M_MAX 12 + double mi = 0.25, m[M_MAX]; /* diagonal constants of matrix */ + int x3, y3, x4, y4; + int i, x0, y0, x1, y1, x2, y2; +#ifdef DEBUG_SPLINE_SEGMENTS + RegisterNum color = 0; +#endif + + assert(n > 2); /* need at least 4 points P[0]..P[n] */ + +#ifdef DEBUG_SPLINE_POINTS + { + unsigned save_pattern; + + i = 0; + global_context->temporary_write_controls.foreground = 11; + save_pattern = global_context->temporary_write_controls.pattern; + global_context->temporary_write_controls.pattern = 0xff; + draw_patterned_arc(global_context, x[i], y[i], x[i] + 2, y[i], 0, + 3600, NULL, NULL); + i++; + global_context->temporary_write_controls.foreground = 15; + for (; i < n; i++) { + draw_patterned_arc(global_context, + x[i], y[i], + x[i] + 2, y[i], + 0, 3600, NULL, NULL); + } + global_context->temporary_write_controls.foreground = 10; + draw_patterned_arc(global_context, x[i], y[i], x[i] + 2, y[i], 0, + 3600, NULL, NULL); + global_context->temporary_write_controls.pattern = save_pattern; + } +#endif + + x3 = x[n - 1]; + y3 = y[n - 1]; + x4 = x[n]; + y4 = y[n]; + + x[1] = x0 = 12 * x[1] - 3 * x[0]; /* first row of matrix */ + y[1] = y0 = 12 * y[1] - 3 * y[0]; + + for (i = 2; i < n; i++) { /* forward sweep */ + if (i - 2 < M_MAX) + m[i - 2] = mi = 0.25 / (2.0 - mi); + x[i] = x0 = ifloor(12 * x[i] - 2 * x0 * mi + 0.5); + y[i] = y0 = ifloor(12 * y[i] - 2 * y0 * mi + 0.5); + } + x2 = ifloor((x0 - 3 * x4) / (7 - 4 * mi) + 0.5); /* correct last row */ + /* printf("y0=%d, y4=%d mi=%g\n", y0, y4, mi); */ + y2 = ifloor((y0 - 3 * y4) / (7 - 4 * mi) + 0.5); + /* printf("y2=%d, y3=%d, y4=%d\n", y2, y3, y4); */ +#ifdef DEBUG_SPLINE_SEGMENTS + color++; + global_context->temporary_write_controls.foreground = color; +#endif + if (!skip_first_last) + plotCubicBezier(x3, y3, (x2 + x4) / 2, (y2 + y4) / 2, x4, y4, x4, y4); + + if (n - 3 < M_MAX) + mi = m[n - 3]; + x1 = ifloor((x[n - 2] - 2 * x2) * mi + 0.5); + y1 = ifloor((y[n - 2] - 2 * y2) * mi + 0.5); + for (i = n - 3; i > 0; i--) { /* back substitution */ + if (i <= M_MAX) + mi = m[i - 1]; + x0 = ifloor((x[i] - 2 * x1) * mi + 0.5); + y0 = ifloor((y[i] - 2 * y1) * mi + 0.5); + x4 = ifloor((x0 + 4 * x1 + x2 + 3) / 6.0); /* reconstruct P[i] */ + y4 = ifloor((y0 + 4 * y1 + y2 + 3) / 6.0); +#ifdef DEBUG_SPLINE_SEGMENTS + color++; + global_context->temporary_write_controls.foreground = color; +#endif +#define CB_PARM(num) ifloor((num) / 3.0 + 0.5) + plotCubicBezier(x4, y4, + CB_PARM(2 * x1 + x2), + CB_PARM(2 * y1 + y2), + CB_PARM(x1 + 2 * x2), + CB_PARM(y1 + 2 * y2), + x3, y3); + x3 = x4; + y3 = y4; + x2 = x1; + y2 = y1; + x1 = x0; + y1 = y0; + } + x0 = x[0]; + x4 = ifloor((3 * x0 + 7 * x1 + 2 * x2 + 6) / 12.0); /* reconstruct P[1] */ + y0 = y[0]; + y4 = ifloor((3 * y0 + 7 * y1 + 2 * y2 + 6) / 12.0); +#ifdef DEBUG_SPLINE_SEGMENTS + global_context->temporary_write_controls.foreground = 4; +#endif + plotCubicBezier(x4, y4, + CB_PARM(2 * x1 + x2), + CB_PARM(2 * y1 + y2), + CB_PARM(x1 + 2 * x2), + CB_PARM(y1 + 2 * y2), + x3, y3); +#ifdef DEBUG_SPLINE_SEGMENTS + color++; + global_context->temporary_write_controls.foreground = color; +#endif + if (!skip_first_last) + plotCubicBezier(x0, y0, x0, y0, (x0 + x1) / 2, (y0 + y1) / 2, x4, y4); +} + +static unsigned +find_free_alphabet_index(RegisGraphicsContext *context, unsigned alphabet, + unsigned pixw, unsigned pixh) +{ + unsigned ii, jj; + + /* try an exact match */ + for (ii = 0U; ii < MAX_REGIS_ALPHABETS; ii++) { + if (context->alphabets[ii].alphabet_num == alphabet && + context->alphabets[ii].pixw == pixw && + context->alphabets[ii].pixh == pixh) { + return ii; + } + } + + /* otherwise use any empty slot */ + for (ii = 0U; ii < MAX_REGIS_ALPHABETS; ii++) { + if (context->alphabets[ii].alphabet_num == INVALID_ALPHABET_NUM) { + context->alphabets[ii].alphabet_num = alphabet; + context->alphabets[ii].pixw = pixw; + context->alphabets[ii].pixh = pixh; + return ii; + } + } + + /* otherwise recycle a slot with a different font size */ + for (ii = 0U; ii < MAX_REGIS_ALPHABETS; ii++) { + if (context->alphabets[ii].alphabet_num == alphabet) { + context->alphabets[ii].pixw = pixw; + context->alphabets[ii].pixh = pixh; + context->alphabets[ii].name[0] = '\0'; + context->alphabets[ii].fontname[0] = '\0'; + context->alphabets[ii].use_font = 0; + if (context->alphabets[ii].bytes != NULL) { + free(context->alphabets[ii].bytes); + context->alphabets[ii].bytes = NULL; + } + for (jj = 0U; jj < MAX_GLYPHS; jj++) { + context->alphabets[ii].loaded[jj] = 0; + } + return ii; + } + } + + /* finally just recycle this arbitrary slot */ + context->alphabets[0U].alphabet_num = alphabet; + context->alphabets[0U].pixw = pixw; + context->alphabets[0U].pixh = pixh; + context->alphabets[0U].name[0] = '\0'; + context->alphabets[0U].fontname[0] = '\0'; + context->alphabets[0U].use_font = 0; + if (context->alphabets[0U].bytes != NULL) { + free(context->alphabets[0U].bytes); + context->alphabets[0U].bytes = NULL; + } + for (jj = 0U; jj < MAX_GLYPHS; jj++) { + context->alphabets[0U].loaded[jj] = 0; + } + + return 0U; +} + +#ifdef DEBUG_SPECIFIC_CHAR_METRICS +static void +dump_bitmap_pixels(Char const *pixels, unsigned w, unsigned h) +{ + unsigned yy, xx; + + for (yy = 0U; yy < h; yy++) { + printf(" "); + for (xx = 0U; xx < w; xx++) { + if (pixels[yy * w + xx]) { + printf("#"); + } else { + printf("_"); + } + } + printf("\n"); + } +} +#endif + +#if OPT_RENDERFONT && defined(HAVE_TYPE_FCCHAR32) +static int +copy_bitmap_from_xft_font(Display *display, XftFont *font, FcChar32 ch, + Char *pixels, unsigned w, unsigned h, + unsigned xmin, unsigned ymin) +{ + /* + * FIXME: cache: + * - the bitmap for the last M characters and target dimensions + * - reuse the pixmap object where possible + */ + XftColor bg, fg; + Pixmap bitmap; + XftDraw *draw; + XImage *image; + unsigned bmw, bmh; + unsigned xx, yy; + + bg.pixel = 0UL; + bg.color.red = 0; + bg.color.green = 0; + bg.color.blue = 0; + bg.color.alpha = 0x0; + + fg.pixel = 1UL; + fg.color.red = 0xffff; + fg.color.green = 0xffff; + fg.color.blue = 0xffff; + fg.color.alpha = 0xffff; + + bmw = w + xmin; + bmh = h; + bitmap = XCreatePixmap(display, + DefaultRootWindow(display), + bmw, bmh, + 1); + if (bitmap == None) { + TRACE(("Unable to create Pixmap\n")); + return 0; + } + draw = XftDrawCreateBitmap(display, bitmap); + if (!draw) { + TRACE(("Unable to create XftDraw\n")); + XFreePixmap(display, bitmap); + return 0; + } + + XftDrawRect(draw, &bg, 0, 0, bmw, bmh); + XftDrawString32(draw, &fg, font, 0, font->ascent - (int) ymin, + &ch, 1); + + image = XGetImage(display, bitmap, (int) xmin, 0, w, h, 1UL, XYPixmap); + if (!image) { + TRACE(("Unable to create XImage\n")); + XftDrawDestroy(draw); + XFreePixmap(display, bitmap); + return 0; + } + + for (yy = 0U; yy < h; yy++) { + for (xx = 0U; xx < w; xx++) { + pixels[yy * w + xx] = (XGetPixel(image, (int) xx, (int) yy) != 0); + } + } + + XDestroyImage(image); + XftDrawDestroy(draw); + XFreePixmap(display, bitmap); + return 1; +} + +static void +get_xft_glyph_dimensions(Display *display, XftFont *font, unsigned *w, + unsigned *h, unsigned *xmin, unsigned *ymin) +{ + unsigned workw, workh; + FcChar32 ch; + Char *pixels; + Char *pixelp; + unsigned yy, xx; + unsigned char_count, pixel_count; + unsigned real_minx, real_maxx, real_miny, real_maxy; + unsigned char_minx, char_maxx, char_miny, char_maxy; + + /* + * For each ASCII or ISO-8859-1 printable code, find out what its + * dimensions are. + * + * We actually render the glyphs and determine the extents ourselves + * because the font library can lie by several pixels, and since we are + * doing manual character placement in fixed areas the glyph boundary needs + * to be accurate. + * + * Ignore control characters and spaces - their extent information is + * misleading. + */ + + /* Our "work area" is just a buffer which should be big enough to hold the + * largest glyph even if its size is under-reported by a couple of pixels + * in each dimension. + */ + workw = (unsigned) font->max_advance_width + 2U; + if (font->ascent + font->descent > font->height) { + workh = (unsigned) (font->ascent + font->descent) + 2U; + } else { + workh = (unsigned) font->height + 2U; + } + + if (!(pixels = malloc((size_t) (workw * workh)))) { + *w = 0U; + *h = 0U; + return; + } + + /* FIXME: ch is in UCS32 -- try to support non-ASCII characters */ + char_count = 0U; + real_minx = workw - 1U; + real_maxx = 0U; + real_miny = workh - 1U; + real_maxy = 0U; + for (ch = 33; ch < 256; ++ch) { + if (ch >= 127 && ch <= 160) + continue; + if (!FcCharSetHasChar(font->charset, ch)) + continue; + + if (!copy_bitmap_from_xft_font(display, font, ch, pixels, + workw, workh, 0U, 0U)) + continue; + + pixel_count = 0U; + char_minx = workh - 1U; + char_maxx = 0U; + char_miny = workh - 1U; + char_maxy = 0U; + pixelp = pixels; + for (yy = 0U; yy < workh; yy++) { + for (xx = 0U; xx < workw; xx++) { + if (*pixelp++) { + if (xx < char_minx) + char_minx = xx; + else if (xx > char_maxx) + char_maxx = xx; + if (yy < char_miny) + char_miny = yy; + else if (yy > char_maxy) + char_maxy = yy; + pixel_count++; + } + } + } + if (pixel_count < 1U) + continue; + +#ifdef DEBUG_SPECIFIC_CHAR_METRICS + if (IS_DEBUG_CHAR(ch)) { + printf("char: '%c' (%d)\n", (char) ch, ch); + printf(" minx: %u\n", char_minx); + printf(" maxx: %u\n", char_maxx); + printf(" miny: %u\n", char_miny); + printf(" maxy: %u\n", char_maxy); + dump_bitmap_pixels(pixels, workw, workh); + printf("\n"); + } +#endif + + if (char_minx < real_minx) + real_minx = char_minx; + if (char_maxx > real_maxx) + real_maxx = char_maxx; + if (char_miny < real_miny) + real_miny = char_miny; + if (char_maxy > real_maxy) + real_maxy = char_maxy; + char_count++; + } + + free(pixels); + + if (char_count < 1U) { + *w = 0U; + *h = 0U; + return; + } + + *w = (unsigned) (1 + real_maxx - real_minx); + *h = (unsigned) (1 + real_maxy - real_miny); + *xmin = real_minx; + *ymin = real_miny; + +#ifdef DEBUG_COMPUTED_FONT_METRICS + printf("reported metrics:\n"); + printf(" %ux%u ascent=%u descent=%u\n", font->max_advance_width, + font->height, font->ascent, font->descent); + printf("computed metrics:\n"); + printf(" real_minx=%u real_maxx=%u real_miny=%u real_maxy=%u\n", + real_minx, real_maxx, real_miny, real_maxy); + printf(" final: %ux%u xmin=%u ymin=%u\n", *w, *h, *xmin, *ymin); +#endif +} + +#define FONT_SIZE_CACHE_SIZE 32U + +/* Find the font pixel size which returns the font which is closest to the given + * maxw and maxh without overstepping either dimension. + */ +static XftFont * +find_best_xft_font_size(XtermWidget xw, + char const *fontname, + unsigned maxw, unsigned maxh, unsigned max_pixels, + unsigned *w, unsigned *h, + unsigned *xmin, unsigned *ymin) +{ + Display *display = XtDisplay(xw); + Screen *screen = XtScreen(xw); + XftFont *font; + unsigned targeth; + unsigned ii, cacheindex; + static struct { + char fontname[REGIS_FONTNAME_LEN]; + unsigned maxw, maxh, max_pixels; + unsigned targeth; + unsigned w, h; + unsigned xmin; + unsigned ymin; + } cache[FONT_SIZE_CACHE_SIZE]; + + assert(display); + assert(screen); + assert(fontname); + assert(w); + assert(h); + assert(xmin); + assert(ymin); + + cacheindex = FONT_SIZE_CACHE_SIZE; + for (ii = 0U; ii < FONT_SIZE_CACHE_SIZE; ii++) { + if (cache[ii].maxw == maxw && cache[ii].maxh == maxh && + cache[ii].max_pixels == max_pixels && + strcmp(cache[ii].fontname, fontname) == 0) { + cacheindex = ii; + break; + } + } + + if (cacheindex < FONT_SIZE_CACHE_SIZE) { + targeth = cache[cacheindex].targeth; + } else { + targeth = maxh * 10U + 5U; + } + for (;;) { + if (targeth <= 5U) { + TRACE(("Giving up finding suitable Xft font size for %ux%u.\n", + maxw, maxh)); + return NULL; + } + + /* + * Xft does a bad job at: + * - two-color low-resolution anti-aliased fonts + * - non-anti-aliased fonts at low resolution unless a font size is + * given (pixel size does not help, and the value of the font size + * doesn't appear to matter). + * + * In those two cases it literally drops pixels, sometimes whole + * columns, making the glyphs unreadable and ugly even when readable. + */ + /* + * FIXME: + * Also, we need to scale the width and height separately. The + * CHAR_WIDTH and CHAR_HEIGHT attributes would seem to be ideal, but + * don't appear to have any effect if set. Instead we will manually + * scale the bitmap later, which may be very ugly because we won't try + * to identify different parts of glyphs or preserve density. + */ + { + XftPattern *pat; + XftPattern *match; + XftResult status; + + font = NULL; + if ((pat = XftNameParse(fontname))) { + XftPatternBuild(pat, + /* arbitrary value */ + XFT_SIZE, XftTypeDouble, 12.0, + XFT_PIXEL_SIZE, XftTypeDouble, (double) + targeth / 10.0, +#if 0 + XFT_CHAR_WIDTH, XftTypeInteger, (int) maxw, + XFT_CHAR_HEIGHT, XftTypeInteger, (int) + (targeth / 10U), +#endif + XFT_SPACING, XftTypeInteger, XFT_MONO, + XFT_SLANT, XftTypeInteger, 0, + XFT_ANTIALIAS, XftTypeBool, False, + NULL); + if ((match = XftFontMatch(display, + XScreenNumberOfScreen(screen), + pat, &status))) { + font = XftFontOpenPattern(display, match); + maybeXftCache(xw, font); + } + XftPatternDestroy(pat); + } + } + if (!font) { + TRACE(("Unable to open a monospaced Xft font.\n")); + return NULL; + } +#ifdef DEBUG_FONT_SIZE_SEARCH + { + char buffer[1024]; + + if (XftNameUnparse(font->pattern, buffer, (int) sizeof(buffer))) { + printf("Testing font named \"%s\"\n", buffer); + } else { + printf("Testing unknown font\n"); + } + } +#endif + + if (cacheindex < FONT_SIZE_CACHE_SIZE && + targeth == cache[cacheindex].targeth) { + *w = cache[cacheindex].w; + *h = cache[cacheindex].h; + *xmin = cache[cacheindex].xmin; + *ymin = cache[cacheindex].ymin; + } else { + get_xft_glyph_dimensions(display, font, w, h, xmin, ymin); + } +#ifdef DEBUG_FONT_SIZE_SEARCH + printf("checking max=%ux%u targeth=%u.%u\n", maxw, maxh, targeth / + 10U, targeth % 10U); +#endif + + if (*h > maxh) { + XftFontClose(display, font); +#ifdef DEBUG_FONT_SIZE_SEARCH + printf("got %ux%u glyph; too tall; reducing target size\n", *w, *h); +#endif + if (*h > 2U * maxh) { + targeth /= (*h / maxh); + } else if (targeth > 10U && *h > maxh + 1U) { + targeth -= 10U; + } else { + targeth--; + } + continue; + } + if (*w > maxw) { + XftFontClose(display, font); +#ifdef DEBUG_FONT_SIZE_SEARCH + printf("got %ux%u glyph; too wide; reducing target size\n", *w, *h); +#endif + if (*w > 2U * maxw) { + targeth /= (*w / maxw); + } else if (targeth > 10U && *w > maxw + 1U) { + targeth -= 10U; + } else { + targeth--; + } + continue; + } + if (*w * *h > max_pixels) { + XftFontClose(display, font); +#ifdef DEBUG_FONT_SIZE_SEARCH + printf("got %ux%u glyph; too many pixels; reducing target size\n", + *w, *h); +#endif + if (*w * *h > 2U * max_pixels) { + unsigned min = *w < *h ? *w : *h; + unsigned divisor = (*w * *h) / (max_pixels * min); + if (divisor > 1U) { + targeth /= divisor; + } else if (targeth > 10U) { + targeth -= 10U; + } else { + targeth--; + } + } else { + targeth--; + } + continue; + } +#ifdef DEBUG_FONT_NAME + { + char buffer[1024]; + + if (XftNameUnparse(font->pattern, buffer, (int) sizeof(buffer))) { + printf("Final font for \"%s\" max %dx%d is \"%s\"\n", + fontname, maxw, maxh, buffer); + } else { + printf("Final font for \"%s\" max %dx%d is unknown\n", + fontname, maxw, maxh); + } + } +#endif + + if (cacheindex == FONT_SIZE_CACHE_SIZE) { + for (ii = 0U; ii < FONT_SIZE_CACHE_SIZE; ii++) { + if (cache[ii].maxw == 0U || cache[ii].maxh == 0U || + cache[ii].max_pixels == 0U) { + CopyFontname(cache[ii].fontname, fontname); + cache[ii].maxw = maxw; + cache[ii].maxh = maxh; + cache[ii].max_pixels = max_pixels; + cache[ii].targeth = targeth; + cache[ii].w = *w; + cache[ii].h = *h; + cache[ii].xmin = *xmin; + cache[ii].ymin = *ymin; + break; + } + } + if (ii == FONT_SIZE_CACHE_SIZE) { + ii = targeth % FONT_SIZE_CACHE_SIZE; + CopyFontname(cache[ii].fontname, fontname); + cache[ii].maxw = maxw; + cache[ii].maxh = maxh; + cache[ii].max_pixels = max_pixels; + cache[ii].targeth = targeth; + cache[ii].w = *w; + cache[ii].h = *h; + cache[ii].xmin = *xmin; + cache[ii].ymin = *ymin; + } + } + return font; + } +} +#endif + +static int +get_xft_bitmap_of_character(RegisGraphicsContext const *context, + char const *fontname, int ch, + unsigned maxw, unsigned maxh, Char *pixels, + unsigned max_pixels, unsigned *w, unsigned *h) +{ + /* + * See Xft / RENDERFONT stuff in fontutils.c and used in utils.c + * Add a separate configuration for ReGIS. + */ + /* + * FIXME: cache: + * - reuse the font where possible + */ +#ifdef XRENDERFONT + XtermWidget xw = context->destination_graphic->xw; + Display *display = XtDisplay(xw); + XftFont *font; + unsigned xmin = 0U, ymin = 0U; + + if (!(font = find_best_xft_font_size(xw, fontname, maxw, maxh, + max_pixels, w, h, &xmin, &ymin))) { + TRACE(("Unable to find suitable Xft font\n")); + return 0; + } + + if (!copy_bitmap_from_xft_font(display, font, CharOf(ch), pixels, *w, *h, + xmin, ymin)) { + TRACE(("Unable to create bitmap for '%c'\n", ch)); + XftFontClose(display, font); + return 0; + } + XftFontClose(display, font); + return 1; +#else + (void) context; + (void) fontname; + (void) ch; + (void) maxw; + (void) maxh; + (void) pixels; + (void) max_pixels; + (void) w; + (void) h; + + return 0; +#endif +} + +static unsigned +find_best_alphabet_index(RegisGraphicsContext const *context, + unsigned minw, unsigned minh, + unsigned maxw, unsigned maxh, + unsigned max_pixels) +{ + unsigned ii; + unsigned bestmatch; + unsigned bestw, besth; + + assert(context); + assert(maxw); + assert(maxh); + + bestmatch = MAX_REGIS_ALPHABETS; + bestw = 0U; + besth = 0U; + for (ii = 0U; ii < MAX_REGIS_ALPHABETS; ii++) { + if (context->alphabets[ii].alphabet_num == + context->current_text_controls->alphabet_num && + context->alphabets[ii].pixw >= minw && + context->alphabets[ii].pixh >= minh && + context->alphabets[ii].pixw <= maxw && + context->alphabets[ii].pixh <= maxh && + context->alphabets[ii].pixw > bestw && + context->alphabets[ii].pixh > besth && + context->alphabets[ii].pixw * + context->alphabets[ii].pixh <= max_pixels) { + bestmatch = ii; + bestw = context->alphabets[ii].pixw; + besth = context->alphabets[ii].pixh; + } + } + +#ifdef DEBUG_ALPHABET_LOOKUP + if (bestmatch < MAX_REGIS_ALPHABETS) { + TRACE(("found alphabet %u at index %u size %ux%u font=%s\n", + context->current_text_controls->alphabet_num, bestmatch, + bestw, besth, + context->alphabets[bestmatch].use_font ? + context->alphabets[bestmatch].fontname : "(none)")); + } +#endif + + return bestmatch; +} + +#define GLYPH_WIDTH_BYTES(PIXW) ( ((PIXW) + 7U) >> 3U ) + +static int +get_user_bitmap_of_character(RegisGraphicsContext const *context, + int ch, + unsigned alphabet_index, + Char *pixels) +{ + const Char *glyph; + unsigned w, h; + unsigned xx, yy; + unsigned byte, bit; + + assert(context); + assert(pixels); + + if (!context->alphabets[alphabet_index].loaded[(Char) ch]) { + TRACE(("in alphabet %u with alphabet index %u user glyph for '%c' not loaded\n", + context->current_text_controls->alphabet_num, alphabet_index, + ch)); + return 0; + } + + assert(context->alphabets[alphabet_index].bytes); + + w = context->alphabets[alphabet_index].pixw; + h = context->alphabets[alphabet_index].pixh; + glyph = &context->alphabets[alphabet_index] + .bytes[(Char) ch * GLYPH_WIDTH_BYTES(w) * h]; + + for (yy = 0U; yy < h; yy++) { + for (xx = 0U; xx < w; xx++) { + byte = yy * GLYPH_WIDTH_BYTES(w) + (xx >> 3U); + bit = xx & 7U; + pixels[yy * w + xx] = ((unsigned) glyph[byte] >> (7U - bit)) & 1U; + } + } + + return 1; +} + +/* + * alphabets + * 0 built-in + * 1-N custom (max is 3 on VT3X0 -- up to MAX_REGIS_ALPHABETS with xterm) + * + * built-in 7-bit charsets + * (B ASCII + * (0 DEC special graphics + * (> DEC technical + * (A NCR British + * (4 NCR Dutch + * (5 NCR Finnish + * (R NCR French + * (9 NCR French Canadian + * (K NCR German + * (Y NCR Italian + * (' NCR Norwegian/Danish + * (!6 NCR Portuguese + * (Z NCR Spanish + * (7 NCR Swedish + * (- NCR Swiss + * + * -@ ??? + * + * built-in 8-bit charsets + * )%5 DEC supplemental graphics + * -A ISO Latin-1 supplemental + * )< user-preferred supplemental (94 chars) + * + * defaults + * terminal char cell size charsets angle + * VT3x0 S1 0:ASCII(94) 0 (positive) + * + */ +static void +get_bitmap_of_character(RegisGraphicsContext const *context, int ch, + unsigned maxw, unsigned maxh, Char *pixels, + unsigned *w, unsigned *h, unsigned max_pixels) +{ + unsigned bestmatch; + char const *fontname = NULL; + + assert(context); + assert(w); + assert(h); + + if (context->current_text_controls->alphabet_num == 0) + fontname = context->builtin_font; + + *w = 0U; + *h = 0U; + + bestmatch = find_best_alphabet_index(context, 1U, 1U, maxw, maxh, + max_pixels); + if (bestmatch < MAX_REGIS_ALPHABETS) { + RegisAlphabet const *alpha = &context->alphabets[bestmatch]; + + if (!alpha->use_font && + get_user_bitmap_of_character(context, ch, bestmatch, pixels)) { +#ifdef DEBUG_USER_GLYPH + TRACE(("found user glyph for alphabet number %d (index %u)\n\n", + context->current_text_controls->alphabet_num, bestmatch)); +#endif + *w = alpha->pixw; + *h = alpha->pixh; + return; + } + + if (alpha->use_font) + fontname = alpha->fontname; + } + + if (fontname) { + if (get_xft_bitmap_of_character(context, fontname, ch, + maxw, maxh, pixels, + max_pixels, w, h)) { + if (*w > maxw) { + TRACE(("BUG: Xft glyph is too wide: %ux%u but max is %ux%u\n", + *w, *h, maxw, maxh)); + } else if (*h > maxh) { + TRACE(("BUG: Xft glyph is too tall: %ux%u but max is %ux%u\n", + *w, *h, maxw, maxh)); + } else if (*w * *h > max_pixels) { + TRACE(("BUG: Xft glyph has too many pixels: %u but max is %u\n", + *w * *h, max_pixels)); + } else { + TRACE(("got glyph from \"%s\" for alphabet number %d\n", + fontname, context->current_text_controls->alphabet_num)); +#ifdef DEBUG_SPECIFIC_CHAR_METRICS + if (IS_DEBUG_CHAR(ch)) { + printf("got %ux%u Xft bitmap for '%c' target size %ux%u:\n", + *w, *h, + ch, maxw, maxh); + dump_bitmap_pixels(pixels, *w, *h); + printf("\n"); + } +#endif + return; + } + } + } + + TRACE(("unable to load any bitmap for character '%c' in alphabet number %u at %ux%u\n", + ch, context->current_text_controls->alphabet_num, maxw, maxh)); + + /* + * The VT3x0 series (and probably earlier ReGIS implementations) use a solid + * block glyph for unknown glyphs. + */ + { + unsigned xx, yy; + + *w = MIN2(8U, maxh); + *h = MIN2(10U, maxw); + for (yy = 0U; yy < *h; yy++) + for (xx = 0U; xx < *w; xx++) + pixels[yy * *w + xx] = '\1'; + } +} + +#define ROT_SHEAR_SCALE 8192 +#define SIGNED_UNSIGNED_MOD(VAL, BASE) ( (((VAL) % (int) (BASE)) + (int) (BASE)) % (int) (BASE) ) + +static unsigned +get_shade_character_pixel(Char const *pixels, unsigned w, unsigned h, + unsigned smaxf, unsigned scale, int slant_dx, + int px, int py) +{ + unsigned wx, wy; + unsigned fx, fy; + + wx = (unsigned) SIGNED_UNSIGNED_MOD(px - + (slant_dx * SIGNED_UNSIGNED_MOD(py, smaxf)) + / ROT_SHEAR_SCALE, smaxf); + wy = (unsigned) SIGNED_UNSIGNED_MOD(py, smaxf); + + fx = (wx * scale) >> SCALE_FIXED_POINT; + fy = (wy * scale) >> SCALE_FIXED_POINT; + if (fx < w && fy < h) { + return (unsigned) pixels[fy * w + fx]; + } + return 0U; +} + +static void +draw_character(RegisGraphicsContext *context, int ch, + int slant_dx, int rot_shear_x, + int rot_shear_y, int x_sign_x, int x_sign_y, + int y_sign_x, int y_sign_y) +{ + const unsigned xmaxd = context->current_text_controls->character_display_w; + const unsigned ymaxd = context->current_text_controls->character_display_h; + const unsigned xmaxf = context->current_text_controls->character_unit_cell_w; + const unsigned ymaxf = context->current_text_controls->character_unit_cell_h; + unsigned w, h; + unsigned xscale, yscale; + unsigned fx, fy; + unsigned px, py; + int sx; + int rx, ry; + int ox, oy; + unsigned pad_left, pad_right; + unsigned pad_top, pad_bottom; + Char pixels[MAX_GLYPH_PIXELS]; + unsigned value; + + get_bitmap_of_character(context, ch, xmaxf, ymaxf, pixels, &w, &h, + MAX_GLYPH_PIXELS); + if (w < 1 || h < 1) { + return; + } + + if (xmaxd > xmaxf) { + pad_left = (xmaxd - xmaxf) / 2U; + pad_right = (xmaxd - xmaxf) - pad_left; + } else { + pad_left = 0U; + pad_right = 0U; + } + if (ymaxd > ymaxf) { + pad_top = (ymaxd - ymaxf) / 2U; + pad_bottom = (ymaxd - ymaxf) - pad_top; + } else { + pad_top = 0U; + pad_bottom = 0U; + } + + xscale = (w << SCALE_FIXED_POINT) / xmaxf; + yscale = (h << SCALE_FIXED_POINT) / ymaxf; + + for (py = 0U; py < ymaxd; py++) { + for (px = 0U; px < xmaxd; px++) { + if (py < pad_top || px < pad_left || + py >= ymaxd - pad_bottom || px >= xmaxd - pad_right) { + value = 0U; + } else { + fx = ((px - pad_left) * xscale) >> SCALE_FIXED_POINT; + fy = ((py - pad_top) * yscale) >> SCALE_FIXED_POINT; + if (fx < w && fy < h) { + value = (unsigned) pixels[fy * w + fx]; + } else { + value = 0U; + } + } + + sx = (int) px + (slant_dx * (int) py) / ROT_SHEAR_SCALE; + rx = x_sign_x * sx + x_sign_y * (int) py; + ry = y_sign_x * sx + y_sign_y * (int) py; + ox = rx + (rot_shear_x * ry) / ROT_SHEAR_SCALE; + oy = ry + (rot_shear_y * ox) / ROT_SHEAR_SCALE; + ox += (rot_shear_x * oy) / ROT_SHEAR_SCALE; + + draw_regis_pixel(context, + (int) context->graphics_output_cursor_x + ox, + (int) context->graphics_output_cursor_y + oy, + value); + } + } +} + +static void +move_text(RegisGraphicsContext *context, int dx, int dy) +{ + double total_rotation; + int str_invert; + int str_shear_x, str_shear_y; + int ox, oy; + + total_rotation = 2.0 * M_PI * + context->current_text_controls->string_rotation / 360.0; + while (total_rotation > 1.5 * M_PI) { + total_rotation -= 2.0 * M_PI; + } + if (total_rotation > 0.5 * M_PI) { + total_rotation -= M_PI; + str_invert = -1; + } else { + str_invert = 1; + } + str_shear_x = (int) (ROT_SHEAR_SCALE * -tan(0.5 * -total_rotation)); + str_shear_y = (int) (ROT_SHEAR_SCALE * sin(-total_rotation)); + + total_rotation = 2.0 * M_PI * + context->current_text_controls->character_rotation / 360.0; + while (total_rotation > 1.5 * M_PI) { + total_rotation -= 2.0 * M_PI; + } + + TRACE(("str_shear: %.5f, %.5f (sign=%d)\n", + str_shear_x / (double) ROT_SHEAR_SCALE, + str_shear_y / (double) ROT_SHEAR_SCALE, + str_invert)); + + ox = str_invert * dx + (str_shear_x * dy) / ROT_SHEAR_SCALE; + oy = str_invert * dy + (str_shear_y * ox) / ROT_SHEAR_SCALE; + ox += (str_shear_x * oy) / ROT_SHEAR_SCALE; + + TRACE(("after pv output updating position %+d,%+d\n", ox, oy)); + context->graphics_output_cursor_x += ox; + context->graphics_output_cursor_y += oy; + + return; +} + +#define UPSCALE_TEXT_DIMENSION(D) do { \ + *(D) = (unsigned)((double)(*(D)) * M_SQRT2); \ + } while (0) + +static void +draw_text(RegisGraphicsContext *context, char const *str) +{ +#ifndef ENABLE_DISTORTIONLESS_ROTATION + RegisTextControls *old_text_controls = NULL; + static RegisTextControls scratch_text_controls; +#endif + double total_rotation; + size_t ii; + int str_invert; + int str_shear_x, str_shear_y; + int slant_dx; + int chr_x_sign_x, chr_x_sign_y; + int chr_y_sign_x, chr_y_sign_y; + int chr_shear_x, chr_shear_y; + int begin_x, begin_y; + int rx, ry; + int ox, oy; + +#ifdef DEBUG_ALPHABETS + { + unsigned n; + + for (n = 0U; n < MAX_REGIS_ALPHABETS; n++) { + printf("alphabet index %u\n", n); + if (context->alphabets[n].alphabet_num != INVALID_ALPHABET_NUM) { + printf(" alphabet_num=%u\n", context->alphabets[n].alphabet_num); + printf(" pixw=%d\n", context->alphabets[n].pixw); + printf(" pixh=%d\n", context->alphabets[n].pixh); + printf(" name=\"%s\"\n", context->alphabets[n].name); + printf(" use_font=%d\n", context->alphabets[n].use_font); + printf(" fontname=\"%s\"\n", context->alphabets[n].fontname); + printf(" bytes=%p\n", context->alphabets[n].bytes); + } + } + } +#endif + + if (context->current_text_controls->slant <= -75 || + context->current_text_controls->slant >= +75) { + TRACE(("ERROR: unsupported character slant angle %d\n", + context->current_text_controls->slant)); + return; + } + + /* FIXME: grab when first entering command */ + begin_x = context->graphics_output_cursor_x; + begin_y = context->graphics_output_cursor_y; + +#ifndef ENABLE_DISTORTIONLESS_ROTATION + if (context->current_text_controls->character_rotation != 0 && + context->current_text_controls->character_rotation != 90 && + context->current_text_controls->character_rotation != 180 && + context->current_text_controls->character_rotation != 270) { + old_text_controls = context->current_text_controls; + scratch_text_controls = *context->current_text_controls; + UPSCALE_TEXT_DIMENSION(&scratch_text_controls.character_display_w); + UPSCALE_TEXT_DIMENSION(&scratch_text_controls.character_display_h); + /* FIXME: Not sure if this is really scaled. The increment seems to + * _not_ be scaled. + */ + UPSCALE_TEXT_DIMENSION(&scratch_text_controls.character_unit_cell_w); + UPSCALE_TEXT_DIMENSION(&scratch_text_controls.character_unit_cell_h); + context->current_text_controls = &scratch_text_controls; + TRACE(("scaled up text to %dx%d\n", + scratch_text_controls.character_display_w, + scratch_text_controls.character_display_h)); + } +#endif + + total_rotation = 2.0 * M_PI * + context->current_text_controls->string_rotation / 360.0; + while (total_rotation > 1.5 * M_PI) { + total_rotation -= 2.0 * M_PI; + } + if (total_rotation > 0.5 * M_PI) { + total_rotation -= M_PI; + str_invert = -1; + } else { + str_invert = 1; + } + str_shear_x = (int) (ROT_SHEAR_SCALE * -tan(0.5 * -total_rotation)); + str_shear_y = (int) (ROT_SHEAR_SCALE * sin(-total_rotation)); + + total_rotation = 2.0 * M_PI * + context->current_text_controls->character_rotation / 360.0; + while (total_rotation > 1.5 * M_PI) { + total_rotation -= 2.0 * M_PI; + } + if (total_rotation > 0.5 * M_PI) { + total_rotation -= M_PI; + chr_x_sign_x = -1; + chr_x_sign_y = 0; + chr_y_sign_x = 0; + chr_y_sign_y = -1; + } else { + chr_x_sign_x = 1; + chr_x_sign_y = 0; + chr_y_sign_x = 0; + chr_y_sign_y = 1; + } + chr_shear_x = (int) (ROT_SHEAR_SCALE * -tan(0.5 * -total_rotation)); + chr_shear_y = (int) (ROT_SHEAR_SCALE * sin(-total_rotation)); + + { + const int slant = context->current_text_controls->slant; + + TRACE(("float version: %.5f\n", tan(2.0 * M_PI * abs(slant) / 360.0))); + /* The slant is negative for forward-leaning characters. */ + if (slant > 0) { + slant_dx = (int) +(tan(2.0 * M_PI * abs(slant) / 360.0) * ROT_SHEAR_SCALE); + } else if (slant < 0) { + slant_dx = (int) -(tan(2.0 * M_PI * abs(slant) / 360.0) * ROT_SHEAR_SCALE); + } else { + slant_dx = 0; + } + TRACE(("string rotation: %d\n", + context->current_text_controls->string_rotation)); + TRACE(("character rotation: %d\n", + context->current_text_controls->character_rotation)); + TRACE(("character slant: %d (%.5f pixels per line)\n", + slant, slant_dx / (double) ROT_SHEAR_SCALE)); + } + + TRACE(("str_shear: %.5f, %.5f (sign=%d)\n", + str_shear_x / (double) ROT_SHEAR_SCALE, + str_shear_y / (double) ROT_SHEAR_SCALE, + str_invert)); + TRACE(("chr_shear: %.5f, %.5f (xsign=%d,%d, ysign=%d,%d)\n", + chr_shear_x / (double) ROT_SHEAR_SCALE, + chr_shear_y / (double) ROT_SHEAR_SCALE, + chr_x_sign_x, chr_x_sign_y, + chr_y_sign_x, chr_y_sign_y)); + TRACE(("character_inc: %d,%d\n", + context->current_text_controls->character_inc_x, context->current_text_controls->character_inc_y)); + + rx = 0; + ry = 0; + for (ii = 0U; ii < strlen(str); ii++) { + switch (str[ii]) { + case '\r': + rx = 0; + break; + case '\n': + ry += (int) context->current_text_controls->character_display_h; + break; + case '\b': + rx -= context->current_text_controls->character_inc_x; + ry -= context->current_text_controls->character_inc_y; + break; + case '\t': + rx += context->current_text_controls->character_inc_x; + ry += context->current_text_controls->character_inc_y; + break; + default: + ox = str_invert * rx + (str_shear_x * ry) / ROT_SHEAR_SCALE; + oy = str_invert * ry + (str_shear_y * ox) / ROT_SHEAR_SCALE; + ox += (str_shear_x * oy) / ROT_SHEAR_SCALE; + TRACE(("during text output updating position to %d,%d + %+d,%+d for '%c'\n", + begin_x, begin_y, ox, oy, str[ii])); + context->graphics_output_cursor_x = begin_x + ox; + context->graphics_output_cursor_y = begin_y + oy; + draw_character(context, str[ii], slant_dx, + chr_shear_x, chr_shear_y, + chr_x_sign_x, chr_x_sign_y, + chr_y_sign_x, chr_y_sign_y); + rx += context->current_text_controls->character_inc_x; + ry += context->current_text_controls->character_inc_y; + } + } + + ox = str_invert * rx + (str_shear_x * ry) / ROT_SHEAR_SCALE; + oy = str_invert * ry + (str_shear_y * ox) / ROT_SHEAR_SCALE; + ox += (str_shear_x * oy) / ROT_SHEAR_SCALE; + TRACE(("after text output updating position to %d,%d + %+d,%+d\n", + begin_x, begin_y, ox, oy)); + context->graphics_output_cursor_x = begin_x + ox; + context->graphics_output_cursor_y = begin_y + oy; + +#ifndef ENABLE_DISTORTIONLESS_ROTATION + if (context->current_text_controls->character_rotation != 0 && + context->current_text_controls->character_rotation != 90 && + context->current_text_controls->character_rotation != 180 && + context->current_text_controls->character_rotation != 270) { + context->current_text_controls = old_text_controls; + } +#endif + + context->destination_graphic->dirty = 1; + return; +} + +/* + * standard character cell sizes + * number disp cell unit cell offset + * S0 [ 9, 10] [ 8, disp_h] [disp_w, 0] + * S1 [ 9, 20] [ 8, disp_h] [disp_w, 0] + * S2 [ 18, 30] [ 16, disp_h] [disp_w, 0] + * S3 [ 27, 45] [ 24, disp_h] [disp_w, 0] + * S4 [ 36, 60] [ 32, disp_h] [disp_w, 0] + * S5 [ 45, 75] [ 40, disp_h] [disp_w, 0] + * S6 [ 54, 90] [ 48, disp_h] [disp_w, 0] + * S7 [ 63,105] [ 56, disp_h] [disp_w, 0] + * S8 [ 72,120] [ 64, disp_h] [disp_w, 0] + * S9 [ 81,135] [ 72, disp_h] [disp_w, 0] + * S10 [ 90,150] [ 80, disp_h] [disp_w, 0] + * S11 [ 99,165] [ 88, disp_h] [disp_w, 0] + * S12 [108,180] [ 96, disp_h] [disp_w, 0] + * S13 [117,195] [104, disp_h] [disp_w, 0] + * S14 [126,210] [112, disp_h] [disp_w, 0] + * S15 [135,225] [120, disp_h] [disp_w, 0] + * S16 [144,240] [128, disp_h] [disp_w, 0] + */ +static int +get_standard_character_size(int standard, unsigned *disp_w, unsigned + *disp_h, unsigned *unit_w, unsigned *unit_h, + int *off_x, int *off_y) +{ + switch (standard) { + case 0: + *disp_w = 9U; + *disp_h = 10U; + *unit_w = 8U; + break; + case 1: + *disp_w = 9U; + *disp_h = 20U; + *unit_w = 8U; + break; + case 2: + *disp_w = 18U; + *disp_h = 30U; + *unit_w = 16U; + break; + case 3: + *disp_w = 27U; + *disp_h = 45U; + *unit_w = 24U; + break; + case 4: + *disp_w = 36U; + *disp_h = 60U; + *unit_w = 32U; + break; + case 5: + *disp_w = 45U; + *disp_h = 75U; + *unit_w = 40U; + break; + case 6: + *disp_w = 54U; + *disp_h = 90U; + *unit_w = 48U; + break; + case 7: + *disp_w = 63U; + *disp_h = 105U; + *unit_w = 56U; + break; + case 8: + *disp_w = 72U; + *disp_h = 120U; + *unit_w = 64U; + break; + case 9: + *disp_w = 81U; + *disp_h = 135U; + *unit_w = 72U; + break; + case 10: + *disp_w = 90U; + *disp_h = 150U; + *unit_w = 80U; + break; + case 11: + *disp_w = 99U; + *disp_h = 165U; + *unit_w = 88U; + break; + case 12: + *disp_w = 108U; + *disp_h = 180U; + *unit_w = 96U; + break; + case 13: + *disp_w = 117U; + *disp_h = 195U; + *unit_w = 104U; + break; + case 14: + *disp_w = 126U; + *disp_h = 210U; + *unit_w = 112U; + break; + case 15: + *disp_w = 135U; + *disp_h = 225U; + *unit_w = 120U; + break; + case 16: + *disp_w = 144U; + *disp_h = 240U; + *unit_w = 128U; + break; + default: + return 1; + } + *unit_h = *disp_h; + *off_x = (int) *disp_w; + *off_y = 0; + + return 0; +} + +static void +init_fragment(RegisDataFragment *fragment, char const *str) +{ + assert(fragment); + assert(str); + + fragment->start = str; + fragment->len = (unsigned) strlen(str); + fragment->pos = 0U; +} + +static void +copy_fragment(RegisDataFragment *dst, RegisDataFragment const *src) +{ + assert(dst); + assert(src); + + dst->start = src->start; + dst->len = src->len; + dst->pos = src->pos; +} + +static char +peek_fragment(RegisDataFragment const *fragment) +{ + assert(fragment); + + if (fragment->pos < fragment->len) { + return fragment->start[fragment->pos]; + } + return '\0'; +} + +static char +pop_fragment(RegisDataFragment *fragment) +{ + assert(fragment); + + if (fragment->pos < fragment->len) { + return fragment->start[fragment->pos++]; + } + return '\0'; +} + +static char +get_fragment(RegisDataFragment const *fragment, unsigned pos) +{ + assert(fragment); + + if (fragment->pos + pos < fragment->len) { + return fragment->start[fragment->pos + pos]; + } + return '\0'; +} + +#define fragment_length(f) (f)->len + +static unsigned +fragment_remaining(RegisDataFragment const *fragment) +{ + assert(fragment); + + if (fragment->pos > fragment->len) + return 0U; + return fragment->len - fragment->pos; +} + +static int +fragment_consumed(RegisDataFragment const *fragment) +{ + assert(fragment); + + return fragment->pos >= fragment->len; +} + +static void +fragment_to_string(RegisDataFragment const *fragment, char *out, + unsigned outlen) +{ + unsigned remaininglen; + unsigned endpos; + + assert(fragment); + assert(out); + + if (!outlen) + return; + remaininglen = fragment->len - fragment->pos; + if (remaininglen < outlen - 1U) { + endpos = remaininglen; + } else { + endpos = outlen - 1U; + } + strncpy(out, &fragment->start[fragment->pos], (size_t) endpos); + out[endpos] = '\0'; +} + +#define MAX_FRAG 1024 +static char const * +fragment_to_tempstr(RegisDataFragment const *fragment) +{ + static char tempstr[MAX_FRAG]; + + assert(fragment); + + fragment_to_string(fragment, tempstr, MAX_FRAG); + return tempstr; +} + +static int +skip_regis_whitespace(RegisDataFragment *input) +{ + int skipped = 0; + + assert(input); + + while (!fragment_consumed(input)) { + char ch = peek_fragment(input); + if (ch != ',' && !IsSpace(ch)) { + break; + } + if (ch == '\n') { + TRACE(("end of input line\n\n")); + } + skipped = 1; + pop_fragment(input); + } + + if (skipped) + return 1; + return 0; +} + +static int +extract_regis_extent(RegisDataFragment *input, RegisDataFragment *output) +{ + char ch; + + assert(input); + assert(output); + + output->start = &input->start[input->pos]; + output->len = 0U; + output->pos = 0U; + + if (input->pos >= input->len) + return 0; + + ch = input->start[input->pos]; + if (ch != '[') + return 0; + input->pos++; + output->start++; + + /* FIXME: truncate to 16 bit signed integers */ + for (; input->pos < input->len; input->pos++, output->len++) { + ch = input->start[input->pos]; + if (ch == ';') { + TRACE(("DATA_ERROR: end of input before closing bracket\n")); + break; + } + if (ch == ']') + break; + } + if (ch == ']') + input->pos++; + + return 1; +} + +static int +extract_regis_num(RegisDataFragment *input, RegisDataFragment *output) +{ + char ch = 0; + int has_digits = 0; + + assert(input); + assert(output); + + output->start = &input->start[input->pos]; + output->len = 0U; + output->pos = 0U; + + if (input->start[input->pos] == '-' || + input->start[input->pos] == '+') { + input->pos++; + output->len++; + } + + for (; input->pos < input->len; input->pos++, output->len++) { + ch = input->start[input->pos]; + if (ch != '0' && ch != '1' && ch != '2' && ch != '3' && + ch != '4' && ch != '5' && ch != '6' && ch != '7' && + ch != '8' && ch != '9') { + break; + } + has_digits = 1; + } + + /* FIXME: what degenerate forms should be accepted ("E10" "1E" "1e" "1." "1ee10")? */ + /* FIXME: the terminal is said to support "floating point values", truncating to int... what do these look like? */ + if (has_digits && ch == 'E') { + input->pos++; + output->len++; + for (; input->pos < input->len; input->pos++, output->len++) { + ch = input->start[input->pos]; + if (ch != '0' && ch != '1' && ch != '2' && ch != '3' && + ch != '4' && ch != '5' && ch != '6' && ch != '7' && + ch != '8' && ch != '9') { + break; + } + } + } + + return has_digits; +} + +static int +extract_regis_pixelvector(RegisDataFragment *input, RegisDataFragment *output) +{ + char ch; + int has_digits; + + assert(input); + assert(output); + + output->start = &input->start[input->pos]; + output->len = 0U; + output->pos = 0U; + + if (input->pos < input->len) { + ch = input->start[input->pos]; + if (ch == '+' || ch == '-') { + input->pos++; + output->len++; + } + } + + has_digits = 0; + for (; input->pos < input->len; input->pos++, output->len++) { + ch = input->start[input->pos]; + if (ch != '0' && ch != '1' && ch != '2' && ch != '3' && + ch != '4' && ch != '5' && ch != '6' && ch != '7') { + break; + } + has_digits = 1; + } + + return has_digits; +} + +static int +extract_regis_command(RegisDataFragment *input, char *command) +{ + char ch; + + assert(input); + assert(command); + + if (input->pos >= input->len) + return 0; + + ch = input->start[input->pos]; + if (ch == '\0' || ch == ';') { + return 0; + } + if (!islower(CharOf(ch)) && !isupper(CharOf(ch)) && ch != '@') { + return 0; + } + *command = ch; + input->pos++; + + return 1; +} + +static int +extract_regis_string(RegisDataFragment *input, char *out, unsigned maxlen) +{ + char open_quote_ch; + char ch; + unsigned outlen; + + assert(input); + assert(out); + assert(maxlen > 0U); + + if (input->pos >= input->len) + return 0; + + ch = peek_fragment(input); + if (ch != '\'' && ch != '"') + return 0; + open_quote_ch = ch; + outlen = 0U; + pop_fragment(input); + + ch = '\0'; + while (!fragment_consumed(input)) { + char prev_ch = ch; + ch = peek_fragment(input); + /* ';' (resync) and '@' (macrograph) are not recognized in strings */ + if (prev_ch == open_quote_ch) { + if (ch == open_quote_ch) { + if (outlen < maxlen) { + out[outlen] = ch; + } + outlen++; + pop_fragment(input); + ch = '\0'; + continue; + } + if (outlen < maxlen) + out[outlen] = '\0'; + else + out[maxlen] = '\0'; + return 1; + } + if (ch == '\0') + break; + if (ch != open_quote_ch) { + if (outlen < maxlen) + out[outlen] = ch; + outlen++; + } + pop_fragment(input); + } + if (ch == open_quote_ch) { + pop_fragment(input); + if (outlen < maxlen) + out[outlen] = '\0'; + else + out[maxlen] = '\0'; + return 1; + } + /* FIXME: handle multiple strings concatenated with commas */ + + TRACE(("DATA_ERROR: end of input before closing quote\n")); + return 0; +} + +static int +extract_regis_parenthesized_data(RegisDataFragment *input, + RegisDataFragment *output) +{ + char ch; + char open_quote_ch; + int nesting; + + assert(input); + assert(output); + + output->start = &input->start[input->pos]; + output->len = 0U; + output->pos = 0U; + + if (input->pos >= input->len) + return 0; + + ch = input->start[input->pos]; + if (ch != '(') + return 0; + input->pos++; + output->start++; + nesting = 1; + open_quote_ch = '\0'; + + ch = '\0'; + for (; input->pos < input->len; input->pos++, output->len++) { + char prev_ch = ch; + ch = input->start[input->pos]; + if (ch == '\'' || ch == '"') { + if (open_quote_ch == '\0') { + open_quote_ch = ch; + } else { + if (ch == prev_ch && prev_ch == open_quote_ch) { + ch = '\0'; + } else if (ch == open_quote_ch) { + open_quote_ch = '\0'; + } + } + continue; + } + if (open_quote_ch != '\0') + continue; + + if (ch == ';') { + TRACE(("leaving parenthesized data nested %d levels deep due to command termination character\n", + nesting)); + break; + } + if (ch == '(') + nesting++; + if (ch == ')') { + nesting--; + if (nesting == 0) { + input->pos++; + return 1; + } + } + } + + TRACE(("DATA_ERROR: end of input before closing paren (%d levels deep)\n", + nesting)); + return 0; +} + +static int +extract_regis_option(RegisDataFragment *input, + char *option, + RegisDataFragment *output) +{ + char ch; + int paren_level, bracket_level; + char open_quote_ch; + + assert(input); + assert(option); + assert(output); + + /* LETTER suboptions* value? */ + /* + * FIXME: what are the rules for using separate parens vs. sharing between + * options? + */ + + output->start = &input->start[input->pos]; + output->len = 0U; + output->pos = 0U; + + if (input->pos >= input->len) { + return 0; + } + + ch = input->start[input->pos]; + /* FIXME: are options always letters or are some special characters ok? */ + if (ch == ';' || ch == ',' || + ch == '(' || ch == ')' || + ch == '[' || ch == ']' || + ch == '"' || ch == '\'' || + isdigit(CharOf(ch))) { + return 0; + } + *option = ch; + input->pos++; + output->start++; + paren_level = 0; + bracket_level = 0; + + open_quote_ch = '\0'; + for (; input->pos < input->len; input->pos++, output->len++) { + ch = input->start[input->pos]; + TRACE(("looking at char '%c' in option '%c'\n", ch, *option)); + /* FIXME: any special rules for commas? */ + /* FIXME: handle escaped quotes */ + if (ch == '\'' || ch == '"') { + if (open_quote_ch == ch) { + open_quote_ch = '\0'; + } else { + open_quote_ch = ch; + } + continue; + } + if (open_quote_ch != '\0') + continue; + if (ch == '(') { + paren_level++; + } + if (ch == ')') { + paren_level--; + if (paren_level < 0) { + TRACE(("DATA_ERROR: found ReGIS option has value with too many close parens \"%c\"\n", + *option)); + return 0; + } + } + if (ch == '[') { + bracket_level++; + } + if (ch == ']') { + bracket_level--; + if (bracket_level < 0) { + TRACE(("DATA_ERROR: found ReGIS option has value with too many close brackets \"%c\"\n", + *option)); + return 0; + } + } + if (paren_level == 0 && bracket_level == 0) { + /* + * Top-level commas indicate the end of this option and the start of + * another. + */ + if (ch == ',') + break; + /* + * Top-level command/option/suboption names also indicate the end of + * this option. "E" is valid as the exponent indicator in a numeric + * parameter. + */ + if (ch != 'E' && ch != 'e' && + ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))) + break; + } + if (ch == ';') + break; + } + if (paren_level != 0) { + TRACE(("DATA_ERROR: mismatched parens in argument to ReGIS option \"%c\"\n", + *option)); + return 0; + } + if (bracket_level != 0) { + TRACE(("DATA_ERROR: mismatched brackets in argument to ReGIS option \"%c\"\n", + *option)); + return 0; + } + + TRACE(("found ReGIS option and value \"%c\" \"%s\"\n", + *option, + fragment_to_tempstr(output))); + return 1; +} + +static int +regis_num_to_int(RegisDataFragment const *input, int *out) +{ + char ch; + + assert(input); + assert(out); + + /* FIXME: handle exponential notation and rounding */ + /* FIXME: check for junk after the number */ + ch = peek_fragment(input); + if (!isdigit(CharOf(ch)) && + ch != '+' && + ch != '-') { + *out = 0; + return 0; + } + + TRACE(("converting \"%s\" to an int\n", fragment_to_tempstr(input))); + *out = atoi(fragment_to_tempstr(input)); + return 1; +} + +static int +load_regis_colorspec(RegisGraphicsContext const *context, + RegisDataFragment const *input, + short *r_out, short *g_out, short *b_out) +{ + RegisDataFragment colorspec; + short r = -1, g = -1, b = -1; + short l = -1; + int simple; + + assert(context); + assert(input); + assert(r_out); + assert(g_out); + assert(b_out); + + copy_fragment(&colorspec, input); + TRACE(("colorspec option: \"%s\"\n", fragment_to_tempstr(&colorspec))); + + skip_regis_whitespace(&colorspec); + simple = 0; + if (fragment_remaining(&colorspec) == 1U) { + simple = 1; + } else if (fragment_remaining(&colorspec) > 1U) { + char after = get_fragment(&colorspec, 1U); + if (IsSpace(after)) + simple = 1; + } + if (simple) { + char ch = pop_fragment(&colorspec); + + TRACE(("got ReGIS RGB colorspec pattern '%c' with arguments: \"%s\"\n", + ch, fragment_to_tempstr(&colorspec))); + switch (ch) { + case 'D': + case 'd': + r = 0; + g = 0; + b = 0; + l = 0; + break; + case 'R': + case 'r': + r = 100; + g = 0; + b = 0; + l = 46; + break; + case 'G': + case 'g': + r = 0; + g = 100; + b = 0; + l = 50; + break; + case 'B': + case 'b': + r = 0; + g = 0; + b = 100; + l = 50; + break; + case 'C': + case 'c': + r = 0; + g = 100; + b = 100; + l = 50; + break; + case 'Y': + case 'y': + r = 100; + g = 100; + b = 0; + l = 50; + break; + case 'M': + case 'm': + r = 100; + g = 0; + b = 100; + l = 50; + break; + case 'W': + case 'w': + r = 100; + g = 100; + b = 100; + l = 100; + break; + default: + TRACE(("DATA_ERROR: unknown RGB color name: \"%c\"\n", ch)); + return 0; + } + } else { + RegisDataFragment num; + int max, val; + char comp; + short h = -1; + short s = -1; + + while (!fragment_consumed(&colorspec)) { + if (skip_regis_whitespace(&colorspec)) + continue; + + comp = pop_fragment(&colorspec); + switch (comp) { + case ',': + /* not sure if this is valid, but it is easy to handle */ + continue; + case 'H': + case 'h': + max = 360; + comp = 'H'; + break; + case 'L': + case 'l': + max = 100; + comp = 'L'; + break; + case 'S': + case 's': + max = 100; + comp = 'S'; + break; +#ifdef ENABLE_RGB_COLORSPECS + case 'R': /* RLogin extension */ + case 'r': + max = 100; + comp = 'R'; + break; + case 'G': /* RLogin extension */ + case 'g': + max = 100; + comp = 'G'; + break; + case 'B': /* RLogin extension */ + case 'b': + max = 100; + comp = 'B'; + break; +#endif + default: + TRACE(("DATA_ERROR: unrecognized component in colorspec: '%c'\n", + comp)); + return 0; + } + + skip_regis_whitespace(&colorspec); + if (!extract_regis_num(&colorspec, &num)) { + TRACE(("DATA_ERROR: expected int after '%c' component in colorspec: \"%s\"\n", + comp, fragment_to_tempstr(&colorspec))); + return 0; + } + if (!regis_num_to_int(&num, &val)) { + TRACE(("DATA_ERROR: component value %s is not a number\n", + fragment_to_tempstr(&num))); + return 0; + } + /* FIXME: error, truncate, wrap, ...? */ + if (val < 0 || val > max) { + TRACE(("DATA_ERROR: component value %d out of range\n", val)); + return 0; + } + + switch (comp) { + case 'H': + h = (short) val; + break; + case 'L': + l = (short) val; + break; + case 'S': + s = (short) val; + break; + case 'R': + r = (short) val; + break; + case 'G': + g = (short) val; + break; + case 'B': + b = (short) val; + break; + } + } + + if (h >= 0 && l >= 0 && s >= 0 && r < 0 && g < 0 && b < 0) { + TRACE(("found HLS colorspec to be converted: %hd,%hd,%hd\n", + h, l, s)); + hls2rgb(h, l, s, &r, &g, &b); + TRACE(("converted to RGB: %hd,%hd,%hd\n", r, g, b)); + } else if (h < 0 && l < 0 && s < 0 && r >= 0 && g >= 0 && b >= 0) { + TRACE(("found RGB colorspec: %hd,%hd,%hd\n", r, g, b)); + l = (short) ((MIN3(r, g, b) + MAX3(r, g, b)) / 2); + TRACE(("calculated L: %d\n", l)); + } else if (h < 0 && l >= 0 && s < 0 && r < 0 && g < 0 && b < 0) { + TRACE(("found L colorspec to be converted: %hd,%hd,%hd\n", + h, l, s)); + hls2rgb(0, l, 0, &r, &g, &b); + TRACE(("converted to RGB: %hd,%hd,%hd\n", r, g, b)); + } else { + TRACE(("DATA_ERROR: unrecognized colorspec format\n")); + return 0; + } + } + + /* + * The VT240 and VT330 models convert to the closest grayscale value. + */ + if (context->graphics_id == 240 || context->graphics_id == 330) { + hls2rgb(0, l, 0, &r, &g, &b); + TRACE(("converted to grayscale: %hd,%hd,%hd\n", r, g, b)); + } + + *r_out = r; + *g_out = g; + *b_out = b; + + skip_regis_whitespace(&colorspec); + if (!fragment_consumed(&colorspec)) { + char skip; + + skip = pop_fragment(&colorspec); + (void) skip; /* variable needed only if tracing */ + TRACE(("DATA_ERROR: ignoring unexpected character in ReGIS colorspec \"%c\"\n", + skip)); + } + + return 1; +} + +static int +load_regis_regnum_or_colorspec(RegisGraphicsContext const *context, + RegisDataFragment const *input, + RegisterNum *out) +{ + int val; + RegisDataFragment colorspec; + RegisDataFragment num; + RegisDataFragment coloroption; + + copy_fragment(&colorspec, input); + TRACE(("looking at colorspec pattern: \"%s\"\n", + fragment_to_tempstr(&colorspec))); + + skip_regis_whitespace(&colorspec); + + if (extract_regis_num(&colorspec, &num)) { + if (!regis_num_to_int(&num, &val)) { + TRACE(("DATA_ERROR: colorspec value %s is not a valid register\n", + fragment_to_tempstr(&num))); + return 0; + } + if (val < 0) { + /* FIXME: error, truncate, wrap, ...? */ + TRACE(("DATA_ERROR: ignoring negative colorspec value: %d\n", val)); + return 0; + } + if (val >= (int) context->destination_graphic->valid_registers) { + /* FIXME: error, truncate, wrap, ...? */ + TRACE(("DATA_ERROR: colorspec value %d is too big; wrapping\n", + val)); + val %= (int) context->destination_graphic->valid_registers; + } + + TRACE(("colorspec contains index for register %u\n", val)); + *out = (RegisterNum) val; + + skip_regis_whitespace(&colorspec); + if (!fragment_consumed(&colorspec)) { + char skip; + + skip = pop_fragment(&colorspec); + (void) skip; /* variable needed only if tracing */ + TRACE(("DATA_ERROR: unexpected character after register \"%c\"\n", + skip)); + return 0; + } + + return 1; + } + + if (extract_regis_parenthesized_data(&colorspec, &coloroption)) { + short r, g, b; + + if (!load_regis_colorspec(context, &coloroption, &r, &g, &b)) { + TRACE(("unable to parse colorspec\n")); + return 0; + } + + *out = find_color_register(context->destination_graphic->color_registers, + r, g, b); + TRACE(("colorspec maps to closest register %u\n", *out)); + + return 1; + } + + TRACE(("expected register number or colorspec, but found: \"%s\"\n", + fragment_to_tempstr(&colorspec))); + return 0; +} + +static int +to_scaled_int(char const *num, int scale, int *value) +{ + unsigned long whole, frac; + char *end; + + /* FIXME: handle whitespace? how about trailing junk? */ + whole = strtoul(num, &end, 10); + if (end[0] == '.') { + char temp[5] = "0000"; + + if (end[1] != '\0') { + temp[0] = end[1]; + if (end[2] != '\0') { + temp[1] = end[2]; + if (end[3] != '\0') { + temp[2] = end[3]; + if (end[4] != '\0') { + temp[3] = end[4]; + } + } + } + } + frac = strtoul(temp, NULL, 10); + } else if (end[0] == '\0' || end[0] == ',' || IsSpace(end[0])) { + frac = 0; + } else { + TRACE(("unexpected character %c in number %s\n", end[0], num)); + return 0; + } + + *value = (int) (whole * (unsigned) scale + + (frac * (unsigned) scale) / 10000); + + return 1; +} + +static int +load_regis_raw_extent(char const *extent, int *relx, int *rely, + int *xloc, int *yloc, int scale) +{ + int xsign, ysign; + char const *xpart; + char const *ypart; + + xpart = extent; + if ((ypart = strchr(extent, ','))) { + ypart++; + } else { + ypart = ""; + } + + while (IsSpace(xpart[0])) + xpart++; + while (IsSpace(ypart[0])) + ypart++; + + if (xpart[0] == '-') { + xsign = -1; + xpart++; + } else if (xpart[0] == '+') { + xsign = +1; + xpart++; + } else { + xsign = 0; + } + if (ypart[0] == '-') { + ysign = -1; + ypart++; + } else if (ypart[0] == '+') { + ysign = +1; + ypart++; + } else { + ysign = 0; + } + + if (xpart[0] == '\0' || xpart[0] == ',') { + *relx = 1; + *xloc = 0; + } else if (xsign == 0) { + int val; + + if (!to_scaled_int(xpart, scale, &val)) + return 0; + *relx = 0; + *xloc = val; + } else { + int val; + + if (!to_scaled_int(xpart, scale, &val)) + return 0; + *relx = 1; + *xloc = xsign * val; + } + if (ypart[0] == '\0') { + *rely = 1; + *yloc = 0; + } else if (ysign == 0) { + int val; + + if (!to_scaled_int(ypart, scale, &val)) + return 0; + *rely = 0; + *yloc = val; + } else { + int val; + + if (!to_scaled_int(ypart, scale, &val)) + return 0; + *rely = 1; + *yloc = ysign * val; + } + + return 1; +} + +static int +load_regis_mult_extent(char const *extent, int *w, int *h) +{ + int relx, rely; + int px, py; + + if (!load_regis_raw_extent(extent, &relx, &rely, &px, &py, 1)) { + TRACE(("invalid coordinates in extent %s\n", extent)); + return 0; + } + if (relx | rely) { + TRACE(("invalid relative value in multiplier extent %s\n", extent)); + return 0; + } + + *w = px; + *h = py; + + return 1; +} + +static int +load_regis_pixel_extent(char const *extent, int origx, int origy, + int *xloc, int *yloc) +{ + int relx, rely; + int px, py; + + if (!load_regis_raw_extent(extent, &relx, &rely, &px, &py, 1)) { + TRACE(("invalid coordinates in extent %s\n", extent)); + return 0; + } + + *xloc = px; + *yloc = py; + + if (relx) + *xloc += origx; + if (rely) + *yloc += origy; + + return 1; +} + +#define COORD_SCALE 1000 + +static int +load_regis_coord_extent(RegisGraphicsContext const *context, char const *extent, + int origx, int origy, int *xloc, int *yloc) +{ + int relx, rely; + int ux, uy; + + if (!load_regis_raw_extent(extent, &relx, &rely, &ux, &uy, COORD_SCALE)) { + TRACE(("invalid coordinates in extent %s\n", extent)); + return 0; + } + + if (relx) { + const int px = SCALE_XCOORD(context, ux, COORD_SCALE); + TRACE(("converted relative user X coord %.03f to relative pixel X coord %d (width=%d xoff=%d xdiv=%d)\n", + ux / (double) COORD_SCALE, px, context->width, + context->x_off, context->x_div)); + *xloc = origx + px; + } else { + const int px = TRANSLATE_XCOORD(context, ux, COORD_SCALE); + TRACE(("converted absolute user X coord %.03f to absolute pixel X coord %d\n", + ux / (double) COORD_SCALE, px)); + *xloc = px; + } + if (rely) { + const int py = SCALE_YCOORD(context, uy, COORD_SCALE); + TRACE(("converted relative user Y coord %.03f to relative pixel Y coord %d (height=%d yoff=%d ydiv=%d)\n", + uy / (double) COORD_SCALE, py, context->height, + context->y_off, context->y_div)); + *yloc = origy + py; + } else { + const int py = TRANSLATE_YCOORD(context, uy, COORD_SCALE); + TRACE(("converted absolute user Y coord %.03f to absolute pixel Y coord %d\n", + uy / (double) COORD_SCALE, py)); + *yloc = py; + } + + return 1; +} + +static int +load_regis_raw_pixelvector_digit(char const *pixelvector, + unsigned *offset, + int *dx, int *dy, int mul) +{ + switch (pixelvector[*offset]) { + case '0': + *dx += mul; + break; + case '1': + *dx += mul; + *dy -= mul; + break; + case '2': + *dy -= mul; + break; + case '3': + *dx -= mul; + *dy -= mul; + break; + case '4': + *dx -= mul; + break; + case '5': + *dx -= mul; + *dy += mul; + break; + case '6': + *dy += mul; + break; + case '7': + *dx += mul; + *dy += mul; + break; + default: + return 0; + } + + (*offset)++; + return 1; +} + +static int +load_regis_pixel_pixelvector(char const *pixelvector, + int mul, + int origx, int origy, + int *xloc, int *yloc) +{ + int found = 0; + int px = 0, py = 0; + unsigned offset = 0U; + while (load_regis_raw_pixelvector_digit(pixelvector, &offset, + &px, &py, + mul)) + found = 1; + if (pixelvector[offset] != '\0') { + TRACE(("DATA_ERROR: ignoring unknown pixel vector digits: \"%s\"\n", + &pixelvector[offset])); + } + + *xloc = origx + px; + *yloc = origy + py; + + return found; +} + +static int +load_regis_coord_pixelvector(RegisGraphicsContext const *context, + char const *pixelvector, + int origx, int origy, + int *xloc, int *yloc) +{ + const int mul = (int) (context->temporary_write_controls.pv_multiplier + * COORD_SCALE); + int found = 0; + int ux = 0, uy = 0; + unsigned offset = 0U; + + while (load_regis_raw_pixelvector_digit(pixelvector, &offset, + &ux, &uy, + mul)) + found = 1; + if (pixelvector[offset] != '\0') { + TRACE(("DATA_ERROR: ignoring unknown pixel vector digits: \"%s\"\n", + &pixelvector[offset])); + } { + const int px = SCALE_XCOORD(context, ux, COORD_SCALE); + const int py = SCALE_YCOORD(context, uy, COORD_SCALE); + + TRACE(("converted relative X coord %.03f to relative pixel X coord %d (width=%d xoff=%d xdiv=%d)\n", + ux / (double) COORD_SCALE, px, context->width, + context->x_off, context->x_div)); + *xloc = origx + px; + + TRACE(("converted relative Y coord %.03f to relative pixel Y coord %d (height=%d yoff=%d ydiv=%d)\n", + uy / (double) COORD_SCALE, py, context->height, + context->y_off, context->y_div)); + *yloc = origy + py; + } + + return found; +} + +static int +load_regis_coord_pixelvector_step(RegisGraphicsContext const *context, + char const *pixelvector, + unsigned *offset, + int origx, int origy, + int *xloc, int *yloc) +{ + const int mul = (int) (context->temporary_write_controls.pv_multiplier + * COORD_SCALE); + int found = 0; + int ux = 0, uy = 0; + if (load_regis_raw_pixelvector_digit(pixelvector, offset, &ux, &uy, mul)) + found = 1; + if (!found && pixelvector[*offset] != '\0') { + TRACE(("DATA_ERROR: ignoring unknown pixel vector digits: \"%s\"\n", + &pixelvector[*offset])); + } { + const int px = SCALE_XCOORD(context, ux, COORD_SCALE); + const int py = SCALE_YCOORD(context, uy, COORD_SCALE); + + TRACE(("converted relative X coord %.03f to relative pixel X coord %d (width=%d xoff=%d xdiv=%d)\n", + ux / (double) COORD_SCALE, px, context->width, + context->x_off, context->x_div)); + *xloc = origx + px; + + TRACE(("converted relative Y coord %.03f to relative pixel Y coord %d (height=%d yoff=%d ydiv=%d)\n", + uy / (double) COORD_SCALE, py, context->height, + context->y_off, context->y_div)); + *yloc = origy + py; + } + + return found; +} + +static int +load_regis_write_control(RegisParseState *state, + RegisGraphicsContext const *context, + int cur_x, int cur_y, + int option, + RegisDataFragment *arg, + RegisWriteControls *out) +{ + TRACE(("checking write control option \"%c\" with arg \"%s\"\n", + option, fragment_to_tempstr(arg))); + switch (option) { + case 'A': + case 'a': + TRACE(("write control alternate display method \"%s\"\n", + fragment_to_tempstr(arg))); + { + int val; + if (!regis_num_to_int(arg, &val) || val < 0 || val >= 1) { + TRACE(("DATA_ERROR: interpreting out of range value as 0 FIXME\n")); + break; + } + if (val == 1) { + TRACE(("ERROR: blink display method not supported FIXME\n")); + } + } + break; + case 'C': + case 'c': + TRACE(("write control compliment writing mode \"%s\"\n", + fragment_to_tempstr(arg))); + out->write_style = WRITE_STYLE_COMPLEMENT; + break; + case 'E': + case 'e': + TRACE(("write control erase writing mode \"%s\"\n", + fragment_to_tempstr(arg))); + out->write_style = WRITE_STYLE_ERASE; + break; + case 'F': + case 'f': + TRACE(("write control plane write mask \"%s\"\n", + fragment_to_tempstr(arg))); + { + int val; + if (!regis_num_to_int(arg, &val) || + val < 0 || val >= (int) context->destination_graphic->valid_registers) { + TRACE(("DATA_ERROR: interpreting out of range value as 0 FIXME\n")); + out->plane_mask = 0U; + } else { + out->plane_mask = (unsigned) val; + } + } + break; + case 'I': + case 'i': + TRACE(("write control foreground color \"%s\"\n", + fragment_to_tempstr(arg))); + if (!load_regis_regnum_or_colorspec(context, arg, &out->foreground)) { + TRACE(("DATA_ERROR: write control foreground color specifier not recognized: \"%s\"\n", + fragment_to_tempstr(arg))); + return 0; + } + break; + case 'L': + case 'l': + TRACE(("write control line width \"%s\" (FIXME: currently ignored)\n", + fragment_to_tempstr(arg))); + { + int val; + if (!regis_num_to_int(arg, &val) || + val < 0 || val >= (int) 9) { + TRACE(("interpreting out of range value as 1 FIXME\n")); + out->line_width = 1U; + } else { + out->line_width = (unsigned) val; + } + } + break; + case 'M': + case 'm': + TRACE(("write control found pixel multiplication factor \"%s\"\n", + fragment_to_tempstr(arg))); + { + int val; + if (!regis_num_to_int(arg, &val) || val <= 0) { + TRACE(("interpreting out of range value %d as 1 FIXME\n", val)); + out->pv_multiplier = 1U; + } else { + out->pv_multiplier = (unsigned) val; + } + } + break; + case 'N': + case 'n': + TRACE(("write control negative pattern control \"%s\"\n", + fragment_to_tempstr(arg))); + { + int val; + if (!regis_num_to_int(arg, &val)) { + val = -1; + } + switch (val) { + default: + TRACE(("interpreting out of range value %d as 0 FIXME\n", val)); + out->invert_pattern = 0U; + break; + case 0: + out->invert_pattern = 0U; + break; + case 1: + out->invert_pattern = 1U; + break; + } + } + break; + case 'P': + case 'p': + TRACE(("write control found pattern control \"%s\"\n", + fragment_to_tempstr(arg))); + { + RegisDataFragment suboptionset; + RegisDataFragment suboptionarg; + RegisDataFragment item; + char suboption; + + while (!fragment_consumed(arg)) { + if (skip_regis_whitespace(arg)) + continue; + + TRACE(("looking for option in \"%s\"\n", + fragment_to_tempstr(arg))); + if (extract_regis_parenthesized_data(arg, &suboptionset)) { + TRACE(("got write pattern suboptionset: \"%s\"\n", + fragment_to_tempstr(&suboptionset))); + while (!fragment_consumed(&suboptionset)) { + skip_regis_whitespace(&suboptionset); + if (extract_regis_option(&suboptionset, &suboption, + &suboptionarg)) { + skip_regis_whitespace(&suboptionarg); + TRACE(("inspecting write pattern suboption \"%c\" with value \"%s\"\n", + suboption, + fragment_to_tempstr(&suboptionarg))); + switch (suboption) { + case 'M': + case 'm': + TRACE(("found pattern multiplier \"%s\"\n", + fragment_to_tempstr(&suboptionarg))); + { + RegisDataFragment num; + int val; + + if (extract_regis_num(&suboptionarg, + &num)) { + if (!regis_num_to_int(&num, &val) + || val < 1) { + TRACE(("interpreting out of range pattern multiplier \"%s\" as 2 FIXME\n", + fragment_to_tempstr(&num))); + out->pattern_multiplier = 2U; + } else { + out->pattern_multiplier = + (unsigned) val; + } + skip_regis_whitespace(&suboptionarg); + } + + if (!fragment_consumed(&suboptionarg)) { + TRACE(("DATA_ERROR: unknown content after pattern multiplier \"%s\"\n", + fragment_to_tempstr(&suboptionarg))); + return 0; + } + } + break; + default: + TRACE(("DATA_ERROR: unknown ReGIS write pattern suboption '%c' arg \"%s\"\n", + suboption, + fragment_to_tempstr(&suboptionarg))); + return 0; + } + continue; + } + + TRACE(("DATA_ERROR: skipping unknown token in pattern control suboptionset (expecting option): \"%s\"\n", + fragment_to_tempstr(&suboptionset))); + pop_fragment(&suboptionset); + } + continue; + } + + TRACE(("looking for int in \"%s\"\n", + fragment_to_tempstr(arg))); + if (extract_regis_num(arg, &item)) { + if (peek_fragment(&item) == '0' || + peek_fragment(&item) == '1') { + unsigned pattern = 0U; + unsigned bitcount; + + TRACE(("converting pattern bits \"%s\"\n", + fragment_to_tempstr(&item))); + for (bitcount = 0;; bitcount++) { + char ch = pop_fragment(&item); + if (ch == '\0') + break; + switch (ch) { + case '0': + if (bitcount < MAX_PATTERN_BITS) { + pattern <<= 1U; + } + break; + case '1': + if (bitcount < MAX_PATTERN_BITS) { + pattern <<= 1U; + pattern |= 1U; + } + break; + default: + TRACE(("DATA_ERROR: unknown ReGIS write pattern bit value \"%c\"\n", + ch)); + return 0; + } + } + + if (bitcount > 0U) { + unsigned extrabits; + + for (extrabits = 0; + bitcount + extrabits < MAX_PATTERN_BITS; + extrabits++) { + if (pattern & (1U << (bitcount - 1U))) { + pattern <<= 1U; + pattern |= 1U; + } else { + pattern <<= 1U; + } + } + } + + out->pattern = pattern; + } else { + int val; + + TRACE(("converting pattern id \"%s\"\n", + fragment_to_tempstr(&item))); + if (!regis_num_to_int(&item, &val)) + val = -1; + switch (val) { /* FIXME: exponential allowed? */ + case 0: + out->pattern = 0x00; /* solid bg */ + break; + case 1: + out->pattern = 0xff; /* solid fg */ + break; + case 2: + out->pattern = 0xf0; /* dash */ + break; + case 3: + out->pattern = 0xe4; /* dash dot */ + break; + case 4: + out->pattern = 0xaa; /* dot */ + break; + case 5: + out->pattern = 0xea; /* dash dot dot */ + break; + case 6: + out->pattern = 0x88; /* sparse dot */ + break; + case 7: + out->pattern = 0x84; /* asymmetric sparse dot */ + break; + case 8: + out->pattern = 0xc8; /* sparse dash dot */ + break; + case 9: + out->pattern = 0x86; /* sparse dot dash */ + break; + default: + TRACE(("DATA_ERROR: unknown ReGIS standard write pattern \"%d\"\n", + val)); + return 0; + } + } + + TRACE(("final pattern is %02x\n", out->pattern)); + continue; + } + skip_regis_whitespace(arg); + + TRACE(("DATA_ERROR: skipping unknown token in pattern suboption: \"%s\"\n", + fragment_to_tempstr(arg))); + pop_fragment(arg); + } + } + break; + case 'R': + case 'r': + TRACE(("write control switch to replacement writing mode \"%s\"\n", + fragment_to_tempstr(arg))); + out->write_style = WRITE_STYLE_REPLACE; + break; + case 'S': + case 's': + TRACE(("write control shading control \"%s\"\n", + fragment_to_tempstr(arg))); + { + RegisDataFragment suboptionset; + RegisDataFragment suboptionarg; + RegisDataFragment item; + char suboption; + char shading_character = '\0'; + unsigned reference_dim = WRITE_SHADING_REF_Y; + /* FIXME: are relative offsets additive? */ + int ref_x = cur_x, ref_y = cur_y; + int shading_enabled = 0; + + while (!fragment_consumed(arg)) { + if (skip_regis_whitespace(arg)) + continue; + + if (extract_regis_string(arg, state->temp, state->templen)) { + TRACE(("found fill char \"%s\"\n", state->temp)); + /* FIXME: allow longer strings, ignore extra chars, or treat as error? */ + if (strlen(state->temp) != 1) { + TRACE(("DATA_ERROR: expected exactly one char in fill string FIXME\n")); + return 0; + } + shading_character = state->temp[0]; + shading_enabled = 1; + TRACE(("shading character is: '%c' (%d)\n", + shading_character, (int) shading_character)); + continue; + } + + if (extract_regis_parenthesized_data(arg, &suboptionset)) { + skip_regis_whitespace(&suboptionset); + TRACE(("got shading control suboptionset: \"%s\"\n", + fragment_to_tempstr(&suboptionset))); + while (!fragment_consumed(&suboptionset)) { + if (skip_regis_whitespace(&suboptionset)) + continue; + if (extract_regis_option(&suboptionset, &suboption, + &suboptionarg)) { + TRACE(("inspecting write shading suboption \"%c\" with value \"%s\"\n", + suboption, + fragment_to_tempstr(&suboptionarg))); + switch (suboption) { + case 'X': + case 'x': + TRACE(("found horizontal shading suboption \"%s\"\n", + fragment_to_tempstr(&suboptionarg))); + if (!fragment_consumed(&suboptionarg)) { + TRACE(("DATA_ERROR: unexpected value to horizontal shading suboption FIXME\n")); + return 0; + } + reference_dim = WRITE_SHADING_REF_X; + shading_enabled = 1; + break; + default: + TRACE(("DATA_ERROR: unknown ReGIS write pattern suboption '%c' arg \"%s\"\n", + suboption, + fragment_to_tempstr(&suboptionarg))); + return 0; + } + continue; + } + + TRACE(("DATA_ERROR: skipping unknown token in shading control suboptionset (expecting option): \"%s\"\n", + fragment_to_tempstr(&suboptionset))); + pop_fragment(&suboptionset); + } + continue; + } + + if (extract_regis_extent(arg, &item)) { + TRACE(("found extent in shading option curr=%d,%d ref=%d,%d\n", + cur_x, cur_y, ref_x, ref_y)); + if (!load_regis_coord_extent(context, + fragment_to_tempstr(&item), + ref_x, ref_y, + &ref_x, &ref_y)) { + TRACE(("DATA_ERROR: unable to parse extent in write shading option '%c': \"%s\"\n", + option, fragment_to_tempstr(&item))); + return 0; + } + TRACE(("shading reference = %d,%d (%s)\n", ref_x, ref_y, + ((reference_dim == WRITE_SHADING_REF_X) + ? "X" + : "Y"))); + continue; + } + + if (extract_regis_num(arg, &item)) { + if (!regis_num_to_int(&item, &shading_enabled)) { + TRACE(("DATA_ERROR: unable to parse int in write shading option '%c': \"%s\"\n", + option, fragment_to_tempstr(&item))); + return 0; + } + if (shading_enabled < 0 || shading_enabled > 1) { + TRACE(("interpreting out of range value %d as 0 FIXME\n", + shading_enabled)); + shading_enabled = 0; + } + TRACE(("shading enabled = %d\n", shading_enabled)); + continue; + } + + if (skip_regis_whitespace(arg)) { + continue; + } + + TRACE(("DATA_ERROR: skipping unknown token in shade suboption: \"%s\"\n", + fragment_to_tempstr(arg))); + pop_fragment(arg); + } + + if (shading_enabled) { + out->shading_enabled = 1U; + out->shading_reference_dim = reference_dim; + out->shading_reference = ((reference_dim == WRITE_SHADING_REF_X) + ? ref_x + : ref_y); + out->shading_character = shading_character; + TRACE(("final shading state: enabled, dim=%d ref=%d, char=%c\n", + out->shading_reference_dim, out->shading_reference, + out->shading_character)); + } else { + /* FIXME: confirm there is no effect if shading isn't enabled + * in the same command + */ + out->shading_enabled = 0U; + TRACE(("final shading state: shading disabled\n")); + } + } + break; + case 'V': + case 'v': + TRACE(("write control switch to overlay writing mode \"%s\"\n", + fragment_to_tempstr(arg))); + out->write_style = WRITE_STYLE_OVERLAY; + break; + default: + TRACE(("DATA_ERROR: ignoring unknown ReGIS write option \"%c\" arg \"%s\"\n", + option, fragment_to_tempstr(arg))); + return 0; + } + + return 1; +} + +static int +load_regis_write_control_set(RegisParseState *state, + RegisGraphicsContext const *context, + int cur_x, int cur_y, + RegisDataFragment *controls, + RegisWriteControls *out) +{ + RegisDataFragment optionset; + RegisDataFragment arg; + char option; + + while (!fragment_consumed(controls)) { + if (skip_regis_whitespace(controls)) + continue; + + if (extract_regis_parenthesized_data(controls, &optionset)) { + TRACE(("got write control optionset: \"%s\"\n", + fragment_to_tempstr(&optionset))); + while (!fragment_consumed(&optionset)) { + skip_regis_whitespace(&optionset); + if (extract_regis_option(&optionset, &option, &arg)) { + skip_regis_whitespace(&arg); + TRACE(("got write control option and value: \"%c\" \"%s\"\n", + option, fragment_to_tempstr(&arg))); + if (!load_regis_write_control(state, context, + cur_x, cur_y, + option, &arg, out)) { + return 0; + } + continue; + } + + TRACE(("DATA_ERROR: skipping unknown token in write control optionset (expecting option): \"%s\"\n", + fragment_to_tempstr(&optionset))); + pop_fragment(&optionset); + } + continue; + } + + TRACE(("DATA_ERROR: skipping unknown token in write controls (expecting optionset): \"%s\"\n", + fragment_to_tempstr(controls))); + pop_fragment(controls); + } + + return 1; +} + +static void +init_regis_write_controls(int graphics_id, unsigned all_planes, + RegisWriteControls *controls) +{ + controls->pv_multiplier = 1U; + controls->pattern = 0xff; /* solid */ + controls->pattern_multiplier = 2U; + controls->invert_pattern = 0U; + controls->plane_mask = all_planes; + controls->write_style = WRITE_STYLE_OVERLAY; + switch (graphics_id) { + case 125: /* FIXME: verify */ + case 240: /* FIXME: verify */ + case 241: /* FIXME: verify */ + case 330: + controls->foreground = 3U; + break; + case 340: + default: + controls->foreground = 7U; + break; + case 382: + controls->foreground = 1U; /* FIXME: verify */ + break; + } + controls->shading_enabled = 0U; + controls->shading_character = '\0'; + controls->shading_reference = 0; /* no meaning if shading is disabled */ + controls->shading_reference_dim = WRITE_SHADING_REF_NONE; + controls->line_width = 1U; + /* FIXME: add the rest */ +} + +static void +map_regis_graphics_pages(XtermWidget xw, RegisGraphicsContext *context) +{ + const int charrow = 0; + const int charcol = 0; + unsigned old_display_id = ~0U; + + if (context->destination_graphic) + context->destination_graphic->hidden = 1; + if (context->display_graphic) { + context->display_graphic->hidden = 1; + old_display_id = context->display_graphic->id; + } + + context->destination_graphic = + get_new_or_matching_graphic(xw, + charrow, charcol, + context->width, + context->height, + context->destination_page); + if (context->destination_graphic) { + context->destination_graphic->hidden = 1; + context->destination_graphic->valid = 1; + } + + context->display_graphic = + get_new_or_matching_graphic(xw, + charrow, charcol, + context->width, + context->height, + context->display_page); + if (context->display_graphic) { + context->display_graphic->hidden = 0; + if (old_display_id != context->display_graphic->id) { + if (!context->display_graphic->valid) { + draw_solid_rectangle(context->display_graphic, 0, 0, + context->width, context->height, + context->background); + } + context->display_graphic->dirty = 1; + context->force_refresh = 1; + /* FIXME: This isn't really enough. If there are holes in the new + * graphic they should be cleared and set to the text from the same + * page. But we don't have pages for text in xterm (the alt buffer + * is similar though). + */ + } + context->display_graphic->valid = 1; + } + + TRACE(("using graphics destination=[%d -> %u] display=[%d -> %u]\n", + context->destination_page, + (context->destination_graphic + ? context->destination_graphic->id + : 0U), + context->display_page, + (context->display_graphic + ? context->display_graphic->id + : 0U))); +} + +static void +copy_regis_write_controls(RegisWriteControls const *src, + RegisWriteControls *dst) +{ + dst->pv_multiplier = src->pv_multiplier; + dst->pattern = src->pattern; + dst->pattern_multiplier = src->pattern_multiplier; + dst->invert_pattern = src->invert_pattern; + dst->foreground = src->foreground; + dst->plane_mask = src->plane_mask; + dst->write_style = src->write_style; + dst->shading_enabled = src->shading_enabled; + dst->shading_character = src->shading_character; + dst->shading_reference = src->shading_reference; + dst->shading_reference_dim = src->shading_reference_dim; + dst->line_width = src->line_width; +} + +static void +init_regis_text_controls(RegisTextControls *controls) +{ + controls->alphabet_num = 0U; /* built-in */ + controls->character_set_l = 0U; /* ASCII */ + controls->character_set_r = 0U; /* Latin-1 */ + get_standard_character_size(1, &controls->character_display_w, + &controls->character_display_h, + &controls->character_unit_cell_w, + &controls->character_unit_cell_h, + &controls->character_inc_x, + &controls->character_inc_y); + controls->string_rotation = 0; + controls->character_rotation = 0; + controls->slant = 0; +} + +static void +copy_regis_text_controls(RegisTextControls const *src, RegisTextControls *dst) +{ + dst->alphabet_num = src->alphabet_num; + dst->character_set_l = src->character_set_l; + dst->character_set_r = src->character_set_r; + dst->character_display_w = src->character_display_w; + dst->character_display_h = src->character_display_h; + dst->character_unit_cell_w = src->character_unit_cell_w; + dst->character_unit_cell_h = src->character_unit_cell_h; + dst->character_inc_x = src->character_inc_x; + dst->character_inc_y = src->character_inc_y; + dst->string_rotation = src->string_rotation; + dst->character_rotation = src->character_rotation; + dst->slant = src->slant; +} + +static void +init_regis_alphabets(RegisGraphicsContext *context) +{ + unsigned alphabet_index; + + for (alphabet_index = 0U; alphabet_index < MAX_REGIS_ALPHABETS; + alphabet_index++) { + context->alphabets[alphabet_index].alphabet_num = INVALID_ALPHABET_NUM; + context->alphabets[alphabet_index].pixw = 0U; + context->alphabets[alphabet_index].pixh = 0U; + context->alphabets[alphabet_index].name[0] = '\0'; + context->alphabets[alphabet_index].fontname[0] = '\0'; + context->alphabets[alphabet_index].use_font = 0; + context->alphabets[alphabet_index].bytes = NULL; + } +} + +static void +init_regis_graphics_context(int graphics_id, int width, int height, + unsigned max_colors, const char *builtin_font, + RegisGraphicsContext *context) +{ + context->destination_graphic = NULL; + context->display_graphic = NULL; + context->display_page = 0U; + context->destination_page = 0U; + context->graphics_id = graphics_id; + + /* reset addressing / clear user coordinates */ + context->width = width; + context->height = height; + context->x_off = 0; + context->y_off = 0; + context->x_div = width - 1; + context->y_div = height - 1; + + /* + * Generate a mask covering all valid color register address bits + * (but don't bother past 2**16). + */ + context->all_planes = max_colors; + context->all_planes--; + context->all_planes |= 1U; + context->all_planes |= context->all_planes >> 1U; + context->all_planes |= context->all_planes >> 2U; + context->all_planes |= context->all_planes >> 4U; + context->all_planes |= context->all_planes >> 8U; + + context->builtin_font = builtin_font; + + init_regis_write_controls(graphics_id, context->all_planes, + &context->persistent_write_controls); + copy_regis_write_controls(&context->persistent_write_controls, + &context->temporary_write_controls); + + init_regis_text_controls(&context->persistent_text_controls); + context->current_text_controls = &context->persistent_text_controls; + init_regis_alphabets(context); + + context->multi_input_mode = 0; + /* FIXME: coordinates */ + /* FIXME: scrolling */ + context->background = 0U; + /* FIXME: input cursor location */ + /* FIXME: input cursor style */ + context->graphics_output_cursor_x = 0; + context->graphics_output_cursor_y = 0; + /* FIXME: output cursor style */ + + context->force_refresh = 0; +} + +static int +parse_regis_command(RegisParseState *state) +{ + char ch; + + if (!extract_regis_command(&state->input, &ch)) + return 0; + + switch (ch) { + case 'C': + case 'c': + /* Curve + + * C + * (A) # set the arc length in degrees (+ or nothing for + * # counter-clockwise, - for clockwise, rounded to the + * # closest integer degree) + * (B) # begin closed curve sequence (must have at least two + * # values; this option can not be nested) + * (C) # position is the center, current location is the + * # circumference (stays in effect until next command) + * (E) # end curve sequence (drawing is performed here) + * (S) # begin open curve sequence + * (W) # temporary write options (see write command) + * [] # center if (C), otherwise point on circumference + * []... # if between (B) and (E) + * ... # if between (B) and (E) + */ + TRACE(("found ReGIS command \"%c\" (curve)\n", ch)); + state->command = 'c'; + state->curve_mode = CURVE_POSITION_ARC_EDGE; + state->arclen = 360; + state->num_points = 0U; + break; + case 'F': + case 'f': + /* Fill + + * F + * (V) # polygon (see vector command) + * (C) # curve (see curve command) + * (W) # temporary write options (see write command) + */ + TRACE(("found ReGIS command \"%c\" (filled polygon)\n", ch)); + state->command = 'f'; + break; + case 'L': + case 'l': + /* Load + + * L + * (A) # set alphabet number or name + * (F)"fontname" # load from font (xterm extension) + * (S)[w,h] # set glyph size (xterm extension) + * "ascii"xx,xx,xx,xx,xx,xx,xx,xx # pixel values + */ + TRACE(("found ReGIS command \"%c\" (load charset)\n", ch)); + state->command = 'l'; + break; + case 'P': + case 'p': + /* Position + + * P + * (B) # begin bounded position stack (last point returns to first) + * (E) # end position stack + * (P) # select graphics page for the input and output cursors + * (S) # begin unbounded position stack + * (W) # temporary write options (see write command) + * # move: 0 == right, 1 == upper right, ..., 7 == lower right + * [] # move to position (X, Y, or both) + * + * Note the stack does not need to be ended before the next command + * Note: maximum depth is 16 levels + */ + TRACE(("found ReGIS command \"%c\" (position)\n", ch)); + state->command = 'p'; + break; + case 'R': + case 'r': + /* Report + + * R + * (E) # parse error + * (I) # set input mode (0 == one-shot, 1 == multiple) (always returns CR) + * (L) # current alphabet number and name + * (M() # macrograph contents + * (M(=) # macrograph storage (free bytes of total bytes) + * (P) # absolute output cursor position + * (P(I)) # interactive locator mode (in one-shot or multiple mode) + * (P(I[xmul,ymul])) # interactive locator mode with arrow key movement multipliers + */ + TRACE(("found ReGIS command \"%c\" (report status)\n", ch)); + state->command = 'r'; + break; + case 'S': + case 's': + /* Screen + + * S + * (A[][]) # adjust screen coordinates + * (C # 0 (cursor output off), 1 (cursor output on) + * (E) # erase to background color, resets shades, curves, and stacks + * (F) # print the graphic and erase the screen (DECprint extension) + * (H(P)[][) + * (I) # set the background to a specific register + * (I()) # set the background to the register closest to an "RGB" color + * (I(RGB)) # set the background to the register closest to an RGB triplet (RLogin extension) + * (I(HLS)) # set the background to the register closest to an HLS triplet + * (I(L)) # set the background to the register closest to a grayscale value + * (M()...) # codes are D (black), R (red), G (green), B (blue), C (cyan), Y (yellow), M (magenta), W (white) (sets color and grayscale registers) + * (M(A)...) # codes are D (black), R (red), G (green), B (blue), C (cyan), Y (yellow), M (magenta), W (white) (sets color registers only) + * (M(RGB)...) # 0..100, 0..100, 0..100 (sets color and grayscale registers) (RLogin extension) + * (M(ARGB)...) # 0..100, 0..100, 0..100 (sets color registers only) (RLogin extension) + * (M(HLS)...) # 0..360, 0..100, 0..100 (sets color and grayscale registers) + * (M(AHLS)...) # 0..360, 0..100, 0..100 (sets color registers only) + * (M(L)...) # level is 0 ... 100 (sets grayscale registers only) + * (P) # 0 (default) or 1 + * (S() # scale screen output by scale (default 1, VT125:max=2, VT3x0:unsupported) FIXME + * (S(X) # scale screen output horizontally by scale (default 1, VT125:max=2, VT3x0:unsupported) FIXME + * (S(Y) # scale screen output vertically by scale (default 1, VT125:max=2, VT3x0:unsupported) FIXME + * (T(