HP Forums
Simple IP Calculator - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Simple IP Calculator (/thread-637.html)



Simple IP Calculator - massimo - 02-08-2014 01:05 PM

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.
[attachment=259]


RE: Simple IP Calculator - rprosperi - 02-09-2014 06:52 PM

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.


RE: Simple IP Calculator - rprosperi - 02-09-2014 07:32 PM

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.


RE: Simple IP Calculator - massimo - 02-09-2014 11:06 PM

(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.


RE: Simple IP Calculator - rprosperi - 02-09-2014 11:29 PM

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)?


RE: Simple IP Calculator - massimo - 02-10-2014 12:50 AM

(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.


RE: Simple IP Calculator - Tim Wessman - 02-10-2014 04:05 PM

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?


RE: Simple IP Calculator - rprosperi - 02-11-2014 12:11 AM

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?


RE: Simple IP Calculator - rprosperi - 02-11-2014 12:37 AM

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?