[WP34S] New GUI features
01-01-2016, 10:56 PM (This post was last modified: 01-03-2016 04:07 PM by Marcus von Cube.)
Post: #1
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
[WP34S] New GUI features
I've enhanced the classic Windows GUI application with new menu choices:
1. Reload State: Reload the current state file from disk in order to revert to the last saved state
2. Load State...: Access a different state file and make it current
3. Save State: Save the state to the current state file
4. Save State as...: Save the state to a new state file and make it current
5. Import Program...: Import a text (.wp34s) file with help of the assembler tool
6. Export Program...: Create a text (.wp34s) file from the current program

In addition, you can name the initial state file on the command line of wp34sgui.exe.

In order to use the text file import feature, edit wp34s.ini and add a line with the name of the assembler tool, e.g. ..\tools\wp34s_asm.pl (or .exe if you don't have Perl installed). The path may include spaces. The program file is compiled with the -pp switch set and the code is appended to program memory in RAM in the same way PRCL works. This way you can easily add any library program to the emulator. Be aware that this will add a new copy of the program with each import!

The export feature works without the tools. It exports the complete RAM if called while in program mode or, while in run mode, just the current program (which can be in the lib area).

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
01-02-2016, 11:26 AM (This post was last modified: 01-02-2016 12:28 PM by fhub.)
Post: #2
 fhub Member Posts: 172 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-01-2016 10:56 PM)Marcus von Cube Wrote:  I've enhanced the classic Windows GUI application with new menu choices:
Great new features, Marcus - many thanks!

There's only one small problem - importing only works when Perl is installed, i.e. when using wp34s_asm.pl as compiler.
I'm using wp34s_asm.exe instead (not the Perl version), and so I get an error message that ".pl is not associated with any program".

What I understand from your sources (in storage.c) it should try it again with wp34s_asm.exe (if wp34s_asm.pl fails), but it doesn't work - here's your code:
Code:
 while ( rc >= 2 && retry-- ) {   sprintf( buffer, "%s\\wp34s_asm%s -pp %s -o %s 1>%s 2>&1", Tools, ext, filename, tempname, logname );   rc = system( buffer );   ext = ".exe"; }
Since I'm no C-programmer I don't know what system(buffer) should return, but as I saw with a debugger it always returns 0 (even if the call to .pl fails), so the while-loop is not repeated with ".exe".

Of course I could solve the problem by patching the wp34sgui.exe, but I think it would be better to solve this problem in the sources (especially because I'm sure that most Windows users would rather use the EXE version of wp34s_asm than the PL version).

I guess the easiest fix would be to just swap the order of ".pl" and ".exe", i.e. first try assembling it with the EXE version, and if that fails then using the PL version.
A second method would be to first check if wp34s_asm.exe exists in the folder stated in wp34s.ini, and if yes then use it - if not then use the .pl version.
And a third method: the user could specify directly in wp34s.ini which assembler should be used, i.e. not only enter the folder but even the complete porgram, e.g. "..\tools\wp34s_asm.exe".
But my first suggestion (i.e. trying ".exe" first) is certainly the most simple way.

Edit:
I've now tried it with swapped ".exe" and ".pl", and now users which only have the PL version would have problems, because if the wp34s_asm.exe does NOT exist, the while-loop is also NOT repeated with ".pl".
So I guess it would indeed be the best to check for the existence of wp34s_asm.exe and wp34s_asm.pl, and use the one that in fact exists in the ..\tools folder.

Franz
01-02-2016, 12:26 PM
Post: #3
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
Franz,

that's what testing is for.

When I designed the config option I was thinking I would need more than a single tool. That's why only the path is used in the ini file. I think it's easiest to change it to the full name of the assembler. Running the exe in favor of the Perl file has a disadvantage if Perl is installed. I can't rebuild the exe file if I make changes to the Perl sources.

The next version will have a modified configuration. Stay tuned!

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
01-02-2016, 12:34 PM
Post: #4
 fhub Member Posts: 172 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 12:26 PM)Marcus von Cube Wrote:  When I designed the config option I was thinking I would need more than a single tool. That's why only the path is used in the ini file. I think it's easiest to change it to the full name of the assembler.
