summaryrefslogtreecommitdiffabout
path: root/doc
authorSergey Poznyakoff <gray@gnu.org.ua>2011-07-01 15:59:30 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-07-01 15:59:30 (GMT)
commit6c28bd628ede02dfb6e8a5520d0b43cd19c03b57 (patch) (side-by-side diff)
tree1430e744ceddadc5bb73300ebc13ae4ff1049569 /doc
parenta01d5e230db6f61a6efd3384f1eafe184944c45d (diff)
downloadgrecs-6c28bd628ede02dfb6e8a5520d0b43cd19c03b57.tar.gz
grecs-6c28bd628ede02dfb6e8a5520d0b43cd19c03b57.tar.bz2
Update the docs.
Diffstat (limited to 'doc') (more/less context) (ignore whitespace changes)
-rw-r--r--doc/grecs_error.364
-rw-r--r--doc/grecs_parse.310
2 files changed, 68 insertions, 6 deletions
diff --git a/doc/grecs_error.3 b/doc/grecs_error.3
index 4f82dc5..1c2b62f 100644
--- a/doc/grecs_error.3
+++ b/doc/grecs_error.3
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_ERROR 3 "May 4, 2011" "GRECS" "Grecs User Reference"
+.TH GRECS_ERROR 3 "July 1, 2011" "GRECS" "Grecs User Reference"
.SH NAME
grecs_error, grecs_warning \- grecs error reporting functions
.SH SYNOPSIS
@@ -86,19 +86,73 @@ System error code, or \fB0\fR, if no system error occurred.
.I msg
Formatted message.
.PP
-The \fBgrecs_locus_t\fR structure is defined as:
+The \fBgrecs_locus_t\fR structure consists of two \fBpoints\fR, each
+point describing the beginning and the end of the input fragment in
+question:
.sp
.nf
.in +5
-typedef struct {
+struct grecs_locus_point {
char *file;
- int line;
+ unsigned line;
+ unsigned col;
+};
+typedef struct {
+ struct grecs_locus_point beg;
+ struct grecs_locus_point end;
} grecs_locus_t;
.in
.fi
.PP
The \fBfile\fR member points to the file name, and the \fBline\fR
-member contains the input line number.
+member contains the input line number and the \fBcol\fR member
+contains the column number. Both lines and columns are numbered from
+1.
+.PP
+On output, the \fBgrecs_locus_t\fR structure is formatted as follows:
+.sp
+.nf
+.in +5
+\fBBEGFILE\fR:\fBBEGLINE\fR.\fBBEGCOL\fR\-\fBENDFILE\fR:\fBENDLINE\fR.\fBENDCOL\fR
+.in
+.fi
+.PP
+If \fBBEGFILE\fR equals \fBENDFILE\fR in the sense of
+.BR strcmp (3),
+then the output is contracted to:
+.sp
+.nf
+.in +5
+\fBFILE\fR:\fBBEGLINE\fR.\fBBEGCOL\fR\-\fBENDLINE\fR.\fBENDCOL\fR
+.in
+.fi
+.PP
+Furthermore, if \fBBEGLINE\fR equals \fBENDLINE\fR, then the format
+is:
+.sp
+.nf
+.in +5
+\fBFILE\fR:\fBLINE\fR.\fBBEGCOL\fR\-\fBENDCOL\fR
+.in
+.fi
+.PP
+Finally, if \fBBEGCOL\fR\ equals \fBENDCOL\fR, the output is
+simplified to
+.sp
+.nf
+.in +5
+\fBFILE\fR:\fBLINE\fR.\fBCOL\fR
+.in
+.fi
+.PP
+If \fBbeg.col\fR is \fB0\fR, then only the \fBbeg\fR part is
+formatted:
+.sp
+.nf
+.in +5
+\fBFILE\fR:\fBLINE\fR
+.in
+.fi
.SH RETURN VALUE
None.
.SH "SEE ALSO"
diff --git a/doc/grecs_parse.3 b/doc/grecs_parse.3
index dff6759..a8b70ca 100644
--- a/doc/grecs_parse.3
+++ b/doc/grecs_parse.3
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
.\"
-.TH GRECS_PARSE 3 "May 7, 2011" "GRECS" "Grecs User Reference"
+.TH GRECS_PARSE 3 "July 1, 2011" "GRECS" "Grecs User Reference"
.SH NAME
grecs_parse \- parse a configuration file.
.SH SYNOPSIS
@@ -46,6 +46,7 @@ typedef struct grecs_node {
struct grecs_node *next;
struct grecs_node *prev;
char *ident;
+ grecs_locus_t idloc;
union {
struct grecs_value *value;
struct grecs_symtab *texttab;
@@ -99,6 +100,9 @@ pidfile "/var/run/mypid";
.sp
will have \fBident\fR pointing to the string \fB/var/run/mypid\fR.
.PP
+The \fIidloc\fR contains the location of the identifier portion in the
+input file. Notice, that it differs from \fBlocus\fR described above.
+.PP
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
@@ -112,6 +116,7 @@ the value associated with this statement. A value is defined as:
.in +5
typedef struct grecs_value {
int type;
+ grecs_locus_t locus;
union {
struct grecs_list *list;
char *string;
@@ -138,6 +143,9 @@ The list value is pointed to by \fBv.list\fR.
.B GRECS_TYPE_ARRAY
The array itself is stored in \fBv.arg.v\fR. The \fBv.arg.c\fR member
contains the number of elements in the array.
+.PP
+The \fBlocus\fR member contains the location of this value in the
+input file.
.SH RETURN VALUE
On success, a pointer to the root node. On error, \fBNULL\fR.
.SH EXAMPLE

Return to:

Send suggestions and report system problems to the System administrator.