diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-01-04 12:01:50 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-01-04 12:01:50 +0200 |
commit | 007b5a854a9ffbb2a5bc0b01fb50dbd54a33df42 (patch) | |
tree | b0d7aaa4ba40fde056169d1dddfd10d4fa1db264 /src/format.c | |
parent | b74252278ec81bea7b4a295d1cd49134ef03ee7c (diff) | |
download | grecs-007b5a854a9ffbb2a5bc0b01fb50dbd54a33df42.tar.gz grecs-007b5a854a9ffbb2a5bc0b01fb50dbd54a33df42.tar.bz2 |
Separate statement type and flags.
This change is incompatible with prior versions. Grecs users will have
to add a new field to their keyword definitions. See tests/gcfset.c
for an example.
* src/grecs.h (GRECS_DFLT): New flag.
(grecs_keyword) <flags>: New member.
* src/format.c: Use flags where appropriate.
* src/tree.c: Likewise.
* tests/gcfset.c: Likewise.
Diffstat (limited to 'src/format.c')
-rw-r--r-- | src/format.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/format.c b/src/format.c index ae2fa9e..0a360ca 100644 --- a/src/format.c +++ b/src/format.c @@ -126,7 +126,7 @@ grecs_print_simple_statement(struct grecs_keyword *kwp, unsigned level, { const char *argstr; - if (kwp->type & GRECS_INAC) + if (kwp->flags & GRECS_INAC) grecs_print_docstring(N_("Disabled;"), level, stream); if (kwp->docstring) grecs_print_docstring(kwp->docstring, level, stream); @@ -143,14 +143,12 @@ grecs_print_simple_statement(struct grecs_keyword *kwp, unsigned level, fprintf(stream, "%s <%s>;\n", kwp->ident, gettext(argstr)); else { fprintf(stream, "%s <%s: ", kwp->ident, gettext(argstr)); - if (GRECS_IS_LIST(kwp->type)) + if (kwp->flags & GRECS_LIST) fprintf(stream, "list of %s", - gettext(grecs_data_type_string( - GRECS_TYPE(kwp->type)))); + gettext(grecs_data_type_string(kwp->type))); else fprintf(stream, "%s", - gettext(grecs_data_type_string( - GRECS_TYPE(kwp->type)))); + gettext(grecs_data_type_string(kwp->type))); fprintf(stream, ">;\n"); } } @@ -183,7 +181,7 @@ grecs_print_statement_array(struct grecs_keyword *kwp, for (; kwp->ident; kwp++, n++) { if (n) fputc('\n', stream); - if (GRECS_TYPE(kwp->type) == grecs_type_section) + if (kwp->type == grecs_type_section) grecs_print_block_statement(kwp, level, stream); else grecs_print_simple_statement(kwp, level, stream); |