|
cprover
|
Convert file contents to a C character-array initialiser. More...
#include <istream>#include <string>Go to the source code of this file.
Functions | |
| void | file_converter_emit_bytes (std::ostream &out, const std::string &s) |
Emit the bytes of s to out as comma-separated decimal byte values (not character literals). | |
| void | file_converter_append (std::istream &in, std::ostream &out, bool line_marker, const std::string &file_name) |
Append the contents of in to out as the body of a C character-array initialiser; the enclosing braces and trailing null terminator are supplied by the caller. | |
Convert file contents to a C character-array initialiser.
Definition in file file_converter.h.
|
inline |
Append the contents of in to out as the body of a C character-array initialiser; the enclosing braces and trailing null terminator are supplied by the caller.
Each input line contributes its bytes followed by a newline byte (the sole character literal emitted) and a physical line break, so one output line corresponds to one input line – this keeps the generated initialiser diffable and within compiler line-length limits. When line_marker is set, a #line directive naming file_name is emitted first so that diagnostics refer to the original file.
Definition at line 43 of file file_converter.h.
|
inline |
Emit the bytes of s to out as comma-separated decimal byte values (not character literals).
A byte with the high bit set is written with a (char) cast so the surrounding braced initialiser is valid regardless of whether char is signed or unsigned – a brace initialiser would otherwise reject the narrowing conversion of a value > 127.
Definition at line 23 of file file_converter.h.