diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2024-07-09 09:37:08 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2024-07-09 09:37:08 +0000 |
commit | db03c39e0b5660e7c7dd509af1579a5440f9e988 (patch) | |
tree | 090d7084f45cdb4aa909bb26c6246bfc5a80a729 /lib/libXaw | |
parent | 64d37c62a3670520206e2833683c030b3e2ffbc3 (diff) |
update libXaw to version 1.0.16
Diffstat (limited to 'lib/libXaw')
71 files changed, 6004 insertions, 3282 deletions
diff --git a/lib/libXaw/ChangeLog b/lib/libXaw/ChangeLog index 466bd9277..eff590bc9 100644 --- a/lib/libXaw/ChangeLog +++ b/lib/libXaw/ChangeLog @@ -1,3 +1,382 @@ +commit f14ba54e9c7e415a05e33dd0b3b5f96e5de05c8b +Author: Thomas E. Dickey <dickey@his.com> +Date: Sun Mar 10 16:25:47 2024 +0000 + + libXaw 1.0.16: amends XawListChange() prototype, plus code-cleanup + +commit 254e1f657496d21aef0c5e0a14ecca076a9ebcd5 +Author: Thomas E. Dickey <dickey@his.com> +Date: Sun Mar 10 14:31:35 2024 +0000 + + delete code which is never used + +commit c07b1728e38529ff8177e2075c2bae4724d3abe7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 10 10:03:25 2024 -0400 + + make the examples configurable as (interactive) unit-tests + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit d0fcbd9722ad691ca0b5873c98e8e9c236fa718b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 3 20:21:40 2024 -0500 + + amend change to XawListChange() + + My previous commit in July 2019 + + build-fixes when _CONST_X_STRING is defined + + modified the interface of XawListChange() to use "_Xconst char *" + to fix builds when the Xt symbol _CONST_X_STRING is defined (which + makes the String typedef "const"). + + While this fixed building Xaw, clients which use Xaw were impacted. + Changing that function to use String resolves both problems. + + (report by Karl Berry). + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit b116d033a5b4daf75a10ad959e42aac398036ef9 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 3 19:04:21 2024 -0500 + + clang/gcc warnings about undefined behavior (minor bug-fix) + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit fd4b2ce63feae01744a850fa6f1809ff15361a8b +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 3 18:51:46 2024 -0500 + + fix clang/gcc warnings for undefined behavior, also fix a bug + + XtConvertAndStore may update the XrmValue value, changing its size. + clang and gcc warn about undefined behavior in the case-statement + following the call (which uses the size), but do not explain what + the problem is. Since this code is not intended to handle changes + of the size, simply reject that case. That quiets the gcc warnings + and is actually all that is needed for correctness. clang still + complains (neither knows what the call does), but can be quieted + by initializing the variable before calling the function. + + The code happens to work without the fix as long as it is not + used to convert between resource types which would increase the + size. + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit d33708e30f102f6ab278d6f809eeaa18e65d0716 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 3 15:13:27 2024 -0500 + + scan-build(clang-17) reports possible null dereference, add checks + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 9aba0a9212e0bb3ad010fff569bce95c20c3ebfa +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Sun Mar 3 14:50:21 2024 -0500 + + split-up assignments which give unnecessary compiler-warnings + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit ce94a168f6a10455e98e2be7bd905bb9fb7f7fc1 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:32:17 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 95e93cfd56c8dec57a3bb2627d7714944713c37a +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:32:01 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 28b5ce87555b5c85f240895c64818015d134b3b7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:31:43 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 96e4ac3ae1afdeafb16ea0e147364d15e7bfd549 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:31:26 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5815fc38a12e5ac7f8bd391ce8f04f13b8178e69 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:31:09 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit a3fb321330ccb6d9dcd6fd3d41971cda3987527a +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:30:50 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 3841474f3ba6914b6909e29c5cf0c5e7207a69a7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 20:30:28 2024 -0500 + + add check for null pointer, avoid dereferencing + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit f4906b8a4fc09eb3ce971272f993be81885f602f +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 19:30:22 2024 -0500 + + delete unused assignments + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 1b1d164cdcd3b30d1effb4a07a40ae1cf08d0419 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 18:47:16 2024 -0500 + + reduce variable-length argument lists to match the existing code + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit ff9312d99940be2d81d91601ad6c1688da1016bd +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Fri Mar 1 17:01:07 2024 -0500 + + fix references to uninitialized data when constructing argument-lists + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit cc1e73a85d437ebd0d5c8efbe14a7f398c1b9fcc +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Feb 29 20:19:25 2024 -0500 + + manpage: improve formatting consistency of bold/italics + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 080e6e49825c2e03adb0c5dd8dad53767ec41ce6 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Feb 29 18:12:40 2024 -0500 + + manpage: assume .EX/.EE macros + + Branden Robinson says macros have to go after ".TH"; the existing macros did + not match the format used in groff, etc., and can be simply removed. The + ".TQ" macro is used only without a parameter, causing an extra space to be + emitted (and fixed that by dropping the parameter). + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit d696cf912efb884af1a73952f3bd70bd28a9a942 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Feb 29 17:54:04 2024 -0500 + + manpage: adjust line-breaks to avoid embedded full-stops + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 6ded4c0487220253a2cb2fefc4983ff31e486dd4 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Thu Feb 29 16:45:23 2024 -0500 + + cppcheck scope and assignment warnings + +commit f181d10b934c85a30f27de6aa0b71c94e68d2293 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Feb 28 20:46:24 2024 -0500 + + reduce compiler-warnings using casts + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 785ba6f4ee7677f395252daf9c1de30fb80a179d +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Feb 28 20:18:34 2024 -0500 + + provide fallback for deprecated isascii/toascii + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 36ac433450b7e0b260e44b4320c4b6af0ba12a8f +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Feb 28 19:43:50 2024 -0500 + + quiet conversion-warnings with casts + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit eb5cbbd6f8056b3008c0f8e7e603b10a3ff4cbb2 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Feb 28 18:04:28 2024 -0500 + + fix missing-initializer warnings + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 5c23a1f5e5b0961a0938a8f3da1c9ad01fe67af7 +Author: Thomas E. Dickey <dickey@invisible-island.net> +Date: Wed Feb 28 16:30:11 2024 -0500 + + build-fix + + Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net> + +commit 239a9d1f8fa2655a5ebc53de00e3311ae1413e33 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Feb 17 14:48:34 2024 -0800 + + unifdef ISC + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 6bbdea682c9c0064895e1619815a8d116f197c3f +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:59:23 2024 -0800 + + Remove unused sharedlib.c + + It was only built by Imake if SUNSHLIB was defined. + SUNSHLIB was only set in the Imake configs for SunOS versions < 5 + (i.e. before Solaris 2.0). + + It has never been used in the autoconf builds. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 84f62d9c2a37366661332b8218c842f5af98356d +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:54:47 2024 -0800 + + unifdef __UNIXOS2__ + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit bce0fc281e883f4ffa53e47cd5fa96ea04ea4227 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:53:49 2024 -0800 + + unifdef __osf__ + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit b6de2199357cdbde852a9caea1ed752d3c236d65 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:51:04 2024 -0800 + + unifdef AIXV3 || __SCO__ + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit dbd28c703175051e0d20df664c4423317ed556a3 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:48:19 2024 -0800 + + unifdef QNX4 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 04a5e1a7d8cb1446e4fe2bb4a823d9795254fecb +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:47:21 2024 -0800 + + unifdef sony + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit a6cd58c90cf5e47678fd50932d6fc2fdbffb2605 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 13 17:46:44 2024 -0800 + + unifdef NCR + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 1b5fe7cf8b5e7ed3f214b43b9f7e081c82df5b1d +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Sep 23 09:46:16 2023 -0700 + + gitlab CI: add xz-utils to container for "make distcheck" + + Also update to latest ci-templates + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit e1b030770a2d489ff832b619ba646aa96e0bfb5c +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 28 19:19:13 2023 -0800 + + Use C99 designated initializers where appropriate + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 77533b88018c2923075562e106ef2970c7e6c6a9 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 28 17:49:59 2023 -0800 + + Handle redundantInitialization warnings from cppcheck + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit c5a5fcea941e4ee7c4c68ae090601d6282f0a5cb +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Feb 28 16:10:19 2023 -0800 + + Variable scope reductions as suggested by cppcheck + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 571c764ace3d4415531641db3dee0c2b066edc10 +Author: Walter Harms <wharms@bfs.de> +Date: Sun Jun 18 21:05:34 2023 +0200 + + expand for simple widget demo + +commit 55c2ab7cd46efb17f59f18d22307fcf5b26f3692 +Author: Walter Harms <wharms@bfs.de> +Date: Sun Jun 18 21:04:43 2023 +0200 + + add simple widget demo + +commit e67c7ff2bd6bff84edd70c224bc672535e4b41a4 +Author: Walter Harms <wharms@bfs.de> +Date: Sat May 13 19:08:12 2023 +0200 + + add xawhisto + +commit 2f99a415913b6be4ed2955a3e30694c2216aafbd +Author: Walter Harms <wharms@bfs.de> +Date: Fri May 12 23:03:32 2023 +0200 + + add examples + + provide some examples to support the documentation + +commit 324358180ddeaae482c5f66bb5647a4918710296 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Tue Mar 28 12:08:41 2023 -0700 + + Set close-on-exec when opening files + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit 78eb3c75688a1e92ec435e5bc3ded063cd339a73 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Wed Mar 15 16:29:53 2023 -0700 @@ -1909,7 +2288,7 @@ Date: Sun Jan 31 17:43:29 2010 -0500 Signed-off-by: Gaetan Nadon <memsize@videotron.ca> commit ceaf6f7f0e516b1479744df421de404b1decc556 -Author: Rémi Cardona <remi@gentoo.org> +Author: Rémi Cardona <remi@gentoo.org> Date: Thu Dec 17 08:28:30 2009 +0100 require autoconf 2.60 because of $(docdir) use @@ -2567,7 +2946,7 @@ Date: Sat Jul 9 06:11:58 2005 +0000 libraries not yet installed will work properly. commit 5fc8851308321a65a6987aedea6618d056ff7879 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jul 6 19:26:27 2005 +0000 - Xaw/xaw.m4: Change help string to say "enable xprint" instead of "disable @@ -2578,7 +2957,7 @@ Date: Wed Jul 6 19:26:27 2005 +0000 - remove font/arabic-misc/README and font/mutt-misc/README commit d4f214b6255184a2cbf571c02409a0e3f4405fb0 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Tue Jul 5 22:51:11 2005 +0000 Add build systems for xlogo, xlsatoms, xlsclients, xmag, xman, xmessage, @@ -2599,7 +2978,7 @@ Date: Sun Jul 3 07:00:56 2005 +0000 <X11/fonts/foo.h>. commit f8e7a4ec6117006123dfdc7c970f9f1392bf7d84 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Tue Jun 28 13:30:15 2005 +0000 lib/Xaw/Makefile.am: install the libXaw.so symlink in $(DESTDIR)$(libdir) - @@ -2607,7 +2986,7 @@ Date: Tue Jun 28 13:30:15 2005 +0000 lib/Xaw/man/Makefile.am: add Xaw.man to EXTRA_DIST to make it distcheck. commit c35ec1561bfc9bf8d79b68a071619f4904764002 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Mon Jun 27 21:35:04 2005 +0000 - Fix string test in lib/Xaw/xaw.m4 @@ -2615,26 +2994,26 @@ Date: Mon Jun 27 21:35:04 2005 +0000 - add build system for editres commit f6c298f70e13ecf37b4824f6ac01007b876dd3cb -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Fri Jun 24 22:54:24 2005 +0000 Add m4 macro to check for versions of the Xaw library commit e3e78cd7815716d8af729c19833bec51d7e3f19c -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Fri Jun 24 21:20:32 2005 +0000 Change the so names to libXaw{6,7,8}.so and install a symlink from libXaw.so to the newest version installed commit cc658b573a13f36868c5a2263e0b3ff8d0230b86 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Mon May 23 21:47:37 2005 +0000 Conditionally include config.h in xc/lib/Xaw/*.c commit 62b680d868fbe4bfdf1af6e6067d0ef27f773559 -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Mon May 23 20:01:46 2005 +0000 Check in build system for Xaw @@ -2675,7 +3054,7 @@ Date: Thu Sep 2 01:10:29 2004 +0000 Bump major version number of libXaw (Bug #1273). commit 93df4ff66635ea936d57723d317d0a0cdaa55e62 -Author: Kristian Høgsberg <krh@redhat.com> +Author: Kristian Høgsberg <krh@redhat.com> Date: Mon Aug 16 16:36:14 2004 +0000 As discussed and agreed on on the release-wranglers meeting of August 16, diff --git a/lib/libXaw/Makefile.am b/lib/libXaw/Makefile.am index 09ea0b657..1f90e84eb 100644 --- a/lib/libXaw/Makefile.am +++ b/lib/libXaw/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = include src man specs +SUBDIRS = include src examples man specs pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = diff --git a/lib/libXaw/Makefile.in b/lib/libXaw/Makefile.in index 8deb053be..8a1835d0b 100644 --- a/lib/libXaw/Makefile.in +++ b/lib/libXaw/Makefile.in @@ -265,6 +265,7 @@ XAW6_LIBS = @XAW6_LIBS@ XAW7_CFLAGS = @XAW7_CFLAGS@ XAW7_LIBS = @XAW7_LIBS@ XMLTO = @XMLTO@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_SGML_PATH = @XORG_SGML_PATH@ XSLTPROC = @XSLTPROC@ @@ -322,7 +323,7 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = include src man specs +SUBDIRS = include src examples man specs pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(am__append_1) $(am__append_2) @BUILD_XAW6_TRUE@@PLATFORM_DARWIN_FALSE@DEFAULT_LIB = libXaw6.@LIBEXT@ diff --git a/lib/libXaw/aclocal.m4 b/lib/libXaw/aclocal.m4 index 66a530e9a..868db45b6 100644 --- a/lib/libXaw/aclocal.m4 +++ b/lib/libXaw/aclocal.m4 @@ -9974,7 +9974,7 @@ dnl DEALINGS IN THE SOFTWARE. # See the "minimum version" comment for each macro you use to see what # version you require. m4_defun([XORG_MACROS_VERSION],[ -m4_define([vers_have], [1.20.0]) +m4_define([vers_have], [1.20.1]) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_if(m4_cmp(maj_have, maj_needed), 0,, @@ -10021,10 +10021,10 @@ rm -f conftest.$ac_ext AC_MSG_CHECKING([if $RAWCPP requires -traditional]) AC_LANG_CONFTEST([AC_LANG_SOURCE([[Does cpp preserve "whitespace"?]])]) -if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then +if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve "'` -eq 1 ; then AC_MSG_RESULT([no]) else - if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then + if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve "'` -eq 1 ; then TRADITIONALCPPFLAGS="-traditional" RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" AC_MSG_RESULT([yes]) diff --git a/lib/libXaw/config.guess b/lib/libXaw/config.guess index 872b96a16..f6d217a49 100644 --- a/lib/libXaw/config.guess +++ b/lib/libXaw/config.guess @@ -1,14 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2024 Free Software Foundation, Inc. -timestamp='2012-09-25' +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2024-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the 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 @@ -17,33 +17,39 @@ timestamp='2012-09-25' # 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 <http://www.gnu.org/licenses/>. +# along with this program; if not, see <https://www.gnu.org/licenses/>. # # 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. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to <config-patches@gnu.org> and include a ChangeLog -# entry. +# 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"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to <config-patches@gnu.org>. + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of the system \`$me' is run on. +Output the configuration name of the system '$me' is run on. -Operation modes: +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 @@ -54,15 +60,13 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2024 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." +Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -90,57 +94,109 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' 1 2 15 +# Just in case it came from the environment. +GUESS= # 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. +# 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. -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { 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) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; 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 ; set_cc_for_build= ;' +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,SC3028 + { 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) >/dev/null 2>&1 ; then +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_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/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm + #else + #include <stdarg.h> + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + # Note: order is significant - the case branches are not exclusive. -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in +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*, @@ -152,22 +208,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # # 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=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-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. - case "${UNAME_MACHINE_ARCH}" in + # 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) - eval $set_cc_for_build + set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -182,45 +248,80 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in 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 + case $UNAME_VERSION in Debian*) release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + 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}" - exit ;; + GUESS=$machine-${os}${release}${abi-} + ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` @@ -234,163 +335,158 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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 + case $ALPHA_CPU_TYPE in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + 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 ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; + GUESS=m68k-unknown-sysv4 + ;; *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; + GUESS=$UNAME_MACHINE-unknown-morphos + ;; *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; + GUESS=i370-ibm-openedition + ;; *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; + GUESS=s390-ibm-zvmoe + ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; + GUESS=powerpc-ibm-os400 + ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; + GUESS=arm-unknown-riscos + ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; + GUESS=hppa1.1-hitachi-hiuxmpp + ;; 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 ;; + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; + GUESS=pyramid-pyramid-svr4 + ;; DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; + GUESS=sparc-icl-nx6 + ;; 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 ;; + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" + 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 test "$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) | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; 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 ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in + 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 ;; + # Japanese Language versions have a version number like '4.1.3-JL'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; 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 + test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + case `/bin/arch` in sun3) - echo m68k-sun-sunos${UNAME_RELEASE} + GUESS=m68k-sun-sunos$UNAME_RELEASE ;; sun4) - echo sparc-sun-sunos${UNAME_RELEASE} + GUESS=sparc-sun-sunos$UNAME_RELEASE ;; esac - exit ;; + ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; # 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 @@ -400,44 +496,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # 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 ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; + GUESS=mips-dec-mach_bsd4.3 + ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include <stdio.h> /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -446,95 +542,96 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + 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); + 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); + 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` && + $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 ;; + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; + GUESS=powerpc-motorola-powermax + ;; Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; + GUESS=powerpc-harris-powermax + ;; Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; + GUESS=powerpc-harris-powerunix + ;; m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; + GUESS=m88k-harris-cxux7 + ;; m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; + GUESS=m88k-motorola-sysv4 + ;; m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x then - echo m88k-dg-dgux${UNAME_RELEASE} + GUESS=m88k-dg-dgux$UNAME_RELEASE else - echo m88k-dg-dguxbcs${UNAME_RELEASE} + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE fi else - echo i586-dg-dgux${UNAME_RELEASE} + GUESS=i586-dg-dgux$UNAME_RELEASE fi - exit ;; + ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; + GUESS=m88k-dolphin-sysv3 + ;; M88*:*:R3*:*) # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; + GUESS=m88k-motorola-sysv3 + ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; + GUESS=m88k-tektronix-sysv3 + ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; + GUESS=m68k-tektronix-bsd + ;; *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; ????????: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 ' + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; + GUESS=i386-ibm-aix + ;; ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then + if test -x /usr/bin/oslevel ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include <sys/systemcfg.h> main() @@ -545,76 +642,77 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then - echo "$SYSTEM_NAME" + GUESS=$SYSTEM_NAME else - echo rs6000-ibm-aix3.2.5 + GUESS=rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 + GUESS=rs6000-ibm-aix3.2.4 else - echo rs6000-ibm-aix3.2 + GUESS=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 + 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/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if test -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} + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; 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 + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; + GUESS=rs6000-bull-bosx + ;; DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; + GUESS=m68k-bull-sysv3 + ;; 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; + GUESS=m68k-hp-bsd + ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; + GUESS=m68k-hp-bsd4.4 + ;; 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 ;; + 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 + if test -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 + 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 + 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 - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + if test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include <stdlib.h> @@ -647,13 +745,13 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (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" ] + if test "$HP_ARCH" = hppa2.0w then - eval $set_cc_for_build + 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 @@ -664,23 +762,23 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" #include <unistd.h> int main () @@ -705,38 +803,38 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + $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 ;; + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; + GUESS=hppa1.0-hp-bsd + ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; + GUESS=hppa1.0-hp-osf + ;; i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk else - echo ${UNAME_MACHINE}-unknown-osf1 + GUESS=$UNAME_MACHINE-unknown-osf1 fi - exit ;; + ;; parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; + GUESS=hppa1.1-hp-lites + ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; + GUESS=c1-convex-bsd + ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd @@ -744,139 +842,174 @@ EOF fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; + GUESS=c34-convex-bsd + ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; + GUESS=c38-convex-bsd + ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; + GUESS=c4-convex-bsd + ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + 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_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; 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 ;; + 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/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; 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 ;; + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + 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 + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac - exit ;; + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; + GUESS=$UNAME_MACHINE-pc-cygwin + ;; *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; *:Interix*:*) - case ${UNAME_MACHINE} in + case $UNAME_MACHINE in x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; + GUESS=i586-pc-interix$UNAME_RELEASE + ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; + GUESS=$UNAME_MACHINE-pc-uwin + ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; + GUESS=x86_64-pc-cygwin + ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + 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 ;; @@ -886,168 +1019,246 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; arm*:Linux:*:*) - eval $set_cc_for_build + 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-gnu + GUESS=$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-gnueabi + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf fi fi - exit ;; + ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit ;; + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el + #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) - CPU=${UNAME_MACHINE}el + MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} + MIPS_ENDIAN= #else - CPU= + MIPS_ENDIAN= #endif #endif EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; + GUESS=sparc-unknown-linux-$LIBC + ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; + GUESS=hppa64-unknown-linux-$LIBC + ;; 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-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; esac - exit ;; + ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; + GUESS=powerpc64-unknown-linux-$LIBC + ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; 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 ;; + GUESS=i386-sequent-sysv4 + ;; 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 ;; + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility + # If we were able to find 'uname', then EMX Unix compatibility # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; + GUESS=$UNAME_MACHINE-unknown-stop + ;; i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; + GUESS=$UNAME_MACHINE-unknown-atheos + ;; i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; + GUESS=$UNAME_MACHINE-pc-syllable + ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + 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} + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + GUESS=$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 @@ -1055,12 +1266,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL elif /bin/uname -X 2>/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 @@ -1070,43 +1281,43 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL else - echo ${UNAME_MACHINE}-pc-sysv32 + GUESS=$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 configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; + GUESS=i586-pc-msdosdjgpp + ;; Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; + GUESS=i386-pc-mach3 + ;; paragon:*:*:*) - echo i860-intel-osf1 - exit ;; + GUESS=i860-intel-osf1 + ;; 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 + GUESS=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 + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 fi - exit ;; + ;; mini*:CTIX:SYS*5:*) # "miniframe" - echo m68010-convergent-sysv - exit ;; + GUESS=m68010-convergent-sysv + ;; mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; + GUESS=m68k-convergent-sysv + ;; M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; + GUESS=m68k-diab-dnix + ;; 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) @@ -1114,9 +1325,9 @@ EOF 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; } + && { 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; } ;; + && { 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; } ;; @@ -1125,226 +1336,290 @@ EOF 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; } + && { 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; } + && { 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; } ;; + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; + GUESS=m68k-atari-sysv4 + ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; + GUESS=mips-sni-sysv4 + ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 + GUESS=$UNAME_MACHINE-sni-sysv4 else - echo ns32k-sni-sysv + GUESS=ns32k-sni-sysv fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; + GUESS=i586-unisys-sysv4 + ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes <hewes@openmarket.com>. # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; + GUESS=hppa1.1-stratus-sysv4 + ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; + GUESS=i860-stratus-sysv4 + ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; + GUESS=$UNAME_MACHINE-stratus-vos + ;; *:VOS:*:*) # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; + GUESS=hppa1.1-stratus-vos + ;; mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; + GUESS=mips-sony-newsos6 + ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE else - echo mips-unknown-sysv${UNAME_RELEASE} + GUESS=mips-unknown-sysv$UNAME_RELEASE fi - exit ;; + ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; + GUESS=powerpc-be-beos + ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; + GUESS=powerpc-apple-beos + ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; + GUESS=i586-pc-beos + ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + UNAME_PROCESSOR=`uname -p` case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - 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 - UNAME_PROCESSOR="x86_64" - fi - fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; + 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 test "$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 + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; + GUESS=mips-compaq-nonstopux + ;; BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; + GUESS=bs2000-siemens-sysv + ;; DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "${cputype-}" = 386; then UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; + GUESS=pdp10-unknown-tops10 + ;; *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; + GUESS=pdp10-unknown-tenex + ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; + GUESS=pdp10-dec-tops20 + ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; + GUESS=pdp10-xkl-tops20 + ;; *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; + GUESS=pdp10-unknown-tops20 + ;; *:ITS:*:*) - echo pdp10-unknown-its - exit ;; + GUESS=pdp10-unknown-its + ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; *:*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 ;; + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; esac ;; *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; + GUESS=i386-pc-xenix + ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; esac -eval $set_cc_for_build -cat >$dummy.c <<EOF +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" <<EOF #ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> +#include <sys/types.h> +#include <sys/utsname.h> +#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 <signal.h> +#if defined(_SIZE_T_) || defined(SIGLOST) +#include <sys/utsname.h> +#endif +#endif #endif main () { @@ -1357,20 +1632,12 @@ main () #include <sys/param.h> printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 - "4" + "4" #else - "" -#endif - ); exit (0); + "" #endif + ); exit (0); #endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) @@ -1412,39 +1679,54 @@ main () #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); + 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 <sys/param.h> -# 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 - printf ("vax-dec-ultrix\n"); exit (0); -# endif +#if !defined (ultrix) +#include <sys/param.h> +#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) @@ -1455,54 +1737,46 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && +$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; } -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } +echo "$0: unable to guess system type" >&2 -# Convex versions that predate uname can use getsysinfo(1) +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <<EOF -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi +NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize +the system type. Please install a C compiler and try again. +EOF + ;; +esac cat >&2 <<EOF -$0: unable to guess system type -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from +This script (version $timestamp), has failed to recognize the +operating system you are using. If your script is old, overwrite *all* +copies of config.guess and config.sub with the latest versions from: - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + https://git.savannah.gnu.org/cgit/config.git/plain/config.guess and - http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + https://git.savannah.gnu.org/cgit/config.git/plain/config.sub +EOF -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. +our_year=`echo $timestamp | sed 's,-.*,,'` +thisyear=`date +%Y` +# shellcheck disable=SC2003 +script_age=`expr "$thisyear" - "$our_year"` +if test "$script_age" -lt 3 ; then + cat >&2 <<EOF + +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp @@ -1521,16 +1795,17 @@ hostinfo = `(hostinfo) 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} +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 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/lib/libXaw/config.h.in b/lib/libXaw/config.h.in index 93c76a109..e8ec74ff4 100644 --- a/lib/libXaw/config.h.in +++ b/lib/libXaw/config.h.in @@ -15,6 +15,12 @@ /* Define to 1 if you have the `ws2_32' library (-lws2_32). */ #undef HAVE_LIBWS2_32 +/* Define to 1 if you have the <malloc.h> header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the `malloc_usable_size' function. */ +#undef HAVE_MALLOC_USABLE_SIZE + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H diff --git a/lib/libXaw/config.sub b/lib/libXaw/config.sub index 8df551109..2c6a07ab3 100644 --- a/lib/libXaw/config.sub +++ b/lib/libXaw/config.sub @@ -1,36 +1,33 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2024 Free Software Foundation, Inc. -timestamp='2012-12-06' +# shellcheck disable=SC2006,SC2268 # see below for rationale -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +timestamp='2024-01-01' + +# 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. +# 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 <http://www.gnu.org/licenses/>. +# along with this program; if not, see <https://www.gnu.org/licenses/>. # # 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. +# 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 <config-patches@gnu.org>. Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to <config-patches@gnu.org>. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -38,7 +35,7 @@ timestamp='2012-12-06' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -55,15 +52,21 @@ timestamp='2012-12-06' # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. -Operation modes: +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 @@ -73,15 +76,13 @@ Report bugs and patches to <config-patches@gnu.org>." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2024 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." +Try '$me --help' for more information." # Parse command line while test $# -gt 0 ; do @@ -97,12 +98,12 @@ while test $# -gt 0 ; do - ) # Use stdin as input. break ;; -* ) - echo "$me: invalid option $1$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. - echo $1 + echo "$1" exit ;; * ) @@ -118,1207 +119,1167 @@ case $# in exit 1;; esac -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <<EOF +$1 +EOF +IFS=$saved_IFS -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -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*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos +# Separate into logical components for further validation +case $1 in + *-*-*-*-*) + echo "Invalid configuration '$1': more than four components" >&2 + exit 1 ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` + *-*-*) + # 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* | managarm-* \ + | windows-* ) + 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 ;; - -psos*) - os=-psos + *-*) + # 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 + ;; + zephyr*) + basic_machine=$field1-unknown + 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 ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint + *) + # 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 aliases for certain CPU-COMPANY combinations. +# Decode 1-component or ad-hoc basic machines case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown + # 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 ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown + op50n) + cpu=hppa1.1 + vendor=oki ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none + op60c) + cpu=hppa1.1 + vendor=oki ;; - xscaleeb) - basic_machine=armeb-unknown + ibm*) + cpu=i370 + vendor=ibm ;; - - xscaleel) - basic_machine=armel-unknown + orion105) + cpu=clipper + vendor=highlevel ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown + 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. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att + cpu=m68000 + vendor=att ;; 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux + cpu=we32k + vendor=att ;; bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec + cpu=powerpc + vendor=ibm + basic_os=cnk ;; decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 + cpu=pdp10 + vendor=dec + basic_os=tops10 ;; decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 + cpu=pdp10 + vendor=dec + basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp + cpu=m68k + vendor=motorola ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 ;; encore | umax | mmax) - basic_machine=ns32k-encore + cpu=ns32k + vendor=encore ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} ;; fx2800) - basic_machine=i860-alliant + cpu=i860 + vendor=alliant ;; genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 + cpu=ns32k + vendor=ns ;; h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp + cpu=m68000 + vendor=hp ;; hp9k3[2-9][0-9]) - basic_machine=m68k-hp + cpu=m68k + vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp + cpu=hppa1.0 + vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-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 - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp + cpu=hppa1.1 + vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm + cpu=hppa1.0 + vendor=hp ;; i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 ;; i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 ;; i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv ;; i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} ;; iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) + cpu=mips + vendor=sgi + case $basic_os in + irix*) ;; *) - os=-irix4 + basic_os=irix4 ;; esac ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i386-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs + cpu=m68000 + vendor=convergent ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint ;; news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) ;; - -ns2*) - os=-nextstep2 + ns2*) + basic_os=nextstep2 ;; *) - os=-nextstep3 + basic_os=nextstep3 ;; esac ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem + cpu=np1 + vendor=gould ;; op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k + cpu=hppa1.1 + vendor=oki + basic_os=proelf ;; pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 ;; pbd) - basic_machine=sparc-tti + cpu=sparc + vendor=tti ;; pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc + cpu=m68k + vendor=tti ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + pc532) + cpu=ns32k + vendor=pc532 ;; pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + cpu=pn + vendor=gould ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + power) + cpu=power + vendor=ibm ;; ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff + cpu=i386 + vendor=ibm ;; rm[46]00) - basic_machine=mips-siemens + cpu=mips + vendor=siemens ;; rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm + cpu=romp + vendor=ibm ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks ;; - sde) - basic_machine=mipsisa32-sde - os=-elf + tower | tower-32) + cpu=m68k + vendor=ncr ;; - sei) - basic_machine=mips-sei - os=-seiux + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu ;; - sequent) - basic_machine=i386-sequent + w65) + cpu=w65 + vendor=wdc ;; - sh) - basic_machine=sh-hitachi - os=-hms + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf ;; - sh5el) - basic_machine=sh5le-unknown + none) + cpu=none + vendor=none ;; - sh64) - basic_machine=sh64-unknown + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <<EOF +$basic_machine +EOF + IFS=$saved_IFS + ;; + # We use 'pc' rather than 'unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + cpu=$basic_machine + vendor=pc ;; - spur) - basic_machine=spur-unknown + # These rules are duplicated from below for sake of the special case above; + # i.e. things that normalized to x86 arches should also default to "pc" + pc98) + cpu=i386 + vendor=pc ;; - st2000) - basic_machine=m68k-tandem + x64 | amd64) + cpu=x86_64 + vendor=pc ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 + # Recognize the basic CPU types without company name. + *) + cpu=$basic_machine + vendor=unknown ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` +esac + +unset -v basic_machine + +# Decode basic machines in the full and proper CPU-Company form. +case $cpu-$vendor in + # Here we handle the default manufacturer of certain CPU types in canonical form. It is in + # some cases the only manufacturer, in others, it is the most popular. + craynv-unknown) + vendor=cray + basic_os=${basic_os:-unicosmp} ;; - sun2) - basic_machine=m68000-sun + c90-unknown | c90-cray) + vendor=cray + basic_os=${Basic_os:-unicos} ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 + fx80-unknown) + vendor=alliant ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 + romp-unknown) + vendor=ibm ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 + mmix-unknown) + vendor=knuth ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 + microblaze-unknown | microblazeel-unknown) + vendor=xilinx ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 + rs6000-unknown) + vendor=ibm ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 + vax-unknown) + vendor=dec ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 + pdp11-unknown) + vendor=dec ;; - sun3 | sun3-*) - basic_machine=m68k-sun + we32k-unknown) + vendor=att ;; - sun4) - basic_machine=sparc-sun + cydra-unknown) + vendor=cydrome ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun + i370-ibm*) + vendor=ibm ;; - sv1) - basic_machine=sv1-cray - os=-unicos + orion-unknown) + vendor=highlevel ;; - symmetry) - basic_machine=i386-sequent - os=-dynix + xps-unknown | xps100-unknown) + cpu=xps100 + vendor=honeywell ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos + + # Here we normalize CPU types with a missing or matching vendor + armh-unknown | armh-alt) + cpu=armv7l + vendor=alt + basic_os=${basic_os:-linux-gnueabihf} ;; - t90) - basic_machine=t90-cray - os=-unicos + dpx20-unknown | dpx20-bull) + cpu=rs6000 + vendor=bull + basic_os=${basic_os:-bosx} ;; - tile*) - basic_machine=$basic_machine-unknown - os=-linux-gnu + + # Here we normalize CPU types irrespective of the vendor + amd64-*) + cpu=x86_64 ;; - tx39) - basic_machine=mipstx39-unknown + blackfin-*) + cpu=bfin + basic_os=linux ;; - tx39el) - basic_machine=mipstx39el-unknown + c54x-*) + cpu=tic54x ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 + c55x-*) + cpu=tic55x ;; - tower | tower-32) - basic_machine=m68k-ncr + c6x-*) + cpu=tic6x ;; - tpf) - basic_machine=s390x-ibm - os=-tpf + e500v[12]-*) + cpu=powerpc + basic_os=${basic_os}"spe" ;; - udi29k) - basic_machine=a29k-amd - os=-udi + mips3*-*) + cpu=mips64 ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 + ms1-*) + cpu=mt ;; - v810 | necv810) - basic_machine=v810-nec - os=-none + m68knommu-*) + cpu=m68k + basic_os=linux ;; - vaxv) - basic_machine=vax-dec - os=-sysv + m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) + cpu=s12z ;; - vms) - basic_machine=vax-dec - os=-vms + openrisc-*) + cpu=or32 ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu + parisc-*) + cpu=hppa + basic_os=linux ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + cpu=i586 ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks + pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) + cpu=i686 ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + cpu=i686 ;; - w65*) - basic_machine=w65-wdc - os=-none + pentium4-*) + cpu=i786 ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf + pc98-*) + cpu=i386 ;; - xbox) - basic_machine=i686-pc - os=-mingw32 + ppc-* | ppcbe-*) + cpu=powerpc ;; - xps | xps100) - basic_machine=xps100-honeywell + ppcle-* | powerpclittle-*) + cpu=powerpcle ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` + ppc64-*) + cpu=powerpc64 ;; - ymp) - basic_machine=ymp-cray - os=-unicos + ppc64le-* | powerpc64little-*) + cpu=powerpc64le ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim + sb1-*) + cpu=mipsisa64sb1 ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim + sb1el-*) + cpu=mipsisa64sb1el ;; - none) - basic_machine=none-none - os=-none + sh5e[lb]-*) + cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` ;; - -# 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) - basic_machine=hppa1.1-winbond + spur-*) + cpu=spur ;; - op50n) - basic_machine=hppa1.1-oki + strongarm-* | thumb-*) + cpu=arm ;; - op60c) - basic_machine=hppa1.1-oki + tx39-*) + cpu=mipstx39 ;; - romp) - basic_machine=romp-ibm + tx39el-*) + cpu=mipstx39el ;; - mmix) - basic_machine=mmix-knuth + x64-*) + cpu=x86_64 ;; - rs6000) - basic_machine=rs6000-ibm + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;; - vax) - basic_machine=vax-dec + arm64-* | aarch64le-*) + cpu=aarch64 ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown + + # Recognize the canonical CPU Types that limit and/or modify the + # company names they are paired with. + cr16-*) + basic_os=${basic_os:-elf} ;; - pdp11) - basic_machine=pdp11-dec + crisv32-* | etraxfs*-*) + cpu=crisv32 + vendor=axis ;; - we32k) - basic_machine=we32k-att + cris-* | etrax*-*) + cpu=cris + vendor=axis ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown + crx-*) + basic_os=${basic_os:-elf} ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun + neo-tandem) + cpu=neo + vendor=tandem ;; - cydra) - basic_machine=cydra-cydrome + nse-tandem) + cpu=nse + vendor=tandem ;; - orion) - basic_machine=orion-highlevel + nsr-tandem) + cpu=nsr + vendor=tandem ;; - orion105) - basic_machine=clipper-highlevel + nsv-tandem) + cpu=nsv + vendor=tandem ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple + nsx-tandem) + cpu=nsx + vendor=tandem ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple + mipsallegrexel-sony) + cpu=mipsallegrexel + vendor=sony ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. + tile*-*) + basic_os=${basic_os:-linux-gnu} ;; + *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be | aarch64c | arm64ec \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | javascript \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | kvx \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips* \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nanomips* \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | vc4 \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 + exit 1 + ;; + esac ;; esac # Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` +case $vendor in + digital*) + vendor=dec ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + commodore*) + vendor=cbm ;; *) ;; @@ -1326,203 +1287,226 @@ esac # Decode manufacturer-specific aliases for certain operating systems. -if [ x"$os" != x"" ] +if test x"$basic_os" != x then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +obj= +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <<EOF +$basic_os +EOF + IFS=$saved_IFS + ;; + # Default OS when just kernel was specified + nto*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto|qnx|'` + ;; + linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|linux|gnu|'` + ;; + managarm*) + kernel=managarm + os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` + ;; + *) + kernel= + os=$basic_os + ;; +esac + +# Now, normalize the OS (knowing we just have one component, it's not a kernel, +# etc.) case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux + # First match some system type aliases that might get confused + # with valid system types. + # solaris* is a basic system type, with this one exception. + auroraux) + os=auroraux ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` + bluegene*) + os=cnk ;; - -solaris) - os=-solaris2 + solaris1 | solaris1.*) + os=`echo "$os" | sed -e 's|solaris1|sunos4|'` ;; - -svr4*) - os=-sysv4 + solaris) + os=solaris2 ;; - -unixware*) - os=-sysv4.2uw + unixware*) + os=sysv4.2uw ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + # es1800 is here to avoid being matched by es* (a different OS) + es1800*) + os=ose ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac + # Some version numbers need modification + chorusos*) + os=chorusos ;; - -nto-qnx*) + isc) + os=isc2.2 ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` + sco6) + os=sco5v6 ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + sco5) + os=sco3.2v5 ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` + sco4) + os=sco3.2v4 ;; - -linux-dietlibc) - os=-linux-dietlibc + sco3.2.[4-9]*) + os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` + sco*v* | scout) + # Don't match below ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` + sco*) + os=sco3.2v2 ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` + psos*) + os=psos ;; - -opened*) - os=-openedition + qnx*) + os=qnx ;; - -os400*) - os=-os400 + hiux*) + os=hiuxwe2 ;; - -wince*) - os=-wince + lynx*178) + os=lynxos178 ;; - -osfrose*) - os=-osfrose + lynx*5) + os=lynxos5 ;; - -osf*) - os=-osf + lynxos*) + # don't get caught up in next wildcard ;; - -utek*) - os=-bsd + lynx*) + os=lynxos ;; - -dynix*) - os=-bsd + mac[0-9]*) + os=`echo "$os" | sed -e 's|mac|macos|'` ;; - -acis*) - os=-aos + opened*) + os=openedition ;; - -atheos*) - os=-atheos + os400*) + os=os400 ;; - -syllable*) - os=-syllable + sunos5*) + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; - -386bsd) - os=-bsd + sunos6*) + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; - -ctix* | -uts*) - os=-sysv + wince*) + os=wince ;; - -nova*) - os=-rtmk-nova + utek*) + os=bsd ;; - -ns2 ) - os=-nextstep2 + dynix*) + os=bsd ;; - -nsk*) - os=-nsk + acis*) + os=aos ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` + atheos*) + os=atheos ;; - -sinix*) - os=-sysv4 + syllable*) + os=syllable ;; - -tpf*) - os=-tpf + 386bsd) + os=bsd ;; - -triton*) - os=-sysv3 + ctix* | uts*) + os=sysv ;; - -oss*) - os=-sysv3 + nova*) + os=rtmk-nova ;; - -svr4) - os=-sysv4 + ns2) + os=nextstep2 ;; - -svr3) - os=-sysv3 + # Preserve the version number of sinix5. + sinix5.*) + os=`echo "$os" | sed -e 's|sinix|sysv|'` ;; - -sysvr4) - os=-sysv4 + sinix*) + os=sysv4 ;; - # This must come after -sysvr4. - -sysv*) + tpf*) + os=tpf ;; - -ose*) - os=-ose + triton*) + os=sysv3 ;; - -es1800*) - os=-ose + oss*) + os=sysv3 ;; - -xenix) - os=-xenix + svr4*) + os=sysv4 ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint + svr3) + os=sysv3 ;; - -aros*) - os=-aros + sysvr4) + os=sysv4 ;; - -kaos*) - os=-kaos + ose*) + os=ose ;; - -zvmoe) - os=-zvmoe + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + os=mint ;; - -dicos*) - os=-dicos + dicos*) + os=dicos ;; - -nacl*) + pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $cpu in + arm*) + os=eabi + ;; + *) + os= + obj=elf + ;; + esac ;; - -none) + aout* | coff* | elf* | pe*) + # These are machine code file formats, not OSes + obj=$os + os= ;; *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 + # No normalization, but not necessarily accepted, that comes below. ;; esac + else # Here we handle the default operating systems that come with various machines. @@ -1535,258 +1519,452 @@ else # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. -case $basic_machine in +kernel= +obj= +case $cpu-$vendor in score-*) - os=-elf + os= + obj=elf ;; spu-*) - os=-elf + os= + obj=elf ;; *-acorn) - os=-riscix1.2 + os=riscix1.2 ;; arm*-rebel) - os=-linux + kernel=linux + os=gnu ;; arm*-semi) - os=-aout + os= + obj=aout ;; c4x-* | tic4x-*) - os=-coff + os= + obj=coff + ;; + c8051-*) + os= + obj=elf + ;; + clipper-intergraph) + os=clix ;; hexagon-*) - os=-elf + os= + obj=elf ;; tic54x-*) - os=-coff + os= + obj=coff ;; tic55x-*) - os=-coff + os= + obj=coff ;; tic6x-*) - os=-coff + os= + obj=coff ;; # This must come before the *-dec entry. pdp10-*) - os=-tops20 + os=tops20 ;; pdp11-*) - os=-none + os=none ;; *-dec | vax-*) - os=-ultrix4.2 + os=ultrix4.2 ;; m68*-apollo) - os=-domain + os=domain ;; i386-sun) - os=-sunos4.0.2 + os=sunos4.0.2 ;; m68000-sun) - os=-sunos3 + os=sunos3 ;; m68*-cisco) - os=-aout + os= + obj=aout ;; mep-*) - os=-elf + os= + obj=elf ;; mips*-cisco) - os=-elf + os= + obj=elf ;; - mips*-*) - os=-elf + mips*-*|nanomips*-*) + os= + obj=elf ;; or32-*) - os=-coff + os= + obj=coff ;; *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 + os=sysv3 ;; sparc-* | *-sun) - os=-sunos4.1.1 + os=sunos4.1.1 ;; - *-be) - os=-beos + pru-*) + os= + obj=elf ;; - *-haiku) - os=-haiku + *-be) + os=beos ;; *-ibm) - os=-aix + os=aix ;; *-knuth) - os=-mmixware + os=mmixware ;; *-wec) - os=-proelf + os=proelf ;; *-winbond) - os=-proelf + os=proelf ;; *-oki) - os=-proelf + os=proelf ;; *-hp) - os=-hpux + os=hpux ;; *-hitachi) - os=-hiux + os=hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv + os=sysv ;; *-cbm) - os=-amigaos + os=amigaos ;; *-dg) - os=-dgux + os=dgux ;; *-dolphin) - os=-sysv3 + os=sysv3 ;; m68k-ccur) - os=-rtu + os=rtu ;; m88k-omron*) - os=-luna + os=luna ;; - *-next ) - os=-nextstep + *-next) + os=nextstep ;; *-sequent) - os=-ptx + os=ptx ;; *-crds) - os=-unos + os=unos ;; *-ns) - os=-genix + os=genix ;; i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 + os=mvs ;; *-gould) - os=-sysv + os=sysv ;; *-highlevel) - os=-bsd + os=bsd ;; *-encore) - os=-bsd + os=bsd ;; *-sgi) - os=-irix + os=irix ;; *-siemens) - os=-sysv4 + os=sysv4 ;; *-masscomp) - os=-rtu + os=rtu ;; f30[01]-fujitsu | f700-fujitsu) - os=-uxpv + os=uxpv ;; *-rom68k) - os=-coff + os= + obj=coff ;; *-*bug) - os=-coff + os= + obj=coff ;; *-apple) - os=-macos + os=macos ;; *-atari*) - os=-mint + os=mint + ;; + *-wrs) + os=vxworks ;; *) - os=-none + os=none ;; esac + fi +# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). + +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + llvm* | musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # See `case $cpu-$os` validation below + ghcjs) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* | tvos* | watchos* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | oabi* \ + | ptx* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* | mlibc* | cos* | mbr* | ironclad* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + # This refers to builds using the UEFI calling convention + # (which depends on the architecture) and PE file format. + # Note that this is both a different calling convention and + # different file format than that of GNU-EFI + # (x86_64-w64-mingw32). + uefi) + ;; + none) + ;; + kernel* | msvc* ) + # Restricted further below + ;; + '') + if test x"$obj" = x + then + echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; + *) + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&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-$obj in + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) + ;; + windows*-msvc*-) + ;; + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -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 + ;; + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) + ;; + os2-emx-) + ;; + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) + # Blank kernel with real OS is always fine. + ;; + --*) + # Blank kernel and OS with real machine code file format 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. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) vendor=acorn ;; - -sunos*) + *-sunos*) vendor=sun ;; - -cnk*|-aix*) + *-cnk* | *-aix*) vendor=ibm ;; - -beos*) + *-beos*) vendor=be ;; - -hpux*) + *-hpux*) vendor=hp ;; - -mpeix*) + *-mpeix*) vendor=hp ;; - -hiux*) + *-hiux*) vendor=hitachi ;; - -unos*) + *-unos*) vendor=crds ;; - -dgux*) + *-dgux*) vendor=dg ;; - -luna*) + *-luna*) vendor=omron ;; - -genix*) + *-genix*) vendor=ns ;; - -mvs* | -opened*) + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) vendor=ibm ;; - -os400*) + s390-* | s390x-*) vendor=ibm ;; - -ptx*) + *-ptx*) vendor=sequent ;; - -tpf*) + *-tpf*) vendor=ibm ;; - -vxsim* | -vxworks* | -windiss*) + *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; - -aux*) + *-aux*) vendor=apple ;; - -hms*) + *-hms*) vendor=hitachi ;; - -mpw* | -macos*) + *-mpw* | *-macos*) vendor=apple ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; - -vos*) + *-vos*) vendor=stratus ;; esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac -echo $basic_machine$os +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" exit # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/lib/libXaw/configure b/lib/libXaw/configure index 6207d9e46..4ca4b9ae3 100644 --- a/lib/libXaw/configure +++ b/lib/libXaw/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for libXaw 1.0.15. +# Generated by GNU Autoconf 2.71 for libXaw 1.0.16. # # Report bugs to <https://gitlab.freedesktop.org/xorg/lib/libxaw/-/issues>. # @@ -682,8 +682,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libXaw' PACKAGE_TARNAME='libXaw' -PACKAGE_VERSION='1.0.15' -PACKAGE_STRING='libXaw 1.0.15' +PACKAGE_VERSION='1.0.16' +PACKAGE_STRING='libXaw 1.0.16' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/lib/libxaw/-/issues' PACKAGE_URL='' @@ -724,6 +724,9 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +ENABLE_UNIT_TESTS_FALSE +ENABLE_UNIT_TESTS_TRUE +XORG_MALLOC_DEBUG_ENV BUILD_XAW7_FALSE BUILD_XAW7_TRUE BUILD_XAW6_FALSE @@ -914,6 +917,7 @@ with_xsltproc enable_xaw6 enable_xaw7 enable_const +enable_unit_tests ' ac_precious_vars='build_alias host_alias @@ -932,7 +936,8 @@ XSLTPROC XAW6_CFLAGS XAW6_LIBS XAW7_CFLAGS -XAW7_LIBS' +XAW7_LIBS +XORG_MALLOC_DEBUG_ENV' # Initialize some variables set by options. @@ -1481,7 +1486,7 @@ 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 <<_ACEOF -\`configure' configures libXaw 1.0.15 to adapt to many kinds of systems. +\`configure' configures libXaw 1.0.16 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1552,7 +1557,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of libXaw 1.0.15:";; + short | recursive ) echo "Configuration of libXaw 1.0.16:";; esac cat <<\_ACEOF @@ -1584,6 +1589,7 @@ Optional Features: --disable-xaw6 Disable building of libXaw.so.6 --disable-xaw7 Disable building of libXaw.so.7 --disable-const Disable const-support + --enable-unit-tests Enable building unit test cases (default: no) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1619,6 +1625,8 @@ Some influential environment variables: XAW6_LIBS linker flags for XAW6, overriding pkg-config XAW7_CFLAGS C compiler flags for XAW7, overriding pkg-config XAW7_LIBS linker flags for XAW7, overriding pkg-config + XORG_MALLOC_DEBUG_ENV + Environment variables to enable memory checking in tests Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1687,7 +1695,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -libXaw configure 1.0.15 +libXaw configure 1.0.16 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1957,7 +1965,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by libXaw $as_me 1.0.15, which was +It was created by libXaw $as_me 1.0.16, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -3195,7 +3203,7 @@ fi # Define the identity of the package. PACKAGE='libXaw' - VERSION='1.0.15' + VERSION='1.0.16' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -19643,7 +19651,190 @@ printf "%s\n" "#define _CONST_X_STRING 1" >>confdefs.h fi -ac_config_files="$ac_config_files Makefile include/Makefile man/Makefile specs/Makefile specs/libXaw.ent src/Makefile" +# --enable-unit-tests + + + + + +# Check for different types of support on different platforms +case $host_os in + solaris*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for umem_alloc in -lumem" >&5 +printf %s "checking for umem_alloc in -lumem... " >&6; } +if test ${ac_cv_lib_umem_umem_alloc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lumem $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char umem_alloc (); +int +main (void) +{ +return umem_alloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_umem_umem_alloc=yes +else $as_nop + ac_cv_lib_umem_umem_alloc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_umem_umem_alloc" >&5 +printf "%s\n" "$ac_cv_lib_umem_umem_alloc" >&6; } +if test "x$ac_cv_lib_umem_umem_alloc" = xyes +then : + malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default' +fi + + ;; + *-gnu*) # GNU libc - Value is used as a single byte bit pattern, + # both directly and inverted, so should not be 0 or 255. + malloc_debug_env='MALLOC_PERTURB_=15' + ;; + darwin*) + malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib' + ;; + *bsd*) + malloc_debug_env='MallocPreScribble=1 MallocScribble=1' + ;; +esac + +# User supplied flags override default flags +if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then + malloc_debug_env="$XORG_MALLOC_DEBUG_ENV" +fi + +XORG_MALLOC_DEBUG_ENV=$malloc_debug_env + + + + + + + +# Check whether --enable-unit-tests was given. +if test ${enable_unit_tests+y} +then : + enableval=$enable_unit_tests; enable_unit_tests=$enableval +else $as_nop + enable_unit_tests=no +fi + + + if test "x$enable_unit_tests" != xno; then + ENABLE_UNIT_TESTS_TRUE= + ENABLE_UNIT_TESTS_FALSE='#' +else + ENABLE_UNIT_TESTS_TRUE='#' + ENABLE_UNIT_TESTS_FALSE= +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build unit test cases" >&5 +printf %s "checking whether to build unit test cases... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_unit_tests" >&5 +printf "%s\n" "$enable_unit_tests" >&6; } + + + + + + +# Check for different types of support on different platforms +case $host_os in + solaris*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for umem_alloc in -lumem" >&5 +printf %s "checking for umem_alloc in -lumem... " >&6; } +if test ${ac_cv_lib_umem_umem_alloc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lumem $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char umem_alloc (); +int +main (void) +{ +return umem_alloc (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_umem_umem_alloc=yes +else $as_nop + ac_cv_lib_umem_umem_alloc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_umem_umem_alloc" >&5 +printf "%s\n" "$ac_cv_lib_umem_umem_alloc" >&6; } +if test "x$ac_cv_lib_umem_umem_alloc" = xyes +then : + malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default' +fi + + ;; + *-gnu*) # GNU libc - Value is used as a single byte bit pattern, + # both directly and inverted, so should not be 0 or 255. + malloc_debug_env='MALLOC_PERTURB_=15' + ;; + darwin*) + malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib' + ;; + *bsd*) + malloc_debug_env='MallocPreScribble=1 MallocScribble=1' + ;; +esac + +# User supplied flags override default flags +if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then + malloc_debug_env="$XORG_MALLOC_DEBUG_ENV" +fi + +XORG_MALLOC_DEBUG_ENV=$malloc_debug_env + + +if test "x$enable_unit_tests" != "xno" ; then + ac_fn_c_check_func "$LINENO" "malloc_usable_size" "ac_cv_func_malloc_usable_size" +if test "x$ac_cv_func_malloc_usable_size" = xyes +then : + printf "%s\n" "#define HAVE_MALLOC_USABLE_SIZE 1" >>confdefs.h + +fi + + ac_fn_c_check_header_compile "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default" +if test "x$ac_cv_header_malloc_h" = xyes +then : + printf "%s\n" "#define HAVE_MALLOC_H 1" >>confdefs.h + +fi + +fi + +ac_config_files="$ac_config_files Makefile examples/Makefile include/Makefile man/Makefile specs/Makefile specs/libXaw.ent src/Makefile" if test "x$build_v6" = xyes; then @@ -19833,6 +20024,10 @@ if test -z "${BUILD_XAW7_TRUE}" && test -z "${BUILD_XAW7_FALSE}"; then as_fn_error $? "conditional \"BUILD_XAW7\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ENABLE_UNIT_TESTS_TRUE}" && test -z "${ENABLE_UNIT_TESTS_FALSE}"; then + as_fn_error $? "conditional \"ENABLE_UNIT_TESTS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 @@ -20223,7 +20418,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by libXaw $as_me 1.0.15, which was +This file was extended by libXaw $as_me 1.0.16, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20291,7 +20486,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -libXaw config.status 1.0.15 +libXaw config.status 1.0.16 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" @@ -20702,6 +20897,7 @@ do "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "libtool_hack") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool_hack" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "specs/Makefile") CONFIG_FILES="$CONFIG_FILES specs/Makefile" ;; diff --git a/lib/libXaw/configure.ac b/lib/libXaw/configure.ac index c6501943a..6e3c7164a 100644 --- a/lib/libXaw/configure.ac +++ b/lib/libXaw/configure.ac @@ -1,7 +1,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([libXaw], [1.0.15], +AC_INIT([libXaw], [1.0.16], [https://gitlab.freedesktop.org/xorg/lib/libxaw/-/issues], [libXaw]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) @@ -115,7 +115,16 @@ if test "x$USE_CONST" = "xyes" ; then AC_DEFINE(_CONST_X_STRING, 1, [Define to 1 to use standard C const feature.]) fi +# --enable-unit-tests +XORG_ENABLE_UNIT_TESTS(no) +XORG_MEMORY_CHECK_FLAGS +if test "x$enable_unit_tests" != "xno" ; then + AC_CHECK_FUNCS([malloc_usable_size]) + AC_CHECK_HEADERS([malloc.h]) +fi + AC_CONFIG_FILES([Makefile + examples/Makefile include/Makefile man/Makefile specs/Makefile diff --git a/lib/libXaw/examples/Makefile.am b/lib/libXaw/examples/Makefile.am new file mode 100644 index 000000000..78308dc85 --- /dev/null +++ b/lib/libXaw/examples/Makefile.am @@ -0,0 +1,15 @@ +if ENABLE_UNIT_TESTS +check_PROGRAMS = list menu pane repeater scrollbar simple strip toggle viewport xawhisto + +TESTS=$(check_PROGRAMS) + +AM_CFLAGS = $(CWARNFLAGS) $(XAW_CFLAGS) +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 +LDADD= $(top_builddir)/src/libXaw7.la $(XAW7_LIBS) + +TESTS_ENVIRONMENT = $(MALLOC_DEBUG_ENV) + +endif ENABLE_UNIT_TESTS diff --git a/lib/libXaw/examples/Makefile.in b/lib/libXaw/examples/Makefile.in new file mode 100644 index 000000000..f55c9c3e1 --- /dev/null +++ b/lib/libXaw/examples/Makefile.in @@ -0,0 +1,774 @@ +# Makefile.in generated by automake 1.12.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ENABLE_UNIT_TESTS_TRUE@check_PROGRAMS = list$(EXEEXT) menu$(EXEEXT) \ +@ENABLE_UNIT_TESTS_TRUE@ pane$(EXEEXT) repeater$(EXEEXT) \ +@ENABLE_UNIT_TESTS_TRUE@ scrollbar$(EXEEXT) simple$(EXEEXT) \ +@ENABLE_UNIT_TESTS_TRUE@ strip$(EXEEXT) toggle$(EXEEXT) \ +@ENABLE_UNIT_TESTS_TRUE@ viewport$(EXEEXT) xawhisto$(EXEEXT) +subdir = examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +list_SOURCES = list.c +list_OBJECTS = list.$(OBJEXT) +list_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +@ENABLE_UNIT_TESTS_TRUE@list_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +menu_SOURCES = menu.c +menu_OBJECTS = menu.$(OBJEXT) +menu_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@menu_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +pane_SOURCES = pane.c +pane_OBJECTS = pane.$(OBJEXT) +pane_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@pane_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +repeater_SOURCES = repeater.c +repeater_OBJECTS = repeater.$(OBJEXT) +repeater_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@repeater_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +scrollbar_SOURCES = scrollbar.c +scrollbar_OBJECTS = scrollbar.$(OBJEXT) +scrollbar_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@scrollbar_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +simple_SOURCES = simple.c +simple_OBJECTS = simple.$(OBJEXT) +simple_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@simple_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +strip_SOURCES = strip.c +strip_OBJECTS = strip.$(OBJEXT) +strip_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@strip_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +toggle_SOURCES = toggle.c +toggle_OBJECTS = toggle.$(OBJEXT) +toggle_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@toggle_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +viewport_SOURCES = viewport.c +viewport_OBJECTS = viewport.$(OBJEXT) +viewport_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@viewport_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +xawhisto_SOURCES = xawhisto.c +xawhisto_OBJECTS = xawhisto.$(OBJEXT) +xawhisto_LDADD = $(LDADD) +@ENABLE_UNIT_TESTS_TRUE@xawhisto_DEPENDENCIES = \ +@ENABLE_UNIT_TESTS_TRUE@ $(top_builddir)/src/libXaw7.la \ +@ENABLE_UNIT_TESTS_TRUE@ $(am__DEPENDENCIES_1) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = list.c menu.c pane.c repeater.c scrollbar.c simple.c strip.c \ + toggle.c viewport.c xawhisto.c +DIST_SOURCES = list.c menu.c pane.c repeater.c scrollbar.c simple.c \ + strip.c toggle.c viewport.c xawhisto.c +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = $(am__tty_colors_dummy) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHANGELOG_CMD = @CHANGELOG_CMD@ +CPPFLAGS = @CPPFLAGS@ +CWARNFLAGS = @CWARNFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FOP = @FOP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_CMD = @INSTALL_CMD@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEXT = @LIBEXT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MAN_SUBSTS = @MAN_SUBSTS@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ +STRIP = @STRIP@ +STYLESHEET_SRCDIR = @STYLESHEET_SRCDIR@ +VERSION = @VERSION@ +XAW6_CFLAGS = @XAW6_CFLAGS@ +XAW6_LIBS = @XAW6_LIBS@ +XAW7_CFLAGS = @XAW7_CFLAGS@ +XAW7_LIBS = @XAW7_LIBS@ +XMLTO = @XMLTO@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ +XORG_MAN_PAGE = @XORG_MAN_PAGE@ +XORG_SGML_PATH = @XORG_SGML_PATH@ +XSLTPROC = @XSLTPROC@ +XSL_STYLESHEET = @XSL_STYLESHEET@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@ENABLE_UNIT_TESTS_TRUE@TESTS = $(check_PROGRAMS) +@ENABLE_UNIT_TESTS_TRUE@AM_CFLAGS = $(CWARNFLAGS) $(XAW_CFLAGS) +@ENABLE_UNIT_TESTS_TRUE@AM_CPPFLAGS = \ +@ENABLE_UNIT_TESTS_TRUE@ -I$(top_srcdir)/include \ +@ENABLE_UNIT_TESTS_TRUE@ -I$(top_builddir)/include \ +@ENABLE_UNIT_TESTS_TRUE@ -I$(top_builddir)/include/X11 + +@ENABLE_UNIT_TESTS_TRUE@LDADD = $(top_builddir)/src/libXaw7.la $(XAW7_LIBS) +@ENABLE_UNIT_TESTS_TRUE@TESTS_ENVIRONMENT = $(MALLOC_DEBUG_ENV) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +list$(EXEEXT): $(list_OBJECTS) $(list_DEPENDENCIES) $(EXTRA_list_DEPENDENCIES) + @rm -f list$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(list_OBJECTS) $(list_LDADD) $(LIBS) +menu$(EXEEXT): $(menu_OBJECTS) $(menu_DEPENDENCIES) $(EXTRA_menu_DEPENDENCIES) + @rm -f menu$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(menu_OBJECTS) $(menu_LDADD) $(LIBS) +pane$(EXEEXT): $(pane_OBJECTS) $(pane_DEPENDENCIES) $(EXTRA_pane_DEPENDENCIES) + @rm -f pane$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(pane_OBJECTS) $(pane_LDADD) $(LIBS) +repeater$(EXEEXT): $(repeater_OBJECTS) $(repeater_DEPENDENCIES) $(EXTRA_repeater_DEPENDENCIES) + @rm -f repeater$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(repeater_OBJECTS) $(repeater_LDADD) $(LIBS) +scrollbar$(EXEEXT): $(scrollbar_OBJECTS) $(scrollbar_DEPENDENCIES) $(EXTRA_scrollbar_DEPENDENCIES) + @rm -f scrollbar$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(scrollbar_OBJECTS) $(scrollbar_LDADD) $(LIBS) +simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES) $(EXTRA_simple_DEPENDENCIES) + @rm -f simple$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(simple_OBJECTS) $(simple_LDADD) $(LIBS) +strip$(EXEEXT): $(strip_OBJECTS) $(strip_DEPENDENCIES) $(EXTRA_strip_DEPENDENCIES) + @rm -f strip$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(strip_OBJECTS) $(strip_LDADD) $(LIBS) +toggle$(EXEEXT): $(toggle_OBJECTS) $(toggle_DEPENDENCIES) $(EXTRA_toggle_DEPENDENCIES) + @rm -f toggle$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(toggle_OBJECTS) $(toggle_LDADD) $(LIBS) +viewport$(EXEEXT): $(viewport_OBJECTS) $(viewport_DEPENDENCIES) $(EXTRA_viewport_DEPENDENCIES) + @rm -f viewport$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(viewport_OBJECTS) $(viewport_LDADD) $(LIBS) +xawhisto$(EXEEXT): $(xawhisto_OBJECTS) $(xawhisto_DEPENDENCIES) $(EXTRA_xawhisto_DEPENDENCIES) + @rm -f xawhisto$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(xawhisto_OBJECTS) $(xawhisto_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pane.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/repeater.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scrollbar.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toggle.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/viewport.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xawhisto.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/lib/libXaw/examples/list.c b/lib/libXaw/examples/list.c new file mode 100644 index 000000000..06e71c890 --- /dev/null +++ b/lib/libXaw/examples/list.c @@ -0,0 +1,52 @@ +#include <stdlib.h> +#include <stdio.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/List.h> +#include <Xaw/Viewport.h> +#include <Xaw/Command.h> + +void quit_CB(Widget w, XtPointer closure, XtPointer call_data) +{ + Widget lst=closure; + XawListReturnStruct *ret; + + ret=XawListShowCurrent(lst); + + if (ret->string[0] != 0) + printf("selected:%s\n",ret->string); + + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +int main(int argc, char **argv) +{ + Widget toplevel,box,list,cmd,view; + XtAppContext app_con; + toplevel = XtAppInitialize(&app_con, "Hello", NULL, 0, + &argc, argv, NULL, + NULL, 0); + char *items[]={ "the ","quick","brown", "fox ", + "jumps","Over","the","lazy","dog", + NULL}; + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + cmd=XtCreateManagedWidget("exit", commandWidgetClass, box, NULL, 0); + + view=XtVaCreateManagedWidget("viewport", viewportWidgetClass, box, + XtNallowVert, 1, + XtNforceBars,1, + NULL); + + list= XtVaCreateManagedWidget("listbox", listWidgetClass,view, + XtNlist,items, + XtNdefaultColumns,1, + XtNnumberStrings,4, + XtNforceColumns,1, + NULL); + XawListChange(list,items,0,0,0); + XtAddCallback(cmd, XtNcallback, quit_CB , list); + XtRealizeWidget(toplevel); + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/menu.c b/lib/libXaw/examples/menu.c new file mode 100644 index 000000000..a9126bf9b --- /dev/null +++ b/lib/libXaw/examples/menu.c @@ -0,0 +1,62 @@ +#include <stdlib.h> +#include <stdio.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Command.h> +#include <Xaw/SimpleMenu.h> +#include <Xaw/MenuButton.h> +#include <Xaw/Sme.h> +#include <Xaw/SmeLine.h> +#include <Xaw/SmeBSB.h> + +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +void setupmenu(Widget top) +{ + Widget button, menu; + char buf[256]; + int i; + + button = XtVaCreateManagedWidget("menuButton", menuButtonWidgetClass, top, + NULL); + + menu = XtVaCreatePopupShell("menu", simpleMenuWidgetClass, + button, NULL); + + for (i = 1; i < 6; i++) { + sprintf(buf, "menuEntry%d", i ); + (void) XtVaCreateManagedWidget(buf, smeBSBObjectClass, menu, NULL); + if (i == 2) + (void) XtVaCreateManagedWidget("menuButton", smeLineObjectClass, + menu, NULL); + } + +} + +int main(int argc, char **argv) +{ + Widget toplevel,box,command; + XtAppContext app_con; + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, box, + XtNlabel, "EXIT", + NULL); + + XtAddCallback(command, XtNcallback, quit_cb, NULL); + + setupmenu(box); + + XtRealizeWidget(toplevel); + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/pane.c b/lib/libXaw/examples/pane.c new file mode 100644 index 000000000..4ec01defa --- /dev/null +++ b/lib/libXaw/examples/pane.c @@ -0,0 +1,84 @@ +#include <stdlib.h> +#include <stdio.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Label.h> +#include <Xaw/Paned.h> +#include <Xaw/Command.h> + +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +static void +getnumsub_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + Widget p=XtParent(w); + char buf[80]; + int min,max; + XawPanedGetMinMax(w,&min,&max); + + sprintf(buf,"%d number\n%d min %d max\n",XawPanedGetNumSub(p),min,max); + XtVaSetValues(w,XtNlabel,buf,NULL); + +} +static void +refigure_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + Widget p=XtParent(w); + XawPanedSetRefigureMode(p,False); +} + +int main(int argc, char **argv) +{ + Widget toplevel,pane,label,command; + XtAppContext app_con; + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + pane=XtVaCreateManagedWidget( "paned", panedWidgetClass, toplevel, + NULL); + + label = XtVaCreateManagedWidget("Label", + labelWidgetClass, + pane, XtNlabel, "quick", NULL); + + XawPanedAllowResize(label,False); + + label = XtVaCreateManagedWidget("Label", + labelWidgetClass, + pane, XtNlabel, "brown", NULL); + + label = XtVaCreateManagedWidget("Label", + labelWidgetClass, + pane, XtNlabel, "fox", NULL); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, pane, + XtNlabel, "stop resize", + NULL); + + XtAddCallback(command, XtNcallback,refigure_cb, NULL); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, pane, + XtNlabel, "getnumsub", + NULL); + + XtAddCallback(command, XtNcallback,getnumsub_cb, NULL); + XawPanedSetMinMax(command,50,100); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, pane, + XtNlabel, "EXIT", + NULL); + XtAddCallback(command, XtNcallback, quit_cb, NULL); + + XtRealizeWidget(toplevel); + + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/repeater.c b/lib/libXaw/examples/repeater.c new file mode 100644 index 000000000..f6b1f5922 --- /dev/null +++ b/lib/libXaw/examples/repeater.c @@ -0,0 +1,77 @@ +#include <stdlib.h> +#include <stdio.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Command.h> +#include <Xaw/Repeater.h> + +static int counter; + +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +static void +start_cb(Widget w, XtPointer ptr, XtPointer arg) +{ +#ifdef DEBUG + puts("Start"); +#endif +} + +static void +do_cb(Widget w, XtPointer ptr, XtPointer arg) +{ + char buf[10]; + Widget show= (Widget)ptr; + counter++; + snprintf(buf,10,"%d",counter); + XtVaSetValues(show,XtNlabel,buf,NULL); +#ifdef DEBUG + puts("counter"); +#endif +} + + +static void +stop_cb(Widget w, XtPointer ptr, XtPointer arg) +{ + counter=0; +#ifdef DEBUG + puts("reset counter"); +#endif +} + +int main(int argc, char **argv) +{ + Widget toplevel,box,command,rep; + XtAppContext app_con; + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, box, + XtNlabel, "EXIT", + NULL); + XtAddCallback(command, XtNcallback, quit_cb, NULL); + + rep=XtVaCreateManagedWidget("Repeater", + repeaterWidgetClass, + box, XtNlabel,"hitme",NULL); + + XtAddCallback(rep,XtNstartCallback,start_cb,command); + + XtAddCallback(rep,XtNcallback,do_cb,command); + + XtAddCallback(rep,XtNstopCallback,stop_cb,command); + + XtRealizeWidget(toplevel); + + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/scrollbar.c b/lib/libXaw/examples/scrollbar.c new file mode 100644 index 000000000..c0b3536a3 --- /dev/null +++ b/lib/libXaw/examples/scrollbar.c @@ -0,0 +1,72 @@ +#define _GNU_SOURCE +#include <stdlib.h> +#include <stdio.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Label.h> +#include <Xaw/Scrollbar.h> +#include <Xaw/Command.h> + +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +static void +scroll_cb(Widget widget,XtPointer label_ptr, XtPointer value_ptr) +{ + long value = (long)value_ptr; + Widget label = (Widget) label_ptr; + char *msg=NULL; + asprintf(&msg, "%ld", value); + XtVaSetValues( label, XtNlabel, msg, NULL); + free(msg); +} +static void +jump_cb(Widget widget,XtPointer label_ptr, XtPointer value_ptr) +{ + float value = *(float *)value_ptr; + Widget label = (Widget) label_ptr; + char *msg=NULL; + asprintf(&msg, "%lf", value); + XtVaSetValues( label, XtNlabel, msg, NULL); + free(msg); +} + +int main(int argc, char **argv) +{ + Widget toplevel,box,label,scroll,command; + XtAppContext app_con; + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + + label = XtVaCreateManagedWidget("Label", + labelWidgetClass, + box, XtNlabel, "hello", NULL); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, box, + XtNlabel, "EXIT", + NULL); + + XtAddCallback(command, XtNcallback, quit_cb, NULL); + + scroll = XtVaCreateManagedWidget("scroller", + scrollbarWidgetClass, box, + XtNorientation,XtorientHorizontal, + XtNlength,500, + XtNwidth,100, + NULL); + + XtAddCallback(scroll, XtNscrollProc, scroll_cb, label); + XtAddCallback(scroll,XtNjumpProc,jump_cb,label); + + XtRealizeWidget(toplevel); + + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/simple.c b/lib/libXaw/examples/simple.c new file mode 100644 index 000000000..a78bc900d --- /dev/null +++ b/lib/libXaw/examples/simple.c @@ -0,0 +1,79 @@ +#include <stdlib.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Simple.h> +#include <Xaw/Command.h> +#include <X11/Xmu/Drawing.h> + +/* + this is the draw function. it uses two pencils (GC) with + different colors. one pencil is used to draw the logo, + the other is used to fill the background. +*/ + +static void ac_set ( Widget w, XEvent *event, String *params, Cardinal *num_params ) +{ + GC gc1,gc2; + XGCValues values; + Dimension wi,hi; + + if (!XtIsRealized(w)) + return ; + + if (strcmp(XtName(w),"draw") != 0) + return ; + + XtVaGetValues(w,XtNheight,&hi,XtNwidth,&wi,NULL); + values.foreground = 0xcf00fe; //purple + gc1 = XtGetGC(w, GCForeground, &values); + values.foreground = 0x00ff00; //green + gc2 = XtGetGC(w, GCForeground, &values); + XmuDrawLogo(XtDisplay(w), XtWindow(w), gc1, gc2, 0,0, wi, hi ); + XtReleaseGC(w,gc1); + XtReleaseGC(w,gc2); +} + + +static void +quit_cb(Widget w, XtPointer data, XtPointer call_data) +{ + XtAppSetExitFlag( XtWidgetToApplicationContext(w) ); +}; + +int main(int argc, char **argv) +{ + Widget toplevel,box,command,simple; + XtAppContext app; + static char translation[] = + "<Expose>:set()\n"; + static XtActionsRec actionTable[] = { + {"set",ac_set } + }; + + toplevel = XtAppInitialize(&app, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + XtAppAddActions(app, actionTable, XtNumber(actionTable) ); + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, box, + XtNlabel, "EXIT", + NULL); + + simple=XtVaCreateManagedWidget("draw", + simpleWidgetClass, box, + XtNheight,250, + XtNwidth,250, + XtNbackground, 0xff0000, + XtNtranslations,XtParseTranslationTable(translation), + NULL); + + XtAddCallback(command, XtNcallback, quit_cb, simple ); + + XtRealizeWidget(toplevel); + XtAppMainLoop(app); + exit(0); +} diff --git a/lib/libXaw/examples/strip.c b/lib/libXaw/examples/strip.c new file mode 100644 index 000000000..1cf5efe72 --- /dev/null +++ b/lib/libXaw/examples/strip.c @@ -0,0 +1,51 @@ +#include <stdio.h> +#include <stdlib.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Command.h> +#include <Xaw/StripChart.h> + +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +static void +getvalue_cb(Widget widget,XtPointer label_ptr, XtPointer value_ptr) +{ + static double dbl=0,delta=0.1; + double *ret = (double *)value_ptr; + + dbl=dbl+delta; + if (dbl >= 1.0 || dbl <= 0 ) { delta = delta*-1.0 ; } + *ret=dbl; +} + +int main(int argc, char **argv) +{ + Widget toplevel,box,chart,command; + XtAppContext app_con; + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, box, + XtNlabel, "EXIT", + NULL); + + chart = XtVaCreateManagedWidget("chart", + stripChartWidgetClass, box, + XtNupdate, 1, + NULL); + + XtAddCallback(chart,XtNgetValue,getvalue_cb,NULL); + XtAddCallback(command, XtNcallback, quit_cb, NULL); + + XtRealizeWidget(toplevel); + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/toggle.c b/lib/libXaw/examples/toggle.c new file mode 100644 index 000000000..2d7e88b8f --- /dev/null +++ b/lib/libXaw/examples/toggle.c @@ -0,0 +1,103 @@ +#include <stdio.h> +#include <stdlib.h> +#include <X11/StringDefs.h> +#include <Xaw/Box.h> +#include <Xaw/Command.h> +#include <Xaw/Toggle.h> + +static Widget toggle[3]; +static Widget radio_group; + +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +static void +getdata_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + char *radio_data=XawToggleGetCurrent(radio_group); + if (radio_data) + printf("radio_data=%s\n",radio_data); + else + printf("radio_data=%s\n","nodata"); +} + +static void +unset_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XawToggleUnsetCurrent(radio_group); +} + + +static void +reset_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XawToggleSetCurrent(radio_group,"3397"); +} + + +int main(int argc, char **argv) +{ + Widget toplevel,box,command; + XtAppContext app_con; + + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + box = XtCreateManagedWidget("box", boxWidgetClass, toplevel, NULL, 0); + + command = XtVaCreateManagedWidget("cmd", + commandWidgetClass, box, + XtNlabel, "EXIT", + NULL); + + toggle[0]=XtVaCreateManagedWidget("toggle", + toggleWidgetClass, box, +// XtNradioData,radioname, + XtNradioGroup,radio_group, + XtNlabel, "track", + NULL); + radio_group=toggle[0]; + toggle[1]=XtVaCreateManagedWidget("toggle", + toggleWidgetClass, box, +// XtNradioData,radioname, + XtNradioGroup,radio_group, + XtNlabel, "trick", + NULL); + + toggle[2]=XtVaCreateManagedWidget("toggle", + toggleWidgetClass, box, + XtNradioData,"3397", + XtNradioGroup,radio_group, + XtNlabel, "tick", + NULL); + + XtAddCallback(command, XtNcallback, quit_cb, NULL); + + command = XtVaCreateManagedWidget("getcurrent", + commandWidgetClass, box, + XtNlabel, "say ", + NULL); + XtAddCallback(command, XtNcallback, getdata_cb, NULL); + + command = XtVaCreateManagedWidget("unsetcurrent", + commandWidgetClass, box, + XtNlabel, "unset ", + NULL); + XtAddCallback(command, XtNcallback, unset_cb, NULL); + + + command = XtVaCreateManagedWidget("setnew", + commandWidgetClass, box, + XtNlabel, "setnew", + NULL); + + XtAddCallback(command, XtNcallback, reset_cb, NULL); + + XtRealizeWidget(toplevel); + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/viewport.c b/lib/libXaw/examples/viewport.c new file mode 100644 index 000000000..890e9f9e7 --- /dev/null +++ b/lib/libXaw/examples/viewport.c @@ -0,0 +1,45 @@ +#include <stdlib.h> +#include <stdio.h> +#include <X11/StringDefs.h> +#include <Xaw/Viewport.h> +#include <Xaw/Command.h> +#include <Xaw/Box.h> +static void +quit_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +int main(int argc, char **argv) +{ + Widget toplevel,viewport,box,cmd; + XtAppContext app_con; + int i; + char buf[80]; + toplevel = XtAppInitialize(&app_con, "demo", NULL, 0, + &argc, argv, NULL, + NULL, 0); + + viewport = XtVaCreateManagedWidget("view", viewportWidgetClass, toplevel, + XtNforceBars,True, + XtNallowVert,True, + NULL); + + box = XtVaCreateManagedWidget("box", boxWidgetClass, viewport, + XtNvSpace,10, + NULL); + + for (i=0;i<10;i++){ + sprintf(buf,"label%02d",i); + cmd=XtVaCreateManagedWidget("cmd", + commandWidgetClass, + box, XtNlabel, buf, NULL); + XtAddCallback(cmd, XtNcallback, quit_cb, NULL); + } + + XtRealizeWidget(toplevel); + + + XtAppMainLoop(app_con); + exit(0); +} diff --git a/lib/libXaw/examples/xawhisto.c b/lib/libXaw/examples/xawhisto.c new file mode 100644 index 000000000..542bbf023 --- /dev/null +++ b/lib/libXaw/examples/xawhisto.c @@ -0,0 +1,81 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Command.h> +#include <X11/Xaw/Scrollbar.h> + + +static XtAppContext app_context; +static Widget scrollbar; +static Widget command; +static XtIntervalId timerId; + +static void update(XtPointer client_data, XtIntervalId * id) +{ + char buf[28]; + static int i = 1; + + sprintf(buf, "% 2d%%", i); + XtVaSetValues(command, XtNlabel, buf, NULL); + XawScrollbarSetThumb(scrollbar, 0.0, (i / 100.0)); + i ++; + i %= 100; + timerId = XtAppAddTimeOut(app_context, 500 , update, app_context); +} + +static void cmd_cb(Widget w, XtPointer client_data, XtPointer call_data) +{ + XtAppSetExitFlag(XtWidgetToApplicationContext(w)); +} + +int main(int argc, char **argv) +{ + + Widget form; + Widget topLevel; + + topLevel = XtVaAppInitialize(&app_context, "demo", + NULL, 0, + &argc, argv, NULL, NULL); + + form = XtVaCreateManagedWidget("form", + formWidgetClass, topLevel, + XtNorientation, XtorientHorizontal, + XtNborderWidth, 0, + XtNdefaultDistance, 2, + NULL); + + command = XtVaCreateManagedWidget("command", + commandWidgetClass, form, + XtNleft, XtChainLeft, + XtNhighlightThickness, 0, + XtNborderWidth, 2, + XtNlabel, "start", + XtNresize, FALSE, + NULL); + + scrollbar = XtVaCreateManagedWidget("scrollbar", + scrollbarWidgetClass, form, + XtNhorizDistance, 3, + XtNfromHoriz, command, + XtNorientation, XtorientHorizontal, + NULL); + + XawScrollbarSetThumb(scrollbar, 0.0, 0.0); + + /* + * disable interaction from scrollbar + */ + XtVaSetValues(scrollbar, + XtNtranslations, XtParseTranslationTable(""), NULL); + + XtAddCallback(command, XtNcallback, cmd_cb, NULL); + + XtRealizeWidget(topLevel); + timerId = XtAppAddTimeOut(app_context, 0, update, app_context); + XtAppMainLoop(app_context); + return 0; +} diff --git a/lib/libXaw/include/Makefile.in b/lib/libXaw/include/Makefile.in index 631b73f51..4c2412fbf 100644 --- a/lib/libXaw/include/Makefile.in +++ b/lib/libXaw/include/Makefile.in @@ -203,6 +203,7 @@ XAW6_LIBS = @XAW6_LIBS@ XAW7_CFLAGS = @XAW7_CFLAGS@ XAW7_LIBS = @XAW7_LIBS@ XMLTO = @XMLTO@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_SGML_PATH = @XORG_SGML_PATH@ XSLTPROC = @XSLTPROC@ diff --git a/lib/libXaw/include/X11/Xaw/List.h b/lib/libXaw/include/X11/Xaw/List.h index 48a64824c..59de9800a 100644 --- a/lib/libXaw/include/X11/Xaw/List.h +++ b/lib/libXaw/include/X11/Xaw/List.h @@ -167,7 +167,7 @@ _XFUNCPROTOBEGIN void XawListChange ( Widget w, - _Xconst char **list, + String *list, int nitems, int longest, #if NeedWidePrototypes diff --git a/lib/libXaw/m4/libtool.m4 b/lib/libXaw/m4/libtool.m4 index 79a2451ef..e7b683345 100644 --- a/lib/libXaw/m4/libtool.m4 +++ b/lib/libXaw/m4/libtool.m4 @@ -730,7 +730,6 @@ _LT_CONFIG_SAVE_COMMANDS([ cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. @@ -2907,6 +2906,18 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) dynamic_linker='GNU/Linux ld.so' ;; +netbsdelf*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='NetBSD ld.elf_so' + ;; + netbsd*) version_type=sunos need_lib_prefix=no @@ -3566,7 +3577,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; -netbsd*) +netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else @@ -4072,7 +4083,8 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD + if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -4444,7 +4456,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise @@ -4712,6 +4724,12 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; + # flang / f18. f95 an alias for gfortran or flang on Debian + flang* | f18* | f95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -4956,6 +4974,9 @@ m4_if([$1], [CXX], [ ;; esac ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; @@ -5018,6 +5039,9 @@ dnl Note also adjust exclude_expsyms for C++ above. openbsd* | bitrig*) with_gnu_ld=no ;; + linux* | k*bsd*-gnu | gnu*) + _LT_TAGVAR(link_all_deplibs, $1)=no + ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes @@ -5253,6 +5277,7 @@ _LT_EOF case $cc_basename in tcc*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) @@ -5273,7 +5298,7 @@ _LT_EOF fi ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= @@ -5794,6 +5819,7 @@ _LT_EOF if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi + _LT_TAGVAR(link_all_deplibs, $1)=no else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' @@ -5811,11 +5837,12 @@ _LT_EOF # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; esac ;; - netbsd*) + netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else @@ -6442,7 +6469,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else GXX=no @@ -6818,7 +6845,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -6883,7 +6910,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -7222,7 +7249,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # FIXME: insert proper C++ library support @@ -7306,7 +7333,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -7317,7 +7344,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' diff --git a/lib/libXaw/man/Makefile.in b/lib/libXaw/man/Makefile.in index e5b28d53b..5cc00e59a 100644 --- a/lib/libXaw/man/Makefile.in +++ b/lib/libXaw/man/Makefile.in @@ -225,6 +225,7 @@ XAW6_LIBS = @XAW6_LIBS@ XAW7_CFLAGS = @XAW7_CFLAGS@ XAW7_LIBS = @XAW7_LIBS@ XMLTO = @XMLTO@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_SGML_PATH = @XORG_SGML_PATH@ XSLTPROC = @XSLTPROC@ diff --git a/lib/libXaw/man/Xaw.man b/lib/libXaw/man/Xaw.man index dc6537858..b93810731 100644 --- a/lib/libXaw/man/Xaw.man +++ b/lib/libXaw/man/Xaw.man @@ -26,29 +26,24 @@ .\" .\" Author: Paulo César Pereira de Andrade .\" -.de EX -.sp -.nf -.ft CW -.. -.de EE -.ft R -.fi -.sp -.. +.TH Xaw __libmansuffix__ __vendorversion__ .de TQ -.\".br .ns -.TP \\$1 +.TP +.. +.de bP +.ie n .IP \(bu 4 +.el .IP \(bu 2 .. -.TH Xaw __libmansuffix__ __vendorversion__ .SH NAME - Xaw \- X Athena Widgets +Xaw \- +X Athena Widgets .SH DESCRIPTION .B Xaw -is a widget set based on the X Toolkit Intrinsics (Xt) Library. This -release by the X.Org Foundation includes additions and modifications -originally made for The XFree86 Project, Inc. This manual page describes +is a widget set based on the X Toolkit Intrinsics (Xt) Library. +This release by the X.Org Foundation includes additions and modifications +originally made for The XFree86 Project, Inc. +This manual page describes these changes as well as some of the common interfaces between its version and the previous X Consortium release (Xaw6). .PP @@ -57,425 +52,549 @@ which may be installed in __docdir__, or found on the X.Org website. .SH ACTIONS All of the \fIXaw\fR widgets now have the additional translations .B call-proc, declare, get-values -and \fBset-values\fP. The syntax for these actions is: +and \fBset-values\fP. +The syntax for these actions is: .PP .I action-name \fP(\fIboolean-expression\fP, \fIarguments\fP) .PP -\fBAction-name\fP is one of \fIcall-proc\fP, \fIdeclare\fP, -\fIget-values\fP or \fIset-values\fP. +\fIaction-name\fP is one of \fBcall-proc\fP, \fBdeclare\fP, +\fBget-values\fP or \fBset-values\fP. .PP -\fBBoolean-expression\fP is composed with the operators \fI|\fR (or), \fI&\fR -(and), \fI^\fR (xor), and \fI~\fR (not). The operands can be a variable name, -which starts with a \fI$\fR; a resource name without the bindings \fI.\fP -or \fI*\fP; or a constant name, including \fImine\fP (event->xany.window -== XtWindow(widget)), \fIfaked\fP (event->xany.send_event != 0), \fItrue\fP (1) -and \fIfalse\fP (0). +\fIboolean-expression\fP is composed with the operators +.RS +.TP +\fB|\fR (or), +.TP +\fB&\fR (and), +.TP +\fB^\fR (xor), and +.TP +\fB~\fR (not). +.RE +.IP +Its operands can be +.RS +.bP +a variable name, which starts with a \fI$\fR, +.bP +a resource name without the bindings \fI.\fP or \fI*\fP, or +.bP +a constant name, including +.RS +.bP +\fImine\fP (event->xany.window == XtWindow(widget)), +.bP +\fIfaked\fP (event->xany.send_event != 0), +.bP +\fItrue\fP (1) and +.bP +\fIfalse\fP (0). +.RE +.RE .PP -\fBArguments\fP are self-explanatory; when starting with a \fI$\fP they name -a variable, otherwise, they indicate a resource name. +\fIarguments\fP are self-explanatory: +.RS +.bP +when starting with a \fI$\fP they name a variable, +.bP +otherwise they indicate a resource name. +.RE .TP 8 .B call-proc \fP(\fIboolean-expression\fP, \fIprocedure-name\fP) This action allows the evaluation of a boolean expression in the first -parameter before calling a action procedure. The procedure is only called -if the expression evaluates as true. Example: +parameter before calling a action procedure. +The procedure is only called if the expression evaluates as true. +Example: .EX -call-proc("$inside & $pressed", notify) +\fBcall-proc\fP("$inside & $pressed", notify) .EE .TP 8 .B declare \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...) -This action is used to create new variables or change their values. Any -number of variable-value tuples may be specified. Example: +This action is used to create new variables or change their values. +Any number of variable-value tuples may be specified. +Example: .EX -declare(1, $pressed, 1) +\fBdeclare\fP(1, $pressed, 1) .EE .TP 8 .B get-values \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...) -This action reads a widget resource value into a variable. Any number of -variable-value tuples may be specified. Example: +This action reads a widget resource value into a variable. +Any number of variable-value tuples may be specified. +Example: .EX -get-values(1, $fg, foreground, $bg, background) +\fBget-values\fP(1, $fg, foreground, $bg, background) .EE .TP 8 .B set-values \fP(\fIboolean-expression\fP, \fIvariable\fP, \fIvalue\fP, ...) This action sets a widget resource to the given value, which may be a -variable. Any number of variable-value tuples may be specified. Example: +variable. +Any number of variable-value tuples may be specified. +Example: .EX -set-values(1, foreground, $bg, background, $fg) +\fBset-values\fP(1, foreground, $bg, background, $fg) .EE +.ne 5 .PP Here is a sample translation to make a label widget behave like a button: .PP -.nf +.EX <Map>: get-values(1, $fg, foreground, $bg, background)\en\e <Btn1Down>: set-values(1, foreground, yellow, background, gray30)\en\e <Btn1Up>: set-values(1, foreground, $fg, background, $bg) -.fi +.EE .SH DISPLAY LISTS All of the \fBXaw\fP widgets have now the additional resource -\fIdisplayList\fP. This resource allows drawing the widget decorations -using commands embedded in a resource string. The displayList resource has -the syntax: +\fIdisplayList\fP. +This resource allows drawing the widget decorations +using commands embedded in a resource string. +The displayList resource has the syntax: .PP \fI[class-name:]function-name arguments[[{;\en}]...]\fP .PP -\fBClass-name\fP is any registered set of functions to draw in the widget. -Currently the only existing class is \fIxlib\fP, which provides access to +\fIclass-name\fP is any registered set of functions to draw in the widget. +Currently the only existing class is \fBxlib\fP, which provides access to the Xlib drawing primitives. .PP -\fBFunction-name\fP is the drawing or configuration function to be called, +\fIfunction-name\fP is the drawing or configuration function to be called, described below. .PP -\fBArguments\fP may be anything suitable to the displayList function being -called. When the function requires a coordinate, the syntax is -\fI{+-}<integer>\fP or \fI<integer>/<integer>\fP. Examples: -.nf - +0,+0 top, left - -0,-0 bottom, right - -+10,-+10 bottom+10, right+10 - +0,1/2 left, vertical-center -.fi -.TP 8 -.B arc-mode \fPmode -Sets the arc mode. Accepted \fImode\fPs are "pieslice" and "chord", which -set the arc to ArcPieSlice or ArcChord, respectively. Example: +\fIarguments\fP may be anything suitable to the displayList function being +called. +When the function requires a coordinate, the syntax is +.IP +.EX +\fI{+-}<integer>\fP or +\fI<integer>/<integer>\fP. +.EE +.ne 6 +.IP +Examples: +.RS +.EX ++0,+0 top, left +-0,-0 bottom, right +-+10,-+10 bottom+10, right+10 ++0,1/2 left, vertical-center +.EE +.RE +.TP 8 +.B arc-mode \fImode +Sets the arc mode. +Accepted \fImode\fPs are "pieslice" and "chord", which +set the arc to ArcPieSlice or ArcChord, respectively. +Example: .EX -arc-mode chord +\fBarc-mode\fP chord .EE .TP 8 -.B bg \fPcolor-spec +.B bg \fIcolor-spec .TQ -.B background \fPcolor-spec -Sets the background color. \fIcolor-spec\fP must a valid color -specification. Example: +.B background \fIcolor-spec +Sets the background color. +\fIcolor-spec\fP must a valid color +specification. +Example: .EX -background red +\fBbackground\fP red .EE .TP 8 -.B cap-style \fPstyle -Sets the cap style. Accepted \fIstyle\fPs are "notlast", "butt", "round", +.B cap-style \fIstyle +Sets the cap style. +Accepted \fIstyle\fPs are "notlast", "butt", "round", and "projecting", which set the cap style to CapNotLast, CapBut, CapRound -or CapProjecting, respectively. Example: +or CapProjecting, respectively. +Example: .EX -cap-style round +\fBcap-style\fP round .EE .TP 8 -.B clip-mask \fPpixmap-spec -Sets the pixmap for the clip mask. Requires a pixmap parameter, as -described in the \fBPIXMAPS\fP section below. Example: +.B clip-mask \fIpixmap-spec +Sets the pixmap for the clip mask. +Requires a pixmap parameter, as described in the \fBPIXMAPS\fP section below. +Example: .EX -clip-mask xlogo11 +\fBclip-mask\fP xlogo11 .EE .TP 8 -.B clip-origin \fPx,y -Sets the clip x and y origin. Requires two arguments, the x and y -coordinates. Example: +.B clip-origin \fIx,y +Sets the clip x and y origin. +Requires two arguments, the x and y coordinates. +Example: .EX -clip-origin 10,10 +\fBclip-origin\fP 10,10 .EE .TP 8 .B clip-rects \fPx1,y1,x2,y2 [...,xn,yn] .TQ .B clip-rectangles \fPx1,y1,x2,y2 [...,xn,yn] -Sets a list of rectangles to the clip mask. The number of arguments must -be a multiple of four. The arguments are coordinates. The parser -calculates the width and height of the rectangles. Example: +Sets a list of rectangles to the clip mask. +The number of arguments must be a multiple of four. +The arguments are coordinates. +The parser calculates the width and height of the rectangles. +Example: .EX -clip-rects 0,0,10,20, 20,10,30,30 +\fBclip-rects\fP 0,0,10,20, 20,10,30,30 .EE .TP 8 .B coord-mode \fPmode -Changes the coord mode for \fIfill-polygon\fP, \fIdraw-lines\fP, and -\fIdraw-points\fP. Accepted parameters are "modeorigin" and "previous", -that sets the coord mode to CoordModeOrigin or CoordModePrevious, -respectively. Example: +Changes the coordinate mode for \fIfill-polygon\fP, \fIdraw-lines\fP, and +\fIdraw-points\fP. +Accepted parameters are "modeorigin" and "previous", +that sets the coord mode to CoordModeOrigin or CoordModePrevious, respectively. +Example: .EX -coord-mode previous +\fBcoord-mode\fP previous .EE .TP 8 .B copy-area \fP{pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy] -Calls XCopyArea. The character \fI.\fP means copy the window contents; -pixmap-spec is as defined in the \fBPIXMAPS\fP section below. \fIX2\fP and -\fIy2\fP are the coordinates of the end copy, not the width and height; if -not defined, the parser calculates them. \fIsrc_x\fP and \fIsrc_y\fP -default to zero. Example: +Calls XCopyArea. +The character \fI.\fP means copy the window contents; +pixmap-spec is as defined in the \fBPIXMAPS\fP section below. +\fIX2\fP and +\fIy2\fP are the coordinates of the end copy, not the width and height; +if not defined, the parser calculates them. +\fIsrc_x\fP and \fIsrc_y\fP default to zero. +Example: .EX -copy-area Term,10,10 +\fBcopy-area\fP Term,10,10 .EE .TP 8 .B copy-plane \fP{pixmap-spec|.},dstx,dsty[,x2,y2,srcx,srcy,plane] -Calls XCopyPlane. The character \fI.\fP means copy the window contents; -pixmap-spec is as defined in the \fBPIXMAPS\fP section below. \fIX2\fP and -\fIy2\fP are the coordinates of the end copy, not the width and height; if -not defined, the parser calculates them. \fIsrc_x\fP and \fIsrc_y\fP -default to zero. \fIPlane\fP defaults to one. Example: +Calls XCopyPlane. +The character \fI.\fP means copy the window contents; +pixmap-spec is as defined in the \fBPIXMAPS\fP section below. +\fIX2\fP and +\fIy2\fP are the coordinates of the end copy, not the width and height; +if not defined, the parser calculates them. +\fIsrc_x\fP and \fIsrc_y\fP default to zero. +\fIPlane\fP defaults to one. +Example: .EX -copy-plane star,10,10 +\fBcopy-plane\fP star,10,10 .EE .TP 8 .B dashes \fPi1[...,in] -Sets the dashes for line drawing. Accepts up to 127 arguments. Example: +Sets the dashes for line drawing. +Accepts up to 127 arguments. +Example: .EX -dashes 3,7 9,10 +\fBdashes\fP 3,7 9,10 .EE .TP 8 .B draw-arc \fPx1,y1,x2,y2[,start-angle,end-angle] -Draws an arc. The four first arguments are the rectangle enclosing the -arc. The two remaining arguments, if specified, are the start and end -angle, in degrees. Example: +Draws an arc. +The four first arguments are the rectangle enclosing the arc. +The two remaining arguments, if specified, +are the start and end angle, in degrees. +Example: .EX -draw-arc +0,+0,-1,-1,0,90 +\fBdraw-arc\fP +0,+0,-1,-1,0,90 .EE .TP 8 .B draw-rect \fPx1,y1,x2,y2 .TQ .B draw-rectangle \fPx1,y1,x2,y2 -Draws a rectangle. Requires four arguments, which are the start and end -coordinate pairs. Example: +Draws a rectangle. +Requires four arguments, which are the start and end coordinate pairs. +Example: .EX -draw-rect +1,+1,-5,-5 +\fBdraw-rect\fP +1,+1,-5,-5 .EE .TP 8 .B draw-string \fPx,y,"string" -Draws a text string. Requires three arguments, a x coordinate, a y -coordinate, and a string. Strings that have white space can be quoted with +Draws a text string. +Requires three arguments, a x coordinate, a y coordinate, and a string. +Strings that have white space can be quoted with the \fI"\fP character; the backslash character \fI\e\fP can also be used, -but it will be necessary escape it twice. Example: +but it will be necessary escape it twice. +Example: .EX - draw-string 10,10, "Hello world!"\fP +\fBdraw-string\fP 10,10, "Hello world!"\fP .EE .TP 8 .B exposures \fPboolean -Sets graphics exposures in the GC. Allowed parameters are a integer or the -strings "true", "false", "on" and "off". Example: +Sets graphics exposures in the GC. +Allowed parameters are a integer +or the strings "true", "false", "on" and "off". +Example: .EX -exposures true +\fBexposures\fP true .EE .TP 8 .B fill-arc \fPx1,y1,x2,y2[,start-angle,end-angle] Like \fIdraw-arc\fP, but fills the contents of the arc with the currently -selected foreground. Example: +selected foreground. +Example: .EX -fill-arc +0,+0,-1,-1,0,180 +\fBfill-arc\fP +0,+0,-1,-1,0,180 .EE .TP 8 .B fill-poly \fPx1,y1 [...,xn,yn] .TQ .B fill-polygon \fPx1,y1 [...,xn,yn] Like \fIdraw-lines\fP, but fills the enclosed polygon and joins the first -and last point, if they are not at the same position. Example: +and last point, if they are not at the same position. +Example: .EX -fill-poly +0,+10, +10,+20, +30,+0 +\fBfill-poly\fP +0,+10, +10,+20, +30,+0 .EE .TP .B fill-rect \fPx1,y1,x2,y2 .TQ .B fill-rectangle \fPx1,y1,x2,y2 Like \fIdraw-rect\fP, but fills the contents of the rectangle with the -selected foreground color. Example: +selected foreground color. +Example: .EX -fill-rect +10,+10,-20,-20 +\fBfill-rect\fP +10,+10,-20,-20 .EE .TP 8 .B fill-rule \fPrule -Sets the fill rule. Accepted parameters are "evenodd" and "winding", which -set the fill rule to EvenOddRule or WindingRule, respectively. Example: +Sets the fill rule. +Accepted parameters are "evenodd" and "winding", which +set the fill rule to EvenOddRule or WindingRule, respectively. +Example: .EX -fill-rule winding +\fBfill-rule\fP winding .EE .TP 8 .B fill-style \fPstyle -Sets the fill style. Allowed parameters are "solid", "tiled", "stippled" and +Sets the fill style. +Allowed parameters are "solid", "tiled", "stippled" and "opaquestippled", which set the fill style to FillSolid, FillTiled, -FillStippled or FillOpaqueStippled, respectively. Example: +FillStippled or FillOpaqueStippled, respectively. +Example: .EX -fill-style tiled +\fBfill-style\fP tiled .EE .TP 8 .B font \fPfont-spec -Sets the font for text functions. Example: +Sets the font for text functions. +Example: .EX -font -*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1 +\fBfont\fP -*-*-*-R-*-*-*-120-*-*-*-*-ISO8859-1 .EE .TP 8 .B fg \fPcolor-spec .TQ .B foreground \fPcolor-spec -Like \fIbackground\fP, but sets the current foreground color. Example: +Like \fIbackground\fP, but sets the current foreground color. +Example: .EX -foreground blue +\fBforeground\fP blue .EE .TP 8 .B mask This command is useful when you want to draw only in the region that really -needs to be repainted. Requires no arguments. +needs to be repainted. +It requires no arguments. .TP 8 .B function \fPfunction-spec -Sets the specific GC function. Allowed parameters are "set", "clear", "and", +Sets the specific GC function. +Allowed parameters are "set", "clear", "and", "andreverse", "copy", "andinverted", "noop", "xor", "or", "nor", "equiv", "invert", "orreverse", "copyinverted" and "nand", which set the function to GXset, GXclear, GXand, GXandReverse, GXcopy, GXandInverted, GXnoop, GXxor, GXor, GXnor, GXequiv, GXinvert, GXorReverse, GXcopyInverted or GXnand, -respectively. Example: +respectively. +Example: .EX -function xor +\fBfunction\fP xor .EE .TP 8 .B join-style \fPstyle -Sets the join style. Allowed parameters are "miter", "round" and "bevel", +Sets the join style. +Allowed parameters are "miter", "round" and "bevel", which set the join style to JoinMiter, JoinRound and JoinBevel, -respectively. Example: +respectively. +Example: .EX -join-style round +\fBjoin-style\fP round .EE .TP 8 .B image \fP{pixmap-spec},xs,ys,[xe,ye] This function is implemented as a way to quickly compose complex -decorations in widgets. \fIPixmap-spec\fP is as defined in the -\fBPIXMAPS\fP section below. \fIxs\fP and \fIys\fP are the coordinates from -where to start copying the pixmap; \fIxe\fP and \fIye\fP are optional (they -default to xs + pixmap.width and ys + pixmap.height, respectively). If the -pixmap has a mask, the copy is masked accordingly. Example: +decorations in widgets. +\fIPixmap-spec\fP is as defined in the +\fBPIXMAPS\fP section below. +\fIxs\fP and \fIys\fP are the coordinates from +where to start copying the pixmap; \fIxe\fP and \fIye\fP are optional +(they default to xs + pixmap.width and ys + pixmap.height, respectively). +If the pixmap has a mask, the copy is masked accordingly. +Example: .EX -image pixmap.xpm,0,0,20,20 +\fBimage\fP pixmap.xpm,0,0,20,20 .EE .TP 8 .B line \fPx1,y1,x2,y2 .TQ .B draw-line \fPx1,y1,x2,y2 -Draws a line with the current foreground color. Requires four arguments, -the starting and ending coordinate pairs. Example: +Draws a line with the current foreground color. +Requires four arguments, the starting and ending coordinate pairs. +Example: .EX -line +0,+0, -1,-1 +\fBline\fP +0,+0, -1,-1 .EE .TP 8 .B line-width \fPinteger -Selects a line width for drawing. Example: +Selects a line width for drawing. +Example: .EX -line-width 2 +\fBline-width\fP 2 .EE .TP 8 .B line-style \fPstyle -Sets the line style. Accepted parameters are "solid", "onoffdash" and +Sets the line style. +Accepted parameters are "solid", "onoffdash" and "doubledash", which set the line style to LineSolid, LineOnOffDash or -LineDoubleDash, respectively. Example: +LineDoubleDash, respectively. +Example: .EX -line-style onoffdash +\fBline-style\fP onoffdash .EE .TP 8 .B lines \fPx1,y1,x2,y2 [...,xn,yn] .TQ .B draw-lines \fPx1,y1,x2,y2 [...,xn,yn] -Draws a list of lines. Any number of argument pairs may be supplied. +Draws a list of lines. +Any number of argument pairs may be supplied. Example: .EX -lines +0,-1, -1,-1, -1,+0 +\fBlines\fP +0,-1, -1,-1, -1,+0 .EE .TP 8 .B paint-string \fPx,y,"string" -Identical to draw-string, but also uses the background color. Example: +Identical to draw-string, but also uses the background color. +Example: .EX - paint-string 10,20, "Sample text"\fP +\fBpaint-string\fP 10,20, "Sample text"\fP .EE .TP 8 .B point \fPx,y .TQ .B draw-point \fPx,y -Draws a point. Requires two arguments, a coordinate pair. Example: +Draws a point. +Requires two arguments, a coordinate pair. +Example: .EX -point +10,+10 +\fBpoint\fP +10,+10 .EE .TP 8 .B plane-mask \fPinteger -Sets the plane mask. Requires an integer parameter. Example: +Sets the plane mask. +Requires an integer parameter. +Example: .EX -plane-mask -1 +\fBplane-mask\fP -1 .EE .TP 8 .B points \fPx1,y1 [...,xn,yn] .TQ .B draw-points \fPx1,y1 [...,xn,yn] -Draws a list of points at the specified coordinates. Example: +Draws a list of points at the specified coordinates. +Example: .EX -points +1,+2, +1,+4, +1,+6 +\fBpoints\fP +1,+2, +1,+4, +1,+6 .EE .TP 8 .B segments \fPx1,y1,x2,y2 [...,xn,yn] .TQ .B draw-segments \fPx1,y1,x2,y2 [...,xn,yn] -Draws a list of segment lines. The number of parameters must be multiple -of 4. Example: +Draws a list of segment lines. +The number of parameters must be multiple of 4. +Example: .EX -segments +1,+2,+1,-3, +2,-2,-3,-2 +\fBsegments\fP +1,+2,+1,-3, +2,-2,-3,-2 .EE .TP 8 .B shape-mode \fPmode -Sets the shape mode used in \fIfill-polygon\fP. Accepted parameters are +Sets the shape mode used in \fIfill-polygon\fP. +Accepted parameters are "complex", "convex" or "nonconvex", which set the shape mode to Complex, -Convex or Nonconvex, accordingly. Example: +Convex or Nonconvex, accordingly. +Example: .EX -shape-mode convex +\fBshape-mode\fP convex .EE .TP 8 .B stipple \fPpixmap-spec -Sets the pixmap for a stipple. Requires a pixmap parameter, as described -in the \fBPIXMAPS\fP section below. Example: +Sets the pixmap for a stipple. +Requires a pixmap parameter, as described in the \fBPIXMAPS\fP section below. +Example: .EX -stipple plaid +\fBstipple\fP plaid .EE .TP 8 .B subwindow-mode \fPmode -Sets the subwindow mode in the GC. Accepted parameters are -"includeinferiors" and "clipbychildren", which set the subwindow mode to -IncludeInferiors or ClipByChildren, respectively. Example: +Sets the subwindow mode in the GC. +Accepted parameters are +"includeinferiors" and "clipbychildren", +which set the subwindow mode to +IncludeInferiors or ClipByChildren, respectively. +Example: .EX -subwindow-mode includeinferiors +\fBsubwindow-mode\fP includeinferiors .EE .TP 8 .B tile \fPpixmap-spec -Sets the pixmap for a tile. Requires a pixmap parameter, as described -in the \fBPIXMAPS\fP section below. Example: +Sets the pixmap for a tile. +Requires a pixmap parameter, as described +in the \fBPIXMAPS\fP section below. +Example: .EX -tile xlogo11?foreground=red&background=gray80 +\fBtile\fP xlogo11?foreground=red&background=gray80 .EE .TP 8 .B ts-origin \fPx,y -Sets the tile stipple x and y origin. Requires two arguments, a x and y -coordinate. Example: +Sets the tile stipple x and y origin. +Requires two arguments, a x and y coordinate. +Example: .EX -ts-origin 10,10 +\fBts-origin\fP 10,10 .EE .TP 8 .B umask Disables the GC mask, if it has been set with the command \fImask\fP. Requires no arguments. +.ne 7 .PP Example for drawing a shadow effect in a widget: +.PP .EX -foreground gray30;\e -draw-lines +1,-1,-1,-1,-1,+1;\e -foreground gray85;\e -draw-lines -1,+0,+0,+0,+0,-1 +\fBforeground\fP gray30;\e +\fBdraw-lines\fP +1,-1,-1,-1,-1,+1;\e +\fBforeground\fP gray85;\e +\fBdraw-lines\fP -1,+0,+0,+0,+0,-1 .EE .SH PIXMAPS -A String to Pixmap converter has been added to \fBXaw\fP. This converter -is meant to be extended, and has enough abstraction to allow loading -several image formats. It uses a format that resembles a \fIURL\fP, with -the syntax: +A String to Pixmap converter has been added to \fBXaw\fP. +This converter is meant to be extended, +and has enough abstraction to allow loading several image formats. +It uses a format that resembles a \fIURL\fP, with the syntax: .PP .I [type:]name[?arg=val[{&}...]] -.PP -\fBType\fP can be one of \fIbitmap\fP, \fIgradient\fP or \fIxpm\fP. -.PP -\fBName\fP may be a file name, or, in the case of type \fIgradient\fP, may be +.TP +\fItype\fP +can be one of \fIbitmap\fP, \fIgradient\fP or \fIxpm\fP. +.TP +\fIname\fP +may be a file name, or, in the case of type \fIgradient\fP, may be either \fIvertical\fP or \fIhorizontal\fP. -.PP -\fBArg=val\fP is a list of arguments to the converter. An argument list is -preceded by a question mark, and multiple arguments are separated by -ampersands. The most common arguments are \fIforeground\fP and -\fIbackground\fP. Gradients also support the arguments \fIstart\fP and -\fIend\fP (colors with which to start and end the gradient); the -\fPsteps\fP argument, to allow using less colors; and the \fIdimension\fP -argument to specify the size of the gradient. The \fIxpm\fP converter +.TP +\fIarg=val\fP +is a list of arguments to the converter. +.IP +An argument list is preceded by a question mark, +and multiple arguments are separated by ampersands. +.IP +The most common arguments are \fIforeground\fP and \fIbackground\fP. +.IP +Gradients also support the arguments \fIstart\fP and \fIend\fP +(colors with which to start and end the gradient), +the \fPsteps\fP argument (to allow using fewer colors), +and the \fIdimension\fP argument (to specify the size of the gradient). +.IP +The \fIxpm\fP converter understands the \fIcloseness\fP argument, which aids in using fewer colors (useful if you have a limited colormap). .SH TEXT WIDGET @@ -486,65 +605,83 @@ A couple of highly visible changes in the Text widget are due to many bugs in the Xaw6 implementation involving scrollbars and auto-resizing. Scrollbars being added or removed caused several problems in keeping the text cursor visible, and in Xaw6 it was very easy to have a widget thinking -the cursor was visible, when it was not. Also, permitting automatic +the cursor was visible, when it was not. +Also, permitting automatic resizing of the widget to a larger geometry created other problems, making it difficult to have a consistent layout in the application, and, if the window manager did not interfere, windows larger than the screen could -result. Therefore, some functionality involving scrollbars and +result. +Therefore, some functionality involving scrollbars and auto-resizing has been disabled; see the section on new and modified Text widget resources below. .PP The Text widget's default key bindings were originally based on the Emacs -text editor. In this release, even more operations familiar to Emacs users -have been added. New text actions include: +text editor. +In this release, even more operations familiar to Emacs users have been added. +New text actions include: .TP 8 .B indent -Indents text blocks. Not bound by default. The Text widget also does not +Indents text blocks. +Not bound by default. +The Text widget also does not attempt to perform auto-indentation of its source object by default. .TP 8 .B keyboard-reset -Resets the keyboard state. Reverts the action multiplier to 1, and if undo -is enabled, toggles between undo and redo. Bound by default to +Resets the keyboard state. +Reverts the action multiplier to 1, and if undo +is enabled, toggles between undo and redo. +Bound by default to \fIControl<Key>G\fP. .TP 8 .B kill-ring-yank In this version of Xaw, text killed in any text field is kept in memory, allowing cut and paste operations internally to the program between text -fields. Bound by default to \fIMeta<Key>Y\fP. +fields. +Bound by default to \fIMeta<Key>Y\fP. .TP 8 .B numeric -Listed here only for purposes of documentation. Called by default when one +Listed here only for purposes of documentation. +Called by default when one of the characters \fI1, 2, 3, 4, 5, 6, 7, 8, 9, 0,\fP or \fI-\fP is typed, allowing composition of the multiplication number of text actions. .TP 8 .B set-keyboard-focus -Sets the input focus of the top level widget to the text field. Not +Sets the input focus of the top level widget to the text field. +Not enabled by default, but bound to the \fI<Btn1Down>\fP event. .TP 8 .B toggle-overwrite -Toggles overwrite mode. In overwrite mode, any text inserted in a text -field will replace existing text. Bound by default to \fI<Key>Insert\fP. +Toggles overwrite mode. +In overwrite mode, any text inserted in a text field will replace existing text. +Bound by default to \fI<Key>Insert\fP. .TP 8 .B undo -Sets the \fIenableUndo\fP resource of the textSrcObject. Not enabled by +Sets the \fIenableUndo\fP resource of the textSrcObject. +Not enabled by default, but bound to \fIControl<Key>_\fP. .PP New and modified Text widget resources include: .TP 8 .B justify (\fPClass\fB Justify) -Sets the text justification. Can be one of \fIleft, right, center\fP, or -\fIfull\fP. Only enabled when the \fIautoFill\fP resource is set, and the +Sets the text justification. +Can be one of \fIleft, right, center\fP, or +\fIfull\fP. +Only enabled when the \fIautoFill\fP resource is set, and the resources \fIleftColumn\fP and \fIrightColumn\fP are correctly set. .TP 8 .B leftColumn (\fPClass\fB Column) -Specifies the left column at which to break text. Text lines started with +Specifies the left column at which to break text. +Text lines started with an alphanumeric character will automatically start at this column. .TP 8 .B positionCallback (\fPClass\fB Callback) Allows installation of a callback to be called every time the cursor is -moved, and/or the file changes its size. The callback is called with a +moved, and/or the file changes its size. +The callback is called with a pointer to a structure containing the following data: -.nf +.RS +.PP +.EX typedef struct { int line_number; int column_number; @@ -552,7 +689,9 @@ typedef struct { XawTextPosition last_position; Boolean overwrite_mode; } XawTextPositionInfo; -.fi +.EE +.RE +.IP This callback is intended to help programmers write text editors based on the Xaw widget set. .TP 8 @@ -561,46 +700,54 @@ No longer supported, but recognized for backward compatibility with resource specifications written for the Xaw6 Text widget. .TP 8 .B rightColumn (\fPClass\fB Column) -Specifies the right column at which to break text. Text lines started with +Specifies the right column at which to break text. +Text lines started with an alphanumeric character will automatically end at this column. .TP 8 .B scrollHorizontal (\fPClass\fB Scroll) .TQ .B scrollVertical (\fPClass\fB Scroll) These resources control the placement of scrollbars on the left and bottom -edges of the Text widget. They accept the values \fIXawtextScrollAlways\fP -and \fIXawtextScrollNever\fP. A converter is registered for this resource -that will convert the following strings: \fIalways\fP and \fInever\fP. The +edges of the Text widget. +They accept the values \fIXawtextScrollAlways\fP and \fIXawtextScrollNever\fP. +A converter is registered for this resource +that will convert the following strings: \fIalways\fP and \fInever\fP. +The value \fIXawtextScrollWhenNeeded\fP (and \fIwhenNeeded\fP, recognized by the converter), is accepted for backwards compatibility with resource specifications written for the Xaw6 Text widget, but ignored (effectively treated as \fIXawtextScrollNever\fP). .SH TEXT SOURCE OBJECT The textSrcObject allows display of its contents to more than one window, -and also stores undo information. The new resources for the textSrcObject +and also stores undo information. +The new resources for the textSrcObject are: .TP 8 .B callback (\fPClass\fB Callback) Previous versions of Xaw had this resource in subclasses of the TextSource -object. This was changed to make it possible to tell the callback the +object. +This was changed to make it possible to tell the callback the state of the text when undo is enabled. .TP 8 .B enableUndo (\fPClass\fB Undo) -A boolean resource that enables or disables the undo function. The default -value is False. +A boolean resource that enables or disables the undo function. +The default value is False. .TP 8 .B sourceChanged (\fPClass\fB Changed) Like the callback resource, this resource was previously in subclasses of -the TextSource object. It is now in the textSrcObject to control the +the TextSource object. +It is now in the textSrcObject to control the changed/unchanged state when undo is enabled. .SH TEXT SINK OBJECT The textSinkObject subclasses asciiSinkObject and multiSinkObject have been changed slightly to use a new cursor shape (no longer a caret at the baseline) that indicates the input focus of the text widget, and allow -specification of the cursor color. The new resource is: +specification of the cursor color. +The new resource is: .TP 8 .B cursorColor (\fPClass\fB Color) -Sets the cursor color of the text. This color is also used to draw +Sets the cursor color of the text. +This color is also used to draw selected text. .SH SIMPLE MENU WIDGET The simpleMenuWidget algorithm to lay out menu entries has been changed to @@ -608,11 +755,13 @@ enable multiple columns when a single column does not fit on the screen. It was also modified to enable submenus. .SH SME BSB OBJECT A new resource has been added to the smeBSBObject to allow binding submenus -to it. The new resource is: +to it. +The new resource is: .TP 8 .B menuName (\fPClass\fB MenuName) Specifies the name of the popup widget to be popped up when the pointer is -over the menu entry, or NULL. Note that the named menu must be a child of +over the menu entry, or NULL. +Note that the named menu must be a child of the popup parent of the smeBSBObject. .SH AUTHORS The original X Consortium version of the Athena Widget Set and its diff --git a/lib/libXaw/specs/Makefile.in b/lib/libXaw/specs/Makefile.in index 7db88f1ed..a19baa3ab 100644 --- a/lib/libXaw/specs/Makefile.in +++ b/lib/libXaw/specs/Makefile.in @@ -237,6 +237,7 @@ XAW6_LIBS = @XAW6_LIBS@ XAW7_CFLAGS = @XAW7_CFLAGS@ XAW7_LIBS = @XAW7_LIBS@ XMLTO = @XMLTO@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_SGML_PATH = @XORG_SGML_PATH@ XSLTPROC = @XSLTPROC@ diff --git a/lib/libXaw/src/Actions.c b/lib/libXaw/src/Actions.c index ae330d5b2..abb61efc6 100644 --- a/lib/libXaw/src/Actions.c +++ b/lib/libXaw/src/Actions.c @@ -151,15 +151,17 @@ static Cardinal num_variable_list; Bool XawParseBoolean(Widget w, String param, XEvent *event, Bool *succeed) { - char *tmp = (char *)param; - int value; - if (!param) return (False); + else + { + char *tmp = (char *)param; + double dd = strtod(param, &tmp); + int value = (int) dd; - value = (int)strtod(param, &tmp); - if (*tmp == '\0') - return (value); + if (*tmp == '\0') + return (value); + } if (XmuCompareISOLatin1(param, "true") == 0 || XmuCompareISOLatin1(param, "yes") == 0 @@ -188,7 +190,6 @@ Bool XawBooleanExpression(Widget w, String param, XEvent *event) { XawEvalInfo info; - Bool retval; if (!param) return (False); @@ -215,16 +216,18 @@ XawBooleanExpression(Widget w, String param, XEvent *event) (void)get_token(&info); if (info.token == ERROR) return (False); - retval = expr(&info); + else + { + Bool retval = expr(&info); - return (info.token != ERROR ? retval : False); + return (info.token != ERROR ? retval : False); + } } static int get_token(XawEvalInfo *info) { int ch; - char *p, name[256]; info->lp = info->cp; @@ -248,7 +251,8 @@ get_token(XawEvalInfo *info) { Bool succeed = True; - p = info->cp - 1; + char *p = info->cp - 1; + char name[256]; while ((ch = *info->cp) && (isalnum(ch) || ch == '_')) ++info->cp; @@ -409,6 +413,7 @@ XawSetValuesAction(Widget w, XEvent *event, #ifdef LONG64 long c_8; #endif + unsigned use_size; if (!(*num_params & 1)) { @@ -440,13 +445,14 @@ XawSetValuesAction(Widget w, XEvent *event, from.size = (Cardinal) strlen(value) + 1; from.addr = (char *)value; to.size = resource->size; - switch (to.size) + use_size = resource->size; + switch (use_size) { - case 1: to.addr = (XPointer)&c_1; break; - case 2: to.addr = (XPointer)&c_2; break; - case 4: to.addr = (XPointer)&c_4; break; + case 1: to.addr = (XPointer)&c_1; c_1 = 0; break; + case 2: to.addr = (XPointer)&c_2; c_2 = 0; break; + case 4: to.addr = (XPointer)&c_4; c_4 = 0; break; #ifdef LONG64 - case 8: to.addr = (XPointer)&c_8; break; + case 8: to.addr = (XPointer)&c_8; c_8 = 0; break; #endif default: { @@ -466,10 +472,11 @@ XawSetValuesAction(Widget w, XEvent *event, c_4 = (int)from.addr; #endif else if (!XtConvertAndStore(w, XtRString, &from, - XrmQuarkToString(resource->qtype), &to)) + XrmQuarkToString(resource->qtype), &to) + || to.size != use_size) continue; - switch (to.size) + switch (use_size) { case 1: XtSetArg(arglist[num_args], XrmQuarkToString(resource->qname), c_1); @@ -499,7 +506,6 @@ XawGetValuesAction(Widget w, XEvent *event, { XawActionResList *rlist; XawActionVarList *vlist; - String value; Cardinal count; if (!(*num_params & 1)) @@ -515,7 +521,8 @@ XawGetValuesAction(Widget w, XEvent *event, for (count = 1; count < *num_params; count += 2) { - if ((value = XawConvertActionRes(rlist, w, params[count + 1])) == NULL) + String value = XawConvertActionRes(rlist, w, params[count + 1]); + if (value == NULL) continue; XawDeclareActionVar(vlist, params[count], value); } @@ -865,11 +872,9 @@ _XawFindActionRes(XawActionResList *list, Widget detail, String name) static char * _XawEscapeActionVarValue(String value) { - char * escape; - if (value[0] == '$' || value[0] == '\\') { - escape = XtMalloc((Cardinal)strlen(value) + 2); + char *escape = XtMalloc((Cardinal)strlen(value) + 2); escape[0] = '\\'; strcpy(escape + 1, value); return (escape); @@ -881,11 +886,9 @@ _XawEscapeActionVarValue(String value) static char * _XawUnescapeActionVarValue(String value) { - char * unescape; - if (value[0] == '\\') { - unescape = XtMalloc((Cardinal)strlen(value)); + char *unescape = XtMalloc((Cardinal)strlen(value)); strcpy(unescape, value + 1); return (unescape); } @@ -918,7 +921,7 @@ XawDeclareActionVar(XawActionVarList *list, String name, String value) { String val = escape ? escape : value; - if (strcmp(XrmQuarkToString(variable->qvalue), val) == 0) + if (val != NULL && strcmp(XrmQuarkToString(variable->qvalue), val) == 0) { if (escape) XtFree(escape); diff --git a/lib/libXaw/src/AllWidgets.c b/lib/libXaw/src/AllWidgets.c index 8a7490f73..9171242e8 100644 --- a/lib/libXaw/src/AllWidgets.c +++ b/lib/libXaw/src/AllWidgets.c @@ -60,7 +60,7 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xaw/Tree.h> #include <X11/Xaw/Viewport.h> -#define DATA(name,class) { (char *)name, class } +#define DATA(name,class) { (char *)name, class, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } XmuWidgetNode XawWidgetArray[] = { DATA( "applicationShell", &applicationShellWidgetClass ), DATA( "asciiSink", &asciiSinkObjectClass ), diff --git a/lib/libXaw/src/AsciiSink.c b/lib/libXaw/src/AsciiSink.c index 29850ba33..1736a7692 100644 --- a/lib/libXaw/src/AsciiSink.c +++ b/lib/libXaw/src/AsciiSink.c @@ -296,12 +296,13 @@ static int GetTextWidth(TextWidget ctx, int current_width, XFontStruct *font, XawTextPosition from, int length) { - int i, width = 0; - XawTextBlock block; - XawTextPosition pos = from; + int width = 0; while (length > 0) { - pos = XawTextSourceRead(ctx->text.source, from, &block, length); + int i; + XawTextBlock block; + XawTextPosition pos = XawTextSourceRead(ctx->text.source, from, &block, length); + length = (int)(length - (pos - from)); from = pos; for (i = 0; i < block.length; i++) @@ -340,7 +341,6 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, XawTextAnchor *anchor; XawTextEntity *entity; XawTextProperty *property; - XawTextPaintStruct *paint; XawTextBlock block; XFontStruct *font; @@ -373,7 +373,7 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, rbearing = font->per_char[c - font->min_char_or_byte2].rbearing - font->per_char[c - font->min_char_or_byte2].width; if (rbearing > 0) { - paint = XtNew(XawTextPaintStruct); + XawTextPaintStruct *paint = XtNew(XawTextPaintStruct); paint->next = sink->text_sink.paint->bearings; sink->text_sink.paint->bearings = paint; paint->x = x - (paint->width = CharWidth(sink, font, 0, c)); @@ -408,7 +408,7 @@ void CalculateBearing(TextWidget ctx, XawTextPosition position, int x, int y, (c >= font->min_char_or_byte2 && c <= font->max_char_or_byte2)) lbearing = font->per_char[c - font->min_char_or_byte2].lbearing; if (lbearing < 0) { - paint = XtNew(XawTextPaintStruct); + XawTextPaintStruct *paint = XtNew(XawTextPaintStruct); paint->next = sink->text_sink.paint->bearings; sink->text_sink.paint->bearings = paint; paint->x = x; @@ -438,14 +438,13 @@ AsciiPreparePaint(Widget w, int y, int line, TextWidget ctx = (TextWidget)XtParent(w); AsciiSinkObject sink = (AsciiSinkObject)ctx->text.sink; - XawTextPosition left, right, pos, pos2, tmp, length; + XawTextPosition left, right, pos, tmp, length; XawTextAnchor *anchor; XawTextEntity *entity; XawTextProperty *property; - int i, ascent = 0, descent = 0, xl, xr, x = ctx->text.left_margin, bufsiz; + int i, ascent = 0, descent = 0, xl, xr, x = ctx->text.left_margin; XawTextBlock block; XFontStruct *font; - XawTextPaintStruct *paint; if (!sink->ascii_sink.echo) return; @@ -455,7 +454,7 @@ AsciiPreparePaint(Widget w, int y, int line, /* XXX the x coordinate can be a parameter, but since it is required to calculate the ascent/descent, do it here to avoid an extra search in the entities */ - pos = tmp = left = ctx->text.lt.info[line].position; + pos = left = ctx->text.lt.info[line].position; right = ctx->text.lt.info[line + 1].position; right = XawMin(right, ctx->text.lastPos + 1); while (pos < right) { @@ -530,7 +529,9 @@ AsciiPreparePaint(Widget w, int y, int line, /* pass 2: feed the XawTextPaintStruct lists */ pos = from; while (pos < to) { - paint = XtNew(XawTextPaintStruct); + int bufsiz; + XawTextPaintStruct *paint = XtNew(XawTextPaintStruct); + paint->next = sink->text_sink.paint->paint; sink->text_sink.paint->paint = paint; paint->x = x; @@ -572,9 +573,8 @@ AsciiPreparePaint(Widget w, int y, int line, paint->length = 0; segment.x1 = x; - pos2 = tmp; while (length > 0) { - pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, (int)length); + XawTextPosition pos2 = XawTextSourceRead(ctx->text.source, tmp, &block, (int)length); length = pos - pos2; tmp = pos2; for (i = 0; i < block.length; i++) { @@ -736,9 +736,6 @@ AsciiDoPaint(Widget w) XmuScanline *scan; XmuSegment *seg; XawTextPaintList *list = sink->text_sink.paint; -#if 0 - XawTextPaintStruct *base, *head; -#endif XawTextPaintStruct *paint = list->paint; XawTextProperty *property; XFontStruct *font = NULL; @@ -762,26 +759,6 @@ AsciiDoPaint(Widget w) (unsigned)(seg->x2 - seg->x1), (unsigned)(scan->next->y - scan->y)); - /* pass 2: optimize drawing list to avoid too much GC change requests */ - /* XXX this assumes there will not exist entities drawn over other - entities. */ -#if 0 - while (paint) { - base = paint; - head = paint->next; - while (head) { - if (head->property == paint->property) { - base->next = head->next; - head->next = paint->next; - paint->next = head; - paint = head; - } - base = head; - head = head->next; - } - paint = paint->next; - } -#endif if (paint && paint->next) { XawTextPaintStruct **paints; int i = 0, n_paints = 0; @@ -982,8 +959,6 @@ AsciiDoPaint(Widget w) /* dont care on order of drawing or caching of state (by now) */ paint = list->bearings; while (paint) { - XRectangle rect2; - if (paint->highlight) XSetForeground(XtDisplay(ctx), gc, sink->text_sink.background); if (!paint->property || !(paint->property->mask & XAW_TPROP_FONT)) @@ -999,10 +974,13 @@ AsciiDoPaint(Widget w) XSetForeground(XtDisplay(ctx), gc, paint->property->foreground); } if (paint->x < XtWidth(ctx) && paint->x + paint->width > 0) { - rect2.x = (short)(paint->x + paint->width); - rect2.width = (XawAbs(paint->width)); /* more than enough */ - rect2.y = (short)(paint->y - font->ascent); - rect2.height = (unsigned short)(rect2.y + font->ascent + font->descent); + XRectangle rect2 = { + .x = (short)(paint->x + paint->width), + .width = (unsigned short)(XawAbs(paint->width)), /* more than enough */ + .y = (short)(paint->y - font->ascent), + .height = (unsigned short)((paint->y - font->ascent) + + font->ascent + font->descent) + }; XSetClipRectangles(XtDisplay((Widget)ctx), gc, 0, 0, &rect2, 1, Unsorted); XDrawString(XtDisplay(ctx), XtWindow(ctx), gc, paint->x, paint->y, @@ -1387,7 +1365,7 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, #ifndef OLDXAW AsciiSinkObject sink = (AsciiSinkObject)w; TextWidget ctx = (TextWidget)XtParent(w); - XFontStruct *font = sink->ascii_sink.font; + XFontStruct *font; Widget source = ctx->text.source; XawTextPosition idx, pos; unsigned char c; @@ -1401,12 +1379,11 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, pos = idx = fromPos; rWidth = 0; - c = 0; while (!done) { if (XawTextSourceAnchorAndEntity(source, pos, &anchor, &entity)) { length = (Cardinal)(anchor->position + entity->offset + entity->length); - length = (XawMin(toPos, length) - pos); + length = (Cardinal)(XawMin(toPos, length) - pos); if ((property = XawTextSinkGetProperty((Widget)sink, entity->property)) != NULL && (property->mask & XAW_TPROP_FONT)) @@ -1420,13 +1397,13 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, entity = entity->next; if (entity) { length = (Cardinal)(anchor->position + entity->offset); - length = (XawMin(toPos, length) - pos); + length = (Cardinal)(XawMin(toPos, length) - pos); } else - length = (XawMin(toPos - pos, 4096)); + length = (Cardinal)(XawMin(toPos - pos, 4096)); } else - length = (XawMin(toPos - pos, 4096)); + length = (Cardinal)(XawMin(toPos - pos, 4096)); font = sink->ascii_sink.font; } @@ -1462,16 +1439,17 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, XFontStruct *font = sink->ascii_sink.font; Widget source = ctx->text.source; XawTextPosition idx, pos; - unsigned char c; XawTextBlock blk; int i, rWidth; - pos = XawTextSourceRead(source, fromPos, &blk, toPos - fromPos); + pos = XawTextSourceRead(source, fromPos, &blk, (int)(toPos - fromPos)); rWidth = 0; for (i = 0, idx = fromPos; idx < toPos; i++, idx++) { + unsigned char c; + if (i >= blk.length) { i = 0; - pos = XawTextSourceRead(source, pos, &blk, toPos - pos); + pos = XawTextSourceRead(source, pos, &blk, (int)(toPos - pos)); if (blk.length == 0) break; } @@ -1498,7 +1476,7 @@ FindPosition(Widget w, XawTextPosition fromPos, int fromx, int width, AsciiSinkObject sink = (AsciiSinkObject)w; TextWidget ctx = (TextWidget)XtParent(w); Widget source = ctx->text.source; - XFontStruct *font = sink->ascii_sink.font; + XFontStruct *font; XawTextPosition idx, pos, whiteSpacePosition = 0; int i, lastWidth, whiteSpaceWidth, rWidth, ascent = 0, descent = 0; Boolean whiteSpaceSeen; @@ -1653,16 +1631,16 @@ GetGC(AsciiSinkObject sink) { XtGCMask valuemask = (GCFont | GCGraphicsExposures | GCClipXOrigin | GCForeground | GCBackground); - XGCValues values; - - /* XXX We dont want do share a gc that will change the clip-mask */ - values.clip_x_origin = (int)(long)sink; - values.clip_mask = None; - values.font = sink->ascii_sink.font->fid; - values.graphics_exposures = False; - - values.foreground = sink->text_sink.foreground; - values.background = sink->text_sink.background; + XGCValues values = { + /* XXX We dont want to share a gc that will change the clip-mask */ + .clip_x_origin = (int)(long)sink, + .clip_mask = None, + .font = sink->ascii_sink.font->fid, + .graphics_exposures = False, + + .foreground = sink->text_sink.foreground, + .background = sink->text_sink.background + }; sink->ascii_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values, GCClipMask | GCFont | GCForeground | GCBackground, 0); diff --git a/lib/libXaw/src/AsciiSrc.c b/lib/libXaw/src/AsciiSrc.c index 78335144c..a3703aebe 100644 --- a/lib/libXaw/src/AsciiSrc.c +++ b/lib/libXaw/src/AsciiSrc.c @@ -55,6 +55,10 @@ in this Software without prior written authorization from The Open Group. #include <sys/stat.h> #include <fcntl.h> +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + #if (defined(ASCII_STRING) || defined(ASCII_DISK)) #include <X11/Xaw/AsciiText.h> /* for Widget Classes */ #endif @@ -240,6 +244,9 @@ AsciiSrcClassRec asciiSrcClassRec = { Search, /* Search */ XtInheritSetSelection, /* SetSelection */ XtInheritConvertSelection, /* ConvertSelection */ +#ifndef OLDXAW + NULL, +#endif }, /* ascii_src */ { @@ -389,7 +396,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) text->format = XawFmt8Bit; if (length == 0) { text->firstPos = (int)(end = (offset + entity->length)); - text->ptr = ""; + text->ptr = (char*)""; } else { text->firstPos = (int)pos; @@ -411,7 +418,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) text->firstPos = (int)pos; text->ptr = piece->text + (pos - start); count = piece->used - (pos - start); - text->length = (Max(0, (length > count) ? count : length)); + text->length = (int)(Max(0, (length > count) ? count : length)); text->format = XawFmt8Bit; return (pos + text->length); @@ -449,8 +456,10 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, if (src->text_src.edit_mode == XawtextRead) return (XawEditError); - start_piece = FindPiece(src, startPos, &start_first); - end_piece = FindPiece(src, endPos, &end_first); + if ((start_piece = FindPiece(src, startPos, &start_first)) == NULL) + return XawEditError; + if ((end_piece = FindPiece(src, endPos, &end_first)) == NULL) + return XawEditError; #ifndef OLDXAW /* @@ -461,7 +470,7 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, if (start_piece->used) { int i; - for (i = 0; i < src->text_src.num_text; i++) { + for (i = 0; i < (int)src->text_src.num_text; i++) { int line; TextWidget ctx = (TextWidget)src->text_src.text[i]; @@ -514,7 +523,8 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, * Remove Old Stuff */ if (start_piece != end_piece) { - temp_piece = start_piece->next; + if ((temp_piece = start_piece->next) == NULL) + return XawEditError; /* * If empty and not the only piece then remove it. @@ -973,8 +983,7 @@ XawAsciiSrcSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, AsciiSrcObject src = (AsciiSrcObject)cnew; AsciiSrcObject old_src = (AsciiSrcObject)current; Bool total_reset = False, string_set = False; - FILE *file; - unsigned int i; + Cardinal i; if (old_src->ascii_src.use_string_in_place != src->ascii_src.use_string_in_place) { @@ -992,6 +1001,8 @@ XawAsciiSrcSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, } if (string_set || (old_src->ascii_src.type != src->ascii_src.type)) { + FILE *file; + RemoveOldStringOrFile(old_src, string_set); /* remove old info */ file = InitStringOrFile(src, string_set); /* Init new info */ LoadPieces(src, file, NULL); /* load new info into internal buffers */ @@ -1039,7 +1050,7 @@ static void XawAsciiSrcGetValuesHook(Widget w, ArgList args, Cardinal *num_args) { AsciiSrcObject src = (AsciiSrcObject)w; - unsigned int i; + Cardinal i; if (src->ascii_src.type == XawAsciiString) { for (i = 0; i < *num_args ; i++) @@ -1280,7 +1291,7 @@ WriteToFile(String string, String name, unsigned length) { int fd; - if ((fd = creat(name, 0666)) == -1) + if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)) == -1) return (False); if (write(fd, string, length) == -1) { @@ -1317,14 +1328,13 @@ WritePiecesToFile(AsciiSrcObject src, String name) int fd; if (src->ascii_src.data_compression) { - Piece *tmp; - piece = src->ascii_src.first_piece; while (piece) { int bytes = (int)(src->ascii_src.piece_size - piece->used); + Piece *tmp; if (bytes > 0 && (tmp = piece->next) != NULL) { - bytes = (XawMin(bytes, tmp->used)); + bytes = (int)(XawMin(bytes, tmp->used)); memcpy(piece->text + piece->used, tmp->text, (size_t)bytes); memmove(tmp->text, tmp->text + bytes, (size_t)(tmp->used - bytes)); piece->used += bytes; @@ -1337,7 +1347,7 @@ WritePiecesToFile(AsciiSrcObject src, String name) } } - if ((fd = creat(name, 0666)) == -1) + if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)) == -1) return (False); for (piece = src->ascii_src.first_piece; piece; piece = piece->next) @@ -1403,8 +1413,6 @@ InitStringOrFile(AsciiSrcObject src, Bool newString) { mode_t open_mode = 0; const char *fdopen_mode = NULL; - int fd; - FILE *file; if (src->ascii_src.type == XawAsciiString) { if (src->ascii_src.string == NULL) @@ -1443,19 +1451,19 @@ InitStringOrFile(AsciiSrcObject src, Bool newString) XtErrorMsg("NoFile", "asciiSourceCreate", "XawError", "Creating a read only disk widget and no file specified.", NULL, NULL); - open_mode = O_RDONLY; + open_mode = O_RDONLY | O_CLOEXEC; fdopen_mode = "r"; break; case XawtextAppend: case XawtextEdit: if (src->ascii_src.string == NULL) { - src->ascii_src.string = "*ascii-src*"; + src->ascii_src.string = (char*)"*ascii-src*"; src->ascii_src.is_tempfile = True; } else { -/* O_NOFOLLOW is a FreeBSD & Linux extension */ +/* O_NOFOLLOW was a FreeBSD & Linux extension, now adopted by POSIX */ #ifdef O_NOFOLLOW - open_mode = O_RDWR | O_NOFOLLOW; + open_mode = O_RDWR | O_NOFOLLOW | O_CLOEXEC; #else open_mode = O_RDWR; /* unsafe; subject to race conditions */ #endif /* O_NOFOLLOW */ @@ -1477,8 +1485,12 @@ InitStringOrFile(AsciiSrcObject src, Bool newString) } if (!src->ascii_src.is_tempfile) { - if ((fd = open(src->ascii_src.string, (int)open_mode, 0666)) != -1) { - if ((file = fdopen(fd, fdopen_mode))) { + int fd = open(src->ascii_src.string, (int)open_mode, 0666); + + if (fd != -1) { + FILE *file = fdopen(fd, fdopen_mode); + + if (file != NULL) { (void)fseek(file, 0, SEEK_END); src->ascii_src.length = (XawTextPosition)ftell(file); return (file); @@ -1511,11 +1523,11 @@ LoadPieces(AsciiSrcObject src, FILE *file, char *string) if (string == NULL) { if (src->ascii_src.type == XawAsciiFile) { if (src->ascii_src.length != 0) { - int len; - left = 0; fseek(file, 0, SEEK_SET); while (left < src->ascii_src.length) { + int len; + ptr = XtMalloc((unsigned)src->ascii_src.piece_size); if ((len = (int)fread(ptr, sizeof(unsigned char), (size_t)src->ascii_src.piece_size, file)) < 0) diff --git a/lib/libXaw/src/AsciiText.c b/lib/libXaw/src/AsciiText.c index 65a2323f7..32c7db1df 100644 --- a/lib/libXaw/src/AsciiText.c +++ b/lib/libXaw/src/AsciiText.c @@ -123,10 +123,15 @@ AsciiTextClassRec asciiTextClassRec = { NULL, /* callback_private */ XtInheritTranslations, /* tm_table */ XtInheritQueryGeometry, /* query_geometry */ + NULL, /* display_accelerator */ + NULL, /* extension */ }, /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* text */ { diff --git a/lib/libXaw/src/Box.c b/lib/libXaw/src/Box.c index 4f759c5f1..0e9c4e4a6 100644 --- a/lib/libXaw/src/Box.c +++ b/lib/libXaw/src/Box.c @@ -208,7 +208,6 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, Dimension lw, lh; /* Width and height needed for current line */ Dimension bw, bh; /* Width and height needed for current widget */ Dimension h_space; /* Local copy of bbw->box.h_space */ - Widget widget; /* Current widget */ unsigned int num_mapped_children = 0; /* Box width and height */ @@ -230,7 +229,7 @@ DoLayout(BoxWidget bbw, unsigned int width, unsigned int height, lw = h_space; for (i = 0; i < bbw->composite.num_children; i++) { - widget = bbw->composite.children[i]; + Widget widget = bbw->composite.children[i]; /* Current widget */ if (widget->core.managed) { if (widget->core.mapped_when_managed) num_mapped_children++; @@ -498,10 +497,12 @@ TryNewLayout(BoxWidget bbw) proposed_height = preferred_height; } else { /* proposed_height != preferred_height */ - XtWidgetGeometry constraints, reply; + XtWidgetGeometry constraints = { + .request_mode = CWHeight, + .height = proposed_height + }; + XtWidgetGeometry reply; - constraints.request_mode = CWHeight; - constraints.height = proposed_height; (void)XawBoxQueryGeometry((Widget)bbw, &constraints, &reply); proposed_width = preferred_width; } @@ -525,9 +526,6 @@ static XtGeometryResult XawBoxGeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply _X_UNUSED) { - Dimension width, height, borderWidth; - BoxWidget bbw; - /* Position request always denied */ if (((request->request_mode & CWX) && request->x != XtX(w)) || ((request->request_mode & CWY) && request->y != XtY(w))) @@ -535,6 +533,9 @@ XawBoxGeometryManager(Widget w, XtWidgetGeometry *request, /* Size changes must see if the new size can be accommodated */ if (request->request_mode & (CWWidth | CWHeight | CWBorderWidth)) { + Dimension width, height, borderWidth; + BoxWidget bbw; + /* Make all three fields in the request valid */ if ((request->request_mode & CWWidth) == 0) request->width = XtWidth(w); @@ -544,12 +545,12 @@ XawBoxGeometryManager(Widget w, XtWidgetGeometry *request, request->border_width = XtBorderWidth(w); /* Save current size and set to new size */ - width = XtWidth(w); - height = XtHeight(w); - borderWidth = XtBorderWidth(w); - XtWidth(w) = request->width; - XtHeight(w) = request->height; - XtBorderWidth(w) = request->border_width; + width = XtWidth(w); + height = XtHeight(w); + borderWidth = XtBorderWidth(w); + XtWidth(w) = request->width; + XtHeight(w) = request->height; + XtBorderWidth(w) = request->border_width; /* Decide if new layout works: (1) new widget is smaller, diff --git a/lib/libXaw/src/Command.c b/lib/libXaw/src/Command.c index d9db81a69..a2b298a95 100644 --- a/lib/libXaw/src/Command.c +++ b/lib/libXaw/src/Command.c @@ -200,6 +200,9 @@ CommandClassRec commandClassRec = { /* simple */ { ChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* label */ { @@ -219,17 +222,16 @@ WidgetClass commandWidgetClass = (WidgetClass)&commandClassRec; static GC Get_GC(CommandWidget cbw, Pixel fg, Pixel bg) { - XGCValues values; - - values.foreground = fg; - values.background = bg; - values.font = cbw->label.font->fid; - values.cap_style = CapProjecting; + XGCValues values = { + .foreground = fg, + .background = bg, + .font = cbw->label.font->fid, + .cap_style = CapProjecting, + .line_width = 0 + }; if (cbw->command.highlight_thickness > 1) values.line_width = cbw->command.highlight_thickness; - else - values.line_width = 0; if (cbw->simple.international == True) return (XtAllocateGC((Widget)cbw, 0, @@ -296,8 +298,8 @@ HighlightRegion(CommandWidget cbw) rect.height = XtHeight(cbw); XUnionRectWithRegion(&rect, emptyRegion, outerRegion); rect.x = rect.y = (short)cbw->command.highlight_thickness; - rect.width = (rect.width - cbw->command.highlight_thickness * 2); - rect.height = (rect.height - cbw->command.highlight_thickness * 2); + rect.width = (unsigned short)(rect.width - cbw->command.highlight_thickness * 2); + rect.height = (unsigned short)(rect.height - cbw->command.highlight_thickness * 2); XUnionRectWithRegion(&rect, emptyRegion, innerRegion); XSubtractRegion(outerRegion, innerRegion, outerRegion); @@ -563,7 +565,7 @@ static void XawCommandGetValuesHook(Widget w, ArgList args, Cardinal *num_args) { CommandWidget cbw = (CommandWidget)w; - unsigned int i; + Cardinal i; for (i = 0; i < *num_args; i++) { if (STR_EQUAL(args[i].name, XtNforeground)) diff --git a/lib/libXaw/src/Dialog.c b/lib/libXaw/src/Dialog.c index 925c975d1..9a9f348fb 100644 --- a/lib/libXaw/src/Dialog.c +++ b/lib/libXaw/src/Dialog.c @@ -174,6 +174,9 @@ DialogClassRec dialogClassRec = { /* form */ { XtInheritLayout, /* layout */ +#ifndef OLDXAW + NULL, +#endif }, /* dialog */ { @@ -271,7 +274,6 @@ XawDialogSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, DialogWidget w = (DialogWidget)cnew; DialogWidget old = (DialogWidget)current; Arg args[5]; - Cardinal num_args; unsigned int i; Bool checks[NUM_CHECKS]; @@ -310,7 +312,8 @@ XawDialogSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, } if (checks[LABEL]) { - num_args = 0; + Cardinal num_args = 0; + XtSetArg(args[num_args], XtNlabel, w->dialog.label); num_args++; if (w->dialog.iconW != NULL && XtHeight(w->dialog.labelW) <= XtHeight(w->dialog.iconW)) { @@ -359,9 +362,9 @@ XawDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args) Arg a[1]; char * s; DialogWidget src = (DialogWidget)w; - unsigned int i; + Cardinal i; - for (i = 0; i < *num_args; i++) + for (i = 0; i < *num_args; i++) { if (streq(args[i].name, XtNvalue)) { XtSetArg(a[0], XtNstring, &s); XtGetValues(src->dialog.valueW, a, 1); @@ -372,6 +375,7 @@ XawDialogGetValuesHook(Widget w, ArgList args, Cardinal *num_args) XtGetValues(src->dialog.labelW, a, 1); *((char **)args[i].value) = s; } + } } /* diff --git a/lib/libXaw/src/DisplayList.c b/lib/libXaw/src/DisplayList.c index ae5e7c6dc..457485ca6 100644 --- a/lib/libXaw/src/DisplayList.c +++ b/lib/libXaw/src/DisplayList.c @@ -122,7 +122,6 @@ void XawRunDisplayList(Widget w, _XawDisplayList *list, XEvent *event, Region region) { - XawDLProc *proc; Cardinal i; if (!XtIsRealized(w)) @@ -130,7 +129,7 @@ XawRunDisplayList(Widget w, _XawDisplayList *list, for (i = 0; i < list->num_procs; i++) { - proc = list->procs[i]; + XawDLProc *proc = list->procs[i]; proc->proc(w, proc->args, proc->data->data, event, region); } } @@ -236,8 +235,6 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, char cname[64], fname[64], aname[1024]; Cardinal i; String cp; - String fp; - String lp; int status; xlibc = XawGetDisplayListClass(xlib); @@ -264,6 +261,8 @@ _XawDisplayList *XawCreateDisplayList(String string, Screen *screen, status = 0; while (status != DLEOF) { + String fp, lp; + lp = cp; cp = read_token(cp, fname, sizeof(fname), &status); @@ -449,16 +448,14 @@ void XawDestroyDisplayList(_XawDisplayList *dlist) { Cardinal i, j; - XawDLProc *proc; - XawDLData *data; if (!dlist) return; for (i = 0; i < dlist->num_procs; i++) { - proc = dlist->procs[i]; - data = proc->data; + XawDLProc *proc = dlist->procs[i]; + XawDLData *data = proc->data; if (data) { @@ -707,7 +704,6 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id) { XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args; XawXlibData *xdata = (XawXlibData *)data; - XawDLPosition *pos; XPoint points_buf[16]; XPoint *points; Display *display; @@ -719,7 +715,7 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id) for (i = j = 0; i < num_points; i++, j = i << 1) { - pos = &pos_ptr->pos[j]; + XawDLPosition *pos = &pos_ptr->pos[j]; points[i].x = X_ARG(pos[0]); points[i].y = Y_ARG(pos[1]); } @@ -738,7 +734,7 @@ DlXPoints(Widget w, XtPointer args, XtPointer data, int id) points[i].y = (short)(points[i].y + ypad); } } - else + else if (num_points != 0) { points[0].x = (short)(points[0].x + xpad); points[0].y = (short)(points[0].y + ypad); @@ -888,12 +884,14 @@ DlMask(Widget w, XtPointer args _X_UNUSED, XtPointer data, XSetRegion(display, xdata->gc, region); else if (event) { - XRectangle rect; + XRectangle rect = + { + .x = (short)event->xexpose.x, + .y = (short)event->xexpose.y, + .width = (unsigned short)event->xexpose.width, + .height = (unsigned short)event->xexpose.height + }; - rect.x = (short)event->xexpose.x; - rect.y = (short)event->xexpose.y; - rect.width = (unsigned short)event->xexpose.width; - rect.height = (unsigned short)event->xexpose.height; XSetClipRectangles(display, xdata->gc, 0, 0, &rect, 1, Unsorted); } } @@ -916,7 +914,7 @@ DlLineWidth(Widget w, XtPointer args, XtPointer data, XawXlibData *xdata = (XawXlibData *)data; unsigned line_width = (unsigned)(unsigned long)args; - if (xdata->values.line_width != line_width) + if ((unsigned)xdata->values.line_width != line_width) { xdata->mask |= GCLineWidth; xdata->values.line_width = (int)line_width; @@ -938,7 +936,6 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data, { XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args; XawXlibData *xdata = (XawXlibData *)data; - XawDLPosition *pos; XSegment *segments; XSegment segments_buf[8]; Display *display; @@ -950,7 +947,7 @@ DlDrawSegments(Widget w, XtPointer args, XtPointer data, for (i = j = 0; i < num_segments; i++, j = i << 2) { - pos = &pos_ptr->pos[j]; + XawDLPosition *pos = &pos_ptr->pos[j]; segments[i].x1 = X_ARG(pos[0]); segments[i].y1 = Y_ARG(pos[1]); segments[i].x2 = X_ARG(pos[2]); @@ -1323,10 +1320,8 @@ DlClipRectangles(Widget w, XtPointer args, XtPointer data, { XawDLPositionPtr *pos_ptr = (XawDLPositionPtr *)args; XawXlibData *xdata = (XawXlibData *)data; - XawDLPosition *pos; XRectangle *rects; XRectangle rects_buf[8]; - Position x1, y1, x2, y2; Cardinal num_rects, i, j; num_rects = pos_ptr->num_pos>>2; @@ -1334,11 +1329,11 @@ DlClipRectangles(Widget w, XtPointer args, XtPointer data, for (i = j = 0; i < num_rects; i++, j = i << 2) { - pos = &pos_ptr->pos[j]; - x1 = X_ARG(pos[0]); - y1 = Y_ARG(pos[1]); - x2 = X_ARG(pos[2]); - y2 = Y_ARG(pos[3]); + XawDLPosition *pos = &pos_ptr->pos[j]; + Position x1 = X_ARG(pos[0]); + Position y1 = Y_ARG(pos[1]); + Position x2 = X_ARG(pos[2]); + Position y2 = Y_ARG(pos[3]); rects[i].x = XawMin(x1, x2); rects[i].y = XawMin(y1, y2); rects[i].width = (unsigned short)(XawMax(x1, x2) - rects[i].x); @@ -1751,7 +1746,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, break; case LWIDTH: if (*num_params == 1) - retval = (void *)read_int((char *)params[0], NULL); + { + long x = read_int((char *)params[0], NULL); + retval = (void *)x; + } break; case ARCMODE: if (*num_params == 1) @@ -1896,7 +1894,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, break; case PLANEMASK: if (*num_params == 1) - retval = (void *)read_int((char *)params[0], NULL); + { + long x = read_int((char *)params[0], NULL); + retval = (void *)x; + } break; case DSTRING: case PSTRING: @@ -1914,7 +1915,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, break; case FONT: if (*num_params == 1) - retval = (void *)XLoadFont(DisplayOfScreen(screen), params[0]); + { + Font x = XLoadFont(DisplayOfScreen(screen), params[0]); + retval = (void *)x; + } break; case DASHES: if (*num_params && *num_params < 127) @@ -1942,7 +1946,10 @@ _Xaw_Xlib_ArgsInitProc(String proc_name, String *params, Cardinal *num_params, if (*num_params == 1) { if (isdigit((unsigned char)params[0][0]) || params[0][0] == '+' || params[0][0] == '-') - retval = (void *)read_int((char *)params[0], NULL); + { + long x = read_int((char *)params[0], NULL); + retval = (void *)x; + } else if (XmuCompareISOLatin1(params[0], "true") == 0 || XmuCompareISOLatin1(params[0], "on") == 0) retval = (void *)True; @@ -2125,7 +2132,7 @@ Bool XawDeclareDisplayListProc(XawDLClass *lc, String name, if (!lc || !proc || !name || name[0] == '\0') return (False); - if ((info = _XawFindDLInfo(lc, name)) != NULL) + if (_XawFindDLInfo(lc, name) != NULL) /* Since the data structures to the displayList classes are(should be) * opaque, it is not a good idea to allow overriding a displayList * procedure; it's better to choose another name or class name! diff --git a/lib/libXaw/src/Form.c b/lib/libXaw/src/Form.c index f673d3e6f..8f819104c 100644 --- a/lib/libXaw/src/Form.c +++ b/lib/libXaw/src/Form.c @@ -301,13 +301,12 @@ WidgetClass formWidgetClass = (WidgetClass)&formClassRec; static void XawFormRealize(Widget w, Mask *mask, XSetWindowAttributes *attr) { - XawPixmap *pixmap; - (*formWidgetClass->core_class.superclass->core_class.realize)(w, mask, attr); if (w->core.background_pixmap > XtUnspecifiedPixmap) { - pixmap = XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), - w->core.colormap, (int)w->core.depth); + XawPixmap *pixmap = + XawPixmapFromXPixmap(w->core.background_pixmap, XtScreen(w), + w->core.colormap, (int)w->core.depth); if (pixmap && pixmap->mask) XawReshapeWidget(w, pixmap); } @@ -781,8 +780,8 @@ XawFormResize(Widget w) fw->form.old_height, XtHeight(fw), form->form.bottom) - (y + (XtBorderWidth(*childP) << 1)); - form->form.virtual_width = width; - form->form.virtual_height = height; + form->form.virtual_width = (short)width; + form->form.virtual_height = (short)height; #endif width = width < 1 ? 1 : width; @@ -1022,10 +1021,8 @@ static void XawFormChangeManaged(Widget w) { FormWidget fw = (FormWidget)w; - FormConstraints form; WidgetList children, childP; int num_children = (int)fw->composite.num_children; - Widget child; (*((FormWidgetClass)w->core.widget_class)->form_class.layout) (fw, XtWidth(w), XtHeight(w), True); @@ -1035,7 +1032,8 @@ XawFormChangeManaged(Widget w) for (children = childP = fw->composite.children; childP - children < num_children; childP++) { - child = *childP; + FormConstraints form; + Widget child = *childP; if (!XtIsManaged(child)) continue; form = (FormConstraints)child->core.constraints; diff --git a/lib/libXaw/src/Grip.c b/lib/libXaw/src/Grip.c index 1682a757b..63cc2ff04 100644 --- a/lib/libXaw/src/Grip.c +++ b/lib/libXaw/src/Grip.c @@ -160,6 +160,9 @@ GripClassRec gripClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* grip */ { @@ -175,11 +178,11 @@ WidgetClass gripWidgetClass = (WidgetClass)&gripClassRec; static void GripAction(Widget widget, XEvent *event, String *params, Cardinal *num_params) { - XawGripCallDataRec call_data; - - call_data.event = event; - call_data.params = params; - call_data.num_params = *num_params; + XawGripCallDataRec call_data = { + .event = event, + .params = params, + .num_params = *num_params + }; XtCallCallbacks(widget, XtNcallback, (XtPointer)&call_data); } diff --git a/lib/libXaw/src/Label.c b/lib/libXaw/src/Label.c index cec1875cf..bb82706dc 100644 --- a/lib/libXaw/src/Label.c +++ b/lib/libXaw/src/Label.c @@ -253,6 +253,9 @@ LabelClassRec labelClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* label */ { @@ -355,10 +358,10 @@ SetTextWidthAndHeight(LabelWidget lw) label = nl + 1; if (*label) lw->label.label_height += - fs->max_bounds.ascent + fs->max_bounds.descent; + (Dimension)(fs->max_bounds.ascent + fs->max_bounds.descent); } if (*label) { - int width = XTextWidth(fs, label, (int)strlen(label)); + int width; if (lw->label.encoding) width = XTextWidth16(fs, (XChar2b *)label, (int)(strlen(label) / 2)); @@ -384,12 +387,12 @@ SetTextWidthAndHeight(LabelWidget lw) static void GetNormalGC(LabelWidget lw) { - XGCValues values; - - values.foreground = lw->label.foreground; - values.background = lw->core.background_pixel; - values.font = lw->label.font->fid; - values.graphics_exposures = False; + XGCValues values = { + .foreground = lw->label.foreground, + .background = lw->core.background_pixel, + .font = lw->label.font->fid, + .graphics_exposures = False + }; if (lw->simple.international == True) /* Since Xmb/wcDrawString eats the font, I must use XtAllocateGC */ @@ -406,17 +409,17 @@ GetNormalGC(LabelWidget lw) static void GetGrayGC(LabelWidget lw) { - XGCValues values; - - values.foreground = lw->label.foreground; - values.background = lw->core.background_pixel; - values.font = lw->label.font->fid; - values.fill_style = FillTiled; - values.tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), - lw->label.foreground, - lw->core.background_pixel, - lw->core.depth); - values.graphics_exposures = False; + XGCValues values = { + .foreground = lw->label.foreground, + .background = lw->core.background_pixel, + .font = lw->label.font->fid, + .fill_style = FillTiled, + .tile = XmuCreateStippledPixmap(XtScreen((Widget)lw), + lw->label.foreground, + lw->core.background_pixel, + lw->core.depth), + .graphics_exposures = False + }; lw->label.stipple = values.tile; if (lw->simple.international == True) @@ -492,9 +495,9 @@ XawLabelInitialize(Widget request _X_UNUSED, Widget cnew, set_bitmap_info(lw); /* need core.height */ if (XtWidth(lw) == 0) /* need label.lbm_width */ - XtWidth(lw) = (lw->label.label_width - + (2 * lw->label.internal_width) - + LEFT_OFFSET(lw)); + XtWidth(lw) = (Dimension)(lw->label.label_width + + (unsigned)(2 * lw->label.internal_width) + + LEFT_OFFSET(lw)); lw->label.label_x = lw->label.label_y = 0; (*XtClass(cnew)->core_class.resize)((Widget)lw); @@ -511,10 +514,6 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) (*Superclass->core_class.expose)(gw, event, region); gc = XtIsSensitive(gw) ? w->label.normal_GC : w->label.gray_GC; -#ifdef notdef - if (region != NULL) - XSetRegion(XtDisplay(gw), gc, region); -#endif /*notdef*/ if (w->label.pixmap == None) { int len = w->label.label_len; @@ -532,7 +531,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) if (w->simple.international == True) { XFontSetExtents *ext = XExtentsOfFontSet(w->label.fontset); - ksy = (ksy + XawAbs(ext->max_ink_extent.y)); + ksy = (Position) (ksy + XawAbs(ext->max_ink_extent.y)); if (len == MULTI_LINE_LABEL) { char *nl; @@ -541,7 +540,7 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) XmbDrawString(XtDisplay(w), XtWindow(w), w->label.fontset, gc, w->label.label_x, ksy, label, (int)(nl - label)); - ksy = (ksy + ext->max_ink_extent.height); + ksy = (Position) (ksy + ext->max_ink_extent.height); label = nl + 1; } len = (int)strlen(label); @@ -562,8 +561,8 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) else XDrawString(XtDisplay(gw), XtWindow(gw), gc, w->label.label_x, y, label, (int)(nl - label)); - y += (w->label.font->max_bounds.ascent + - w->label.font->max_bounds.descent); + y += (Position) (w->label.font->max_bounds.ascent + + w->label.font->max_bounds.descent); label = nl + 1; } len = (int)strlen(label); @@ -586,11 +585,6 @@ XawLabelRedisplay(Widget gw, XEvent *event, Region region) XCopyArea(XtDisplay(gw), w->label.pixmap, XtWindow(gw), gc, 0, 0, w->label.label_width, w->label.label_height, w->label.label_x, w->label.label_y); - -#ifdef notdef - if (region != NULL) - XSetClipMask(XtDisplay(gw), gc, (Pixmap)None); -#endif /* notdef */ } static void @@ -598,7 +592,7 @@ _Reposition(LabelWidget lw, unsigned int width, unsigned int height, Position *dx, Position *dy) { Position newPos; - Position leftedge = (lw->label.internal_width + LEFT_OFFSET(lw)); + Position leftedge = (Position)(lw->label.internal_width + LEFT_OFFSET(lw)); switch (lw->label.justify) { case XtJustifyLeft: @@ -644,8 +638,8 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew, LabelWidget curlw = (LabelWidget)current; LabelWidget reqlw = (LabelWidget)request; LabelWidget newlw = (LabelWidget)cnew; - unsigned int i; Boolean was_resized = False, redisplay = False, checks[NUM_CHECKS]; + Cardinal i; for (i = 0; i < NUM_CHECKS; i++) checks[i] = False; @@ -700,9 +694,9 @@ XawLabelSetValues(Widget current, Widget request, Widget cnew, set_bitmap_info(newlw); if (XtWidth(curlw) == XtWidth(reqlw) && !checks[WIDTH]) - XtWidth(newlw) = (newlw->label.label_width - + LEFT_OFFSET(newlw) - + (unsigned)(newlw->label.internal_width << 1)); + XtWidth(newlw) = (Dimension)(newlw->label.label_width + + LEFT_OFFSET(newlw) + + (unsigned)(newlw->label.internal_width << 1)); } if (curlw->label.foreground != newlw->label.foreground @@ -753,9 +747,9 @@ XawLabelQueryGeometry(Widget w, XtWidgetGeometry *intended, LabelWidget lw = (LabelWidget)w; preferred->request_mode = CWWidth | CWHeight; - preferred->width = (lw->label.label_width - + (unsigned)(lw->label.internal_width << 1) - + LEFT_OFFSET(lw)); + preferred->width = (Dimension)(lw->label.label_width + + (unsigned)(lw->label.internal_width << 1) + + LEFT_OFFSET(lw)); preferred->height = (Dimension)(lw->label.label_height + (lw->label.internal_height << 1)); diff --git a/lib/libXaw/src/List.c b/lib/libXaw/src/List.c index de765974f..8a8758ca7 100644 --- a/lib/libXaw/src/List.c +++ b/lib/libXaw/src/List.c @@ -300,10 +300,15 @@ ListClassRec listClassRec = { NULL, /* callback_private */ defaultTranslations, /* tm_table */ XawListQueryGeometry, /* query_geometry */ + NULL, /* display_accelerator */ + NULL, /* extension */ }, /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* list */ { @@ -319,11 +324,11 @@ WidgetClass listWidgetClass = (WidgetClass)&listClassRec; static void GetGCs(Widget w) { - XGCValues values; ListWidget lw = (ListWidget)w; - - values.foreground = lw->list.foreground; - values.font = lw->list.font->fid; + XGCValues values = { + .foreground = lw->list.foreground, + .font = lw->list.font->fid + }; if (lw->simple.international == True) lw->list.normgc = XtAllocateGC(w, 0, GCForeground, &values, GCFont, 0); @@ -353,7 +358,6 @@ GetGCs(Widget w) static void CalculatedValues(Widget w) { - int i, len; ListWidget lw = (ListWidget)w; /* If list is NULL then the list will just be the name of the widget */ @@ -369,9 +373,13 @@ CalculatedValues(Widget w) /* Get column width */ if (LongestFree(lw)) { + int i; + lw->list.longest = 0; /* so it will accumulate real longest below */ for (i = 0 ; i < lw->list.nitems; i++) { + int len; + if (lw->simple.international == True) len = XmbTextEscapement(lw->list.fontset, lw->list.list[i], (int)strlen(lw->list.list[i])); @@ -432,11 +440,12 @@ ResetList(Widget w, Bool changex, Bool changey) static void ChangeSize(Widget w, unsigned int width, unsigned int height) { - XtWidgetGeometry request, reply; - - request.request_mode = CWWidth | CWHeight; - request.width = (Dimension)width; - request.height = (Dimension)height; + XtWidgetGeometry request = { + .request_mode = CWWidth | CWHeight, + .width = (Dimension)width, + .height = (Dimension)height + }; + XtWidgetGeometry reply; switch (XtMakeGeometryRequest(w, &request, &reply)) { case XtGeometryYes: @@ -668,12 +677,15 @@ HighlightBackground(Widget w, int x, int y, GC gc) static void ClipToShadowInteriorAndLongest(ListWidget lw, GC *gc_p, unsigned int x) { - XRectangle rect; + XRectangle rect = { + .x = (short)x, + .y = (short)lw->list.internal_height, + .height = (unsigned short) + (XtHeight(lw) - (lw->list.internal_height << 1)), + .width = (unsigned short) + (XtWidth(lw) - (unsigned)lw->list.internal_width - x), + }; - rect.x = (short)x; - rect.y = (short)lw->list.internal_height; - rect.height = (unsigned short)(XtHeight(lw) - (lw->list.internal_height << 1)); - rect.width = (unsigned short)(XtWidth(lw) - (unsigned)lw->list.internal_width - x); if (rect.width > lw->list.longest) rect.width = (unsigned short)lw->list.longest; @@ -980,7 +992,6 @@ Notify(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _ { ListWidget lw = (ListWidget)w; int item, item_len; - XawListReturnStruct ret_value; /* * Find item and if out of range then unhighlight and return @@ -1012,10 +1023,14 @@ Notify(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _ /* * Call Callback function */ - ret_value.string = lw->list.list[item]; - ret_value.list_index = item; + { + XawListReturnStruct ret_value = { + .string = lw->list.list[item], + .list_index = item + }; - XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value); + XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value); + } } /* Unset() - Action @@ -1178,7 +1193,7 @@ XawListDestroy(Widget w) * If nitems is <= 0 then the list needs to be NULL terminated */ void -XawListChange(Widget w, _Xconst char **list, int nitems, int longest, +XawListChange(Widget w, String *list, int nitems, int longest, #if NeedWidePrototypes int resize_it #else diff --git a/lib/libXaw/src/Makefile.am b/lib/libXaw/src/Makefile.am index b5f2bd145..fb39988d1 100644 --- a/lib/libXaw/src/Makefile.am +++ b/lib/libXaw/src/Makefile.am @@ -1,13 +1,5 @@ lib_LTLIBRARIES = -# -# This doesn't appear to be used on any -# current systems -- it requires SUNSHLIB and !SHAREDCODE, -# but only sunLib.rules defines SUNSHLIB and that file also -# always defines SHAREDCODE. Go figure -# -# SHAREDLIB_SOURCES = sharedlib.c - COMMON_SOURCES = \ Actions.c \ AllWidgets.c \ @@ -138,5 +130,3 @@ endif endif endif - -EXTRA_DIST = sharedlib.c diff --git a/lib/libXaw/src/Makefile.in b/lib/libXaw/src/Makefile.in index 28caee936..39338b2ee 100644 --- a/lib/libXaw/src/Makefile.in +++ b/lib/libXaw/src/Makefile.in @@ -306,6 +306,7 @@ XAW6_LIBS = @XAW6_LIBS@ XAW7_CFLAGS = @XAW7_CFLAGS@ XAW7_LIBS = @XAW7_LIBS@ XMLTO = @XMLTO@ +XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XORG_SGML_PATH = @XORG_SGML_PATH@ XSLTPROC = @XSLTPROC@ @@ -364,14 +365,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ lib_LTLIBRARIES = $(am__append_1) $(am__append_2) - -# -# This doesn't appear to be used on any -# current systems -- it requires SUNSHLIB and !SHAREDCODE, -# but only sunLib.rules defines SUNSHLIB and that file also -# always defines SHAREDCODE. Go figure -# -# SHAREDLIB_SOURCES = sharedlib.c COMMON_SOURCES = \ Actions.c \ AllWidgets.c \ @@ -453,7 +446,6 @@ AM_CPPFLAGS = \ @BUILD_XAW7_TRUE@libXaw7_la_LDFLAGS = -version-info 7:0:0 -no-undefined @BUILD_XAW7_TRUE@libXaw7_la_LIBADD = $(XAW7_LIBS) -EXTRA_DIST = sharedlib.c all: all-am .SUFFIXES: diff --git a/lib/libXaw/src/MenuButton.c b/lib/libXaw/src/MenuButton.c index ff75d9002..a6b93020c 100644 --- a/lib/libXaw/src/MenuButton.c +++ b/lib/libXaw/src/MenuButton.c @@ -128,7 +128,10 @@ MenuButtonClassRec menuButtonClassRec = { }, /* simple */ { - XtInheritChangeSensitive /* change_sensitive */ + XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* label */ { @@ -208,7 +211,9 @@ PopupMenu(Widget w, XEvent *event _X_UNUSED, String *params _X_UNUSED, Cardinal int menu_x, menu_y, menu_width, menu_height, button_height; Position button_x, button_y; - temp = w; + if ((temp = w) == NULL) + return; + while(temp != NULL) { menu = XtNameToWidget(temp, mbw->menu_button.menu_name); if (menu == NULL) diff --git a/lib/libXaw/src/MultiSink.c b/lib/libXaw/src/MultiSink.c index c9d51690a..6bb24658d 100644 --- a/lib/libXaw/src/MultiSink.c +++ b/lib/libXaw/src/MultiSink.c @@ -551,7 +551,6 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, TextWidget ctx = (TextWidget)XtParent(w); Widget source = ctx->text.source; XawTextPosition idx, pos; - wchar_t c; XFontSetExtents *ext = XExtentsOfFontSet(fontset); XawTextBlock blk; int i, rWidth; @@ -559,6 +558,8 @@ FindDistance(Widget w, XawTextPosition fromPos, int fromx, pos = XawTextSourceRead(source, fromPos, &blk, (int)(toPos - fromPos)); rWidth = 0; for (i = 0, idx = fromPos; idx < toPos; i++, idx++) { + wchar_t c; + if (i >= blk.length) { i = 0; XawTextSourceRead(source, pos, &blk, (int)(toPos - pos)); @@ -656,15 +657,15 @@ GetGC(MultiSinkObject sink) { XtGCMask valuemask = (GCGraphicsExposures | GCClipXOrigin | GCForeground | GCBackground); - XGCValues values; - - /* XXX We dont want do share a gc that will change the clip-mask */ - values.clip_x_origin = (int)(long)sink; - values.clip_mask = None; - values.graphics_exposures = False; - - values.foreground = sink->text_sink.foreground; - values.background = sink->text_sink.background; + XGCValues values = { + /* XXX We dont want to share a gc that will change the clip-mask */ + .clip_x_origin = (int)(long)sink, + .clip_mask = None, + .graphics_exposures = False, + + .foreground = sink->text_sink.foreground, + .background = sink->text_sink.background + }; sink->multi_sink.normgc = XtAllocateGC((Widget)sink, 0, valuemask, &values, GCFont | GCClipMask, 0); diff --git a/lib/libXaw/src/MultiSrc.c b/lib/libXaw/src/MultiSrc.c index a9e84baee..5d23396b3 100644 --- a/lib/libXaw/src/MultiSrc.c +++ b/lib/libXaw/src/MultiSrc.c @@ -75,6 +75,10 @@ in this Software without prior written authorization from The Open Group. #include <sys/stat.h> #include <fcntl.h> +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + #define MAGIC_VALUE ((XawTextPosition)-1) #define streq(a, b) (strcmp((a), (b)) == 0) @@ -331,7 +335,7 @@ ReadText(Widget w, XawTextPosition pos, XawTextBlock *text, int length) text->firstPos = (int)pos; text->ptr = (char *)(piece->text + (pos - start)); count = piece->used - (pos - start); - text->length = (Max(0, (length > count) ? count : length)); + text->length = (int)(Max(0, (length > count) ? count : length)); return (pos + text->length); } @@ -404,12 +408,15 @@ ReplaceText(Widget w, XawTextPosition startPos, XawTextPosition endPos, if (src->text_src.edit_mode == XawtextRead) return (XawEditError); - start_piece = FindPiece(src, startPos, &start_first); - end_piece = FindPiece(src, endPos, &end_first); + if ((start_piece = FindPiece(src, startPos, &start_first)) == NULL) + return XawEditError; + if ((end_piece = FindPiece(src, endPos, &end_first)) == NULL) + return XawEditError; /* STEP 3: remove the empty pieces... */ if (start_piece != end_piece) { - temp_piece = start_piece->next; + if ((temp_piece = start_piece->next) == NULL) + return XawEditError; /* If empty and not the only piece then remove it */ if (((start_piece->used = startPos - start_first) == 0) @@ -587,7 +594,6 @@ Scan(Widget w, register XawTextPosition position, XawTextScanType type, if (piece == NULL) /* Beginning of text */ return (0); ptr = piece->text + piece->used - 1; - c = *ptr; } else if (ptr >= piece->text + piece->used) { piece = piece->next; @@ -869,7 +875,7 @@ static void XawMultiSrcGetValuesHook(Widget w, ArgList args, Cardinal *num_args) { MultiSrcObject src = (MultiSrcObject)w; - unsigned int i; + Cardinal i; if (src->multi_src.type == XawAsciiString) { for (i = 0; i < *num_args ; i++) { @@ -1034,13 +1040,10 @@ Bool _XawMultiSaveAsFile(Widget w, _Xconst char* name) { MultiSrcObject src = (MultiSrcObject)w; - char * mb_string; - Bool ret; - - mb_string = StorePiecesInString(src); + char *mb_string = StorePiecesInString(src); if (mb_string != 0) { - ret = WriteToFile(mb_string, (String)name); + Bool ret = WriteToFile(mb_string, (String)name); XtFree(mb_string); return (ret); @@ -1089,7 +1092,7 @@ WriteToFile(String string, String name) int fd; Bool result = True; - if ((fd = creat(name, 0666)) == -1) + if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0666)) == -1) return (False); if (write(fd, string, strlen(string)) == -1) @@ -1215,7 +1218,7 @@ InitStringOrFile(MultiSrcObject src, Bool newString) XtErrorMsg("NoFile", "multiSourceCreate", "XawError", "Creating a read only disk widget and no file specified.", NULL, 0); - open_mode = O_RDONLY; + open_mode = O_RDONLY | O_CLOEXEC; fdopen_mode = "r"; break; case XawtextAppend: @@ -1225,9 +1228,9 @@ InitStringOrFile(MultiSrcObject src, Bool newString) src->multi_src.is_tempfile = True; } else { -/* O_NOFOLLOW is a BSD & Linux extension */ +/* O_NOFOLLOW was a FreeBSD & Linux extension, now adopted by POSIX */ #ifdef O_NOFOLLOW - open_mode = O_RDWR | O_NOFOLLOW; + open_mode = O_RDWR | O_NOFOLLOW | O_CLOEXEC; #else open_mode = O_RDWR; /* unsafe; subject to race conditions */ #endif @@ -1323,7 +1326,7 @@ LoadPieces(MultiSrcObject src, FILE *file, char *string) else { if (src->multi_src.length != 0) { temp_mb_holder = - XtMalloc(((size_t)(src->multi_src.length + 1) * sizeof(unsigned char))); + XtMalloc((Cardinal)((size_t)(src->multi_src.length + 1) * sizeof(unsigned char))); fseek(file, 0, SEEK_SET); src->multi_src.length = (XawTextPosition)fread(temp_mb_holder, sizeof(unsigned char), diff --git a/lib/libXaw/src/Paned.c b/lib/libXaw/src/Paned.c index 363c9692d..c7bc71cc6 100644 --- a/lib/libXaw/src/Paned.c +++ b/lib/libXaw/src/Paned.c @@ -466,6 +466,10 @@ PanedClassRec panedClassRec = { XawPanedPaneSetValues, /* set_values */ NULL, /* extension */ }, + /* paned */ + { + NULL, /* extension */ + } }; WidgetClass panedWidgetClass = (WidgetClass)&panedClassRec; @@ -506,7 +510,7 @@ AdjustPanedSize(PanedWidget pw, unsigned int off_size, int size = Max(PaneInfo(*childP)->size, (int)PaneInfo(*childP)->min); AssignMin(size, (int)PaneInfo(*childP)->max); - newsize = (newsize + (size + pw->paned.internal_bw)); + newsize = (Dimension)(newsize + (size + pw->paned.internal_bw)); } newsize = (Dimension)(newsize - pw->paned.internal_bw); @@ -792,9 +796,7 @@ static void CommitNewLocations(PanedWidget pw) { Widget *childP; - XWindowChanges changes; - - changes.stack_mode = Above; + XWindowChanges changes = { .stack_mode = Above }; ForAllPanes(pw, childP) { Pane pane = PaneInfo(*childP); @@ -910,7 +912,7 @@ static void _DrawInternalBorders(PanedWidget pw, GC gc) { Widget *childP; - int on_loc, off_loc; + int off_loc; unsigned int on_size, off_size; /* @@ -925,7 +927,7 @@ _DrawInternalBorders(PanedWidget pw, GC gc) on_size = (unsigned int)pw->paned.internal_bw; ForAllPanes(pw, childP) { - on_loc = IsVert(pw) ? XtY(*childP) : XtX(*childP); + int on_loc = IsVert(pw) ? XtY(*childP) : XtX(*childP); on_loc -= (int)on_size; _DrawRect(pw, gc, on_loc, off_loc, on_size, off_size); @@ -1041,7 +1043,6 @@ static void StartGripAdjustment(PanedWidget pw, Widget grip, Direction dir) { Widget *childP; - Cursor cursor; pw->paned.whichadd = pw->paned.whichsub = NULL; @@ -1054,6 +1055,8 @@ StartGripAdjustment(PanedWidget pw, Widget grip, Direction dir) * Change the cursor */ if (XtIsRealized(grip)) { + Cursor cursor; + if (IsVert(pw)) { if (dir == UpLeftPane) cursor = pw->paned.adjust_upper_cursor; @@ -1122,11 +1125,17 @@ MoveGripAdjustment(PanedWidget pw, Widget grip, Direction dir, int loc) if (dir == ThisBorderOnly) { int old_add_size = add_size, old_sub_size; + if (pw->paned.whichadd == NULL) + return; + AssignMax(add_size, (int)PaneInfo(pw->paned.whichadd)->min); AssignMin(add_size, (int)PaneInfo(pw->paned.whichadd)->max); if (add_size != old_add_size) sub_size += old_add_size - add_size; + if (pw->paned.whichsub == NULL) + return; + old_sub_size = sub_size; AssignMax(sub_size, (int)PaneInfo(pw->paned.whichsub)->min); AssignMin(sub_size, (int)PaneInfo(pw->paned.whichsub)->max); @@ -1452,7 +1461,6 @@ ChangeAllGripCursors(PanedWidget pw) Widget *childP; ForAllPanes(pw, childP) { - Arg arglist[1]; Cursor cursor; if ((cursor = pw->paned.grip_cursor) == None) { @@ -1463,6 +1471,8 @@ ChangeAllGripCursors(PanedWidget pw) } if (HasGrip(*childP)) { + Arg arglist[1]; + XtSetArg(arglist[0], XtNcursor, cursor); XtSetValues(PaneInfo(*childP)->grip, arglist, 1); } diff --git a/lib/libXaw/src/Panner.c b/lib/libXaw/src/Panner.c index 9f3262038..8898163e8 100644 --- a/lib/libXaw/src/Panner.c +++ b/lib/libXaw/src/Panner.c @@ -39,12 +39,7 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xaw/PannerP.h> #include <X11/Xaw/XawInit.h> #include "Private.h" - -#if defined(ISC) && __STDC__ && !defined(ISC30) -extern double atof(char *); -#else #include <stdlib.h> /* for atof() */ -#endif /* * Class Methods @@ -342,7 +337,7 @@ WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec; static void reset_shadow_gc(PannerWidget pw) { - XtGCMask valuemask = GCForeground; + XtGCMask valuemask; XGCValues values; unsigned long pixels[3]; @@ -981,11 +976,11 @@ ActionPage(Widget gw, XEvent *event, String *params, Cardinal *num_params) y += pw->panner.knob_y; if (isin) { /* if in, then use move */ - XEvent ev; - - ev.xbutton.type = ButtonPress; - ev.xbutton.x = x; - ev.xbutton.y = y; + XEvent ev = { + .xbutton.type = ButtonPress, + .xbutton.x = x, + .xbutton.y = y + }; ActionMove(gw, &ev, NULL, &zero); } else { diff --git a/lib/libXaw/src/Pixmap.c b/lib/libXaw/src/Pixmap.c index 7072eb3bd..0083b8cd4 100644 --- a/lib/libXaw/src/Pixmap.c +++ b/lib/libXaw/src/Pixmap.c @@ -469,14 +469,15 @@ _XawFindCache(XawCache *xaw, static XawCache * _XawGetCache(XawCache *xaw, Screen *screen, Colormap colormap, int depth) { - XawCache *s_cache, *c_cache, *d_cache, *cache, *pcache; + XawCache *cache; cache = _XawFindCache(xaw, screen, colormap, depth, FIND_ALL); if (!cache) { - s_cache = _XawFindCache(xaw, - screen, colormap, depth, FIND_SCREEN); + XawCache *c_cache, *d_cache, *pcache; + XawCache *s_cache = _XawFindCache(xaw, + screen, colormap, depth, FIND_SCREEN); if (!s_cache) { pcache = (XawCache *)XtMalloc(sizeof(XawCache)); @@ -664,7 +665,7 @@ GetResourcePixmapPath(Display *display) XrmRepresentation rep_type; XrmValue value; static char *default_path = - "%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N"; + (char*)"%H/%T/%N:%P/include/X11/%T/%N:/usr/X11R6/include/X11/%T/%N:/usr/include/X11/%T/%N:%N"; xrm_name[0] = XrmPermStringToQuark("pixmapFilePath"); xrm_name[1] = NULLQUARK; @@ -707,7 +708,6 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, { Pixel fg, bg; XColor color, exact; - Pixmap pixmap; unsigned int width, height; unsigned char *data = NULL; int hotX, hotY; @@ -716,8 +716,8 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, static SubstitutionRec sub[] = { {'H', NULL}, {'N', NULL}, - {'T', "bitmaps"}, - {'P', PROJECT_ROOT}, + {'T', (_XtString) "bitmaps"}, + {'P', (_XtString) PROJECT_ROOT}, }; char *filename; @@ -747,7 +747,7 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, { if (!sub[0].substitution) sub[0].substitution = getenv("HOME"); - sub[1].substitution = params->name; + sub[1].substitution = (_XtString)params->name; if (pixmap_path == NULL) GetResourcePixmapPath(DisplayOfScreen(screen)); filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL); @@ -755,15 +755,16 @@ BitmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, return (FALSE); } else - filename = params->name; + filename = (char*)params->name; if (XReadBitmapFileData(filename, &width, &height, &data, &hotX, &hotY) == BitmapSuccess) { - pixmap = XCreatePixmapFromBitmapData(DisplayOfScreen(screen), - RootWindowOfScreen(screen), - (char *)data, - width, height, fg, bg, (unsigned)depth); + Pixmap pixmap = + XCreatePixmapFromBitmapData(DisplayOfScreen(screen), + RootWindowOfScreen(screen), + (char *)data, + width, height, fg, bg, (unsigned)depth); if (data) XFree(data); *pixmap_return = pixmap; @@ -828,7 +829,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, value = NULL; if ((argval = XawFindArgVal(params, "start")) != NULL) - value = argval->value; + value = (char*)argval->value; if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value, &start, &color)) return (False); @@ -839,7 +840,7 @@ GradientLoader(XawParams *params, Screen *screen, Colormap colormap, int depth, } value = NULL; if ((argval = XawFindArgVal(params, "end")) != NULL) - value = argval->value; + value = (char*)argval->value; if (value && !XAllocNamedColor(DisplayOfScreen(screen), colormap, value, &end, &color)) return (False); @@ -936,8 +937,8 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X static SubstitutionRec sub[] = { {'H', NULL}, {'N', NULL}, - {'T', "pixmaps"}, - {'P', PROJECT_ROOT}, + {'T', (_XtString) "pixmaps"}, + {'P', (_XtString) PROJECT_ROOT}, }; const char *filename; @@ -949,7 +950,7 @@ XPixmapLoader(XawParams *params, Screen *screen, Colormap colormap, int depth _X { if (!sub[0].substitution) sub[0].substitution = getenv("HOME"); - sub[1].substitution = params->name; + sub[1].substitution = (_XtString)params->name; if (pixmap_path == NULL) GetResourcePixmapPath(DisplayOfScreen(screen)); filename = XtFindFile(pixmap_path, sub, XtNumber(sub), NULL); diff --git a/lib/libXaw/src/Porthole.c b/lib/libXaw/src/Porthole.c index c87be98b5..2bbf967f8 100644 --- a/lib/libXaw/src/Porthole.c +++ b/lib/libXaw/src/Porthole.c @@ -153,15 +153,15 @@ SendReport(PortholeWidget pw, unsigned int changed) Widget child = find_child(pw); if (pw->porthole.report_callbacks && child) { - XawPannerReport prep; - - prep.changed = changed; - prep.slider_x = (Position)(-XtX(child)); /* porthole is "inner" */ - prep.slider_y = (Position)(-XtY(child)); /* child is outer since it is larger */ - prep.slider_width = XtWidth(pw); - prep.slider_height = XtHeight(pw); - prep.canvas_width = XtWidth(child); - prep.canvas_height = XtHeight(child); + XawPannerReport prep = { + .changed = changed, + .slider_x = (Position)(-XtX(child)), /* porthole is "inner" */ + .slider_y = (Position)(-XtY(child)), /* child is outer since it is larger */ + .slider_width = XtWidth(pw), + .slider_height = XtHeight(pw), + .canvas_width = XtWidth(child), + .canvas_height = XtHeight(child) + }; XtCallCallbackList((Widget)pw, pw->porthole.report_callbacks, (XtPointer)&prep); } @@ -351,9 +351,8 @@ XawPortholeChangeManaged(Widget gw) if (child) { if (!XtIsRealized (gw)) { - XtWidgetGeometry geom, retgeom; + XtWidgetGeometry geom = { .request_mode = 0 }, retgeom; - geom.request_mode = 0; if (XtWidth(pw) == 0) { geom.width = XtWidth(child); geom.request_mode |= CWWidth; diff --git a/lib/libXaw/src/Repeater.c b/lib/libXaw/src/Repeater.c index 19537b428..fc39c5e97 100644 --- a/lib/libXaw/src/Repeater.c +++ b/lib/libXaw/src/Repeater.c @@ -190,6 +190,9 @@ RepeaterClassRec repeaterClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* label */ { diff --git a/lib/libXaw/src/Scrollbar.c b/lib/libXaw/src/Scrollbar.c index 5bc8db9eb..ac75083b4 100644 --- a/lib/libXaw/src/Scrollbar.c +++ b/lib/libXaw/src/Scrollbar.c @@ -316,6 +316,9 @@ ScrollbarClassRec scrollbarClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* scrollbar */ { diff --git a/lib/libXaw/src/Simple.c b/lib/libXaw/src/Simple.c index ae322cb48..189a2ffbd 100644 --- a/lib/libXaw/src/Simple.c +++ b/lib/libXaw/src/Simple.c @@ -225,6 +225,9 @@ SimpleClassRec simpleClassRec = { /* simple */ { ChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, }; diff --git a/lib/libXaw/src/SimpleMenu.c b/lib/libXaw/src/SimpleMenu.c index 4ac62a57d..744d6c905 100644 --- a/lib/libXaw/src/SimpleMenu.c +++ b/lib/libXaw/src/SimpleMenu.c @@ -272,6 +272,9 @@ static CompositeClassExtensionRec extension_rec = { XtCompositeExtensionVersion, /* version */ sizeof(CompositeClassExtensionRec), /* record_size */ True, /* accepts_objects */ +#ifndef OLDXAW + False, /* allows_change_managed_set */ +#endif }; #define Superclass (&overrideShellClassRec) @@ -1070,7 +1073,9 @@ CreateLabel(Widget w) *next_child = *child; next_child = child; } - *child = (Widget)smw->simple_menu.label; + + if (child != NULL) + *child = (Widget)smw->simple_menu.label; } /* @@ -1105,8 +1110,6 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) short vadd, hadd, x_ins, y_ins; Dimension *widths; - height = 0; - if (XtIsSubclass(w, simpleMenuWidgetClass)) { smw = (SimpleMenuWidget)w; current_entry = NULL; @@ -1196,7 +1199,7 @@ Layout(Widget w, Dimension *width_ret, Dimension *height_ret) ++n; } - height = (tmp_h + smw->simple_menu.bottom_margin); + height = (Dimension)(tmp_h + smw->simple_menu.bottom_margin); width = (Dimension)(width + tmp_w); if (smw->simple_menu.label && width < XtWidth(smw->simple_menu.label)) { @@ -1306,12 +1309,14 @@ AddPositionAction(XtAppContext app_con, XPointer data _X_UNUSED) static Widget FindMenu(Widget widget, String name) { - Widget w, menu; + Widget w; - for (w = widget; w != NULL; w = XtParent(w)) - if ((menu = XtNameToWidget(w, name)) != NULL) - return (menu); + for (w = widget; w != NULL; w = XtParent(w)) { + Widget menu = XtNameToWidget(w, name); + if (menu != NULL) + return (menu); + } return (NULL); } @@ -1458,11 +1463,12 @@ static void MakeSetValuesRequest(Widget w, unsigned int width, unsigned int height) { SimpleMenuWidget smw = (SimpleMenuWidget)w; - Arg arglist[2]; - Cardinal num_args = 0; if (!smw->simple_menu.recursive_set_values) { if (XtWidth(smw) != width || XtHeight(smw) != height) { + Arg arglist[2]; + Cardinal num_args = 0; + smw->simple_menu.recursive_set_values = True; XtSetArg(arglist[num_args], XtNwidth, width); num_args++; XtSetArg(arglist[num_args], XtNheight, height); num_args++; @@ -1553,7 +1559,6 @@ GetEventEntry(Widget w, XEvent *event) */ if (x_root == WidthOfScreen(XtScreen(w)) - 1 && XtX(w) + XtWidth(w) + (XtBorderWidth(w)) > x_root) { - warp = -8; if (smw->simple_menu.entry_set) { entry = DoGetEventEntry(w, XtX(smw->simple_menu.entry_set) diff --git a/lib/libXaw/src/SmeBSB.c b/lib/libXaw/src/SmeBSB.c index 380a21555..d4653f7b4 100644 --- a/lib/libXaw/src/SmeBSB.c +++ b/lib/libXaw/src/SmeBSB.c @@ -705,15 +705,16 @@ static void CreateGCs(Widget w) { SmeBSBObject entry = (SmeBSBObject)w; - XGCValues values; - XtGCMask mask, mask_i18n; + XGCValues values = { + .foreground = XtParent(w)->core.background_pixel, + .background = entry->sme_bsb.foreground, + .font = entry->sme_bsb.font->fid, + .graphics_exposures = False + }; + + XtGCMask mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont; + XtGCMask mask_i18n = GCForeground | GCBackground | GCGraphicsExposures; - values.foreground = XtParent(w)->core.background_pixel; - values.background = entry->sme_bsb.foreground; - values.font = entry->sme_bsb.font->fid; - values.graphics_exposures = False; - mask = GCForeground | GCBackground | GCGraphicsExposures | GCFont; - mask_i18n = GCForeground | GCBackground | GCGraphicsExposures; if (entry->sme.international == True) entry->sme_bsb.rev_gc = XtAllocateGC(w, 0, mask_i18n, &values, GCFont, 0); else diff --git a/lib/libXaw/src/SmeLine.c b/lib/libXaw/src/SmeLine.c index 350b3fd41..22980323c 100644 --- a/lib/libXaw/src/SmeLine.c +++ b/lib/libXaw/src/SmeLine.c @@ -181,12 +181,12 @@ static void CreateGC(Widget w) { SmeLineObject entry = (SmeLineObject)w; - XGCValues values; XtGCMask mask = GCForeground | GCGraphicsExposures | GCLineWidth; - - values.foreground = entry->sme_line.foreground; - values.graphics_exposures = False; - values.line_width = entry->sme_line.line_width; + XGCValues values = { + .foreground = entry->sme_line.foreground, + .graphics_exposures = False, + .line_width = entry->sme_line.line_width + }; if (entry->sme_line.stipple != XtUnspecifiedPixmap) { values.stipple = entry->sme_line.stipple; diff --git a/lib/libXaw/src/StripChart.c b/lib/libXaw/src/StripChart.c index 942a7d51a..a710337e7 100644 --- a/lib/libXaw/src/StripChart.c +++ b/lib/libXaw/src/StripChart.c @@ -318,7 +318,7 @@ static void draw_it(XtPointer client_data, XtIntervalId *id _X_UNUSED) { StripChartWidget w = (StripChartWidget)client_data; - double value; + double value = 0.0; if (w->strip_chart.update > 0) w->strip_chart.interval_id = @@ -385,7 +385,6 @@ draw_it(XtPointer client_data, XtIntervalId *id _X_UNUSED) static int repaint_window(StripChartWidget w, int left, int width) { - int i, j; int next = w->strip_chart.interval; int scale = w->strip_chart.scale; int scalewidth = 0; @@ -410,6 +409,7 @@ repaint_window(StripChartWidget w, int left, int width) } if (XtIsRealized((Widget)w)) { + int i; Display *dpy = XtDisplay(w); Window win = XtWindow(w); @@ -434,7 +434,7 @@ repaint_window(StripChartWidget w, int left, int width) /* Draw graph reference lines */ for (i = 1; i < w->strip_chart.scale; i++) { - j = i * ((int)XtHeight(w) / w->strip_chart.scale); + int j = i * ((int)XtHeight(w) / w->strip_chart.scale); XDrawLine(dpy, win, w->strip_chart.hiGC, left, j, scalewidth, j); } } diff --git a/lib/libXaw/src/Text.c b/lib/libXaw/src/Text.c index da15a3795..960214c98 100644 --- a/lib/libXaw/src/Text.c +++ b/lib/libXaw/src/Text.c @@ -474,9 +474,7 @@ static XtResource resources[] = { { toVal->size = sizeof(type); toVal->addr = (XPointer)address; } static XrmQuark QWrapNever, QWrapLine, QWrapWord; -#ifndef notdef static XrmQuark QScrollNever, QScrollWhenNeeded, QScrollAlways; -#endif static XrmQuark QJustifyLeft, QJustifyRight, QJustifyCenter, QJustifyFull; /*ARGSUSED*/ @@ -795,7 +793,7 @@ CreateVScrollBar(TextWidget ctx) XtAddCallback(vbar, XtNscrollProc, VScroll, (XtPointer)ctx); XtAddCallback(vbar, XtNjumpProc, VJump, (XtPointer)ctx); - ctx->text.r_margin.left += (XtWidth(vbar) + XtBorderWidth(vbar)); + ctx->text.r_margin.left += (Position) (XtWidth(vbar) + XtBorderWidth(vbar)); ctx->text.left_margin = ctx->text.margin.left = ctx->text.r_margin.left; PositionVScrollBar(ctx); @@ -950,7 +948,7 @@ XawTextInitialize(Widget request _X_UNUSED, Widget cnew, if (XtHeight(ctx) == DEFAULT_TEXT_HEIGHT) { XtHeight(ctx) = (Dimension)VMargins(ctx); if (ctx->text.sink != NULL) - XtHeight(ctx) += XawTextSinkMaxHeight(ctx->text.sink, 1); + XtHeight(ctx) += (Dimension) XawTextSinkMaxHeight(ctx->text.sink, 1); } if (ctx->text.scroll_vert == XawtextScrollAlways) @@ -1069,14 +1067,16 @@ void _XawTextNeedsUpdating(TextWidget ctx, XawTextPosition left, XawTextPosition right) { - XmuSegment segment; - if (left >= right) return; + else { + XmuSegment segment = { + .x1 = (int)left, + .x2 = (int)right + }; - segment.x1 = (int)left; - segment.x2 = (int)right; - (void)XmuScanlineOrSegment(ctx->text.update, &segment); + (void)XmuScanlineOrSegment(ctx->text.update, &segment); + } } /* @@ -1124,18 +1124,15 @@ _XawTextGetText(TextWidget ctx, XawTextPosition left, XawTextPosition right) char * _XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right) { - unsigned char *s; - unsigned char c; - long i, j, n; - wchar_t *ws, wc; - /* allow ESC in accordance with ICCCM */ if (XawTextFormat(ctx, XawFmtWide)) { MultiSinkObject sink = (MultiSinkObject)ctx->text.sink; - ws = (wchar_t *)_XawTextGetText(ctx, left, right); - n = (long)wcslen(ws); + wchar_t *ws = (wchar_t *)_XawTextGetText(ctx, left, right); + long n = (long)wcslen(ws); + long i, j; + for (j = 0, i = 0; j < n; j++) { - wc = ws[j]; + wchar_t wc = ws[j]; if (XwcTextEscapement (sink->multi_sink.fontset, &wc, 1) || (wc == _Xaw_atowc(XawTAB)) || (wc == _Xaw_atowc(XawLF)) || (wc == _Xaw_atowc(XawESC))) @@ -1145,12 +1142,13 @@ _XawTextGetSTRING(TextWidget ctx, XawTextPosition left, XawTextPosition right) return ((char *)ws); } else { - s = (unsigned char *)_XawTextGetText(ctx, left, right); + unsigned char *s = (unsigned char *)_XawTextGetText(ctx, left, right); /* only HT and NL control chars are allowed, strip out others */ - n = (long)strlen((char *)s); - i = 0; + long n = (long)strlen((char *)s); + long i = 0, j; + for (j = 0; j < n; j++) { - c = s[j]; + unsigned char c = s[j]; if (((c >= 0x20) && c <= 0x7f) ||(c >= 0xa0) || (c == XawTAB) || (c == XawLF) || (c == XawESC)) { @@ -1222,14 +1220,15 @@ static Bool LineAndXYForPosition(TextWidget ctx, XawTextPosition pos, int *line, int *x, int *y) { - XawTextPosition linePos, endPos; Boolean visible; - int realW, realH; *line = 0; *x = ctx->text.left_margin; *y = ctx->text.margin.top + 1; if ((visible = IsPositionVisible(ctx, pos)) != False) { + XawTextPosition linePos, endPos; + int realW, realH; + *line = LineForPosition(ctx, pos); *y = ctx->text.lt.info[*line].y; linePos = ctx->text.lt.info[*line].position; @@ -1252,12 +1251,11 @@ void _XawTextBuildLineTable(TextWidget ctx, XawTextPosition position, _XtBoolean force_rebuild) { - Dimension height = 0; int lines = 0; Cardinal size; if ((int)XtHeight(ctx) > VMargins(ctx)) { - height = (Dimension)(XtHeight(ctx) - VMargins(ctx)); + Dimension height = (Dimension)(XtHeight(ctx) - VMargins(ctx)); lines = XawTextSinkMaxLines(ctx->text.sink, height); } size = (Cardinal)(sizeof(XawTextLineTableEntry) * (size_t)(lines + 1)); @@ -1385,7 +1383,7 @@ _BuildLineTable(TextWidget ctx, XawTextPosition position, int line) if (lt->textWidth != (Cardinal)width) { if (lt->textWidth > (Cardinal)width) ctx->text.clear_to_eol = True; - lt->textWidth = (unsigned)width; + lt->textWidth = (Dimension)width; } y = (Position)(y + height); @@ -1486,9 +1484,11 @@ GetWidestLine(TextWidget ctx) void _XawTextSetScrollBars(TextWidget ctx) { - float first, last, denom, widest; + float first; if (ctx->text.scroll_vert == XawtextScrollAlways) { + float last; + if (ctx->text.lastPos == 0) first = 0.0; else @@ -1504,7 +1504,10 @@ _XawTextSetScrollBars(TextWidget ctx) } if (ctx->text.scroll_horiz == XawtextScrollAlways) { - denom = (float)GetWidestLine(ctx); + unsigned value = GetWidestLine(ctx); + float denom = (float)value; + float widest; + if (denom <= 0) denom = (float)((int)XtWidth(ctx) - RHMargins(ctx)); if (denom <= 0) @@ -1712,7 +1715,6 @@ XawTextScroll(TextWidget ctx, int vlines, int hpixels) else { update_from = lt->info[lt->lines - vlines].position; update_to = lt->info[lt->lines].position; - y1 = lt->info[lt->lines - vlines].y; y2 = lt->info[vlines].y; DoCopyArea(ctx, ctx->text.r_margin.left, y2, (unsigned)vwidth, (unsigned)(lt->info[lt->lines].y - y2), @@ -1762,10 +1764,11 @@ HJump(Widget w, XtPointer closure, XtPointer callData) { TextWidget ctx = (TextWidget)closure; float percent = *(float *)callData; + unsigned value = GetWidestLine(ctx); long pixels; pixels = ctx->text.left_margin - - (ctx->text.r_margin.left - (int)(percent * (float)GetWidestLine(ctx))); + (ctx->text.r_margin.left - (int)(percent * (float)value)); HScroll(w, (XtPointer)ctx, (XtPointer)pixels); } @@ -1956,7 +1959,6 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, TextWidget ctx = (TextWidget)w; Widget src = ctx->text.source; XawTextEditType edit_mode; - Arg args[1]; XawTextSelectionSalt *salt = NULL; XawTextSelection *s; @@ -1966,9 +1968,12 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, if (SrcCvtSel(src, selection, target, type, value, length, format)) return (True); + else { + Arg args[1]; - XtSetArg(args[0], XtNeditType, &edit_mode); - XtGetValues(src, args, ONE); + XtSetArg(args[0], XtNeditType, &edit_mode); + XtGetValues(src, args, ONE); + } XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, (XPointer*)&std_targets, @@ -2045,20 +2050,21 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, *length = strlen((char *)*value); } else { - *value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char))); + *value = XtMalloc((Cardinal)((size_t)(salt->length + 1) * sizeof(unsigned char))); strcpy ((char *)*value, salt->contents); *length = (unsigned long)salt->length; } /* Got *value,*length, now in COMPOUND_TEXT format. */ if (XawTextFormat(ctx, XawFmtWide) && *type == XA_STRING) { - XTextProperty textprop; wchar_t **wlist; int count; + XTextProperty textprop = { + .encoding = XA_COMPOUND_TEXT(d), + .value = (unsigned char *)*value, + .nitems = strlen(*value), + .format = 8 + }; - textprop.encoding = XA_COMPOUND_TEXT(d); - textprop.value = (unsigned char *)*value; - textprop.nitems = strlen(*value); - textprop.format = 8; if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) < Success || count < 1) { @@ -2075,14 +2081,15 @@ TextConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, *length = textprop.nitems; XwcFreeStringList(wlist); } else if (*type == XA_UTF8_STRING(d)) { - XTextProperty textprop; char **list; int count; + XTextProperty textprop = { + .encoding = XA_COMPOUND_TEXT(d), + .value = (unsigned char *)*value, + .nitems = strlen(*value), + .format = 8 + }; - textprop.encoding = XA_COMPOUND_TEXT(d); - textprop.value = (unsigned char *)*value; - textprop.nitems = strlen(*value); - textprop.format = 8; if (Xutf8TextPropertyToTextList(d, &textprop, &list, &count) < Success || count < 1) { @@ -2352,10 +2359,10 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right, if (left < right) { Widget w = (Widget)ctx; - int buffer; while (count) { Atom selection = selections[--count]; + int buffer; /* * If this is a cut buffer @@ -2396,7 +2403,7 @@ _SetSelection(TextWidget ctx, XawTextPosition left, XawTextPosition right, while (len > max_len) { len -= max_len; tptr += max_len; - amount = Min (len, max_len); + amount = (unsigned) Min (len, max_len); XChangeProperty(XtDisplay(w), RootWindow(XtDisplay(w), 0), selection, XA_STRING, 8, PropModeAppend, tptr, (int)amount); @@ -2679,12 +2686,13 @@ OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right) TextWidget ctx = (TextWidget)w; int x, y, line; - XawTextPosition start, end, last, final; + XawTextPosition last; XmuScanline *scan; XmuSegment *seg; XmuArea *clip = NULL; Bool cleol = ctx->text.clear_to_eol; Bool has_selection = ctx->text.s.right > ctx->text.s.left; + XawTextPosition start; left = left < ctx->text.lt.top ? ctx->text.lt.top : left; @@ -2697,7 +2705,10 @@ OldDisplayText(Widget w, XawTextPosition left, XawTextPosition right) if (cleol) clip = XmuCreateArea(); - for (start = left; start < right && line < ctx->text.lt.lines; line++) { + for (start = left; + start < right && line < ctx->text.lt.lines; line++) { + XawTextPosition end, final; + if ((end = ctx->text.lt.info[line + 1].position) > right) end = right; @@ -2756,10 +2767,11 @@ DisplayText(Widget w, XawTextPosition left, XawTextPosition right) TextWidget ctx = (TextWidget)w; int y, line; - XawTextPosition from, to, lastPos; + XawTextPosition lastPos; Bool cleol = ctx->text.clear_to_eol; Bool has_selection = ctx->text.s.right > ctx->text.s.left; XawTextPaintList *paint_list; + XawTextPosition from; left = left < ctx->text.lt.top ? ctx->text.lt.top : left; @@ -2773,8 +2785,11 @@ DisplayText(Widget w, XawTextPosition left, XawTextPosition right) paint_list = ((TextSinkObject)ctx->text.sink)->text_sink.paint; - for (from = left; from < right && line < ctx->text.lt.lines; line++) { - if ((to = ctx->text.lt.info[line + 1].position) > right) + for (from = left; + from < right && line < ctx->text.lt.lines; line++) { + XawTextPosition to = ctx->text.lt.info[line + 1].position; + + if (to > right) to = right; if (to > lastPos) @@ -2834,7 +2849,7 @@ static void DoSelection(TextWidget ctx, XawTextPosition pos, Time time, Bool motion) { XawTextPosition newLeft, newRight; - XawTextSelectType newType, *sarray; + XawTextSelectType newType; Widget src = ctx->text.source; if (motion) @@ -2842,7 +2857,8 @@ DoSelection(TextWidget ctx, XawTextPosition pos, Time time, Bool motion) else { if ((labs((long) time - (long) ctx->text.lasttime) < MULTI_CLICK_TIME) && (pos >= ctx->text.s.left && pos <= ctx->text.s.right)) { - sarray = ctx->text.sarray; + XawTextSelectType *sarray = ctx->text.sarray; + for (; *sarray != XawselectNull && *sarray != ctx->text.s.type; sarray++) ; @@ -3062,7 +3078,7 @@ _XawTextClearAndCenterDisplay(TextWidget ctx) left_margin == ctx->text.left_margin) { int insert_line = LineForPosition(ctx, ctx->text.insertPos); int scroll_by = insert_line - (ctx->text.lt.lines >> 1); - Boolean clear_to_eol = ctx->text.clear_to_eol; + Boolean clear_to_eol; XawTextScroll(ctx, scroll_by, 0); SinkClearToBG(ctx->text.sink, 0, 0, XtWidth(ctx), XtHeight(ctx)); @@ -3348,11 +3364,11 @@ CountLines(TextWidget ctx, XawTextPosition left, XawTextPosition right) if (ctx->text.wrap == XawtextWrapNever || left >= right) return (1); else { - XawTextPosition tmp; int dim, lines = 0, wwidth = GetMaxTextWidth(ctx); while (left < right) { - tmp = left; + XawTextPosition tmp = left; + XawTextSinkFindPosition(ctx->text.sink, left, ctx->text.left_margin, wwidth, ctx->text.wrap == XawtextWrapWord, diff --git a/lib/libXaw/src/TextAction.c b/lib/libXaw/src/TextAction.c index 5eae39ea8..09e22f29c 100644 --- a/lib/libXaw/src/TextAction.c +++ b/lib/libXaw/src/TextAction.c @@ -403,14 +403,14 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection _X_UNUSED, StartAction(ctx, NULL); if (XawTextFormat(ctx, XawFmtWide)) { - XTextProperty textprop; wchar_t **wlist; int count; - - textprop.encoding = *type; - textprop.value = (unsigned char *)value; - textprop.nitems = strlen(value); - textprop.format = 8; + XTextProperty textprop = { + .encoding = *type, + .value = (unsigned char *)value, + .nitems = strlen(value), + .format = 8 + }; if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) != Success @@ -421,7 +421,7 @@ _SelectionReceived(Widget w, XtPointer client_data, Atom *selection _X_UNUSED, fprintf(stderr, "Xaw Text Widget: An attempt was made to insert " "an illegal selection.\n"); - textprop.value = (const unsigned char *)" >> ILLEGAL SELECTION << "; + textprop.value = (unsigned char *)" >> ILLEGAL SELECTION << "; textprop.nitems = strlen((char *) textprop.value); if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) != Success @@ -950,7 +950,6 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, TextWidget ctx = (TextWidget)w; Widget src = ctx->text.source; XawTextEditType edit_mode; - Arg args[1]; XawTextSelectionSalt *salt = NULL; XawTextSelection *s; @@ -960,9 +959,12 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, if (SrcCvtSel(src, selection, target, type, value, length, format)) return (True); + else { + Arg args[1]; - XtSetArg(args[0], XtNeditType,&edit_mode); - XtGetValues(src, args, 1); + XtSetArg(args[0], XtNeditType,&edit_mode); + XtGetValues(src, args, 1); + } XmuConvertStandardSelection(w, ctx->text.time, selection, target, type, (XPointer *)&std_targets, @@ -1035,21 +1037,22 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, *length = strlen(*value); } else { - *value = XtMalloc(((size_t)(salt->length + 1) * sizeof(unsigned char))); + *value = XtMalloc((Cardinal)((size_t)(salt->length + 1) * sizeof(unsigned char))); strcpy (*value, salt->contents); *length = (unsigned long)salt->length; } /* Got *value,*length, now in COMPOUND_TEXT format. */ if (XawTextFormat(ctx, XawFmtWide)) { if (*type == XA_STRING) { - XTextProperty textprop; wchar_t **wlist; int count; + XTextProperty textprop = { + .encoding = XA_COMPOUND_TEXT(d), + .value = (unsigned char *)*value, + .nitems = strlen(*value), + .format = 8 + }; - textprop.encoding = XA_COMPOUND_TEXT(d); - textprop.value = (unsigned char *)*value; - textprop.nitems = strlen(*value); - textprop.format = 8; if (XwcTextPropertyToTextList(d, &textprop, &wlist, &count) < Success || count < 1) { @@ -1067,14 +1070,15 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, XwcFreeStringList((wchar_t**) wlist); } else if (*type == XA_UTF8_STRING(d)) { - XTextProperty textprop; char **list; int count; + XTextProperty textprop = { + .encoding = XA_COMPOUND_TEXT(d), + .value = (unsigned char *)*value, + .nitems = strlen(*value), + .format = 8 + }; - textprop.encoding = XA_COMPOUND_TEXT(d); - textprop.value = (unsigned char *)*value; - textprop.nitems = strlen(*value); - textprop.format = 8; if (Xutf8TextPropertyToTextList(d, &textprop, &list, &count) < Success || count < 1) { @@ -1194,7 +1198,7 @@ _LoseSelection(Widget w, Atom *selection, char **contents _X_UNUSED, int *length tail = kill_ring; kill_ring = kill_ring->next; } - if (kill_ring->refcount == 0) { + if (tail != NULL && kill_ring->refcount == 0) { --num_kill_rings; tail->next = NULL; XtFree(kill_ring->contents); @@ -1289,16 +1293,24 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to, if (!append) salt->contents = string; else { - salt->contents = XtMalloc((length + size + 1)); + salt->contents = XtMalloc((Cardinal)(length + size + 1)); if (from >= old_from) { - strncpy(salt->contents, ring, (size_t)size); - salt->contents[size] = '\0'; + if (ring != NULL) { + strncpy(salt->contents, ring, (size_t)size); + salt->contents[size] = '\0'; + } else { + salt->contents[size = 0] = '\0'; + } strncat(salt->contents, string, (size_t)length); } else { strncpy(salt->contents, string, (size_t)length); salt->contents[length] = '\0'; - strncat(salt->contents, ring, (size_t)size); + if (ring != NULL) { + strncat(salt->contents, ring, (size_t)size); + } else { + size = 0; + } } salt->contents[length + size] = '\0'; XtFree(ring); @@ -1330,7 +1342,7 @@ _DeleteOrKill(TextWidget ctx, XawTextPosition from, XawTextPosition to, text.firstPos = 0; text.format = (unsigned long)_XawTextFormat(ctx); - text.ptr = ""; + text.ptr = (char*)""; if (_XawTextReplace(ctx, from, to, &text)) { XBell(XtDisplay(ctx), 50); @@ -1399,7 +1411,8 @@ DeleteChar(Widget w, XEvent *event, XawTextScanDirection dir) short mul = MULT(ctx); if (mul < 0) { - ctx->text.mult = mul = (short)(-mul); + mul = -mul; + ctx->text.mult = mul; dir = dir == XawsdLeft ? XawsdRight : XawsdLeft; } DeleteOrKill(ctx, event, dir, XawstPositions, True, False); @@ -1600,11 +1613,10 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, text.firstPos = 0; text.format = XawFmt8Bit; - text.ptr = " "; + text.ptr = (char*)" "; text.length = 1; - position = XawTextSourceRead(ctx->text.source, position, - &block, (int)(right - left)); + XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left)); done = False; space = False; /* convert tabs and returns to spaces */ @@ -1637,11 +1649,10 @@ StripSpaces(TextWidget ctx, XawTextPosition left, XawTextPosition right, done = True; } - text.ptr = ""; + text.ptr = (char*)""; text.length = 0; position = tmp = left; - position = XawTextSourceRead(ctx->text.source, position, - &block, (int)(right - left)); + XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left)); ipos = ctx->text.insertPos; done = False; while (!done) { @@ -1717,12 +1728,11 @@ Tabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, int tab_index = 0, tab_column = 0, TAB_SIZE = DEFAULT_TAB_SIZE; text.firstPos = 0; - text.ptr = "\t"; + text.ptr = (char*)"\t"; text.format = XawFmt8Bit; text.length = 1; - position = XawTextSourceRead(ctx->text.source, position, - &block, (int)(right - left)); + XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left)); ipos = ctx->text.insertPos; done = zero = False; if (tab_count) @@ -1859,14 +1869,13 @@ Untabify(TextWidget ctx, XawTextPosition left, XawTextPosition right, short *char_tabs = sink->text_sink.char_tabs; int tab_count = sink->text_sink.tab_count; int tab_index = 0, tab_column = 0, tab_base = 0; - static char *tabs = " "; + static char *tabs = (char*)" "; text.firstPos = 0; text.format = XawFmt8Bit; text.ptr = tabs; - position = XawTextSourceRead(ctx->text.source, position, - &block, (int)(right - left)); + XawTextSourceRead(ctx->text.source, position, &block, (int)(right - left)); ipos = ctx->text.insertPos; done = False; zero = False; @@ -2182,7 +2191,7 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, position = tmp; if (position > left && position - left > ctx->text.left_column && position != right) { - text.ptr = "\n"; + text.ptr = (char*)"\n"; text.length = 1; CHECK_SAVE(); if (_XawTextReplace(ctx, position, position + 1, &text)) @@ -2235,7 +2244,6 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, } XawStackFree(text.ptr, buf); position += count; - right += count; if (num_pos) { for (cpos = 0; cpos < num_pos; cpos++) if (pos[cpos] > left) @@ -2297,7 +2305,6 @@ DoFormatText(TextWidget ctx, XawTextPosition left, Bool force, int level, inc += ii; } position += count; - right += count; XawStackFree(text.ptr, buf); } break; @@ -2322,18 +2329,17 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _ TextWidget ctx = (TextWidget)w; TextSrcObject src = (TextSrcObject)ctx->text.source; XawTextPosition from, to, tmp, end = 0, *pos, *posbuf[32]; - char buf[32]; XawTextBlock text; int i, spaces = MULT(ctx); char *lbuf = NULL, *rbuf; - unsigned llen = 0, rlen, size; + unsigned llen = 0; Bool undo = src->textSrc.enable_undo && src->textSrc.undo_state == False; Bool format = ctx->text.auto_fill && ctx->text.left_column < ctx->text.right_column; text.firstPos = 0; text.format = XawFmt8Bit; - text.ptr = ""; + text.ptr = (char*)""; StartAction(ctx, event); @@ -2370,6 +2376,8 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _ tmp = from; if (spaces > 0) { + char buf[32]; + text.ptr = XawStackAlloc((unsigned)spaces, buf); for (i = 0; i < spaces; i++) text.ptr[i] = ' '; @@ -2424,7 +2432,9 @@ Indent(Widget w, XEvent *event, String *params _X_UNUSED, Cardinal *num_params _ Tabify(ctx, from, to, pos, (int)src->textSrc.num_text, NULL); if (undo) { - rlen = (unsigned)(llen + (ctx->text.lastPos - end)); + unsigned rlen = (unsigned)(llen + (ctx->text.lastPos - end)); + unsigned size; + rbuf = _XawTextGetText(ctx, from, from + rlen); text.format = (unsigned long)_XawTextFormat(ctx); @@ -2601,7 +2611,7 @@ InsertNewLineAndIndent(Widget w, XEvent *event, String *p _X_UNUSED, Cardinal *n char *ptr; length = (int)strlen(line_to_ip); - text.ptr = XtMalloc(((size_t)(2 + length) * sizeof(char))); + text.ptr = XtMalloc((Cardinal)((size_t)(2 + length) * sizeof(char))); ptr = text.ptr; ptr[0] = XawLF; strcpy(++ptr, line_to_ip); @@ -3020,7 +3030,7 @@ AutoFill(TextWidget ctx) return; text.format = XawFmt8Bit; - text.ptr = "\n"; + text.ptr = (char*)"\n"; } text.length = 1; text.firstPos = 0; @@ -3295,7 +3305,7 @@ InsertString(Widget w, XEvent *event, String *params, Cardinal *num_params) StartAction(ctx, event); for (i = (int)*num_params; i; i--, params++) { /* DO FOR EACH PARAMETER */ - text.ptr = IfHexConvertHexElseReturnParam(*params, &text.length); + text.ptr = IfHexConvertHexElseReturnParam((char*) *params, &text.length); if (text.length == 0) continue; @@ -3370,7 +3380,7 @@ DisplayCaret(Widget w, XEvent *event, String *params, Cardinal *num_params) if (*num_params > 0) { /* default arg is "True" */ XrmValue from, to; - from.size = (unsigned)strlen(from.addr = params[0]); + from.size = (unsigned)strlen(from.addr = (char*)params[0]); XtConvert(w, XtRString, &from, XtRBoolean, &to); if (to.addr != NULL) @@ -3416,7 +3426,6 @@ Numeric(Widget w, XEvent *event, String *params, Cardinal *num_params) return; } else if (mult == 32767) { - mult = ctx->text.mult = (short)(- (params[0][0] - '0')); return; } else { @@ -3520,19 +3529,20 @@ static XawTextPosition StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, XawTextPosition *pos, int num_pos) { - XawTextPosition startPos, endPos, eop_begin, eop_end, temp; + XawTextPosition startPos, endPos, eop_begin, eop_end; Widget src = ctx->text.source; XawTextBlock text; char *buf; - static wchar_t wc_two_spaces[3]; int idx; /* Initialize our TextBlock with two spaces. */ text.firstPos = 0; text.format = (unsigned long)_XawTextFormat(ctx); - if (text.format == XawFmt8Bit) - text.ptr= " "; - else { + if (text.format == XawFmt8Bit) { + text.ptr= (char*)" "; + } else { + static wchar_t wc_two_spaces[3]; + wc_two_spaces[0] = _Xaw_atowc(XawSP); wc_two_spaces[1] = _Xaw_atowc(XawSP); wc_two_spaces[2] = 0; @@ -3540,11 +3550,13 @@ StripOutOldCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, } /* Strip out CR's. */ - eop_begin = eop_end = startPos = endPos = from; + eop_begin = eop_end = startPos = from; /* CONSTCOND */ while (TRUE) { - endPos=SrcScan(src, startPos, XawstEOL, XawsdRight, 1, False); + XawTextPosition temp; + + endPos = SrcScan(src, startPos, XawstEOL, XawsdRight, 1, False); temp = SrcScan(src, endPos, XawstWhiteSpace, XawsdLeft, 1, False); temp = SrcScan(src, temp, XawstWhiteSpace, XawsdRight,1, False); @@ -3626,19 +3638,19 @@ static void InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, XawTextPosition *pos, int num_pos) { - XawTextPosition startPos, endPos, space, eol; + XawTextPosition startPos; XawTextBlock text; - int i, width, height, len, wwidth, idx; - char *buf; - static wchar_t wide_CR[2]; + int i, width, height, wwidth, idx; text.firstPos = 0; text.length = 1; text.format = (unsigned long)_XawTextFormat(ctx); - if (text.format == XawFmt8Bit) - text.ptr = "\n"; - else { + if (text.format == XawFmt8Bit) { + text.ptr = (char*)"\n"; + } else { + static wchar_t wide_CR[2]; + wide_CR[0] = _Xaw_atowc(XawLF); wide_CR[1] = 0; text.ptr = (char*)wide_CR; @@ -3657,6 +3669,10 @@ InsertNewCRs(TextWidget ctx, XawTextPosition from, XawTextPosition to, /* CONSTCOND */ while (TRUE) { + int len; + char *buf; + XawTextPosition endPos, space, eol; + XawTextSinkFindPosition(ctx->text.sink, startPos, (int)ctx->text.r_margin.left, wwidth, True, &eol, &width, &height); @@ -3735,14 +3751,12 @@ FormRegion(TextWidget ctx, XawTextPosition from, XawTextPosition to, ctx->text.justify == XawjustifyFull) { Untabify(ctx, from, to, pos, num_pos, NULL); to += ctx->text.lastPos - len; - len = ctx->text.insertPos; (void)BlankLine((Widget)ctx, from, &inc); if (from + inc >= to) return (XawEditDone); } if (!StripSpaces(ctx, from + inc, to, pos, num_pos, NULL)) return (XawReplaceError); - to += ctx->text.lastPos - len; FormatText(ctx, from, ctx->text.justify != XawjustifyFull, pos, num_pos); } diff --git a/lib/libXaw/src/TextPop.c b/lib/libXaw/src/TextPop.c index 9bf35eeed..499c340da 100644 --- a/lib/libXaw/src/TextPop.c +++ b/lib/libXaw/src/TextPop.c @@ -61,6 +61,12 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xaw/Toggle.h> #include "XawI18n.h" +#ifdef O_CLOEXEC +#define FOPEN_CLOEXEC "e" +#else +#define FOPEN_CLOEXEC "" +#endif + static _Xconst char* INSERT_FILE = "Enter Filename:"; static _Xconst char* SEARCH_LABEL_1 = "Use <Tab> to change fields."; static _Xconst char* SEARCH_LABEL_2 = "Use ^q<Tab> for <Tab>."; @@ -305,7 +311,8 @@ InsertFileNamed(Widget tw, String str) XawTextBlock text; XawTextPosition pos; - if (str == NULL || strlen(str) == 0 || (file = fopen(str, "r")) == NULL) + if (str == NULL || strlen(str) == 0 || + (file = fopen(str, "r" FOPEN_CLOEXEC)) == NULL) return (False); pos = XawTextGetInsertionPoint(tw); diff --git a/lib/libXaw/src/TextSink.c b/lib/libXaw/src/TextSink.c index 3b435765b..8c85492a8 100644 --- a/lib/libXaw/src/TextSink.c +++ b/lib/libXaw/src/TextSink.c @@ -198,6 +198,9 @@ TextSinkClassRec textSinkClassRec = { MaxHeight, /* MaxHeight */ SetTabs, /* SetTabs */ GetCursorBounds, /* GetCursorBounds */ +#ifndef OLDXAW + NULL, +#endif }, }; @@ -423,10 +426,10 @@ ClearToBackground(Widget w, int x, int y, TextWidget xaw = (TextWidget)XtParent(w); Position x1, y1, x2, y2; - x1 = (XawMax(x, xaw->text.r_margin.left)); - y1 = (XawMax(y, xaw->text.r_margin.top)); - x2 = (XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right)); - y2 = (XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom)); + x1 = (Position) (XawMax(x, xaw->text.r_margin.left)); + y1 = (Position) (XawMax(y, xaw->text.r_margin.top)); + x2 = (Position) (XawMin(x + (int)width, (int)XtWidth(xaw) - xaw->text.r_margin.right)); + y2 = (Position) (XawMin(y + (int)height, (int)XtHeight(xaw) - xaw->text.r_margin.bottom)); x = (int)x1; y = (int)y1; @@ -939,15 +942,6 @@ XawTextSinkPreparePaint(Widget w, int y, int line, XawTextPosition from, (w, y, line, from, to, highlight); } -#if 0 -/*ARGSUSED*/ -static void -PreparePaint(Widget w, int y, int line, XawTextPosition from, XawTextPosition to, - Bool highlight) -{ -} -#endif - void XawTextSinkDoPaint(Widget w) { @@ -956,14 +950,6 @@ XawTextSinkDoPaint(Widget w) (*cclass->text_sink_class.extension->DoPaint)(w); } -#if 0 -/*ARGSUSED*/ -static void -DoPaint(Widget w) -{ -} -#endif - Bool XawTextSinkEndPaint(Widget w) { diff --git a/lib/libXaw/src/TextSrc.c b/lib/libXaw/src/TextSrc.c index adea9b3dc..0138e2a5a 100644 --- a/lib/libXaw/src/TextSrc.c +++ b/lib/libXaw/src/TextSrc.c @@ -231,6 +231,9 @@ TextSrcClassRec textSrcClassRec = { Search, /* Search */ SetSelection, /* SetSelection */ ConvertSelection, /* ConvertSelection */ +#ifndef OLDXAW + NULL, /* extension */ +#endif }, }; @@ -238,7 +241,7 @@ WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec; static XrmQuark QRead, QAppend, QEdit; #ifndef OLDXAW -static char *SrcNL = "\n"; +static char *SrcNL = (char*)"\n"; static wchar_t SrcWNL[2]; #endif @@ -732,6 +735,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left, Bool enable_undo; XawTextPosition start, end; int i, error, lines = 0; + Cardinal j; if (src->textSrc.edit_mode == XawtextRead) return (XawEditError); @@ -751,9 +755,9 @@ XawTextSourceReplace(Widget w, XawTextPosition left, if (left < right) { Widget ctx = NULL; - for (i = 0; i < src->textSrc.num_text; i++) - if (XtIsSubclass(src->textSrc.text[i], textWidgetClass)) { - ctx = src->textSrc.text[i]; + for (j = 0; j < src->textSrc.num_text; j++) + if (XtIsSubclass(src->textSrc.text[j], textWidgetClass)) { + ctx = src->textSrc.text[j]; break; } l_state->buffer = _XawTextGetText((TextWidget)ctx, left, right); @@ -823,8 +827,8 @@ XawTextSourceReplace(Widget w, XawTextPosition left, */ if (left > LARGE_VALUE) { start = XawTextSourceScan(w, left, XawstEOL, XawsdLeft, 2, False); - for (i = 0; i < src->textSrc.num_text; i++) { - TextWidget tw = (TextWidget)src->textSrc.text[i]; + for (j = 0; j < src->textSrc.num_text; j++) { + TextWidget tw = (TextWidget)src->textSrc.text[j]; if (left <= tw->text.lt.top && left + block->length - (right - left) > tw->text.lt.top) @@ -983,7 +987,6 @@ XawTextSourceReplace(Widget w, XawTextPosition left, src->textSrc.changed = True; if (error == XawEditDone) { - XawTextPropertyInfo info; XawTextAnchor *anchor; /* find anchor and index */ @@ -1051,7 +1054,7 @@ XawTextSourceReplace(Widget w, XawTextPosition left, offset = anchor->position + entity->offset + entity->length; if (offset > right) { - entity->length = (XawMin(entity->length, offset - right)); + entity->length = (Cardinal) (XawMin(entity->length, offset - right)); goto exit_anchor_loop; } @@ -1183,10 +1186,15 @@ exit_anchor_loop: } } - info.left = left; - info.right = right; - info.block = block; - XtCallCallbacks(w, XtNpropertyCallback, &info); + { + XawTextPropertyInfo info = { + .left = left, + .right = right, + .block = block + }; + + XtCallCallbacks(w, XtNpropertyCallback, &info); + } TellSourceChanged(src, left, right, block, lines); /* Call callbacks, we have changed the buffer */ @@ -1349,7 +1357,6 @@ FreeUndoBuffer(XawTextUndo *undo) static void UndoGC(XawTextUndo *undo) { - unsigned i; XawTextUndoList *head = undo->head, *redo = head->redo; if (head == undo->pointer || head == undo->end_mark @@ -1362,6 +1369,8 @@ UndoGC(XawTextUndo *undo) --head->left->refcount; if (--head->right->refcount == 0) { + unsigned i; + for (i = 0; i < undo->num_undo; i+= 2) if (head->left == undo->undo[i] || head->left == undo->undo[i+1]) { if (head->left == undo->undo[i+1]) { @@ -1673,13 +1682,15 @@ XawTextAnchor * XawTextSourceFindAnchor(Widget w, XawTextPosition position) { TextSrcObject src = (TextSrcObject)w; - int i = 0, left, right, nmemb = src->textSrc.num_anchors; - XawTextAnchor *anchor, **anchors = src->textSrc.anchors; + int left, right, nmemb = src->textSrc.num_anchors; + XawTextAnchor **anchors = src->textSrc.anchors; left = 0; right = nmemb - 1; while (left <= right) { - anchor = anchors[i = (left + right) >> 1]; + int i = (left + right) >> 1; + XawTextAnchor *anchor = anchors[i]; + if (anchor->position == position) return (anchor); else if (position < anchor->position) @@ -1701,7 +1712,6 @@ XawTextSourceAnchorAndEntity(Widget w, XawTextPosition position, { XawTextAnchor *anchor = XawTextSourceFindAnchor(w, position); XawTextEntity *pentity, *entity; - XawTextPosition offset; Bool next_anchor = True, retval = False; if (anchor->cache && anchor->position + anchor->cache->offset + @@ -1710,7 +1720,7 @@ XawTextSourceAnchorAndEntity(Widget w, XawTextPosition position, else pentity = entity = anchor->entities; while (entity) { - offset = anchor->position + entity->offset; + XawTextPosition offset = anchor->position + entity->offset; if (offset > position) { retval = next_anchor = False; @@ -1899,7 +1909,6 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right XawTextAnchor *anchor = XawTextSourceFindAnchor(w, left); XawTextEntity *entity, *eprev, *enext; XawTextPosition offset; - int length; while (anchor && anchor->entities == NULL) anchor = XawTextSourceRemoveAnchor(w, anchor); @@ -1928,7 +1937,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right offset = anchor->position + entity->offset; if (offset <= left) { - length = (XawMin(entity->length, left - offset)); + int length = (int) (XawMin(entity->length, left - offset)); if (length <= 0) { enext = entity->next; @@ -1963,7 +1972,7 @@ XawTextSourceClearEntities(Widget w, XawTextPosition left, XawTextPosition right if (offset > right) { anchor->cache = NULL; entity->offset = XawMax(entity->offset, right - anchor->position); - entity->length = (XawMin(entity->length, offset - right)); + entity->length = (Cardinal) (XawMin(entity->length, offset - right)); return; } diff --git a/lib/libXaw/src/Tip.c b/lib/libXaw/src/Tip.c index 33e562008..d0ff52b42 100644 --- a/lib/libXaw/src/Tip.c +++ b/lib/libXaw/src/Tip.c @@ -330,13 +330,13 @@ XawTipExpose(Widget w, XEvent *event, Region region) Position ksy = (Position)tip->tip.top_margin; XFontSetExtents *ext = XExtentsOfFontSet(tip->tip.fontset); - ksy = (ksy + XawAbs(ext->max_ink_extent.y)); + ksy = (Position) (ksy + XawAbs(ext->max_ink_extent.y)); while ((nl = strchr(label, '\n')) != NULL) { XmbDrawString(XtDisplay(w), XtWindow(w), tip->tip.fontset, gc, tip->tip.left_margin, ksy, label, (int)(nl - label)); - ksy = (ksy + ext->max_ink_extent.height); + ksy = (Position) (ksy + ext->max_ink_extent.height); label = nl + 1; } len = (int)strlen(label); @@ -380,12 +380,13 @@ XawTipSetValues(Widget current, Widget request _X_UNUSED, Widget cnew, if (curtip->tip.font->fid != newtip->tip.font->fid || curtip->tip.foreground != newtip->tip.foreground) { - XGCValues values; + XGCValues values = { + .foreground = newtip->tip.foreground, + .background = newtip->core.background_pixel, + .font = newtip->tip.font->fid, + .graphics_exposures = False + }; - values.foreground = newtip->tip.foreground; - values.background = newtip->core.background_pixel; - values.font = newtip->tip.font->fid; - values.graphics_exposures = False; XtReleaseGC(cnew, curtip->tip.gc); newtip->tip.gc = XtAllocateGC(cnew, 0, GCForeground | GCBackground | GCFont | GCGraphicsExposures, &values, @@ -454,10 +455,10 @@ TipLayout(XawTipInfo *info) XTextWidth16(fs, (_Xconst XChar2b*)label, (int)(strlen(label) >> 1)) : XTextWidth(fs, label, (int)strlen(label)); } - XtWidth(info->tip) = (width + info->tip->tip.left_margin + - info->tip->tip.right_margin); - XtHeight(info->tip) = (height + info->tip->tip.top_margin + - info->tip->tip.bottom_margin); + XtWidth(info->tip) = (Dimension) (width + info->tip->tip.left_margin + + info->tip->tip.right_margin); + XtHeight(info->tip) = (Dimension) (height + info->tip->tip.top_margin + + info->tip->tip.bottom_margin); } #define DEFAULT_TIP_Y_OFFSET 12 @@ -526,7 +527,7 @@ FindTipInfo(Widget w) Screen *screen = XtScreenOfObject(w); if (tip == NULL) - return (first_tip = tip = CreateTipInfo(w)); + return (first_tip = CreateTipInfo(w)); for (ptip = tip; tip; ptip = tip, tip = tip->next) if (tip->screen == screen) diff --git a/lib/libXaw/src/Toggle.c b/lib/libXaw/src/Toggle.c index eb6281d6e..281089036 100644 --- a/lib/libXaw/src/Toggle.c +++ b/lib/libXaw/src/Toggle.c @@ -159,6 +159,9 @@ ToggleClassRec toggleClassRec = { /* simple */ { XtInheritChangeSensitive, /* change_sensitive */ +#ifndef OLDXAW + NULL, +#endif }, /* label */ { @@ -489,7 +492,6 @@ void XawToggleChangeRadioGroup(Widget w, Widget radio_group) { ToggleWidget tw = (ToggleWidget)w; - RadioGroup *group; RemoveFromRadioGroup(w); @@ -502,7 +504,9 @@ XawToggleChangeRadioGroup(Widget w, Widget radio_group) XawToggleUnsetCurrent(radio_group); if (radio_group != NULL) { - if ((group = GetRadioGroup(radio_group)) == NULL) + RadioGroup *group = GetRadioGroup(radio_group); + + if (group == NULL) CreateRadioGroup(w, radio_group); else AddToRadioGroup(group, w); @@ -611,12 +615,13 @@ XawToggleSetCurrent(Widget radio_group, XtPointer radio_data) void XawToggleUnsetCurrent(Widget radio_group) { - ToggleWidgetClass cclass; ToggleWidget local_tog = (ToggleWidget)radio_group; /* Special Case no radio group */ if (local_tog->command.set) { + ToggleWidgetClass cclass; + cclass = (ToggleWidgetClass)local_tog->core.widget_class; cclass->toggle_class.Unset(radio_group, NULL, NULL, NULL); Notify(radio_group, NULL, NULL, NULL); diff --git a/lib/libXaw/src/Tree.c b/lib/libXaw/src/Tree.c index b3485f55a..5c6fcd5cd 100644 --- a/lib/libXaw/src/Tree.c +++ b/lib/libXaw/src/Tree.c @@ -206,9 +206,6 @@ WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec; static void initialize_dimensions(Dimension **listp, int *sizep, int n) { - int i; - Dimension *l; - if (!*listp) { *listp = (Dimension *) XtCalloc ((unsigned int) n, (unsigned int) sizeof(Dimension)); @@ -221,9 +218,14 @@ initialize_dimensions(Dimension **listp, int *sizep, int n) if (!*listp) { *sizep = 0; return; + } else { + int i; + Dimension *l; + + for (i = *sizep, l = (*listp) + i; i < n; i++, l++) + *l = 0; + *sizep = n; } - for (i = *sizep, l = (*listp) + i; i < n; i++, l++) *l = 0; - *sizep = n; } return; } @@ -282,7 +284,8 @@ static void delete_node(Widget parent, Widget node) { TreeConstraints pc; - int pos, i; + int pos; + int i; /* * Make sure the parent exists. @@ -587,6 +590,8 @@ static void XawTreeRedisplay(Widget gw, XEvent *event _X_UNUSED, Region region _X_UNUSED) { TreeWidget tw = (TreeWidget) gw; + Cardinal i; + int j; #ifndef OLDXAW if (tw->tree.display_list) @@ -597,8 +602,6 @@ XawTreeRedisplay(Widget gw, XEvent *event _X_UNUSED, Region region _X_UNUSED) * If the Tree widget is visible, visit each managed child. */ if (tw->core.visible) { - Cardinal i; - int j; Display *dpy = XtDisplay (tw); Window w = XtWindow (tw); @@ -722,10 +725,10 @@ static void compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) { TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */ - int i; Bool horiz = IsHorizontal (tree); Dimension newwidth, newheight; Dimension bw2 = (Dimension)(w->core.border_width * 2); + int i; /* * Set the max-size per level. @@ -792,10 +795,9 @@ compute_bounding_box_subtree(TreeWidget tree, Widget w, int depth) static void set_positions(TreeWidget tw, Widget w, int level) { - int i; - if (w) { TreeConstraints tc = TREE_CONSTRAINT(w); + int i; if (level > 0) { /* @@ -832,15 +834,13 @@ static void arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y) { TreeConstraints tc = TREE_CONSTRAINT(w); /* info attached to all kids */ - TreeConstraints firstcc, lastcc; - int i; int newx, newy; Bool horiz = IsHorizontal (tree); Widget child = NULL; Dimension tmp; Dimension bw2 = (Dimension)(w->core.border_width * 2); Bool relayout = True; - + int i; /* * If no children, then just lay out where requested. @@ -903,10 +903,10 @@ arrange_subtree(TreeWidget tree, Widget w, int depth, int x, int y) /* * now layout parent between first and last children */ - if (relayout) { + if (relayout && (child != NULL)) { Position adjusted; - firstcc = TREE_CONSTRAINT (tc->tree.children[0]); - lastcc = TREE_CONSTRAINT (child); + TreeConstraints firstcc = TREE_CONSTRAINT (tc->tree.children[0]); + TreeConstraints lastcc = TREE_CONSTRAINT (child); /* Adjustments are disallowed if they result in a position above * or to the left of the originally requested position, because diff --git a/lib/libXaw/src/Vendor.c b/lib/libXaw/src/Vendor.c index 7940d2e5c..07faaa9dc 100644 --- a/lib/libXaw/src/Vendor.c +++ b/lib/libXaw/src/Vendor.c @@ -204,7 +204,7 @@ externaldef(vendorshellclassrec) VendorShellClassRec vendorShellClassRec = { } }; -#if !defined(__UNIXOS2__) && !defined(__APPLE__) +#if !defined(__APPLE__) externaldef(vendorshellwidgetclass) WidgetClass vendorShellWidgetClass = (WidgetClass) (&vendorShellClassRec); #endif @@ -280,16 +280,16 @@ XawCvtCompoundTextToString(Display *dpy, XrmValuePtr args _X_UNUSED, Cardinal *n XrmValue *fromVal, XrmValue *toVal, XtPointer *cvt_data _X_UNUSED) { - XTextProperty prop; char **list; int count; static char *mbs = NULL; int len; - - prop.value = (unsigned char *)fromVal->addr; - prop.encoding = XA_COMPOUND_TEXT(dpy); - prop.format = 8; - prop.nitems = fromVal->size; + XTextProperty prop = { + .value = (unsigned char *)fromVal->addr, + .encoding = XA_COMPOUND_TEXT(dpy), + .format = 8, + .nitems = fromVal->size + }; if(XmbTextPropertyToTextList(dpy, &prop, &list, &count) < Success) { XtAppWarningMsg(XtDisplayToApplicationContext(dpy), @@ -330,11 +330,11 @@ XawVendorShellClassPartInit(WidgetClass cclass) CompositeClassExtension ext; VendorShellWidgetClass vsclass = (VendorShellWidgetClass)cclass; - if ((ext = (CompositeClassExtension) - XtGetClassExtension (cclass, - XtOffsetOf(CompositeClassRec, - composite_class.extension), - NULLQUARK, 1L, (Cardinal) 0)) == NULL) { + if (((CompositeClassExtension) + XtGetClassExtension (cclass, + XtOffsetOf(CompositeClassRec, + composite_class.extension), + NULLQUARK, 1L, (Cardinal) 0)) == NULL) { ext = (CompositeClassExtension) XtNew (CompositeClassExtensionRec); if (ext != NULL) { ext->next_extension = vsclass->composite_class.extension; @@ -348,8 +348,8 @@ XawVendorShellClassPartInit(WidgetClass cclass) } } -#if defined(__osf__) || defined(__UNIXOS2__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) -/* stupid OSF/1 shared libraries have the wrong semantics */ +#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__) +/* shared libraries on these platforms have the wrong semantics */ /* symbols do not get resolved external to the shared library */ void _XawFixupVendorShell() { diff --git a/lib/libXaw/src/Viewport.c b/lib/libXaw/src/Viewport.c index 9256ffabc..885e48d07 100644 --- a/lib/libXaw/src/Viewport.c +++ b/lib/libXaw/src/Viewport.c @@ -216,6 +216,9 @@ ViewportClassRec viewportClassRec = { /* form */ { Layout, /* layout */ +#ifndef OLDXAW + NULL, +#endif }, /* viewport */ { @@ -441,10 +444,6 @@ XawViewportChangeManaged(Widget widget) ((FormWidget)w, XtWidth(w), XtHeight(w), True /* True? */); } } - -#ifdef notdef - (*Superclass->composite_class.change_managed)(widget); -#endif } static void @@ -472,19 +471,18 @@ RedrawThumbs(ViewportWidget w) static void SendReport(ViewportWidget w, unsigned int changed) { - XawPannerReport rep; - if (w->viewport.report_callbacks) { Widget child = w->viewport.child; Widget clip = w->viewport.clip; - - rep.changed = changed; - rep.slider_x = (Position) -XtX(child); /* child is canvas */ - rep.slider_y = (Position) -XtY(child); /* clip is slider */ - rep.slider_width = XtWidth(clip); - rep.slider_height = XtHeight(clip); - rep.canvas_width = XtWidth(child); - rep.canvas_height = XtHeight(child); + XawPannerReport rep = { + .changed = changed, + .slider_x = (Position) -XtX(child), /* child is canvas */ + .slider_y = (Position) -XtY(child), /* clip is slider */ + .slider_width = XtWidth(clip), + .slider_height = XtHeight(clip), + .canvas_width = XtWidth(child), + .canvas_height = XtHeight(child) + }; XtCallCallbackList((Widget)w, w->viewport.report_callbacks, (XtPointer)&rep); } diff --git a/lib/libXaw/src/XawI18n.c b/lib/libXaw/src/XawI18n.c index b75f70a32..9a613fe51 100644 --- a/lib/libXaw/src/XawI18n.c +++ b/lib/libXaw/src/XawI18n.c @@ -76,20 +76,6 @@ _Xaw_atowc(unsigned char c) return (wc); } -#ifdef NCR -int -_Xaw_iswspace(wchar_t w) -{ - int ret = 0; - wchar_t s = _Xaw_atowc(' '); - - if (s == w) - ret = 1; - - return (ret); -} -#endif - int _Xaw_iswalnum(wchar_t ch) { diff --git a/lib/libXaw/src/XawI18n.h b/lib/libXaw/src/XawI18n.h index d50171cfb..7d20bfc13 100644 --- a/lib/libXaw/src/XawI18n.h +++ b/lib/libXaw/src/XawI18n.h @@ -38,29 +38,6 @@ in this Software without prior written authorization from The Open Group. #include <wchar.h> #endif -#if defined(AIXV3) || defined(__SCO__) -#include <ctype.h> -#endif - -#ifdef NCR -#define iswspace(c) _Xaw_iswspace(c) -int _Xaw_iswspace -( - wchar_t c - ); -#endif - -#ifdef sony -#ifndef SVR4 -#include <jctype.h> -#define iswspace(c) jisspace(c) -#endif -#endif - -#ifdef QNX4 -#define toascii( c ) ((unsigned)(c) & 0x007f) -#endif - #include <stdlib.h> #ifdef USE_XWCHAR_STRING @@ -103,10 +80,16 @@ wchar_t _Xaw_atowc ); #ifndef HAS_ISW_FUNCS -#include <ctype.h> -#ifndef iswspace -#define iswspace(c) (isascii(c) && isspace(toascii(c))) -#endif +# include <ctype.h> +# ifndef isascii +# define isascii(c) ((unsigned char)(c) < 127) +# endif +# ifndef toascii +# define toascii(c) ((c) & 0x7f) +# endif +# ifndef iswspace +# define iswspace(c) (isascii(c) && isspace(toascii(c))) +# endif #endif #if !defined(iswalnum) && !defined(HAVE_ISWALNUM) diff --git a/lib/libXaw/src/XawIm.c b/lib/libXaw/src/XawIm.c index ebc5edefb..5446c62fe 100644 --- a/lib/libXaw/src/XawIm.c +++ b/lib/libXaw/src/XawIm.c @@ -80,6 +80,18 @@ in this Software without prior written authorization from The Open Group. #define Offset(field) (XtOffsetOf(XawIcTablePart, field)) +#define ADD_IC(value) ic_a[ic_cnt] = (XPointer) value; ic_cnt++ +#define USE_IC(count) (ic_cnt > count) ? ic_a[count] : NULL +#define END_IC() ic_a[ic_cnt] = (XPointer) NULL + +#define ADD_PE(value) pe_a[pe_cnt] = (XPointer) value; pe_cnt++ +#define USE_PE(count) (pe_cnt > count) ? pe_a[count] : NULL +#define END_PE() pe_a[pe_cnt] = (XPointer) NULL + +#define ADD_ST(value) st_a[st_cnt] = (XPointer) value; st_cnt++ +#define USE_ST(count) (st_cnt > count) ? st_a[count] : NULL +#define END_ST() st_a[st_cnt] = (XPointer) NULL + /***************************************************** * * Forward reference prototypes @@ -264,18 +276,19 @@ GetInputStyleOfIC(XawVendorShellExtPart *ve) static void ConfigureCB(Widget w, XtPointer closure _X_UNUSED, XEvent *event, Boolean *unused _X_UNUSED) { - XawIcTableList p; XawVendorShellExtPart *ve; VendorShellWidget vw; - XVaNestedList pe_attr; - XRectangle pe_area; - XawTextMargin *margin; if (event->type != ConfigureNotify) return; if ((vw = SearchVendorShell(w)) == NULL) return; if ((ve = GetExtPart(vw)) != NULL) { + XawIcTableList p; + XVaNestedList pe_attr; + XRectangle pe_area; + XawTextMargin *margin; + if (IsSharedIC(ve)) return; if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) || @@ -314,20 +327,6 @@ static Widget SetErrCnxt(Widget w, XIM xim) return(contextErrData->widget); } -#if 0 -static Widget -GetErrCnxt(XIM error_im) -{ - contextErrDataRec *contextErrData; - - if (XFindContext(XDisplayOfIM(error_im), (Window)error_im, errContext, - (XPointer*)&contextErrData)) { - return(NULL); - } - return(contextErrData->widget); -} -#endif - static void CloseIM(XawVendorShellExtPart *ve) { @@ -426,31 +425,15 @@ VendorShellDestroyed(Widget w, XtPointer cl_data _X_UNUSED, XtPointer ca_data _X return; } -#if 0 -static int -IOErrorHandler(XIM error_im) -{ - VendorShellWidget vw; - XawVendorShellExtPart * ve; - - if ((vw = (VendorShellWidget)GetErrCnxt(error_im)) == NULL - || (ve = GetExtPart(vw)) == NULL) return(0); - - DestroyAllIM(ve); - return(0); -} -#endif - /* * Attempt to open an input method */ - static void OpenIM(XawVendorShellExtPart *ve) { int i; _Xconst char *s, *ns, *end; - char *p, *pbuf, buf[32]; + char *p, buf[32]; XIM xim = NULL; XIMStyles *xim_styles; XIMStyle input_style = 0; @@ -462,6 +445,8 @@ OpenIM(XawVendorShellExtPart *ve) if ((p = XSetLocaleModifiers("@im=none")) != NULL && *p) xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL); } else { + char *pbuf; + /* no fragment can be longer than the whole string */ Cardinal len = (Cardinal)strlen (ve->im.input_method) + 5; @@ -496,7 +481,7 @@ OpenIM(XawVendorShellExtPart *ve) if (pbuf != buf) XtFree (pbuf); } if (xim == NULL) { - if ((p = XSetLocaleModifiers("")) != NULL) { + if (XSetLocaleModifiers("") != NULL) { xim = XOpenIM(XtDisplay(ve->parent), NULL, NULL, NULL); } } @@ -513,7 +498,7 @@ OpenIM(XawVendorShellExtPart *ve) return; } found = False; - for(ns = s = ve->im.preedit_type; s && !found;) { + for (s = ve->im.preedit_type; s && !found;) { while (*s && isspace((unsigned char)*s)) s++; if (!*s) break; if ((ns = end = strchr(s, ',')) == NULL) @@ -720,18 +705,18 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height) if (p->input_style & XIMPreeditArea) { pe_attr = XVaCreateNestedList(0, XNAreaNeeded, &pe_area_needed, NULL); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; + ADD_IC(XNPreeditAttributes); + ADD_IC(pe_attr); } if (p->input_style & XIMStatusArea) { st_attr = XVaCreateNestedList(0, XNAreaNeeded, &st_area_needed, NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; + ADD_IC(XNStatusAttributes); + ADD_IC(st_attr); } - ic_a[ic_cnt] = (XPointer) NULL; + END_IC(); if (ic_cnt > 0) { - XGetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL); + XGetICValues(p->xic, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3), NULL); if (pe_attr) XFree(pe_attr); if (st_attr) XFree(st_attr); if (p->xic == NULL) { @@ -752,8 +737,8 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height) XFree(st_area_needed); st_attr = XVaCreateNestedList(0, XNArea, &st_area, NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; + ADD_IC(XNStatusAttributes); + ADD_IC(st_attr); } if (p->input_style & XIMPreeditArea) { if (p->input_style & XIMStatusArea) { @@ -767,11 +752,11 @@ SizeNegotiation(XawIcTableList p, unsigned int width, unsigned int height) XFree(pe_area_needed); pe_area.y = (short)(height - pe_area.height); pe_attr = XVaCreateNestedList(0, XNArea, &pe_area, NULL); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; + ADD_IC(XNPreeditAttributes); + ADD_IC(pe_attr); } - ic_a[ic_cnt] = (XPointer) NULL; - XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], NULL); + END_IC(); + XSetICValues(p->xic, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3), NULL); if (pe_attr) XFree(pe_attr); if (st_attr) XFree(st_attr); if (p->xic == NULL) { @@ -791,7 +776,6 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) XPointer ic_a[20], pe_a[20], st_a[20]; Dimension height = 0; int ic_cnt = 0, pe_cnt = 0, st_cnt = 0; - XawTextMargin *margin; if (!XtIsRealized(w)) return; if (((ve->im.xim == NULL) || (p = GetIcTableShared(w, ve)) == NULL) || @@ -804,10 +788,10 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) { if (p->flg & CIFontSet) { - pe_a[pe_cnt] = (XPointer) XNFontSet; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->font_set; pe_cnt++; - st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++; - st_a[st_cnt] = (XPointer) p->font_set; st_cnt++; + ADD_PE(XNFontSet); + ADD_PE(p->font_set); + ADD_ST(XNFontSet); + ADD_ST(p->font_set); if (p->font_set) { height = (Dimension)(maxAscentOfFontSet(p->font_set) + maxDescentOfFontSet(p->font_set)); @@ -815,39 +799,43 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) height = (Dimension)SetVendorShellHeight(ve, height); } if (p->flg & CIFg) { - pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->foreground; pe_cnt++; - st_a[st_cnt] = (XPointer) XNForeground; st_cnt++; - st_a[st_cnt] = (XPointer) p->foreground; st_cnt++; + ADD_PE(XNForeground); + ADD_PE(p->foreground); + ADD_ST(XNForeground); + ADD_ST(p->foreground); } if (p->flg & CIBg) { - pe_a[pe_cnt] = (XPointer) XNBackground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->background; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackground; st_cnt++; - st_a[st_cnt] = (XPointer) p->background; st_cnt++; + ADD_PE(XNBackground); + ADD_PE(p->background); + ADD_ST(XNBackground); + ADD_ST(p->background); } if (p->flg & CIBgPixmap) { - pe_a[pe_cnt] = (XPointer) XNBackgroundPixmap; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->bg_pixmap; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackgroundPixmap; st_cnt++; - st_a[st_cnt] = (XPointer) p->bg_pixmap; st_cnt++; + ADD_PE(XNBackgroundPixmap); + ADD_PE(p->bg_pixmap); + ADD_ST(XNBackgroundPixmap); + ADD_ST(p->bg_pixmap); } if (p->flg & CILineS) { - pe_a[pe_cnt] = (XPointer) XNLineSpace; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->line_spacing; pe_cnt++; - st_a[st_cnt] = (XPointer) XNLineSpace; st_cnt++; - st_a[st_cnt] = (XPointer) p->line_spacing; st_cnt++; + ADD_PE(XNLineSpace); + ADD_PE(p->line_spacing); + ADD_ST(XNLineSpace); + ADD_ST(p->line_spacing); } } + if (p->input_style & XIMPreeditArea) { pe_area.x = 0; pe_area.y = (short)(ve->parent->core.height - height); pe_area.width = ve->parent->core.width; pe_area.height = height; - pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; - pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++; + ADD_PE(XNArea); + ADD_PE(&pe_area); } + if (p->input_style & XIMPreeditPosition) { + XawTextMargin *margin; + pe_area.x = 0; pe_area.y = 0; pe_area.width = w->core.width; @@ -857,59 +845,58 @@ CreateIC(Widget w, XawVendorShellExtPart *ve) pe_area.y = (short)(pe_area.y + margin->top); pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1)); pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1)); - pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; - pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++; + ADD_PE(XNArea); + ADD_PE(&pe_area); if (p->flg & CICursorP) { _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y); } else { position.x = position.y = 0; } - pe_a[pe_cnt] = (XPointer) XNSpotLocation; pe_cnt++; - pe_a[pe_cnt] = (XPointer) &position; pe_cnt++; + ADD_PE(XNSpotLocation); + ADD_PE(&position); } if (p->input_style & XIMStatusArea) { st_area.x = 0; st_area.y = (short)(ve->parent->core.height - height); st_area.width = ve->parent->core.width; st_area.height = height; - st_a[st_cnt] = (XPointer) XNArea; st_cnt++; - st_a[st_cnt] = (XPointer) &st_area; st_cnt++; + ADD_ST(XNArea); + ADD_ST(&st_area); } - ic_a[ic_cnt] = (XPointer) XNInputStyle; ic_cnt++; - ic_a[ic_cnt] = (XPointer) p->input_style; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XNClientWindow; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XtWindow(ve->parent); ic_cnt++; - ic_a[ic_cnt] = (XPointer) XNFocusWindow; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XtWindow(w); ic_cnt++; + ADD_IC(XNInputStyle); + ADD_IC(p->input_style); + ADD_IC(XNClientWindow); + ADD_IC(XtWindow(ve->parent)); + ADD_IC(XNFocusWindow); + ADD_IC(XtWindow(w)); if (pe_cnt > 0) { - pe_a[pe_cnt] = (XPointer) NULL; - pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3], - pe_a[4], pe_a[5], pe_a[6], pe_a[7], pe_a[8], - pe_a[9], pe_a[10], pe_a[11], pe_a[12], - pe_a[13], pe_a[14], pe_a[15], pe_a[16], - pe_a[17], pe_a[18], NULL); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; + END_PE(); + pe_attr = XVaCreateNestedList(0, USE_PE(0), USE_PE(1), USE_PE(2), + USE_PE(3), USE_PE(4), USE_PE(5), + USE_PE(6), USE_PE(7), USE_PE(8), + USE_PE(9), USE_PE(10), USE_PE(11), + USE_PE(12), USE_PE(13), USE_PE(14), + USE_PE(15), NULL); + ADD_IC(XNPreeditAttributes); + ADD_IC(pe_attr); } if (st_cnt > 0) { - st_a[st_cnt] = (XPointer) NULL; - st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3], - st_a[4], st_a[5], st_a[6], st_a[7], st_a[8], - st_a[9], st_a[10], st_a[11], st_a[12], - st_a[13], st_a[14], st_a[15], st_a[16], - st_a[17], st_a[18], NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; - } - ic_a[ic_cnt] = (XPointer) NULL; - - p->xic = XCreateIC(ve->im.xim, ic_a[0], ic_a[1], ic_a[2], ic_a[3], - ic_a[4], ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], - ic_a[10], ic_a[11], ic_a[12], ic_a[13], ic_a[14], - ic_a[15], ic_a[16], ic_a[17], ic_a[18], NULL); + END_ST(); + st_attr = XVaCreateNestedList(0, USE_ST(0), USE_ST(1), USE_ST(2), + USE_ST(3), USE_ST(4), USE_ST(5), + USE_ST(6), USE_ST(7), USE_ST(8), + USE_ST(9), USE_ST(10), USE_ST(11), NULL); + ADD_IC(XNStatusAttributes); + ADD_IC(st_attr); + } + END_IC(); + + p->xic = XCreateIC(ve->im.xim, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3), + USE_IC(4), USE_IC(5), USE_IC(6), USE_IC(7), USE_IC(8), + USE_IC(9), NULL); if (pe_attr) XtFree(pe_attr); if (st_attr) XtFree(st_attr); @@ -963,46 +950,46 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus) if (p->input_style & (XIMPreeditArea|XIMPreeditPosition|XIMStatusArea)) { if (p->flg & CIFontSet) { - pe_a[pe_cnt] = (XPointer) XNFontSet; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->font_set; pe_cnt++; - st_a[st_cnt] = (XPointer) XNFontSet; st_cnt++; - st_a[st_cnt] = (XPointer) p->font_set; st_cnt++; + ADD_PE(XNFontSet); + ADD_PE(p->font_set); + ADD_ST(XNFontSet); + ADD_ST(p->font_set); if (p->font_set) { height = maxAscentOfFontSet(p->font_set) - + maxDescentOfFontSet(p->font_set); + + maxDescentOfFontSet(p->font_set); } - height = (int)SetVendorShellHeight(ve, (unsigned)height); + SetVendorShellHeight(ve, (unsigned)height); } if (p->flg & CIFg) { - pe_a[pe_cnt] = (XPointer) XNForeground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->foreground; pe_cnt++; - st_a[st_cnt] = (XPointer) XNForeground; st_cnt++; - st_a[st_cnt] = (XPointer) p->foreground; st_cnt++; + ADD_PE(XNForeground); + ADD_PE(p->foreground); + ADD_ST(XNForeground); + ADD_ST(p->foreground); } if (p->flg & CIBg) { - pe_a[pe_cnt] = (XPointer) XNBackground; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->background; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackground; st_cnt++; - st_a[st_cnt] = (XPointer) p->background; st_cnt++; + ADD_PE(XNBackground); + ADD_PE(p->background); + ADD_ST(XNBackground); + ADD_ST(p->background); } if (p->flg & CIBgPixmap) { - pe_a[pe_cnt] = (XPointer) XNBackgroundPixmap; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->bg_pixmap; pe_cnt++; - st_a[st_cnt] = (XPointer) XNBackgroundPixmap; st_cnt++; - st_a[st_cnt] = (XPointer) p->bg_pixmap; st_cnt++; + ADD_PE(XNBackgroundPixmap); + ADD_PE(p->bg_pixmap); + ADD_ST(XNBackgroundPixmap); + ADD_ST(p->bg_pixmap); } if (p->flg & CILineS) { - pe_a[pe_cnt] = (XPointer) XNLineSpace; pe_cnt++; - pe_a[pe_cnt] = (XPointer) p->line_spacing; pe_cnt++; - st_a[st_cnt] = (XPointer) XNLineSpace; st_cnt++; - st_a[st_cnt] = (XPointer) p->line_spacing; st_cnt++; + ADD_PE(XNLineSpace); + ADD_PE(p->line_spacing); + ADD_ST(XNLineSpace); + ADD_ST(p->line_spacing); } } if (p->input_style & XIMPreeditPosition) { if (p->flg & CICursorP) { _XawMultiSinkPosToXY(w, p->cursor_position, &position.x, &position.y); - pe_a[pe_cnt] = (XPointer) XNSpotLocation; pe_cnt++; - pe_a[pe_cnt] = (XPointer) &position; pe_cnt++; + ADD_PE(XNSpotLocation); + ADD_PE(&position); } } if (IsSharedIC(ve)) { @@ -1016,41 +1003,38 @@ SetICValues(Widget w, XawVendorShellExtPart *ve, Bool focus) pe_area.y = (short)(pe_area.y + margin->top); pe_area.width = (unsigned short)(pe_area.width - (margin->left + margin->right - 1)); pe_area.height = (unsigned short)(pe_area.height - (margin->top + margin->bottom - 1)); - pe_a[pe_cnt] = (XPointer) XNArea; pe_cnt++; - pe_a[pe_cnt] = (XPointer) &pe_area; pe_cnt++; + ADD_PE(XNArea); + ADD_PE(&pe_area); } } if (pe_cnt > 0) { - pe_a[pe_cnt] = (XPointer) NULL; - pe_attr = XVaCreateNestedList(0, pe_a[0], pe_a[1], pe_a[2], pe_a[3], - pe_a[4], pe_a[5], pe_a[6], pe_a[7], - pe_a[8], pe_a[9], pe_a[10], pe_a[11], - pe_a[12], pe_a[13], pe_a[14], pe_a[15], - pe_a[16], pe_a[17], pe_a[18], NULL); - ic_a[ic_cnt] = (XPointer) XNPreeditAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) pe_attr; ic_cnt++; + END_PE(); + pe_attr = XVaCreateNestedList(0, USE_PE(0), USE_PE(1), USE_PE(2), + USE_PE(3), USE_PE(4), USE_PE(5), + USE_PE(6), USE_PE(7), USE_PE(8), + USE_PE(9), USE_PE(10), USE_PE(11), + USE_PE(12), USE_PE(13), NULL); + ADD_IC(XNPreeditAttributes); + ADD_IC(pe_attr); } if (st_cnt > 0) { - st_a[st_cnt] = (XPointer) NULL; - st_attr = XVaCreateNestedList(0, st_a[0], st_a[1], st_a[2], st_a[3], - st_a[4], st_a[5], st_a[6], st_a[7], - st_a[8], st_a[9], st_a[10], st_a[11], - st_a[12], st_a[13], st_a[14], st_a[15], - st_a[16], st_a[17], st_a[18], NULL); - ic_a[ic_cnt] = (XPointer) XNStatusAttributes; ic_cnt++; - ic_a[ic_cnt] = (XPointer) st_attr; ic_cnt++; + END_ST(); + st_attr = XVaCreateNestedList(0, USE_ST(0), USE_ST(1), USE_ST(2), + USE_ST(3), USE_ST(4), USE_ST(5), + USE_ST(6), USE_ST(7), USE_ST(8), + USE_ST(9), NULL); + ADD_IC(XNStatusAttributes); + ADD_IC(st_attr); } if (focus == TRUE) { - ic_a[ic_cnt] = (XPointer) XNFocusWindow; ic_cnt++; - ic_a[ic_cnt] = (XPointer) XtWindow(w); ic_cnt++; + ADD_IC(XNFocusWindow); + ADD_IC(XtWindow(w)); } if (ic_cnt > 0) { - ic_a[ic_cnt] = (XPointer) NULL; - XSetICValues(p->xic, ic_a[0], ic_a[1], ic_a[2], ic_a[3], ic_a[4], - ic_a[5], ic_a[6], ic_a[7], ic_a[8], ic_a[9], ic_a[10], - ic_a[11], ic_a[12], ic_a[13], ic_a[14], ic_a[15], - ic_a[16], ic_a[17], ic_a[18], NULL); + END_IC(); + XSetICValues(p->xic, USE_IC(0), USE_IC(1), USE_IC(2), USE_IC(3), + USE_IC(4), USE_IC(5), NULL); if (pe_attr) XtFree(pe_attr); if (st_attr) XtFree(st_attr); } @@ -1085,13 +1069,13 @@ CurrentSharedIcTable(XawVendorShellExtPart *ve) static void SetICFocus(Widget w, XawVendorShellExtPart *ve) { - XawIcTableList p, pp; + XawIcTableList p; if ((ve->im.xim == NULL) || ((p = GetIcTableShared(w, ve)) == NULL) || (p->xic == NULL)) return; if (IsSharedIC(ve)) { - pp = CurrentSharedIcTable(ve); + XawIcTableList pp = CurrentSharedIcTable(ve); if (pp == NULL || pp->widget != w) { SharedICChangeFocusWindow(w, ve, p); } @@ -1232,10 +1216,12 @@ UnsetFocus(Widget inwidg) { XawVendorShellExtPart *ve; VendorShellWidget vw; - XawIcTableList p; if ((vw = SearchVendorShell(inwidg)) == NULL) return; + if ((ve = GetExtPart(vw)) != NULL) { + XawIcTableList p; + if ((p = GetIcTableShared(inwidg, ve)) == NULL) return; if (p->flg & CIICFocus) { p->flg &= (unsigned long)(~CIICFocus); diff --git a/lib/libXaw/src/sharedlib.c b/lib/libXaw/src/sharedlib.c deleted file mode 100644 index e892d82c2..000000000 --- a/lib/libXaw/src/sharedlib.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - -Copyright 1991, 1994, 1998 The Open Group - -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 Open Group 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 Open Group. - -*/ - -#if defined(SUNSHLIB) && !defined(SHAREDCODE) - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <X11/IntrinsicP.h> -#include <X11/Xaw/AsciiSinkP.h> -#include <X11/Xaw/AsciiSrcP.h> -#include <X11/Xaw/AsciiTextP.h> -#include <X11/Xaw/MultiSinkP.h> -#include <X11/Xaw/MultiSrcP.h> -#include <X11/Xaw/BoxP.h> -#include <X11/Xaw/CommandP.h> -#include <X11/Xaw/DialogP.h> -#include <X11/Xaw/FormP.h> -#include <X11/Xaw/GripP.h> -#include <X11/Xaw/LabelP.h> -#include <X11/Xaw/ListP.h> -#include <X11/Xaw/MenuButtoP.h> -#include <X11/Xaw/PanedP.h> -#include <X11/Xaw/PannerP.h> -#include <X11/Xaw/PortholeP.h> -#include <X11/Xaw/RepeaterP.h> -#include <X11/Xaw/ScrollbarP.h> -#include <X11/Xaw/SimpleP.h> -#include <X11/Xaw/SimpleMenP.h> -#include <X11/Xaw/SmeP.h> -#include <X11/Xaw/SmeBSBP.h> -#include <X11/Xaw/SmeLineP.h> -#include <X11/Xaw/StripCharP.h> -#include <X11/Xaw/TextP.h> -#include <X11/Xaw/TextSinkP.h> -#include <X11/Xaw/TextSrcP.h> -#include <X11/Xaw/ToggleP.h> -#include <X11/Xaw/TreeP.h> -#include <X11/VendorP.h> -#include <X11/Xaw/ViewportP.h> - -extern AsciiSinkClassRec asciiSinkClassRec; -WidgetClass asciiSinkObjectClass = (WidgetClass)&asciiSinkClassRec; - -extern AsciiSrcClassRec asciiSrcClassRec; -WidgetClass asciiSrcObjectClass = (WidgetClass)&asciiSrcClassRec; - -extern AsciiTextClassRec asciiTextClassRec; -WidgetClass asciiTextWidgetClass = (WidgetClass)&asciiTextClassRec; - -#ifdef ASCII_STRING -extern AsciiStringClassRec asciiStringClassRec; -WidgetClass asciiStringWidgetClass = (WidgetClass)&asciiStringClassRec; -#endif - -#ifdef ASCII_DISK -extern AsciiDiskClassRec asciiDiskClassRec; -WidgetClass asciiDiskWidgetClass = (WidgetClass)&asciiDiskClassRec; -#endif - -extern MultiSinkClassRec multiSinkClassRec; -WidgetClass multiSinkObjectClass = (WidgetClass)&multiSinkClassRec; - -extern MultiSrcClassRec multiSrcClassRec; -WidgetClass multiSrcObjectClass = (WidgetClass)&multiSrcClassRec; - -extern BoxClassRec boxClassRec; -WidgetClass boxWidgetClass = (WidgetClass)&boxClassRec; - -extern CommandClassRec commandClassRec; -WidgetClass commandWidgetClass = (WidgetClass) &commandClassRec; - -extern DialogClassRec dialogClassRec; -WidgetClass dialogWidgetClass = (WidgetClass)&dialogClassRec; - -extern FormClassRec formClassRec; -WidgetClass formWidgetClass = (WidgetClass)&formClassRec; - -extern GripClassRec gripClassRec; -WidgetClass gripWidgetClass = (WidgetClass) &gripClassRec; - -extern LabelClassRec labelClassRec; -WidgetClass labelWidgetClass = (WidgetClass)&labelClassRec; - -extern ListClassRec listClassRec; -WidgetClass listWidgetClass = (WidgetClass)&listClassRec; - -extern MenuButtonClassRec menuButtonClassRec; -WidgetClass menuButtonWidgetClass = (WidgetClass) &menuButtonClassRec; - -extern PanedClassRec panedClassRec; -WidgetClass panedWidgetClass = (WidgetClass) &panedClassRec; -WidgetClass vPanedWidgetClass = (WidgetClass) &panedClassRec; - -extern PannerClassRec pannerClassRec; -WidgetClass pannerWidgetClass = (WidgetClass) &pannerClassRec; - -extern PortholeClassRec portholeClassRec; -WidgetClass portholeWidgetClass = (WidgetClass) &portholeClassRec; - -extern RepeaterClassRec repeaterClassRec; -WidgetClass repeaterWidgetClass = (WidgetClass) &repeaterClassRec; - -extern ScrollbarClassRec scrollbarClassRec; -WidgetClass scrollbarWidgetClass = (WidgetClass)&scrollbarClassRec; - -extern SimpleClassRec simpleClassRec; -WidgetClass simpleWidgetClass = (WidgetClass)&simpleClassRec; - -extern SimpleMenuClassRec simpleMenuClassRec; -WidgetClass simpleMenuWidgetClass = (WidgetClass)&simpleMenuClassRec; - -extern SmeClassRec smeClassRec; -WidgetClass smeObjectClass = (WidgetClass) &smeClassRec; - -extern SmeBSBClassRec smeBSBClassRec; -WidgetClass smeBSBObjectClass = (WidgetClass) &smeBSBClassRec; - -extern SmeLineClassRec smeLineClassRec; -WidgetClass smeLineObjectClass = (WidgetClass) &smeLineClassRec; - -extern StripChartClassRec stripChartClassRec; -WidgetClass stripChartWidgetClass = (WidgetClass) &stripChartClassRec; - -extern TextClassRec textClassRec; -WidgetClass textWidgetClass = (WidgetClass)&textClassRec; - -unsigned long FMT8BIT = 0L; -unsigned long XawFmt8Bit = 0L; -unsigned long XawFmtWide = 0L; - -extern TextSinkClassRec textSinkClassRec; -WidgetClass textSinkObjectClass = (WidgetClass)&textSinkClassRec; - -extern TextSrcClassRec textSrcClassRec; -WidgetClass textSrcObjectClass = (WidgetClass)&textSrcClassRec; - -extern ToggleClassRec toggleClassRec; -WidgetClass toggleWidgetClass = (WidgetClass) &toggleClassRec; - -extern TreeClassRec treeClassRec; -WidgetClass treeWidgetClass = (WidgetClass) &treeClassRec; - -extern VendorShellClassRec vendorShellClassRec; -WidgetClass vendorShellWidgetClass = (WidgetClass) &vendorShellClassRec; - -extern ViewportClassRec viewportClassRec; -WidgetClass viewportWidgetClass = (WidgetClass)&viewportClassRec; - -#endif /* SUNSHLIB */ diff --git a/lib/libXaw/test-driver b/lib/libXaw/test-driver new file mode 100644 index 000000000..be73b80ad --- /dev/null +++ b/lib/libXaw/test-driver @@ -0,0 +1,153 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 2011-2021 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. + +# 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 file is maintained in Automake, please report +# bugs to <bug-automake@gnu.org> or send patches to +# <automake-patches@gnu.org>. + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <<END +Usage: + test-driver --test-name NAME --log-file PATH --trs-file PATH + [--expect-failure {yes|no}] [--color-tests {yes|no}] + [--enable-hard-errors {yes|no}] [--] + TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] + +The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. +END +} + +test_name= # Used for reporting. +log_file= # Where to save the output of the test script. +trs_file= # Where to save the metadata of the test run. +expect_failure=no +color_tests=no +enable_hard_errors=yes +while test $# -gt 0; do + case $1 in + --help) print_usage; exit $?;; + --version) echo "test-driver $scriptversion"; exit $?;; + --test-name) test_name=$2; shift;; + --log-file) log_file=$2; shift;; + --trs-file) trs_file=$2; shift;; + --color-tests) color_tests=$2; shift;; + --expect-failure) expect_failure=$2; shift;; + --enable-hard-errors) enable_hard_errors=$2; shift;; + --) shift; break;; + -*) usage_error "invalid option: '$1'";; + *) break;; + esac + shift +done + +missing_opts= +test x"$test_name" = x && missing_opts="$missing_opts --test-name" +test x"$log_file" = x && missing_opts="$missing_opts --log-file" +test x"$trs_file" = x && missing_opts="$missing_opts --trs-file" +if test x"$missing_opts" != x; then + usage_error "the following mandatory options are missing:$missing_opts" +fi + +if test $# -eq 0; then + usage_error "missing argument" +fi + +if test $color_tests = yes; then + # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'. + red='[0;31m' # Red. + grn='[0;32m' # Green. + lgn='[1;32m' # Light green. + blu='[1;34m' # Blue. + mgn='[0;35m' # Magenta. + std='[m' # No color. +else + red= grn= lgn= blu= mgn= std= +fi + +do_exit='rm -f $log_file $trs_file; (exit $st); exit $st' +trap "st=129; $do_exit" 1 +trap "st=130; $do_exit" 2 +trap "st=141; $do_exit" 13 +trap "st=143; $do_exit" 15 + +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 +estatus=$? + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>"$log_file" + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: |