Skip to content

aowlspt_shim.h

Source: abi/aowlspt_shim.h — 849 lines, 127 file-scope functions.

What this header owns

Reproduced verbatim from the header's own banner comment — these notes are frequently the only written record of why the subsystem is shaped the way it is.

text
 aowlspt_shim.h — the C side of the nimony hosts.

nimony will not `cast` between a `pointer` and a `proc` type, in either
direction, and not through an integer either. Two things a host must do run
straight into that:

  * calling a mod, whose entry points arrive as `GetProcAddress` results and
    as function-pointer fields inside `AowlModApi`;
  * being called by a mod, which needs the host's own functions as pointers
    inside `AowlHostApi`.

So the indirect calls live here, in C, and everything above them is nimony.
That split is not a workaround so much as the right layering: `aowlspt_abi.h`
is a C header, and a C file that `#include`s it cannot disagree with it about
struct layout or field order. The alternative — restating the layout in
nimony — is exactly the mistake `tests/abi_layout.nim` exists to catch.

Everything here is `static`: this header is included once, into the single
translation unit nimony emits.

The naming convention is `aowl_<area>_<what>`. Functions the *nimony* side
implements and C calls back into are declared `extern` and named
`aowlspt_nim_*`.

Constants

  • AOWLSPT_SHIM_H

Types

  • struct AowlArgs
  • struct AowlHostBlock
  • struct AowlRegs

Functions

