23 #include <interfaces/generator/cpp_generator.h>
24 #include <interfaces/generator/tolua_generator.h>
25 #include <interfaces/generator/parser.h>
26 #include <interfaces/generator/digest.h>
27 #include <interfaces/generator/exceptions.h>
29 #include <utils/system/argparser.h>
30 #include <utils/system/file.h>
37 using namespace fawkes;
40 main(
int argc,
char **argv)
45 const vector<const char *> & items = argp->
items();
46 if ( items.size() == 0 || argp->
has_arg(
"h") ) {
47 cout <<
"Fawkes Interface generator - Usage Instructions" << endl
48 <<
"===============================================================================" << endl
49 <<
"Usage: " << argv[0] <<
" [-h] [-d dir] [-v] config.xml [config2.xml...]" << endl
50 <<
"where [options] is one or more of:" << endl
51 <<
" -h These help instructions" << endl
52 <<
" -d dir Directory where to write generated files" << endl
53 <<
" -v Verbose console output." << endl
61 for ( vector<const char *>::const_iterator i = items.begin(); i != items.end(); ++i) {
66 if ( ( pos = s.find_last_of (
".")) != string::npos ) {
67 prefix = s.substr(0, pos);
72 if ( ( pos = s.find_last_of (
"/")) != string::npos ) {
73 prefix = s.substr(pos + 1);
78 if ( ! File::exists( *i ) ) {
79 cout <<
"File " << *i <<
" does not exist" << endl;
81 }
else if (! File::is_regular( *i ) ) {
82 cout << *i <<
" is not a regular file" << endl;
128 toluaigen->generate();
136 cout <<
"Generating the interface failed." << endl;