Changeset 7f51b9d
- Timestamp:
- Aug 15, 2020, 12:20:08 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 762fbc1
- Parents:
- 0fa04a04
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
driver/cfa.cc
r0fa04a04 r7f51b9d 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 13 17:22:02202013 // Update Count : 43 512 // Last Modified On : Fri Aug 14 07:22:03 2020 13 // Update Count : 437 14 14 // 15 15 16 16 #include <iostream> 17 #include <cstdio> 18 #include <cstdlib> 19 #include <climits> 20 #include <unistd.h> 21 #include <string> 22 #include <string.h> 23 #include <algorithm> 17 #include <cstdio> // perror 18 #include <cstdlib> // putenv, exit 19 #include <climits> // PATH_MAX 20 #include <unistd.h> // execvp 21 #include <string> // STL version 22 #include <string.h> // strcmp 23 #include <algorithm> // find 24 24 25 25 #include <sys/types.h> … … 36 36 // #define __DEBUG_H__ 37 37 38 #define xstr(s) str(s) 39 #define str(s) #s 40 38 41 // "N__=" suffix 39 42 static string __CFA_FLAGPREFIX__( "__CFA_FLAG" ); 40 43 41 void Putenv( char * argv[], string arg ) {44 static void Putenv( char * argv[], string arg ) { 42 45 // environment variables must have unique names 43 46 static int flags = 0; … … 49 52 } // Putenv 50 53 51 // check if string has prefix 52 bool prefix( const string & arg, const string & pre ) { 54 static bool prefix( const string & arg, const string & pre ) { // check if string has prefix 53 55 return arg.substr( 0, pre.size() ) == pre; 54 56 } // prefix 55 57 56 inline bool ends_with(const string & str, const string & sfix) {58 static inline bool ends_with(const string & str, const string & sfix) { 57 59 if (sfix.size() > str.size()) return false; 58 60 return std::equal(str.rbegin(), str.rbegin() + sfix.size(), sfix.rbegin(), sfix.rend()); … … 60 62 61 63 // check if string has suffix 62 bool suffix( const string & arg ) {64 static bool suffix( const string & arg ) { 63 65 enum { NumSuffixes = 3 }; 64 66 static const string suffixes[NumSuffixes] = { "cfa", "hfa", "ifa" }; … … 70 72 } // suffix 71 73 72 73 74 static inline bool dirExists( const string & path ) { // check if directory exists 74 75 struct stat info; … … 79 80 static inline string dir(const string & path) { 80 81 return path.substr(0, path.find_last_of('/')); 81 } 82 } // dir 82 83 83 84 // Different path modes … … 118 119 } 119 120 120 121 #define xstr(s) str(s)122 #define str(s) #s123 121 124 122 int main( int argc, char * argv[] ) {
Note: See TracChangeset
for help on using the changeset viewer.