1 .\" $Id: roff.3,v 1.7 2010/07/13 23:53:20 schwarze Exp $
3 .\" Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 .Dd $Mdocdate: July 13 2010 $
27 .Nd roff macro compiler library
33 .Fa "struct regset *regs"
38 .Fn roff_endparse "struct roff *roff"
40 .Fn roff_free "struct roff *roff"
43 .Fa "struct roff *roff"
51 .Fn roff_reset "struct roff *roff"
55 library processes lines of
59 In general, applications initiate a parsing sequence with
61 parse each line in a document with
63 close the parsing session with
65 and finally free all allocated memory with
69 function may be used in order to reset the parser for another input
74 function should be invoked before passing a line into the
82 section for a full example.
84 This section further defines the
88 available to programmers.
92 may use the following types:
95 Instructions for further processing to the caller of
98 An opaque type defined in
100 Its values are only used privately within the library.
102 A function callback type defined in
106 Function descriptions follow:
109 Allocates a parsing structure.
116 arguments are defined in
118 Returns NULL on failure.
119 If non-NULL, the pointer must be freed with
122 Reset the parser for another parse routine.
125 behaves as if invoked for the first time.
127 Free all resources of a parser.
128 The pointer is no longer valid after invocation.
130 Parse a nil-terminated line of input.
133 may be modified or reallocated within this function.
136 will be modified accordingly.
139 pointer will be modified if the line start during subsequent processing
140 of the line is not at the zeroth index.
141 This line should not contain the trailing newline.
142 Returns 0 on failure, 1 on success.
144 Signals that the parse is complete.
145 Returns 0 on failure, 1 on success.
150 in the source distribution for an example of usage.
159 library was written by
160 .An Kristaps Dzonsons Aq kristaps@bsd.lv .
162 The implementation of user-defined strings needs improvement:
165 String values are taken literally and are not interpreted.
167 Parsing of quoted strings is incomplete.
169 The stings are stored internally using a singly linked list,
170 which is fine for small numbers of strings,
171 but ineffient when handling many strings.