Package Details: grpn 1.4.0-1

Git Clone URL: https://aur.archlinux.org/grpn.git (read-only)
Package Base: grpn
Description: A graphical reverse polish notation (RPN) calculator
Upstream URL: http://www.getreu.net/
Licenses: GPL
Submitter: Dragonlord
Maintainer: Dragonlord
Last Packager: Dragonlord
Votes: 6
Popularity: 0.112991
First Submitted: 2012-01-03 19:33
Last Updated: 2015-06-28 15:12

Latest Comments

thx1138 commented on 2014-12-01 03:32

There is a new version 1.4.0, with files dated 2013 Nov 02. The CHANGES files says:
v1.4.0
New left and right shift operators.
Some fixes for compilation warnings in regard to the mod
operator functions.
New adds a gitignore file.

The grpn project is also hosted on GitHub. After moving to GitHub, the grpn-1.4.0 tar file, also copied at getreu.net, uses the literal name "src" for the top level directory. This is a problem, since all the build references expect a name of the form "$pkgname-$pkgver", as in "grpn-1.4.0". A simple work-around modifies the PKGBUILD to change the directory name to the conventional "$pkgname-$pkgver". I have a modified PKGBUILD that provides for this.

I also suggest a modified "grpn.desktop" file, that includes the grpn program in the "Utility" menu, in addition to the "Office" menu, and adds a "GenericName=Calculator" entry. This makes the menu entry appear as "Calculator (grpn)" instead of simply "grpn", which might be a clue for anyone unfamiliar with the program.

I have also made some hacks to rearrange the buttons in the display. First, it is possible to display all of the function buttons by simply setting "int NumButtonRows" to a larger value in button_def.c. But also, it helps to organize these buttons in several rows, instead of the current single row, so that the display is more compact. And then, I have added an additional button for the constant "e", to fill out the total number of buttons to an even value, where otherwise there was a "blank" missing button. Finally, I have moved the row of stack manipulation buttons down below the number pad.

If you want to play with these, there are two modified files and one patch file: PKGBUILD, grpn.desktop, and button.patch. I don't see any way to attach files on the AUR, so I will include the unified diffs here inline. You can cut and paste these diff's and use them as patch files against the current AUR tarball. Then, in the directory with the patched files - PKGBUILD, grpn.desktop - and additional patch file - button.patch - run something like "makepkg -si".

For the PKGBUILD:

--- PKGBUILD.orig 2012-10-27 10:55:19.000000000 -0600
+++ PKGBUILD 2014-11-30 19:22:34.523913985 -0700
@@ -1,7 +1,7 @@
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>

pkgname=grpn
-pkgver=1.3.4
+pkgver=1.4.0
pkgrel=1
pkgdesc='A graphical reverse polish notation (RPN) calculator'
arch=('i686' 'x86_64')
@@ -9,14 +9,26 @@
license=('GPL')
depends=('gtk2')
source=(http://www.getreu.net/public/downloads/software/$pkgname/$pkgname-$pkgver/${pkgname}_${pkgver}-1.tar.gz \
- $pkgname.desktop)
-sha256sums=('e26c9c4648c11d35d3a0ba8bb7855b016e2559fa291036eb2dac0a9d4b2caa6f'
- '2c0f7685e7423e14f93c38fca951b8497009da4705f4b629f01c4048b32697ab')
+ button.patch $pkgname.desktop)
+sha256sums=('51fe7800cecab5119c94a87f6b263cc65073cfa7d655f538e7adf5273d092947'
+ '5e2083906569f8928c59db07d43e909a22db02fa95ba01e388a986cce34d1cd6'
+ 'a635b7ef6b940202899eb4599c346acd596f28809fdf18275681771d79381226')

