c-scripting/examples/example1.h

37 lines
883 B
C

#ifndef EXAMPLE1_H
#define EXAMPLE1_H
////////////////////////////////
// Example Specifics
typedef struct EX1_Ctx{
S64 foo;
} EX1_Ctx;
typedef void EX1_Hook(EX1_Ctx *ctx);
typedef struct EX1_Command{
String8 name;
String8 description;
EX1_Hook *hook;
} EX1_Command;
#define SYMBOL_SET_DEFINE EX1_COMMAND
#define EX1_COMMAND_Type EX1_Command
#define EX1_COMMAND_elf_section ".sy.cmd"
#define EX1_COMMAND_coff_a_section ".sy$cmd_a"
#define EX1_COMMAND_coff_m_section ".sy$cmd_m"
#define EX1_COMMAND_coff_z_section ".sy$cmd_z"
#define EX1_COMMAND_marker cmd
#include "symbol_set.define.h"
#define COMMAND_SCRIPT(N,desc) \
void ex1_command__##N(EX1_Ctx *ctx); \
SyDefine(EX1_COMMAND, N) = { \
.name = {(U8*)#N, sizeof(#N) - 1}, \
.description = {(U8*)desc, sizeof(desc) - 1}, \
.hook = ex1_command__##N }; \
void ex1_command__##N(EX1_Ctx *ctx)
#endif //EXAMPLE1_H