-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefines_notes.txt
More file actions
112 lines (85 loc) · 4.09 KB
/
defines_notes.txt
File metadata and controls
112 lines (85 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
MetaC Preprocessor - A macro processor for preprocessing usage.
Copyright (C) 2022 Jared A. Maddox
This program is free software; you can redistribute it and/or modify it
under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the:
Free Software Foundation, Inc.,
59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
These are several things that I'll need to grab from a separate code base.
LIB4_DEFINE_PASCALARRAY_STDDEFINE( prefix, element_type )
Results in "struct prefix##_pascalarray { len; body[]; };", plus some functions.
prefix##_pascalarray_result res = prefix##_pascalarray_build( size_t len );
prefix##_pascalarray_result res = prefix##_pascalarray_rebuild( prefix##_pascalarray*, size_t newlen );
lib4_result res = prefix##_pascalarray_destroy( prefix##_pascalarray* );
LIB4_MONAD_EITHER_BUILDTYPE_DEFINITION(
msg_piece_result,
msg_piece,
lib4_failure_uipresult
);
#define MSG_PIECE_RESULT_BUILDSUCCESS( val ) \
LIB4_MONAD_EITHER_BUILDLEFT( \
msg_piece_result, msg_piece, (val) \
)
#define MSG_PIECE_RESULT_BUILDFAILURE( val ) \
LIB4_MONAD_EITHER_BUILDRIGHT( \
msg_piece_result, lib4_failure_uipresult, (val) \
)
#define MSG_PIECE_RESULT_BODYMATCH( var, matcha, matchb ) \
LIB4_MONAD_EITHER_BODYMATCH( var, matcha, matchb )
#define MSG_PIECE_RESULT_EXPRMATCH( var, matcha, matchb ) \
LIB4_MONAD_EITHER_EXPRMATCH( var, matcha, matchb )
#define MSG_PIECE_RESULT_RETURNSUCCESS( val ) \
LIB4_MONAD_EITHER_RETURNLEFT( \
msg_piece_result, msg_piece, val )
#define MSG_PIECE_RESULT_RETURNFAILURE( val ) \
LIB4_MONAD_EITHER_RETURNRIGHT( \
msg_piece_result, lib4_failure_uipresult, val )
LIB4_OP_SETa( val )
LIB4_OP_SETb( val )
LIB4_OP_SETc( val )
LIB4_OP_SETd( val )
Defines for:
LIB4_MONAD_EITHER_BUILDTYPE_DEFINITION(
tokenheadptr_result,
token_head*,
uintptr_t
);
TOKENHEADPTR_RESULT_BUILDSUCCESS( val )
TOKENHEADPTR_RESULT_BUILDFAILURE( val )
TOKENHEADPTR_RESULT_BODYMATCH( var, matcha, matchb )
TOKENHEADPTR_RESULT_EXPRMATCH( var, matcha, matchb )
TOKENHEADPTR_RESULT_RETURNSUCCESS( val )
TOKENHEADPTR_RESULT_RETURNFAILURE( val )
Builder define for:
LIB4_DEFINE_PASCALARRAY_STDDEFINE( retframe_, retframe );
typedef retframe_pascalarray retframe_parr;
BUILD_RETFRAMEPARR( set )
stack_ENDRETFRAME( ... ) return( (retframe){ &end_run, (void*)0 } )
/* Old version: STACK_CHECK( stack, errfunc, errnum, ... ) */
STACK_CHECK( stack, stylesetptr, caller, endfunc )
/* Old version: STACK_CHECK2( stack, v, errfunc, errnum, ... ) */
STACK_CHECK2( stack, v, stylesetptr, caller, endfunc )
/* Old version: STACK_PEEK_UINT( stk, offset, var, errfunc, err1, err2, ... ) */
STACK_PEEK_UINT( stk, offset, dest, stylesetptr, caller, scratch, endfunc )
/* Old version: STACK_POP_UINT( stk, var, errfunc, err1, err2, ... ) */
STACK_POP_UINT( stk, dest, stylesetptr, caller, scratch, endfunc )
/* Old version: STACK_PUSH_UINT( stk, val, errfunc, err, ... ) */
STACK_PUSH_UINT( stk, val, stylesetptr, caller, scratch, endfunc )
STACK_SWAP_UINT( stk, tmp1, tmp2, stylesetptr, caller, scratch, endfunc )
/* Old version: CALL_FRAMEFUNC( rethand, retval, fhand, fval ) */
CALL_FRAMEFUNC( stkpair, rethand, retval, callhand, callval, stylesetptr, caller, scratch, endfunc )
RET_FRAMEFUNC( stkpair, stylesetptr, caller, scratch, endfunc )
Produces a couple definitions to produce a useful local version of setjump_*()
for use with longjump_*(). bookmark has to be the name of a uintptr_t variable,
localname will be a retframe_parr instance for use with enqueue_returns(),
onset_ptr and onjump_ptr must be compile-time pointers to retframe instances.
LOCALIZE_SETJUMP( bookmark, prefix, localname, onset_ptr, onjump_ptr )