definition prep (still exploring..)

This commit is contained in:
2025-08-07 01:53:15 -04:00
parent 8b252c4e68
commit 046800b9d8
13 changed files with 247 additions and 69 deletions
+13 -13
View File
@@ -34,7 +34,7 @@ enum {
#define def_enum(underlying_type, symbol) underlying_type symbol; enum symbol
#define def_struct(symbol) struct symbol symbol; struct symbol
#define def_union(symbol) union symbol symbol; union symbol
#define fn(symbol) symbol
#define def_proc(symbol) symbol
#define opt_args(symbol, ...) &(symbol){__VA_ARGS__}
#define ret_type(type) type
#define local_persist static
@@ -54,19 +54,19 @@ enum {
#define giga(n) (cast(SSIZE, n) << 30)
#define tera(n) (cast(SSIZE, n) << 40)
#define range_iter(type, iter, m_begin, op, m_end) \
tmpl(Iter_Range,type) iter = { \
.r = {(m_begin), (m_end)}, \
.cursor = (m_begin) }; \
iter.cursor op iter.r.end; \
#define span_iter(type, iter, m_begin, op, m_end) \
tmpl(Iter_Span,type) iter = { \
.r = {(m_begin), (m_end)}, \
.cursor = (m_begin) }; \
iter.cursor op iter.r.end; \
++ iter.cursor
#define def_range(type) \
def_struct(tmpl( Range,type)) { type begin; type end; }; \
typedef def_struct(tmpl(Iter_Range,type)) { tmpl(Range,type) r; type cursor; }
#define def_span(type) \
def_struct(tmpl( Span,type)) { type begin; type end; }; \
typedef def_struct(tmpl(Iter_Span,type)) { tmpl(Span,type) r; type cursor; }
typedef def_range(S32);
typedef def_range(U32);
typedef def_range(SSIZE);
typedef def_span(S32);
typedef def_span(U32);
typedef def_span(SSIZE);
typedef void fn(VoidFn) (void);
typedef void def_proc(VoidFn) (void);
+5 -5
View File
@@ -1,6 +1,7 @@
#ifdef INTELLISENSE_DIRECTIVES
# pragma once
# include "dsl.h"
# include "math.h"
#endif
typedef def_enum(U32, gp_Commands) {
@@ -72,6 +73,8 @@ typedef def_enum(U32, gp_Commands) {
#define gp_SetArea_TopLeft (gcmd_SetDrawArea_TopLeft << gcmd_offset)
#define gp_SetArea_BottomRight (gcmd_SetDrawArea_BotRight << gcmd_offset)
typedef def_struct(RGB8) { BYTE r; BYTE g; BYTE b; };
typedef BYTE gp_Pixel16[1];
typedef BYTE gp_Pixel24[3];
@@ -80,9 +83,6 @@ typedef BYTE gp_Pixel24[3];
#define gp_b16_X 0
#define gp_b16_Y 16
typedef def_struct(gp_Vec2) {
U16 x;
U16 y;
};
typedef def_struct(gp_Vec2) { U16 y; U16 x; };
void gp_screen_init();
void gp_screen_init(void) __asm__("gp_screen_init");
+21
View File
@@ -0,0 +1,21 @@
#ifdef INTELLISENSE_DIRECTIVES
# pragma once
# include "dsl.h"
#endif
typedef def_farray(S16, 2);
typedef def_farray(S32, 2);
// typedef def_farray(F32, 2);
typedef def_struct(Extent_2S16) { S16 width; S16 height; };
typedef def_struct(Extent_2S32) { S32 width; S32 height; };
// typedef def_struct(Extent_2F32) { F32 width; F32 height; }
typedef def_struct(Vec_2S16) { S16 x; S16 y; };
typedef def_struct(Vec_2S32) { S32 x; S32 y; };
// typedef def_struct(Vec_2F32) { F32 x; F32 y; };
typedef def_struct(Range_2S16) { Vec_2S16 p0; Vec_2S16 p1; };
typedef def_struct(Range_2S32) { Vec_2S32 p0; Vec_2S32 p1; };
// typedef def_struct(Range_2F32) { Vec_2F32 p0; Vec_2F32 p1; };
typedef def_struct(Rect_S16) { S16 x; S16 y; S16 width; S16 height; };
typedef def_struct(Rect_S32) { S32 x; S32 y; S32 width; S32 height; };