]> git.cameronkatri.com Git - mandoc.git/blobdiff - mdoc.3
Adding initial options processing (not hooked into parse yet). This is
[mandoc.git] / mdoc.3
diff --git a/mdoc.3 b/mdoc.3
index f65b4c39e35fc17e6b56c60cea8fcceca60bed31..be982ddc41fd2b7cf43748b57f6f69f97f508df2 100644 (file)
--- a/mdoc.3
+++ b/mdoc.3
@@ -1,6 +1,7 @@
-.\"    $Id: mdoc.3,v 1.45 2010/06/29 19:20:38 schwarze Exp $
+.\"    $Id: mdoc.3,v 1.51 2010/12/17 11:41:45 kristaps Exp $
 .\"
 .\"
-.\" Copyright (c) 2009-2010 Kristaps Dzonsons <kristaps@bsd.lv>
+.\" Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
+.\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
@@ -14,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: June 29 2010 $
+.Dd $Mdocdate: December 17 2010 $
 .Dt MDOC 3
 .Os
 .Sh NAME
 .Dt MDOC 3
 .Os
 .Sh NAME
@@ -29,7 +30,6 @@
 .Nd mdoc macro compiler library
 .Sh SYNOPSIS
 .In mandoc.h
 .Nd mdoc macro compiler library
 .Sh SYNOPSIS
 .In mandoc.h
-.In regs.h
 .In mdoc.h
 .Vt extern const char * const * mdoc_macronames;
 .Vt extern const char * const * mdoc_argnames;
 .In mdoc.h
 .Vt extern const char * const * mdoc_macronames;
 .Vt extern const char * const * mdoc_argnames;
@@ -37,7 +37,6 @@
 .Fo mdoc_alloc
 .Fa "struct regset *regs"
 .Fa "void *data"
 .Fo mdoc_alloc
 .Fa "struct regset *regs"
 .Fa "void *data"
-.Fa "int pflags"
 .Fa "mandocmsg msgs"
 .Fc
 .Ft int
 .Fa "mandocmsg msgs"
 .Fc
 .Ft int
@@ -80,43 +79,18 @@ The
 .Fn mdoc_reset
 function may be used in order to reset the parser for another input
 sequence.
 .Fn mdoc_reset
 function may be used in order to reset the parser for another input
 sequence.
-See the
-.Sx EXAMPLES
-section for a simple example.
-.Pp
-This section further defines the
-.Sx Types ,
-.Sx Functions
-and
-.Sx Variables
-available to programmers.
-Following that, the
-.Sx Abstract Syntax Tree
-section documents the output tree.
 .Ss Types
 .Ss Types
-Both functions (see
-.Sx Functions )
-and variables (see
-.Sx Variables )
-may use the following types:
 .Bl -ohang
 .It Vt struct mdoc
 .Bl -ohang
 .It Vt struct mdoc
-An opaque type defined in
-.Pa mdoc.c .
+An opaque type.
 Its values are only used privately within the library.
 .It Vt struct mdoc_node
 A parsed node.
 Its values are only used privately within the library.
 .It Vt struct mdoc_node
 A parsed node.
-Defined in
-.Pa mdoc.h .
 See
 .Sx Abstract Syntax Tree
 for details.
 See
 .Sx Abstract Syntax Tree
 for details.
-.It Vt mandocmsg
-A function callback type defined in
-.Pa mandoc.h .
 .El
 .Ss Functions
 .El
 .Ss Functions
-Function descriptions follow:
 .Bl -ohang
 .It Fn mdoc_alloc
 Allocates a parsing structure.
 .Bl -ohang
 .It Fn mdoc_alloc
 Allocates a parsing structure.
@@ -124,10 +98,6 @@ The
 .Fa data
 pointer is passed to
 .Fa msgs .
 .Fa data
 pointer is passed to
 .Fa msgs .
-The
-.Fa pflags
-arguments are defined in
-.Pa mdoc.h .
 Returns NULL on failure.
 If non-NULL, the pointer must be freed with
 .Fn mdoc_free .
 Returns NULL on failure.
 If non-NULL, the pointer must be freed with
 .Fn mdoc_free .
