Thread: Converting MINI-BASIC in MASM over to C++?

  1. #181
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "OK, I've updated the credits. One last question, though: should I include the original MiniBasic creator (I think he has a Japanese name - I'll look it up)?"

    Well, as far as I am concerned, you may give credit to all you wish. That said, the original assembler we are working from was an just an assembler project based on a "how to" document project implementing this dialect which is based on an old BASIC distribution for small machines which is itself based on a distribution for the old Apple computers. My point is, where exactly would you stop?

    (This is what I found out when I tried to find a better existing implementation to work from than the horribly confusing assembler you guys translated.)

    Edit: And of course, this is the age of the "wiki-people"; there is no telling how wrong the information I found may be...

    Soma

  2. #182
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Soma, the design looks good. Let me know if you want me to post the IO code I have (for reference, if nothing else).
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  3. #183
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Yes. Please. The less we duplicate each others work the better. (Like you I had been using C++ streams for testing purposes.)

    Soma

  4. #184
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by phantomotap
    No, but the only reason we have so many licenses is that no one bothers to understand the existing ones well enough. You really only need GPL, the GPL offspring, and Apache for %99.9 of all projects.
    It is not so simple, considering that lawyers disagree on how the various licenses would be interpreted in a court of law in various jurisdictions. Personally, I would choose OSL and AFL over the LGPL and Apache license respectively as I am convinced by Lawrence Rosen's arguments, but the FSF has been sprouting license FUD against those two licenses for some time now.

    Quote Originally Posted by phantomotap
    What I mean to say is, I'll be more inclined to favor this little project if it is released under the GPL. As for the "v3", that's just a habit; I prefer the GPLv3, but any one would make me happy.
    Right

    Quote Originally Posted by Sebastiani
    OK, so before everyonce gets started writing more code, let me just post a final revision so that there won't be any duplication of effort. We can break everything down into modules and work on them individually.
    I think that using the appropriate tools is even more important now, e.g., automated merging of the different parts so that you can more readily integrate them instead of merging them by hand.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #185
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Alright, well here's the IO code. It's truly a mess, but I'm pretty sure that it works (well, mostly anyway ).

    >> I think that using the appropriate tools is even more important now, e.g., automated merging of the different parts so that you can more readily integrate them instead of merging them by hand.

    I'm divided. On the one hand, that seems like a great idea, on the other, it does just add yet another complication...
    Last edited by Sebastiani; 04-12-2009 at 03:17 AM.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  6. #186
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "It is not so simple, considering [...] licenses for some time now."

    Edit: Congratulations must be offered to the few who had time to read my eight page thesis. Now I offer only this: "FUD" is the crime you commit when you choose to infer the machinations of one party in support of another. We need real victories or real defeat; we will celebrate of learn as appropriate. To this end, we need to eliminate most of the countless software licenses so we can develop a history from which we may succeed or fail.

    [Edit]
    "Alright, well here's the IO code."

    I'll take a look at it in a few moments. My stomachache demands my full and undivided attention... now if only I could say that about my girlfriend. ;_;
    [/Edit]

    Soma

  7. #187
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ok, I'm supposed to be at a Easter Dinner at mother-in-law's in a bout 1 minute... But I'm sure they don't mind me being a little bit late. I haven't had any time to

    I think Laserlight makes a good point on the "merging source" situation.

    So has anyone else have experience with Mercurial?
    Mercurial - Mercurial

    It works on multiple platforms - which is a good thing.

    It is distributed and allows us all to have our own copy, and submit changes to the master code line as we see fit.

    I'm sure CVS and GIT does the same thing, and several others.

    So if we choose mercurial, would anyone else object very much?
    If we wanted to use mercurial, our project could live on Mercurial hosting &mdash; bitbucket.org

    I picked mercurial because I have used it before, and bitbucket because it came up first in google...

    Any constructive advice welcome.

    --
    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.

  8. #188
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "I think Laserlight makes a good point on the "merging source" situation."

    You remember a few pages back when I said "I have something I want to discuss with you two."? I wanted to discuss these very things--the license, VCS, and server.

    "So has anyone else have experience with Mercurial?"

    I have no experience with Mercurial, but I've heard enough about it that I've read the tutorial and contemplated a toy repository. So, yea, Mercurial gets my vote.

    "It is distributed and allows [...] to the master code line as we see fit."

    And according to what I've heard, you can arbitrarily create forks for attempting major revisions and automatically merge these changes to root or toss them as appropriate. This makes me salivate... it makes me tingle. ^_^;

    As for the server, I've never had anything to do with BitBucket so I can't say anything about them. I've helped with projects on BerliOS and they were great. I've hosted projects on SourceForge, but I can't recommend it. I'd say BerliOS gets my vote, but I'm fine with anything free!

    The GPLv3 is obviously my license of choice.

    "So if we choose mercurial, would anyone else object very much?"

    I don't see why they should. Many, maybe even all, of the open source project servers I've seen with Mercurial support have either nightly snapshots, generative snapshots on demand, or some combination of the two.

    Or was this just targeted at me and Sebastiani?! O_o

    "I'm sure CVS and GIT does the same thing, and several others."

    Unless the modern CVS has greatly improved it isn't half what Mercurial is... I don't want to offend anyone, but I flat out refuse to use CVS. I'll still help. I'll post source at the project forum/list or something.

    Edit: And I hate to bring this up, I truly do, but what about the build system? Apparently one of you, or the other, has MSVC installed which targets Windows nicely, but what about other platforms? (I have the compiler from 2005 installed, but not the IDE and companions.) I like the "autotools" build system almost as much as I like being kicked in the crotch.

    Soma

  9. #189
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Right, my "anyone object" meant those who are currently actively working on this project - anyone else is free to comment, but the weight of their comments would be near zero (although if someone suggest "bitbucket has rubbish stability, use butbicket instead", then that would be something I'd take into account).

    Build environment: We probably do NEED to think about that. I'm happy using a generic makefile. I'm not too keen on other "make" replacements.

    The project should (in reasonable foreseeable future) stay small enough to manage in a single, small makefile with a few configuration options. I think, to begin with, I'd say we ONLY target Windows. Further OS's can be a future thing [we certainly should DESIGN TO SUPPORT OTHERS, but not necessarily implement that right now].

    Horror moment: I can see how this will derail and we spend all our time discussing the solution to things that don't really matter right now (or will ever), instead of actually doing some work!

    --
    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.

  10. #190
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "I'm happy using a generic makefile."

    Relief! Joy!

    One down... and one to go...

    Soma

  11. #191
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by matsp
    It works on multiple platforms - which is a good thing.

    It is distributed and allows us all to have our own copy, and submit changes to the master code line as we see fit.

    I'm sure CVS and GIT does the same thing, and several others.
    CVS is not distributed, and Git's Windows support is still relatively weak.

    Quote Originally Posted by matsp
    If we wanted to use mercurial, our project could live on Mercurial hosting &mdash; bitbucket.org

    I picked mercurial because I have used it before, and bitbucket because it came up first in google...
    Naturally, I would suggest Bazaar and Launchpad instead, but nah, Mercurial and Bitbucket should be fine for your purposes.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #192
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "Naturally, I would suggest Bazaar and Launchpad instead, but nah, Mercurial and Bitbucket should be fine for your purposes."

    Shut Up! I'm excited to try Mercurial; don't stick your nose where I don't want it!

    Anyway, more seriously, I've been playing with the `terminal' interface and Windows implementation.

    Now, as I've imagined it, I'm having a problem with the echo stuff. I can't manage it in context without employing threads and locking. As it is, this part is or will be a huge time sink. So, I have made a few changes to the way the `terminal' abstraction handles a few things.

    To this end I'm altering the interface I posted dramatically. Currently it uses a `std::uint32_t' for both the foreground and the background. (Which I was intending to use as a full RGBA component.) I'm now proposing we [S]steal[/S] borrow the implementation mechanic from most of the decent text editors. I figure, just use a `std::uint8_t' and associate that value with the particulars of the font, both the foreground and the background, behind the abstraction for whatever the library particulars may demand. (This is similar to what Windows does internally for the console.) Believe it or not, this gave a rather large performance boost. (Granted, anything dropping a WIN32API "mutex" would probably be an improvement.)

    Fortunately, the IO code posted by Sebastiani introduced me to an API I have never considered. I think I'll be able to simplify the implementation a bit more and further improve the abstraction so that anything built on top of the abstraction can more easily implement the line editor stuff we need.

    Also, I think I've nailed the last of the startup/cleanup code needed for the console window. You can change the size, the title, dump random text to the screen, and the cleanup restores everything to exactly what it was before it was started without polluting the memory with unused structures. I'm not positive, and I'm not sure why I had so much trouble with this, but I thing I've got it. Regarding this, I'd say, on exit, after we restore everything, we dump the license, copyright, the version, notices, and maybe a "thank you" or something to `std::cout' leaving some indication of what has transpired in the window--assuming we aren't responsible for destroying the window.

    I have some notes I'd like to ask you about your VM Sebastiani, but I've finally gotten tired enough I thing maybe I will not have nightmares... I'll post when I wake up.

    Soma

  13. #193
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by laserlight View Post
    Naturally, I would suggest Bazaar and Launchpad instead, but
    nah, Mercurial and Bitbucket should be fine for your purposes.
    Of course, you WOULD say that. Do you have shares in Bazaar or something?

    I take that as an approval of the idea!

    I will try to set something up in the next couple of days.

    --
    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.

  14. #194
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Yep, Mercurial looks good. I'm looking through the quickstart now.

    >> I'm not positive, and I'm not sure why I had so much trouble with this, but I thing I've got it.

    Yeah, that's pretty much how the Windows API operates; if you don't do something "just so" things tend not to work at all.

    >> what about the build system?

    I would prefer to use GNU make, if possible. I typically use gcc or cygwin, and I don't even have MSVC at home (and would rather not install the behemoth, come to think of it!).
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  15. #195
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I have set up a bitbucket account.
    matsp / minibasic / overview &mdash; bitbucket.org

    I also put up MY current version of the code. I have no idea if that version actually works or not - it is the same as what I posted a few days ago after doing a bit of file-splitting and such (as memory has it, it compiles and can execute simple programs).

    I have no idea if I can allow others to submit code - maybe you can sign up for an account and try to just add a new file.

    Some thoughts on how to continue (aside from the ongoing bits that we already have going):
    1. Whenever you think the code is OK to publish, feel free to put it in there.
    2. We probably need some test-code - to start with an .mbi file that does something.
    3. Example programs?

    --
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting textBox1->Text into a basic string.
    By azjherben in forum C++ Programming
    Replies: 5
    Last Post: 06-07-2009, 08:27 PM
  2. [ANN] New script engine (Basic sintax)
    By MKTMK in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2005, 10:28 AM
  3. what are your thoughts on visual basic?
    By orion- in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-22-2005, 04:28 AM
  4. VC++ 6 & MASM (eek)
    By cboard_member in forum C++ Programming
    Replies: 2
    Last Post: 07-16-2005, 10:00 AM