Announcement

Collapse
No announcement yet.

Proof of Concept Code

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

    Proof of Concept Code

    This VB6 Proof-of-Concept code was written by Fred Harris. I wrote the PB source using DDT.

    Stan
    Last edited by StanHelton; 24 Jun 2008, 03:57 PM.
    Do not go quiet into that good night,
    ... Rage, rage against the dark.

    #2
    The code seems a little verbose to me.

    Why not creating the resulting code in memory and then save 1 single line of code to
    file instead of saving line by line?

    Also... the types, 1 LONG variable for each flag? why not creating couple longs
    and adding flag states using the OR operator?

    Comment


      #3
      Originally posted by Elias Montoya View Post
      The code seems a little verbose to me.
      Maybe, but it's not there to be an example of coding style, but to "prove the concept".

      So we know that you can convert a simple VB program to a simple PB program.

      Now that some issues have been raised regarding OOP and variable types, should we look at POC for the approach chosen for each of these topics? I think that these will be harder tests to pass, BTW!

      It also raises the question of specifying the tests for each technical issue. Designing the tests correctly is just as important as writing the code. It will need first for the objective to be defined then someone with in-depth VB knowledge to take on the task. I would love to do this (honest) but I don't have the VB!

      Somewhere Stan will have a list of "conversion technical issues" which could be shared, discussed and used as a driver for this.

      Comment


        #4
        Originally posted by Elias Montoya View Post
        The code seems a little verbose to me.

        Why not creating the resulting code in memory and then save 1 single line of code to
        file instead of saving line by line?

        Also... the types, 1 LONG variable for each flag? why not creating couple longs
        and adding flag states using the OR operator?

        You're correct. However, all I wanted to do here was prove that it can be done in DDT. The code has not been refactored as it should be for any inclusion in the Converter.


        Originally posted by Chris Holbrook View Post
        Maybe, but it's not there to be an example of coding style, but to "prove the concept".

        So we know that you can convert a simple VB program to a simple PB program.

        Now that some issues have been raised regarding OOP and variable types, should we look at POC for the approach chosen for each of these topics? I think that these will be harder tests to pass, BTW!

        It also raises the question of specifying the tests for each technical issue. Designing the tests correctly is just as important as writing the code. It will need first for the objective to be defined then someone with in-depth VB knowledge to take on the task. I would love to do this (honest) but I don't have the VB!

        Somewhere Stan will have a list of "conversion technical issues" which could be shared, discussed and used as a driver for this.

        Rui Rodrigues tells me he is better at VB than PB. I have asked him to produce some VB6 samples we can use for the process. I have also asked Fred Harris to contact Jose Roca about using some of his research to build a Variant wrapper specifically for the Converter.

        I have the data, but have not compiled the 'technical issues' list. Thanks for the reminder. I'll get that list posted today.

        Stan
        Do not go quiet into that good night,
        ... Rage, rage against the dark.

        Comment


          #5
          continiuing the work...

          Very shortly I'll post my continued work on converting the vb code. I've completed a methodology to convert object calls to PB function calls. Came up with some interesting ideas in the process, and am anxuous to share them, get feedback etc. Have created a symbol table. That former example now produces runnable code without commenting anything out. Havn't tried it yet, but I believe it will be easily extensible to Listboxes, combo boxes, etc. Glad to here you've got a DDT implementation in the works Stan.
          Fred
          "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

          Comment


            #6
            Originally posted by Fred Harris View Post
            Very shortly I'll post my continued work on converting the vb code. I've completed a methodology to convert object calls to PB function calls. Came up with some interesting ideas in the process, and am anxuous to share them, get feedback etc. Have created a symbol table. That former example now produces runnable code without commenting anything out. Havn't tried it yet, but I believe it will be easily extensible to Listboxes, combo boxes, etc. Glad to here you've got a DDT implementation in the works Stan.
            You have developed a methodology already? Great work.

            Daniel Corbier has graciously offered to let us use his uCalc Language Builder as a project tool free of charge. He's also agreed to put together some examples of how to use it if we can supply him with the VB6 source and the desired PB source. If you have something he could work with now, he might be able to provide us with a very useful tool. A working methodology is just the kind of thing he asked me for.

            Can you post that methodology here? and maybe the symbol table too?

            Stan
            Last edited by StanHelton; 10 Jun 2008, 09:44 AM. Reason: typos
            Do not go quiet into that good night,
            ... Rage, rage against the dark.

            Comment


              #7
              Originally posted by Elias Montoya View Post
              The code seems a little verbose to me.

              Why not creating the resulting code in memory and then save 1 single line of code to
              file instead of saving line by line?

              Also... the types, 1 LONG variable for each flag? why not creating couple longs
              and adding flag states using the OR operator?


              My reasoning: Limiting myself to DDT (no SDK) I found that the MsgBoxCount can be almost any number because the Windows OS makes numerous focus calls not related to any user action. The control ID is a DWORD in the OS so maintaining multiple flags in a single variable might corrupt the ID. When I tried the OR method, I could not identify a constant value that did not get confused either in the ID or the count.

              Stan
              Do not go quiet into that good night,
              ... Rage, rage against the dark.

              Comment


                #8
                Originally posted by StanHelton View Post

                Daniel Corbier has graciously offered to let us use his uCalc Language Builder as a project tool free of charge.

                Stan
                I've looked at Danial Corbier uCalc Language Builder and thought about it for this project. The use of uCalc LB can create an interesting twist. The VB code itself could be executed at runtime. A VB interpreter. Include the VB code as string resources or data statements and execute the code at runtime. Of course, this would not be useful in terms of having VB code converted into PB, but it might be useful in getting the more incompatible VB code to run at all.

                Comment


                  #9
                  Originally posted by StanHelton View Post
                  ...The control ID is a DWORD in the OS so maintaining multiple flags in a single variable might corrupt the ID. When I tried the OR method, I could not identify a constant value that did not get confused either in the ID or the count.

                  Stan
                  I was talking only about boolean flags. ID's and other variables should be
                  stored in their own variable.

                  The concept has never been a mistery to me, i know it can be converted.

                  Comment


                    #10
                    Originally posted by Elias Montoya View Post
                    I was talking only about boolean flags. ID's and other variables should be
                    stored in their own variable.

                    The concept has never been a mistery to me, i know it can be converted.

                    Would you mind posting an example? I don't see it now, but I know I need to learn how to do it.
                    Do not go quiet into that good night,
                    ... Rage, rage against the dark.

                    Comment


                      #11
                      I could be wrong about this, but I kind of expect that using a 32 bit long to store what essentially amounts to 1 bit of information (%TRUE / %FALSE), while wasteful of space is probably faster/more efficient than packing bits or even using a byte variable. I'm just basing that idea on the DOS asm code I used to do years ago where you had to add Byte Ptr modifiers to asm statements if you wanted to access anything besides the native 16 bit size.

                      If in the fullness of time we can put together a really high quality error free or nearly error free program that sucks in vb code at one end and spits out perfect pb code one millionth of a second later, followed by a 'Welcome To PowerBASIC' message, well then I'm all for making it as efficient and fast and non-wasteful as can be, even if it takes packing bit variables. But until that time I don't think I'm too worried about it! Actually at this point its running too fast. I don't even get to see the results of my MousePtr 11 call when you click the button!
                      Fred
                      "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                      Comment


                        #12
                        Originally posted by StanHelton View Post
                        Would you mind posting an example? I don't see it now, but I know I need to learn how to do it.
                        Example for what? Storing many bollean flags in 1 variable? Sure here it is:

                        Code:
                        %ST_CODE_USESUNICODE  = &H0000001
                        %ST_CODE_USESFORMS    = &H0000002
                        %ST_CODE_SOMEOTHERVAR = &H0000004
                        
                        LOCAL Flags AS LONG
                        
                        ' Add one boolean flag to the variable
                        &Flags = &Flags OR %ST_CODE_USESUNICODE
                        
                        ' Add one boolean flag to the variable
                        &Flags = &Flags OR %ST_CODE_USESFORMS 
                        
                        ' Remove one boolean flag to the variable
                        &Flags = &Flags AND NOT %ST_CODE_SOMEOTHERVAR
                        
                        
                        ' Check one of the flags
                        
                        IF ISTRUE((&Flags AND %ST_CODE_USESFORMS) = %ST_CODE_USESFORMS) THEN
                        
                        ' This flag is set to ON.
                        
                        END IF
                        If you were asking for an example for converting a VB file to PB, i still dont have any, but i have lots of functions for text formatting. Let me know if you need them.

                        Comment

                        Working...
                        X
                        😀
                        🥰
                        🤢
                        😎
                        😡
                        👍
                        👎