Go to the source code of this file.
Defines |
#define | ROW_MAJOR_IDX(R, C, NCOL) ((R)*(NCOL) + (C)) |
#define | min(a, b) ((a)>(b)?(b):(a)) |
#define | max(a, b) ((a)>(b)?(a):(b)) |
Functions |
bool | endsWith (char *string, char *ending) |
char * | strip (char *aString) |
int | longestName (char *filenames[], int nFiles) |
bool | lowerStrNCmp (const char *str1, const char *str2, int n) |
void | stringTokenizer (char *line) |
char * | nextToken () |
char * | constructFileName (char *basedir, const char *filename) |
char * | td_malloc (size_t size) |
void | td_free (void *mem, size_t size) |
long | getMemoryReport () |
DIR * | exists (const char *name) |
bool | isWritable (char *pathname) |
bool | isReadable (char *pathname) |
void | copyFiles (const char *source, const char *dest) |
char * | getNextEmptyDirectory (char *baseDir) |
DIR * | getDirectoryR (char *dirName) |
DIR * | getDirectory (char *dirName) |
char * | getParent (char *path) |
void | getParentNChild (char *path, char **parent, char **child) |
Define Documentation
#define max |
( |
|
a, |
|
|
|
b | |
|
) |
| | ((a)>(b)?(a):(b)) |
#define min |
( |
|
a, |
|
|
|
b | |
|
) |
| | ((a)>(b)?(b):(a)) |
#define ROW_MAJOR_IDX |
( |
|
R, |
|
|
|
C, |
|
|
|
NCOL | |
|
) |
| | ((R)*(NCOL) + (C)) |
Function Documentation
char* constructFileName |
( |
char * |
basedir, |
|
|
const char * |
filename | |
|
) |
| | |
void copyFiles |
( |
const char * |
source, |
|
|
const char * |
dest | |
|
) |
| | |
Copy file from source to destination. This function make a system call to perform the copy.
- Parameters:
-
[in] | source | Character string containing path to source file. |
[in] | dest | Character string containing path to destination. |
bool endsWith |
( |
char * |
string, |
|
|
char * |
ending | |
|
) |
| | |
DIR* exists |
( |
const char * |
name |
) |
|
DIR* getDirectory |
( |
char * |
dirName |
) |
|
Get the directory structure (pointer) associated with a string name If the directory exists, return a pointer to it. If the directory doesn't exist, create it and return a pointer to it. If the directory cannot be created, report an error and return NULL.
- Parameters:
-
[in] | dirName | Character string containing full path for directory. |
- Returns:
- A pointer to a system DIR structure.
DIR* getDirectoryR |
( |
char * |
dirNameOrig |
) |
|
Get directory recursive; start a the left side and create or get each part of the directory.
- Parameters:
-
[in] | dirNameOrig | Character string containing the full directory path |
- Returns:
- A pointer to a system DIR structure.
char* getNextEmptyDirectory |
( |
char * |
baseDir |
) |
|
function to parse base output directory line find a directory that is empty, create one if needed by appending _v2, _v3, etc. up to _v9999, which is the max.
- Parameters:
-
[in] | baseDir | Character string containing full path to a directory. |
- Returns:
- a pointer to a character string that contains an empty output directory; NULL if an appropriate output directory cannot be found.
char* getParent |
( |
char * |
path |
) |
|
Get the parent part of the path.
- Parameters:
-
[in] | path | String containing the full path. |
- Returns:
- String containing the parent part of the path.
void getParentNChild |
( |
char * |
path, |
|
|
char ** |
parentPtr, |
|
|
char ** |
childPtr | |
|
) |
| | |
Split path into parent and child
- Parameters:
-
[in] | path | String containing path to split. |
[in,out] | parentPtr | Pointer to string containing parent name. |
[in,out] | childPtr | Pointer to string containing child name. |
bool isReadable |
( |
char * |
pathname |
) |
|
Determine if the directory or file is accessible for reading.
- Parameters:
-
[in] | pathname | Character string containing the name of the directory or file. |
- Returns:
- true if the resource is accessible for reading.
bool isWritable |
( |
char * |
pathname |
) |
|
Determine if we have write permission to the directory.
- Parameters:
-
[in] | pathname | Character string containing full path to directory. |
- Returns:
- true is if write access; false otherwise.
int longestName |
( |
char * |
filenames[], |
|
|
int |
nFiles | |
|
) |
| | |
bool lowerStrNCmp |
( |
const char * |
str1, |
|
|
const char * |
str2, |
|
|
int |
n | |
|
) |
| | |
Compare two string up to n characters. Comparison is done with lowercase version of each string.
- Parameters:
-
[in] | str1 | A string to compare. |
[in] | str2 | Another string to compare. |
[in] | n | maximum number of characters to compare. |
- Returns:
- TRUE if strings are equal; FALSE otherwise.
stringTokenizer and nextToken work together to parse a character string into tokens, separated by spaces. nextToken finds the next set of non-white space characters, which is considered a token.
- Returns:
- The next token in the string or NULL if there are no more tokens.
void stringTokenizer |
( |
char * |
line |
) |
|
stringTokenizer and nextToken work together to parse a character string into tokens, separated by spaces. stringTokenizer intializes variables for breaking a string into tokens.
- Parameters:
-
[in] | line | The string to break into words. |
char* strip |
( |
char * |
aString |
) |
|
void td_free |
( |
void * |
mem, |
|
|
size_t |
size | |
|
) |
| | |
char* td_malloc |
( |
size_t |
size |
) |
|