Files
linuxcncWebWASM/wasm-core/include/sim_api.h

39 lines
1.1 KiB
C

#ifndef LINUXCNC_WEB_WASM_SIM_API_H
#define LINUXCNC_WEB_WASM_SIM_API_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
enum sim_result {
SIM_OK = 0,
SIM_ERR_INVALID_ARGUMENT = -1,
SIM_ERR_NOT_CREATED = -2,
SIM_ERR_BUFFER_TOO_SMALL = -3,
SIM_ERR_INVALID_STATE = -4,
SIM_ERR_UNSUPPORTED = -5,
};
/* Bootstrap ABI only. LinuxCNC behavior is added behind this stable boundary. */
int32_t sim_create(const uint8_t *config, uint32_t config_len);
int32_t sim_load_workspace(const char *root_path);
int32_t sim_command(const uint8_t *command, uint32_t command_len);
int32_t sim_step(uint32_t cycles);
uint32_t sim_read_snapshot(uint8_t *out, uint32_t capacity);
uint32_t sim_read_event(uint8_t *out, uint32_t capacity);
int32_t sim_export_state(uint8_t *out, uint32_t capacity);
int32_t sim_import_state(const uint8_t *data, uint32_t len);
uint32_t sim_core_checkpoint_size(void);
const char *sim_checkpoint_build_id(void);
int32_t sim_core_checkpoint_export(uint8_t *output, uint32_t capacity);
int32_t sim_core_checkpoint_restore(const uint8_t *input, uint32_t length);
void sim_destroy(void);
#ifdef __cplusplus
}
#endif
#endif