Update to xcalc 1.1.0

This commit is contained in:
matthieu 2019-08-15 17:13:47 +00:00
parent 274574490b
commit 180002922b
14 changed files with 959 additions and 254 deletions

View File

@ -1,3 +1,208 @@
commit df1721c44e0b357f4d8ae80247861b4a6f7a7bbb
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Jun 9 13:44:24 2019 -0700
xcalc 1.1.0
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 74a71638ace07252e85106d87f80a62b1f07280f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jun 1 17:33:44 2019 -0700
Fix -Wsign-compare warning in quit() function
Reported by gcc 7.3:
actions.c: In function quit:
actions.c:414:60: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (ev->type == ClientMessage && ev->xclient.data.l[0] != wm_delete_window)
^~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 012115650d15697e1cdc13edf770ac9775b108f4
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jun 1 17:29:15 2019 -0700
Fix -Wsign-compare warning in Syntax() function
Reported by gcc 7.3:
xcalc.c: In function Syntax:
xcalc.c:322:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i=0; i < XtNumber(Options); i++)
^
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7a04d51cb90b9a314eea117bc36fedb2bfaab516
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jun 1 17:24:20 2019 -0700
Pass -D_CONST_X_STRING to make libXt declare String as const char *
Clears up 58 of 62 gcc -Wdiscarded-qualifiers warnings in the xcalc build
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 519e35d2c5649a995d39ee26e39809a3b7ffabc9
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jun 1 17:16:11 2019 -0700
Add bitwise ops and base conversion (DEC/OCT/HEX) to man page
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit c4f1bdb16b560d813e6ded83c2d7a4f4d280a90a
Author: Tim Hentenaar <tim@hentenaar.com>
Date: Sat Mar 22 02:47:33 2014 +0100
Add bitwise ops and base conversion (DEC/OCT/HEX) in TI mode
These operations implicitly truncate their parameters, and result to
integers:
* not
* and
* or
* xor
* shl
* shr
* mod
* trunc
Base 2 was left out of the base conversion code intentionally as it
would require making the UI at least one third wider.
Attempts to change base with negative values will simply display
"error." Note that with larger numbers, the result may be inaccurate
due to rounding.
I've also bound the Return key to the equal() action.
Signed-off-by: Tim Hentenaar <tim@hentenaar.com>
commit be5114cebfdc29788cf038d349c0ed6cce4bb536
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Feb 17 13:50:58 2019 -0800
xcalc 1.0.7
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 85c9feb6e10cea1ef017d702151b14717c40b9d5
Author: Stéphane Aulery <lkppo@free.fr>
Date: Sun Jul 7 22:50:30 2013 +0200
Reduce scope of i (cppcheck --verbose --enable=all)
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 aa3d39389bfc752486a83933574d0365c74d4e29
Author: Stéphane Aulery <lkppo@free.fr>
Date: Sun Jul 7 22:50:29 2013 +0200
Reduce scope of cell (cppcheck --verbose --enable=all)
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 8d156f428912aecdd493e075b75e735bfbae7dda
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Wed Nov 21 16:59:17 2018 -0800
Update configure.ac bug URL for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b8f4da1126dd44b4adc5f83ba5c7e06a2de75996
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Nov 16 21:11:40 2018 -0800
Update README for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 8df4b463f69fc3e7e08ce5de284ed7f318935c1e
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 5 12:20:12 2018 -0700
Reword fall through comments to appease gcc -Wimplicit-fallthrough
Gets rid of these warnings:
math.c:707:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
case kSQR: flagINV = !flagINV; /* fall through to */
~~~~~~~~^~~~~~~~~~
math.c:708:3: note: here
case kSQRT: if (flagINV) dnum=dnum*dnum;
^~~~
math.c:711:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
case k10X: flagINV = !flagINV; /* fall through to */
~~~~~~~~^~~~~~~~~~
math.c:712:3: note: here
case kLOG: if (flagINV) dnum=pow(10.0,dnum);
^~~~
math.c:715:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
case kEXP: flagINV = !flagINV; /* fall through to */
~~~~~~~~^~~~~~~~~~
math.c:716:3: note: here
case kLN: if (flagINV) dnum=exp(dnum);
^~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7a90211e35841758ff11e79a1633494e2055df88
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 5 12:15:19 2018 -0700
Fix misleading indentation in math.c
math.c: In function numeric:
math.c:267:3: warning: this if clause does not guard... [-Wmisleading-indentat
ion]
if ((int) strlen(dispstr) >= MAXDISP)
^~
math.c:270:5: note: ...this statement, but the latter is misleadingly indented a
s if it were guarded by the if
switch (keynum){
^~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit d056a3c6843cf5f6c8b392c46bc4f1b637f87d0b
Author: Mihail Konev <k.mvc@ya.ru>
Date: Thu Jan 26 14:00:20 2017 +1000
autogen: add default patch prefix
Signed-off-by: Mihail Konev <k.mvc@ya.ru>
commit f5982d0175359f7db28127cba3a42e08352f295b
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Mon Mar 9 12:00:52 2015 +0000
autogen.sh: use quoted string variables
Place quotes around the $srcdir, $ORIGDIR and $0 variables to prevent
fall-outs, when they contain space.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
commit 004ce8287f9afab014a44c8bb8ba476ef5930a57
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Jan 24 10:32:07 2017 +1000
autogen.sh: use exec instead of waiting for configure to finish
Syncs the invocation of configure with the one from the server.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
commit 0fba659f91bebe1f92f4de2660bf806fd049350b commit 0fba659f91bebe1f92f4de2660bf806fd049350b
Author: Alan Coopersmith <alan.coopersmith@oracle.com> Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Mon Jan 19 21:26:22 2015 -0800 Date: Mon Jan 19 21:26:22 2015 -0800

View File

@ -22,7 +22,7 @@
SUBDIRS = man SUBDIRS = man
bin_PROGRAMS = xcalc bin_PROGRAMS = xcalc
AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) -D_CONST_X_STRING
xcalc_LDADD = $(XCALC_LIBS) -lm xcalc_LDADD = $(XCALC_LIBS) -lm
xcalc_SOURCES = \ xcalc_SOURCES = \
@ -53,3 +53,4 @@ ChangeLog:
dist-hook: ChangeLog INSTALL dist-hook: ChangeLog INSTALL
EXTRA_DIST = README.md

View File

@ -74,7 +74,7 @@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
bin_PROGRAMS = xcalc$(EXEEXT) bin_PROGRAMS = xcalc$(EXEEXT)
subdir = . subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_appdefault_DATA) \ DIST_COMMON = $(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 COPYING \ $(srcdir)/config.h.in $(top_srcdir)/configure COPYING \
ChangeLog INSTALL compile config.guess config.sub depcomp \ ChangeLog INSTALL compile config.guess config.sub depcomp \
@ -341,7 +341,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
SUBDIRS = man SUBDIRS = man
AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) -D_CONST_X_STRING
xcalc_LDADD = $(XCALC_LIBS) -lm xcalc_LDADD = $(XCALC_LIBS) -lm
xcalc_SOURCES = \ xcalc_SOURCES = \
actions.c \ actions.c \
@ -357,6 +357,7 @@ dist_appdefault_DATA = \
app-defaults/XCalc-color app-defaults/XCalc-color
MAINTAINERCLEANFILES = ChangeLog INSTALL MAINTAINERCLEANFILES = ChangeLog INSTALL
EXTRA_DIST = README.md
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive

View File

@ -1,26 +0,0 @@
xcalc is a scientific calculator X11 client that can emulate a TI-30
or an HP-10C.
All questions regarding this software should be directed at the
Xorg mailing list:
http://lists.freedesktop.org/mailman/listinfo/xorg
Please submit bug reports to the Xorg bugzilla:
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
The master development code repository can be found at:
git://anongit.freedesktop.org/git/xorg/app/xcalc
http://cgit.freedesktop.org/xorg/app/xcalc
For patch submission instructions, see:
http://www.x.org/wiki/Development/Documentation/SubmittingPatches
For more information on the git code manager, see:
http://wiki.x.org/wiki/GitPage

18
app/xcalc/README.md Normal file
View File

@ -0,0 +1,18 @@
xcalc is a scientific calculator X11 client that can emulate a TI-30
or an HP-10C.
All questions regarding this software should be directed at the
Xorg mailing list:
https://lists.x.org/mailman/listinfo/xorg
The master development code repository can be found at:
https://gitlab.freedesktop.org/xorg/app/xcalc
Please submit bug reports and requests to merge patches there.
For patch submission instructions, see:
https://www.x.org/wiki/Development/Documentation/SubmittingPatches

278
app/xcalc/aclocal.m4 vendored
View File

