To allow the console to be selected at runtime, I have un-singleton'd it.
--
Mats
To allow the console to be selected at runtime, I have un-singleton'd it.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I've submitted a few updates.
Some small bug-fixes, such as entering just a line-number should REMOVE that line, not end up with a line with just a number on it.
Loading a text file with an empty line in it would end the loading, whcih I don't think is what it should do.
There is a bug when loading text BASIC files by the way. Since the same scanner object is used for both reading the load command, and for inputting the text from the file, when we get back to the command loop, it fails the "scanner.empty()" check by an assert in the STL implementation (In VS 2008 Express Edition at least). I think it is because the string that is used for the input to scanner is "gone".
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I'm pushing another refactoring, splitting out the functionality to run, list, load, save etc into separate functions. I will make it table-driven in a bit.
I have found a difference between the original minibasic and our implementation:
doing "list 1000" will list line 1000 only in our implementation. In the original code, it lists FROM line 1000.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I just took a few minutes to look through the changes and make a few notes.
1): Is the intent of `string awkward_save_helper()' to save with any file extension? If not, the `string awkward_save_helper()' implementation really should use something like `bool ends_with(string const&, string const&);' because most file systems and operating systems in use these days support internal '.' characters. If so, `void load(string name)' should probably drop the implied ".MBI" extension. (If both "test.123" and "text.123.mbi" is in the same directory "LOAD test.123" can't be interpreted as a potentially mistyped "text.123" with the implied extension.)
2): What is "direct.h" used for?! O_o
3): After finally realizing the problem I had with extending the virtual character codes, do you think it is time to make a couple of conversion tables so we can get the bigger bang for our precious bits?
4): Did you ever do anymore work with variable names?
Soma
How are things going?
Paul
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Indeed, I was just doing some more work on that bit of code, and I was thinking exactly the same thing. And I think we should have different defaults for different types of files - e.g. TSAVE should save as test.bas, where SAVE saves as MBI - not quite sure what BSAVE should use.
Apparently not needed - I just commented it out and it still compiles just fine. I will remove it.2): What is "direct.h" used for?! O_o
I'm quite a fan of table-driven programming, so yes.3): After finally realizing the problem I had with extending the virtual character codes, do you think it is time to make a couple of conversion tables so we can get the bigger bang for our precious bits?
Not really - I decided to do some more refactoring first, and haven't got back onto it.
4): Did you ever do anymore work with variable names?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
"not quite sure what BSAVE should use"
".MBB"?
"I'm quite a fan of table-driven programming, so yes."
O_o
"I decided to do some more refactoring first, and haven't got back onto it."
I was thinking around hooking that implementation to virtual character codes. (So that a non-windows implementation wouldn't have to stick with whatever extended keys may be used.)
Soma
Sounds good to me. I will work on that on the way home tonight. Should be doable if I don't get too sleepy on the train! [The advantage of sitting on a train for about 90 minutes each day is that small projects like this gets done pretty neatly].
On the way here, I moved the long "if token == RUN ... else if token == LIST ... " into a table with function pointers.
Not quite sure how those things are related... Maybe what you were asking had nothing to do with what I was replying to - my reply was referring to making long variable names and allowing multiple arrays. Which makes little sense to your follow on point. So perhaps we can clear up what the original question was meant to be...
"I decided to do some more refactoring first, and haven't got back onto it."
I was thinking around hooking that implementation to virtual character codes. (So that a non-windows implementation wouldn't have to stick with whatever extended keys may be used.)
Soma
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
"So perhaps we can clear up what the original question was meant to be..."
You answered the question I asked. ^_^
In other words, instead of checking against `17942' in the "MBI" source, you'd check against `CC_APPLE' without ever implying that this was syntactic magic for `17942'. (The same as, say, loading the value 13 into `@(2000)' by default and having users check against that instead of 13.)
Soma
I've submitted code to fix up the extension - at least in the basic cases. We probably need a better method, really. But at least we get appropriate names for the respective files.
Also submitted the table-driven parser of run, list, save etc.
And I FINALLY fixed the "load test.bas" causes an error!! I had to make a stack of the scanner, which isn't very good solution, but it's better than an error.
I also fixed the BSAVE command - it was broken if you just load a file and save again, because there was no compiled code. I just added a recompile.
I also shuffled a bit of code around, as per usual
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Paul,
Can you get the latest code from
matsp / minibasic / downloads — bitbucket.org
and give it a whirl. If something isn't working right, please let us know. If it IS working, please let us know that too.
If you know someone else who wishes to try it out as well, please feel free to point them towards the link above.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Would anyone object to putting #ifdef _DEBUG around debugging code? A quick hack in interpreter.cpp shows that it's saving about 8KB there alone.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I made another bit of code-clean-up - got about 30KB less code by re-arranging a bunch of things. [That's gcc-code, which I feel is quite bulky - mostly to handle exceptions].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Sounds good. Looks good, too.
Paul