mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
add -string
This commit is contained in:
parent
d636bc832f
commit
839325922d
@ -52,6 +52,11 @@ BinToC() :
|
|||||||
"Flag the table with the keyword 'static'.",
|
"Flag the table with the keyword 'static'.",
|
||||||
&BinToC::dispatch_none, &_static_table);
|
&BinToC::dispatch_none, &_static_table);
|
||||||
|
|
||||||
|
add_option
|
||||||
|
("string", "", 0,
|
||||||
|
"Define the table suitablly to pass to a string constructor.",
|
||||||
|
&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. "
|
||||||
@ -82,13 +87,20 @@ run() {
|
|||||||
static_keyword = "static ";
|
static_keyword = "static ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string table_type = "const unsigned char ";
|
||||||
|
string length_type = "const int ";
|
||||||
|
if (_for_string) {
|
||||||
|
table_type = "const char ";
|
||||||
|
length_type = "const size_t ";
|
||||||
|
}
|
||||||
|
|
||||||
out << "\n"
|
out << "\n"
|
||||||
<< "/*\n"
|
<< "/*\n"
|
||||||
<< " * 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"
|
||||||
<< static_keyword << "const unsigned char " << _table_name << "[] = {";
|
<< static_keyword << table_type << _table_name << "[] = {";
|
||||||
out << hex << setfill('0');
|
out << hex << setfill('0');
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int col = 0;
|
int col = 0;
|
||||||
@ -109,7 +121,7 @@ run() {
|
|||||||
ch = in.get();
|
ch = in.get();
|
||||||
}
|
}
|
||||||
out << "\n};\n\n"
|
out << "\n};\n\n"
|
||||||
<< static_keyword << "const int " << _table_name << "_len = "
|
<< static_keyword << length_type << _table_name << "_len = "
|
||||||
<< dec << count << ";\n\n";
|
<< dec << count << ";\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ protected:
|
|||||||
Filename _input_filename;
|
Filename _input_filename;
|
||||||
string _table_name;
|
string _table_name;
|
||||||
bool _static_table;
|
bool _static_table;
|
||||||
|
bool _for_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user