=================================================================== RCS file: /cvs/mandoc/Attic/roff.3,v retrieving revision 1.4 retrieving revision 1.10 diff -u -p -r1.4 -r1.10 --- mandoc/Attic/roff.3 2010/07/03 16:02:12 1.4 +++ mandoc/Attic/roff.3 2011/01/01 16:18:39 1.10 @@ -1,4 +1,4 @@ -.\" $Id: roff.3,v 1.4 2010/07/03 16:02:12 schwarze Exp $ +.\" $Id: roff.3,v 1.10 2011/01/01 16:18:39 kristaps Exp $ .\" .\" Copyright (c) 2010 Kristaps Dzonsons .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 3 2010 $ +.Dd $Mdocdate: January 1 2011 $ .Dt ROFF 3 .Os .Sh NAME @@ -23,19 +23,19 @@ .Nm roff_endparse , .Nm roff_free , .Nm roff_parseln , -.Nm roff_reset +.Nm roff_reset , +.Nm roff_span .Nd roff macro compiler library .Sh SYNOPSIS .In mandoc.h -.In regs.h .In roff.h .Ft "struct roff *" .Fo roff_alloc .Fa "struct regset *regs" -.Fa "mandocmsg msgs" .Fa "void *data" +.Fa "mandocmsg msgs" .Fc -.Ft int +.Ft void .Fn roff_endparse "struct roff *roff" .Ft void .Fn roff_free "struct roff *roff" @@ -50,15 +50,8 @@ .Fc .Ft void .Fn roff_reset "struct roff *roff" -.In regs.h -.Ft "char *" -.Fn roff_setstr "const char *name" "const char *string" -.Ft "char *" -.Fn roff_getstr "const char *name" -.Ft "char *" -.Fn roff_getstrn "const char *name" "size_t len" -.Ft void -.Fn roff_freestr void +.Ft "const struct tbl_span *" +.Fn roff_span "const struct roff *roff" .Sh DESCRIPTION The .Nm @@ -121,10 +114,6 @@ The .Fa data pointer is passed to .Fa msgs . -The -.Fa pflags -arguments are defined in -.Pa roff.h . Returns NULL on failure. If non-NULL, the pointer must be freed with .Fn roff_free . @@ -152,54 +141,14 @@ This line should not contain the trailing newline. Returns 0 on failure, 1 on success. .It Fn roff_endparse Signals that the parse is complete. -Returns 0 on failure, 1 on success. +.It Fn roff_span +If +.Fn roff_parseln +returned +.Va ROFF_TBL , +return the last parsed table row. +Returns NULL otherwise. .El -.Sh USER-DEFINED STRINGS -Strings defined by the -.Xr roff 7 -.Sx \&ds -instruction are saved using the -.Fn roff_setstr -function and retrieved using the -.Fn roff_getstr -and -.Fn roff_getstrn -functions. -.Pp -These functions take the name of the string to be accessed -as their first argument. -While -.Fn roff_getstr -requires the name to be null-terminated, -.Fn roff_getstrn -accepts non-terminated strings, but requires the length of the name -to be specified. -.Pp -The second argument to -.Fn roff_setstr -is the new value of the string. -It will be copied to internal storage, so both pointers to constant -strings and pointers to volatile storage are acceptable. -.Pp -All of these functions return a pointer to the new value of the string -in internal storage, which should be considered read-only, so use -.Xr strdup 3 -on it as appropriate. -The read functions return NULL when a string of the specified name -is not available or empty, and -.Fn roff_setstr -returns NULL when memory allocation fails. -In the latter case, the string will remain unset. -.Pp -The function -.Fn roff_freestr -clears all user-defined strings. -It always succeeds. -Both -.Fn roff_reset -and -.Fn roff_free -call it. .Sh EXAMPLES See .Pa main.c