#ifndef _DATABASE_H #define _DATABASE_H #include #include typedef enum {database_read, database_write} database_permission; int open_database(char* dbFileName, database_permission permission); void close_database(); void pack_database(); typedef long FileID; FileID add_file(char* fileName); void add_file_property(FileID file, const char* property, const char* value); char* lookup_file_property(FileID file, const char* property); void print_all_properties(FileID fileid, FILE* to_file); /* user must free up the memory since it is created using 'malloc' */ char* lookup_file(FileID id); void add_word(char* word, FileID file, long score, long first_line); typedef struct { FileID file; long score; long first_line; } word_record; /* returns the number of different files it is located in, sets the pointer * indicated by wordlist_alias to point to an allocated array of word_records. * this memory is allocated on the heap and must be freed by the recipient. */ int lookup_word(char* word, word_record** wordlist_alias); #endif