[Gambas-user] Migrating to Gambas

Brian G brian at westwoodsvcs.com
Wed Jun 9 07:41:56 CEST 2021

Gambas has special object functions _get _put for assignment and getting value of an object
Brian G Tuesday, 08 June 2021, 09:07PM -07:00 from John Anderson  johna at starflightinc.com :

>On 6/8/2021 4:16 PM, John Dovey wrote:
>>Does anyone have any thoughts/advice about
>>        migrating a project from vb6 to Gambas?
>>I found a reference to an old project for migrating some
>>          forms, but that was for an old version of Gambas.
>Doing a VB6 to Gambas conversion now on large
>      codebase.  New-ish user here but it gets easier quick.
>Actually, I'm getting good results on a large project where we
>      want to keep source code as close to original as possible. Thanks
>      to advice from kind people here and just trying different methods
>      out.
>In my case - Starting "from scratch" is 100% bullshit in terms
>        of labor time if it can be avoided on a large system; in our
>        case it could be years testing something we started from ground
>        zero.  We especially have to keep the critical state machine
>        routines intact, exactly as they are, and without any errors
>        introduced - that source code has millions of hours verified and
>        expensive testing.  If you're the one paying the bills and
>        running a business, you want to re-use existing source code
>        where it makes sense to do so.  Not all the time, but be
>        practical about your approach.  Sometimes you might start from
>        scratch.  Other times that is the very last thing you want to
>        do.
>So far we have been able to re-create a lot of the most critical
>        state machine code pretty well now that we can declare a Static
>        var inside a state machine.  That completely changes things, and
>        for the better...IF you're doing a VB conversion. 
>We have converted several forms already, trying different
>      methods.  It tuns out it doesn't take too long to print out the
>      form on VB6, jot down the control names for each control, and then
>      duplicate the equivalent layout in Gambas with the same or close
>      equivalent control.  It helps to run VB6 on a Windows VM in one
>      monitor, and Gambas on another, so you can get the layouts and
>      control names the same.
>After that I made a wrapper for VB6 MsgBox to something like
>      Message.Info etc. on Gambas - gotta use Qt for that, according to
>      docs (we are).  Because we used MsgBox hundreds of times.  We can
>      clean that up later but for now wherever we can make a wrapper for
>      your simpler VB calls that don't exist in Gambas, or the maybe
>      function exists but goes by a different name.
>Convert "Double" vars to "Float".    Watch out on your C-code
>      function call test suites here, if your test procedure thinks a
>      struct has a float instead of a double....it might flag a struct
>      mismatch for a C-call until you change your code review
>      procedures.
>Handle Globals a little different, we use the "Put globals in
>      Globals.mod" file method as suggested in docs.  
>Your Find / Replace tools works very close to how it works in in
>      VB6.
>The real bummer is converting arrays to square brackets.  We will
>      have to do that in many many thousands of places.  I'm toying with
>      the idea of scanning the code base for all arrays, and using that
>      list to search for where those arrays are used in
>      code...automation might help here.  
>Watch out for your class Getters and Setters - in VB6 look for
>      Property Let, Get, Set and convert that to Property _Read, _Write,
>      and ??? in Gambas.  In Property Declarations section of help
>      file.  I haven't needed to convert a Property Set yet, but in VB6
>      that was a property object that could -only- be used on left side
>      of an expression... I'm not sure if I need to do that in my
>      conversion yet.  
>There is a gb.vb component that makes some string funcs, dates,
>      rounding etc working like VB6.
>There are SOME spots that yes, will require rewrite.  But I'm
>      finding that probably 85% of expensive source code is re-useable
>      pretty much as is.  
>At least that's what we're finding out so far.  Some weeks of work
>      ahead of us, but early testing is looking hopeful.
>----[  http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20210609/cf9b90d2/attachment.htm>

More information about the User mailing list