@ -19,32 +19,63 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. 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 -*- dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24) dnl serial 11 (pkg-config-0.29.1)
# dnl
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
# dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
# This program is free software; you can redistribute it and/or modify dnl
# it under the terms of the GNU General Public License as published by dnl This program is free software; you can redistribute it and/or modify
# the Free Software Foundation; either version 2 of the License, or dnl it under the terms of the GNU General Public License as published by
# (at your option) any later version. dnl the Free Software Foundation; either version 2 of the License, or
# dnl (at your option) any later version.
# This program is distributed in the hope that it will be useful, but dnl
# WITHOUT ANY WARRANTY; without even the implied warranty of dnl This program is distributed in the hope that it will be useful, but
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl WITHOUT ANY WARRANTY; without even the implied warranty of
# General Public License for more details. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# dnl General Public License for more details.
# You should have received a copy of the GNU General Public License dnl
# along with this program; if not, write to the Free Software dnl You should have received a copy of the GNU General Public License
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl along with this program; if not, write to the Free Software
# dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# As a special exception to the GNU General Public License, if you dnl 02111-1307, USA.
# distribute this file as part of a program that contains a dnl
# configuration script generated by Autoconf, you may include it under dnl As a special exception to the GNU General Public License, if you
# the same distribution terms that you use for the rest of that program. dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.
# PKG_PROG_PKG_CONFIG([MIN-VERSION]) dnl PKG_PREREQ(MIN-VERSION)
# ---------------------------------- dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.1])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
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|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
@ -66,18 +97,19 @@ if test -n "$PKG_CONFIG"; then
PKG_CONFIG="" PKG_CONFIG=""
fi fi
fi[]dnl fi[]dnl
])# PKG_PROG_PKG_CONFIG ])dnl PKG_PROG_PKG_CONFIG
# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
# dnl -------------------------------------------------------------------
# Check to see whether a particular set of modules exists. Similar dnl Since: 0.18
# to PKG_CHECK_MODULES(), but does not set variables or print errors. dnl
# dnl Check to see whether a particular set of modules exists. Similar to
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
# only at the first occurence in configure.ac, so if the first place dnl
# it's called might be skipped (such as if it is within an "if", you dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# have to call PKG_CHECK_EXISTS manually dnl only at the first occurence in configure.ac, so if the first place
# -------------------------------------------------------------- dnl it's called might be skipped (such as if it is within an "if", you
dnl 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" && \
@ -87,8 +119,10 @@ m4_ifvaln([$3], [else
$3])dnl $3])dnl
fi]) fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# --------------------------------------------- dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG], m4_define([_PKG_CONFIG],
[if test -n "$$1"; then [if test -n "$$1"; then
pkg_cv_[]$1="$$1" pkg_cv_[]$1="$$1"
@ -100,10 +134,11 @@ m4_define([_PKG_CONFIG],
else else
pkg_failed=untried pkg_failed=untried
fi[]dnl fi[]dnl
])# _PKG_CONFIG ])dnl _PKG_CONFIG
# _PKG_SHORT_ERRORS_SUPPORTED dnl _PKG_SHORT_ERRORS_SUPPORTED
# ----------------------------- dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) [AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
@ -111,19 +146,17 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
else else
_pkg_short_errors_supported=no _pkg_short_errors_supported=no
fi[]dnl fi[]dnl
])# _PKG_SHORT_ERRORS_SUPPORTED ])dnl _PKG_SHORT_ERRORS_SUPPORTED
# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# [ACTION-IF-NOT-FOUND]) dnl [ACTION-IF-NOT-FOUND])
# dnl --------------------------------------------------------------
# dnl Since: 0.4.0
# Note that if there is a possibility the first call to dnl
# PKG_CHECK_MODULES might not happen, you should be sure to include an dnl Note that if there is a possibility the first call to
# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
# dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
#
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_MODULES], AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
@ -177,16 +210,40 @@ else
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
$3 $3
fi[]dnl fi[]dnl
])# PKG_CHECK_MODULES ])dnl PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY) dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
# ------------------------- dnl [ACTION-IF-NOT-FOUND])
# Substitutes the variable pkgconfigdir as the location where a module dnl ---------------------------------------------------------------------
# should install pkg-config .pc files. By default the directory is dnl Since: 0.29
# $libdir/pkgconfig, but the default can be changed by passing dnl
# DIRECTORY. The user can override through the --with-pkgconfigdir dnl Checks for existence of MODULES and gathers its build flags with
# parameter. dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC
dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR], AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description], m4_pushdef([pkg_description],
@ -197,16 +254,18 @@ AC_ARG_WITH([pkgconfigdir],
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default]) m4_popdef([pkg_default])
m4_popdef([pkg_description]) m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR ])dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY) dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
# ------------------------- dnl --------------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a dnl Since: 0.27
# module should install arch-independent pkg-config .pc files. By dnl
# default the directory is $datadir/pkgconfig, but the default can be dnl Substitutes the variable noarch_pkgconfigdir as the location where a
# changed by passing DIRECTORY. The user can override through the dnl module should install arch-independent pkg-config .pc files. By
# --with-noarch-pkgconfigdir parameter. dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR], AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description], m4_pushdef([pkg_description],
@ -217,7 +276,24 @@ AC_ARG_WITH([noarch-pkgconfigdir],
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default]) m4_popdef([pkg_default])
m4_popdef([pkg_description]) m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR ])dnl PKG_NOARCH_INSTALLDIR
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
# Copyright (C) 2002-2012 Free Software Foundation, Inc. # Copyright (C) 2002-2012 Free Software Foundation, Inc.
# #
@ -1242,7 +1318,7 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl dnl
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
dnl dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"), dnl copy of this software and associated documentation files (the "Software"),
@ -1279,7 +1355,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.19.0]) m4_define([vers_have], [1.19.2])
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,,
@ -1357,6 +1433,17 @@ AC_DEFUN([XORG_MANPAGE_SECTIONS],[
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_SED]) AC_REQUIRE([AC_PROG_SED])
case $host_os in
solaris*)
# Solaris 2.0 - 11.3 use SysV man page section numbers, so we
# check for a man page file found in later versions that use
# traditional section numbers instead
AC_CHECK_FILE([/usr/share/man/man7/attributes.7],
[SYSV_MAN_SECTIONS=false], [SYSV_MAN_SECTIONS=true])
;;
*) SYSV_MAN_SECTIONS=false ;;
esac
if test x$APP_MAN_SUFFIX = x ; then if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1 APP_MAN_SUFFIX=1
fi fi
@ -1372,9 +1459,9 @@ if test x$LIB_MAN_DIR = x ; then
fi fi
if test x$FILE_MAN_SUFFIX = x ; then if test x$FILE_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) FILE_MAN_SUFFIX=4 ;; true) FILE_MAN_SUFFIX=4 ;;
*) FILE_MAN_SUFFIX=5 ;; *) FILE_MAN_SUFFIX=5 ;;
esac esac
fi fi
if test x$FILE_MAN_DIR = x ; then if test x$FILE_MAN_DIR = x ; then
@ -1382,9 +1469,9 @@ if test x$FILE_MAN_DIR = x ; then
fi fi
if test x$MISC_MAN_SUFFIX = x ; then if test x$MISC_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) MISC_MAN_SUFFIX=5 ;; true) MISC_MAN_SUFFIX=5 ;;
*) MISC_MAN_SUFFIX=7 ;; *) MISC_MAN_SUFFIX=7 ;;
esac esac
fi fi
if test x$MISC_MAN_DIR = x ; then if test x$MISC_MAN_DIR = x ; then
@ -1392,9 +1479,9 @@ if test x$MISC_MAN_DIR = x ; then
fi fi
if test x$DRIVER_MAN_SUFFIX = x ; then if test x$DRIVER_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) DRIVER_MAN_SUFFIX=7 ;; true) DRIVER_MAN_SUFFIX=7 ;;
*) DRIVER_MAN_SUFFIX=4 ;; *) DRIVER_MAN_SUFFIX=4 ;;
esac esac
fi fi
if test x$DRIVER_MAN_DIR = x ; then if test x$DRIVER_MAN_DIR = x ; then
@ -1402,9 +1489,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi fi
if test x$ADMIN_MAN_SUFFIX = x ; then if test x$ADMIN_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) ADMIN_MAN_SUFFIX=1m ;; true) ADMIN_MAN_SUFFIX=1m ;;
*) ADMIN_MAN_SUFFIX=8 ;; *) ADMIN_MAN_SUFFIX=8 ;;
esac esac
fi fi
if test x$ADMIN_MAN_DIR = x ; then if test x$ADMIN_MAN_DIR = x ; then
@ -1665,13 +1752,24 @@ m4_ifval([$1],
fi]) fi])
# Test for the ability of xmlto to generate a text target # Test for the ability of xmlto to generate a text target
#
# NOTE: xmlto 0.0.27 or higher return a non-zero return code in the
# following test for empty XML docbook files.
# For compatibility reasons use the following empty XML docbook file and if
# it fails try it again with a non-empty XML file.
have_xmlto_text=no have_xmlto_text=no
cat > conftest.xml << "EOF" cat > conftest.xml << "EOF"
EOF EOF
AS_IF([test "$have_xmlto" = yes], AS_IF([test "$have_xmlto" = yes],
[AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1], [AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes], [have_xmlto_text=yes],
[AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])]) [# Try it again with a non-empty XML file.
cat > conftest.xml << "EOF"
<x></x>
EOF
AS_IF([$XMLTO --skip-validation txt conftest.xml >/dev/null 2>&1],
[have_xmlto_text=yes],
[AC_MSG_WARN([xmlto cannot generate text format, this format skipped])])])])
rm -f conftest.xml rm -f conftest.xml
AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes]) AM_CONDITIONAL([HAVE_XMLTO_TEXT], [test $have_xmlto_text = yes])
AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes]) AM_CONDITIONAL([HAVE_XMLTO], [test "$have_xmlto" = yes])
@ -3067,8 +3165,9 @@ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ || (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" touch \$(top_srcdir)/INSTALL; \
echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
AC_SUBST([INSTALL_CMD]) AC_SUBST([INSTALL_CMD])
]) # XORG_INSTALL ]) # XORG_INSTALL
dnl Copyright 2005 Red Hat, Inc dnl Copyright 2005 Red Hat, Inc
@ -3129,10 +3228,11 @@ AC_DEFUN([XORG_RELEASE_VERSION],[
# #
# #
AC_DEFUN([XORG_CHANGELOG], [ AC_DEFUN([XORG_CHANGELOG], [
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \ CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \ || (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
echo 'git directory not found: installing possibly empty changelog.' >&2)" touch \$(top_srcdir)/ChangeLog; \
echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
AC_SUBST([CHANGELOG_CMD]) AC_SUBST([CHANGELOG_CMD])
]) # XORG_CHANGELOG ]) # XORG_CHANGELOG

View File

@ -46,7 +46,9 @@ from the X Consortium.
#endif #endif
static void add(Widget w, XEvent *ev, String *vector, Cardinal *count); static void add(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void and(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void back(Widget w, XEvent *ev, String *vector, Cardinal *count); static void back(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void base(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count); static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void clearit(Widget w, XEvent *ev, String *vector, Cardinal *count); static void clearit(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void cosine(Widget w, XEvent *ev, String *vector, Cardinal *count); static void cosine(Widget w, XEvent *ev, String *vector, Cardinal *count);
@ -63,11 +65,14 @@ static void factorial(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void inverse(Widget w, XEvent *ev, String *vector, Cardinal *count); static void inverse(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void leftParen(Widget w, XEvent *ev, String *vector, Cardinal *count); static void leftParen(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count); static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void mod(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count); static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void naturalLog(Widget w, XEvent *ev, String *vector, Cardinal *count); static void naturalLog(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void negate(Widget w, XEvent *ev, String *vector, Cardinal *count); static void negate(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count); static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void not(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void off(Widget w, XEvent *ev, String *vector, Cardinal *count); static void off(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void or(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count); static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void power(Widget w, XEvent *ev, String *vector, Cardinal *count); static void power(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count); static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count);
@ -77,6 +82,8 @@ static void rightParen(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void roll(Widget w, XEvent *ev, String *vector, Cardinal *count); static void roll(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void scientific(Widget w, XEvent *ev, String *vector, Cardinal *count); static void scientific(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count); static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void shl(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void shr(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count); static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void square(Widget w, XEvent *ev, String *vector, Cardinal *count); static void square(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void squareRoot(Widget w, XEvent *ev, String *vector, Cardinal *count); static void squareRoot(Widget w, XEvent *ev, String *vector, Cardinal *count);
@ -85,6 +92,8 @@ static void subtract(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void sum(Widget w, XEvent *ev, String *vector, Cardinal *count); static void sum(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void tangent(Widget w, XEvent *ev, String *vector, Cardinal *count); static void tangent(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count); static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void xtrunc(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void xor(Widget w, XEvent *ev, String *vector, Cardinal *count);
static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count); static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count);
/* /*
@ -93,7 +102,9 @@ static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count);
XtActionsRec Actions[] = { XtActionsRec Actions[] = {
{"add", add}, /* addition */ {"add", add}, /* addition */
{"and", and}, /* bitwise and */
{"back", back}, /* HP-specific backspace */ {"back", back}, /* HP-specific backspace */
{"base", base}, /* base conversion */
{"bell", bell}, /* ring bell */ {"bell", bell}, /* ring bell */
{"clear", clearit}, /* TI-specific clear calculator state */ {"clear", clearit}, /* TI-specific clear calculator state */
{"cosine", cosine}, /* trigonometric function cosine */ {"cosine", cosine}, /* trigonometric function cosine */
@ -110,11 +121,14 @@ XtActionsRec Actions[] = {
{"inverse", inverse}, /* inverse */ {"inverse", inverse}, /* inverse */
{"leftParen", leftParen}, /* TI-specific left parenthesis */ {"leftParen", leftParen}, /* TI-specific left parenthesis */
{"logarithm", logarithm}, /* logarithm base 10 */ {"logarithm", logarithm}, /* logarithm base 10 */
{"mod", mod}, /* modulus */
{"multiply", multiply}, /* multiplication */ {"multiply", multiply}, /* multiplication */
{"naturalLog", naturalLog}, /* natural logarithm base e */ {"naturalLog", naturalLog}, /* natural logarithm base e */
{"negate", negate}, /* change sign */ {"negate", negate}, /* change sign */
{"nop", nop}, /* no operation, rings bell */ {"nop", nop}, /* no operation, rings bell */
{"not", not}, /* bitwise not */
{"off", off}, /* clear state */ {"off", off}, /* clear state */
{"or", or}, /* bitwise or */
{"pi", pi}, /* the number pi */ {"pi", pi}, /* the number pi */
{"power", power}, /* raise to an arbitrary power */ {"power", power}, /* raise to an arbitrary power */
{"quit", quit}, /* quit */ {"quit", quit}, /* quit */
@ -124,6 +138,8 @@ XtActionsRec Actions[] = {
{"roll", roll}, /* HP-specific roll stack */ {"roll", roll}, /* HP-specific roll stack */
{"scientific", scientific}, /* scientfic notation (EE) */ {"scientific", scientific}, /* scientfic notation (EE) */
{"selection", selection}, /* copy selection */ {"selection", selection}, /* copy selection */
{"shl", shl}, /* arithmetic shift left */
{"shr", shr}, /* arithmetic shift right */
{"sine", sine}, /* trigonometric function sine */ {"sine", sine}, /* trigonometric function sine */
{"square", square}, /* square */ {"square", square}, /* square */
{"squareRoot", squareRoot}, /* square root */ {"squareRoot", squareRoot}, /* square root */
@ -132,6 +148,8 @@ XtActionsRec Actions[] = {
{"sum", sum}, /* memory summation */ {"sum", sum}, /* memory summation */
{"tangent", tangent}, /* trigonometric function tangent */ {"tangent", tangent}, /* trigonometric function tangent */
{"tenpower", tenpower}, /* 10 raised to to an arbitrary power */ {"tenpower", tenpower}, /* 10 raised to to an arbitrary power */
{"trunc", xtrunc}, /* truncate to integer */
{"xor", xor}, /* bitwise xor */
{"XexchangeY", XexchangeY} /* HP-specific exchange X and Y registers */ {"XexchangeY", XexchangeY} /* HP-specific exchange X and Y registers */
}; };
@ -145,6 +163,14 @@ static void add(Widget w, XEvent *ev, String *vector, Cardinal *count)
post_op(); post_op();
} }
/*ARGSUSED*/
static void and(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kAND);
rpn ? twof(kAND) : twoop(kAND);
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void back(Widget w, XEvent *ev, String *vector, Cardinal *count) static void back(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
@ -153,6 +179,14 @@ static void back(Widget w, XEvent *ev, String *vector, Cardinal *count)
post_op(); post_op();
} }
/*ARGSUSED*/
static void base(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kBASE);
change_base();
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count) static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
@ -196,6 +230,7 @@ static void digit(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
switch (vector[0][0]) switch (vector[0][0])
{ {
case '0': XCALC_PRE_OP(kZERO); numeric(kZERO); break;
case '1': XCALC_PRE_OP(kONE); numeric(kONE); break; case '1': XCALC_PRE_OP(kONE); numeric(kONE); break;
case '2': XCALC_PRE_OP(kTWO); numeric(kTWO); break; case '2': XCALC_PRE_OP(kTWO); numeric(kTWO); break;
case '3': XCALC_PRE_OP(kTHREE); numeric(kTHREE); break; case '3': XCALC_PRE_OP(kTHREE); numeric(kTHREE); break;
@ -205,7 +240,12 @@ static void digit(Widget w, XEvent *ev, String *vector, Cardinal *count)
case '7': XCALC_PRE_OP(kSEVEN); numeric(kSEVEN); break; case '7': XCALC_PRE_OP(kSEVEN); numeric(kSEVEN); break;
case '8': XCALC_PRE_OP(kEIGHT); numeric(kEIGHT); break; case '8': XCALC_PRE_OP(kEIGHT); numeric(kEIGHT); break;
case '9': XCALC_PRE_OP(kNINE); numeric(kNINE); break; case '9': XCALC_PRE_OP(kNINE); numeric(kNINE); break;
case '0': XCALC_PRE_OP(kZERO); numeric(kZERO); break; case 'A': XCALC_PRE_OP(kxA); numeric(kxA); break;
case 'B': XCALC_PRE_OP(kxB); numeric(kxB); break;
case 'C': XCALC_PRE_OP(kxC); numeric(kxC); break;
case 'D': XCALC_PRE_OP(kxD); numeric(kxD); break;
case 'E': XCALC_PRE_OP(kxE); numeric(kxE); break;
case 'F': XCALC_PRE_OP(kxF); numeric(kxF); break;
} }
post_op(); post_op();
} }
@ -290,6 +330,14 @@ static void logarithm(Widget w, XEvent *ev, String *vector, Cardinal *count)
post_op(); post_op();
} }
/*ARGSUSED*/
static void mod(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kMOD);
rpn ? twof(kMOD) : twoop(kMOD);
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count) static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
@ -320,6 +368,14 @@ static void nop(Widget w, XEvent *ev, String *vector, Cardinal *count)
ringbell(); ringbell();
} }
/*ARGSUSED*/
static void not(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kNOT);
oneop(kNOT);
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void off(Widget w, XEvent *ev, String *vector, Cardinal *count) static void off(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
@ -328,6 +384,14 @@ static void off(Widget w, XEvent *ev, String *vector, Cardinal *count)
post_op(); post_op();
} }
/*ARGSUSED*/
static void or(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kOR);
rpn ? twof(kOR) : twoop(kOR);
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count) static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
@ -347,7 +411,8 @@ static void power(Widget w, XEvent *ev, String *vector, Cardinal *count)
/*ARGSUSED*/ /*ARGSUSED*/
static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count) static void quit(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
if (ev->type == ClientMessage && ev->xclient.data.l[0] != wm_delete_window) if (ev->type == ClientMessage &&
((Atom) ev->xclient.data.l[0]) != wm_delete_window)
ringbell(); ringbell();
else else
Quit(); Quit();
@ -399,6 +464,22 @@ static void selection(Widget w, XEvent *ev, String *vector, Cardinal *count)
do_select(((XButtonReleasedEvent *)ev)->time); do_select(((XButtonReleasedEvent *)ev)->time);
} }
/*ARGSUSED*/
static void shl(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kSHL);
rpn ? twof(kSHL) : twoop(kSHL);
post_op();
}
/*ARGSUSED*/
static void shr(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kSHR);
rpn ? twof(kSHR) : twoop(kSHR);
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count) static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {
@ -463,6 +544,22 @@ static void tenpower(Widget w, XEvent *ev, String *vector, Cardinal *count)
post_op(); post_op();
} }
/*ARGSUSED*/
static void xtrunc(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kTRUNC);
oneop(kTRUNC);
post_op();
}
/*ARGSUSED*/
static void xor(Widget w, XEvent *ev, String *vector, Cardinal *count)
{
XCALC_PRE_OP(kXOR);
rpn ? twof(kXOR) : twoop(kXOR);
post_op();
}
/*ARGSUSED*/ /*ARGSUSED*/
static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count) static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count)
{ {

View File

@ -42,6 +42,15 @@ XCalc*bevel.screen.P.label: ()
XCalc*bevel.screen.P.fromHoriz: GRAD XCalc*bevel.screen.P.fromHoriz: GRAD
XCalc*bevel.screen.P.fromVert: LCD XCalc*bevel.screen.P.fromVert: LCD
XCalc*bevel.screen.P.horizDistance: 2 XCalc*bevel.screen.P.horizDistance: 2
XCalc*bevel.screen.HEX.fromHoriz: P
XCalc*bevel.screen.HEX.fromVert: LCD
XCalc*bevel.screen.HEX.horizDistance: 1
XCalc*bevel.screen.DEC.fromHoriz: P
XCalc*bevel.screen.DEC.fromVert: LCD
XCalc*bevel.screen.DEC.horizDistance: 1
XCalc*bevel.screen.OCT.fromHoriz: P
XCalc*bevel.screen.OCT.fromVert: LCD
XCalc*bevel.screen.OCT.horizDistance: 1
!XCalc*ti.Geometry: 171x252 !XCalc*ti.Geometry: 171x252
XCalc*ti.bevel.screen.LCD.width: 186 XCalc*ti.bevel.screen.LCD.width: 186
@ -59,6 +68,12 @@ XCalc*ti.bevel.screen.LCD.translations: #replace\n\
None<Key>7:digit(7)\n\ None<Key>7:digit(7)\n\
None<Key>8:digit(8)\n\ None<Key>8:digit(8)\n\
None<Key>9:digit(9)\n\ None<Key>9:digit(9)\n\
Shift<Key>a:digit(A)\n\
Shift<Key>b:digit(B)\n\
Shift<Key>c:digit(C)\n\
Shift<Key>d:digit(D)\n\
Shift<Key>e:digit(E)\n\
Shift<Key>f:digit(F)\n\
<Key>KP_0:digit(0)\n\ <Key>KP_0:digit(0)\n\
<Key>KP_1:digit(1)\n\ <Key>KP_1:digit(1)\n\
<Key>KP_2:digit(2)\n\ <Key>KP_2:digit(2)\n\
@ -71,6 +86,7 @@ XCalc*ti.bevel.screen.LCD.translations: #replace\n\
<Key>KP_9:digit(9)\n\ <Key>KP_9:digit(9)\n\
<Key>KP_Enter:equal()\n\ <Key>KP_Enter:equal()\n\
<Key>KP_Equal:equal()\n\ <Key>KP_Equal:equal()\n\
<Key>Return:equal()\n\
<Key>KP_Multiply:multiply()\n\ <Key>KP_Multiply:multiply()\n\
<Key>KP_Add:add()\n\ <Key>KP_Add:add()\n\
<Key>KP_Subtract:subtract()\n\ <Key>KP_Subtract:subtract()\n\
@ -87,6 +103,13 @@ XCalc*ti.bevel.screen.LCD.translations: #replace\n\
:<Key>(:leftParen()\n\ :<Key>(:leftParen()\n\
:<Key>):rightParen()\n\ :<Key>):rightParen()\n\
:<Key>!:factorial()\n\ :<Key>!:factorial()\n\
:<Key>|:or()\n\
:<Key>&:and()\n\
:<Key><:shl()\n\
:<Key>>:shr()\n\
:<Key>~:not()\n\
:<Key>%:mod()\n\
<Key>x:xor()\n\
<Key>e:e()\n\ <Key>e:e()\n\
:<Key>^:power()\n\ :<Key>^:power()\n\
<Key>p:pi()\n\ <Key>p:pi()\n\
@ -140,62 +163,95 @@ XCalc*ti.button14.translations: #override<Btn1Down>,<Btn1Up>:naturalLog()unset()
XCalc*ti.button15.label: y^x XCalc*ti.button15.label: y^x
XCalc*ti.button15.translations: #override<Btn1Down>,<Btn1Up>:power()unset() XCalc*ti.button15.translations: #override<Btn1Down>,<Btn1Up>:power()unset()
XCalc*ti.button16.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*ti.button16.label: not
XCalc*ti.button16.label: \160 XCalc*ti.button16.translations: #override<Btn1Down>,<Btn1Up>:not()unset()
XCalc*ti.button16.translations: #override<Btn1Down>,<Btn1Up>:pi()unset() XCalc*ti.button17.label: and
XCalc*ti.button17.label: x! XCalc*ti.button17.translations: #override<Btn1Down>,<Btn1Up>:and()unset()
XCalc*ti.button17.translations: #override<Btn1Down>,<Btn1Up>:factorial()unset() XCalc*ti.button18.label: or
XCalc*ti.button18.label: ( XCalc*ti.button18.translations: #override<Btn1Down>,<Btn1Up>:or()unset()
XCalc*ti.button18.translations: #override<Btn1Down>,<Btn1Up>:leftParen()unset() XCalc*ti.button19.label: xor
XCalc*ti.button19.label: ) XCalc*ti.button19.translations: #override<Btn1Down>,<Btn1Up>:xor()unset()
XCalc*ti.button19.translations: #override<Btn1Down>,<Btn1Up>:rightParen()unset() XCalc*ti.button20.label: trunc
XCalc*ti.button20.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* XCalc*ti.button20.translations: #override<Btn1Down>,<Btn1Up>:trunc()unset()
XCalc*ti.button20.label: \270
XCalc*ti.button20.translations: #override<Btn1Down>,<Btn1Up>:divide()unset()
XCalc*ti.button21.label: STO XCalc*ti.button21.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-*
XCalc*ti.button21.translations: #override<Btn1Down>,<Btn1Up>:store()unset() XCalc*ti.button21.label: \160
XCalc*ti.button22.label: 7 XCalc*ti.button21.translations: #override<Btn1Down>,<Btn1Up>:pi()unset()
XCalc*ti.button22.translations: #override<Btn1Down>,<Btn1Up>:digit(7)unset() XCalc*ti.button22.label: x!
XCalc*ti.button23.label: 8 XCalc*ti.button22.translations: #override<Btn1Down>,<Btn1Up>:factorial()unset()
XCalc*ti.button23.translations: #override<Btn1Down>,<Btn1Up>:digit(8)unset() XCalc*ti.button23.label: (
XCalc*ti.button24.label: 9 XCalc*ti.button23.translations: #override<Btn1Down>,<Btn1Up>:leftParen()unset()
XCalc*ti.button24.translations: #override<Btn1Down>,<Btn1Up>:digit(9)unset() XCalc*ti.button24.label: )
XCalc*ti.button25.label: * XCalc*ti.button24.translations: #override<Btn1Down>,<Btn1Up>:rightParen()unset()
XCalc*ti.button25.translations: #override<Btn1Down>,<Btn1Up>:multiply()unset() XCalc*ti.button25.label: base
XCalc*ti.button25.translations: #override<Btn1Down>,<Btn1Up>:base()unset()
XCalc*ti.button26.label: RCL XCalc*ti.button26.label: shl
XCalc*ti.button26.translations: #override<Btn1Down>,<Btn1Up>:recall()unset() XCalc*ti.button26.translations: #override<Btn1Down>,<Btn1Up>:shl()unset()
XCalc*ti.button27.label: 4 XCalc*ti.button27.label: D
XCalc*ti.button27.translations: #override<Btn1Down>,<Btn1Up>:digit(4)unset() XCalc*ti.button27.translations: #override<Btn1Down>,<Btn1Up>:digit(D)unset()
XCalc*ti.button28.label: 5 XCalc*ti.button28.label: E
XCalc*ti.button28.translations: #override<Btn1Down>,<Btn1Up>:digit(5)unset() XCalc*ti.button28.translations: #override<Btn1Down>,<Btn1Up>:digit(E)unset()
XCalc*ti.button29.label: 6 XCalc*ti.button29.label: F
XCalc*ti.button29.translations: #override<Btn1Down>,<Btn1Up>:digit(6)unset() XCalc*ti.button29.translations: #override<Btn1Down>,<Btn1Up>:digit(F)unset()
XCalc*ti.button30.label: - XCalc*ti.button30.label: shr
XCalc*ti.button30.translations: #override<Btn1Down>,<Btn1Up>:subtract()unset() XCalc*ti.button30.translations: #override<Btn1Down>,<Btn1Up>:shr()unset()
XCalc*ti.button31.label: SUM XCalc*ti.button31.label: mod
XCalc*ti.button31.translations: #override<Btn1Down>,<Btn1Up>:sum()unset() XCalc*ti.button31.translations: #override<Btn1Down>,<Btn1Up>:mod()unset()
XCalc*ti.button32.label: 1 XCalc*ti.button32.label: A
XCalc*ti.button32.translations: #override<Btn1Down>,<Btn1Up>:digit(1)unset() XCalc*ti.button32.translations: #override<Btn1Down>,<Btn1Up>:digit(A)unset()
XCalc*ti.button33.label: 2 XCalc*ti.button33.label: B
XCalc*ti.button33.translations: #override<Btn1Down>,<Btn1Up>:digit(2)unset() XCalc*ti.button33.translations: #override<Btn1Down>,<Btn1Up>:digit(B)unset()
XCalc*ti.button34.label: 3 XCalc*ti.button34.label: C
XCalc*ti.button34.translations: #override<Btn1Down>,<Btn1Up>:digit(3)unset() XCalc*ti.button34.translations: #override<Btn1Down>,<Btn1Up>:digit(C)unset()
XCalc*ti.button35.label: + XCalc*ti.button35.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-*
XCalc*ti.button35.translations: #override<Btn1Down>,<Btn1Up>:add()unset() XCalc*ti.button35.label: \270
XCalc*ti.button35.translations: #override<Btn1Down>,<Btn1Up>:divide()unset()
XCalc*ti.button36.label: EXC XCalc*ti.button36.label: STO
XCalc*ti.button36.translations: #override<Btn1Down>,<Btn1Up>:exchange()unset() XCalc*ti.button36.translations: #override<Btn1Down>,<Btn1Up>:store()unset()
XCalc*ti.button37.label: 0 XCalc*ti.button37.label: 7
XCalc*ti.button37.translations: #override<Btn1Down>,<Btn1Up>:digit(0)unset() XCalc*ti.button37.translations: #override<Btn1Down>,<Btn1Up>:digit(7)unset()
XCalc*ti.button38.label: . XCalc*ti.button38.label: 8
XCalc*ti.button38.translations: #override<Btn1Down>,<Btn1Up>:decimal()unset() XCalc*ti.button38.translations: #override<Btn1Down>,<Btn1Up>:digit(8)unset()
XCalc*ti.button39.label: +/- XCalc*ti.button39.label: 9
XCalc*ti.button39.translations: #override<Btn1Down>,<Btn1Up>:negate()unset() XCalc*ti.button39.translations: #override<Btn1Down>,<Btn1Up>:digit(9)unset()
XCalc*ti.button40.label: = XCalc*ti.button40.label: *
XCalc*ti.button40.translations: #override<Btn1Down>,<Btn1Up>:equal()unset() XCalc*ti.button40.translations: #override<Btn1Down>,<Btn1Up>:multiply()unset()
XCalc*ti.button41.label: RCL
XCalc*ti.button41.translations: #override<Btn1Down>,<Btn1Up>:recall()unset()
XCalc*ti.button42.label: 4
XCalc*ti.button42.translations: #override<Btn1Down>,<Btn1Up>:digit(4)unset()
XCalc*ti.button43.label: 5
XCalc*ti.button43.translations: #override<Btn1Down>,<Btn1Up>:digit(5)unset()
XCalc*ti.button44.label: 6
XCalc*ti.button44.translations: #override<Btn1Down>,<Btn1Up>:digit(6)unset()
XCalc*ti.button45.label: -
XCalc*ti.button45.translations: #override<Btn1Down>,<Btn1Up>:subtract()unset()
XCalc*ti.button46.label: SUM
XCalc*ti.button46.translations: #override<Btn1Down>,<Btn1Up>:sum()unset()
XCalc*ti.button47.label: 1
XCalc*ti.button47.translations: #override<Btn1Down>,<Btn1Up>:digit(1)unset()
XCalc*ti.button48.label: 2
XCalc*ti.button48.translations: #override<Btn1Down>,<Btn1Up>:digit(2)unset()
XCalc*ti.button49.label: 3
XCalc*ti.button49.translations: #override<Btn1Down>,<Btn1Up>:digit(3)unset()
XCalc*ti.button50.label: +
XCalc*ti.button50.translations: #override<Btn1Down>,<Btn1Up>:add()unset()
XCalc*ti.button51.label: EXC
XCalc*ti.button51.translations: #override<Btn1Down>,<Btn1Up>:exchange()unset()
XCalc*ti.button52.label: 0
XCalc*ti.button52.translations: #override<Btn1Down>,<Btn1Up>:digit(0)unset()
XCalc*ti.button53.label: .
XCalc*ti.button53.translations: #override<Btn1Down>,<Btn1Up>:decimal()unset()
XCalc*ti.button54.label: +/-
XCalc*ti.button54.translations: #override<Btn1Down>,<Btn1Up>:negate()unset()
XCalc*ti.button55.label: =
XCalc*ti.button55.translations: #override<Btn1Down>,<Btn1Up>:equal()unset()
XCalc*ti.button1.horizDistance: 4 XCalc*ti.button1.horizDistance: 4
XCalc*ti.button1.vertDistance: 12 XCalc*ti.button1.vertDistance: 12
@ -290,6 +346,38 @@ XCalc*ti.button39.fromVert: button34
XCalc*ti.button40.fromHoriz: button39 XCalc*ti.button40.fromHoriz: button39
XCalc*ti.button40.fromVert: button35 XCalc*ti.button40.fromVert: button35
XCalc*ti.button41.horizDistance: 4
XCalc*ti.button41.fromVert: button36
XCalc*ti.button42.fromHoriz: button41
XCalc*ti.button42.fromVert: button37
XCalc*ti.button43.fromHoriz: button42
XCalc*ti.button43.fromVert: button38
XCalc*ti.button44.fromHoriz: button43
XCalc*ti.button44.fromVert: button39
XCalc*ti.button45.fromHoriz: button44
XCalc*ti.button45.fromVert: button40
XCalc*ti.button46.horizDistance: 4
XCalc*ti.button46.fromVert: button41
XCalc*ti.button47.fromHoriz: button46
XCalc*ti.button47.fromVert: button42
XCalc*ti.button48.fromHoriz: button47
XCalc*ti.button48.fromVert: button43
XCalc*ti.button49.fromHoriz: button48
XCalc*ti.button49.fromVert: button44
XCalc*ti.button50.fromHoriz: button49
XCalc*ti.button50.fromVert: button45
XCalc*ti.button51.horizDistance: 4
XCalc*ti.button51.fromVert: button46
XCalc*ti.button52.fromHoriz: button51
XCalc*ti.button52.fromVert: button47
XCalc*ti.button53.fromHoriz: button52
XCalc*ti.button53.fromVert: button48
XCalc*ti.button54.fromHoriz: button53
XCalc*ti.button54.fromVert: button49
XCalc*ti.button55.fromHoriz: button54
XCalc*ti.button55.fromVert: button50
!XCalc*hp.Geometry: 336x164 !XCalc*hp.Geometry: 336x164
XCalc*hp.bevel.screen.LCD.width: 186 XCalc*hp.bevel.screen.LCD.width: 186

96
app/xcalc/configure vendored
View File

@ -1,8 +1,8 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for xcalc 1.0.6. # Generated by GNU Autoconf 2.69 for xcalc 1.1.0.
# #
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. # Report bugs to <https://gitlab.freedesktop.org/xorg/app/xcalc/issues>.
# #
# #
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@ -267,7 +267,7 @@ fi
$as_echo "$0: be upgraded to zsh 4.3.4 or later." $as_echo "$0: be upgraded to zsh 4.3.4 or later."
else else
$as_echo "$0: Please tell bug-autoconf@gnu.org and $as_echo "$0: Please tell bug-autoconf@gnu.org and
$0: https://bugs.freedesktop.org/enter_bug.cgi?product=xorg $0: https://gitlab.freedesktop.org/xorg/app/xcalc/issues
$0: about your system, including any error possibly output $0: about your system, including any error possibly output
$0: before this message. Then install a modern shell, or $0: before this message. Then install a modern shell, or
$0: manually run the script under such a shell if you do $0: manually run the script under such a shell if you do
@ -581,9 +581,9 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='xcalc' PACKAGE_NAME='xcalc'
PACKAGE_TARNAME='xcalc' PACKAGE_TARNAME='xcalc'
PACKAGE_VERSION='1.0.6' PACKAGE_VERSION='1.1.0'
PACKAGE_STRING='xcalc 1.0.6' PACKAGE_STRING='xcalc 1.1.0'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xcalc/issues'
PACKAGE_URL='' PACKAGE_URL=''
ac_unique_file="Makefile.am" ac_unique_file="Makefile.am"
@ -1317,7 +1317,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # 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. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures xcalc 1.0.6 to adapt to many kinds of systems. \`configure' configures xcalc 1.1.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1387,7 +1387,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of xcalc 1.0.6:";; short | recursive ) echo "Configuration of xcalc 1.1.0:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1443,7 +1443,7 @@ Some influential environment variables:
Use these variables to override the choices made by `configure' or to help Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations. it to find libraries and programs with nonstandard names/locations.
Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>. Report bugs to <https://gitlab.freedesktop.org/xorg/app/xcalc/issues>.
_ACEOF _ACEOF
ac_status=$? ac_status=$?
fi fi
@ -1506,7 +1506,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
xcalc configure 1.0.6 xcalc configure 1.1.0
generated by GNU Autoconf 2.69 generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc. Copyright (C) 2012 Free Software Foundation, Inc.
@ -1830,7 +1830,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by xcalc $as_me 1.0.6, which was It was created by xcalc $as_me 1.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@ $ $0 $@
@ -2659,7 +2659,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='xcalc' PACKAGE='xcalc'
VERSION='1.0.6' VERSION='1.1.0'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -10303,10 +10303,11 @@ _ACEOF
CHANGELOG_CMD="(GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp && \ CHANGELOG_CMD="((GIT_DIR=\$(top_srcdir)/.git git log > \$(top_srcdir)/.changelog.tmp) 2>/dev/null && \
mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \ mv \$(top_srcdir)/.changelog.tmp \$(top_srcdir)/ChangeLog) \
|| (rm -f \$(top_srcdir)/.changelog.tmp; touch \$(top_srcdir)/ChangeLog; \ || (rm -f \$(top_srcdir)/.changelog.tmp; test -e \$(top_srcdir)/ChangeLog || ( \
echo 'git directory not found: installing possibly empty changelog.' >&2)" touch \$(top_srcdir)/ChangeLog; \
echo 'git failed to create ChangeLog: installing empty ChangeLog.' >&2))"
@ -10314,14 +10315,45 @@ echo 'git directory not found: installing possibly empty changelog.' >&2)"
macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros` macros_datadir=`$PKG_CONFIG --print-errors --variable=pkgdatadir xorg-macros`
INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \ INSTALL_CMD="(cp -f "$macros_datadir/INSTALL" \$(top_srcdir)/.INSTALL.tmp && \
mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \ mv \$(top_srcdir)/.INSTALL.tmp \$(top_srcdir)/INSTALL) \
|| (rm -f \$(top_srcdir)/.INSTALL.tmp; touch \$(top_srcdir)/INSTALL; \ || (rm -f \$(top_srcdir)/.INSTALL.tmp; test -e \$(top_srcdir)/INSTALL || ( \
echo 'util-macros \"pkgdatadir\" from xorg-macros.pc not found: installing possibly empty INSTALL.' >&2)" touch \$(top_srcdir)/INSTALL; \
echo 'failed to copy INSTALL from util-macros: installing empty INSTALL.' >&2))"
case $host_os in
solaris*)
# Solaris 2.0 - 11.3 use SysV man page section numbers, so we
# check for a man page file found in later versions that use
# traditional section numbers instead
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /usr/share/man/man7/attributes.7" >&5
$as_echo_n "checking for /usr/share/man/man7/attributes.7... " >&6; }
if ${ac_cv_file__usr_share_man_man7_attributes_7+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/usr/share/man/man7/attributes.7"; then
ac_cv_file__usr_share_man_man7_attributes_7=yes
else
ac_cv_file__usr_share_man_man7_attributes_7=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__usr_share_man_man7_attributes_7" >&5
$as_echo "$ac_cv_file__usr_share_man_man7_attributes_7" >&6; }
if test "x$ac_cv_file__usr_share_man_man7_attributes_7" = xyes; then :
SYSV_MAN_SECTIONS=false
else
SYSV_MAN_SECTIONS=true
fi
;;
*) SYSV_MAN_SECTIONS=false ;;
esac
if test x$APP_MAN_SUFFIX = x ; then if test x$APP_MAN_SUFFIX = x ; then
APP_MAN_SUFFIX=1 APP_MAN_SUFFIX=1
fi fi
@ -10337,9 +10369,9 @@ if test x$LIB_MAN_DIR = x ; then
fi fi
if test x$FILE_MAN_SUFFIX = x ; then if test x$FILE_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) FILE_MAN_SUFFIX=4 ;; true) FILE_MAN_SUFFIX=4 ;;
*) FILE_MAN_SUFFIX=5 ;; *) FILE_MAN_SUFFIX=5 ;;
esac esac
fi fi
if test x$FILE_MAN_DIR = x ; then if test x$FILE_MAN_DIR = x ; then
@ -10347,9 +10379,9 @@ if test x$FILE_MAN_DIR = x ; then
fi fi
if test x$MISC_MAN_SUFFIX = x ; then if test x$MISC_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) MISC_MAN_SUFFIX=5 ;; true) MISC_MAN_SUFFIX=5 ;;
*) MISC_MAN_SUFFIX=7 ;; *) MISC_MAN_SUFFIX=7 ;;
esac esac
fi fi
if test x$MISC_MAN_DIR = x ; then if test x$MISC_MAN_DIR = x ; then
@ -10357,9 +10389,9 @@ if test x$MISC_MAN_DIR = x ; then
fi fi
if test x$DRIVER_MAN_SUFFIX = x ; then if test x$DRIVER_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) DRIVER_MAN_SUFFIX=7 ;; true) DRIVER_MAN_SUFFIX=7 ;;
*) DRIVER_MAN_SUFFIX=4 ;; *) DRIVER_MAN_SUFFIX=4 ;;
esac esac
fi fi
if test x$DRIVER_MAN_DIR = x ; then if test x$DRIVER_MAN_DIR = x ; then
@ -10367,9 +10399,9 @@ if test x$DRIVER_MAN_DIR = x ; then
fi fi
if test x$ADMIN_MAN_SUFFIX = x ; then if test x$ADMIN_MAN_SUFFIX = x ; then
case $host_os in case $SYSV_MAN_SECTIONS in
solaris*) ADMIN_MAN_SUFFIX=1m ;; true) ADMIN_MAN_SUFFIX=1m ;;
*) ADMIN_MAN_SUFFIX=8 ;; *) ADMIN_MAN_SUFFIX=8 ;;
esac esac
fi fi
if test x$ADMIN_MAN_DIR = x ; then if test x$ADMIN_MAN_DIR = x ; then
@ -11193,7 +11225,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by xcalc $as_me 1.0.6, which was This file was extended by xcalc $as_me 1.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -11253,13 +11285,13 @@ $config_headers
Configuration commands: Configuration commands:
$config_commands $config_commands
Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>." Report bugs to <https://gitlab.freedesktop.org/xorg/app/xcalc/issues>."
_ACEOF _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
xcalc config.status 1.0.6 xcalc config.status 1.1.0
configured by $0, generated by GNU Autoconf 2.69, configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View File

