a token list More...
#include <ellipsis-tlist.h>
Public Member Functions | |
token * | ellipsis‿token‿list‿all (ellipsis‿token‿list[static 1]) |
remove all tokens form the list and return the first | |
void | ellipsis‿token‿list‿append (ellipsis‿token‿list[static 1], token *) |
apend a token and all its followers to the list | |
void | ellipsis‿token‿list‿close (ellipsis‿token‿list[static 1]) |
Close a token list for_DEFER_REPLAY_FOR append operations by a producer. | |
size_t | ellipsis‿token‿list‿collect_call (size_t len, ellipsis‿token‿list arg[static len], ellipsis‿token‿list in[restrict static 1], bool var, ellipsis‿str32 const *space[static 1]) |
collect the arguments for_DEFER_REPLAY_FOR a macro call | |
ellipsis‿token‿list * | ellipsis‿token‿list‿cpy‿_Ctra (ellipsis‿token‿list __LOC_ID_0_5[static const 1]) |
create a new token list by deep copying the pointed to token list | |
ellipsis‿token‿list * | ellipsis‿token‿list‿cpy‿_Insta (ellipsis‿token‿list __LOC_ID_0_2[static const 1]) |
create a new token list by deep copying the pointed to token list | |
ellipsis‿token‿list * | ellipsis‿token‿list‿cpy (ellipsis‿token‿list __LOC_ID_0_2[static const 1]) |
create a new token list by deep copying the pointed to token list | |
void | ellipsis‿token‿list‿delete (ellipsis‿token‿list *tl) |
delete all tokens and free the list itself | |
void | ellipsis‿token‿list‿destroy (ellipsis‿token‿list[static 1]) |
destroy all elements in a token list. | |
bool | ellipsis‿token‿list‿equiv (ellipsis‿token‿list *a, ellipsis‿token‿list *b) |
Check if two token lists are token equivalent. | |
token * | ellipsis‿token‿list‿first (ellipsis‿token‿list[static 1]) |
Access a token list. | |
void | ellipsis‿token‿list‿flush (ellipsis‿token‿list target[static 1], ellipsis‿token‿list source[static 1]) |
append the whole contents of source to target | |
ellipsis‿token‿list * | ellipsis‿token‿list‿init‿_Ctra (ellipsis‿token‿list __LOC_ID_0_4[static const 1]) |
Initialize a token list. | |
ellipsis‿token‿list * | ellipsis‿token‿list‿init‿_Insta (ellipsis‿token‿list __LOC_ID_0_1[static const 1]) |
Initialize a token list. | |
ellipsis‿token‿list * | ellipsis‿token‿list‿init (ellipsis‿token‿list __LOC_ID_0_1[static const 1]) |
Initialize a token list. | |
bool | ellipsis‿token‿list‿is_finished (ellipsis‿token‿list[static 1]) |
token * | ellipsis‿token‿list‿last (ellipsis‿token‿list[static 1]) |
Access the last element of a token list. | |
void | ellipsis‿token‿list‿move (ellipsis‿token‿list *__LOC_ID_0_7[restrict static 1], ellipsis‿token‿list **restrict __LOC_ID_0_8) |
Move a ellipsis‿token‿list pointed to by the second parameter to the one pointed to by the first. | |
ellipsis‿token‿list * | ellipsis‿token‿list‿new (void) |
allocate and return a new empty list | |
void | ellipsis‿token‿list‿open (ellipsis‿token‿list[static 1]) |
Open a token list for_DEFER_REPLAY_FOR append operations by a producer. | |
token * | ellipsis‿token‿list‿pop (ellipsis‿token‿list[static 1]) |
pop a token form the list | |
void | ellipsis‿token‿list‿push (ellipsis‿token‿list target[static 1], ellipsis‿token‿list source[static 1]) |
prepend the whole contents of source to target | |
ellipsis‿str32 * | ellipsis‿token‿list‿stringify‿_Ctra (ellipsis‿token‿list const __LOC_ID_0_6[static const 1]) |
stringify the whole source list into one string token | |
ellipsis‿str32 * | ellipsis‿token‿list‿stringify‿_Insta (ellipsis‿token‿list const __LOC_ID_0_3[static const 1]) |
stringify the whole source list into one string token | |
ellipsis‿str32 * | ellipsis‿token‿list‿stringify (ellipsis‿token‿list const __LOC_ID_0_3[static const 1]) |
stringify the whole source list into one string token | |
token const * | ellipsis‿token‿list‿top (ellipsis‿token‿list[static 1]) |
Peek into a token list. | |
void | ellipsis‿token‿list‿wait (ellipsis‿token‿list[static 1]) |
Wait until the token list is finished. | |
Private Attributes | |
Internal members | |
| |
mtx_t | mtx |
cnd_t | cnd |
token * | first |
token * | last |
bool | finished |
a token list
Do not use any of its members directly, but only through its functions.
This list is meant to be thread safe. A producer may append new elements into an open list, and a consumer may then pop these from the list. The consumer is blocked if there is no element left and the list is not closed.
token * ellipsis‿token‿list‿all | ( | ellipsis‿token‿list | [static 1] | ) |
remove all tokens form the list and return the first
References cnd, ellipsis‿error‿finished, ELLIPSIS_WARNING, finished, first, last, and mtx.
void ellipsis‿token‿list‿append | ( | ellipsis‿token‿list | [static 1], |
token * | |||
) |
apend a token and all its followers to the list
References cnd, first, last, mtx, and ellipsis‿token::next.
void ellipsis‿token‿list‿close | ( | ellipsis‿token‿list | [static 1] | ) |
size_t ellipsis‿token‿list‿collect_call | ( | size_t | len, |
ellipsis‿token‿list | arg[static len], | ||
ellipsis‿token‿list | in[restrict static 1], | ||
bool | var, | ||
ellipsis‿str32 const * | space[static 1] | ||
) |
collect the arguments for_DEFER_REPLAY_FOR a macro call
len
is the total number of arguments that is to be expected, including a possible final ...
list. Or said differently, the function switches to the next argument whenever a top-level comma is encountered but only until the last possible argument in position len-1
. Then commas, are included in this final argument.
Parenthesis have to be properly nested, and only commas that are not between such matching parenthesis account as being top-level.
|
inline |
create a new token list by deep copying the pointed to token list
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ellipsis‿token‿list‿cpy‿_Inner(), and ELLIPSIS_CONTRACT.
|
inline |
create a new token list by deep copying the pointed to token list
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
end inner defer anchor, level 1
|
inline |
create a new token list by deep copying the pointed to token list
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ELLIPSIS_CONTRACT.
|
inline |
delete all tokens and free the list itself
References ellipsis‿token‿list‿destroy().
void ellipsis‿token‿list‿destroy | ( | ellipsis‿token‿list | [static 1] | ) |
destroy all elements in a token list.
Any object of the ellipsis‿token‿list
type has to be destroyed by this function. Otherwise the elements are leaked.
References ellipsis‿token‿list‿all().
bool ellipsis‿token‿list‿equiv | ( | ellipsis‿token‿list * | a, |
ellipsis‿token‿list * | b | ||
) |
Check if two token lists are token equivalent.
token * ellipsis‿token‿list‿first | ( | ellipsis‿token‿list | [static 1] | ) |
Access a token list.
References first.
void ellipsis‿token‿list‿flush | ( | ellipsis‿token‿list | target[static 1], |
ellipsis‿token‿list | source[static 1] | ||
) |
append the whole contents of source to target
References cnd, ellipsis‿token‿list‿close(), first, last, mtx, and ellipsis‿token::next.
|
inline |
Initialize a token list.
Any object of the ellipsis‿token‿list
type has to be initialized by this function.
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ellipsis‿token‿list‿init‿_Inner(), and ELLIPSIS_CONTRACT.
|
inline |
Initialize a token list.
Any object of the ellipsis‿token‿list
type has to be initialized by this function.
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
end inner defer anchor, level 1
|
inline |
Initialize a token list.
Any object of the ellipsis‿token‿list
type has to be initialized by this function.
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ELLIPSIS_CONTRACT.
bool ellipsis‿token‿list‿is_finished | ( | ellipsis‿token‿list | [static 1] | ) |
token * ellipsis‿token‿list‿last | ( | ellipsis‿token‿list | [static 1] | ) |
Access the last element of a token list.
References last.
|
inline |
Move a ellipsis‿token‿list
pointed to by the second parameter to the one pointed to by the first.
If target
is not null before, the old pointed-to object is deleted.
|
inline |
allocate and return a new empty list
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ellipsis‿malloc, and ELLIPSIS_CONTRACT.
void ellipsis‿token‿list‿open | ( | ellipsis‿token‿list | [static 1] | ) |
token * ellipsis‿token‿list‿pop | ( | ellipsis‿token‿list | [static 1] | ) |
pop a token form the list
Return a null pointer if the list is empty.
References _Atomic(), cnd, ellipsis‿error‿finished, ELLIPSIS_WARNING, finished, first, last, mtx, and ellipsis‿token::next.
void ellipsis‿token‿list‿push | ( | ellipsis‿token‿list | target[static 1], |
ellipsis‿token‿list | source[static 1] | ||
) |
prepend the whole contents of source to target
References cnd, ellipsis‿token‿list‿close(), ELLIPSIS_BUG, first, last, mtx, and ellipsis‿token::next.
|
inline |
stringify the whole source list into one string token
The source is not modified. The return token is newly allocated.
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ellipsis‿token‿list‿stringify‿_Inner(), and ELLIPSIS_CONTRACT.
|
inline |
stringify the whole source list into one string token
The source is not modified. The return token is newly allocated.
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
end inner defer anchor, level 1
|
inline |
stringify the whole source list into one string token
The source is not modified. The return token is newly allocated.
start inner defer anchor at level 1
DEFER_TYPE needs a semicolon
defer needs braces and a semicolon
end inner defer anchor, level 1
References ELLIPSIS_CONTRACT.
token const * ellipsis‿token‿list‿top | ( | ellipsis‿token‿list | [static 1] | ) |
Peek into a token list.
References first.
void ellipsis‿token‿list‿wait | ( | ellipsis‿token‿list | [static 1] | ) |
Wait until the token list is finished.
References cnd, ellipsis‿error‿finished, ELLIPSIS_WARNING, finished, and mtx.
|
private |
|
private |
|
private |
Referenced by ellipsis‿token‿dictionary::ellipsis‿token‿dictionary‿fputs(), ellipsis‿token‿list‿all(), ellipsis‿token‿list‿append(), ellipsis‿token‿list‿cpy‿_Inner(), ellipsis‿token‿list‿first(), ellipsis‿token‿list‿flush(), ellipsis‿token‿list‿pop(), ellipsis‿token‿list‿push(), ellipsis‿token‿list‿stringify‿_Inner(), and ellipsis‿token‿list‿top().
|
private |
|
private |
{
Referenced by ellipsis‿token‿list‿all(), ellipsis‿token‿list‿append(), ellipsis‿token‿list‿close(), ellipsis‿token‿list‿flush(), ellipsis‿token‿list‿init‿_Inner(), ellipsis‿token‿list‿is_finished(), ellipsis‿token‿list‿open(), ellipsis‿token‿list‿pop(), ellipsis‿token‿list‿push(), and ellipsis‿token‿list‿wait().