#include <stdio.h>
#include <string.h>
#include <string>
#include <fstream>
#include <iostream>
Go to the source code of this file.
Functions | |
void | copyFirstHalf (FILE *file, FILE *dst) |
void | copySecondHalf (FILE *file, FILE *dst) |
void | copyZeroHalf (FILE *file, FILE *dst) |
void | copyFile (FILE *file, FILE *dst) |
void | streamCopyUntil (istream &src, ostream &dst, const string &until) |
Copy src to dst until specific line. | |
void | streamCopyUntilEnd (istream &src, ostream &dst) |
Copy src to dst until end. | |
void | streamCopy (istream &src, ostream &dst) |
Copy src to dst. | |
ifstream * | open_arch_stream (const char *filename) |
Try to open an architecture file searching in various directories. | |
FILE * | fopensearch (const char *filename, string &fullpath) |
Try to open the file <filename> searching in various directories. | |
bool | check_file (const char *filename) |
Check if a file exists. | |
const char * | filebasename (const char *name) |
bool check_file | ( | const char * | filename | ) |
Check if a file exists.
Definition at line 124 of file enrobage.cpp.
Referenced by process_cmdline().
00125 { 00126 FILE* f = fopen(filename, "r"); 00127 00128 if (f == NULL) { 00129 fprintf(stderr, "faust: "); perror(filename); 00130 } else { 00131 fclose(f); 00132 } 00133 return f != NULL; 00134 }
void copyFile | ( | FILE * | file, | |
FILE * | dst | |||
) |
void copyFirstHalf | ( | FILE * | file, | |
FILE * | dst | |||
) |
void copySecondHalf | ( | FILE * | file, | |
FILE * | dst | |||
) |
void copyZeroHalf | ( | FILE * | file, | |
FILE * | dst | |||
) |
const char* filebasename | ( | const char * | name | ) |
Definition at line 316 of file enrobage.cpp.
References IS_DIR_SEPARATOR.
Referenced by copyFaustSources(), and printfaustlisting().
00317 { 00318 #if defined (HAVE_DOS_BASED_FILE_SYSTEM) 00319 /* Skip over the disk name in MSDOS pathnames. */ 00320 if (isalpha(name[0]) && name[1] == ':') 00321 name += 2; 00322 #endif 00323 00324 const char* base; 00325 for (base = name; *name; name++) 00326 { 00327 if (IS_DIR_SEPARATOR (*name)) 00328 { 00329 base = name + 1; 00330 } 00331 } 00332 return base; 00333 }
FILE* fopensearch | ( | const char * | filename, | |
string & | fullpath | |||
) |
Try to open the file <filename> searching in various directories.
If succesful place its full pathname in the string <fullpath>
Definition at line 258 of file enrobage.cpp.
References buildFullPathname(), fopenat(), gFaustDirectory, gFaustSuperDirectory, gFaustSuperSuperDirectory, and gMasterDirectory.
Referenced by SourceReader::parse().
00259 { 00260 FILE* f; 00261 00262 00263 if ((f = fopen(filename, "r"))) { 00264 buildFullPathname(fullpath, filename); 00265 return f; 00266 } 00267 if ((f = fopenat(fullpath, gMasterDirectory, filename))) { 00268 return f; 00269 } 00270 if ((f = fopenat(fullpath, gFaustDirectory, "architecture", filename))) { 00271 return f; 00272 } 00273 if ((f = fopenat(fullpath, gFaustSuperDirectory, "architecture", filename))) { 00274 return f; 00275 } 00276 if ((f = fopenat(fullpath, gFaustSuperSuperDirectory, "architecture", filename))) { 00277 return f; 00278 } 00279 if ((f = fopenat(fullpath, "/usr/local/lib/faust", filename))) { 00280 return f; 00281 } 00282 if ((f = fopenat(fullpath, "/usr/lib/faust", filename))) { 00283 return f; 00284 } 00285 return 0; 00286 }
ifstream* open_arch_stream | ( | const char * | filename | ) |
Try to open an architecture file searching in various directories.
Definition at line 69 of file enrobage.cpp.
References FAUST_PATH_MAX, gFaustDirectory, gFaustSuperDirectory, and gFaustSuperSuperDirectory.
Referenced by main(), and openArchFile().
00070 { 00071 char buffer[FAUST_PATH_MAX]; 00072 char* old = getcwd (buffer, FAUST_PATH_MAX); 00073 int err; 00074 00075 { 00076 ifstream* f = new ifstream(); 00077 f->open(filename, ifstream::in); if (f->is_open()) return f; else delete f; 00078 } 00079 if ( (chdir(gFaustDirectory.c_str())==0) && (chdir("architecture")==0) ) { 00080 //cout << "enrobage.cpp : 'architecture' directory found in gFaustDirectory" << endl; 00081 ifstream* f = new ifstream(); 00082 f->open(filename, ifstream::in); 00083 if (f->good()) return f; else delete f; 00084 } 00085 err = chdir(old); 00086 if ((chdir(gFaustSuperDirectory.c_str())==0) && (chdir("architecture")==0) ) { 00087 //cout << "enrobage.cpp : 'architecture' directory found in gFaustSuperDirectory" << endl; 00088 ifstream* f = new ifstream(); 00089 f->open(filename, ifstream::in); 00090 if (f->good()) return f; else delete f; 00091 } 00092 err = chdir(old); 00093 if ((chdir(gFaustSuperSuperDirectory.c_str())==0) && (chdir("architecture")==0) ) { 00094 //cout << "enrobage.cpp : 'architecture' directory found in gFaustSuperSuperDirectory" << endl; 00095 ifstream* f = new ifstream(); 00096 f->open(filename, ifstream::in); 00097 if (f->good()) return f; else delete f; 00098 } 00099 err = chdir(old); 00100 if (chdir("/usr/local/lib/faust")==0) { 00101 ifstream* f = new ifstream(); 00102 f->open(filename); 00103 if (f->good()) return f; else delete f; 00104 } 00105 err = chdir(old); 00106 if (chdir("/usr/lib/faust")==0) { 00107 ifstream* f = new ifstream(); 00108 f->open(filename); 00109 if (f->good()) return f; else delete f; 00110 } 00111 00112 return 0; 00113 }
void streamCopy | ( | istream & | src, | |
ostream & | dst | |||
) |
Copy src to dst.
Definition at line 50 of file enrobage.cpp.
Referenced by main().
void streamCopyUntil | ( | istream & | src, | |
ostream & | dst, | |||
const string & | until | |||
) |
Copy src to dst until specific line.
Definition at line 41 of file enrobage.cpp.
Referenced by main().
void streamCopyUntilEnd | ( | istream & | src, | |
ostream & | dst | |||
) |
Copy src to dst until end.
Definition at line 59 of file enrobage.cpp.
Referenced by main().