BASIC DATATYPES in Oxygen Basic

Started by Theo Gottwald, February 11, 2024, 08:41:11 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Theo Gottwald

[code]
Category       | Type                 | Description                          | Hex Code
-----------------------------------------------------------------------------------------------------
Numeric        | sbyte                | Signed byte                          | 0x01
               | byte, ubyte          | Unsigned byte                        | 0x21
               | short                | 2-byte integer                       | 0x02
               | long, int, integer   | 4-byte integer                       | 0x04
               | word                 | 2-byte unsigned integer              | 0x22
               | dword, ulong, uint   | 4-byte unsigned integer              | 0x24
               | float, single        | Single precision floating-point      | 0x64
               | double               | Double precision floating-point      | 0x68
               | extended             | Extended precision floating-point    | 0x6A
               | quad                 | Quad precision floating-point (FPU)  | 0x48
               | qword                | 8-byte integer (FPU)                 | 0x58
String         | string               | Dynamic string                       | 0xe1
               | wstring              | Wide character string                | 0xe2
               | bstring, bstr, gstr_ | Binary string                        | 0xc1
               | wbstring             | Wide binary string                   | 0xc2
               | char, wchar          | Single and wide character            | 0xa1, 0xa2
               | asciiz, zstring      | Null-terminated string               | 0xa1
               | wzstring             | Wide null-terminated string          | 0xa2
Special        | sys                  | System-dependent type                | 0x08
               | any                  | Generic type for reference only      | 0x08
               | bool, boolean        | Boolean types                        | 0x04, 0x01
               | signed               | Signed numeric types                 | 0x04
               | unsigned             | Unsigned numeric types               | 0x24
               | fpu                  | Floating-point unit operations       | 0x40
Reference      | void                 | Used by reference only               | 0x10

[/code]

void      15 0x10 '* Used by-reference only
sbyte     15 0x01
byte      15 0x21
ubyte     15 0x21
string    15 0xe1
wstring   15 0xe2
bstring   15 0xc1
gstr_     15 0xc1 '* Accept any Bstring width. for core functions only
bstr      15 0xc1
wbstring  15 0xc2
char      15 0xa1
wchar     15 0xa2
cstr_     15 0xa1 '* Accept any char width. for core functions only
pstr_     15 0xb1 '* Accept any char width. for core functions (len returned in ecx)
asciiz    15 0xa1
zstring   15 0xa1
wzstring  15 0xa2
short     15 0x02
long      15 0x04
wide      15 0xa2
int       15 0x04
integer   15 0x04
float     15 0x64
single    15 0x64
double    15 0x68
extended  15 0x6A
quad      15 0x48 ''* using FPU on 32 bit systems (was 08), returns data on edx:eax
word      15 0x22
dword     15 0x24
ulong     15 0x24
uint      15 0x24
usys      15 0x28 '* 64 bit only
qword     15 0x58 '* using  FPU on 32 bit systems
any       15 0x08 '* to be used by reference only
sys       15 0x08 '* 4/8 depending on 32/64 bit system
bool      15 0x04 '* MS
boolean   15 0x01 '* MS
fpu       15 0x40 '* fast call using fpu registers (not exportable)
signed    15 0x04
unsigned  15 0x24
'===========================================


Zlatko Vid


Charles Pegge

Yes, ptr is a keyword but is not treated as a type.

It can be used same as '*'

int *i
int ptr i

Zlatko Vid


Zlatko Vid

Hi Charles

can you explain to me why this not work
it is simple CASE statement after SELECT

select  IJ.CurrToken.tkType
        print "TK_Type: " + str(IJ.CurrToken.tkType) + crlf ' OK printed->   4
         
        'next case not recognize TK_KEYWORD as 4 ? ..why ? compiler just skip over it ...
        case TK_KEYWORD
             print "AFTER_TK_KEYWORD: " + str(TK_KEYWORD) + crlf
           
            select  IJ.CurrToken.SubType
                 'print "Sub_Type: " + str(IJ.CurrToken.SubType) + crlf
 

i try all options to figure why CASE is ignored
i use latest version of o2 from sourceforge v 0.9

Charles Pegge

There should not be any code between select and its cases. Technically, this is because the select value is carried in a register, and any unexpected code will likely wipe it out.

Zlatko Vid

#6
OK I agree with that
so i will remove it ...thanks  :) 


EDIT:
Yes you right ,i simply forget that only under CASE can be other code  ::)
Now work !  ;)