Business Basic Import #10
Replies: 6 comments
-
Import should be doable. Applesoft has some odd quirks where whitespace matters, e.g. Making the viewed text editable is both simple (don't set the "read only" flag on the text control) and complicated (need to integrate import, handle errors, etc.) But it would be nifty if it worked. :-) |
Beta Was this translation helpful? Give feedback.
-
I'm interested in looking at this - at least from the original CiderPress perspective, since that's the one I can build. So hopefully we can get the import engine running without too much difficulty; much of the infrastructure is already there (again, speaking for CP1) from the work on Business BASIC detokenization. |
Beta Was this translation helpful? Give feedback.
-
I'd be delighted to let you do all the work. :-) The nice thing about the CP2 implementation is that it's comparatively isolated, code-wise: https://github.com/fadden/CiderPress2/blob/main/FileConv/Code/ApplesoftImport.cs The original CP didn't have a general notion of an import converter, so the Applesoft importer is tied up in the MFC dialog definition: https://github.com/fadden/ciderpress/blob/master/app/BasicImport.cpp Building CP2 is easy on Win/Mac/Linux if you're good with the command line and don't mind installing a full copy of .NET. The included shell script should work on anything with a Bash-compatible shell. All import/export converters can be run from the command line, e.g. The CP2 tree also includes a place to put regression tests and test files, e.g. I exercise BAS import/export with this code and this file. Of course, this all assumes you're content to code in C#. If you want to work in C++, it might make sense to write it as a standalone command-line utility, which I can port, rather than trying to make it work in the original CP. If you want to make my life easy, prefer array indexing to pointer dereferencing. |
Beta Was this translation helpful? Give feedback.
-
I'm thinking I can put it in both generations, actually. Since there isn't an "input dialog" for CP1 to distinguish among BAS/INT/BA3, it probably just makes sense to have another menu dropdown specific to BA3. And then I can follow your pattern for how you implemented BAS importation code in CP2 to recode BA3 to C#. (Hey, I'm just one Stack Overflow question away from learning that, so no worries there.) |
Beta Was this translation helpful? Give feedback.
-
As an aside, the Business BASIC parser is available in source form here: |
Beta Was this translation helpful? Give feedback.
-
I've got some of the import working, but I also need to reconsider how token parsing works. Unlike Applesoft, Business BASIC did away with smashing tokens together (i.e. "10 PRINT BOBTOJANE" became "10 PRINT BOB TO JANE") and actually demanded you separate tokens by whitespace (also not alphanumerics). So we don't want to search for tokens using the same algorithm that Applesoft did, because that finds tokens in the middle of variable names, for example. Mostly this is working now, but tokens with trailing nonalnums such as "EXFN%." (yes, it includes the period) need some special consideration yet. |
Beta Was this translation helpful? Give feedback.
-
The /// needs some love! I was attempting to type out a BASIC listing, and was saddened by the fact that I couldn't do it in my IDE and then import it into my .dsk!
It would be great to be able to import a Business Basic file, like is possible with Applesoft Basic files.
(extra request: make the text viewer an editor so I can make changes right on the disk!)
Beta Was this translation helpful? Give feedback.
All reactions