RPN PopUp Calculator 1.0.2


Contents

Overview
Installation
Setup
Usage
Launguage Reference
Examples
Registration
Disclaimer


Overview

RPN PopUp Calculator is a HackMaster extension which pops up a calculator over the active application. It is activated with the simple (definable) pen stroke. When you are finished with calculation, you are back to your application with just one tap. You can exchange data with your application if it supports copy and paste, or if it has an input field. Numbers and operations can also be entered with graffiti.

RPN PopUp Calculator has a simple forth-like script language, so you can write your own functions.

RPN PopUp Calculator is compatibile with OS 2.0 and later. It will not work on older (Pilot 1000/5000 with OS 1.x) models.

Back to contents


Installation

This archive contains the following files:

Readme.htm This document
RpnPopCalc.prc Program file
Scripts.txt Example scripts in the simple text form, so you can copy them to the Palm desktop application. After the HotSync, you'll get them on your Palm device.
RPNCalculatorSSta.prc MagicText plug-in for activating RPN PopUp Calculator
Mathlib.prc Floating point library needed for trig. and exp functions and for RPN PopUp Calculator scripts.
Hackmastr.prc The "HackMaster" System Extensions Manager. "HackMaster" is by Edward Keyes, DaggerWare Software.

After installing RpnPopCalc.prc, start "HackMaster" and click on its checkbox to activate it. After that, RPN PopUp Calculator can be started with the pen stroke defined in the setup.

Before updating or deleting any Hackmaster program, you must disable the application first in the "HackMaster" control screen.

Back to contents


Setup

Start "HackMaster" and tap on the + icon associated with RPN PopUp Calculator.

Avalable options:

Known problem: If you are very fast with double-tap, it will not work correctly.

Back to contents


Usage

- To exit, tap anywhere outside its window, or use "Command" key stroke (something like "./", where dot is the starting point of the stroke).
- Digits and operations are entered by tapping on the buttons or with graffiti.
- "Backspace" graffiti pen stroke erases last entered digit.
- To add an exponent to a number tap on the 'EEX' button, or first write 'E' or 'e' with graffiti and then enter exponent digits. To change exponent sign, tap on the '+/-' button.
- You can move RPN PopUp Calculator on the screen to the position where you like. To do that, put the pen on the number display (above the horizontal line) and drag it to the point where you want upper left upper corner to be placed.

Buttons

'USER' - Shows a list of available user functions which must be located in the 'RpnPopCalc' MemoPad category.

'TRIG' - Shows a list of trigonometric functions. With 'Deg' and 'Rad' you choose 'Degrees' or 'Radians' mode.

'EXP' - Shows a list of exponential functions.

'COPY' - Copies displayed number to the clipboard. However, if your active application has an input field which has a focus (ie. cursor is blinking in it), then you can start RPN PopUpCalc, do some calculation and after you tap on the 'COPY' button, RPN PopUpCalc will exit and the last displayed number will be inserted into the field, at the cursor position. That way, RPN PopUpCalc can also serve as a numeric keypad.

'PASTE' - You can select a text in the field before starting RPN PopUpCalc - it will interpret selected text (execute it as a script) and display the result. See the Language Reference for details.

For other buttons, please see the Language Reference.

Back to contents


RPN PopUp Calculator Script Language Reference

RPN PopUp Calculator script is a series of commands and/or functions written in a simple text form using MemoPad application. The first step is to create a 'RpnPopCalc' MemoPad category. Each script is stored in its own record.

The first line of the script should contain the '#' caharcter followed by the function name. That name (without the '#' character) will be displayed in the popup list you get when you tap on the 'USER' button.

Each command or function can be written on its own line, or on the same line but delimited with the space character. However, there are some exceptions. Please see the note for details.

Back to contents

Function

Description

Available in

Interactive mode

Script mode

+
-
*
/
Arithmetic operators

+

+

> (greater)
< (less)
= (equal)
<> (not equal)
>= (greater or equal)
<= (less or equal)
Boolean operators.
Numbers from levels 1 and 2 are popped from the stack and compared. The result (1 for true and 0 for false) is pushed to the stack in level 1.
Example:
Level 2 = 3
Level 1 = 2
The function ‘>’ returns 1 (true) because 3 is grater than 2

-

+

CHS Changes the sign of the number in level 1. In the interactive mode, also changes the sign of the exponent (while you are entering the exponent of a number).

+

+

% The percentage calculation (level 1 = level 2 * level 1 / 100).
If you want to add or subtract the percentage from the primary number, then you must tap Enter twice (or use DUP in a script) after entering the number.
Example:
200 Enter Enter 5 % +

+

+

PI Returns the number PI

+

+

SIN
COS
TAN
CTG
ASIN
ACOS
ATAN
Trigonometric functions

+

+

INV Divides the number 1 by the number in level 1 (1/x)

+

+

SQ Square of the number in level 1 (x^2)

+

+

POW Raises the number in level 2 to the power of the number in level 1 (y^x)

+

+

EXP Calculates e^x

+

+

SQRT Square root

+

+

LOG Base 10 logarithm

+

+

LN Natural logarithm

+

+

INT Integer part

-

+

FRAC Fractional part

-

+

n ROUND Rounds the number in level 1 to n decimal places

-

+

MC Clears memory. Doesn’t affect the stack.

+

+

MADD Adds the number in level 1 to the memory. Doesn’t affect the stack.

+

+

MSUB Subtracts the number in level 1 from the memory. Doesn’t affect the stack.

+

+

MR The number from memory is pushed to the stack in level 1.

+

+

CLR Drops all numbers from the stack

+

+

n STO Stores the number in level 2 to the temporary memory n. n must be in the range from 0 to 9.

-

+

