1*b817d381Schristos.Dd $Mdocdate: March 28 2016 $ 2*b817d381Schristos.Dt SQLITE2MDOC 1 3*b817d381Schristos.Os 4*b817d381Schristos.Sh NAME 5*b817d381Schristos.Nm sqlite2mdoc 6*b817d381Schristos.Nd extract C reference manpages from SQLite header file 7*b817d381Schristos.Sh SYNOPSIS 8*b817d381Schristos.Nm sqlite2mdoc 9*b817d381Schristos.Op Fl nv 10*b817d381Schristos.Op Fl p Ar prefix 11*b817d381Schristos.Sh DESCRIPTION 12*b817d381SchristosThe 13*b817d381Schristos.Nm 14*b817d381Schristosutility extracts C interface descriptions from a header file composed 15*b817d381Schristosusing the SQLite documentation syntax (see 16*b817d381Schristos.Sx SYNTAX ) . 17*b817d381SchristosIt then emits the corresponding set of 18*b817d381Schristos.Xr mdoc 7 19*b817d381Schristosmanpages, one per interface description. 20*b817d381SchristosBy default, 21*b817d381Schristos.Nm 22*b817d381Schristosreads from standard input and outputs files into the current directory. 23*b817d381SchristosIts arguments are as follows: 24*b817d381Schristos.Bl -tag -width Ds 25*b817d381Schristos.It Fl n 26*b817d381SchristosDon't create files in 27*b817d381Schristos.Ar prefix : 28*b817d381Schristosjust dump everything to stdout. 29*b817d381Schristos.It Fl v 30*b817d381SchristosShow all missing references. 31*b817d381Schristos.It Fl p Ar prefix 32*b817d381SchristosOutput into 33*b817d381Schristos.Ar prefix , 34*b817d381Schristoswhich must already exist. 35*b817d381Schristos.El 36*b817d381Schristos.Pp 37*b817d381SchristosThis tool was designed for SQLite's header file 38*b817d381Schristos.Pa sqlite.h , 39*b817d381Schristosalthough it will work for any document following the 40*b817d381Schristos.Sx SYNTAX . 41*b817d381SchristosHistorically, all of the SQLite C reference documentation (called the 42*b817d381Schristos.Dq C-language Interface Specification ) 43*b817d381Schristoswas only available in HTML. 44*b817d381Schristos.Sh SYNTAX 45*b817d381SchristosThe syntax for the interface descriptions is as follows: 46*b817d381Schristos.Bd -literal 47*b817d381Schristos/* 48*b817d381Schristos** CAPI3REF: A Brief Description Here 49*b817d381Schristos** KEYWORDS: {multiword keyword} single_keyword 50*b817d381Schristos** 51*b817d381Schristos** This is a longer description following the blank line. 52*b817d381Schristos** You can refer to [other descriptions] by enclosing references to 53*b817d381Schristos** keywords (or declaration names) in brackets. 54*b817d381Schristos** If the brackets have [some_keyword | a bar] within them, the 55*b817d381Schristos** second part is shown while the first is used as a reference. 56*b817d381Schristos** Each reference will be collected and its corresponding manpage, 57*b817d381Schristos** if found, will be listed in SEE ALSO. 58*b817d381Schristos** 59*b817d381Schristos** You can embed <b>HTML</b>, but you must limit this to lists 60*b817d381Schristos** (ordered, unordered, description). 61*b817d381Schristos** 62*b817d381Schristos** See also: [another_keyword], although since we're the only 63*b817d381Schristos** reference, none of these will be found. 64*b817d381Schristos** Anything not in [function() | quotes] will be discarded. 65*b817d381Schristos** 66*b817d381Schristos** Now we end the comment. Anything after this, until the next 67*b817d381Schristos** blank line, is taken as declarations. 68*b817d381Schristos*/ 69*b817d381Schristosint function_name(char *anarg, char *another); 70*b817d381Schristos#define A_DEFINITION "text" 71*b817d381Schristosstruct a_struct { 72*b817d381Schristos struct embedded_struct { 73*b817d381Schristos int foo; 74*b817d381Schristos int bar; 75*b817d381Schristos }; 76*b817d381Schristos}; 77*b817d381Schristostypedef void (*fptr)(const char *a, const char *b); 78*b817d381Schristos.Ed 79*b817d381Schristos.Pp 80*b817d381SchristosIt's important that the opening and closing comment parts are flush left 81*b817d381Schristosand not followed by spaces. 82*b817d381SchristosParagraph breaks (empty comment lines) should also not have any spaces. 83*b817d381Schristos.Pp 84*b817d381SchristosThere are many SQLite-specific bits that are purposely not documented so 85*b817d381Schristosthat people don't use them. 86*b817d381Schristos.\" .Sh CONTEXT 87*b817d381Schristos.\" For section 9 functions only. 88*b817d381Schristos.\" .Sh IMPLEMENTATION NOTES 89*b817d381Schristos.\" Not used in OpenBSD. 90*b817d381Schristos.\" .Sh RETURN VALUES 91*b817d381Schristos.\" For sections 2, 3, and 9 function return values only. 92*b817d381Schristos.\" .Sh ENVIRONMENT 93*b817d381Schristos.\" For sections 1, 6, 7, and 8 only. 94*b817d381Schristos.\" .Sh FILES 95*b817d381Schristos.Sh EXIT STATUS 96*b817d381Schristos.Ex -std 97*b817d381Schristos.\" For sections 1, 6, and 8 only. 98*b817d381Schristos.\" .Sh EXAMPLES 99*b817d381Schristos.\" .Sh DIAGNOSTICS 100*b817d381Schristos.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. 101*b817d381Schristos.\" .Sh ERRORS 102*b817d381Schristos.\" For sections 2, 3, 4, and 9 errno settings only. 103*b817d381Schristos.Sh SEE ALSO 104*b817d381Schristos.Xr mdoc 7 , 105*b817d381Schristos.Lk https://www.sqlite.org/capi3ref.html "C-language Interface Specification for SQLite" 106*b817d381Schristos.\" .Sh STANDARDS 107*b817d381Schristos.\" .Sh HISTORY 108*b817d381Schristos.Sh AUTHORS 109*b817d381Schristos.Nm 110*b817d381Schristoswas written by 111*b817d381Schristos.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv . 112*b817d381Schristos.Sh CAVEATS 113*b817d381SchristosThere are some missing bits: 114*b817d381Schristos.Bl -bullet 115*b817d381Schristos.It 116*b817d381SchristosHTML tables are not parsed. 117*b817d381Schristos.It 118*b817d381SchristosHTML anchors are not parsed. 119*b817d381Schristos.It 120*b817d381SchristosObviously-broken HTML (e.g., unmatched </dt>) isn't worked around. 121*b817d381Schristos.It 122*b817d381SchristosStructure definitions are discarded except for the structure name. 123*b817d381Schristos.It 124*b817d381SchristosComments in definitions will cause extra white-space. 125*b817d381Schristos.El 126*b817d381Schristos.Sh BUGS 127*b817d381SchristosAbsolutely. 128*b817d381Schristos.\" .Sh SECURITY CONSIDERATIONS 129*b817d381Schristos.\" Not used in OpenBSD. 130