@@ -171,7 +141,6 @@ or
 return 0, the data will be incomplete.
 .El
 .Ss Variables
 return 0, the data will be incomplete.
 .El
 .Ss Variables
-The following variables are also defined:
 .Bl -ohang
 .It Va mdoc_macronames
 An array of string-ified token names.
 .Bl -ohang
 .It Va mdoc_macronames
 An array of string-ified token names.
@@ -257,10 +226,10 @@ an empty line will produce a zero-length string.
 Multiple body parts are only found in invocations of
 .Sq \&Bl \-column ,
 where a new body introduces a new phrase.
 Multiple body parts are only found in invocations of
 .Sq \&Bl \-column ,
 where a new body introduces a new phrase.
-.Ss Badly nested blocks
-A special kind of node is available to end the formatting
-associated with a given block before the physical end of that block.
-Such an ENDBODY node has a non-null
+.Ss Badly-nested Blocks
+The ENDBODY node is available to end the formatting associated
+with a given block before the physical end of that block.
+It has a non-null
 .Va end
 field, is of the BODY
 .Va type ,
 .Va end
 field, is of the BODY
 .Va type ,
@@ -297,25 +266,32 @@ BLOCK Ao
 TEXT end
 .Ed
 .Pp
 TEXT end
 .Ed
 .Pp
-Here, the formatting of the Ao block extends from TEXT ao to TEXT ac,
-while the formatting of the Bo block extends from TEXT bo to TEXT bc,
-rendering like this in
+Here, the formatting of the
+.Sq \&Ao
+block extends from TEXT ao to TEXT ac,
+while the formatting of the
+.Sq \&Bo
+block extends from TEXT bo to TEXT bc.
+It renders as follows in
 .Fl T Ns Cm ascii
 mode:
 .Fl T Ns Cm ascii
 mode:
+.Pp
 .Dl <ao [bo ac> bc] end
 .Dl <ao [bo ac> bc] end
-Support for badly nested blocks is only provided for backward
+.Pp
+Support for badly-nested blocks is only provided for backward
 compatibility with some older
 .Xr mdoc 7
 implementations.
 compatibility with some older
 .Xr mdoc 7
 implementations.
-Using them in new code is stronly discouraged:
-Some frontends, in particular
-.Fl T Ns Cm html ,
-are unable to render them in any meaningful way,
-many other
-.Xr mdoc 7
-implementations do not support them, and even for those that do,
-the behaviour is not well-defined, in particular when using multiple
-levels of badly nested blocks.
+Using badly-nested blocks is
+.Em strongly discouraged :
+the
+.Fl T Ns Cm html
+and
+.Fl T Ns Cm xhtml
+front-ends are unable to render them in any meaningful way.
+Furthermore, behaviour when encountering badly-nested blocks is not
+consistent across troff implementations, especially when using  multiple
+levels of badly-nested blocks.
 .Sh EXAMPLES
 The following example reads lines from stdin and parses them, operating
 on the finished parse tree with
 .Sh EXAMPLES
 The following example reads lines from stdin and parses them, operating
 on the finished parse tree with
@@ -331,7 +307,7 @@ int line;
 
 bzero(&regs, sizeof(struct regset));
 line = 1;
 
 bzero(&regs, sizeof(struct regset));
 line = 1;
-mdoc = mdoc_alloc(&regs, NULL, 0, NULL);
+mdoc = mdoc_alloc(&regs, NULL, NULL);
 buf = NULL;
 alloc_len = 0;
 
 buf = NULL;
 alloc_len = 0;
 
@@ -352,9 +328,13 @@ parsed(mdoc, node);
 mdoc_free(mdoc);
 .Ed
 .Pp
 mdoc_free(mdoc);
 .Ed
 .Pp
-Please see
+To compile this, execute
+.Pp
+.Dl % cc main.c libmdoc.a libmandoc.a
+.Pp
+where
 .Pa main.c
 .Pa main.c
-in the source archive for a rigorous reference.
+is the example file.
 .Sh SEE ALSO
 .Xr mandoc 1 ,
 .Xr mdoc 7
 .Sh SEE ALSO
 .Xr mandoc 1 ,
 .Xr mdoc 7