#include "gwion_util.h"
#include "gwion_ast.h"
Go to the source code of this file.
◆ ANN2()
Definition at line 46 of file pparg.c.
46 {
47 if (!
ppa->hash.table) hini(&
ppa->hash, 127);
49 const m_str arg = strchr(
str,
'(');
51 const m_str body = strchr(
str,
'=');
53 m->file = "command line";
54 return true;
55}
static ANN GwText * pparg_body(PPArg *ppa, const m_str str)
static ANN Macro pparg_def(PPArg *ppa, const m_str str)
static ANN MacroArg pparg_arg(PPArg *ppa, m_str src)
◆ pparg_arg()
Definition at line 20 of file pparg.c.
20 {
21 const size_t sz = strlen(src);
22 char buf[sz + 1];
23 for (m_uint i = 0; i < sz; ++i) {
24 const char c = src[i];
25 if (c == ')') {
26 buf[i] = '\0';
28 }
29 if (c == ',') {
30 buf[i] = '\0';
33 return arg;
34 }
35 buf[i] = c;
36 }
38}
MacroArg new_macroarg(MemPool p, const m_str name)
◆ pparg_body()
static ANN GwText * pparg_body |
( |
PPArg * | ppa, |
|
|
const m_str | str ) |
|
static |
Definition at line 40 of file pparg.c.
40 {
41 GwText *text = new_text(
ppa->hash.p);
43 return text;
44}
◆ pparg_def()
static ANN Macro pparg_def |
( |
PPArg * | ppa, |
|
|
const m_str | str ) |
|
static |
Definition at line 4 of file pparg.c.
4 {
5 const ssize_t sz = strlen(
str);
6 char base[sz + 1];
7 m_str def = strchr(
str,
'(') ?: strchr(
str,
'=');
8 const ssize_t idx = def ? (def -
str) : sz;
9 strncpy(base,
str, idx);
10 base[idx] = '\0';
12 if (m) {
14 return m;
15 }
18}
Macro macro_add(const Hash, m_str)
◆ pparg_end()
ANN void pparg_end |
( |
PPArg * | a | ) |
|
Definition at line 62 of file pparg.c.
62 {
63 vector_release(&a->
path);
67 }
68}
void macro_del(const Hash)
◆ pparg_ini()
ANN void pparg_ini |
( |
MemPool | mp, |
|
|
PPArg * | a ) |
Definition at line 57 of file pparg.c.
57 {
59 vector_init(&a->
path);
60}