Hello community, here is the log from the commit of package xcalc for openSUSE:Factory checked in at 2019-06-12 13:17:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xcalc (Old) and /work/SRC/openSUSE:Factory/.xcalc.new.4811 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xcalc" Wed Jun 12 13:17:02 2019 rev:9 rq:709093 version:1.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/xcalc/xcalc.changes 2019-02-19 12:02:51.941061684 +0100 +++ /work/SRC/openSUSE:Factory/.xcalc.new.4811/xcalc.changes 2019-06-12 13:17:09.756636523 +0200 @@ -1,0 +2,9 @@ +Tue Jun 11 09:14:45 UTC 2019 - Stefan Dirsch <[email protected]> + +- Update to version 1.1.0 + * This release adds base conversion (decimal, octal, hexadecimal), + bitwise ops (and, or, xor, not, shift left/right, truncate), and + a modulo operator to the default TI (infix, i.e. not RPN/postfix) + calculator mode. It also binds the Return key to the "=" button. + +------------------------------------------------------------------- Old: ---- xcalc-1.0.7.tar.bz2 New: ---- xcalc-1.1.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xcalc.spec ++++++ --- /var/tmp/diff_new_pack.3SVKPK/_old 2019-06-12 13:17:10.236636020 +0200 +++ /var/tmp/diff_new_pack.3SVKPK/_new 2019-06-12 13:17:10.240636015 +0200 @@ -12,12 +12,12 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: xcalc -Version: 1.0.7 +Version: 1.1.0 Release: 0 Summary: Scientific calculator for X License: MIT ++++++ xcalc-1.0.7.tar.bz2 -> xcalc-1.1.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/ChangeLog new/xcalc-1.1.0/ChangeLog --- old/xcalc-1.0.7/ChangeLog 2019-02-17 22:53:01.000000000 +0100 +++ new/xcalc-1.1.0/ChangeLog 2019-06-09 22:45:50.000000000 +0200 @@ -1,3 +1,86 @@ +commit df1721c44e0b357f4d8ae80247861b4a6f7a7bbb +Author: Alan Coopersmith <[email protected]> +Date: Sun Jun 9 13:44:24 2019 -0700 + + xcalc 1.1.0 + + Signed-off-by: Alan Coopersmith <[email protected]> + +commit 74a71638ace07252e85106d87f80a62b1f07280f +Author: Alan Coopersmith <[email protected]> +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 <[email protected]> + +commit 012115650d15697e1cdc13edf770ac9775b108f4 +Author: Alan Coopersmith <[email protected]> +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 <[email protected]> + +commit 7a04d51cb90b9a314eea117bc36fedb2bfaab516 +Author: Alan Coopersmith <[email protected]> +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 <[email protected]> + +commit 519e35d2c5649a995d39ee26e39809a3b7ffabc9 +Author: Alan Coopersmith <[email protected]> +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 <[email protected]> + +commit c4f1bdb16b560d813e6ded83c2d7a4f4d280a90a +Author: Tim Hentenaar <[email protected]> +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 <[email protected]> + commit be5114cebfdc29788cf038d349c0ed6cce4bb536 Author: Alan Coopersmith <[email protected]> Date: Sun Feb 17 13:50:58 2019 -0800 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/Makefile.am new/xcalc-1.1.0/Makefile.am --- old/xcalc-1.0.7/Makefile.am 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/Makefile.am 2019-06-09 22:45:40.000000000 +0200 @@ -22,7 +22,7 @@ SUBDIRS = man bin_PROGRAMS = xcalc -AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) +AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) -D_CONST_X_STRING xcalc_LDADD = $(XCALC_LIBS) -lm xcalc_SOURCES = \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/Makefile.in new/xcalc-1.1.0/Makefile.in --- old/xcalc-1.0.7/Makefile.in 2019-02-17 22:52:49.000000000 +0100 +++ new/xcalc-1.1.0/Makefile.in 2019-06-09 22:45:44.000000000 +0200 @@ -401,7 +401,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = man -AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) +AM_CFLAGS = $(XCALC_CFLAGS) $(CWARNFLAGS) -D_CONST_X_STRING xcalc_LDADD = $(XCALC_LIBS) -lm xcalc_SOURCES = \ actions.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/actions.c new/xcalc-1.1.0/actions.c --- old/xcalc-1.0.7/actions.c 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/actions.c 2019-06-09 22:45:40.000000000 +0200 @@ -46,7 +46,9 @@ #endif 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 base(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 cosine(Widget w, XEvent *ev, String *vector, Cardinal *count); @@ -63,11 +65,14 @@ static void inverse(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 mod(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 negate(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 or(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 quit(Widget w, XEvent *ev, String *vector, Cardinal *count); @@ -77,6 +82,8 @@ static void roll(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 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 square(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 sum(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 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); /* @@ -93,7 +102,9 @@ XtActionsRec Actions[] = { {"add", add}, /* addition */ +{"and", and}, /* bitwise and */ {"back", back}, /* HP-specific backspace */ +{"base", base}, /* base conversion */ {"bell", bell}, /* ring bell */ {"clear", clearit}, /* TI-specific clear calculator state */ {"cosine", cosine}, /* trigonometric function cosine */ @@ -110,11 +121,14 @@ {"inverse", inverse}, /* inverse */ {"leftParen", leftParen}, /* TI-specific left parenthesis */ {"logarithm", logarithm}, /* logarithm base 10 */ +{"mod", mod}, /* modulus */ {"multiply", multiply}, /* multiplication */ {"naturalLog", naturalLog}, /* natural logarithm base e */ {"negate", negate}, /* change sign */ {"nop", nop}, /* no operation, rings bell */ +{"not", not}, /* bitwise not */ {"off", off}, /* clear state */ +{"or", or}, /* bitwise or */ {"pi", pi}, /* the number pi */ {"power", power}, /* raise to an arbitrary power */ {"quit", quit}, /* quit */ @@ -124,6 +138,8 @@ {"roll", roll}, /* HP-specific roll stack */ {"scientific", scientific}, /* scientfic notation (EE) */ {"selection", selection}, /* copy selection */ +{"shl", shl}, /* arithmetic shift left */ +{"shr", shr}, /* arithmetic shift right */ {"sine", sine}, /* trigonometric function sine */ {"square", square}, /* square */ {"squareRoot", squareRoot}, /* square root */ @@ -132,6 +148,8 @@ {"sum", sum}, /* memory summation */ {"tangent", tangent}, /* trigonometric function tangent */ {"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 */ }; @@ -146,6 +164,14 @@ } /*ARGSUSED*/ +static void and(Widget w, XEvent *ev, String *vector, Cardinal *count) +{ + XCALC_PRE_OP(kAND); + rpn ? twof(kAND) : twoop(kAND); + post_op(); +} + +/*ARGSUSED*/ static void back(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kBKSP); @@ -154,6 +180,14 @@ } /*ARGSUSED*/ +static void base(Widget w, XEvent *ev, String *vector, Cardinal *count) +{ + XCALC_PRE_OP(kBASE); + change_base(); + post_op(); +} + +/*ARGSUSED*/ static void bell(Widget w, XEvent *ev, String *vector, Cardinal *count) { ringbell(); @@ -196,6 +230,7 @@ { switch (vector[0][0]) { + case '0': XCALC_PRE_OP(kZERO); numeric(kZERO); break; case '1': XCALC_PRE_OP(kONE); numeric(kONE); break; case '2': XCALC_PRE_OP(kTWO); numeric(kTWO); break; case '3': XCALC_PRE_OP(kTHREE); numeric(kTHREE); break; @@ -205,7 +240,12 @@ case '7': XCALC_PRE_OP(kSEVEN); numeric(kSEVEN); break; case '8': XCALC_PRE_OP(kEIGHT); numeric(kEIGHT); 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(); } @@ -291,6 +331,14 @@ } /*ARGSUSED*/ +static void mod(Widget w, XEvent *ev, String *vector, Cardinal *count) +{ + XCALC_PRE_OP(kMOD); + rpn ? twof(kMOD) : twoop(kMOD); + post_op(); +} + +/*ARGSUSED*/ static void multiply(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kMUL); @@ -321,6 +369,14 @@ } /*ARGSUSED*/ +static void not(Widget w, XEvent *ev, String *vector, Cardinal *count) +{ + XCALC_PRE_OP(kNOT); + oneop(kNOT); + post_op(); +} + +/*ARGSUSED*/ static void off(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kOFF); @@ -329,6 +385,14 @@ } /*ARGSUSED*/ +static void or(Widget w, XEvent *ev, String *vector, Cardinal *count) +{ + XCALC_PRE_OP(kOR); + rpn ? twof(kOR) : twoop(kOR); + post_op(); +} + +/*ARGSUSED*/ static void pi(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kPI); @@ -347,7 +411,8 @@ /*ARGSUSED*/ 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(); else Quit(); @@ -400,6 +465,22 @@ } /*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*/ static void sine(Widget w, XEvent *ev, String *vector, Cardinal *count) { XCALC_PRE_OP(kSIN); @@ -463,6 +544,22 @@ 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*/ static void XexchangeY(Widget w, XEvent *ev, String *vector, Cardinal *count) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/app-defaults/XCalc new/xcalc-1.1.0/app-defaults/XCalc --- old/xcalc-1.0.7/app-defaults/XCalc 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/app-defaults/XCalc 2019-06-09 22:45:40.000000000 +0200 @@ -42,6 +42,15 @@ XCalc*bevel.screen.P.fromHoriz: GRAD XCalc*bevel.screen.P.fromVert: LCD 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.bevel.screen.LCD.width: 186 @@ -59,6 +68,12 @@ None<Key>7:digit(7)\n\ None<Key>8:digit(8)\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_1:digit(1)\n\ <Key>KP_2:digit(2)\n\ @@ -71,6 +86,7 @@ <Key>KP_9:digit(9)\n\ <Key>KP_Enter:equal()\n\ <Key>KP_Equal:equal()\n\ + <Key>Return:equal()\n\ <Key>KP_Multiply:multiply()\n\ <Key>KP_Add:add()\n\ <Key>KP_Subtract:subtract()\n\ @@ -87,6 +103,13 @@ :<Key>(:leftParen()\n\ :<Key>):rightParen()\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>^:power()\n\ <Key>p:pi()\n\ @@ -140,62 +163,95 @@ XCalc*ti.button15.label: y^x XCalc*ti.button15.translations: #override<Btn1Down>,<Btn1Up>:power()unset() -XCalc*ti.button16.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* -XCalc*ti.button16.label: \160 -XCalc*ti.button16.translations: #override<Btn1Down>,<Btn1Up>:pi()unset() -XCalc*ti.button17.label: x! -XCalc*ti.button17.translations: #override<Btn1Down>,<Btn1Up>:factorial()unset() -XCalc*ti.button18.label: ( -XCalc*ti.button18.translations: #override<Btn1Down>,<Btn1Up>:leftParen()unset() -XCalc*ti.button19.label: ) -XCalc*ti.button19.translations: #override<Btn1Down>,<Btn1Up>:rightParen()unset() -XCalc*ti.button20.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* -XCalc*ti.button20.label: \270 -XCalc*ti.button20.translations: #override<Btn1Down>,<Btn1Up>:divide()unset() - -XCalc*ti.button21.label: STO -XCalc*ti.button21.translations: #override<Btn1Down>,<Btn1Up>:store()unset() -XCalc*ti.button22.label: 7 -XCalc*ti.button22.translations: #override<Btn1Down>,<Btn1Up>:digit(7)unset() -XCalc*ti.button23.label: 8 -XCalc*ti.button23.translations: #override<Btn1Down>,<Btn1Up>:digit(8)unset() -XCalc*ti.button24.label: 9 -XCalc*ti.button24.translations: #override<Btn1Down>,<Btn1Up>:digit(9)unset() -XCalc*ti.button25.label: * -XCalc*ti.button25.translations: #override<Btn1Down>,<Btn1Up>:multiply()unset() - -XCalc*ti.button26.label: RCL -XCalc*ti.button26.translations: #override<Btn1Down>,<Btn1Up>:recall()unset() -XCalc*ti.button27.label: 4 -XCalc*ti.button27.translations: #override<Btn1Down>,<Btn1Up>:digit(4)unset() -XCalc*ti.button28.label: 5 -XCalc*ti.button28.translations: #override<Btn1Down>,<Btn1Up>:digit(5)unset() -XCalc*ti.button29.label: 6 -XCalc*ti.button29.translations: #override<Btn1Down>,<Btn1Up>:digit(6)unset() -XCalc*ti.button30.label: - -XCalc*ti.button30.translations: #override<Btn1Down>,<Btn1Up>:subtract()unset() - -XCalc*ti.button31.label: SUM -XCalc*ti.button31.translations: #override<Btn1Down>,<Btn1Up>:sum()unset() -XCalc*ti.button32.label: 1 -XCalc*ti.button32.translations: #override<Btn1Down>,<Btn1Up>:digit(1)unset() -XCalc*ti.button33.label: 2 -XCalc*ti.button33.translations: #override<Btn1Down>,<Btn1Up>:digit(2)unset() -XCalc*ti.button34.label: 3 -XCalc*ti.button34.translations: #override<Btn1Down>,<Btn1Up>:digit(3)unset() -XCalc*ti.button35.label: + -XCalc*ti.button35.translations: #override<Btn1Down>,<Btn1Up>:add()unset() - -XCalc*ti.button36.label: EXC -XCalc*ti.button36.translations: #override<Btn1Down>,<Btn1Up>:exchange()unset() -XCalc*ti.button37.label: 0 -XCalc*ti.button37.translations: #override<Btn1Down>,<Btn1Up>:digit(0)unset() -XCalc*ti.button38.label: . -XCalc*ti.button38.translations: #override<Btn1Down>,<Btn1Up>:decimal()unset() -XCalc*ti.button39.label: +/- -XCalc*ti.button39.translations: #override<Btn1Down>,<Btn1Up>:negate()unset() -XCalc*ti.button40.label: = -XCalc*ti.button40.translations: #override<Btn1Down>,<Btn1Up>:equal()unset() +XCalc*ti.button16.label: not +XCalc*ti.button16.translations: #override<Btn1Down>,<Btn1Up>:not()unset() +XCalc*ti.button17.label: and +XCalc*ti.button17.translations: #override<Btn1Down>,<Btn1Up>:and()unset() +XCalc*ti.button18.label: or +XCalc*ti.button18.translations: #override<Btn1Down>,<Btn1Up>:or()unset() +XCalc*ti.button19.label: xor +XCalc*ti.button19.translations: #override<Btn1Down>,<Btn1Up>:xor()unset() +XCalc*ti.button20.label: trunc +XCalc*ti.button20.translations: #override<Btn1Down>,<Btn1Up>:trunc()unset() + +XCalc*ti.button21.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* +XCalc*ti.button21.label: \160 +XCalc*ti.button21.translations: #override<Btn1Down>,<Btn1Up>:pi()unset() +XCalc*ti.button22.label: x! +XCalc*ti.button22.translations: #override<Btn1Down>,<Btn1Up>:factorial()unset() +XCalc*ti.button23.label: ( +XCalc*ti.button23.translations: #override<Btn1Down>,<Btn1Up>:leftParen()unset() +XCalc*ti.button24.label: ) +XCalc*ti.button24.translations: #override<Btn1Down>,<Btn1Up>:rightParen()unset() +XCalc*ti.button25.label: base +XCalc*ti.button25.translations: #override<Btn1Down>,<Btn1Up>:base()unset() + +XCalc*ti.button26.label: shl +XCalc*ti.button26.translations: #override<Btn1Down>,<Btn1Up>:shl()unset() +XCalc*ti.button27.label: D +XCalc*ti.button27.translations: #override<Btn1Down>,<Btn1Up>:digit(D)unset() +XCalc*ti.button28.label: E +XCalc*ti.button28.translations: #override<Btn1Down>,<Btn1Up>:digit(E)unset() +XCalc*ti.button29.label: F +XCalc*ti.button29.translations: #override<Btn1Down>,<Btn1Up>:digit(F)unset() +XCalc*ti.button30.label: shr +XCalc*ti.button30.translations: #override<Btn1Down>,<Btn1Up>:shr()unset() + +XCalc*ti.button31.label: mod +XCalc*ti.button31.translations: #override<Btn1Down>,<Btn1Up>:mod()unset() +XCalc*ti.button32.label: A +XCalc*ti.button32.translations: #override<Btn1Down>,<Btn1Up>:digit(A)unset() +XCalc*ti.button33.label: B +XCalc*ti.button33.translations: #override<Btn1Down>,<Btn1Up>:digit(B)unset() +XCalc*ti.button34.label: C +XCalc*ti.button34.translations: #override<Btn1Down>,<Btn1Up>:digit(C)unset() +XCalc*ti.button35.font: -adobe-symbol-*-*-*-*-*-120-*-*-*-*-*-* +XCalc*ti.button35.label: \270 +XCalc*ti.button35.translations: #override<Btn1Down>,<Btn1Up>:divide()unset() + +XCalc*ti.button36.label: STO +XCalc*ti.button36.translations: #override<Btn1Down>,<Btn1Up>:store()unset() +XCalc*ti.button37.label: 7 +XCalc*ti.button37.translations: #override<Btn1Down>,<Btn1Up>:digit(7)unset() +XCalc*ti.button38.label: 8 +XCalc*ti.button38.translations: #override<Btn1Down>,<Btn1Up>:digit(8)unset() +XCalc*ti.button39.label: 9 +XCalc*ti.button39.translations: #override<Btn1Down>,<Btn1Up>:digit(9)unset() +XCalc*ti.button40.label: * +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.vertDistance: 12 @@ -290,6 +346,38 @@ XCalc*ti.button40.fromHoriz: button39 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.bevel.screen.LCD.width: 186 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/configure new/xcalc-1.1.0/configure --- old/xcalc-1.0.7/configure 2019-02-17 22:52:47.000000000 +0100 +++ new/xcalc-1.1.0/configure 2019-06-09 22:45:43.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xcalc 1.0.7. +# Generated by GNU Autoconf 2.69 for xcalc 1.1.0. # # Report bugs to <https://gitlab.freedesktop.org/xorg/app/xcalc/issues>. # @@ -581,8 +581,8 @@ # Identity of this package. PACKAGE_NAME='xcalc' PACKAGE_TARNAME='xcalc' -PACKAGE_VERSION='1.0.7' -PACKAGE_STRING='xcalc 1.0.7' +PACKAGE_VERSION='1.1.0' +PACKAGE_STRING='xcalc 1.1.0' PACKAGE_BUGREPORT='https://gitlab.freedesktop.org/xorg/app/xcalc/issues' PACKAGE_URL='' @@ -1313,7 +1313,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xcalc 1.0.7 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]... @@ -1383,7 +1383,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xcalc 1.0.7:";; + short | recursive ) echo "Configuration of xcalc 1.1.0:";; esac cat <<\_ACEOF @@ -1499,7 +1499,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xcalc configure 1.0.7 +xcalc configure 1.1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1823,7 +1823,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xcalc $as_me 1.0.7, which was +It was created by xcalc $as_me 1.1.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2691,7 +2691,7 @@ # Define the identity of the package. PACKAGE='xcalc' - VERSION='1.0.7' + VERSION='1.1.0' cat >>confdefs.h <<_ACEOF @@ -11425,7 +11425,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xcalc $as_me 1.0.7, 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 CONFIG_FILES = $CONFIG_FILES @@ -11491,7 +11491,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xcalc config.status 1.0.7 +xcalc config.status 1.1.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/configure.ac new/xcalc-1.1.0/configure.ac --- old/xcalc-1.0.7/configure.ac 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/configure.ac 2019-06-09 22:45:40.000000000 +0200 @@ -23,7 +23,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([xcalc], [1.0.7], +AC_INIT([xcalc], [1.1.0], [https://gitlab.freedesktop.org/xorg/app/xcalc/issues], [xcalc]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/man/xcalc.man new/xcalc-1.1.0/man/xcalc.man --- old/xcalc-1.0.7/man/xcalc.man 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/man/xcalc.man 2019-06-09 22:45:40.000000000 +0200 @@ -130,7 +130,7 @@ The corresponding action procedure is \fBtangent()\fP. .TP 10 .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. 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 @@ -168,6 +168,26 @@ "(1+2+3) y^x (1+2) =" equals "6 y^x 3" which equals "216". The corresponding action procedure is \fBpower()\fR. .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 The constant 'pi'. (3.1415927....) The corresponding action procedure is \fBpi()\fR. @@ -186,6 +206,30 @@ Right parenthesis. The corresponding action procedure for TI calculators is \fBrightParen()\fR. .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 / Division. The corresponding action procedure is \fBdivide()\fR. .TP 10 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/math.c new/xcalc-1.1.0/math.c --- old/xcalc-1.0.7/math.c 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/math.c 2019-06-09 22:45:40.000000000 +0200 @@ -43,7 +43,7 @@ * 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 rad2drg=180.0/M_PI; @@ -94,17 +94,47 @@ * is non-zero then an error has occurred. On some systems (e.g. Ultrix), * sscanf will call lower level routines that will set errno. */ - static void -parse_double (const char *src, const char *fmt, double *dp) +parse_double(double *dp) { + unsigned long n = 0; 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; 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) @@ -181,12 +211,13 @@ } #endif } + /*-------------------------------------------------------------------------*/ static void DrawDisplay(void) { - if (strlen(dispstr) > 12) { /* strip out some decimal digits */ - char *estr = strchr(dispstr,'e'); /* search for exponent part */ + if (strlen(dispstr) >= MAXDISP) { /* strip out some decimal digits */ + char *estr = index(dispstr,'e'); /* search for exponent part */ if (!estr) dispstr[12]='\0'; /* no exp, just trunc. */ else { char tmp[32]; @@ -204,6 +235,28 @@ setflag(XCalc_RADIAN, (drgmode==RAD)); setflag(XCalc_GRADAM, (drgmode==GRAD)); 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(); } /*-------------------------------------------------------------------------*/ @@ -239,7 +292,7 @@ case kRCL: PushNum(dnum); dnum = mem[cell]; - snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); + format_double(dnum); lift_enabled = 1; entered = 1; clrdisp++; @@ -268,7 +321,9 @@ if ((int) strlen(dispstr) >= MAXDISP) return; + st[0] = '\0'; switch (keynum){ + case kZERO: st[0] = '0'; break; case kONE: st[0] = '1'; break; case kTWO: st[0] = '2'; break; case kTHREE: st[0] = '3'; break; @@ -276,12 +331,20 @@ case kFIVE: st[0] = '5'; break; case kSIX: st[0] = '6'; break; case kSEVEN: st[0] = '7'; break; - case kEIGHT: st[0] = '8'; break; - case kNINE: st[0] = '9'; break; - case kZERO: st[0] = '0'; break; - } - st[1] = '\0'; - strcat(dispstr,st); + case kEIGHT: if (numbase > 8) st[0] = '8'; break; + case kNINE: if (numbase > 8) st[0] = '9'; 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'; + strcat(dispstr,st); DrawDisplay(); if (clrdisp && keynum != kZERO) @@ -433,7 +496,7 @@ } if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); clrdisp=CLR=1; entered=Dpoint=exponent=0; @@ -451,7 +514,7 @@ /* now, if the current op (keynum) is of higher priority than the lastop, the current op and number are just pushed on top - Priorities: (Y^X) > *,/ > +,- */ + Priorities: (Y^X) > *,/ > +,- > >>,<< > & > ^ > ~ */ if (priority(keynum) > priority(lastop)) { PushNum(dnum); @@ -466,10 +529,17 @@ case kMUL: acc *= dnum; break; case kDIV: 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); PushOp(keynum); - snprintf(dispstr, sizeof(dispstr), "%.8g", acc); + format_double(acc); DrawDisplay(); dnum=acc; } @@ -491,7 +561,7 @@ if (!entered) return; if (entered==1) - parse_double(dispstr, "%lf", &dnum); + parse_double(&dnum); acc = PopNum(); switch(keynum) { case kADD: acc += dnum; break; @@ -499,9 +569,16 @@ case kMUL: acc *= dnum; break; case kDIV: 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(); clrdisp++; Dpoint = exponent = 0; @@ -521,7 +598,7 @@ Dpoint=exponent=0; if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); entered=2; memop = kENTR; PushNum(dnum); @@ -539,7 +616,7 @@ Dpoint=exponent=0; if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); entered=2; PushNum(dnum); @@ -562,12 +639,24 @@ case kLPAR: flagPAREN--; PushNum(acc); 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; PushNum(dnum); } - snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); + format_double(dnum); DrawDisplay(); } @@ -586,13 +675,13 @@ if (!entered) return; if (entered==1) - parse_double(dispstr, "%lf", &dnum); + parse_double(&dnum); entered = 2; lift_enabled = 1; RollNum(flagINV); flagINV=0; clrdisp++; - snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); + format_double(dnum); DrawDisplay(); } @@ -610,7 +699,7 @@ Dpoint=exponent=0; if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); entered=2; PushNum(dnum); @@ -629,6 +718,18 @@ 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; } dnum=acc; PushNum(dnum); @@ -636,7 +737,7 @@ (void) PopNum(); flagPAREN--; entered=2; - snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); + format_double(dnum); DrawDisplay(); } @@ -645,7 +746,7 @@ { if (flagINV) { if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); switch (drgmode) { case DEG: dnum=dnum*M_PI/180.0; break; case RAD: dnum=dnum*200.0/M_PI; break; @@ -654,7 +755,7 @@ entered=2; clrdisp=1; flagINV=0; - snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); + format_double(dnum); } flagINV=0; @@ -685,7 +786,7 @@ { memop = keynum; if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); entered = 2; clrdisp++; lift_enabled = 0; @@ -698,7 +799,7 @@ double dtmp; if (entered==1) - parse_double(dispstr,"%lf",&dnum); + parse_double(&dnum); entered = 2; switch (keynum) { /* do the actual math fn. */ @@ -741,6 +842,8 @@ for (j=1,dnum=1.0; j<=i; j++) dnum*=(float) j; break; + case kNOT: dnum = ~(long)dnum; break; + case kTRUNC: dnum = trunc(dnum); break; } if (entered==3) { /* error */ @@ -753,7 +856,7 @@ clrdisp=1; flagINV=0; lift_enabled = 1; - snprintf(dispstr, sizeof(dispstr), "%.8g", dnum); + format_double(dnum); DrawDisplay(); } @@ -899,12 +1002,18 @@ /*******/ { switch (op) { - case kPOW: return(2); + case kPOW: return(6); case kMUL: - case kDIV: return(1); + case kDIV: + case kMOD: return(5); 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; } @@ -915,12 +1024,16 @@ /********/ { flagM=flagINV=flagPAREN=0; drgmode=DEG; + numbase=(!numbase ? 10 : numbase); setflag(XCalc_MEMORY, False); setflag(XCalc_INVERSE, False); setflag(XCalc_PAREN, False); setflag(XCalc_RADIAN, False); setflag(XCalc_GRADAM, False); setflag(XCalc_DEGREE, True); + setflag(XCalc_HEX, False); + setflag(XCalc_DEC, True); + setflag(XCalc_OCT, False); strlcpy(dispstr, "0", sizeof(dispstr)); draw(dispstr); ClearStacks(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/xcalc.c new/xcalc-1.1.0/xcalc.c --- old/xcalc-1.0.7/xcalc.c 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/xcalc.c 2019-06-09 22:45:40.000000000 +0200 @@ -74,7 +74,7 @@ static Widget toplevel=NULL; /* top level shell widget */ static Widget calculator=NULL; /* an underlying form widget */ 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 */ /* checkerboard used in mono mode */ static XtAppContext xtcontext; /* Toolkit application context */ @@ -221,6 +221,18 @@ /* () - the parenthesis indicator */ ind[XCalc_PAREN] = XtCreateManagedWidget("P", labelWidgetClass, screen, 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 @@ "button21","button22","button23","button24","button25", "button26","button27","button28","button29","button30", "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; int n = XtNumber(Keyboard); @@ -297,14 +312,12 @@ */ static void Syntax(int argc, char **argv) { - register int i; - (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, "\n\n"); (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, "\n"); XtDestroyApplicationContext(xtcontext); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xcalc-1.0.7/xcalc.h new/xcalc-1.1.0/xcalc.h --- old/xcalc-1.0.7/xcalc.h 2019-02-17 22:52:44.000000000 +0100 +++ new/xcalc-1.1.0/xcalc.h 2019-06-09 22:45:40.000000000 +0200 @@ -102,6 +102,21 @@ #define kROLL 44 /* roll stack */ #define kNOP 45 /* no operation */ #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_INVERSE 1 /* inverse function indicator */ @@ -109,6 +124,9 @@ #define XCalc_RADIAN 3 /* radian indicator */ #define XCalc_GRADAM 4 /* grad 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 */ extern XtActionsRec Actions[]; @@ -121,6 +139,7 @@ extern int pre_op(int keynum); extern void post_op(void); +extern void change_base(void); extern void numeric(int keynum); extern void bkspf(void); extern void decf(void);
