Qbasicnews.com

Full Version: Intrinsic macros?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The docs say keywords as HIBYTE are "intrinsic macros". Does this mean they can't be found in header files?
I did a search in the inc folder for HIBYTE and did'nt found it...
they are "built in" into compiler as far as i know
You're right! I found them in DATA lines in rtl.bas

Code:
'' name, args, arg[0] to arg[n] names, macro text
imacrodata:
''#define RGB(r,g,b) ((cuint(r) shl 16) or (cuint(g) shl 8) or cuint(b))
data "RGB", 3, "R", "G", "B", "((cuint(#R#) shl 16) or (cuint(#G#) shl 8) or cuint(#B#))"

''#define va_arg(a,t) peek( t, a )
data "VA_ARG", 2, "A", "T", "peek( #T#, #A# )"
''#define va_next(a,t) (a + len( t ))
data "VA_NEXT", 2, "A", "T", "(#A# + len( #T# ))"

'#ifndef FB__BIGENDIAN
''#define LOWORD(x) (cuint(x) and &h0000FFFF)
data "LOWORD", 1, "X", "(cuint(#X#) and &h0000FFFF)"
''#define HIWORD(x) (cyint(x) shr 16)
data "HIWORD", 1, "X", "(cuint(#X#) shr 16)"
''#define LOBYTE(x) (cuint(x) and &h000000FF)
data "LOBYTE", 1, "X", "(cuint(#X#) and &h000000FF)"
''#define HIBYTE(x) ((cuint(x) and &h0000FF00) shr 8)
data "HIBYTE", 1, "X", "((cuint(#X#) and &h0000FF00) shr 8)"
''#define BIT(x,y) (((x) and (1 shl (y))) > 0)
data "BIT", 2, "X", "Y", "(((#X#) and (1 shl (#Y#))) <> 0)"
''#define BITSET(x,y) ((x) or (1 shl (y)))
data "BITSET", 2, "X", "Y", "((#X#) or (1 shl (#Y#)))"
''#define BITRESET(x,y) ((x) and not (y))
data "BITRESET", 2, "X", "Y", "((#X#) and not (1 shl (#Y#)))"
'#endif