Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UTILITIES_H_
00009 #define UTILITIES_H_
00010
00011 #include <stdlib.h>
00012 #include <stdbool.h>
00013 #include <dirent.h>
00014 #include "coreVersion.h"
00015
00016 #define ROW_MAJOR_IDX(R, C, NCOL) ((R)*(NCOL) + (C))
00017
00018 #define min(a,b) ((a)>(b)?(b):(a))
00019 #define max(a,b) ((a)>(b)?(a):(b))
00020
00021 bool endsWith(char *string, char *ending);
00022 char *strip(char *aString);
00023 int longestName(char *filenames[], int nFiles);
00024 bool lowerStrNCmp(const char *str1, const char *str2, int n);
00025
00026
00027 void stringTokenizer(char *line);
00028 char *nextToken();
00029
00030 char *constructFileName(char *basedir, const char *filename);
00031
00032 char *td_malloc(size_t size);
00033
00034 void td_free(void *mem, size_t size);
00035 long getMemoryReport();
00036
00037 DIR *exists(const char *name);
00038
00039 bool isWritable(char *pathname);
00040
00041 bool isReadable(char *pathname);
00042
00043 void copyFiles(const char *source, const char *dest);
00044
00045 char *getNextEmptyDirectory(char *baseDir);
00046
00047 DIR *getDirectoryR(char *dirName);
00048 DIR *getDirectory(char *dirName);
00049
00050 char *getParent(char *path);
00051 void getParentNChild(char *path, char **parent, char **child);
00052
00053 #endif