Debian Codegraph @

lib/gvpr/gvpr.3

raw
1 .TH LIBGVPR 3 "15 OCTOBER 2013"
2 .SH NAME
3 \fBlibgvpr\fR \- library for graph filtering
4 .SH SYNOPSIS
5 .ta .75i 1.5i 2.25i 3i 3.75i 4.5i 5.25i 6i
6 .PP
7 .nf
8 \f5
9 #include <graphviz/gvpr.h>
10
11
12 /* If set, gvpr calls exit() on errors */
13 #define GV_USE_EXIT 1
14 /* If set, gvpr stores output graphs in gvpropts */
15 #define GV_USE_OUTGRAPH 2
16
17 typedef ssize_t (*gvprwr) (void*, const char *buf, size_t nbyte, void*);
18
19 typedef struct {
20 Agraph_t** ingraphs; /* NULL-terminated array of input graphs */
21 int n_outgraphs; /* if GV_USE_OUTGRAPH set, output graphs */
22 Agraph_t** outgraphs;
23 gvprwr out; /* write function for stdout */
24 gvprwr err; /* write function for stderr */
25 int flags;
26 } gvpropts;
27
28 extern int gvpr (int argc, char *argv[], gvpropts* opts);
29
30 \fP
31 .fi
32 .SH DESCRIPTION
33 The \fBgvpr\fP library allows an application to perform general-purpose
34 graph manipulation and filtering based on an awk-like language. (For a more
35 complete description of this language, see gvpr(1).)
36 .P
37 The library has a single entry point: the \fIgvpr()\fP function. This provides a
38 standard \fIargc/argv\fP interface, along with a structure to support
39 in-core graphs, application print functions, along with additional options.
40 .P
41 When called, \fIgvpr()\fP processes any flags provided in the \fIargv\fP array, and compiles
42 the \fBgvpr\fP program to be run (provided either via the \fI\-f\fP flag or as an item
43 in \fIargv\fP). It then runs the program on each input graph. If \fIopts\->ingraphs\fP is
44 non-NULL, this is taken as a NULL-terminated array of in-core graphs to be used as input.
45 Otherwise, the unprocessed elements of \fIargv\fP are taken to be the names of files containing
46 graphs to be processed. (If none remain, \fBgvpr\fP will read from stdin.)
47 .P
48 Normally, \fBgvpr\fP writes any output graph to stdout. However, if
49 the flag \fIGV_USE_OUTGRAPH\fP is set in \fIopts\->flags\fP, the output graphs will be stored in
50 an array pointed to be \fIopts\->outgraphs\fP and the count will be stored in \fIopts\->n_outgraphs\fP.
51 In this case, the application must call \fIagclose()\fP on each output graph when it is done with
52 it.
53 .P
54 The application can override the default write functions for stdout and stderr using the
55 \fIout\fP and \fIerr\fP fields in \fIopts\fP. When called by \fBgvpr\fP, the second argument
56 will point to a buffer of characters to be written, while the third argument provides the
57 number of characters. The function should return the number of bytes actually written.
58 .SH RETURN VALUES
59 Normally, \fBgvpr\fP returns 0 on success and non-zero if an error occurs. Any relevant
60 error message will have been written to stderr or the application's \fIopts\->err\fP function will
61 have been called. If, however, \fIGV_USE_EXIT\fP is set in \fIopts\->flags\fP, \fBgvpr\fP will call
62 exit(3) in case of an error.
63 .SH SEE ALSO
64 .BR gvpr (1),
65 .BR awk (1),
66 .BR cgraph (3)
67
68 .SH AUTHORS
69 Emden Gansner ([email protected]).
70