diff options
Diffstat (limited to 'doc/grecs_parse.3')
-rw-r--r-- | doc/grecs_parse.3 | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/doc/grecs_parse.3 b/doc/grecs_parse.3 index 357889f..c51ef95 100644 --- a/doc/grecs_parse.3 +++ b/doc/grecs_parse.3 @@ -16,7 +16,7 @@ .\" This file is part of SLB. .\" Copyright (C) 2011 Sergey Poznyakoff .\" -.TH GRECS_PARSE 3 "May 4, 2011" "GRECS" "Grecs User Reference" +.TH GRECS_PARSE 3 "May 7, 2011" "GRECS" "Grecs User Reference" .SH NAME grecs_parse \- parse a configuration file. .SH SYNOPSIS @@ -48,14 +48,18 @@ typedef struct grecs_node { struct grecs_node *next; struct grecs_node *prev; char *ident; - struct grecs_value value; + union { + struct grecs_value *value; + struct grecs_symtab *texttab; + } v; } grecs_node_t; .in .fi .PP The \fItype\fR member describes the type of this node. Its value is -\fBgrecs_node_stmt\fR for simple statements, and -\fBgrecs_node_block\fR, for block statements. +\fBgrecs_node_stmt\fR for simple statements and +\fBgrecs_node_block\fR, for block statements. The topmost node (the +one returned by \fBgrecs_tree_parse\fR) has type \fBgrecs_node_root\fR. .PP The \fIlocus\fR describes the location in the input file, which this node described. See @@ -97,8 +101,14 @@ pidfile "/var/run/mypid"; .sp will have \fBident\fR pointing to the string \fB/var/run/mypid\fR. .PP -Finally, the \fBvalue\fR member keeps the value associated with this -statement. It is defined as: +The \fBv\fR union keeps data which depend on the type of this node. +The \fBv.texttab\fR member is defined only for the root node (type +\fBgrecs_node_root\fR). It points to a symbol table which holds shared +strings for this tree. In particular, this table holds file names +referenced by \fBlocus\fR members of all underlying nodes. +.PP +For non-root nodes,the \fBv.value\fR member is defined. It points to +the value associated with this statement. A value is defined as: .sp .nf .in +5 @@ -106,10 +116,10 @@ typedef struct grecs_value { int type; union { struct grecs_list *list; - const char *string; + char *string; struct { size_t c; - struct grecs_value *v; + struct grecs_value **v; } arg; } v; } grecs_value_t; |