aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-05-19 09:49:20 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-05-19 09:49:20 +0300
commit304935a296997c9781688f08693ef70180dd24e4 (patch)
tree7b7801f3a97a780af1719826b2b9ef471151a352 /doc
parent6ef143bd53c35635b6d7edc6410d45fa58f54da2 (diff)
downloadgrecs-304935a296997c9781688f08693ef70180dd24e4.tar.gz
grecs-304935a296997c9781688f08693ef70180dd24e4.tar.bz2
Reimplement grecs_format_ familiy as output-independent functions.
* src/format.c (grecs_format_docstring): Rename to grecs_print_docstring. (grecs_format_simple_statement): Rename to grecs_print_simple_statement. (grecs_format_block_statement): Rename to grecs_print_block_statement. (grecs_format_statement_array): Rename to grecs_print_statement_array. (grecs_format_locus): Rename to grecs_print_locus. (grecs_format_node_path): Rename to grecs_print_node_path. (grecs_format_value): Rename to grecs_print_value. (grecs_format_node): Rename to grecs_print_node. (grecs_format_locus,grecs_format_node_path) (grecs_format_value,grecs_format_node): Reimplement as output-independent functions. All uses changed. * src/grecs.h: Update prototypes. * doc/grecs_format_locus.3: Update. * doc/grecs_format_node.3: Update. * doc/grecs_format_node_path.3: Update. * doc/grecs_format_value.3: Update.
Diffstat (limited to 'doc')
-rw-r--r--doc/grecs_format_locus.350
-rw-r--r--doc/grecs_format_node.333
-rw-r--r--doc/grecs_format_node_path.323
-rw-r--r--doc/grecs_format_value.326
4 files changed, 104 insertions, 28 deletions
diff --git a/doc/grecs_format_locus.3 b/doc/grecs_format_locus.3
index a7743f1..83c9c0b 100644
--- a/doc/grecs_format_locus.3
+++ b/doc/grecs_format_locus.3
@@ -14,31 +14,59 @@
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. 15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
16.\" 16.\"
17.TH GRECS_FORMAT_LOCUS 3 "May 4, 2011" "GRECS" "Grecs User Reference" 17.TH GRECS_FORMAT_LOCUS 3 "May 19, 2011" "GRECS" "Grecs User Reference"
18.SH NAME 18.SH NAME
19grecs_format_locus \- format and output source file location 19grecs_format_locus \- format and output source file location
20.SH SYNOPSIS 20.SH SYNOPSIS
21.nf 21.nf
22.B #include <grecs.h> 22.B #include <grecs.h>
23.sp 23.sp
24.BI "void grecs_format_locus(grecs_locus_t " "*locus" ", FILE " "*fp" ); 24.BI "void grecs_format_locus(grecs_locus_t " "*locus" ","
25.ti +17
26.BI "struct grecs_format_closure " "*clos" );
27.sp
28.BI "void grecs_print_locus(grecs_locus_t " "*locus" ", FILE " "*fp" );
29
25.SH DESCRIPTION 30.SH DESCRIPTION
26\fBgrecs_format_locus\fR formats the location from \fIlocus\fR in the 31\fBgrecs_print_locus\fR formats the location from \fIlocus\fR in the
27human-readable form and outputs it to file \fBfp\fR. 32human-readable form and outputs it using the format closure
33\fIclos\fR. The closure is defined as:
34.sp
35.nf
36.in +5
37struct grecs_format_closure
38{
39 int (*fmtfun)(const char *str, void *data);
40 void *data;
41};
42.in
43.fi
28.PP 44.PP
29The location is output as follows: the file name, followed by a 45While formatting the location, the formatter function \fBfmtfun\fR can
30semicolon, followed by the line number. 46be called one or more times. On each invocation, it is supplied with
47the string to be output as its first argument, and pointer to
48\fBdata\fR as the second one.
31.PP 49.PP
32If \fIlocus\fR is \fBNULL\fR, \fBgrecs_format_locus\fR returns without 50\fBgrecs_print_locus\fR is an alternative interface, which formats the
51location from \fIlocus\fR in the human-readable form and outputs it to
52file \fBfp\fR.
53.PP
54In both cases, the location is formatted as follows: the file name,
55followed by a semicolon, followed by the line number.
56.PP
57If \fIlocus\fR is \fBNULL\fR, both functions return without
33doing anything. 58doing anything.
34.SH "RETURN VALUE" 59.SH "RETURN VALUE"
35None. 60None.
36.SH NOTES 61.SH NOTES
37This is an auxiliary function used by 62This are auxiliary functions used by
38.BR grecs_format_node (3).
39It is seldom needed in user programs.
40.SH "SEE ALSO"
41.BR grecs_format_node (3) 63.BR grecs_format_node (3)
64and
65.BR grecs_print_node (3),
66correspondingly. They are is seldom needed in user programs.
67.SH "SEE ALSO"
68.BR grecs_format_node (3),
69.BR grecs_print_node (3).
42.SH AUTHORS 70.SH AUTHORS
43Sergey Poznyakoff 71Sergey Poznyakoff
44.SH "BUG REPORTS" 72.SH "BUG REPORTS"
diff --git a/doc/grecs_format_node.3 b/doc/grecs_format_node.3
index 095a494..dd87ca7 100644
--- a/doc/grecs_format_node.3
+++ b/doc/grecs_format_node.3
@@ -14,7 +14,7 @@
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. 15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
16.\" 16.\"
17.TH GRECS_FORMAT_NODE 3 "May 4, 2011" "GRECS" "Grecs User Reference" 17.TH GRECS_FORMAT_NODE 3 "May 19, 2011" "GRECS" "Grecs User Reference"
18.SH NAME 18.SH NAME
19grecs_format_node \- format and print a single node from a syntax tree 19grecs_format_node \- format and print a single node from a syntax tree
20.SH SYNOPSIS 20.SH SYNOPSIS
@@ -22,11 +22,19 @@ grecs_format_node \- format and print a single node from a syntax tree
22.B #include <grecs.h> 22.B #include <grecs.h>
23.sp 23.sp
24.BI "void grecs_format_node(struct grecs_node *" "node" ", int " \ 24.BI "void grecs_format_node(struct grecs_node *" "node" ", int " \
25 "flags" ","
26.ti +17
27.BI "struct grecs_format_closure " "*clos" );
28.sp
29.BI "void grecs_print_node(struct grecs_node *" "node" ", int " \
25 "flags" ", FILE " "*fp" ); 30 "flags" ", FILE " "*fp" );
26.SH DESCRIPTION 31.SH DESCRIPTION
27\fBgrecs_format_node\fR prints to the output file \fBfp\fR the 32\fBgrecs_format_node\fR formats the contents of a parse tree node
28contents of a parse tree node \fBnode\fR, according to formatting 33\fInode\fR, according to formatting options, given by \fIflags\fR. The
29options, given by \fBflags\fR. 34formatter closure \fIclos\fR is used for actual output.
35.PP
36\fBgrecs_print_node\fR is an alternative entry point, which formats
37the node to the given file.
30.PP 38.PP
31The \fBflags\fR argument is a bitwise \fBOR\fR of one or more of the 39The \fBflags\fR argument is a bitwise \fBOR\fR of one or more of the
32following options: 40following options:
@@ -72,6 +80,23 @@ Same as
72GRECS_NODE_FLAG_PATH|GRECS_NODE_FLAG_VALUE|GRECS_NODE_FLAG_QUOTE 80GRECS_NODE_FLAG_PATH|GRECS_NODE_FLAG_VALUE|GRECS_NODE_FLAG_QUOTE
73.PP 81.PP
74If \fBflag\fR is 0, \fBGRECS_NODE_FLAG_DEFAULT\fR is assumed. 82If \fBflag\fR is 0, \fBGRECS_NODE_FLAG_DEFAULT\fR is assumed.
83.SH CLOSURE
84The format closure is defined as:
85.sp
86.nf
87.in +5
88struct grecs_format_closure
89{
90 int (*fmtfun)(const char *str, void *data);
91 void *data;
92};
93.in
94.fi
95.PP
96While formatting the node, the formatter function \fBfmtfun\fR can
97be called one or more times. On each invocation, it is supplied with
98the string to be output as its first argument, and pointer to
99\fBdata\fR as the second one.
75.SH "RETURN VALUE" 100.SH "RETURN VALUE"
76None. 101None.
77.SH "SEE ALSO" 102.SH "SEE ALSO"
diff --git a/doc/grecs_format_node_path.3 b/doc/grecs_format_node_path.3
index bf119e7..ed687db 100644
--- a/doc/grecs_format_node_path.3
+++ b/doc/grecs_format_node_path.3
@@ -14,7 +14,7 @@
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. 15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
16.\" 16.\"
17.TH GRECS_FORMAT_NODE_PATH 3 "May 4, 2011" "GRECS" "Grecs User Reference" 17.TH GRECS_FORMAT_NODE_PATH 3 "May 19, 2011" "GRECS" "Grecs User Reference"
18.SH NAME 18.SH NAME
19grecs_format_node_path \- format and output statement pathname for the 19grecs_format_node_path \- format and output statement pathname for the
20node 20node
@@ -23,10 +23,21 @@ node
23.B #include <grecs.h> 23.B #include <grecs.h>
24.sp 24.sp
25.BI "void grecs_format_node_path(struct grecs_node " "*node" ", int " \ 25.BI "void grecs_format_node_path(struct grecs_node " "*node" ", int " \
26 "flag" ", "
27.ti +17
28.BI "struct grecs_format_closure " "*clos" );
29.sp
30.BI "void grecs_print_node_path(struct grecs_node " "*node" ", int " \
26 "flag" ", FILE " "*fp" ); 31 "flag" ", FILE " "*fp" );
27.SH DESCRIPTION 32.SH DESCRIPTION
28\fBgrecs_format_node_path\fR computes the \fIstatement pathname\fR for 33\fBgrecs_format_node_path\fR computes the \fIstatement pathname\fR for
29the \fInode\fR, and outputs it to the file \fBfp\fR. 34the \fInode\fR, and outputs it using the closure \fIclos\fR. See
35section \fBCLOSURE\fR in
36.BR grecs_format_node (3),
37for a description of struct grecs_format_closure.
38.PP
39\fBgrecs_print_node_path\fR is an alternative interface that outputs
40the formatted data to the file.
30.PP 41.PP
31The \fIflags\fR argument describes what character to use as a pathname 42The \fIflags\fR argument describes what character to use as a pathname
32component separator and how to format the statement tag, if \fInode\fR 43component separator and how to format the statement tag, if \fInode\fR
@@ -36,9 +47,11 @@ for a discussion of available flags.
36.SH "RETURN VALUE" 47.SH "RETURN VALUE"
37None. 48None.
38.SH NOTES 49.SH NOTES
39This is an auxiliary function used by 50This are auxiliary functions used by
40.BR grecs_format_node (3). 51.BR grecs_format_node (3)
41It is seldom needed in user programs. 52and
53.BR grecs_print_node (3),
54correspondingly. They are is seldom needed in user programs.
42.SH "SEE ALSO" 55.SH "SEE ALSO"
43.BR grecs_format_node (3), 56.BR grecs_format_node (3),
44.BR grecs_stmt_path (5). 57.BR grecs_stmt_path (5).
diff --git a/doc/grecs_format_value.3 b/doc/grecs_format_value.3
index e4b45fa..918e972 100644
--- a/doc/grecs_format_value.3
+++ b/doc/grecs_format_value.3
@@ -14,7 +14,7 @@
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>. 15.\" along with Grecs. If not, see <http://www.gnu.org/licenses/>.
16.\" 16.\"
17.TH GRECS_FORMAT_VALUE 3 "May 4, 2011" "GRECS" "Grecs User Reference" 17.TH GRECS_FORMAT_VALUE 3 "May 19, 2011" "GRECS" "Grecs User Reference"
18.SH NAME 18.SH NAME
19grecs_format_value \- format and output a configuration value 19grecs_format_value \- format and output a configuration value
20.SH SYNOPSIS 20.SH SYNOPSIS
@@ -22,21 +22,31 @@ grecs_format_value \- format and output a configuration value
22.B #include <grecs.h> 22.B #include <grecs.h>
23.sp 23.sp
24.BI "void grecs_format_value(struct grecs_value *" "val" ", int " \ 24.BI "void grecs_format_value(struct grecs_value *" "val" ", int " \
25 "flags" ", "
26</