Yes, you may be right.
I've just added an edit to my last post, because my 1st method has the same problem for Perl users. So using the full assembler name is indeed the best way.
Quote:Running the exe in favor of the Perl file has a disadvantage if Perl is installed. I can't rebuild the exe file if I make changes to the Perl sources.
Well, that won't be a problem, because if the Perl sources are changed, then I'll certainly rebuild my own EXE versions immediately (which are much smaller than the official ones).

Franz
01-02-2016, 12:53 PM (This post was last modified: 01-02-2016 12:59 PM by Marcus von Cube.)
Post: #5
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 12:34 PM)fhub Wrote:  Well, that won't be a problem, because if the Perl sources are changed, then I'll certainly rebuild my own EXE versions immediately (which are much smaller than the official ones).
That's interesting! Can you post the details here?

I've uploaded a new version to SF. You have to name the assembler explicitly, e. g. ..\tools\wp34s_asm.exe or ..\tools\wp34s_asm.pl if you have Perl installed on your system.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
01-02-2016, 02:00 PM
Post: #6
 fhub Member Posts: 172 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 12:53 PM)Marcus von Cube Wrote:  That's interesting! Can you post the details here?
Well, I've uploaded my builds here a few weeks ago, see this post:
(the link to my WP34sTools is still working)
Maybe also the later post is interesting for you:
Quote:I've uploaded a new version to SF. You have to name the assembler explicitly, e. g. ..\tools\wp34s_asm.exe or ..\tools\wp34s_asm.pl if you have Perl installed on your system.
Yep, now it's working perfectly, thanks Marcus!

It even works with a batch-file where I can execute additional commands to remove temporary files created during the assembling process.

Franz
01-02-2016, 05:19 PM
Post: #7
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 02:00 PM)fhub Wrote:  Well, I've uploaded my builds here a few weeks ago, see this post:
(the link to my WP34sTools is still working)
I'd like to know what the steps are to rebuild the exe files from the Perl scripts.

(01-02-2016 02:00 PM)fhub Wrote:  Maybe also the later post is interesting for you:
I can't reproduce the error (and I can't find the lines you mention). I've tested both disassembly and assembly. Maybe I have a different version of the tools?

(01-02-2016 02:00 PM)fhub Wrote:  It even works with a batch-file where I can execute additional commands to remove temporary files created during the assembling process.
The latter is taken care of automatically by the latest build. So the batch file is only necessary if you want to keep the intermediate file from the preprocessor.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
01-02-2016, 06:25 PM
Post: #8
 fhub Member Posts: 172 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 05:19 PM)Marcus von Cube Wrote:  I'd like to know what the steps are to rebuild the exe files from the Perl scripts.
I'll explain it via PM later ...
Quote:I can't reproduce the error (and I can't find the lines you mention). I've tested both disassembly and assembly. Maybe I have a different version of the tools?
Maybe you have looked at the wrong file, the problem was not with the assembler but with the library manager (in wp34s_lib.pl) - just compare my attached version in the other thread with the original one and you'll see the difference (only the 2 lines 460 and 1072).
The original lib.pl only accepted labels with a quote at the end (e.g. LBL'A') as a new program, but not without quotes (like LBL A), so you couldn't compile programs which started with the labels A-D (with wp34s_lib.pl).
That's what I have changed in these 2 lines.

Franz
01-02-2016, 06:33 PM
Post: #9
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
Thanks for the clarification. It's not a bug that the library manager enforces an alpha label as the first instruction. If you create a program on the calculator and want to add it to the library the same restriction is enforced.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Post: #10
 BarryMead Senior Member Posts: 349 Joined: Feb 2014
