Update to xcalc 1.0.6

This commit is contained in:
matthieu 2015-01-25 11:34:27 +00:00
parent 6091bd3f05
commit 680485cb7f
11 changed files with 1324 additions and 684 deletions

View File

@ -1,3 +1,149 @@
commit 0fba659f91bebe1f92f4de2660bf806fd049350b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jan 19 21:26:22 2015 -0800
xcalc 1.0.6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a647c9bd255c136f9e6e3e274ecf4253e9ead6d6
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Aug 7 19:20:44 2014 -0700
Replace index() call with strchr()
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit a91574fe283263a3f9d91fb257ecb2c5b0a97541
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jun 2 22:10:55 2014 -0700
autogen.sh: Honor NOCONFIGURE=1
See http://people.gnome.org/~walters/docs/build-api.txt
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 6387133e231ec16da4204fddaffafe70d077e5d8
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jun 2 22:10:55 2014 -0700
configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 8afe5270310698d24fff370276c7fd91eb816720
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Tue Dec 17 08:24:45 2013 -0500
Replace signal_t with void
Now that Imake SIGNALRETURNSINT has been removed, the signal handler
function return type can only be void.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 40911339c45a880abbe6ad60dac4718a402d88ab
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Mon Dec 16 10:04:46 2013 -0500
Assume signal handlers return void, as C89 requires
Drops use of Imake's obsolete SIGNALRETURNSINT.
Reviewd-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
commit 25454313c637f2b6983ba289deed96141cec8000
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Jul 9 23:01:23 2013 -0700
Mark functions noreturn as suggested by gcc -Wmissing-noreturn
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit de0e13ada857191a59c0e8f985d2317a7c41f43b
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Jul 9 22:56:02 2013 -0700
Rename "e" arguments to "ev" to avoid shadowing e() function
Resolves many gcc warnings of the form:
actions.c: In function add:
actions.c:142:35: warning: declaration of e shadows a global declaration
actions.c:57:13: warning: shadowed declaration is here [-Wshadow]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 40da34202dffa96197c6248a9d80894611e27921
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Jul 9 22:53:07 2013 -0700
Remove redundant redeclaration of factorial
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 1de8253f0ede02ec87d28b028de97da79adc12e2
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Tue Jul 9 22:49:21 2013 -0700
Replace sprintf & strcpy calls with snprintf & strlcpy
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 3d58c22c4c2729d52b5278c0e6350c0f9f44cfa8
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jul 6 20:45:40 2013 -0700
Remove unused min & max macros from math.c
Flagged by clang:
math.c:33:9: warning: macro is not used [-Wunused-macros]
#define min(a,b) ((a) < (b) ? (a) : (b))
^
math.c:34:9: warning: macro is not used [-Wunused-macros]
#define max(a,b) ((a) > (b) ? (a) : (b))
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 3e6d23bb9d57ae3d19e9eb47ced654669fca4d7c
Author: Stéphane Aulery <lkppo@free.fr>
Date: Sun Jul 7 02:02:46 2013 +0200
Use the new M_E symbol from math.h
Use the new M_E symbol from math.h and fix and a value of the same
accuracy if it's necessary to redefine M_E.
Signed-off-by: Stéphane Aulery <lkppo@free.fr>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit f3b065f03a7b68310b489d5d97b11985ef36e977
Author: Stéphane Aulery <lkppo@free.fr>
Date: Sun Jul 7 02:02:38 2013 +0200
Use the new M_PI symbol from math.h
Use the new M_PI symbol from math.h and fix and a value of the same
accuracy if it's necessary to redefine M_PI.
Signed-off-by: Stéphane Aulery <lkppo@free.fr>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b9a89876666a42ad8692e8384a5a826456e6ae56
Author: Stéphane Aulery <lkppo@free.fr>
Date: Sat Jul 6 15:39:07 2013 +0200
Drop CRAY support
Signed-off-by: Stéphane Aulery <lkppo@free.fr>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7e67bcb9563302f4e89be7a2afb1ae30c185689e commit 7e67bcb9563302f4e89be7a2afb1ae30c185689e
Author: Alan Coopersmith <alan.coopersmith@oracle.com> Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jan 14 23:08:54 2013 -0800 Date: Mon Jan 14 23:08:54 2013 -0800

View File

@ -76,8 +76,8 @@ bin_PROGRAMS = xcalc$(EXEEXT)
subdir = . subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_appdefault_DATA) \ DIST_COMMON = README $(am__configure_deps) $(dist_appdefault_DATA) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \ $(srcdir)/config.h.in $(top_srcdir)/configure COPYING \
ChangeLog INSTALL NEWS config.guess config.sub depcomp \ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
install-sh missing install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@ -262,7 +262,6 @@ LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@ MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_DIR = @MISC_MAN_DIR@
@ -278,6 +277,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
@ -362,7 +363,7 @@ all: config.h
.SUFFIXES: .c .o .obj .SUFFIXES: .c .o .obj
am--refresh: Makefile am--refresh: Makefile
@: @:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
case '$(am__configure_deps)' in \ case '$(am__configure_deps)' in \
*$$dep*) \ *$$dep*) \
@ -389,9 +390,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF) $(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
@ -402,7 +403,7 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1 @rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER)) ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1 rm -f stamp-h1
touch $@ touch $@

199
app/xcalc/aclocal.m4 vendored
View File

