Getting ready for Gambas3¶
- Getting ready for Gambas3
- Install
- Array Syntax Change
- Open Syntax Change
- gb.Text is Depricated
- INC Boolean
- SQL Exec
- Unknown symbol BackColor
- Unknown symbol ForeColor
- Type mismatch: wanted Byte[], got Integer[] instead
- Formatting Issues
- UdpSocket Syntax Change
- Unknown symbol '!GridView' in class '!DataBrowser'
- Related Resources
- Comment
- Attached Files
Gambas3 is the experimental development version of Gambas.
Big changes are done in this version, Gambas2 the stable version gets only bug fixes.
Since I'm trying to get DomotiGa/Gambas running on a new architecture, namely PowerPC which is the OS my Synology DS410 uses, I started to convert DomotiGa to run with Gambas3.
There are however some (big) changes in syntax, and some Gambas3 bugs I run into, and so I created this page to document them.
- Runs faster (10-20%)
- Compiles twice as fast
Install¶
If you want to install Gambas3 to try out, here are the steps for Ubuntu
Gambas3 has different requirements than Gambas2.
For Natty 11.04:
$ sudo apt-get install subversion build-essential autoconf libbz2-dev libfbclient2 libmysqlclient-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libgtk2.0-dev libldap2-dev libcurl4-gnutls-dev libgtkglext1-dev libpcre3-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsage-dev libxml2-dev libxslt1-dev libbonobo2-dev libcos4-dev libomniorb4-dev librsvg2-dev libpoppler-dev libpoppler-glib-dev libasound2-dev libesd0-dev libdirectfb-dev libaa1-dev libxtst-dev libffi-dev kdelibs4-dev firebird2.1-dev libqt4-dev libglew1.5-dev libimlib2-dev libv4l-dev libsdl-ttf2.0-dev libgnome-keyring-dev libgdk-pixbuf2.0-dev linux-libc-dev
For Precise 12.04:
$ sudo apt-get install subversion build-essential autoconf libbz2-dev libfbclient2 libmysqlclient-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libgtk2.0-dev libldap2-dev libcurl4-gnutls-dev libgtkglext1-dev libpcre3-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsage-dev libxml2-dev libxslt1-dev libbonobo2-dev libcos4-dev libomniorb4-dev librsvg2-dev libpoppler-dev libpoppler-glib-dev libasound2-dev libesd0-dev libdirectfb-dev libaa1-dev libxtst-dev libffi-dev kdelibs5-dev firebird2.1-dev libqt4-dev libglew1.5-dev libimlib2-dev libv4l-dev libsdl-ttf2.0-dev libgnome-keyring-dev libgdk-pixbuf2.0-dev linux-libc-dev libgsl0-dev
Download and compile Gambas3
$ cd ~install/gambas $ svn checkout https://gambas.svn.sourceforge.net/svnroot/gambas/gambas/trunk $ cd trunk $ ./reconf-all && ./configure -C $ make $ sudo make install
Keep in mind that due to the syntax changes below, you cannot run DomotiGa on Gambas3 right away, DomotiGaServer3 runs, but DomotiGa has to be converted/party rewritten to be compatible, although the automatic conversion is getting better everytime.
Array Syntax Change¶
Symptom: Syntax error
When declaring an array you have to use the New keyword.
Gambas2: DIM sCommand AS Stringr5
Gambas3: Dim sCommand As New Stringr5
Open Syntax Change¶
Symptom: Unexpected Open
File Open has changed syntax, the As keyword is removed.
Gambas2: Open sBaseDir &/ "logs" &/ sMainLogFile For Append As #hMainLogFile
Gambas3: hMainLogFile = Open sBaseDir &/ "logs" &/ sMainLogFile For Append
gb.Text is Depricated¶
Symptom: Devices.?.0: gb.Text
gb.Text is depricated and replaced by gb.!IgnoreCase
INC Boolean¶
Symptom: warning: Main.!DisplaySensors.4080: ADD QUICK with Boolean
INC Boolean isn't allowed anymore, replace with Boolean = TRUE
SQL Exec¶
Symptom: SQL syntax errors
For DB.Exec and DB.Subst the arguments above 9 have to have {} around them.
sSql = "UPDATE devices SET name = &1, module = &2, interface = &3, address = &4,"
sSql &= "location = &5, label = &6, label2 = &7, label3 = &8, value = &9,"
sSql &= "officon = &{10}, onicon = &{11}"
rResultUpdate = Main.hDB.Exec(sSql, ...)
Unknown symbol BackColor¶
Gambas2: gvPhoneCalls.Data.BackColor = Color.Background
Gambas3: gvPhoneCalls.Data.BackGround = Color.Background
Unknown symbol ForeColor¶
Symptom: Unknown symbol '!ForeColor' in class '!TextLabel'
Gambas2:
With hText
.ForeColor = Color.Gray
End With
Gambas3:
With hText
.ForeGround = Color.Gray
End With
Type mismatch: wanted Byte[], got Integer[] instead¶
Gambas2: DIM b AS Byte[] = [CByte(&HF0), CByte(&H3E), &HF0, &H3E]
Gambas3: Dim b As Byte[] = [&HF0, &H3E, &HF0, &H3E]
Formatting Issues¶
In Gambas 3 prefix characters are filled with spaces.
So 560 formatted with "####" becomes <SPACE>560, which is not always wanted behavior.
Gambas2: Format(sText, "####")
Gambas3: Format(sText, "#")
UdpSocket Syntax Change¶
Gambas2: hBroadcastEvent.Bind(0)
Gambas3: hBroadcastEvent.Port = 0 hBroadcastEvent.Bind()
Unknown symbol '!GridView' in class '!DataBrowser'¶
Gambas2: [[DataBrowserLog]].GridView
Gambas3: [[DataBrowserLog]].View
Related Resources¶
Comment¶
Updated by: rdnzl, Updated 24 days ago
Access count: 1092 since 2011-08-25
Attached Files¶