00001 #ifndef NPS_VOC_H 00002 #define NPS_VOC_H 00003 #include "../error/error.h" 00004 #include "../nps/Object.h" 00005 00006 /* Intern strings-- convert each unique string into an integer index */ 00007 00008 extern const struct Nps_Intern *Nps_Intern ; 00009 /* class initialization*/ 00010 extern int nps_initIntern(nps_error_t *); 00011 /* Build a new Object */ 00012 extern struct Nps_Intern* nps_newIntern(nps_error_t *err, int64_t size); 00013 extern struct Nps_Intern *nps_InternFromFile(nps_error_t *err, const char *filename); 00014 /* number of interned strings */ 00015 extern int64_t nps_InternLen(struct Nps_Intern *o); 00016 /* prevent further alteration of the database */ 00017 extern void nps_InternFreeze(struct Nps_Intern *o); 00018 /* query database state (frozen vs mutable) */ 00019 extern char nps_InternIsFrozen(struct Nps_Intern *o); 00020 /* reverse the order for string processing */ 00021 extern char** nps_InternInvert(struct Nps_Intern *o, nps_error_t *err); 00022 /* write the intern database to a file */ 00023 extern int nps_InternToFile(struct Nps_Intern *o, nps_error_t *err, const char *filename); 00024 00025 00026 /* fill result with string index. Return non-zero on failure. 00027 Return -1 when the database is frozen and the query is unknown 00028 */ 00029 extern int nps_InternIntern(struct Nps_Intern *o, nps_error_t *err, const char *const key, 00030 int64_t *result); 00031 00032 #endif