#include "idep_compiledep.h"#include "idep_namearray.h"#include "idep_nameindexmap.h"#include "idep_binrel.h"#include "idep_string.h"#include "idep_filedepiter.h"#include "idep_tokeniter.h"#include <ctype.h>#include <cstring>#include <fstream>#include <iostream>#include <cassert>Go to the source code of this file.
Classes | |
| struct | idep_CompileDep_i |
| struct | idep_RootFileIter_i |
| struct | idep_HeaderFileIter_i |
Typedefs | |
| typedef void(idep_CompileDep::* | Func )(const char *) |
Functions | |
| std::ostream & | err (std::ostream &orr) |
| const char * | stripDotSlash (const char *originalPath) |
| int | isAbsolutePath (const char *originalPath) |
| int | isAsciiFile (const char *fileName) |
| void | loadFromStream (std::istream &in, idep_CompileDep *dep, Func add) |
| int | loadFromFile (const char *file, idep_CompileDep *dep, Func add) |
| const char * | search (idep_String *s, const char *includeDir, const char *file) |
| const char * | search (idep_String *s, const idep_NameArray &a, const char *file) |
| int | getDep (int index) |
| std::ostream & | operator<< (std::ostream &o, const idep_CompileDep &(dep)) |
Variables | |
| idep_BinRel * | s_dependencies_p |
| idep_NameIndexMap * | s_files_p |
| idep_NameArray * | s_includes_p |
| int | s_recurse |
| std::ostream * | s_err_p |
|
|
Definition at line 56 of file idep_cdep.cxx. |
|
|
Definition at line 18 of file idep_cdep.cxx. 00019 {
00020 return orr << "Error: ";
00021 }
|
|
|
Definition at line 127 of file idep_cdep.cxx. References idep_BinRel::appendEntry(), BAD, idep_NameIndexMap::entry(), err(), GOOD, idep_FileDepIter::isValidFile(), idep_NameIndexMap::length(), s_dependencies_p, s_err_p, s_files_p, s_includes_p, s_recurse, search(), and idep_BinRel::set(). Referenced by idep_CompileDep::calculate(). 00128 {
00129 enum { BAD = -1, GOOD = 0 } status = GOOD;
00130
00131 idep_String buffer; // string buffer, do not use directly
00132 idep_FileDepIter it((*s_files_p)[index]);
00133
00134 for (; it; ++it) {
00135 const char *dirFile = search(&buffer, *s_includes_p, it());
00136 if (!dirFile) {
00137 err(*s_err_p) << "include directory for file \""
00138 << it() << "\" not specified." << std::endl;
00139 status = BAD;
00140 continue;
00141 }
00142
00143 int length = s_files_p->length();
00144 int otherIndex = s_files_p->entry(dirFile);
00145
00146 if (s_files_p->length() > length) {
00147 // first time looking at this file
00148 s_dependencies_p->appendEntry();
00149
00150 if (s_recurse && getDep(otherIndex)) {
00151 status = BAD;
00152 }
00153 }
00154
00155 s_dependencies_p->set(index, otherIndex, 1);
00156 }
00157
00158 if (!it.isValidFile()) {
00159 err(*s_err_p) << "unable to open file \""
00160 << (*s_files_p)[index] << "\" for read access." << std::endl;
00161 status = BAD;
00162 }
00163
00164 return status;
00165 }
|
|
|
Definition at line 33 of file idep_cdep.cxx. Referenced by operator<<(), and search(). 00034 {
00035 return '/' == *originalPath;
00036 }
|
|
|
Definition at line 38 of file idep_cdep.cxx. Referenced by loadFromFile(). 00039 {
00040 enum { NO = 0, YES = 1 };
00041 std::ifstream in(fileName);
00042 if (!in) {
00043 return NO;
00044 }
00045
00046 // check for non-ascii characters
00047 char c;
00048 while (in && !in.get(c).eof()) {
00049 if (!isascii(c)) {
00050 return NO;
00051 }
00052 }
00053 return YES;
00054 }
|
|
||||||||||||||||
|
Definition at line 73 of file idep_cdep.cxx. References BAD, GOOD, isAsciiFile(), and loadFromStream(). Referenced by idep_AliasDep::readFileNames(), idep_AliasDep::readIgnoreNames(), idep_CompileDep::readIncludeDirectories(), and idep_CompileDep::readRootFiles(). 00074 {
00075 enum { BAD = -1, GOOD = 0 };
00076 if (!isAsciiFile(file)) {
00077 return BAD;
00078 }
00079 std::ifstream in(file);
00080 assert(in);
00081 loadFromStream(in, dep, add);
00082 return GOOD;
00083 }
|
|
||||||||||||||||
|
Definition at line 57 of file idep_cdep.cxx. Referenced by idep_AliasDep::inputFileNames(), idep_CompileDep::inputRootFiles(), and loadFromFile(). 00058 {
00059 assert(in);
00060 for (idep_TokenIter it(in); it; ++it) {
00061 if ('#' == *it()) { // strip comment if any
00062 while (it && '\n' != *it()) {
00063 ++it;
00064 }
00065 continue; // either !it or '\n'
00066 }
00067 if ('\n' != *it()) {
00068 (dep->*add)(it());
00069 }
00070 }
00071 }
|
|
||||||||||||
|
Definition at line 317 of file idep_cdep.cxx. References idep_NameArray::append(), isAbsolutePath(), and idep_NameArray::length(). 00318 {
00319 const char *INDENT = " ";
00320 for (idep_RootFileIter rit(dep); rit; ++rit) {
00321 idep_NameArray a;
00322 o << rit() << std::endl;
00323 for (idep_HeaderFileIter hit(rit); hit; ++hit) {
00324 if (isAbsolutePath(hit())) {
00325 a.append(hit());
00326 }
00327 else {
00328 o << INDENT << hit() << std::endl;
00329 }
00330 }
00331 for (int i = 0; i < a.length(); ++i) {
00332 o << INDENT << a[i] << std::endl;
00333 }
00334 o << std::endl;
00335 }
00336 return o;
00337 }
|
|
||||||||||||||||
|
Definition at line 94 of file idep_cdep.cxx. References isAbsolutePath(), idep_NameArray::length(), and s(). Referenced by idep_CompileDep::calculate(), and getDep(). 00096 {
00097 if (isAbsolutePath(file)) {
00098 *s = file;
00099 const char *absFile = *s;
00100 return std::ifstream(absFile) ? absFile : 0;
00101 }
00102
00103 const char *dirFile = 0;
00104 for (int i = 0; i < a.length(); ++i) {
00105 dirFile = search(s, a[i], file);
00106 if (dirFile) {
00107 break;
00108 }
00109 }
00110
00111 return dirFile;
00112 }
|
|
||||||||||||||||
|
Definition at line 85 of file idep_cdep.cxx. References isAbsolutePath(), s(), and stripDotSlash(). 00087 {
00088 assert(!isAbsolutePath(file));
00089 (*s = includeDir) += file;
00090 const char *dirFile = stripDotSlash(*s);
00091 return std::ifstream(dirFile) ? dirFile : 0;
00092 }
|
|
|
Definition at line 23 of file idep_cdep.cxx. 00024 {
00025 if (originalPath) {
00026 while ('.' == originalPath[0] && '/' == originalPath[1]) {
00027 originalPath += 2;
00028 }
00029 }
00030 return originalPath;
00031 }
|
|
|
Definition at line 121 of file idep_cdep.cxx. Referenced by idep_CompileDep::calculate(), and getDep(). |
|
|
Definition at line 125 of file idep_cdep.cxx. Referenced by idep_CompileDep::calculate(), and getDep(). |
|
|
Definition at line 122 of file idep_cdep.cxx. Referenced by idep_CompileDep::calculate(), and getDep(). |
|
|
Definition at line 123 of file idep_cdep.cxx. Referenced by idep_CompileDep::calculate(), and getDep(). |
|
|
Definition at line 124 of file idep_cdep.cxx. Referenced by idep_CompileDep::calculate(), and getDep(). |
1.3.9.1