*** empty log message ***

This commit is contained in:
David Rose 2001-03-08 21:04:54 +00:00
parent b1d25146c3
commit ee8f10684d
4 changed files with 44 additions and 6 deletions

View File

@ -2029,7 +2029,7 @@ element:
| KW_SHORT | KW_SIGNED | KW_SIZEOF | KW_STATIC | KW_STATIC_CAST
| KW_STRUCT | KW_THROW | KW_TRUE | KW_TRY | KW_TYPEDEF | KW_TYPENAME
| KW_UNION | KW_UNSIGNED | KW_VIRTUAL | KW_VOID | KW_VOLATILE
| KW_WHILE
| KW_WHILE | TOKENPASTE
| KW_OPERATOR
{
}

View File

@ -58,6 +58,42 @@ CPPFile::
~CPPFile() {
}
////////////////////////////////////////////////////////////////////
// Function: CPPFile::is_c_or_i_file
// Access: Public
// Description: Returns true if the file appears to be a C or C++
// source code file based on its extension. That is,
// returns true if the filename ends in .c, .C, .cc,
// .cpp, or any of a series of likely extensions.
////////////////////////////////////////////////////////////////////
bool CPPFile::
is_c_or_i_file() const {
return is_c_or_i_file(_filename);
}
////////////////////////////////////////////////////////////////////
// Function: CPPFile::is_c_or_i_file
// Access: Public, Static
// Description: Returns true if the file appears to be a C or C++
// source code file based on its extension. That is,
// returns true if the filename ends in .c, .C, .cc,
// .cpp, or any of a series of likely extensions.
////////////////////////////////////////////////////////////////////
bool CPPFile::
is_c_or_i_file(const Filename &filename) {
string extension = filename.get_extension();
// downcase the extension.
for (string::iterator ei = extension.begin();
ei != extension.end();
++ei) {
(*ei) = tolower(*ei);
}
return (extension == "c" || extension == "cc" ||
extension == "cpp" || extension == "c++" || extension == "cxx" ||
extension == "i");
}
////////////////////////////////////////////////////////////////////
// Function: CPPFile::is_c_file
// Access: Public
@ -90,8 +126,7 @@ is_c_file(const Filename &filename) {
}
return (extension == "c" || extension == "cc" ||
extension == "cpp" || extension == "c++" || extension == "cxx" ||
extension == "i");
extension == "cpp" || extension == "c++" || extension == "cxx");
}
////////////////////////////////////////////////////////////////////

View File

@ -32,6 +32,9 @@ public:
void operator = (const CPPFile &copy);
~CPPFile();
bool is_c_or_i_file() const;
static bool is_c_or_i_file(const Filename &filename);
bool is_c_file() const;
static bool is_c_file(const Filename &filename);

View File

@ -66,7 +66,7 @@ add_source_file(const string &filename) {
return;
}
if (!CPPFile::is_c_file(filename)) {
if (!CPPFile::is_c_or_i_file(filename)) {
_include_files.insert('"' + filename + '"');
}
}
@ -198,7 +198,7 @@ build() {
++ii) {
const string &filename = (*ii);
// Don't add any C files to the include list.
if (!CPPFile::is_c_file(filename)) {
if (!CPPFile::is_c_or_i_file(filename)) {
_include_files.insert('"' + filename + '"');
}
}
@ -207,7 +207,7 @@ build() {
++ii) {
const string &filename = (*ii);
// Don't add any C files to the include list.
if (!CPPFile::is_c_file(filename)) {
if (!CPPFile::is_c_or_i_file(filename)) {
_include_files.insert('<' + filename + '>');
}
}