@ -23,8 +23,8 @@ 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.6], AC_INIT([xcalc], [1.1.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xcalc]) [https://gitlab.freedesktop.org/xorg/app/xcalc/issues], [xcalc])
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])

View File

@ -130,7 +130,7 @@ Computes the tangent, or arctangent when inverted.
The corresponding action procedure is \fBtangent()\fP. The corresponding action procedure is \fBtangent()\fP.
.TP 10 .TP 10
.B DRG .B DRG
Changes the DRG mode, as indicated by 'DEG', 'RAD', or 'GRAD' at the bottom of Changes the DRG mode, as indicated by 'DEG', 'RAD', or 'GRAD' at the bottom
of the calculator ``liquid crystal'' display. of the calculator ``liquid crystal'' display.
When in 'DEG' mode, numbers in the display are taken as being When in 'DEG' mode, numbers in the display are taken as being
degrees. In 'RAD' mode, numbers are in radians, and in 'GRAD' mode, numbers degrees. In 'RAD' mode, numbers are in radians, and in 'GRAD' mode, numbers
@ -168,6 +168,26 @@ example "2 y^x 3 =" results in "8", which is 2^3. For a further example,
"(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals "216". "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals "216".
The corresponding action procedure is \fBpower()\fR. The corresponding action procedure is \fBpower()\fR.
.TP 10 .TP 10
.B not
Performs a bitwise not.
The corresponding action procedure is \fBnot()\fP.
.TP 10
.B and
Performs a bitwise and.
The corresponding action procedure is \fBand()\fP.
.TP 10
.B or
Performs a bitwise or.
The corresponding action procedure is \fBor()\fP.
.TP 10
.B xor
Performs a bitwise exclusive or.
The corresponding action procedure is \fBxor()\fP.
.TP 10
.B trunc
Truncates the number in the display to an integer.
The corresponding action procedure is \fBtrunc()\fP.
.TP 10
.B PI .B PI
The constant 'pi'. (3.1415927....) The constant 'pi'. (3.1415927....)
The corresponding action procedure is \fBpi()\fR. The corresponding action procedure is \fBpi()\fR.
@ -186,6 +206,30 @@ is \fBleftParen()\fR.
Right parenthesis. The corresponding action procedure for TI calculators Right parenthesis. The corresponding action procedure for TI calculators
is \fBrightParen()\fR. is \fBrightParen()\fR.
.TP 10 .TP 10
.B base
Changes the number base, as indicated by 'DEC', 'HEX, or 'OCT' at the bottom
of the calculator display.
When in 'DEC' mode, numbers in the display are taken as being decimal
(base 10). In 'HEX' mode, numbers are in hexadecimal (base 16), and in 'OCT'
mode, numbers are in octal (base 8).
The corresponding action procedure is \fBbase()\fP.
.TP 10
.B shl
Performs an arithmetic bitwise shift left, For example, entering "1 shl 2"
should result in "4".
The corresponding action procedure is \fBshl()\fR.
.TP 10
.B shr
Performs an arithmetic bitwise shift right, For example, entering "8 shr 1"
should result in "4".
The corresponding action procedure is \fBshr()\fR.
.TP 10
.B mod
Performs the modulo operation, which calculates the remainder when dividing
the first number by the second. For example, entering "14 mod 8" should
result in "6".
The corresponding action procedure is \fBmod()\fR.
.TP 10
.B / .B /
Division. The corresponding action procedure is \fBdivide()\fR. Division. The corresponding action procedure is \fBdivide()\fR.
.TP 10 .TP 10

