The libs library contains several modules from libcs50 that were used in our implementation of Nuggets:
file- functions to read files (includes readLine)memory- handy wrappers for malloc/free
Both the modules included in libs are used in our implementation of the Nuggets game
file provides file utilities (reading a word, line, or file) and exports the following functions:
int file_numLines(FILE* fp);
static int never(int c);
static int isnewline(int c);
char* file_readFile(FILE* fp);
char* file_readLine(FILE* fp);
char* file_readWord(FILE* fp);
char* file_readUntil(FILE* fp, int (*stopfunc)(int c));
int main(int argc, char* argv[]);memory provides wrappers for malloc/free and exports the following functions:
void* mem_assert(void* ptr, const char* message);
const void* mem_assert_const(const void* ptr, const char* message);
void* mem_malloc_assert(const size_t size, const char* message);
void* mem_malloc(const size_t size);
void* mem_calloc_assert(const size_t nmemb, const size_t size, const char* message);
void* mem_calloc(const size_t nmemb, const size_t size);
void mem_free(void* ptr);
void mem_report(FILE* fp, const char* message);
int mem_net(void);See file.h for more details regarding the implementation of the functions in this module.
See mem.h for more details regarding the implementation of the functions in this module.
Makefile- compilation procedure
file.h- the interfacefile.c- the implementation
mem.h- the interfacemem.c- the implementation
To compile, simply make.
We did not unit test these modules as they were provided by the libcs50 library.