HP-42S / Free42 Extension for Visual Studio Code - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: Not HP Calculators (/forum-7.html) +--- Forum: Not quite HP Calculators - but related (/forum-8.html) +--- Thread: HP-42S / Free42 Extension for Visual Studio Code (/thread-11743.html) Pages: 1 2 |
HP-42S / Free42 Extension for Visual Studio Code - Thomas Okken - 11-04-2018 04:14 PM An Extension for editing HP-42S / Free42 code in Visual Studio Code has been made available in the Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=JHeilingbrunner.vscode-hp42s-free42 I haven't tried it myself, but the previews look promising. Written by Jochen Heilingbrunner; requires VSC 1.27 or later; free download. RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-04-2018 08:08 PM Quote:Please welcome our newest member, Heilingbrunner RE: HP-42S / Free42 Extension for Visual Studio Code - tcab - 11-04-2018 10:47 PM This looks great! The extension appears and installs ok in my Visual Studio Code (the free editor) on my Mac but I'm not getting the promised behaviours. I've tried both *.hp42 and *.free42 file extensions but only the latter does any syntax highlighting at all, but not the fancy HP42 syntax completion. And the formatting menu is not appearing either. I've tried restarting visual studio code. Has anyone gotten this working? RE: HP-42S / Free42 Extension for Visual Studio Code - Sylvain Cote - 11-04-2018 11:33 PM Tried it on Visual Studio Code (1.28.2) over macOS High Sierra (10.13.6). Installation, color coding, syntax completion & formatting works perfectly. I am not able to encode or decode the program, I do not see the options in any menu or contextual menu. I have read the how-to, but it is not clear for me how you do it and unfortunately the screen capture is in German. Some help will be appreciated, thank you! Sylvain RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-05-2018 12:24 AM (11-04-2018 10:47 PM)tcab Wrote: I've tried both *.hp42 and *.free42 file extensions but only the latter does any syntax highlighting at allThe suffix .hp42s works for me. Quote:And the formatting menu is not appearing either. Try: right click Format Document ⌥ ⇧ F (11-04-2018 11:33 PM)Sylvain Cote Wrote: I am not able to encode or decode the program, I do not see the options in any menu or contextual menu. Try: right click Command Palette… ⇧ ⌘ P Start typing: encode code The following should show up: hp42s/free42: Encode Code HTH Thomas RE: HP-42S / Free42 Extension for Visual Studio Code - tcab - 11-05-2018 01:20 AM @Thomas - thanks for those tips. Indeed it looks like the file extension has to be .hp42s not .hp42 (looks like a typo in the plugin documentation). Raw exporting works in the way you say, too. Formatting works and strips line numbers etc. It would be nice, I think, to have a command to add line numbers back. I remember, in the past, I had trouble pasting RPN code into Free42 unless it had line numbers - even if all the line numbers were 00. Though... I just tried again without line numbers and things pasted ok into Free42. Hmm. RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-05-2018 06:05 AM (11-05-2018 01:20 AM)tcab Wrote: It would be nice, I think, to have a command to add line numbers back. This command inserts line numbers to the files: Code: perl -i~ -ne 'printf "%02d $_", $.' <files ...> The original files are renamed to contain a tilde (~) as suffix. This can be changed of course. See perl -h: Code: -i[extension] edit <> files in place (makes backup if extension supplied) If you use that command often you can make it a function and add it e.g. to your ~/.bash_profile: Code: function add_line_numbers () Use %03d instead of %02d if you prefer 3-digit numbers. Cheers Thomas RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Okken - 11-05-2018 10:04 AM (11-05-2018 01:20 AM)tcab Wrote: It would be nice, I think, to have a command to add line numbers back. I remember, in the past, I had trouble pasting RPN code into Free42 unless it had line numbers - even if all the line numbers were 00. Though... I just tried again without line numbers and things pasted ok into Free42. Hmm. That was fixed earlier this year: Quote:2018-01-07: release 2.0.10 RE: HP-42S / Free42 Extension for Visual Studio Code - Sylvain Cote - 11-05-2018 10:52 AM Thanks Thomas, Perl call from command line and from .profile worked, same thing for Palette / encode code. It does not seems to, but does it have a way to decode a hex or raw file ? Best regards, Sylvain RE: HP-42S / Free42 Extension for Visual Studio Code - Heilingbrunner - 11-05-2018 01:01 PM Hello Everybody, i am happy to see you tried my extension. I had thought about decoding raw code to text back again, but i think the most use case is encoding from code to raw format. Jochen RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-05-2018 01:08 PM (11-05-2018 10:52 AM)Sylvain Cote Wrote: It does not seems to, but does it have a way to decode a hex or raw file ? I don't think so. But you can use this online decoder. Cheers Thomas RE: HP-42S / Free42 Extension for Visual Studio Code - Heilingbrunner - 11-07-2018 09:23 AM I have two questions: 1. Why do we need line numbers in the code ? The VSC editor already shows line numbers. 2. Why is the last ending END command ignored in the { <size>-Byte Prgm } display, but the raw file has three byte more ? RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-07-2018 04:41 PM (11-07-2018 09:23 AM)Heilingbrunner Wrote: Why do we need line numbers in the code ? While editing a file in vscode I don't care about line numbers. The same holds if I load a .raw file into an emulator. However when I enter a program manually into a real calculator it helps to have line numbers. If I miss a command it helps to find the error. Quote:The VSC editor already shows line numbers. True. But when the x-Byte Prgm line is generated it is off by one. HP-42S Code: 00 { 20-Byte Prgm } Visual Studio Code Code: 1 { 23-Byte Prgm } Cheers Thomas RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Okken - 11-07-2018 05:21 PM (11-07-2018 09:23 AM)Heilingbrunner Wrote: Why is the last ending END command ignored in the { <size>-Byte Prgm } display That's what the real HP-42S does. It is strange, since the END is, in fact, a part of the program... but that's the way it is. RE: HP-42S / Free42 Extension for Visual Studio Code - Heilingbrunner - 11-07-2018 09:52 PM Ok, i will add a command for the line numbers. RE: HP-42S / Free42 Extension for Visual Studio Code - Heilingbrunner - 11-09-2018 09:24 AM Hi, in version 0.0.4, i improved the document formatter. It inserts/refreshes the line numbers. The encoder although detects wrong line numbers. Regards. RE: HP-42S / Free42 Extension for Visual Studio Code - Dieter - 11-11-2018 09:01 AM (11-05-2018 01:01 PM)Heilingbrunner Wrote: I had thought about decoding raw code to text back again, but i think the most use case is encoding from code to raw format. I can't say much about the 42s and Free42 in this regard, but for the HP-41 I use hp41uc (Leo Duran's HP41 user code compiler/decompiler) in both ways. Raw files are great for transferring programs or saving/loading programs for use with an emulator, e.g. Warren Furlow's V41. But I also like the decompiler option very much, as it generates nice program listings. Which can be posted here, for instance. There are even several formatting options. Dieter RE: HP-42S / Free42 Extension for Visual Studio Code - Heilingbrunner - 11-16-2018 11:18 PM Hi, i read the suggestions and made some changes. Now the extension supports multi programs in a *hp42s/*free42 file. The formatter and encoder will update the line numbers and program sizes as required for manual input on a original HP-42S (tcab). The program size calculation behaves as the original. The next feature will be the decoder. But this will take some time. Hope you can use it. [attachment=6599] Regards. RE: HP-42S / Free42 Extension for Visual Studio Code - Thomas Klemm - 11-17-2018 09:54 PM Thanks for the update. However I noticed a weird behaviour when an error occurs during encoding. Code: LBL "TOO-LONG-FOR-A-LABEL" Encode this to get: Code: 00 { Error [1, 01]: Code: 'LBL "TOO-LONG-FOR-A-LABEL"'; Message: 'line number not correct' } Correct the label: Code: 00 { Error [1, 01]: Code: 'LBL "TOO-LONG-FOR-A-LABEL"'; Message: 'line number not correct' } Encode again to get: Code: 00 { 1-Byte Prgm } Format to get some strange line numbering: Code: 01 00 { 1-Byte Prgm } Is there an easier way to remove line numbers instead of using ⇧ ⌥ ⌘ with cursors to select a block and delete it? Kind regards Thomas RE: HP-42S / Free42 Extension for Visual Studio Code - Heilingbrunner - 11-18-2018 07:58 AM Sorry, for that bug. My asumption was that a program starts with a 'LBL "NAME"'. Now the extension will detect a program with a '{}' line, which will be filled with a error message or the program size. [attachment=6604] In Visual Studio Code block editing is possible. A good introduction can be found at the Visual Studio Code documentation. |