[WP34s] About the Perl tools


After the latest wp34s_asm.pl suddenly stopped working with my TinyPerl, I've done some trial-and-error changes to this Perl script, because I have no clue about the Perl language at all.

With this latest asm.pl I got an error message about "POSIX", so I looked for this name in the source and found a line "use POSIX;". Now after removing (or commenting out) this line, the assembler is working again with TinyPerl. :-)

Ok, after this experience I also tried to fix the preprocessor pp.pl, because this one has never worked for me. Here the problem is not "POSIX" but after a few compares I found that the line "use strict;" is the reason for the failure with TinyPerl, and after removing this line now also the preprocessor is finally working here for me.

Now the only remaining problem is the new library manager lib.pl:

After having also removed the "use POSIX" and "use strict" lines to avoid the first error messages, I still get an error when I try to run it: "ERROR: lib::split_END: Likely the assembler run failed. Halting lib."

Ok, looking at the source I saw that it calls the assembler script as subprocess (in the line 'my $DEFAULT_ASM = "wp34s_asm.pl";), and this can't work of course for me because I don't have a full Perl installed. So I tried to call TinyPerl instead by changing the line above to "my $DEFAULT_ASM = "tinyperl.exe wp34s_asm.pl";", but that didn't work but gave a new error message:

"ERROR: lib::run_prog: Cannot locate daughter script 'tinyperl.exe wp34s_asm.pl' in current directory or '.\'."

Well, I could imagine that my trial won't work, because certainly the Perl script lib.pl can only call a Perl script as daughter, but not an EXE file like TinyPerl.

But now I've no idea how I could solve this last problem, so that also the new libmanager would work here with my TinyPerl. Does any Perl expert here have any suggestions for me? ;-)


Edited: 19 Dec 2011, 7:53 a.m.


Sorry, I'm of not much help here because my Perl knowledge is as bad as yours. Congratulations that you got it working at all for you.

For the time being, the lib manager is far from working the way I'd like to see it. You can simply throw all your sources at the assembler and let it output a large file named wp34s-lib.dat. If it complains about maxsteps being exceeded you can patch the value in the op-code file. The maximum is then the same as maxlibsteps. I tried to do this in the asm script (the name of the variable is near the top of the script) as an intermediate measure until all is neatly working.

My latest commit fixes some serious issues with the software, so please update!


Thanks, that seems to be a good intermediate solution! :-)

The main problem without having a full Perl installation is currently calling a Perl sub-script from within another Perl script, and this is now even done twice: the assembler calls the preprocessor (if used with -pp), and now also the libmanager calls the assembler.

That's all quite a bit complicated IMO, and I hope this will be simplified in the future - I would really appreciate a single Perl script which can do ALL of these tasks: preprocess, assemble and put it together into a library file!

Edited: 19 Dec 2011, 10:17 a.m.


Question: why do you use TinyPerl and not the real one?


Question: why do you use TinyPerl and not the real one?

What's the "real" one?

If you mean ActivePerl then I have already answered your question here:




What's the "real" one?

If you mean ActivePerl then I have already answered your question

I found ActivePerl became way too fat and was non-standard in too many ways. Years ago I switched to strawberry perl -- strawberry is nothing more and nothing less than the normal perl sources compiled for windows. However I don't currently use windows very much so haven't tried it for 2-3 years now.


Looks like the current download is 40mb, previous version 34mb. Don't know how big it is installed.

Edit: Strawberry Perl and ActiveState Perl are the two windows builds linked on perl.org

Edited: 19 Dec 2011, 7:21 p.m.


I will quibble with the word "fix" in this post. As has been pointed out previously the "fix" is required in tinyperl as its parser -- and now apparently library/module set as well -- is broken and/or deficient. These scripts are designed for a compliant Perl v5.8+ environment -- which tinyperl is most definitely not.

In this specific case, the "use POSIX" allows use of the "ceil" function. Unless tinyperl already has knowledge of this function, your patched version will not be able to calculate some values. I am surprised that it doesn't crash with POSIX commented out except, knowing your history, you probably have not asked ASM to fire up the PP script (ie: did not use the "-pp" switch). If you are not running the PP from within the ASM, it is just possible that the line with the ceil function is never called and you might just survive. (Speculation)

Turning off "use strict" might be OK here because the ASM and PP scripts were already vetted under "strict" mode so there should be no issues. Turning it off in a normal/functional Perl environment is not usually a very good idea as it usually indicates that there are some latent issues you are trying to avoid. (LIB might still have it turned off because I am still tracking some issues.)

The "split_END" error is saying that the spawned assembler run from the LIB tool did not actually succeed. In your case, since you don't usually use the PP, you might be able to add the "-no_pp" switch to the LIB tool invocation to prevent it from running PP. No promises though. PP is on by default in the LIB tool.

The ASM script detects whether it is run from an EXE or Perl script and assumes that the daughter programs are of the same variety. You might be able to adjust what is called by the ASM by using the "-pp_script" switch to change it. I think in your case, it is not "path-aware" and cannot locate "tinyperl.exe" in the current directory. Try adding the complete path to the tinyperl.exe executable to the switch (or edit the default as you did) and see what happens. The equivalent switch does not (yet) exist in LIB so this trick will not work there. LIB is too new and has not really been released to the general public yet. It is in SVN but only showed up there last night for a look-see by the development team. It might go through some wicked gyrations before we are done.

A word of warning: The latest SVN assembler might not build correct images for the current V3 calculator -- at least until the calculator catches up to changes in the binary image specification. Marcus may have more to say on that shortly. Again, you might be in the middle of a development change.



No need to worry, the executables are up to date and collaborate with the modified format. (The emulator works with both old and new formats but since there are recent op-code changes, reassembly is mandatory.)


Thanks Neil, I'll try all your suggestions!

With all my work on your scripts I'm sure I'll become a Perl expert, too - anytime in the future. ;-)


Possibly Related Threads...
Thread Author Replies Views Last Post
  [HP-Prime xCAS] Review Polynomial Tools + BUGs + Request CompSystems 0 279 09-05-2013, 12:53 PM
Last Post: CompSystems
  [WP34S] WP34S firmware on the AT91SAM7L-STK dev kit? jerome ibanes 1 372 10-04-2012, 04:59 PM
Last Post: Paul Dale
  49/50 PC Development Tools Under Linux John R. Graham 1 272 04-24-2012, 03:06 PM
Last Post: Han
  [wp34s] Incomplete Gamma on the wp34s Les Wright 18 1,381 12-06-2011, 11:07 AM
Last Post: Namir
  [wp34s] Romberg Integration on the wp34s Les Wright 2 452 12-04-2011, 10:49 PM
Last Post: Les Wright
  Tools for exploring the 41cv? Peter Murphy (Livermore) 5 518 10-23-2011, 12:39 PM
Last Post: Marcus von Cube, Germany
  Programming tools for HP49g, HP50g Jose Gonzalez Divasson 9 729 06-14-2011, 10:32 AM
Last Post: Dave
  NutStudio tools goes RPN (HP-41) Håkan Thörngren 5 488 05-31-2011, 07:45 AM
Last Post: Håkan Thörngren
  Pre-built Windows version of NutStudio tools for HP-41 available Håkan Thörngren 5 483 04-23-2010, 02:30 PM
Last Post: PeterP
  New MCODE tools available for the HP-41 Håkan Thörngren 10 678 04-07-2010, 01:12 PM
Last Post: Håkan Thörngren

Forum Jump: