c-scripting/symbol_set.starter.h

90 lines
2.6 KiB
C

/***********************************************************
** symbol_set - A public domain C modifier library
** by Allen Webster, "Mr. 4th", allenw@mr4th.com
**
** No warranty implied; use at your own risk
**
** Read README to get started.
*/
/****************************
*****************************
********** Setup **********
*****************************
****************************/
#if 0
/* In ever compilation unit, #include "symbol_set.h" once before using
** any symbol set features or defining a symbol set. */
#include "symbol_set.h"
/* In one compilation unit, #include "symbol_set.c" */
#include "symbol_set.c"
#endif
/******************************************
*******************************************
********** Define A Symbol Set **********
*******************************************
******************************************/
#if 0
/* To define a symbol set, copy-paste the block below and then:
** Replace ZZZ with a name for the symbol set.
** Replace Typezz with the type of the symbol set.
** Replace secz with a unique name for the data section of the symbol set.
** IMPORTANT NOTE: only use 4 characters for the section name if you
** want to port to Windows.
*/
#define SYMBOL_SET_DEFINE ZZZ
#define ZZZ_Type Typezz
#define ZZZ_section ".sy.secz"
#define ZZZ_marker secz
#include "symbol_set.define.h"
#endif
/****************************************************
*****************************************************
********** Common Symbol Defining Macros **********
*****************************************************
****************************************************/
#if 0
/* Define a basic struct with a NAME */
#define ZZZ_DEF(N,...) SyDefine(ZZZ, NAME) = { ... }
/* Define a basic struct without a name */
#define ZZZ_DEF(...) SyDefineUnnamed(ZZZ, NAME) = { ... }
/* Define a struct with a NAME & attach a function.
** Replace zzzprefix with a unique function prefix.
** Update the parameter and return types as needed.
*/
#define ZZZ_DEF(N,...) \
void zzzprefix_##N(void); \
SyDefine(ZZZ, NAME) = { ..., zzzprefix_##N }; \
void zzzprefix_##N(void)
/* Define a struct with a NAME & attach multiple functions
** Replace zzzprefix1... with unique function prefixes.
** Update the parameter and return types as needed.
** Replace ZZZ_PREFIX1... with appropriate names.
*/
#define ZZZ_DEF(N,...) \
void zzzprefix1_##N(void); \
void zzzprefix2_##N(void); \
SyDefine(ZZZ, NAME) = { ..., zzzprefix1_##N, zzzprefix2_##N }
#define ZZZ_PREFIX1(N) void zzzprefix1_##N(void)
#define ZZZ_PREFIX2(N) void zzzprefix2_##N(void)
#endif