Announcement

Collapse
No announcement yet.

Convert QB to PowerBASIC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Convert QB to PowerBASIC

    I'm about to convert 50,000 lines of QB/PDS-code (spread over 500 files) into PB-code. Now I'm looking for a neat utility to help me through. I expect at least the following conversions to occur:
    1. replace . (period) in variable names to _ (underscore)
    2. prefixing name of constants with % or $ (number or string)
    3. substitute 'common shared' by 'global'
    4. differentiate variable names like x$ and x&
    5. substitute $include:'x' by #include "x"
    6. adding FUNCTION PBMAIN and END FUNCTION
    7. substitute USING "x";y by USING$("x",y)
    Which utility can be advised ?
    Last edited by Peter JG de Jong; 26 Oct 2007, 01:55 PM. Reason: misspelling

  • #2
    There's at least one in here:


    http://www.powerbasic.com/support/do.../utilities.htm

    Comment


    • #3
      QB2PBv2

      The only utility from http://www.powerbasic.com/support/do.../utilities.htm that seems to qualify is QB2PBv2, but it does a bad job for me. It removes code close to line continuation characters (_) e.g.:
      if nul.ix = srt _
      or tel.ix = srt _
      or naa.ix = srt then
      is translated to:
      if nul.ix = srtor naa.ix = srt th
      So QB2PB is not aware that line continuation characters don't require conversion and above that proper code disappears ! From lines without a continuation character the last character sometimes disappears as well. E.g:

      X=1
      gets translated to:
      X=
      which is apparently wrong.

      From the list of 7 in my previous append the only requirement that is properly addressed is number 3. Does someone has a better suggestion for me ?

      Comment


      • #4
        Since you seem to have substantial expertise on the topic, you might consider writing such a utility. If so, we'd be pleased to post it in the PowerBASIC Download area.

        Best regards,

        Bob Zale
        PowerBASIC Inc.

        Comment


        • #5
          patience

          Bob,

          The very reason to start this thread was to avoid the development of such a utility myself. As I am not the first one to deal with the QB-PB-conversion, I still expect a mature utility to exist in the PB-community. Such a utility would be of great value to attract programmers to move from QB to PB.
          Let's wait for other appends.

          Best regards,
          Peter

          Comment


          • #6
            >Let's wait

            I've been participating in this forum and its predecessor for a long time, and I've seen both lots of requests and lots of offerings for similar 'conversion utilities' but I've never seen either a request or an offering as comprehensive as your wish list.

            The most complete offerings I've seen were not to convert from Microsoft MS-DOS BASIC to PowerBASIC Windows' BASIC, but from Microsoft MS-DOS BASIC to PowerBASIC MS-DOS BASIC. Perhaps one of those can do more of what you want done as a "first step."

            That is, waiting is an option... but I would not hold my breath for a 'single solution'. You may have to process your code thru multiple existing offerings to get it to the point where only 'tweaking' is required.



            MCM
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Qb 2 Pb

              Peter

              A couple of years ago I converted 150k lines of code in 200 exe's. Writing the conversion programme was fairly easy because one of the "features" of QB was that it formatted your statements eg reserved words were in upper case. It wasn't difficult to write a programme which effectively was doing a text search and replace.

              The only issue is that we each have our own style of writing a programme therefore the conversion utility that worked for me will not work for you.

              It really is not difficult. Subsequent to that I converted 50k lines from QB45 to PBDOS programatically and have since converted the resulting code to PBCC by the same method.

              Regards
              Roy

              Comment


              • #8
                I use Grep to deal with the obvious stuff.

                Then I just load the code into the editor, hit 'Compile' and start fixing.

                Using search and replace, it's surprising how little time it takes when you get started.

                I've fixed tens of thousands of lines like that.

                Needless to say, thourough testing is essential!

                Comment


                • #9
                  Peter it appears to me that the qb2pbv2 (qb2pb.bas) is a pbdos program that
                  converts qb to pbdos.

                  Since you are posting in the PBCC forum, I assume you don't want that.

                  I have one that is intended for qb to pbcc.

                  It's not perfect but it's ok.

                  it does,
                  change common and COMMON SHARED to global
                  rems out const since you can have single/double precision constants in qb.
                  changes most . to _
                  changes DEF FN to FUNCTION FN...
                  if they have a $,#,&,! identifyer it removes that and puts AS ... whatever the type in the declare statement.

                  changes chain to exit function
                  rems out view print.
                  rems out screen 0
                  REMS out TYPE REGTYPE..
                  REMS out CALL ABSOLUTE
                  Changes CSRLIN to CURSORY
                  Changes POS(0) to CURSORX
                  REMS OUT READ with 'Redo this
                  REMS OUT "MOUSE" with 'REDO this
                  fixed most USING statements to USING$ etc.
                  rems out RESTORE to "redo this
                  Code:
                  #COMPILE EXE
                  FUNCTION PBMAIN() AS LONG
                     LINE INPUT "enter qb program saved as text ",qbprog$
                     LINE INPUT "enter name for new program ",newprog$
                     OPEN qbprog$ FOR INPUT AS #1
                     OPEN newprog$ FOR OUTPUT AS #2
                     OPEN "temp.in" FOR OUTPUT AS #3
                     WHILE NOT EOF(1)
                       LINE INPUT #1,LL$
                  checkit1:
                       xx$=""
                       
                       K%=INSTR(LL$," USING ")
                       IF K% THEN
                         Z1%=0:Z2%=0
                         Z1%=INSTR(1,LL$,CHR$(34))
                         IF Z1%>0 AND Z1%<K% THEN
                           Z2%=INSTR(Z1%+1,LL$,CHR$(34))
                         END IF
                         IF Z1%>0 AND Z1%<K% AND Z2%>K% THEN
                           PRINT LL$
                           PRINT "Z1%=";Z1%
                           PRINT Z2%=";z2%
                           WAITKEY$
                           'ignore
                           IF MID$(LL$,K%,9)=" USING "+CHR$(34)+"#" THEN GOTO skip1
                         ELSE
                  skip1:
                           O%=INSTR(K%+1,LL$,";")
                           IF O%>K% THEN
                             MID$(LL$,O%,1)=","
                             P%=INSTR(O%+1,LL$,ANY ":;")
                             IF P%>0 THEN 'P%=LEN(LL$)
                       
                               XX$=MID$(LL$,1,K%-1)+" USING$("+MID$(LL$,K%+7,P%-K%-7)+")"+MID$(LL$,P%)
                             ELSE
                               P%=LEN(LL$)+1
                               XX$=MID$(LL$,1,K%-1)+" USING$("+MID$(LL$,K%+7,P%-K%-7)+")"+MID$(LL$,P%+1)
                             END IF
                             zz$=LL$
                             LL$=XX$'+'"'''"+ZZ$
                           END IF
                         END IF
                         IF XX$<>"" THEN GOTO checkit1 'more than one using on a line
                       END IF
                       K%=INSTR(UCASE$(LL$),"CALL INTERRUPT")
                       IF K% THEN
                         xx$="'REDO this "+LL$
                         LL$=XX$
                       END IF
                       K%=INSTR(LL$,"BSAVE")
                       IF k% THEN
                          xx$="'redo -- contools may help ->"+LL$
                          LL$=XX$
                       END IF
                       K%=INSTR(LL$,"BLOAD")
                       IF k% THEN
                          xx$="'redo -- contools may help ->"+LL$
                          LL$=XX$
                       END IF
                      
                       K%=INSTR(LL$,"SCREEN 0")
                       IF K% THEN
                         IF K%=1 THEN XX$="'"+LL$:LL$=XX$
                       ELSE
                         XX$=MID$(LL$,1,K%-1)+" ' "+MID$(LL$,K%)
                       END IF
                       K%=INSTR(LL$,"CHAIN ")
                       IF K% THEN
                         XX$=MID$(LL$,1,K%-1)+"EXIT FUNCTION '"+MID$(LL$,K%)
                         LL$=XX$
                       END IF
                       IF TRIM$(UCASE$(LL$))="END" THEN
                          LL$="EXIT FUNCTION 'END"
                          PRINT #2,LL$
                          GOTO readnext
                       END IF
                       K%=INSTR(LL$,"CSRLIN")
                       IF K% THEN
                         XX$=MID$(LL$,1,K%-1)+"CURSORY"+MID$(LL$,K%+6)
                         LL$=XX$
                       END IF
                       K%=INSTR(LL$,"POS(0)")
                       IF K% THEN
                         XX$=MID$(LL$,1,K%-1)+"CURSORX"+MID$(LL$,K%+6)
                         LL$=XX$
                       END IF
                       K%=INSTR(LL$,"VIEW PRINT")
                       IF K% THEN
                         PRINT #2,"'redo this "+LL$
                         GOTO readnext
                       END IF
                       'K%=INSTR(LL$,"COLOR ")
                       'IF K% THEN
                       '  M%=INSTR(LL$,":")
                       '  N%=INSTR(LL$,",")
                       '  O%=INSTR(N%+1,LL$,",")
                       '  IF M%=0 THEN
                       '    IF N%>0 THEN
                       '      IF O%>N% THEN
                       '        XX$=MID$(LL$,1,O%-1)
                       '        LL$=XX$
                       '        PRINT #2,LL$
                       '        GOTO readnext
                       '      END IF
                       '    END IF
                       '  END IF
                       '  IF M%>0 THEN
                       '    IF N%>0 THEN
                       '      IF O%>N% THEN
                       '        XX$=MID$(LL$,1,O%-1)+MID$(LL$,M%)
                       '        PRINT #2,XX$
                       '        GOTO readnext
                       '      END IF
                       '    END IF
                       '  END IF
                       'END IF
                  
                       K%=INSTR(LL$,"READ ")
                       IF K% THEN
                         PRINT #2,"'redo this "+LL$
                         GOTO readnext
                       END IF
                       K%=INSTR(LL$,"RESTORE")
                       IF K% THEN
                         PRINT #2,"'redo this "+LL$
                         GOTO readnext
                       END IF
                       K%=INSTR(UCASE$(LL$)," MOUSE ")
                       IF K% THEN
                         PRINT #2,"'Redo this "+LL$
                         GOTO readnext
                       END IF
                       K%=INSTR(LL$,"CALL ABSOLUTE")
                       IF K% THEN
                         PRINT #2,"'REDO THIS "+LL$
                         GOTO readnext
                       END IF
                       K%=INSTR(UCASE$(LL$),"TYPE REGTYPE")
                       IF K% THEN
                         XX$="REM "+LL$
                         PRINT #2,XX$
                         LINE INPUT #1,LL$
                         WHILE INSTR(LL$,"END TYPE")=0
                           PRINT #2,"REM "+LL$
                           LINE INPUT #1,LL$
                         WEND
                         PRINT #2,"REM "+LL$
                         GOTO readnext
                       END IF
                       K%=INSTR(LL$,"CONST ")
                       IF k%=1 THEN
                         XX$="'redo this "+LL$
                         LL$=XX$
                         PRINT #2,LL$
                         GOTO readnext
                       ELSEIF K%>1 THEN
                         IF MID$(LL$,k%-1,1)=" " THEN
                           XX$="'redo this "+LL$
                           LL$=XX$
                           PRINT #2,LL$
                           GOTO readnext
                         END IF
                       END IF
                  
                       K%=INSTR(LL$,".")
                       L%=INSTR(LL$,CHR$(34))
                       M%=INSTR(L%+1,LL$,CHR$(34))
                       IF K% THEN
                         IF L%<K% AND M%>K% THEN
                           'do nothing
                         ELSE
                           test$=MID$(LL$,K%+1,1)
                           IF test$<>"#" AND test$<>"9" AND test$<>"0" THEN
                             MID$(LL$,k%,1)="_"
                             GOTO checkit1
                           END IF
                         END IF
                       END IF
                       K%=INSTR(LL$,"COMMON SHARED")
                       IF K% THEN
                         MID$(LL$,K%,6)="GLOBAL"
                         XX$=MID$(LL$,1,K%+6)+MID$(LL$,K%+13)
                         LL$=XX$
                         PRINT #2,LL$
                         GOTO ReadNext
                       END IF
                  
                       K%=INSTR(LL$,"COMMON ")
                       IF K% THEN
                         MID$(LL$,K%,6)="GLOBAL"
                         PRINT #2,LL$
                         GOTO readnext
                       END IF
                       K%=INSTR(UCASE$(LL$),"DEF FN")
                       IF K% THEN
                         M%=INSTR(K%+1,LL$,"(")
                         IF M% THEN
                           FOR X%=M%-1 TO K% STEP -1
                             IF MID$(LL$,X%,1)<>" " THEN
                                char$=MID$(LL$,X%,1)
                                IF char$="$" OR char$="#" OR char$="&" OR char$="%" OR char$="!" THEN
                                  MID$(LL$,X%,1)=" "
                                END IF
                                x%=K%
                             END IF
                           NEXT
                         END IF
                         IF M% THEN
                           SELECT CASE char$ 'MID$(LL$,M%-1,1)
                             CASE "$"
                               typ$=" AS STRING"
                             CASE "#"
                               typ$=" AS DOUBLE"
                             CASE "&"
                               typ$=" AS LONG"
                             CASE "!"
                               typ$=" AS SINGLE"
                             CASE ELSE
                               typ$=" AS INTEGER"
                           END SELECT
                         END IF
                         xx$="FUNCTION FN"+MID$(LL$,K%+6)+ typ$
                         PRINT #3,XX$
                         LINE INPUT #1,LL$
                         WHILE TRIM$(LL$)<>"END DEF"
                           PRINT #3,LL$
                           LINE INPUT #1,LL$
                         WEND
                         PRINT #3,"END FUNCTION"
                         GOTO readnext
                       END IF
                       IF ENDMAIN%=0 THEN
                         K%=INSTR(LL$,"FUNCTION ")
                         L%=INSTR(LL$,"SUB ")
                         M%=INSTR(LL$,"DECLARE")
                         IF K% AND M%=0 THEN
                           PRINT #2,"END FUNCTION"
                           'print #2,LL$
                           ENDMAIN%=1
                         END IF
                         IF L% AND M%=0 THEN
                           IF L%=1 THEN
                             PRINT #2,"END FUNCTION"
                           'print #2,LL$
                             ENDMAIN%=1
                           END IF
                           IF L%>1 THEN
                             IF MID$(LL$,L%-1,1)=" " THEN
                               PRINT #2,"END FUNCTION"
                           'print #2,LL$
                               ENDMAIN%=1
                             END IF
                           END IF
                         END IF
                       END IF
                       PRINT #2,LL$
                  
                  readnext:
                     WEND
                     IF endmain%=0 THEN PRINT #2,"END FUNCTION"
                     CLOSE
                     DIM declares$(0)
                     OPEN "temp.in" FOR INPUT AS #1
                     WHILE NOT EOF(1)
                       LINE INPUT #1,LL$
                       IF MID$(LTRIM$(UCASE$(LL$)),1,4)="SUB " OR MID$(LTRIM$(UCASE$(LL$)),1,9)="FUNCTION " THEN
                         lc%=lc%+1
                         REDIM PRESERVE declares$(lc%)
                         declares$(lc%)="DECLARE "+LL$
                       END IF
                     WEND
                     CLOSE
                     OPEN "temp.in" FOR INPUT AS #1
                     OPEN "temp.out" FOR OUTPUT AS #2
                     WHILE NOT EOF(1)
                       LINE INPUT #1,LL$
                  checkit2:
                       xx$=""
                       K%=INSTR(LL$," USING ")
                       IF K% THEN
                         Z1%=0:Z2%=0
                         Z1%=INSTR(1,LL$,CHR$(34))
                         IF Z1%>0 AND Z1%<K% THEN
                           Z2%=INSTR(Z1%+1,LL$,CHR$(34))
                         END IF
                         IF Z1%>0 AND Z1%<K% AND Z2%>K% THEN
                           PRINT LL$
                           PRINT "Z1%=";Z1%
                           PRINT Z2%=";z2%
                           WAITKEY$
                           'ignore
                           IF MID$(LL$,K%,9)=" USING "+CHR$(34)+"#" THEN GOTO skip2
                         ELSE
                  skip2:
                           O%=INSTR(K%+1,LL$,";")
                           IF O%>K% THEN
                             MID$(LL$,O%,1)=","
                             P%=INSTR(O%+1,LL$,ANY ":;")
                             IF P%>0 THEN 'P%=LEN(LL$)
                  
                               XX$=MID$(LL$,1,K%-1)+" USING$("+MID$(LL$,K%+7,P%-K%-7)+")"+MID$(LL$,P%)
                             ELSE
                               P%=LEN(LL$)+1
                               XX$=MID$(LL$,1,K%-1)+" USING$("+MID$(LL$,K%+7,P%-K%-7)+")"+MID$(LL$,P%+1)
                             END IF
                             zz$=LL$
                             LL$=XX$'+'"'''"+ZZ$
                           END IF
                         END IF
                         IF XX$<>"" THEN GOTO checkit2 'more than one using on a line
                       END IF
                  
                       IF TRIM$(UCASE$(LL$))="END" THEN
                          LL$="EXIT FUNCTION 'END"
                          PRINT #2,LL$
                          GOTO readnext2
                       END IF
                       K%=INSTR(LL$,"CSRLIN")
                       IF K% THEN
                         XX$=MID$(LL$,1,K%-1)+"CURSORY"+MID$(LL$,K%+6)
                         LL$=XX$
                       END IF
                       K%=INSTR(LL$,"POS(0)")
                       IF K% THEN
                         XX$=MID$(LL$,1,K%-1)+"CURSORX"+MID$(LL$,K%+6)
                         LL$=XX$
                       END IF
                       K%=INSTR(LL$,"VIEW PRINT")
                       IF K% THEN
                         PRINT #2,"'redo this "+LL$
                         GOTO readnext2
                       END IF
                  
                       K%=INSTR(LL$,"READ ")
                       IF K% THEN
                         PRINT #2,"'redo this "+LL$
                         GOTO readnext2
                       END IF
                       K%=INSTR(LL$,"RESTORE")
                       IF K% THEN
                         PRINT #2,"'redo this "+LL$
                         GOTO readnext2
                       END IF
                       K%=INSTR(UCASE$(LL$)," MOUSE ")
                       IF K% THEN
                         PRINT #2,"'Redo this "+LL$
                         GOTO readnext2
                       END IF
                       K%=INSTR(LL$,"CALL ABSOLUTE")
                       IF K% THEN
                         PRINT #2,"'REDO THIS "+LL$
                         GOTO readnext2
                       END IF
                  
                       K%=INSTR(LL$,".")
                       L%=INSTR(LL$,CHR$(34))
                       M%=INSTR(L%+1,LL$,CHR$(34))
                       IF K% THEN
                         IF L%<K% AND M%>K% THEN
                           'do nothing
                         ELSE
                           test$=MID$(LL$,K%+1,1)
                           IF test$<>"#" AND test$<>"9" AND test$<>"0" THEN
                             MID$(LL$,k%,1)="_"
                             GOTO checkit2
                           END IF
                         END IF
                       END IF
                       PRINT #2,LL$
                  
                  readnext2:
                     WEND
                     CLOSE
                     OPEN "temp.out" FOR BINARY AS #1
                     OPEN newprog$ FOR APPEND AS #2
                     GET$ #1,LOF(1),A$
                     IF LOF(1) THEN
                       'GET$ #2,LOF(2),B$
                       'CLOSE
                       PRINT #2,A$;
                       CLOSE
                     END IF
                     CLOSE
                     OPEN newprog$ FOR BINARY AS #2
                     GET$ #2,LOF(2),a$
                     CLOSE
                     OPEN newprog$ FOR OUTPUT AS #2
                     PRINT #2,"#COMPILE EXE"
                     FOR k%=1 TO LC%
                       PRINT #2,declares$(k%)
                     NEXT
                     PRINT #2,a$;
                     CLOSE
                  
                  END FUNCTION
                  Last edited by Fred Buffington; 19 Oct 2007, 10:59 PM.
                  Client Writeup for the CPA

                  buffs.proboards2.com

                  Links Page

                  Comment


                  • #10
                    Let me just throw something out here....

                    A good 'first step' might be to find a 'lint' ("prettifier" or "reformatter") program for your existing code.

                    Whatever is leftover after your 'conversion' program will surely be easier to fix up if all the indents for loop structures are consistent, all single-line IF..THEN converted to indented block IF.. THEN.. END IF blocks, all the remarks are aligned, keywords capitalized and all the other things these programs do.

                    MCM
                    Michael Mattias
                    Tal Systems Inc. (retired)
                    Racine WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      QB to PBCC convertor

                      Look under Downloads
                      PowerBASIC Console Compiler

                      Scan down to "Q"

                      I wrote a "QBASIC to PB/CC Convertor"

                      William Johns

                      Comment


                      • #12
                        Originally posted by William Johns View Post

                        I wrote a "QBASIC to PB/CC Convertor"

                        William Johns
                        Congratulations for writing the converter! I am new to PB/CC and am trying to convert my CBasic (actually MB86, which is an upgraded version of CBasic) .BAS files to PB/CC 5.05. For your info, MB86 has supplied 32 bit DLLs (containing functions written in C and assembly), which I am told, can be accessed from PB/CC by creating DECLARE for each routing in the DLL. Unlike PB/CC, MB86 uses EXTERNAL and PUBLIC as well as COMMON. It allows C code mixing and compiling with MB86.
                        The three steps involved in creating an executable program file are:

                        1. MB86 translates a CBasic source code into C; it generates 32 bit DOS compatible C code.
                        2. compiles that C code into an object file using Borland C++ 4.5; and
                        3. links that object file using Borland C++ 4.5 linker


                        Can your QBASIC to PB/CC Convertor be used for partial conversion since MB86 is also a BASIC language? I can send you some MB86 documentation for your review so that you can give some guidance for conversion to PB/CC 5.05. Thanks for your assistance.

                        Comment


                        • #13
                          Can your QBASIC to PB/CC Convertor be used for partial conversion since MB86 is also a BASIC language? I can send you some MB86 documentation for your review so that you can give some guidance for conversion to PB/CC 5.05. Thanks for your assistance.
                          I downoaded Mr. Johns' file. It is PB source code. It has explicitly been placed in the public domain. It is nicely and extensively commented. It does not do anything weird.

                          I would think Mr. Johns - and many of the other contributors to both the downloads and source code areas - would at least toy with the idea that one-off modifications 'on spec' for a specific party's use should be billable services, the software provided free having served as advertising for same.

                          MCM
                          One who thinks this.
                          Michael Mattias
                          Tal Systems Inc. (retired)
                          Racine WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment


                          • #14
                            Shiv, Peter, and to others new to PB, I think what Mr Mattias is saying is we are more than willing to help you here, but we are not willing to do your job for you.

                            As has been stated there are any number of examples available in your PB CC folder, load one of them and start there. If you have questions, post your code here (with code format). Post a (short) MB86 code, and your efforts in PB to convert it. Many here will load your PB code and offer suggestions how improve/fix it.

                            We're more than willing to help (as I think you have seen demonstrated so far) but we will not do your (home)work for you.

                            ========================================================
                            'I believe that banking institutions are more dangerous
                            to our liberties than standing armies.
                            If the American people ever allow private banks
                            to control the issue of their currency,
                            first by inflation, then by deflation,
                            the banks
                            and corporations that will grow up around the banks
                            will deprive the people of all property -
                            until their children wake-up homeless
                            on the continent their fathers conquered.'
                            Thomas Jefferson
                            ========================================================
                            It's a pretty day. I hope you enjoy it.

                            Gösta

                            JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                            LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                            Comment


                            • #15
                              Thanks Gosta for your encouraging words. I was almost giving up on my conversion/rewriting task. After reading about "QBASIC to PB/CC Convertor," I thought I should have chosen QBasic instead of MB86 (CBasic). Well, here are my questions if anyone can help.
                              Where to look for a good example for accessing 32-bit DLLs? I have three MB86 32 bit DLLs (containing functions written in C and assembly), which I am told, can be accessed from PB/CC by creating DECLARE for each routine in the DLL. Any tool to view the routines in a 32 bit DLL file? How to ensure the said DLLs are usable by PB/CC 5.05?

                              Comment


                              • #16
                                Normally, type libraries are only created for COM DLL's. Technically, it is possible to create one for a standard DLL such as you are using, but I've yet to see one anywhere. Never.

                                It's easy enough to get a list of the function names, but there won't be any information available on the parameter signature, calling conventions, etc. That's normally provided in the accompanying documentation.

                                PowerBASIC can readily access it with appropriate documentation.

                                Best regards,

                                Bob Zale

                                Comment


                                • #17
                                  I have three MB86 32 bit DLLs (containing functions written in C and assembly), which I am told, can be accessed from PB/CC by creating DECLARE
                                  Considering the magnitude of your task, and if your budgets both financial and emotional can handle it, you might consider porting those DLLs to PowerBASIC source using the PB/Windows compiler.

                                  It's a thought.

                                  Another thought is, I've seen a lot of "function libraries" stored in separate DLLs. I've found that often those functions are simple little 'wrapper' things which format numbers, read a record from a file, do some arithmetic and other basic (small b) tasks. These kinds of 'wrapper' functions are often found in applications with a "less feature-rich set of intrinsics" than have the PowerBASIC products; that is, they are often not all that useful.

                                  Since you'll want your own source code library of 'handy-dandy' little procedures anyway, you may as well rewrite those yourself, too: First, they will now be written in a style with which you are comfortable; second, since non-user-interface code is the same for both PB/CC and PB/Windows, you will have a library usable for anything, a library you can either compile to DLLs or simply #INCLUDE in your next program. (I personally have nothing against DLLs but there are a lot of folks here who avoid multi-module applications like the plague).

                                  I have (so far) heroically resisted making my usual comments about performing 'automated' conversions from one source code language to another, or from one operating system to another, but if you are curious do a full text search here on "stone loser" (just like that, with the quotes) and you will get multiple hits.

                                  MCM
                                  Michael Mattias
                                  Tal Systems Inc. (retired)
                                  Racine WI USA
                                  [email protected]
                                  http://www.talsystems.com

                                  Comment


                                  • #18
                                    Amen to that !

                                    Shiv, I have never regretted following Michael advice.
                                    Old QB45 Programmer

                                    Comment


                                    • #19
                                      Shiv
                                      Do you have Minnow Bear's code analyzer? If so use it to spot trouble before conversion and edit code first in cb86 then compile then convert the source.
                                      You might even want to unspagetti your code and use cb86 for compiling again before manual converting.

                                      If your not compiling to PBCC. You should.

                                      Create as many functions as you can in PBCC to replace converted code.

                                      Get away from variable identifiers($,%,#,!,etc) on converted code and use DIM for variable type declarations.

                                      Do short projects first where there is no printing or writing to complicated file formats.
                                      p purvis

                                      Comment


                                      • #20
                                        I struggled with this forever...

                                        Though you can convert big parts, I have become an advocate of rewriting the sections (modules) in PBCC. Yes... from scratch.

                                        You know what you want to do better than anyone else, but you have to know what PBCC offers you - so you don't shortchange the power it offers.

                                        Write "Hello World" and then some input routines.

                                        Learn about fonts and screen positions. I would do everything in a Graphic Window, but that's just me...

                                        See Guy's menu program (but don't get caught up in a neverending search through sample code).

                                        Do some screen formatting. Design some special twists of your own.

                                        After having done this a bunch now (since I had dozens of BIG QB PDS programs), I like the total rewrite. It's a pain, but pays off in the long run.

                                        Once you have your input routines, etc. - you have your own program skeleton and it just gets easier for each project. Then add the sections and functions one at a time (and check them). Chances are your old programs have a bunch of non-descriptive variable names (of the 2-character variety). Use variable names that mean something! You have room now. Comment the heck out of what you're doing. You don't have those old module room limitations.

                                        Use PBCC and dive in. Don't look back. Just my 2 cents.

                                        Comment

                                        Working...
                                        X