[Gambas-user] Some new features in Gambas 3
Benoît Minisini
gambas at ...1...
Sat Nov 27 14:44:05 CET 2010
Hi,
Here is just a few words about recently added features in Gambas 3, for those
who didn't see them.
1) The gb.qt4.webkit got support for cookies and file downloads. See the
WebBrowser example for the details.
2) A new set of native functions named Mk<XXX>$() to create a string from the
memory representation of a value. For example, MkShort$(1234) returns
Chr$(210) & Chr$(4) (on a little endian machine).
3) The contrary are the new <XXX>@() functions (Bool@, Byte@, Short at ...2513......) that
replace the BoolPtr, BytePtr, ShortPtr... functions. It is just a rename,
except that these functions can take a string instead of a pointer. In that
case, the function will read the memory at the beginning of the string. In
other words:
Before: ... = ShortPtr(VarPtr(AString))
Now: ... = Short@(AString)
4) Structures now can be read from and written to a stream with the READ and
WRITE instructions. That way:
Public Struct TheThing
...
End Struct
Dim AThing As TheThing
AThing = New TheThing
...
Write #AStream, AThing As TheThing
AThing = Read #AStream As TheThing
Note #1: reading a structure from a stream does not fill the structure, but
creates a new one.
Note #2: writing a structure is done in one shot (one system call). That way,
you can use structures do send and receive messages to UDP sockets.
Note #3: structures can include other structures, and embedded arrays, and
embedded arrays of structures! All that is managed recursively and
transparently.
Now, I am going to make the big change on the Is<XXX>() functions that
frightens a lot of people. Let's be bold! :-)
--
Benoît Minisini
More information about the User
mailing list