RE: [WP34S] New GUI features
(01-02-2016 06:33 PM)Marcus von Cube Wrote:  Thanks for the clarification. It's not a bug that the library manager enforces an alpha label as the first instruction. If you create a program on the calculator and want to add it to the library the same restriction is enforced.

Marcus: Thanks for your hard work and the generous contribution of your valuable time to add these much needed and appreciated features. There is one point that I would like to make regarding the library manager (Bug/ Non Bug) you were discussing. Since the library manager is required to compile a working wp34s.dat state file there is NO WAY to compile a user created program that uses only non-quoted labels A-D. If he coded his program that way, and saved his program in the emulator and disassembled it, he would naturally think that he would be able to "Re-Assemble" it with the provided tools. But the "Library Manager" tool is required to compile this "NON-LIBRARY" individual program with only non-quoted labels into a wp34s.dat state file. So you wind up with a situation where a program can exist / be saved/ be disassembled into a source file, but have no way to "Re-assemble" the source code into a working program. (Unless you change the LBL A to a LBL 'A' before assembling.) If you are thinking of the "Library Manger" as a tool to manage "Libraries" only, then this limitation makes sense. But if you widen your perspective to include the fact that the "Library Manager" is required to compile even small single programs into wp34s.dat loadable state files, then the limitation of quoted only labels seems more like a bug. The bare-bones assembler is not capable of generating operational state files that can be loaded into the memory of the emulator/calculator. The "Library Manager" is required to perform this task.
I hope this clears up any confusion on this issue, Thanks Barry
01-02-2016, 07:18 PM
Post: #11
 fhub Member Posts: 172 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 06:54 PM)BarryMead Wrote:  ... but have no way to "Re-assemble" the source code into a working program. (Unless you change the LBL A to a LBL 'A' before assembling.)
Barry, didn't you try my small modification of the wp34s_lib.pl which I've posted in the other thread???
With these 2 changed lines the library manager exactly does what you want, i.e. it also compiles labels like LBL A.

Franz
Post: #12
 BarryMead Senior Member Posts: 349 Joined: Feb 2014
RE: [WP34S] New GUI features
(01-02-2016 07:18 PM)fhub Wrote:
(01-02-2016 06:54 PM)BarryMead Wrote:  ... but have no way to "Re-assemble" the source code into a working program. (Unless you change the LBL A to a LBL 'A' before assembling.)
Barry, didn't you try my small modification of the wp34s_lib.pl which I've posted in the other thread???
With these 2 changed lines the library manager exactly does what you want, i.e. it also compiles labels like LBL A.

Franz

I did try it, and I agree that it fixes the issue. I just wanted to be sure that Marcus understood that there was a good reason why you changed it. I have a copy of your modified wp34s_lib.pl program, but the last time I checked this modified version was not included in the official SVN tree?
01-02-2016, 08:26 PM
Post: #13
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
Things are becoming clearer now. Requiring the library manager to compile code into a state file was Neils decision which I have to accept. I'll check Franz' modifications. Maybe they can be refined to enforce the global label restriction in flash library mode only.

BTW, the import option of the emulator just uses the assembler which does not have this problem.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Post: #14
 BarryMead Senior Member Posts: 349 Joined: Feb 2014
