|
@@ -40,12 +40,12 @@ BinToC() :
|
|
|
"for portably importing binary data into a library or executable.");
|
|
"for portably importing binary data into a library or executable.");
|
|
|
|
|
|
|
|
add_option
|
|
add_option
|
|
|
- ("n", "name", 0,
|
|
|
|
|
|
|
+ ("n", "name", 0,
|
|
|
"Specify the name of the table that is generated.",
|
|
"Specify the name of the table that is generated.",
|
|
|
&BinToC::dispatch_string, NULL, &_table_name);
|
|
&BinToC::dispatch_string, NULL, &_table_name);
|
|
|
|
|
|
|
|
add_option
|
|
add_option
|
|
|
- ("static", "", 0,
|
|
|
|
|
|
|
+ ("static", "", 0,
|
|
|
"Flag the table with the keyword 'static'.",
|
|
"Flag the table with the keyword 'static'.",
|
|
|
&BinToC::dispatch_none, &_static_table);
|
|
&BinToC::dispatch_none, &_static_table);
|
|
|
|
|
|
|
@@ -55,7 +55,7 @@ BinToC() :
|
|
|
&BinToC::dispatch_none, &_for_string);
|
|
&BinToC::dispatch_none, &_for_string);
|
|
|
|
|
|
|
|
add_option
|
|
add_option
|
|
|
- ("o", "filename", 0,
|
|
|
|
|
|
|
+ ("o", "filename", 0,
|
|
|
"Specify the filename to which the resulting C code will be written. "
|
|
"Specify the filename to which the resulting C code will be written. "
|
|
|
"If this option is omitted, the last parameter name is taken to be the "
|
|
"If this option is omitted, the last parameter name is taken to be the "
|
|
|
"name of the output file, or standard output is used if there are no "
|
|
"name of the output file, or standard output is used if there are no "
|
|
@@ -98,7 +98,10 @@ run() {
|
|
|
<< " * This table was generated by the command:\n"
|
|
<< " * This table was generated by the command:\n"
|
|
|
<< " *\n"
|
|
<< " *\n"
|
|
|
<< " * " << get_exec_command() << "\n"
|
|
<< " * " << get_exec_command() << "\n"
|
|
|
- << " */\n\n"
|
|
|
|
|
|
|
+ << " */\n"
|
|
|
|
|
+ << "\n"
|
|
|
|
|
+ << "#include <stddef.h>\n"
|
|
|
|
|
+ << "\n"
|
|
|
<< static_keyword << table_type << _table_name << "[] = {";
|
|
<< static_keyword << table_type << _table_name << "[] = {";
|
|
|
out << hex << setfill('0');
|
|
out << hex << setfill('0');
|
|
|
int count = 0;
|
|
int count = 0;
|
|
@@ -120,7 +123,7 @@ run() {
|
|
|
ch = in.get();
|
|
ch = in.get();
|
|
|
}
|
|
}
|
|
|
out << "\n};\n\n"
|
|
out << "\n};\n\n"
|
|
|
- << static_keyword << length_type << _table_name << "_len = "
|
|
|
|
|
|
|
+ << static_keyword << length_type << _table_name << "_len = "
|
|
|
<< dec << count << ";\n\n";
|
|
<< dec << count << ";\n\n";
|
|
|
}
|
|
}
|
|
|
|
|
|