Some more progress towards UDT support...by (no login)QB64 now supports everything you can do with user defined types in QBASIC/QB4.5 except for PUT'ing and GET'ing them from a file, which will be the final essential step towards UDT support for Demo #8. Since last I posted about UDT support, QB64 can now read/write to all element types (it used to be restricted to INTEGERs only) and can define and reference types within types. Here's the latest sample code I used for testing: 'Notes: _BIT variables can be defined in a TYPE but cannot be 'referenced yet. _BIT variables are aligned to the next bit, but 'all other variables are aligned to the nearest byte. So, the first 6 'elements of "alltypes" consume only 12 bits, then because the 7th 'element is not of a _BIT type the structure is padded with 4 bits 'so that the next offset is a byte offset. Make sense? TYPE alltypes bit1 AS _BIT * 1 ubit1 AS _UNSIGNED _BIT * 1 bit2 AS _BIT * 2 ubit2 AS _UNSIGNED _BIT * 2 bit3 AS _BIT * 3 ubit3 AS _UNSIGNED _BIT * 3 byt AS _BYTE ubyt AS _BYTE int AS INTEGER uint AS _UNSIGNED INTEGER lng AS LONG ulng AS _UNSIGNED LONG int64 AS _INTEGER64 uint64 AS _UNSIGNED _INTEGER64 sng AS SINGLE dbl AS DOUBLE flt AS _FLOAT str1 AS STRING * 1 str10 AS STRING * 10 END TYPE TYPE alltypeswrapper t AS alltypes END TYPE DIM myt AS alltypeswrapper DIM myta(100) AS alltypeswrapper myt.t.byt=&HFF: myt.t.ubyt=&HFF myt.t.int=&HFFFF: myt.t.uint=&HFFFF myt.t.lng=&HFFFFFFFF: myt.t.ulng=&HFFFFFFFF myt.t.int64=&HFFFFFFFFFFFFFFFF: myt.t.uint64=&HFFFFFFFFFFFFFFFF myt.t.sng=1.1: myt.t.dbl=2.2: myt.t.flt=3.3 myt.t.str1="Z": myt.t.str10="abcdefghij" print myt.t.byt; myt.t.ubyt print myt.t.int; myt.t.uint print myt.t.lng; myt.t.ulng print myt.t.int64; myt.t.uint64 print myt.t.sng; myt.t.dbl; myt.t.flt print "["+myt.t.str1+"]"+"["+myt.t.str10+"]" myta(1)=myt myta(13).t=myta(1).t print myta(13).t.byt; myta(13).t.ubyt print myta(13).t.int; myta(13).t.uint print myta(13).t.lng; myta(13).t.ulng print myta(13).t.int64; myta(13).t.uint64 print myta(13).t.sng; myta(13).t.dbl;myta(13).t.flt print "["+myta(13).t.str1+"]"+"["+myta(13).t.str10+"]" from IP address 58.106.166.35 |
| Response Title | Author and Date |
| Excellent progress report Galleon... | on May 4 |