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