Reverse Polish Notation Calculator (GUI)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
sloum 125a18a07e Adds license 3 months ago
.gitignore Adds readme and gitignore 3 months ago
LICENSE Adds license 3 months ago
Makefile Adds desktop file and updates makefile and readme to reflect changes 3 months ago
README.md Removes info about there being no hot keys 3 months ago
calc.go Fixes stack display issue, adds colors, adds hot keys, updates repo image 3 months ago
gnums-icon.png Adds desktop file and updates makefile and readme to reflect changes 3 months ago
gnums.desktop Adds desktop file and updates makefile and readme to reflect changes 3 months ago
gnums.png Fixes stack display issue, adds colors, adds hot keys, updates repo image 3 months ago
go.mod Updates giu version to take advantage of keyboard handling 3 months ago
go.sum Updates giu version to take advantage of keyboard handling 3 months ago
main.go Fixes stack display issue, adds colors, adds hot keys, updates repo image 3 months ago

README.md

gnums

gnums is the gui version of my program nums (ie. gui/graphical nums). It is a reverse polish notation calculator.

screenshot of the gnums calculator interface

Usage

On initial load some sensible defaults will be set up. Other options are avialable in the settings menu. You will see a stack view on the left, the calculator buttons on the right, and the main input/output at the top. The main input/output will show what you are typing as you type it and will show the current TOS/total after performing an operation (but before more numerical entry), similar to a regular calculator. The stack view will show the full input stack and allow for more complex operations.

Most of the keys can be figured out if you don't know what they are already. I will mention that the enter key will add the currently typed in number to the top of the stack. If you have a number typed in, but have not hit enter, and you use a non-numeric/non-enter key (+, swap, sqrt, etc) the number will automatically be added to the top of the stack before the function is run.

Hot Keys

Key(s) Effect
Number Key (0-9) Enter the given number
. Enter a decimal point to the current input value
Backspace Delete a character from the current input value
Enter Place the current input value on the top of the stack
Tab Toggle the stack view open/closed
Ctrl-q Exit gnums
+ Add
- Subtract
* Multiply
/ Divide
! Invert the top stack value's sign (+/-)
^ Exponent
f Floor
c Ceiling
r Round
q Square root
o Over
s Swap
d Drop
u Dup

Dependencies

  • Go >= 1.16
  • OSX
    • xcode-select (xcode-select --install)
  • Windows
  • Debian/derivatives (package names may vary for other distros)
    • apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libglx-dev libgl1-mesa-dev libxxf86vm-dev

Building

Minor build variations can be found for each system. Using upx (apt install upx or brew install upx) will reduce binary size by a good bit for any of these systems. After running the build command, and optionally running upx, move the resulting binary onto your path and you are good to go.

OSX / Linux

You should be able to just run sudo make install. If you just want to build locally you can run: make && make compress

Alternatively, you can just run a few things yourself and avoid make altogether:

go build -ldflags "-s -w" -o gnums && upx gnums

You would then need to move the executable to where you want it, as well as install the desktop entry/icon (linux only).

Windows

Windows functionality and build steps are unconfirmed. As is the Makefile for windows usage. The following should work. The makefile instructions provided for OSX/Linux might work.

go build -ldflags "-s -w -H=windowsgui -extldflags=-static" -o gnums.exe