No announcement yet.

Automatic PB/DOS > PB/CC Conversion

  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic PB/DOS > PB/CC Conversion

    To dream the impossible dream...

    Does anyone know about a source code conversion tool out there that does this? Has anyone written one in the past?

    I had a checklist of things it needed to do for the source code in my case:

    [_] Apply common headers, #INCLUDEs
    [_] Rework error trapping (no “(N)ext”)
    [_] INKEY$ is now WAITKEY$
    [_] Remove extended commas from LOCATE
    [_] Redo DEFs as FUNCTIONS or MACROS
    [_] Search for shell-style print routines (OPEN “LPT1”)
    [_] RUN or CHAIN becomes a SHELL():EXIT statement set
    [_] Remove $CPU, $DYNAMIC, and $SEGMENT
    [_] END or SYSTEM becomes EXIT FUNCTION
    [_] PRINT USING is now a PRINT USING$() function call
    [_] GET/PUT now includes UDT & assignment to local vars based on FIELD line
    [_] Remove all instances of FIELD
    [_] OPEN uses LEN(variable) instead of fixed record length number

    Hairy, I know. I was just wondering if there was anything out there - no harm in asking, right?


  • #2
    Hmm, that's not exactly 'recent' code is it? ...I haven't seen DEF in a <U>long</U> time...

    Can't help with automated tool (which I think are stone losers so I'd never suggest one anyway), but another "thing" is that there is no INPUT (from keyboard) statement in PB/CC. You need to use LINE INPUT, and if mutliple variables are accepted, parse them out.

    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]


    • #3
      The OPEN statement can use a numeric literal <U>or</U> an expression such as LEN(), SIZEOF(), etc.

      However, the old-style OPEN statement syntax OPEN <modestring>, #<filenum>, <filespec> [, <recsize> must be revised to the more modern syntax.

      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      mailto:[email protected]


      • #4
        That checklist is just what I specifically wanted/needed the converter to be able to do. It is really hard to expect anything like that though, just a thought. I have a LOT of 16-bit code, literally thousands of similar programs if you count all our systems we don't currently sell. Most of them will fade away into the bit bin because the cost associated with conversion would be prohibitive. I was just curious. With all the flexibilities of the BASIC syntax, it would be nightmarish to write a full-language converter.

        Thanks for the comments though!



        • #5
          Dear Chad:

          I have written, in PBCC, a CONVERT.BAS conversion
          program which translates QBasic (Quick BASIC) programs
          into PBCC code. It gets me about 90% of the way...must
          install some patches I've written for such things as
          SHELL "DIR *.TXT", RETURN 50000, VIEW PRINT, and other
          code not supported in PBCC. Would this be of any interest
          to you?

          Don't know how to send you the .ZIP file via this
          forum. Need instruction.





          • #6
            Chad, William's program sounds like the way to go.

            I've written some convertion programs like THEOS basic programs
            to QB. The idea is the same.

            Basically open the PBdos program and an output file.
            then check each line for known differences, write the code to the
            new file.

            Another alternative, though a little longer timewise.
            Use something like the dos editor and make global changes
            then save the updated file.

            Client Writeup for the CPA


            Links Page


            • #7
              Hi William,

              If you're Ok with it, I'd <U>love</U> to see your code conversion program!

              While there are no direct file uploading facilities here, you could either:
              • Zip and Email it directly to those requesting it, or,
              • Post the source code in the Source Code forum (don't forget to use the UBB [code] tags) , or,
              • Zip and email the code to mailto:[email protected][email protected]</A> and we'll see about hosting it in the FILES area. (Note that you'll need to include an appropriate distribution statement as to whether its freeware or public domain, etc).


              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              mailto:[email protected]


              • #8

                tom hanlin
                powerbasic staff