55 lines
1.1 KiB
C
55 lines
1.1 KiB
C
#ifndef EXAMPLE1_H
|
|
#define EXAMPLE1_H
|
|
|
|
////////////////////////////////
|
|
// Example 1 Header
|
|
|
|
#include <stdint.h>
|
|
typedef int8_t S8;
|
|
typedef int16_t S16;
|
|
typedef int32_t S32;
|
|
typedef int64_t S64;
|
|
typedef uint8_t U8;
|
|
typedef uint16_t U16;
|
|
typedef uint32_t U32;
|
|
typedef uint64_t U64;
|
|
typedef S8 B8;
|
|
typedef S16 B16;
|
|
typedef S32 B32;
|
|
typedef S64 B64;
|
|
typedef float F32;
|
|
typedef double F64;
|
|
|
|
typedef struct String8{
|
|
U8 *str;
|
|
U64 size;
|
|
} String8;
|
|
|
|
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_section ".sy.cmd"
|
|
#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
|