mirror of
https://github.com/nasa/trick.git
synced 2025-02-20 09:16:20 +00:00
Introduce Open Dynamics Engine examples
I want Trick to parse and understand ODE header files. The ODE header files include some typedef constructs ICG was skipping. Added code to handle the typedefs we did not handle before. Also made a small change the way TRICK_ICG_EXCLDUE and TRICK_EXCLUDE are used so that they support excluding individual files as well as directories.
This commit is contained in:
parent
68ffd04dff
commit
71dab9ed45
@ -429,6 +429,9 @@ bool FieldVisitor::VisitTypedefType(clang::TypedefType *tt) {
|
||||
}
|
||||
|
||||
if ( tt->isEnumeralType() ) {
|
||||
if ( debug_level >= 4 ) {
|
||||
std::cout << " FieldVisitor VisitTypedefType enumerated" << std::endl ;
|
||||
}
|
||||
fdes->setEnumString("TRICK_ENUMERATED") ;
|
||||
fdes->setEnum(true) ;
|
||||
std::string enum_type_name = tt->desugar().getAsString() ;
|
||||
@ -534,8 +537,28 @@ bool FieldVisitor::VisitTypedefType(clang::TypedefType *tt) {
|
||||
fdes->setTypeName(type_name) ;
|
||||
fdes->setHasType(true) ;
|
||||
} else if ( tt->isBuiltinType() ) {
|
||||
if ( debug_level >= 4 ) {
|
||||
std::cout << " FieldVisitor VisitTypedefType builtintype" << std::endl ;
|
||||
}
|
||||
const clang::BuiltinType * bt = tt->getAs<clang::BuiltinType>() ;
|
||||
VisitBuiltinType((clang::BuiltinType *)bt) ;
|
||||
} else if ( tt->isArrayType() || tt->isPointerType()) {
|
||||
clang::QualType qt = tt->desugar() ;
|
||||
if ( debug_level >= 4 ) {
|
||||
std::cout << "Typedef to constant array type" << std::endl ;
|
||||
qt->dump() ;
|
||||
}
|
||||
// Calling visit type recursively with the typedeffed type
|
||||
TraverseType(qt) ;
|
||||
|
||||
if ( debug_level >= 4 ) {
|
||||
std::cout << "After TraverseType" << std::endl ;
|
||||
std::cout << *fdes << std::endl ;
|
||||
}
|
||||
} else {
|
||||
if ( debug_level >= 4 ) {
|
||||
std::cout << "Typedef to something we don't handle yet" << std::endl ;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
@ -138,7 +139,13 @@ void HeaderSearchDirs::AddICGExcludeDirs () {
|
||||
if ( ! item.empty() ) {
|
||||
char * resolved_path = realpath(item.c_str(), NULL) ;
|
||||
if ( resolved_path ) {
|
||||
icg_exclude_dirs.push_back(std::string(resolved_path) + std::string("/"));
|
||||
std::ifstream file_or_dir(resolved_path) ;
|
||||
file_or_dir.seekg(0, std::ios::end) ;
|
||||
if ( !file_or_dir.good()) {
|
||||
icg_exclude_dirs.push_back(std::string(resolved_path) + std::string("/"));
|
||||
} else {
|
||||
icg_exclude_dirs.push_back(std::string(resolved_path));
|
||||
}
|
||||
} else {
|
||||
std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ;
|
||||
}
|
||||
@ -160,7 +167,13 @@ void HeaderSearchDirs::AddExcludeDirs () {
|
||||
if ( ! item.empty() ) {
|
||||
char * resolved_path = realpath(item.c_str(), NULL) ;
|
||||
if ( resolved_path ) {
|
||||
exclude_dirs.push_back(std::string(resolved_path) + std::string("/"));
|
||||
std::ifstream file_or_dir(resolved_path) ;
|
||||
file_or_dir.seekg(0, std::ios::end) ;
|
||||
if ( !file_or_dir.good()) {
|
||||
exclude_dirs.push_back(std::string(resolved_path) + std::string("/"));
|
||||
} else {
|
||||
exclude_dirs.push_back(std::string(resolved_path));
|
||||
}
|
||||
} else {
|
||||
std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ;
|
||||
}
|
||||
|
@ -180,11 +180,11 @@ bool PrintAttributes::openIOFile(std::string header_file_name) {
|
||||
icg_no_files.push_back(rp) ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (ICG exclude dir " <<
|
||||
std::cout << "[33mICG skipping " << rp << " (ICG exclude " <<
|
||||
hsd.getPathInICGExclude(rp) << ")[00m" << std::endl ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (exclude dir " <<
|
||||
std::cout << "[33mICG skipping " << rp << " (exclude " <<
|
||||
hsd.getPathInExclude(rp) << ")[00m" << std::endl ;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user