RE: [WP34S] New GUI features
(01-01-2016 10:56 PM)Marcus von Cube Wrote:  In order to use the text file import feature, edit wp34s.ini and add a line with the name of the assembler tool, e.g. ..\tools\wp34s_asm.pl (or .exe if you don't have Perl installed). The path may include spaces. The program file is compiled with the -pp switch set and the code is appended to program memory in RAM in the same way PRCL works. This way you can easily add any library program to the emulator. Be aware that this will add a new copy of the program with each import!
Marcus: Where is this wp34s.ini file located? (Where should it be located?) I searched the entire SVN tree and could not find a file by this name?
01-02-2016, 08:56 PM
Post: #15
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
Quote:Marcus: Where is this wp34s.ini file located? (Where should it be located?) I searched the entire SVN tree and could not find a file by this name?
The same place where the wp34s-lib.dat is located, i. e. the current directory. It should look like this:

COM1 # COM port
..\tools\wp34s_asm.pl # Assembler

Modify the second line according to your installation.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Post: #16
 BarryMead Senior Member Posts: 349 Joined: Feb 2014
RE: [WP34S] New GUI features
(01-02-2016 08:56 PM)Marcus von Cube Wrote:
Quote:Marcus: Where is this wp34s.ini file located? (Where should it be located?) I searched the entire SVN tree and could not find a file by this name?
The same place where the wp34s-lib.dat is located, i. e. the current directory. It should look like this:

COM1 # COM port
..\tools\wp34s_asm.pl # Assembler

Modify the second line according to your installation.

Let me ask a more specific question. When I run the emulator under wine on a linux system, I cannot find any location on my entire computer that creates or uses a file named "wp34s.ini". I can find copies of the wp34s-lib.dat file in several places including: basedir/trunk/windows/bin/ , basedir/trunk/windows/wp34sgui/ , basedir/library/

Where would one expect to find this wp34s.ini file on a linux system running the emulator under wine?
Since the emuator itself is running under wine, would one be able to call windows, or Linux compatible executables from inside a windows emulation program? I was able to create an ini file that
references the wp34s_asm.pl or wp34s_asm.exe files, but that still didn't work, because either one expects to find a windows native perl library that will not exist on a Linux system.
01-02-2016, 09:31 PM
Post: #17
 pascal_meheut Member Posts: 124 Joined: Dec 2013
RE: [WP34S] New GUI features
If you are willing to wait a while, the Qt emulator will support the same functions without the need for a wp34s.ini.
Post: #18
 BarryMead Senior Member Posts: 349 Joined: Feb 2014
RE: [WP34S] New GUI features
(01-02-2016 09:31 PM)pascal_meheut Wrote:  If you are willing to wait a while, the Qt emulator will support the same functions without the need for a wp34s.ini.
I think that is the only option. The windows emulation throws a monkey wrench into the whole running perl or compiled perl script thing. I was able to create an ini file in the trunk/windows/bin directory, and it did find the ../../trunk/wp34s_asm.pl or exe file, but could not run because of missing windows native perl dll libraries. With the QT version compiled in native linux I would not run into the problem of some programs running under emulation and others not. Thanks Pascal, I look forward to your next release with hope and anticipation.
01-02-2016, 09:55 PM
Post: #19
 Marcus von Cube Senior Member Posts: 745 Joined: Dec 2013
RE: [WP34S] New GUI features
Barry,

I don't use Wine and thus haven't run into your problem. I'm glad that Pascal is coming to the rescue.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
01-02-2016, 10:00 PM
Post: #20
 Dieter Senior Member Posts: 1,608 Joined: Dec 2013
RE: [WP34S] New GUI features
(01-02-2016 09:19 PM)BarryMead Wrote:  Let me ask a more specific question. When I run the emulator under wine on a linux system, I cannot find any location on my entire computer that creates or uses a file named "wp34s.ini".

The .ini file was only used for transferring programs and data between the emulator and "the real thing". On my Windows system this file is located in the "emulator" directory that also contains wp34s.exe and wp34sgui.exe. The .ini file consists of one single line, in my case a simple "COM1:" as this is the port which is used for the respective WP34s SEND and RECV commands for data transfer.

If until now you did not transfer data between emulator and a physical WP34s (using the dedicated data cable) there was no need for a wp34s.ini file. Just create one (a simple text file) in the wp34sgui.exe directory (usually named "emulator") and place the path to the assembler there.

I'm not sure if you already knew all this before, so please excuse me if I didn't get you right. ;-)

Dieter
 « Next Oldest | Next Newest »

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