SignatureLine
void aowl_p_v(void* f)46
void aowl_p_p(void* f, void* a)47
LONG CALLBACK aowl_seh_veh(PEXCEPTION_POINTERS ep)58
void aowl_p_p_seh(void* f, void* a)66
void aowl_p_pp(void* f, void* a, void* b)79
void aowl_p_ppp(void* f, void* a, void* b, void* c)80
void aowl_p_pppp(void* f, void* a, void* b, void* c, void* d)81
void aowl_p_ppi(void* f, void* a, void* b, int32_t i)82
void aowl_p_pz(void* f, void* a, uint64_t z)83
void aowl_p_u(void* f, uint32_t u)84
void aowl_v_v(void* f)86
void aowl_v_p(void* f, void* a)87
void aowl_v_pp(void* f, void* a, void* b)88
void aowl_v_ppp(void* f, void* a, void* b, void* c)89
void aowl_v_u(void* f, uint32_t u)90
int32_t aowl_i32_p(void* f, void* a)92
uint32_t aowl_u32_p(void* f, void* a)93
uint64_t aowl_z_p(void* f, void* a)94
uint32_t aowl_u32_pi(void* f, void* a, int32_t i)95
uint32_t aowl_u32_pp(void* f, void* a, void* b)96
uint8_t aowl_byte_at(void* p, uint64_t i)101
uint16_t aowl_word_at(void* p, uint64_t i)102
void aowl_modinfo_new(void)111
void aowl_modinfo_free(void* p)116
int32_t aowl_modinfo_size(void* p)117
uint32_t aowl_modinfo_abi_version(void* p)118
uint32_t aowl_modinfo_abi_revision(void* p)119
uint32_t aowl_modinfo_sides(void* p)120
uint32_t aowl_modinfo_flags(void* p)121
void aowl_modinfo_guid_ptr(void* p)126
int32_t aowl_modinfo_guid_len(void* p)127
void aowl_modinfo_name_ptr(void* p)128
int32_t aowl_modinfo_name_len(void* p)129
void aowl_modinfo_author_ptr(void* p)130
int32_t aowl_modinfo_author_len(void* p)131
void aowl_modinfo_version_ptr(void* p)132
int32_t aowl_modinfo_version_len(void* p)133
void aowl_modinfo_range_ptr(void* p)134
int32_t aowl_modinfo_range_len(void* p)135
uint32_t aowl_mod_abi_version(void* fn)141
int32_t aowl_mod_describe(void* fn, void* info)144
int32_t aowl_mod_init(void* fn, void* host, void* out)147
void aowl_modapi_new(void)151
void aowl_modapi_free(void* p)156
int32_t aowl_modapi_has_update(void* p)158
int32_t aowl_modapi_has_load(void* p)159
int32_t aowl_modapi_has_unload(void* p)160
int32_t aowl_modapi_on_load(void* p)162
int32_t aowl_modapi_on_update(void* p, int64_t elapsed)167
int32_t aowl_modapi_on_unload(void* p)172
void* AOWLSPT_CALL aowl_host_alloc(void* ctx, int32_t bytes)227
void AOWLSPT_CALL aowl_host_free(void* ctx, void* p)232
void AOWLSPT_CALL aowl_host_log(void* ctx, int32_t level, AowlSlice msg)237
void AOWLSPT_CALL aowl_host_last_error(void* ctx, AowlSlice* out)241
AowlStatus AOWLSPT_CALL aowl_host_config_get(void* ctx, AowlSlice key, AowlBuffer* out)248
AowlStatus AOWLSPT_CALL aowl_host_config_set(void* ctx, AowlSlice key, AowlSlice value)255
AowlStatus AOWLSPT_CALL aowl_host_db_get(void* ctx, AowlSlice path, AowlBuffer* out)263
AowlStatus AOWLSPT_CALL aowl_host_db_patch(void* ctx, AowlSlice path, AowlSlice patch)271
AowlStatus AOWLSPT_CALL aowl_host_route_register(void* ctx, AowlSlice url, int32_t kind, AowlRouteFn h, void* user)275
AowlStatus AOWLSPT_CALL aowl_host_event_subscribe(void* ctx, AowlSlice name, AowlCallbackFn h, void* user)281
AowlStatus AOWLSPT_CALL aowl_host_event_emit(void* ctx, AowlSlice name, AowlSlice payload)285
AowlStatus AOWLSPT_CALL aowl_host_call(void* ctx, AowlSlice target, AowlSlice args, AowlBuffer* out)290
AowlStatus AOWLSPT_CALL aowl_host_resolve(void* ctx, AowlSlice typeName, AowlHandle* out)299
void AOWLSPT_CALL aowl_host_handle_release(void* ctx, AowlHandle h)306
AowlStatus AOWLSPT_CALL aowl_host_patch(void* ctx, AowlSlice target, int32_t kind, AowlPatchFn h, void* user)310
AowlStatus AOWLSPT_CALL aowl_host_schedule(void* ctx, int32_t delayMs, AowlCallbackFn cb, void* user)316
AowlStatus AOWLSPT_CALL aowl_host_invoke_main(void* ctx, AowlCallbackFn cb, void* user)320
int64_t AOWLSPT_CALL aowl_host_now_ms(void* ctx)323
AowlStatus AOWLSPT_CALL aowl_host_store_get(void* ctx, AowlSlice key, AowlBuffer* out)327
AowlStatus AOWLSPT_CALL aowl_host_store_set(void* ctx, AowlSlice key, AowlSlice value)335
AowlStatus AOWLSPT_CALL aowl_host_store_list(void* ctx, AowlSlice prefix, AowlBuffer* out)340
int32_t aowl_invoke_callback(void* cb, void* user, void* payload, int32_t len)357
int32_t aowl_invoke_route(void* cb, void* user, void* url, int32_t urlLen, void* body, int32_t bodyLen, void* session, int32_t sessionLen, void* outPtrRaw, void* outLenRaw)367
void aowl_host_release(void* p)384
int32_t aowl_invoke_patch_args(void* cb, void* user, void* target, int32_t tlen, void* args, int32_t alen, void* outPtrRaw, void* outLenRaw)393
int32_t aowl_invoke_patch(void* cb, void* user, void* target, int32_t tlen)414
AowlSlice aowl_block_str(AowlHostBlock* b, const char* s)446
void aowl_hostapi_new(void* ctx, int32_t side, const char* hostName, const char* hostVersion, const char* sptVersion, const char* gameVersion, const char* modDir, const char* dataDir)460
void aowl_hostapi_free(void* p)527
void aowl_hostapi_ptr(void* p)531
uint32_t aowl_abi_version_expected(void)533
int32_t aowl_hostapi_sizeof(void)534
int32_t aowl_modapi_sizeof(void)535
int32_t aowl_modinfo_sizeof(void)536
int32_t aowl_out_copy(void* outPtrRaw, void* outLenRaw, void* src, int32_t len)540
void aowl_args_new(int32_t n)571
void aowl_args_free(void* p)577
void aowl_args_ptr(void* p)578
void aowl_args_set_ref(void* p, int32_t i, void* v)584
void aowl_args_set_i32(void* p, int32_t i, int32_t v)591
void aowl_args_set_i64(void* p, int32_t i, int64_t v)597
void aowl_args_set_f32(void* p, int32_t i, double v)603
void aowl_args_set_f64(void* p, int32_t i, double v)609
int32_t aowl_is_code_pointer(void* p)623
int32_t aowl_is_readable(void* p, int32_t size)639
void aowl_read_ptr(void* p, int32_t off)660
int32_t aowl_read_i32(void* p)667
int64_t aowl_read_i64(void* p)668
uint64_t aowl_regs_int(void* p, int32_t i)690
double aowl_regs_flt(void* p, int32_t i)701
double aowl_regs_f32(void* p, int32_t i)723
void aowl_regs_set_ret_int(void* p, uint64_t v)731
void aowl_regs_set_ret_f32(void* p, double v)734
void aowl_regs_set_ret_f64(void* p, double v)741
int32_t aowl_regs_sizeof(void)747
uint64_t aowl_regs_ret_int(void* p)757
double aowl_regs_ret_f64(void* p)760
double aowl_regs_ret_f32(void* p)766
void aowl_cell_new(void)781
void aowl_cell_free(void* p)782
void aowl_cell_set_i32(void* p, int32_t v)783
void aowl_cell_set_i64(void* p, int64_t v)784
void aowl_cell_set_f32(void* p, double v)785
void aowl_cell_set_f64(void* p, double v)786
void aowl_cell_set_ptr(void* p, void* v)787
void aowl_cell_get_ptr(void* p)788
double aowl_read_f32(void* p)790
double aowl_read_f64(void* p)791
void aowl_sys_anchor(void)805
int32_t aowl_sys_module_path(char* buf, int32_t cap)807
uint64_t aowl_sys_now_ms(void)818
void aowl_sys_sleep(int32_t ms)822
uint32_t aowl_sys_thread_id(void)826
void aowl_sys_load_library(const char* path)833
void aowl_sys_free_library(void* h)836
void aowl_sys_get_proc(void* h, const char* name)839
uint32_t aowl_sys_last_error(void)843

aoughwl — self-hosted platform for things n stuff. Contact / Support on Discord for access to the private backends.