bcc.1

Wed, 21 Oct 2020 15:27:50 +0200

author
David Demelier <markand@malikania.fr>
date
Wed, 21 Oct 2020 15:27:50 +0200
changeset 0
e5fc6565dce0
child 3
b91e030a2040
permissions
-rw-r--r--

misc: initial import

0
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
1 .\"
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 .\" Copyright (c) 2020 David Demelier <markand@malikania.fr>
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 .\"
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
4 .\" Permission to use, copy, modify, and/or distribute this software for any
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 .\" purpose with or without fee is hereby granted, provided that the above
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 .\" copyright notice and this permission notice appear in all copies.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 .\"
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
14 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 .\"
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 .Dd October 21, 2020
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
17 .Dt BCC 1
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
18 .Os
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
19 .\" NAME
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
20 .Sh NAME
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
21 .Nm bcc
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
22 .Nd binary to C/C++ arrays converter
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
23 .\" SYNOPSIS
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
24 .Sh SYNOPSIS
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
25 .Nm bcc
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
26 .Op Fl 0csu
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
27 .Op Fl I Ar tab-indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
28 .Op Fl i Ar space-indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
29 .Ar filename
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
30 .Ar variable
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
31 .\" DESCRIPTION
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
32 .Sh DESCRIPTION
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
33 The
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
34 .Nm
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
35 utility converts the
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
36 .Ar input
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
37 file into a C or C++ array named
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
38 .Ar variable
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
39 that can be embedded as-is in the source code. A special
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
40 .Ar -
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
41 value can be passed as input which will read standard input instead.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
42 .Pp
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
43 The
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
44 .Ar variable
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
45 can contain any character but only ones that are allowed in the C standard will
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
46 be kept, other will be replaced with a
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
47 .Dq _ .
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
48 Also, the extension (by finding the first .) is removed as well. This can be
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
49 handy when generating a lots of file based on their names during a build
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
50 process.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
51 .Pp
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
52 Note: you must still not start a variable name with digits.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
53 .Pp
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
54 The following options are available:
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
55 .Bl -tag -width indent-xxxxxxxx
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
56 .It Fl 0
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
57 Terminate the generated array with a trailing NUL.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
58 .It Fl c
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
59 Generates a
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
60 .Em const
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
61 array.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
62 .It Fl s
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
63 Generate a
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
64 .Em static
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
65 array.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
66 .It Fl u
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
67 Use an
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
68 .Em unsigned
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
69 char rather than
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
70 .Em signed .
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
71 .It Fl I Ar tab-indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
72 .Ar tab-indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
73 count as leading indents.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
74 .It Fl i Ar space-indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
75 .Ar space-indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
76 count as leading indents.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
77 .El
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
78 .\" EXAMPLES
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
79 .Sh EXAMPLES
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
80 Create a static, const, unsigned array from an image.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
81 .Bd -literal -offset indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
82 bcc -scu image.png image > image.h
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
83 .Ed
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
84 .Pp
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
85 Create a modifiable array from a text file as a NUL terminated string.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
86 .Bd -literal -offset indent
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
87 bcc -0 text.txt text > text.h
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
88 .Ed
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
89 .\" HISTORY
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
90 .Sh HISTORY
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
91 The
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
92 .Nm
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
93 tool is inspired by
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
94 .Nm xxd
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
95 utility but offers more flexibility over the the generated code.
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
96 .\" SEE ALSO
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
97 .Sh SEE ALSO
e5fc6565dce0 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
98 .Xr xxd 1

mercurial