2026-02-10 10:25:08 -05:00
|
|
|
#ifndef GW_HAL_H
|
|
|
|
|
#define GW_HAL_H
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
|
|
/* Hardware Abstraction Layer vtable */
|
|
|
|
|
typedef struct hal_ops {
|
|
|
|
|
/* Terminal I/O */
|
|
|
|
|
void (*putch)(int ch);
|
|
|
|
|
void (*puts)(const char *s);
|
|
|
|
|
int (*getch)(void); /* blocking read */
|
|
|
|
|
bool (*kbhit)(void); /* key available? */
|
|
|
|
|
void (*locate)(int row, int col);
|
|
|
|
|
int (*get_cursor_row)(void);
|
|
|
|
|
int (*get_cursor_col)(void);
|
|
|
|
|
void (*cls)(void);
|
|
|
|
|
void (*set_width)(int cols);
|
|
|
|
|
|
2026-02-10 16:46:34 -05:00
|
|
|
/* Raw mode for INKEY$/INPUT$ */
|
|
|
|
|
void (*enable_raw)(void);
|
|
|
|
|
void (*disable_raw)(void);
|
|
|
|
|
|
|
|
|
|
/* Write raw bytes bypassing cursor tracking (for Sixel, etc.) */
|
|
|
|
|
void (*write_raw)(const char *data, int len);
|
|
|
|
|
|
2026-02-10 10:25:08 -05:00
|
|
|
/* Terminal properties */
|
|
|
|
|
int screen_width;
|
|
|
|
|
int screen_height;
|
2026-02-10 16:46:34 -05:00
|
|
|
bool is_tty;
|
2026-02-10 10:25:08 -05:00
|
|
|
|
|
|
|
|
/* Lifecycle */
|
|
|
|
|
void (*init)(void);
|
|
|
|
|
void (*shutdown)(void);
|
|
|
|
|
} hal_ops_t;
|
|
|
|
|
|
|
|
|
|
extern hal_ops_t *gw_hal;
|
|
|
|
|
|
|
|
|
|
/* Platform implementations */
|
|
|
|
|
hal_ops_t *hal_posix_create(void);
|
|
|
|
|
|
|
|
|
|
#endif
|