1 c590d32c 2022-09-29 op .\" Copyright (c) 2022 Omar Polo <op@openbsd.org>
3 c590d32c 2022-09-29 op .\" Permission to use, copy, modify, and distribute this software for any
4 c590d32c 2022-09-29 op .\" purpose with or without fee is hereby granted, provided that the above
5 c590d32c 2022-09-29 op .\" copyright notice and this permission notice appear in all copies.
7 c590d32c 2022-09-29 op .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 c590d32c 2022-09-29 op .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 c590d32c 2022-09-29 op .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10 c590d32c 2022-09-29 op .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 c590d32c 2022-09-29 op .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12 c590d32c 2022-09-29 op .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13 c590d32c 2022-09-29 op .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 1ba2bcf9 2023-01-07 op .Dd January 06, 2022
16 c590d32c 2022-09-29 op .Dt TEMPLATE 1
20 c590d32c 2022-09-29 op .Nd templating system compiler
24 e733e1f3 2022-12-04 op .Op Fl o Ar out
26 c590d32c 2022-09-29 op .Sh DESCRIPTION
28 c590d32c 2022-09-29 op is an utility that converts files written in the
29 c590d32c 2022-09-29 op .Xr template 7
30 c590d32c 2022-09-29 op format format to a set of routine writtens in the C programming
33 c590d32c 2022-09-29 op converts the files given as arguments or from standard input, and
34 c590d32c 2022-09-29 op writes to standard output.
36 c590d32c 2022-09-29 op The options are as follows:
37 c590d32c 2022-09-29 op .Bl -tag -width Ds
39 c590d32c 2022-09-29 op Do not emit debug info in the generated source.
40 c590d32c 2022-09-29 op It's disabled by default, unless
42 c590d32c 2022-09-29 op is reading from standard input.
43 e733e1f3 2022-12-04 op .It Fl o Ar out
44 e733e1f3 2022-12-04 op Write output to file.
46 e733e1f3 2022-12-04 op will be created or truncated if exists and will be removed if
48 e733e1f3 2022-12-04 op encounters any error.
50 c590d32c 2022-09-29 op .Sh EXIT STATUS
53 c590d32c 2022-09-29 op .Xr template 7
58 c590d32c 2022-09-29 op utility was written by
59 c590d32c 2022-09-29 op .An Omar Polo Aq Mt op@openbsd.org .
61 c590d32c 2022-09-29 op The compiler is very naive, so there are quite a few shortcomings:
62 c590d32c 2022-09-29 op .Bl -bullet -compact
64 c590d32c 2022-09-29 op No attempt is made to validate the C code provided inline, nor the
65 c590d32c 2022-09-29 op validity of the arguments to many constructs.
67 c590d32c 2022-09-29 op The generated code assumes that a variable called
70 c590d32c 2022-09-29 op .Vt struct template *
71 e733e1f3 2022-12-04 op is in scope inside each block.
73 c590d32c 2022-09-29 op Each block may have additional variables used for the template
74 e733e1f3 2022-12-04 op generation implicitly defined: to avoid clashes, don't name variables
75 e733e1f3 2022-12-04 op or arguments with the
79 c590d32c 2022-09-29 op Blanks are, in most cases, trimmed.
80 c590d32c 2022-09-29 op Normally this is not a problem, but a workaround is needed in case
81 c590d32c 2022-09-29 op they need to be preserved, for e.g.:
82 c590d32c 2022-09-29 op .Bd -literal -offset indent
83 c590d32c 2022-09-29 op Name: {{ " " }} {{ render name_field(tp) }}