n RCL The number from the temporary memory n is pushed to the stack in level 1. n must be in the range from 0 to 9.

-

+

DROP Drops the number in level 1 from the stack

+

+

DUP Duplicates the number in level 1. In the interactive mode, use the ‘Enter’ button

+

+

SWAP Moves the number in level 2 to level 1

+

+

n ROLL Moves the object in level n to level 1. In the interactive mode, if you tap on the 'ROLL' button, content of the stack will be displayed in a list. The last item of the list will becontents of the memory.

+

+

DEPTH Returns the number of elements on the stack

-

+

#Function name or

#Comment

The first line of each script should contain the ‘#’ character followed with the user-function name. That name will be visible in the list when you tap on the “USER” button.
The ‘#’ character can also be used to add comments anywhere in the script.
See
examples and the note.

-

+

?Prompt Prompts the user to enter the number.
It can be useful if your function has several arguments, and you want to remind the user what should be entered.
Entered number will be pushed to the level 1 of the stack. If the input field is left blank, the error will be generated, and the script will stop.
See
example 1 and the note.

-

+

!Message text Message box is displayed. The number from the level 1 of the stack is also displayed. Doesn’t affect the stack.
See
example 1 and the note.

-

+

:label number Defines a label. ‘label number’ must be integer in the range of 1 to 32767. If same label is defined more than once, an error is generated, and scripts stops.
See
example 2 and the note.

-

+

@label number Conditional jump.
If the number in the level 1is not zero, then the execution of a script continues from the location of the label ‘label number’.
‘label number’ must be integer in the range of 1 to 32767. If the label doesn’t exist, an error will be generated, and the script will stop.
See
example 2 and the note.

-

+

END Ends the execution of a script.
See example 2.
- +
BREAK Adds a breakpoint to the script. Usefull for debuggin.
When the script execution reaches the breakpoint, a new form will be popped up where you can view the stack.
You can stop or continue script execution, or step through the code.
- +

Back to contents

Note:

‘#’, ‘?’, ‘!’, ‘:’ and ‘@’ commands must be placed as the last commands on the line.

Some examples:

#This is a comment correct
DUP 3 ROLL SWAP #Another comment correct
#Comment SWAP DUP incorrect
@15 correct
SWAP 3 > @15 correct
@15 DUP incorrect

Back to contents

Script examples

To use scripts bellow, copy each script to a separate MemoPad record in the "RpnPopCalc" category using Palm Desktop application, and then just do a HotSync.

Script example 1:
This script calculates box volume.

#Box volume
?Box length:
?Box width:
?Box height:
* *
!Box volume is:

Back to contents

Script example 2:
This script compares all numbers on the stack and returns the largest number.

#Max
:1
DEPTH
1 >
@2
END
:2
DUP
3 ROLL
DUP
3 ROLL
<
@3
SWAP
:3
DROP
#An example for unconditional jump
#Just put a non-zero number on the stack and invoke a jump
1
@1

Back to contents

Script example 3:
This function calculates the factoriel of a number. Because RPN PopUp Calculator intermpretes the script, it can be quite slow. One of our plans for the future is to make a special script editor/compiler, so scripts will be executed much faster.

#Factoriel

?Number:
INT DUP 2 >=
@1
DROP 1 1
@3
:1
DUP
:4
1 -
DUP
2 <
@2
DUP
3 ROLL * SWAP
1 @4
:2
DROP
:3
!The result is:

Back to contents

Script example 4:
This script calculates monthly payment given present value, annual interest rate, number of payment periods, future value and payment type (0 - payments are due at the end of the period, 1 - payments are due at the beginning of the period. This function works exactly like MS Excel PMT() function.

#PMT (Payment)

?Present value:
0 STO DROP
?Future value:
1 STO DROP
?Annual interest rate (%):
1200 / 2 STO DROP
?Number of payment periods:
3 STO DROP
?Payment type (0/1):
#0=at the end of period
#1=at the beginning of period
4 STO DROP
2 RCL
0 =
@1
1
2 RCL +
3 RCL POW
5 STO
0 RCL * 1 RCL +
1 2 RCL 4 RCL * +
5 RCL 1 -
2 RCL /
*
1
@2
:1
0 RCL
1 RCL
+
3 RCL
:2
/
2 ROUND
CHS
!Monthly payment is:

Back to contents


Registration

IMPORTANT: RPN PopUp Calculator is free for all registered users of PopUpCalculator!

Registration fee is $9.95. If you find RPN PopUp Calculator useful, you can register via the excellent PilotGear service at http://www2.viaweb.com/pilotgearsw/bozidarbenc.html

PilotGear accept all kinds of payment in all forms.

If registering by fax or e-mail please provide the following:

Full Name, Address including city, state and zip, phone number, credit card (Visa, MasterCard or American Express), credit card number, expiration date and also a fact that you want to register RPN PopUp Calculator.

After you obtain you registration name and number:

Your PopUp Calculator is now registered.

Back to contents


Disclaimer

RPN PopUp Calculator is shareware. If you use it please register it. Details are given above. You may distribute unregistered copies of PopUp Calculator, but only with this file.

If you are using RPN PopUp Calculator, please register "HackMaster" with DaggerWare, if you have not already done so.

MathLib is a free shared library that can be used by any PalmPilot program that needs IEEE 754 double precision math functions. It's distributed under the terms of the GNU General Public License, and is freely available with full source code and documentation at the http://www.probe.net/~rhuebner/mathlib.html. It's not a part of the PopUp Calculator, and you're not paying anything for its use; a copy is simply included in this archive for your convenience.

I am not responsible for any damage or loss of data caused by this software. If you encounter errors, please send me a report.

Back to contents


© 1999 Benc Software Production