1LIBGVPR(3)                 Library Functions Manual                 LIBGVPR(3)
2
3
4

NAME

6       libgvpr - library for graph filtering
7

SYNOPSIS

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

DESCRIPTION

32       The gvpr library allows an application to perform general-purpose graph
33       manipulation and filtering based on an awk-like language. (For  a  more
34       complete description of this language, see gvpr(1).)
35
36       The  library  has  a single entry point: the gvpr() function. This pro‐
37       vides a standard argc/argv interface, along with a structure to support
38       in-core  graphs,  application  print  functions,  along with additional
39       options.
40
41       When called, gvpr() processes any flags provided in the argv array, and
42       compiles the gvpr program to be run (provided either via the -f flag or
43       as an item in argv). It then runs the program on each input  graph.  If
44       opt->ingraphs  is non-NULL, this is taken as a NULL-terminated array of
45       in-core graphs to be used as input.  Otherwise,  the  unprocessed  ele‐
46       ments  of  argv are taken to be the names of files containing graphs to
47       be processed. (If none remain, gvpr will read from stdin.)
48
49       Normally, gvpr writes any output graph to stdout. However, if the  flag
50       GV_USE_OUTGRAPH is set in opts->flags, the output graphs will be stored
51       in an array pointed to be opts->outgraphs and the count will be  stored
52       in   opts->n_outgraphs.   In  this  case,  the  application  must  call
53       agclose() on each output graph when it is done with it.
54
55       The application can override the default write functions for stdout and
56       stderr  using  the out and err fields in opts. When called by gvpr, the
57       second argument will point to a buffer of  characters  to  be  written,
58       while  the  third argument provides the number of characters. The func‐
59       tion should return the number of bytes actually written.
60

RETURN VALUES

62       Normally, gvpr returns 0 on success and non-zero if  an  error  occurs.
63       Any  relevant  error  message  will  have been written to stderr or the
64       application's opts->err function will have been  called.  If,  however,
65       GV_USE_EXIT is set in opts->flags, gvpr will call exit(3) in case of an
66       error.
67

SEE ALSO

69       gvpr(1), awk(1), cgraph(3)
70
71

AUTHORS

73       Emden Gansner (erg@research.att.com).
74
75
76
77
78                                15 OCTOBER 2013                     LIBGVPR(3)
Impressum