@ -20,6 +20,7 @@ If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
# #
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
# #
@ -46,8 +47,12 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# ---------------------------------- # ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG], AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi fi
@ -60,7 +65,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
PKG_CONFIG="" PKG_CONFIG=""
fi fi
fi[]dnl fi[]dnl
])# PKG_PROG_PKG_CONFIG ])# PKG_PROG_PKG_CONFIG
@ -69,33 +73,31 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar # Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors. # to PKG_CHECK_MODULES(), but does not set variables or print errors.
# #
# # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# Similar to PKG_CHECK_MODULES, make sure that the first instance of # only at the first occurence in configure.ac, so if the first place
# this or PKG_CHECK_MODULES is called, or make sure to call # it's called might be skipped (such as if it is within an "if", you
# PKG_CHECK_EXISTS manually # have to call PKG_CHECK_EXISTS manually
# -------------------------------------------------------------- # --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS], AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:]) m4_default([$2], [:])
m4_ifvaln([$3], [else m4_ifvaln([$3], [else
$3])dnl $3])dnl
fi]) fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# --------------------------------------------- # ---------------------------------------------
m4_define([_PKG_CONFIG], m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then [if test -n "$$1"; then
if test -n "$$1"; then
pkg_cv_[]$1="$$1" pkg_cv_[]$1="$$1"
else elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3], PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes]) [pkg_failed=yes])
fi else
else
pkg_failed=untried pkg_failed=untried
fi[]dnl fi[]dnl
])# _PKG_CONFIG ])# _PKG_CONFIG
@ -138,16 +140,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.]) See the pkg-config man page for more details.])
if test $pkg_failed = yes; then if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED _PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met: [Package requirements ($2) were not met:
$$1_PKG_ERRORS $$1_PKG_ERRORS
@ -155,28 +158,67 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix. installed software in a non-standard prefix.
_PKG_TEXT _PKG_TEXT])[]dnl
])], ])
[AC_MSG_RESULT([no])
$4])
elif test $pkg_failed = untried; then elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it [The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config. path to pkg-config.
_PKG_TEXT _PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])], To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
[$4]) ])
else else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3]) $3
fi[]dnl fi[]dnl
])# PKG_CHECK_MODULES ])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# Copyright (C) 2002-2012 Free Software Foundation, Inc. # Copyright (C) 2002-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
@ -757,44 +799,6 @@ fi
rmdir .tst 2>/dev/null rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])]) AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
#
# This file 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.
# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
# Default is to disable them, unless 'enable' is passed literally.
# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
[enable], [m4_define([am_maintainer_other], [disable])],
[disable], [m4_define([am_maintainer_other], [enable])],
[m4_define([am_maintainer_other], [enable])
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
am_maintainer_other[ make rules and dependencies not useful
(and sometimes confusing) to the casual installer])],
[USE_MAINTAINER_MODE=$enableval],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST([MAINT])dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*- # Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2012 Free Software Foundation, Inc. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
@ -1237,7 +1241,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what # See the "minimum version" comment for each macro you use to see what
# version you require. # version you require.
m4_defun([XORG_MACROS_VERSION],[ m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.17]) m4_define([vers_have], [1.19.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) 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_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,, m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1287,6 +1291,7 @@ if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else 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" RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
@ -1295,6 +1300,7 @@ else
fi fi
rm -f conftest.$ac_ext rm -f conftest.$ac_ext
AC_SUBST(RAWCPPFLAGS) AC_SUBST(RAWCPPFLAGS)
AC_SUBST(TRADITIONALCPPFLAGS)
]) # XORG_PROG_RAWCPP ]) # XORG_PROG_RAWCPP
# XORG_MANPAGE_SECTIONS() # XORG_MANPAGE_SECTIONS()
@ -1819,9 +1825,10 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
]) # XORG_WITH_ASCIIDOC ]) # XORG_WITH_ASCIIDOC
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) # XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
# -------------------------------- # -------------------------------------------
# Minimum version: 1.5.0 # Minimum version: 1.5.0
# Minimum version for optional DEFAULT argument: 1.11.0 # Minimum version for optional DEFAULT argument: 1.11.0
# Minimum version for optional DOT checking: 1.18.0
# #
# Documentation tools are not always available on all platforms and sometimes # Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the # not at the appropriate level. This macro enables a module to test for the
@ -1841,6 +1848,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
# #
AC_DEFUN([XORG_WITH_DOXYGEN],[ AC_DEFUN([XORG_WITH_DOXYGEN],[
AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
m4_define([_defopt], m4_default([$2], [auto])) m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(doxygen, AC_ARG_WITH(doxygen,
AS_HELP_STRING([--with-doxygen], AS_HELP_STRING([--with-doxygen],
@ -1884,6 +1892,20 @@ m4_ifval([$1],
AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
fi]) fi])
fi]) fi])
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
dnl HAVE_DOT = @HAVE_DOT@
HAVE_DOT=no
if test "x$have_doxygen" = "xyes"; then
AC_PATH_PROG([DOT], [dot])
if test "x$DOT" != "x"; then
HAVE_DOT=yes
fi
fi
AC_SUBST([HAVE_DOT])
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
]) # XORG_WITH_DOXYGEN ]) # XORG_WITH_DOXYGEN
@ -2066,6 +2088,29 @@ fi])
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
]) # XORG_WITH_FOP ]) # XORG_WITH_FOP
# XORG_WITH_M4([MIN-VERSION])
# ---------------------------
# Minimum version: 1.19.0
#
# This macro attempts to locate an m4 macro processor which supports
# -I option and is only useful for modules relying on M4 in order to
# expand macros in source code files.
#
# Interface to module:
# M4: returns the path of the m4 program found
# returns the path set by the user in the environment
#
AC_DEFUN([XORG_WITH_M4], [
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
[AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
[[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
[AC_MSG_ERROR([could not find m4 that supports -I option])],
[$PATH:/usr/gnu/bin])])
AC_SUBST([M4], [$ac_cv_path_M4])
]) # XORG_WITH_M4
# XORG_WITH_PS2PDF([DEFAULT]) # XORG_WITH_PS2PDF([DEFAULT])
# ---------------- # ----------------
# Minimum version: 1.6.0 # Minimum version: 1.6.0
@ -2520,7 +2565,8 @@ AC_ARG_ENABLE(malloc0returnsnull,
AC_MSG_CHECKING([whether malloc(0) returns NULL]) AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([AC_LANG_PROGRAM([ AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h> #include <stdlib.h>
],[ ],[
char *m0, *r0, *c0, *p; char *m0, *r0, *c0, *p;
@ -2530,9 +2576,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
c0 = calloc(0,10); c0 = calloc(0,10);
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
])], ])],
[MALLOC_ZERO_RETURNS_NULL=yes], [xorg_cv_malloc0_returns_null=yes],
[MALLOC_ZERO_RETURNS_NULL=no], [xorg_cv_malloc0_returns_null=no])])
[MALLOC_ZERO_RETURNS_NULL=yes]) MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
fi fi
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
@ -2743,18 +2789,18 @@ fi
found="no" found="no"
m4_foreach([flag], m4_cdr($@), [ m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[]) AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[]) cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid, AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
@ -2821,7 +2867,7 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
] ]
) )
@ -2830,16 +2876,17 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# These are currently disabled because they are noisy. They will be enabled # These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence # in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings. # them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds # Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed. # when there are problems that should be fixed.

