mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Make obj_dir only when needed, and use OS calls rather than system to clean up
git-svn-id: file://localhost/svn/verilator/trunk/verilator@984 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
@@ -226,6 +226,55 @@ string V3Options::filePath (FileLine* fl, const string& modname, const string& e
|
||||
return "";
|
||||
}
|
||||
|
||||
void V3Options::unlinkRegexp(const string& dir, const string& regexp) {
|
||||
if (DIR* dirp = opendir(dir.c_str())) {
|
||||
while (struct dirent* direntp = readdir(dirp)) {
|
||||
if (wildmatch(direntp->d_name, regexp.c_str())) {
|
||||
string fullname = dir + "/" + string(direntp->d_name);
|
||||
unlink (fullname.c_str());
|
||||
}
|
||||
}
|
||||
closedir(dirp);
|
||||
}
|
||||
}
|
||||
|
||||
// Double procedures, inlined, unrolls loop much better
|
||||
inline bool V3Options::wildmatchi(const char* s, const char* p) {
|
||||
for ( ; *p; s++, p++) {
|
||||
if (*p!='*') {
|
||||
if (((*s)!=(*p)) && *p != '?')
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Trailing star matches everything.
|
||||
if (!*++p) return true;
|
||||
while (wildmatch(s, p) == false)
|
||||
if (*++s == '\0')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return(*s == '\0' || *s == '[');
|
||||
}
|
||||
|
||||
bool V3Options::wildmatch(const char* s, const char* p) {
|
||||
for ( ; *p; s++, p++) {
|
||||
if (*p!='*') {
|
||||
if (((*s)!=(*p)) && *p != '?')
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Trailing star matches everything.
|
||||
if (!*++p) return true;
|
||||
while (wildmatchi(s, p) == false)
|
||||
if (*++s == '\0')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return(*s == '\0' || *s == '[');
|
||||
}
|
||||
|
||||
//######################################################################
|
||||
// V3 Options accessors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user