View File

@ -43,7 +43,7 @@ jmp_buf env;
* functions. Much of it is shared between the infix and rpn modes. * functions. Much of it is shared between the infix and rpn modes.
*/ */
static int flagINV, flagPAREN, flagM, drgmode; /* display flags */ static int flagINV, flagPAREN, flagM, drgmode, numbase; /* display flags */
static double drg2rad=M_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/M_PI; static double rad2drg=180.0/M_PI;
@ -94,17 +94,47 @@ strlcpy(char *dst, const char *src, size_t size)
* 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),
* sscanf will call lower level routines that will set errno. * sscanf will call lower level routines that will set errno.
*/ */
static void static void
parse_double (const char *src, const char *fmt, double *dp) parse_double(double *dp)
{ {
unsigned long n = 0;
int olderrno = errno; int olderrno = errno;
(void) sscanf (src, fmt, dp); switch (numbase) {
case 8:
(void)sscanf(dispstr, "%lo", &n);
*dp = (double)n;
break;
case 16:
(void)sscanf(dispstr, "%lX", &n);
*dp = (double)n;
break;
default:
(void)sscanf(dispstr, "%lf", dp);
}
errno = olderrno; errno = olderrno;
return; return;
} }
/**
* Format the given double according to the
* selected number base.
*/
static void
format_double(double n)
{
switch (numbase) {
case 8:
snprintf(dispstr, sizeof(dispstr), "%lo", (long)n);
break;
case 16:
snprintf(dispstr, sizeof(dispstr), "%lX", (long)n);
break;
default:
snprintf(dispstr, sizeof(dispstr), "%.8g", n);
}
}
/*********************************/ /*********************************/
int pre_op(int keynum) int pre_op(int keynum)
@ -181,12 +211,13 @@ void post_op(void)
} }
#endif #endif
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void static void
DrawDisplay(void) DrawDisplay(void)
{ {
if (strlen(dispstr) > 12) { /* strip out some decimal digits */ if (strlen(dispstr) >= MAXDISP) { /* strip out some decimal digits */
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 {
char tmp[32]; char tmp[32];
@ -204,18 +235,41 @@ DrawDisplay(void)
setflag(XCalc_RADIAN, (drgmode==RAD)); setflag(XCalc_RADIAN, (drgmode==RAD));
setflag(XCalc_GRADAM, (drgmode==GRAD)); setflag(XCalc_GRADAM, (drgmode==GRAD));
setflag(XCalc_PAREN, (flagPAREN)); setflag(XCalc_PAREN, (flagPAREN));
setflag(XCalc_HEX, (numbase==16));
setflag(XCalc_DEC, (numbase==10));
setflag(XCalc_OCT, (numbase==8));
}
/*-------------------------------------------------------------------------*/
void
change_base(void)
{
parse_double(&dnum);
if (dnum >= 0) {
switch (numbase) {
case 8: numbase = 10; break;
case 10: numbase = 16; break;
case 16: numbase = 8; break;
}
format_double(dnum);
} else strlcpy(dispstr, "error", sizeof(dispstr));
DrawDisplay();
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
void void
numeric(int keynum) numeric(int keynum)
{ {
char st[2]; char st[2];
int cell = 0;
flagINV=0; flagINV=0;
if (rpn && (memop == kSTO || memop == kRCL || memop == kSUM)) { if (rpn && (memop == kSTO || memop == kRCL || memop == kSUM)) {
int cell = 0;
switch (keynum) { switch (keynum) {
case kONE: cell = 1; break; case kONE: cell = 1; break;
case kTWO: cell = 2; break; case kTWO: cell = 2; break;
@ -238,7 +292,7 @@ numeric(int keynum)
case kRCL: case kRCL:
PushNum(dnum); PushNum(dnum);
dnum = mem[cell]; dnum = mem[cell];
snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); format_double(dnum);
lift_enabled = 1; lift_enabled = 1;
entered = 1; entered = 1;
clrdisp++; clrdisp++;
@ -267,7 +321,9 @@ numeric(int keynum)
if ((int) strlen(dispstr) >= MAXDISP) if ((int) strlen(dispstr) >= MAXDISP)
return; return;
switch (keynum){ st[0] = '\0';
switch (keynum){
case kZERO: st[0] = '0'; break;
case kONE: st[0] = '1'; break; case kONE: st[0] = '1'; break;
case kTWO: st[0] = '2'; break; case kTWO: st[0] = '2'; break;
case kTHREE: st[0] = '3'; break; case kTHREE: st[0] = '3'; break;
@ -275,10 +331,18 @@ numeric(int keynum)
case kFIVE: st[0] = '5'; break; case kFIVE: st[0] = '5'; break;
case kSIX: st[0] = '6'; break; case kSIX: st[0] = '6'; break;
case kSEVEN: st[0] = '7'; break; case kSEVEN: st[0] = '7'; break;
case kEIGHT: st[0] = '8'; break; case kEIGHT: if (numbase > 8) st[0] = '8'; break;
case kNINE: st[0] = '9'; break; case kNINE: if (numbase > 8) st[0] = '9'; break;
case kZERO: st[0] = '0'; break; case kxA: if (numbase > 10) st[0] = 'A'; break;
case kxB: if (numbase > 10) st[0] = 'B'; break;
case kxC: if (numbase > 10) st[0] = 'C'; break;
case kxD: if (numbase > 10) st[0] = 'D'; break;
case kxE: if (numbase > 10) st[0] = 'E'; break;
case kxF: if (numbase > 10) st[0] = 'F'; break;
} }
if (st[0] == '\0')
return;
st[1] = '\0'; st[1] = '\0';
strcat(dispstr,st); strcat(dispstr,st);
@ -432,7 +496,7 @@ twoop(int keynum)
} }
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
clrdisp=CLR=1; clrdisp=CLR=1;
entered=Dpoint=exponent=0; entered=Dpoint=exponent=0;
@ -450,7 +514,7 @@ twoop(int keynum)
/* now, if the current op (keynum) is of /* now, if the current op (keynum) is of
higher priority than the lastop, the current higher priority than the lastop, the current
op and number are just pushed on top op and number are just pushed on top
Priorities: (Y^X) > *,/ > +,- */ Priorities: (Y^X) > *,/ > +,- > >>,<< > & > ^ > ~ */
if (priority(keynum) > priority(lastop)) { if (priority(keynum) > priority(lastop)) {
PushNum(dnum); PushNum(dnum);
@ -465,10 +529,17 @@ twoop(int keynum)
case kMUL: acc *= dnum; break; case kMUL: acc *= dnum; break;
case kDIV: acc /= dnum; break; case kDIV: acc /= dnum; break;
case kPOW: acc = pow(acc,dnum); break; case kPOW: acc = pow(acc,dnum); break;
} case kMOD: acc = (long)acc % (long)dnum; break;
case kAND: acc = (long)acc & (long)dnum; break;
case kOR: acc = (long)acc | (long)dnum; break;
case kXOR: acc = (long)acc ^ (long)dnum; break;
case kSHL: acc = (long)acc << (long)dnum; break;
case kSHR: acc = (long)acc >> (long)dnum; break;
}
PushNum(acc); PushNum(acc);
PushOp(keynum); PushOp(keynum);
snprintf(dispstr, sizeof(dispstr), "%.8g", acc); format_double(acc);
DrawDisplay(); DrawDisplay();
dnum=acc; dnum=acc;
} }
@ -490,7 +561,7 @@ twof(int keynum)
if (!entered) if (!entered)
return; return;
if (entered==1) if (entered==1)
parse_double(dispstr, "%lf", &dnum); parse_double(&dnum);
acc = PopNum(); acc = PopNum();
switch(keynum) { switch(keynum) {
case kADD: acc += dnum; break; case kADD: acc += dnum; break;
@ -498,9 +569,16 @@ twof(int keynum)
case kMUL: acc *= dnum; break; case kMUL: acc *= dnum; break;
case kDIV: acc /= dnum; break; case kDIV: acc /= dnum; break;
case kPOW: acc = pow(acc,dnum); break; case kPOW: acc = pow(acc,dnum); break;
case kXXY: PushNum(dnum); case kXXY: PushNum(dnum); break;
case kMOD: acc = (long)acc % (long)dnum; break;
case kAND: acc = (long)acc & (long)dnum; break;
case kOR: acc = (long)acc | (long)dnum; break;
case kXOR: acc = (long)acc ^ (long)dnum; break;
case kSHL: acc = (long)acc << (long)dnum; break;
case kSHR: acc = (long)acc >> (long)dnum; break;
} }
snprintf(dispstr, sizeof(dispstr), "%.8g", acc);
format_double(acc);
DrawDisplay(); DrawDisplay();
clrdisp++; clrdisp++;
Dpoint = exponent = 0; Dpoint = exponent = 0;
@ -520,7 +598,7 @@ entrf(void)
Dpoint=exponent=0; Dpoint=exponent=0;
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
entered=2; entered=2;
memop = kENTR; memop = kENTR;
PushNum(dnum); PushNum(dnum);
@ -538,7 +616,7 @@ equf(void)
Dpoint=exponent=0; Dpoint=exponent=0;
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
entered=2; entered=2;
PushNum(dnum); PushNum(dnum);
@ -561,12 +639,24 @@ equf(void)
case kLPAR: flagPAREN--; case kLPAR: flagPAREN--;
PushNum(acc); PushNum(acc);
break; break;
case kMOD: acc = (long)acc % (long)dnum;
break;
case kAND: acc = (long)acc & (long)dnum;
break;
case kOR: acc = (long)acc | (long)dnum;
break;
case kXOR: acc = (long)acc ^ (long)dnum;
break;
case kSHL: acc = (long)acc << (long)dnum;
break;
case kSHR: acc = (long)acc >> (long)dnum;
break;
} }
dnum=acc; dnum=acc;
PushNum(dnum); PushNum(dnum);
} }
snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); format_double(dnum);
DrawDisplay(); DrawDisplay();
} }
@ -585,13 +675,13 @@ rollf(void)
if (!entered) if (!entered)
return; return;
if (entered==1) if (entered==1)
parse_double(dispstr, "%lf", &dnum); parse_double(&dnum);
entered = 2; entered = 2;
lift_enabled = 1; lift_enabled = 1;
RollNum(flagINV); RollNum(flagINV);
flagINV=0; flagINV=0;
clrdisp++; clrdisp++;
snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); format_double(dnum);
DrawDisplay(); DrawDisplay();
} }
@ -609,7 +699,7 @@ rparf(void)
Dpoint=exponent=0; Dpoint=exponent=0;
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
entered=2; entered=2;
PushNum(dnum); PushNum(dnum);
@ -628,6 +718,18 @@ rparf(void)
break; break;
case kPOW: acc = pow(acc,dnum); case kPOW: acc = pow(acc,dnum);
break; break;
case kMOD: acc = (long)acc % (long)dnum;
break;
case kAND: acc = (long)acc & (long)dnum;
break;
case kOR: acc = (long)acc | (long)dnum;
break;
case kXOR: acc = (long)acc ^ (long)dnum;
break;
case kSHL: acc = (long)acc << (long)dnum;
break;
case kSHR: acc = (long)acc >> (long)dnum;
break;
} }
dnum=acc; dnum=acc;
PushNum(dnum); PushNum(dnum);
@ -635,7 +737,7 @@ rparf(void)
(void) PopNum(); (void) PopNum();
flagPAREN--; flagPAREN--;
entered=2; entered=2;
snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); format_double(dnum);
DrawDisplay(); DrawDisplay();
} }
@ -644,7 +746,7 @@ drgf(void)
{ {
if (flagINV) { if (flagINV) {
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
switch (drgmode) { switch (drgmode) {
case DEG: dnum=dnum*M_PI/180.0; break; case DEG: dnum=dnum*M_PI/180.0; break;
case RAD: dnum=dnum*200.0/M_PI; break; case RAD: dnum=dnum*200.0/M_PI; break;
@ -653,7 +755,7 @@ drgf(void)
entered=2; entered=2;
clrdisp=1; clrdisp=1;
flagINV=0; flagINV=0;
snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); format_double(dnum);
} }
flagINV=0; flagINV=0;
@ -684,7 +786,7 @@ memf(int keynum)
{ {
memop = keynum; memop = keynum;
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
entered = 2; entered = 2;
clrdisp++; clrdisp++;
lift_enabled = 0; lift_enabled = 0;
@ -697,22 +799,22 @@ oneop(int keynum)
double dtmp; double dtmp;
if (entered==1) if (entered==1)
parse_double(dispstr,"%lf",&dnum); parse_double(&dnum);
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=M_E; break; case kE: if (rpn && memop != kENTR) PushNum(dnum); dnum=M_E; break;
case kPI: if (rpn && memop != kENTR) PushNum(dnum); dnum=M_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 */
case kSQRT: if (flagINV) dnum=dnum*dnum; case kSQRT: if (flagINV) dnum=dnum*dnum;
else dnum=sqrt(dnum); else dnum=sqrt(dnum);
break; break;
case k10X: flagINV = !flagINV; /* fall through to */ case k10X: flagINV = !flagINV; /* fall through */
case kLOG: if (flagINV) dnum=pow(10.0,dnum); case kLOG: if (flagINV) dnum=pow(10.0,dnum);
else dnum=log10(dnum); else dnum=log10(dnum);
break; break;
case kEXP: flagINV = !flagINV; /* fall through to */ case kEXP: flagINV = !flagINV; /* fall through */
case kLN: if (flagINV) dnum=exp(dnum); case kLN: if (flagINV) dnum=exp(dnum);
else dnum=log(dnum); else dnum=log(dnum);
break; break;
@ -740,6 +842,8 @@ oneop(int keynum)
for (j=1,dnum=1.0; j<=i; j++) for (j=1,dnum=1.0; j<=i; j++)
dnum*=(float) j; dnum*=(float) j;
break; break;
case kNOT: dnum = ~(long)dnum; break;
case kTRUNC: dnum = trunc(dnum); break;
} }
if (entered==3) { /* error */ if (entered==3) { /* error */
@ -752,7 +856,7 @@ oneop(int keynum)
clrdisp=1; clrdisp=1;
flagINV=0; flagINV=0;
lift_enabled = 1; lift_enabled = 1;
snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); format_double(dnum);
DrawDisplay(); DrawDisplay();
} }
@ -760,13 +864,12 @@ void
offf(void) offf(void)
{ {
/* full reset */ /* full reset */
int i;
ResetCalc(); ResetCalc();
entered=clrdisp=1; entered=clrdisp=1;
lift_enabled = 0; lift_enabled = 0;
dnum=mem[0]=0.0; dnum=mem[0]=0.0;
if (rpn) if (rpn)
for (i=1; i < XCALC_MEMORY; i++) for (int i=1; i < XCALC_MEMORY; i++)
mem[i]=0.0; mem[i]=0.0;
exponent=Dpoint=0; exponent=Dpoint=0;
DrawDisplay(); DrawDisplay();
@ -899,12 +1002,18 @@ priority(int op)
/*******/ /*******/
{ {
switch (op) { switch (op) {
case kPOW: return(2); case kPOW: return(6);
case kMUL: case kMUL:
case kDIV: return(1); case kDIV:
case kMOD: return(5);
case kADD: case kADD:
case kSUB: return(0); case kSUB: return(4);
} case kSHL:
case kSHR: return(3);
case kAND: return(2);
case kXOR: return(1);
case kOR: return(0);
}
return 0; return 0;
} }
@ -915,12 +1024,16 @@ ResetCalc(void)
/********/ /********/
{ {
flagM=flagINV=flagPAREN=0; drgmode=DEG; flagM=flagINV=flagPAREN=0; drgmode=DEG;
numbase=(!numbase ? 10 : numbase);
setflag(XCalc_MEMORY, False); setflag(XCalc_MEMORY, False);
setflag(XCalc_INVERSE, False); setflag(XCalc_INVERSE, False);
setflag(XCalc_PAREN, False); setflag(XCalc_PAREN, False);
setflag(XCalc_RADIAN, False); setflag(XCalc_RADIAN, False);
setflag(XCalc_GRADAM, False); setflag(XCalc_GRADAM, False);
setflag(XCalc_DEGREE, True); setflag(XCalc_DEGREE, True);
setflag(XCalc_HEX, False);
setflag(XCalc_DEC, True);
setflag(XCalc_OCT, False);
strlcpy(dispstr, "0", sizeof(dispstr)); strlcpy(dispstr, "0", sizeof(dispstr));
draw(dispstr); draw(dispstr);
ClearStacks(); ClearStacks();

View File

@ -74,7 +74,7 @@ static Display *dpy = NULL; /* connection to the X server */
static Widget toplevel=NULL; /* top level shell widget */ static Widget toplevel=NULL; /* top level shell widget */
static Widget calculator=NULL; /* an underlying form widget */ static Widget calculator=NULL; /* an underlying form widget */
static Widget LCD = NULL; /* liquid crystal display */ static Widget LCD = NULL; /* liquid crystal display */
static Widget ind[6]; /* mode indicators in the screen */ static Widget ind[9]; /* mode indicators in the screen */
static char selstr[LCD_STR_LEN]; /* storage for selections from the LCD */ static char selstr[LCD_STR_LEN]; /* storage for selections from the LCD */
/* checkerboard used in mono mode */ /* checkerboard used in mono mode */
static XtAppContext xtcontext; /* Toolkit application context */ static XtAppContext xtcontext; /* Toolkit application context */
@ -221,6 +221,18 @@ static void create_display(Widget parent)
/* () - the parenthesis indicator */ /* () - the parenthesis indicator */
ind[XCalc_PAREN] = XtCreateManagedWidget("P", labelWidgetClass, screen, ind[XCalc_PAREN] = XtCreateManagedWidget("P", labelWidgetClass, screen,
args, XtNumber(args)); args, XtNumber(args));
/* HEX - the hexadecimal (base 16) indicator */
ind[XCalc_HEX] = XtCreateManagedWidget("HEX", labelWidgetClass, screen,
args, XtNumber(args));
/* DEC - the hexadecimal (base 16) indicator */
ind[XCalc_DEC] = XtCreateManagedWidget("DEC", labelWidgetClass, screen,
args, XtNumber(args));
/* OCT - the octal (base 8) indicator */
ind[XCalc_OCT] = XtCreateManagedWidget("OCT", labelWidgetClass, screen,
args, XtNumber(args));
} }
/* /*
@ -240,7 +252,10 @@ static void create_keypad(Widget parent)
"button21","button22","button23","button24","button25", "button21","button22","button23","button24","button25",
"button26","button27","button28","button29","button30", "button26","button27","button28","button29","button30",
"button31","button32","button33","button34","button35", "button31","button32","button33","button34","button35",
"button36","button37","button38","button39","button40" "button36","button37","button38","button39","button40",
"button41","button42","button43","button44","button45",
"button46","button47","button48","button49","button50",
"button51","button52","button53","button54","button55",
}; };
register int i; register int i;
int n = XtNumber(Keyboard); int n = XtNumber(Keyboard);
@ -297,14 +312,12 @@ void Quit(void)
*/ */
static void Syntax(int argc, char **argv) static void Syntax(int argc, char **argv)
{ {
register int i;
(void) fprintf(stderr, "%s: unknown options:", argv[0]); (void) fprintf(stderr, "%s: unknown options:", argv[0]);
for (i=1; i <argc; i++) for (int i = 1; i <argc; i++)
(void) fprintf(stderr, " %s", argv[i]); (void) fprintf(stderr, " %s", argv[i]);
(void) fprintf(stderr, "\n\n"); (void) fprintf(stderr, "\n\n");
(void) fprintf(stderr, "Usage: %s", argv[0]); (void) fprintf(stderr, "Usage: %s", argv[0]);
for (i=0; i < XtNumber(Options); i++) for (Cardinal i = 0; i < XtNumber(Options); i++)
(void) fprintf(stderr, " [%s]", Options[i].option); (void) fprintf(stderr, " [%s]", Options[i].option);
(void) fprintf(stderr, "\n"); (void) fprintf(stderr, "\n");
XtDestroyApplicationContext(xtcontext); XtDestroyApplicationContext(xtcontext);

View File

@ -102,6 +102,21 @@ from the X Consortium.
#define kROLL 44 /* roll stack */ #define kROLL 44 /* roll stack */
#define kNOP 45 /* no operation */ #define kNOP 45 /* no operation */
#define kBKSP 46 /* backspace */ #define kBKSP 46 /* backspace */
#define kAND 47 /* bitwise and */
#define kBASE 48 /* base conversion */
#define kMOD 49 /* modulus */
#define kNOT 50 /* bitwise not (ones compliment) */
#define kOR 51 /* bitwise or */
#define kSHL 52 /* arithmetic shift left */
#define kSHR 53 /* arithmetic shift right */
#define kXOR 54 /* bitwise xor */
#define kTRUNC 55 /* truncate to integer */
#define kxA 56 /* 0xa */
#define kxB 57 /* 0xb */
#define kxC 58 /* 0xc */
#define kxD 59 /* 0xd */
#define kxE 60 /* 0xe */
#define kxF 61 /* 0xf */
#define XCalc_MEMORY 0 /* memory indicator */ #define XCalc_MEMORY 0 /* memory indicator */
#define XCalc_INVERSE 1 /* inverse function indicator */ #define XCalc_INVERSE 1 /* inverse function indicator */
@ -109,6 +124,9 @@ from the X Consortium.
#define XCalc_RADIAN 3 /* radian indicator */ #define XCalc_RADIAN 3 /* radian indicator */
#define XCalc_GRADAM 4 /* grad indicator */ #define XCalc_GRADAM 4 /* grad indicator */
#define XCalc_PAREN 5 /* parenthesis indicator */ #define XCalc_PAREN 5 /* parenthesis indicator */
#define XCalc_HEX 6 /* hexadecimal (base 16) indicator */
#define XCalc_DEC 7 /* decimal (base 10) indicator */
#define XCalc_OCT 8 /* octal (base 8) indicator */
/* actions.c */ /* actions.c */
extern XtActionsRec Actions[]; extern XtActionsRec Actions[];
@ -121,6 +139,7 @@ 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);
extern void change_base(void);
extern void numeric(int keynum); extern void numeric(int keynum);
extern void bkspf(void); extern void bkspf(void);
extern void decf(void); extern void decf(void);