View File

@ -45,48 +45,47 @@ from the X Consortium.
#define XCALC_PRE_OP(keynum) if (pre_op(keynum)) return; #define XCALC_PRE_OP(keynum) if (pre_op(keynum)) return;
#endif #endif
static void add(Widget w, XEvent *e, String *vector, Cardinal *count); static void add(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void back(Widget w, XEvent *e, String *vector, Cardinal *count); static void back(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void bell(Widget w, XEvent *e, String *vector, Cardinal *count); static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void clearit(Widget w, XEvent *e, String *vector, Cardinal *count); static void clearit(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void cosine(Widget w, XEvent *e, String *vector, Cardinal *count); static void cosine(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void decimal(Widget w, XEvent *e, String *vector, Cardinal *count); static void decimal(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void degree(Widget w, XEvent *e, String *vector, Cardinal *count); static void degree(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void digit(Widget w, XEvent *e, String *vector, Cardinal *count); static void digit(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void divide(Widget w, XEvent *e, String *vector, Cardinal *count); static void divide(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void e(Widget w, XEvent *e, String *vector, Cardinal *count); static void e(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void enter(Widget w, XEvent *e, String *vector, Cardinal *count); static void enter(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void epower(Widget w, XEvent *e, String *vector, Cardinal *count); static void epower(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void equal(Widget w, XEvent *e, String *vector, Cardinal *count); static void equal(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void exchange(Widget w, XEvent *e, String *vector, Cardinal *count); static void exchange(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void factorial(Widget w, XEvent *e, String *vector, Cardinal *count); static void factorial(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void inverse(Widget w, XEvent *e, String *vector, Cardinal *count); static void inverse(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void leftParen(Widget w, XEvent *e, String *vector, Cardinal *count); static void leftParen(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void logarithm(Widget w, XEvent *e, String *vector, Cardinal *count); static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void multiply(Widget w, XEvent *e, String *vector, Cardinal *count); static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void naturalLog(Widget w, XEvent *e, String *vector, Cardinal *count); static void naturalLog(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void factorial(Widget w, XEvent *e, String *vector, Cardinal *count); static void negate(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void negate(Widget w, XEvent *e, String *vector, Cardinal *count); static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void nop(Widget w, XEvent *e, String *vector, Cardinal *count); static void off(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void off(Widget w, XEvent *e, String *vector, Cardinal *count); static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void pi(Widget w, XEvent *e, String *vector, Cardinal *count); static void power(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void power(Widget w, XEvent *e, String *vector, Cardinal *count); static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void quit(Widget w, XEvent *e, String *vector, Cardinal *count); static void recall(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void recall(Widget w, XEvent *e, String *vector, Cardinal *count); static void reciprocal(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void reciprocal(Widget w, XEvent *e, String *vector, Cardinal *count); static void rightParen(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void rightParen(Widget w, XEvent *e, String *vector, Cardinal *count); static void roll(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void roll(Widget w, XEvent *e, String *vector, Cardinal *count); static void scientific(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void scientific(Widget w, XEvent *e, String *vector, Cardinal *count); static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void selection(Widget w, XEvent *e, String *vector, Cardinal *count); static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void sine(Widget w, XEvent *e, String *vector, Cardinal *count); static void square(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void square(Widget w, XEvent *e, String *vector, Cardinal *count); static void squareRoot(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void squareRoot(Widget w, XEvent *e, String *vector, Cardinal *count); static void store(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void store(Widget w, XEvent *e, String *vector, Cardinal *count); static void subtract(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void subtract(Widget w, XEvent *e, String *vector, Cardinal *count); static void sum(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void sum(Widget w, XEvent *e, String *vector, Cardinal *count); static void tangent(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void tangent(Widget w, XEvent *e, String *vector, Cardinal *count); static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void tenpower(Widget w, XEvent *e, String *vector, Cardinal *count); static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void XexchangeY(Widget w, XEvent *e, String *vector, Cardinal *count);
/* /*
* calculator action table * calculator action table
@ -139,7 +138,7 @@ XtActionsRec Actions[] = {
int ActionsCount = XtNumber(Actions); int ActionsCount = XtNumber(Actions);
/*ARGSUSED*/ /*ARGSUSED*/
static void add(Widget w, XEvent *e, String *vector, Cardinal *count) static void add(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kADD); XCALC_PRE_OP(kADD);
rpn ? twof(kADD) : twoop(kADD); rpn ? twof(kADD) : twoop(kADD);
@ -147,7 +146,7 @@ static void add(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void back(Widget w, XEvent *e, String *vector, Cardinal *count) static void back(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kBKSP); XCALC_PRE_OP(kBKSP);
bkspf(); bkspf();
@ -155,13 +154,13 @@ static void back(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void bell(Widget w, XEvent *e, String *vector, Cardinal *count) static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
ringbell(); ringbell();
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void clearit(Widget w, XEvent *e, String *vector, Cardinal *count) static void clearit(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kCLR); XCALC_PRE_OP(kCLR);
clearf(); clearf();
@ -169,7 +168,7 @@ static void clearit(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void cosine(Widget w, XEvent *e, String *vector, Cardinal *count) static void cosine(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kCOS); XCALC_PRE_OP(kCOS);
oneop(kCOS); oneop(kCOS);
@ -177,7 +176,7 @@ static void cosine(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void decimal(Widget w, XEvent *e, String *vector, Cardinal *count) static void decimal(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kDEC); XCALC_PRE_OP(kDEC);
decf(); decf();
@ -185,7 +184,7 @@ static void decimal(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void degree(Widget w, XEvent *e, String *vector, Cardinal *count) static void degree(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kDRG); XCALC_PRE_OP(kDRG);
drgf(); drgf();
@ -193,7 +192,7 @@ static void degree(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void digit(Widget w, XEvent *e, String *vector, Cardinal *count) static void digit(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
switch (vector[0][0]) switch (vector[0][0])
{ {
@ -212,7 +211,7 @@ static void digit(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void divide(Widget w, XEvent *e, String *vector, Cardinal *count) static void divide(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kDIV); XCALC_PRE_OP(kDIV);
rpn ? twof(kDIV) : twoop(kDIV); rpn ? twof(kDIV) : twoop(kDIV);
@ -220,7 +219,7 @@ static void divide(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void e(Widget w, XEvent *e, String *vector, Cardinal *count) static void e(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kE); XCALC_PRE_OP(kE);
oneop(kE); oneop(kE);
@ -228,7 +227,7 @@ static void e(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void enter(Widget w, XEvent *e, String *vector, Cardinal *count) static void enter(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kENTR); XCALC_PRE_OP(kENTR);
entrf(); entrf();
@ -236,7 +235,7 @@ static void enter(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void epower(Widget w, XEvent *e, String *vector, Cardinal *count) static void epower(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kEXP); XCALC_PRE_OP(kEXP);
oneop(kEXP); oneop(kEXP);
@ -244,7 +243,7 @@ static void epower(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void equal(Widget w, XEvent *e, String *vector, Cardinal *count) static void equal(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kEQU); XCALC_PRE_OP(kEQU);
equf(); equf();
@ -252,7 +251,7 @@ static void equal(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void exchange(Widget w, XEvent *e, String *vector, Cardinal *count) static void exchange(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kEXC); XCALC_PRE_OP(kEXC);
oneop(kEXC); oneop(kEXC);
@ -260,7 +259,7 @@ static void exchange(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void factorial(Widget w, XEvent *e, String *vector, Cardinal *count) static void factorial(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kFACT); XCALC_PRE_OP(kFACT);
oneop(kFACT); oneop(kFACT);
@ -268,7 +267,7 @@ static void factorial(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void inverse(Widget w, XEvent *e, String *vector, Cardinal *count) static void inverse(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kINV); XCALC_PRE_OP(kINV);
invf(); invf();
@ -276,7 +275,7 @@ static void inverse(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void leftParen(Widget w, XEvent *e, String *vector, Cardinal *count) static void leftParen(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kLPAR); XCALC_PRE_OP(kLPAR);
lparf(); lparf();
@ -284,7 +283,7 @@ static void leftParen(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void logarithm(Widget w, XEvent *e, String *vector, Cardinal *count) static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kLOG); XCALC_PRE_OP(kLOG);
oneop(kLOG); oneop(kLOG);
@ -292,7 +291,7 @@ static void logarithm(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void multiply(Widget w, XEvent *e, String *vector, Cardinal *count) static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kMUL); XCALC_PRE_OP(kMUL);
rpn ? twof(kMUL) : twoop(kMUL); rpn ? twof(kMUL) : twoop(kMUL);
@ -300,7 +299,7 @@ static void multiply(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void naturalLog(Widget w, XEvent *e, String *vector, Cardinal *count) static void naturalLog(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kLN); XCALC_PRE_OP(kLN);
oneop(kLN); oneop(kLN);
@ -308,7 +307,7 @@ static void naturalLog(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void negate(Widget w, XEvent *e, String *vector, Cardinal *count) static void negate(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kNEG); XCALC_PRE_OP(kNEG);
negf(); negf();
@ -316,13 +315,13 @@ static void negate(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void nop(Widget w, XEvent *e, String *vector, Cardinal *count) static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
ringbell(); ringbell();
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void off(Widget w, XEvent *e, String *vector, Cardinal *count) static void off(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kOFF); XCALC_PRE_OP(kOFF);
offf(); offf();
@ -330,7 +329,7 @@ static void off(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void pi(Widget w, XEvent *e, String *vector, Cardinal *count) static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kPI); XCALC_PRE_OP(kPI);
oneop(kPI); oneop(kPI);
@ -338,7 +337,7 @@ static void pi(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void power(Widget w, XEvent *e, String *vector, Cardinal *count) static void power(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kPOW); XCALC_PRE_OP(kPOW);
rpn ? twof(kPOW) : twoop(kPOW); rpn ? twof(kPOW) : twoop(kPOW);
@ -346,16 +345,16 @@ static void power(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void quit(Widget w, XEvent *e, String *vector, Cardinal *count) static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
if (e->type == ClientMessage && e->xclient.data.l[0] != wm_delete_window) if (ev->type == ClientMessage && ev->xclient.data.l[0] != wm_delete_window)
ringbell(); ringbell();
else else
Quit(); Quit();
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void recall(Widget w, XEvent *e, String *vector, Cardinal *count) static void recall(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kRCL); XCALC_PRE_OP(kRCL);
rpn ? memf(kRCL) : oneop(kRCL); rpn ? memf(kRCL) : oneop(kRCL);
@ -363,7 +362,7 @@ static void recall(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void reciprocal(Widget w, XEvent *e, String *vector, Cardinal *count) static void reciprocal(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kRECIP); XCALC_PRE_OP(kRECIP);
oneop(kRECIP); oneop(kRECIP);
@ -371,7 +370,7 @@ static void reciprocal(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void rightParen(Widget w, XEvent *e, String *vector, Cardinal *count) static void rightParen(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kRPAR); XCALC_PRE_OP(kRPAR);
rparf(); rparf();
@ -379,7 +378,7 @@ static void rightParen(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void roll(Widget w, XEvent *e, String *vector, Cardinal *count) static void roll(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kROLL); XCALC_PRE_OP(kROLL);
rollf(); rollf();
@ -387,7 +386,7 @@ static void roll(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void scientific(Widget w, XEvent *e, String *vector, Cardinal *count) static void scientific(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kEE); XCALC_PRE_OP(kEE);
eef(); eef();
@ -395,13 +394,13 @@ static void scientific(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void selection(Widget w, XEvent *e, String *vector, Cardinal *count) static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
do_select(((XButtonReleasedEvent *)e)->time); do_select(((XButtonReleasedEvent *)ev)->time);
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void sine(Widget w, XEvent *e, String *vector, Cardinal *count) static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kSIN); XCALC_PRE_OP(kSIN);
oneop(kSIN); oneop(kSIN);
@ -409,7 +408,7 @@ static void sine(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void square(Widget w, XEvent *e, String *vector, Cardinal *count) static void square(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kSQR); XCALC_PRE_OP(kSQR);
oneop(kSQR); oneop(kSQR);
@ -417,7 +416,7 @@ static void square(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void squareRoot(Widget w, XEvent *e, String *vector, Cardinal *count) static void squareRoot(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kSQRT); XCALC_PRE_OP(kSQRT);
oneop(kSQRT); oneop(kSQRT);
@ -425,7 +424,7 @@ static void squareRoot(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void store(Widget w, XEvent *e, String *vector, Cardinal *count) static void store(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kSTO); XCALC_PRE_OP(kSTO);
rpn ? memf(kSTO) : oneop(kSTO); rpn ? memf(kSTO) : oneop(kSTO);
@ -433,7 +432,7 @@ static void store(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void subtract(Widget w, XEvent *e, String *vector, Cardinal *count) static void subtract(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kSUB); XCALC_PRE_OP(kSUB);
rpn ? twof(kSUB) : twoop(kSUB); rpn ? twof(kSUB) : twoop(kSUB);
@ -441,7 +440,7 @@ static void subtract(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void sum(Widget w, XEvent *e, String *vector, Cardinal *count) static void sum(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kSUM); XCALC_PRE_OP(kSUM);
rpn ? memf(kSUM) : oneop(kSUM); rpn ? memf(kSUM) : oneop(kSUM);
@ -449,7 +448,7 @@ static void sum(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void tangent(Widget w, XEvent *e, String *vector, Cardinal *count) static void tangent(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kTAN); XCALC_PRE_OP(kTAN);
oneop(kTAN); oneop(kTAN);
@ -457,7 +456,7 @@ static void tangent(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void tenpower(Widget w, XEvent *e, String *vector, Cardinal *count) static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(k10X); XCALC_PRE_OP(k10X);
oneop(k10X); oneop(k10X);
@ -465,7 +464,7 @@ static void tenpower(Widget w, XEvent *e, String *vector, Cardinal *count)
} }
/*ARGSUSED*/ /*ARGSUSED*/
static void XexchangeY(Widget w, XEvent *e, String *vector, Cardinal *count) static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
XCALC_PRE_OP(kXXY); XCALC_PRE_OP(kXXY);
twof(kXXY); twof(kXXY);

347
app/xcalc/compile Normal file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, 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 <http://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>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -18,6 +18,9 @@
/* Define to 1 if you have the <string.h> header file. */ /* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H #undef HAVE_STRING_H
/* Define to 1 if you have the `strlcpy' function. */
#undef HAVE_STRLCPY
/* Define to 1 if you have the <sys/stat.h> header file. */ /* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H #undef HAVE_SYS_STAT_H

905
app/xcalc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -23,14 +23,13 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf # Initialize Autoconf
AC_PREREQ([2.60]) AC_PREREQ([2.60])
AC_INIT([xcalc], [1.0.5], AC_INIT([xcalc], [1.0.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xcalc]) [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xcalc])
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
# Initialize Automake # Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION], m4_ifndef([XORG_MACROS_VERSION],
@ -38,8 +37,10 @@ m4_ifndef([XORG_MACROS_VERSION],
XORG_MACROS_VERSION(1.8) XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS XORG_DEFAULT_OPTIONS
AC_CHECK_FUNCS([strlcpy])
# Checks for pkg-config packages # Checks for pkg-config packages
PKG_CHECK_MODULES(XCALC, xaw7 xt x11) PKG_CHECK_MODULES(XCALC, [xaw7 xt x11 xproto >= 7.0.17])
PKG_CHECK_MODULES(APPDEFS, xt) PKG_CHECK_MODULES(APPDEFS, xt)
xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt` xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`

View File

@ -155,7 +155,6 @@ LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@ MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_DIR = @MISC_MAN_DIR@
@ -171,6 +170,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
@ -241,7 +242,7 @@ all: all-am
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .$(APP_MAN_SUFFIX) .man .SUFFIXES: .$(APP_MAN_SUFFIX) .man
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
case '$(am__configure_deps)' in \ case '$(am__configure_deps)' in \
*$$dep*) \ *$$dep*) \
@ -266,9 +267,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
install-appmanDATA: $(appman_DATA) install-appmanDATA: $(appman_DATA)

View File

@ -18,43 +18,19 @@
#include "xcalc.h" #include "xcalc.h"
#ifdef _CRAY /* kludge around Cray STDC compiler */ #ifndef M_PI /* sometimes defined in math.h */
double (*log_p)() = log; #define M_PI 3.14159265358979323846
#define log ((*log_p))
double (*exp_p)() = exp;
#define exp ((*exp_p))
double (*sqrt_p)() = sqrt;
#define sqrt ((*sqrt_p))
double (*log10_p)() = log10;
#define log10 ((*log10_p))
double (*atan2_p)() = atan2;
#define atan2 ((*atan2_p))
double (*asin_p)() = asin;
#define asin ((*asin_p))
double (*acos_p)() = acos;
#define acos ((*acos_p))
double (*atan_p)() = atan;
#define atan ((*atan_p))
double (*sin_p)() = sin;
#define sin ((*sin_p))
double (*cos_p)() = cos;
#define cos ((*cos_p))
double (*tan_p)() = tan;
#define tan ((*tan_p))
double (*pow_p)() = pow;
#define pow ((*pow_p))
#endif /* _CRAY */
#ifndef PI /* sometimes defined in math.h */
#define PI 3.14159265358979
#endif #endif
#define E 2.71828182845904
#ifndef M_E /* sometimes defined in math.h */
#define M_E 2.7182818284590452354
#endif
#define MAXDISP 11 #define MAXDISP 11
#define DEG 0 /* DRG mode. used for trig calculations */ #define DEG 0 /* DRG mode. used for trig calculations */
#define RAD 1 #define RAD 1
#define GRAD 2 #define GRAD 2
#define min(a,b) ((a) < (b) ? (a) : (b))
#define max(a,b) ((a) > (b) ? (a) : (b))
#define True 1 #define True 1
#define False 0 #define False 0
@ -69,8 +45,8 @@ jmp_buf env;
static int flagINV, flagPAREN, flagM, drgmode; /* display flags */ static int flagINV, flagPAREN, flagM, drgmode; /* display flags */
static double drg2rad=PI/180.0; /* Conversion factors for trig funcs */ static double drg2rad=M_PI/180.0; /* Conversion factors for trig funcs */
static double rad2drg=180.0/PI; static double rad2drg=180.0/M_PI;
static int entered=1; /* true if display contains a valid number. static int entered=1; /* true if display contains a valid number.
if==2, then use 'dnum', rather than the string if==2, then use 'dnum', rather than the string
stored in the display. (for accuracy) stored in the display. (for accuracy)
@ -102,6 +78,17 @@ static void RollNum(int dir);
static void ClearStacks(void); static void ClearStacks(void);
static int priority(int op); static int priority(int op);
#ifndef HAVE_STRLCPY
/* Close enough for the short strings copied in xcalc */
static inline size_t
strlcpy(char *dst, const char *src, size_t size)
{
strncpy(dst, src, size);
dst[size - 1] = '\0';
return strlen(src);
}
#endif
/* /*
* The following is to deal with the unfortunate assumption that if errno * The following is to deal with the unfortunate assumption that if errno
* is non-zero then an error has occurred. On some systems (e.g. Ultrix), * is non-zero then an error has occurred. On some systems (e.g. Ultrix),
@ -147,9 +134,9 @@ static volatile int SignalKind;
void fail_op(void) void fail_op(void)
{ {
if (SignalKind == SIGFPE) if (SignalKind == SIGFPE)
strcpy(dispstr, "math error"); strlcpy(dispstr, "math error", sizeof(dispstr));
else if (SignalKind == SIGILL) else if (SignalKind == SIGILL)
strcpy(dispstr, "illegal operand"); strlcpy(dispstr, "illegal operand", sizeof(dispstr));
entered=3; entered=3;
DrawDisplay(); DrawDisplay();
@ -157,7 +144,7 @@ void fail_op(void)
} }
/*ARGSUSED*/ /*ARGSUSED*/
signal_t fperr(int sig) void fperr(int sig)
{ {
#if defined(SYSV) || defined(SVR4) || defined(linux) #if defined(SYSV) || defined(SVR4) || defined(linux)
signal(SIGFPE, fperr); signal(SIGFPE, fperr);
@ -168,7 +155,7 @@ signal_t fperr(int sig)
/* for VAX BSD4.3 */ /* for VAX BSD4.3 */
/*ARGSUSED*/ /*ARGSUSED*/
signal_t illerr(int sig) void illerr(int sig)
{ {
/* not reset when caught? */ /* not reset when caught? */
signal(SIGILL, illerr); signal(SIGILL, illerr);
@ -187,7 +174,7 @@ void post_op(void)
#endif #endif
#ifndef IEEE #ifndef IEEE
if (errno) { if (errno) {
strcpy(dispstr,"error"); strlcpy(dispstr, "error", sizeof(dispstr));
DrawDisplay(); DrawDisplay();
entered=3; entered=3;
errno=0; errno=0;
@ -198,17 +185,16 @@ void post_op(void)
static void static void
DrawDisplay(void) DrawDisplay(void)
{ {
if ((int) strlen(dispstr) > 12) { /* strip out some decimal digits */ if (strlen(dispstr) > 12) { /* strip out some decimal digits */
char tmp[32]; char *estr = strchr(dispstr,'e'); /* search for exponent part */
char *estr = index(dispstr,'e'); /* search for exponent part */
if (!estr) dispstr[12]='\0'; /* no exp, just trunc. */ if (!estr) dispstr[12]='\0'; /* no exp, just trunc. */
else { else {
if ((int) strlen(estr) <= 4) char tmp[32];
sprintf(tmp,"%.8s",dispstr); /* leftmost 8 chars */ if (strlen(estr) <= 4) /* leftmost 8 chars plus exponent */
else snprintf(tmp, sizeof(tmp), "%.8s%s", dispstr, estr);
sprintf(tmp,"%.7s",dispstr); /* leftmost 7 chars */ else /* leftmost 7 chars plus exponent */
strcat (tmp,estr); /* plus exponent */ snprintf(tmp, sizeof(tmp), "%.7s%s", dispstr, estr);
strcpy (dispstr,tmp); strlcpy(dispstr, tmp, sizeof(dispstr));
} }
} }
draw(dispstr); draw(dispstr);
@ -252,7 +238,7 @@ numeric(int keynum)
case kRCL: case kRCL:
PushNum(dnum); PushNum(dnum);
dnum = mem[cell]; dnum = mem[cell];
sprintf(dispstr, "%.8g", dnum); snprintf(dispstr, sizeof(dispstr), "%.8g", dnum);
lift_enabled = 1; lift_enabled = 1;
entered = 1; entered = 1;
clrdisp++; clrdisp++;
@ -338,7 +324,7 @@ bkspf(void)
} }
else else
{ {
strcpy(dispstr, "0"); strlcpy(dispstr, "0", sizeof(dispstr));
dnum = 0.0; dnum = 0.0;
clrdisp++; clrdisp++;
flagINV = 0; flagINV = 0;
@ -353,7 +339,7 @@ decf(void)
if (clrdisp) { if (clrdisp) {
if (rpn && lift_enabled) if (rpn && lift_enabled)
PushNum(dnum); PushNum(dnum);
strcpy(dispstr,"0"); strlcpy(dispstr, "0", sizeof(dispstr));
} }
if (!Dpoint) { if (!Dpoint) {
#ifndef X_LOCALE #ifndef X_LOCALE
@ -375,7 +361,7 @@ eef(void)
if (clrdisp) { if (clrdisp) {
if (rpn && lift_enabled) if (rpn && lift_enabled)
PushNum(dnum); PushNum(dnum);
strcpy(dispstr, rpn ? "1" : "0"); strlcpy(dispstr, rpn ? "1" : "0", sizeof(dispstr));
} }
if (!exponent) { if (!exponent) {
strcat(dispstr,"E+"); strcat(dispstr,"E+");
@ -398,7 +384,7 @@ clearf(void)
exponent=Dpoint=0; exponent=Dpoint=0;
clrdisp=1; clrdisp=1;
entered=1; entered=1;
strcpy(dispstr,"0"); strlcpy(dispstr, "0", sizeof(dispstr));
DrawDisplay(); DrawDisplay();
} }
@ -421,8 +407,8 @@ negf(void)
strcpy(dispstr,dispstr+1); /* move str left once */ strcpy(dispstr,dispstr+1); /* move str left once */
else { /* not neg-ed. add a '-' */ else { /* not neg-ed. add a '-' */
char tmp[32]; char tmp[32];
sprintf(tmp,"-%s",dispstr); snprintf(tmp, sizeof(tmp), "-%s", dispstr);
strcpy(dispstr,tmp); strlcpy(dispstr, tmp, sizeof(dispstr));
} }
if (entered==2) if (entered==2)
dnum = -1.0 * dnum; dnum = -1.0 * dnum;
@ -482,7 +468,7 @@ twoop(int keynum)
} }
PushNum(acc); PushNum(acc);
PushOp(keynum); PushOp(keynum);
sprintf(dispstr,"%.8g",acc); snprintf(dispstr, sizeof(dispstr), "%.8g", acc);
DrawDisplay(); DrawDisplay();
dnum=acc; dnum=acc;
} }
@ -514,7 +500,7 @@ twof(int keynum)
case kPOW: acc = pow(acc,dnum); break; case kPOW: acc = pow(acc,dnum); break;
case kXXY: PushNum(dnum); case kXXY: PushNum(dnum);
} }
sprintf(dispstr, "%.8g", acc); snprintf(dispstr, sizeof(dispstr), "%.8g", acc);
DrawDisplay(); DrawDisplay();
clrdisp++; clrdisp++;
Dpoint = exponent = 0; Dpoint = exponent = 0;
@ -580,7 +566,7 @@ equf(void)
PushNum(dnum); PushNum(dnum);
} }
sprintf(dispstr,"%.8g",dnum); snprintf(dispstr, sizeof(dispstr), "%.8g", dnum);
DrawDisplay(); DrawDisplay();
} }
@ -605,7 +591,7 @@ rollf(void)
RollNum(flagINV); RollNum(flagINV);
flagINV=0; flagINV=0;
clrdisp++; clrdisp++;
sprintf(dispstr, "%.8g", dnum); snprintf(dispstr, sizeof(dispstr), "%.8g", dnum);
DrawDisplay(); DrawDisplay();
} }
@ -649,7 +635,7 @@ rparf(void)
(void) PopNum(); (void) PopNum();
flagPAREN--; flagPAREN--;
entered=2; entered=2;
sprintf(dispstr,"%.8g",dnum); snprintf(dispstr, sizeof(dispstr), "%.8g", dnum);
DrawDisplay(); DrawDisplay();
} }
@ -660,27 +646,27 @@ drgf(void)
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(dispstr,"%lf",&dnum);
switch (drgmode) { switch (drgmode) {
case DEG: dnum=dnum*PI/180.0; break; case DEG: dnum=dnum*M_PI/180.0; break;
case RAD: dnum=dnum*200.0/PI; break; case RAD: dnum=dnum*200.0/M_PI; break;
case GRAD: dnum=dnum*90.0/100.0; break; case GRAD: dnum=dnum*90.0/100.0; break;
} }
entered=2; entered=2;
clrdisp=1; clrdisp=1;
flagINV=0; flagINV=0;
sprintf(dispstr,"%.8g",dnum); snprintf(dispstr, sizeof(dispstr), "%.8g", dnum);
} }
flagINV=0; flagINV=0;
drgmode = (drgmode + 1) % 3; drgmode = (drgmode + 1) % 3;
switch (drgmode) { switch (drgmode) {
case DEG: drg2rad=PI / 180.0; case DEG: drg2rad=M_PI / 180.0;
rad2drg=180.0 / PI; rad2drg=180.0 / M_PI;
break; break;
case RAD: drg2rad=1.0; case RAD: drg2rad=1.0;
rad2drg=1.0; rad2drg=1.0;
break; break;
case GRAD: drg2rad=PI / 200.0; case GRAD: drg2rad=M_PI / 200.0;
rad2drg=200.0 / PI; rad2drg=200.0 / M_PI;
break; break;
} }
DrawDisplay(); DrawDisplay();
@ -715,8 +701,8 @@ oneop(int keynum)
entered = 2; entered = 2;
switch (keynum) { /* do the actual math fn. */ switch (keynum) { /* do the actual math fn. */
case kE: if (rpn && memop != kENTR) PushNum(dnum); dnum=E; break; case kE: if (rpn && memop != kENTR) PushNum(dnum); dnum=M_E; break;
case kPI: if (rpn && memop != kENTR) PushNum(dnum); dnum=PI; break; case kPI: if (rpn && memop != kENTR) PushNum(dnum); dnum=M_PI; break;
case kRECIP: dnum=1.0/dnum; break; case kRECIP: dnum=1.0/dnum; break;
case kSQR: flagINV = !flagINV; /* fall through to */ case kSQR: flagINV = !flagINV; /* fall through to */
case kSQRT: if (flagINV) dnum=dnum*dnum; case kSQRT: if (flagINV) dnum=dnum*dnum;
@ -746,7 +732,7 @@ oneop(int keynum)
case kEXC: dtmp=dnum; dnum=mem[0]; mem[0]=dtmp; case kEXC: dtmp=dnum; dnum=mem[0]; mem[0]=dtmp;
flagM=!(mem[0]==0.0); break; flagM=!(mem[0]==0.0); break;
case kFACT: if (floor(dnum)!=dnum || dnum<0.0 || dnum>500.0) { case kFACT: if (floor(dnum)!=dnum || dnum<0.0 || dnum>500.0) {
strcpy(dispstr,"error"); strlcpy(dispstr, "error", sizeof(dispstr));
entered=3; entered=3;
break; break;
} }
@ -766,7 +752,7 @@ oneop(int keynum)
clrdisp=1; clrdisp=1;
flagINV=0; flagINV=0;
lift_enabled = 1; lift_enabled = 1;
sprintf(dispstr,"%.8g",dnum); snprintf(dispstr, sizeof(dispstr), "%.8g", dnum);
DrawDisplay(); DrawDisplay();
} }
@ -799,8 +785,11 @@ static void
PushOp(int op) PushOp(int op)
/*******/ /*******/
{ {
if (opsp==STACKMAX) {strcpy(dispstr,"stack error"); entered=3;} if (opsp==STACKMAX) {
else opstack[opsp++]=op; strlcpy(dispstr, "stack error", sizeof(dispstr));
entered=3;
} else
opstack[opsp++]=op;
} }
/*******/ /*******/
@ -809,7 +798,7 @@ PopOp(void)
/*******/ /*******/
{ {
if (opsp==0) { if (opsp==0) {
strcpy(dispstr,"stack error"); strlcpy(dispstr, "stack error", sizeof(dispstr));
entered=3; entered=3;
return(kNOP); return(kNOP);
} else } else
@ -845,7 +834,7 @@ PushNum(double num)
return; return;
} }
if (numsp==STACKMAX) { if (numsp==STACKMAX) {
strcpy(dispstr,"stack error"); strlcpy(dispstr, "stack error", sizeof(dispstr));
entered=3; entered=3;
} else } else
numstack[numsp++]=num; numstack[numsp++]=num;
@ -863,7 +852,7 @@ PopNum(void)
return(tmp); return(tmp);
} }
if (numsp==0) { if (numsp==0) {
strcpy(dispstr,"stack error"); strlcpy(dispstr, "stack error", sizeof(dispstr));
entered=3; entered=3;
return 0.0; return 0.0;
} else } else
@ -932,9 +921,9 @@ ResetCalc(void)
setflag(XCalc_RADIAN, False); setflag(XCalc_RADIAN, False);
setflag(XCalc_GRADAM, False); setflag(XCalc_GRADAM, False);
setflag(XCalc_DEGREE, True); setflag(XCalc_DEGREE, True);
strcpy(dispstr,"0"); strlcpy(dispstr, "0", sizeof(dispstr));
draw(dispstr); draw(dispstr);
ClearStacks(); ClearStacks();
drg2rad=PI/180.0; drg2rad=M_PI/180.0;
rad2drg=180.0/PI; rad2drg=180.0/M_PI;
} }

View File

@ -37,6 +37,10 @@ from the X Consortium.
#ifndef _XCALC_H_ #ifndef _XCALC_H_
#define _XCALC_H_ #define _XCALC_H_
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
#include <X11/StringDefs.h> #include <X11/StringDefs.h>
@ -51,13 +55,6 @@ from the X Consortium.
#include <errno.h> #include <errno.h>
#include <X11/Xlocale.h> #include <X11/Xlocale.h>
#ifdef SIGNALRETURNSINT
#define signal_t int
#else
#define signal_t void
#endif
#define kRECIP 0 /* reciprocal */ #define kRECIP 0 /* reciprocal */
#define kSQR 1 /* square */ #define kSQR 1 /* square */
#define kSQRT 2 /* square root */ #define kSQRT 2 /* square root */
@ -118,8 +115,8 @@ extern XtActionsRec Actions[];
extern int ActionsCount; extern int ActionsCount;
/* math.c */ /* math.c */
extern signal_t fperr(int sig); extern void fperr(int sig) _X_NORETURN;
extern signal_t illerr(int sig); extern void illerr(int sig) _X_NORETURN;
extern void fail_op(void); extern void fail_op(void);
extern int pre_op(int keynum); extern int pre_op(int keynum);
extern void post_op(void); extern void post_op(void);
@ -151,7 +148,7 @@ extern jmp_buf env;
/* xcalc.c */ /* xcalc.c */
extern void do_select(Time time); extern void do_select(Time time);
extern void draw(char *string); extern void draw(char *string);
extern void Quit(void); extern void Quit(void) _X_NORETURN;
extern void ringbell(void); extern void ringbell(void);
extern void setflag(int indicator, Boolean on); extern void setflag(int indicator, Boolean on);