Post Reply 
Simple IP Calculator
02-08-2014, 01:05 PM (This post was last modified: 02-09-2014 10:20 AM by massimo.)
Post: #1
Simple IP Calculator
I created a simple IPv4 calculator to play with HP-PPL.

The IP addresses are represented as list of 4 numbers (the ip address 192.168.2.34 becomes {192,168,2,34}).

The program uses some utility functions that I wrote to simplify output of text on the display of the calculator.

---

IP Calc v0.2

Corrected a small bug (using #FF in place of #FFh broke code compilation when base is not hex).

IP Calc v0.3

Corrected the calculation of number of hosts. Introduced rounding of expressions using LN or ^ to eliminate decimals. Added code to manage correct integer settings.

.zip  IPCalc-v03.zip (Size: 2.16 KB / Downloads: 80)

Massimo
from 34c to prime
Find all posts by this user
Quote this message in a reply
02-09-2014, 06:52 PM
Post: #2
RE: Simple IP Calculator
Massimo:

When I compile (enter/exit or Check) the IP Calculator program, I get a Syntax Error in line 30, in the R2L function call.

Odd, since it is declared above. Looking into it now, but thought I would give you feedback asap.

Thanks for the nice sample app.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
02-09-2014, 07:32 PM
Post: #3
RE: Simple IP Calculator
Quite odd findings.
This App actually runs fine on my actual device (rev 5447) but does not run on the Virtual Prime (VPrime) emulator (rev 5447). On the VPrime, I get error "Syntax error in program line 30" when leaving (and therefor compiling) the App, as noted above.

On the VPrime, when I edit the code and do a [Check], I get a Red-X Error: Syntax Error. Upon pressing Esc, the cursor is between the 2 and L in "R2L"

I have copied the working versions of the IP Calculator and TEXT apps from my device to the VPrime to be sure I am using identical versions, and still get the same inconsistent results noted above.

I will continue to poke at it, but not sure exactly where to look.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
02-09-2014, 11:06 PM (This post was last modified: 02-09-2014 11:08 PM by massimo.)
Post: #4
RE: Simple IP Calculator
(02-09-2014 07:32 PM)rprosperi Wrote:  This App actually runs fine on my actual device (rev 5447) but does not run on the Virtual Prime (VPrime) emulator (rev 5447). On the VPrime, I get error "Syntax error in program line 30" when leaving (and therefor compiling) the App, as noted above.

Have you tried to (re)compile the TEXT module before running the main program?

Are you using the last version (0.3)? In the previous versions there are some problems when the integers settings are different from hex, 32 bits and unsigned.

Massimo
from 34c to prime
Find all posts by this user
Quote this message in a reply
02-09-2014, 11:29 PM
Post: #5
RE: Simple IP Calculator
Yes, I am using version 0.3, the only version I've downloaded.

I did try to recompile the TEXT app, but it does not change the results.

I have explored it some, but still have no idea what could be causing this.

I assume it works fine on both device and emulator for you? Same fw version (5447)?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
02-10-2014, 12:50 AM
Post: #6
RE: Simple IP Calculator
(02-09-2014 11:29 PM)rprosperi Wrote:  I assume it works fine on both device and emulator for you? Same fw version (5447)?

Yes and yes.

Massimo
from 34c to prime
Find all posts by this user
Quote this message in a reply
02-10-2014, 04:05 PM
Post: #7
RE: Simple IP Calculator
When pasting from forums, sometimes the browser will stick in several varieties of "unicode" spaces that were not recognized in earlier versions as whitespace. Maybe something like that is happening?

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
02-11-2014, 12:11 AM
Post: #8
RE: Simple IP Calculator
The files were loaded by unzipping them directly to C:\Users\MyName\AppData\Roaming\HP_Prime, then opening the vPrime, going to the Program Catalog and encountering the issues when compiling. From the vPrime, I transferred them down to my device, which runs them OK. I then deleted them from the vPrime (from Program Catalog More... Delete), and uploaded from the device. Same problem.

Just now, with vPrime closed, I deleted the 2 .hpprgm files from C:\Users\MyName\AppData\Roaming\HP_Prime via Windows Explorer, then started the vPrime and again uploaded the programs from the same device and the problem is back, with Syntax error in the exact same place. I then downloaded the file back to the device and now the device gets the same syntax error in the same place.

Joe suggested I simply reset the vPrime and while I'm pretty sure that will resolve (or hide) the issue, there is definitely something weird going on.

Tim - Is there anything else you'd like me to try before I do the reset? Would the various files in the HP_Prime folder be of use for forensics?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
02-11-2014, 12:37 AM
Post: #9
RE: Simple IP Calculator
Update - it just got a bit weirder.
I opened the program in the editor on both the device and vPrime, to compare the files, and made no changes. On the device, after going to the bottom of the file, then hitting Esc, it exited w/o error. Then I went back into editor and hit Check and now have No errors in the program.

On the vPrime however the issue remains.

Seems like some kind of checksum issue?

I also just discovered that the IP Calculator program, obviously present in the vPrime Program Catalog, does not appear in the menu if I press Toolbox and tap on "User". I presume that since the program will not compile, the global name isn't valid, and therefore is not added into the User List?

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)