1 .\" $Id: roff.3,v 1.3 2010/06/27 15:52:41 kristaps 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: June 27 2010 $
27 .Nd roff macro compiler library
34 .Fa "struct regset *regs"
39 .Fn roff_endparse "struct roff *roff"
41 .Fn roff_free "struct roff *roff"
44 .Fa "struct roff *roff"
52 .Fn roff_reset "struct roff *roff"
56 library processes lines of
60 In general, applications initiate a parsing sequence with
62 parse each line in a document with
64 close the parsing session with
66 and finally free all allocated memory with
70 function may be used in order to reset the parser for another input
75 function should be invoked before passing a line into the
83 section for a full example.
85 This section further defines the
89 available to programmers.
93 may use the following types:
96 Instructions for further processing to the caller of
99 An opaque type defined in
101 Its values are only used privately within the library.
103 A function callback type defined in
107 Function descriptions follow:
110 Allocates a parsing structure.
117 arguments are defined in
119 Returns NULL on failure.
120 If non-NULL, the pointer must be freed with
123 Reset the parser for another parse routine.
126 behaves as if invoked for the first time.
128 Free all resources of a parser.
129 The pointer is no longer valid after invocation.
131 Parse a nil-terminated line of input.
134 may be modified or reallocated within this function.
137 will be modified accordingly.
140 pointer will be modified if the line start during subsequent processing
141 of the line is not at the zeroth index.
142 This line should not contain the trailing newline.
143 Returns 0 on failure, 1 on success.
145 Signals that the parse is complete.
146 Returns 0 on failure, 1 on success.
151 in the source distribution for an example of usage.
160 library was written by
161 .An Kristaps Dzonsons Aq kristaps@bsd.lv .