-build() {
- cd $pkgname-$pkgver
+prepare() {
+# After moving to GitHub, the grpn-1.4.0 tar file uses the literal name "src" for the top level directory.
+# Change the directory name to the conventional "$pkgname-$pkgver".
+ cd ${srcdir}
+ mv src $pkgname-$pkgver
+ cd $pkgname-$pkgver
+
+ for i in ../*patch
+ do patch -Np1 < ${i};
+ done
+}

- make
+build() {
+ cd $pkgname-$pkgver
+ make
}

package() {


For the desktop menu entry:

--- grpn.desktop.orig 2012-01-03 12:37:28.000000000 -0700
+++ grpn.desktop 2014-11-30 19:04:55.281058216 -0700
@@ -1,8 +1,9 @@
[Desktop Entry]
Name=grpn
+GenericName=Calculator
Exec=grpn
Comment=Graphical reverse polish notation calculator
Terminal=false
Type=Application
-Categories=Office;
-Icon=grpn
\ No newline at end of file
+Categories=Office;Utility;
+Icon=grpn

And, to patch the source files, naming this diff "button.patch":

--- grpn-1.4.0/button_def.c 2013-11-02 06:54:30.000000000 -0600
+++ grpn-1.4.0-new/button_def.c 2014-11-30 18:32:25.944743615 -0700
@@ -47,7 +47,10 @@
{ "Oct", "oct", "Octal display mode.",
baseCmdCB, (void *)OCTAL },
{ "Bin", "bin", "Binary display mode.",
- baseCmdCB, (void *)BINARY },
+ baseCmdCB, (void *)BINARY }
+};
+
+FuncInfo invisible2[] = {
{ "Rect", "rect", "Rectangular display mode.",
cmodeCmdCB, (void *)RECTANGULAR },
{ "Polar", "pol", "Polar display mode.",
@@ -59,7 +62,10 @@
{ "Db10", "db10", "Convert to dB (Power).",
genericButtonCB, (void *)Db10Stack },
{ "Db20", "db20", "Convert to dB (Voltage).",
- genericButtonCB, (void *)Db20Stack },
+ genericButtonCB, (void *)Db20Stack }
+};
+
+FuncInfo invisible3[] = {
{ "Rip", "rip", "Resistors in parallel.",
genericButtonCB, (void *)RipStack },
{ "Cplx", "cplx", "Create or decompose a complex number.",
@@ -71,23 +77,27 @@
{ "Mtrx", "matrix", "Create or decompose a matrix.",
genericButtonCB, (void *)MtrxStack },
{ "LShift", "<<", "Left Shift Stack",
- genericButtonCB, (void *)LShiftStack },
+ genericButtonCB, (void *)LShiftStack }
+};
+
+FuncInfo invisible4[] = {
{ "LShift", "lshift", "Left Shift Stack",
- genericButtonCB, (void *)LShiftStack },
+ genericButtonCB, (void *)LShiftStack },
{ "RShift", ">>", "Right Shift Stack",
- genericButtonCB, (void *)RShiftStack },
+ genericButtonCB, (void *)RShiftStack },
{ "RShift", "rshift", "Right Shift Stack",
- genericButtonCB, (void *)RShiftStack },
+ genericButtonCB, (void *)RShiftStack },
{ "Undo", "undo", "Undo last command. Up to 10 commands can be undone.",
genericButtonCB, (void *)UndoStack },
{ "Clear", "clear", "Clears and removes all numbers on the stack.",
genericButtonCB, (void *)clearLCD },
- { "Quit", "quit", "Quit GRPN.", genericButtonCB, (void *)exit }
+ { "Quit", "quit", "Quit GRPN.",
+ genericButtonCB, (void *)exit }
};
+
FuncInfo row2[] = {
{ "Enter", "dup", "Copy the number on the top of the stack.",
genericButtonCB, (void *)PushStack },
- { "+/-", "neg", "Change sign.", plusMinusCB, NULL },
{ "EEX", NULL, "Mouse input: enter an exponent.",
enterNumCB, (void *)'e' },
{ "DEL", NULL, "Mouse input: backspace.",
@@ -95,7 +105,8 @@
{ "Drop", "drop", "Delete the number on the top of the stack.",
genericButtonCB, (void *)PopStack },
{ "Swap", "swap", "Swap 2 numbers on the top of the stack.",
- genericButtonCB, (void *)SwapStack }
+ genericButtonCB, (void *)SwapStack },
+ { "e", "e", "The constant e.", genericButtonCB, (void *)eStack }
};
FuncInfo num789[] = {
{ "7", NULL, NULL, enterNumCB, (void *)'7' },
@@ -140,7 +151,7 @@
FuncInfo num0[] = {
{ "0", NULL, NULL, enterNumCB, (void *)'0' },
{ ".", NULL, NULL, enterNumCB, (void *)'.' },
- { NULL, NULL, NULL, NULL, NULL },
+ { "+/-", "neg", "Change sign.", plusMinusCB, NULL },
{ "+", NULL, NULL, genericButtonCB, (void *)AddStack },
{ " 2\nx ", "sqr", "Square.", genericButtonCB, (void *)SqrStack },
{ " x\ny ", "pow", "Power.", genericButtonCB, (void *)PowStack },
@@ -150,16 +161,19 @@
genericButtonCB, (void *)ExpStack }
};

-int NumButtonRows = 5;
-int NumFunctionRows = 6;
+int NumButtonRows = 9;
+int NumFunctionRows = 9;

struct RowInfo rowinf[] = {
- { 6, 6, row2 },
{ 8, 8, num789 },
{ 8, 8, num456 },
{ 8, 8, num123 },
{ 8, 8, num0 },
- { sizeof(invisible1)/sizeof(*invisible1), 0, invisible1 }
+ { 6, 6, row2 },
+ { sizeof(invisible1)/sizeof(*invisible1), 0, invisible1 },
+ { sizeof(invisible2)/sizeof(*invisible2), 0, invisible2 },
+ { sizeof(invisible3)/sizeof(*invisible3), 0, invisible3 },
+ { sizeof(invisible4)/sizeof(*invisible4), 0, invisible4 }
};


diff -u grpn-1.4.0/constant.c grpn-1.4.0-new/constant.c
--- grpn-1.4.0/constant.c 2013-11-02 06:50:07.000000000 -0600
+++ grpn-1.4.0-new/constant.c 2014-11-30 18:31:26.088292613 -0700
@@ -24,6 +24,7 @@
#include "real.h"
#include "complex.h"

+Real *reale;
Real *realPi;
Real *realPi2;
Real *realZero;
@@ -38,6 +39,7 @@
void setup_constant(){
Real *tmp;

+ reale = setRealDouble(newReal(), M_E);
realPi = setRealDouble(newReal(), M_PI);
realPi2 = setRealDouble(newReal(), M_PI/2.0);
realZero = setRealDouble(newReal(), 0.0);
diff -u grpn-1.4.0/constant.h grpn-1.4.0-new/constant.h
--- grpn-1.4.0/constant.h 2013-11-02 06:50:07.000000000 -0600
+++ grpn-1.4.0-new/constant.h 2014-11-30 18:28:23.395617527 -0700
@@ -22,6 +22,7 @@
#ifndef __CONSTANT_H
#define __CONSTANT_H

+extern Real *reale;
extern Real *realPi;
extern Real *realPi2;
extern Real *realZero;
Common subdirectories: grpn-1.4.0/debian and grpn-1.4.0-new/debian
diff -u grpn-1.4.0/funcs.c grpn-1.4.0-new/funcs.c
--- grpn-1.4.0/funcs.c 2013-11-02 06:50:07.000000000 -0600
+++ grpn-1.4.0-new/funcs.c 2014-11-30 18:25:16.676290283 -0700
@@ -115,6 +115,19 @@
UndoStackState(1);
}

+void eStack(){
+ Number *n1;
+
+ finishEditor();
+
+ SaveStackState(0);
+
+ n1 = setNumberReal(newNumber(), reale);
+ Push(n1);
+
+ UndoStackState(1);
+}
+
void NegStack(){
Number *n1, *n2;

diff -u grpn-1.4.0/funcs.h grpn-1.4.0-new/funcs.h
--- grpn-1.4.0/funcs.h 2013-11-02 06:50:07.000000000 -0600
+++ grpn-1.4.0-new/funcs.h 2014-11-30 18:21:19.373811960 -0700
@@ -42,6 +42,7 @@
void PushStack();

void PiStack();
+void eStack();

void NegStack();
void InvStack();

Anonymous comment on 2012-04-22 16:19

I've always wanted an updated version of this program, but I'm not a C programmer. Thanks.

Myra