bool util_filexists (const char *);
bool util_strupper (const char *);
bool util_strdigit (const char *);
-char *util_strdup (const char *);
+char *_util_Estrdup (const char *, const char *, size_t);
void util_debug (const char *, const char *, ...);
void util_endianswap (void *, size_t, unsigned int);
#ifdef NOTRACK
-# define mem_a(x) malloc (x)
-# define mem_d(x) free ((void*)x)
-# define mem_r(x, n) realloc((void*)x, n)
+# define mem_a(x) malloc (x)
+# define mem_d(x) free ((void*)x)
+# define mem_r(x, n) realloc((void*)x, n)
+# define mem_af(x,f,l) malloc (x)
#else
-# define mem_a(x) util_memory_a((x), __LINE__, __FILE__)
-# define mem_d(x) util_memory_d((void*)(x))
-# define mem_r(x, n) util_memory_r((void*)(x), (n), __LINE__, __FILE__)
+# define mem_a(x) util_memory_a((x), __LINE__, __FILE__)
+# define mem_d(x) util_memory_d((void*)(x))
+# define mem_r(x, n) util_memory_r((void*)(x), (n), __LINE__, __FILE__)
+# define mem_af(x,f,l) util_memory_a((x), __LINE__, __FILE__)
#endif /*! NOTRACK */
+#define util_strdup(X) _util_Estrdup((X), __FILE__, __LINE__)
+
/*
* A flexible vector implementation: all vector pointers contain some
* data about themselfs exactly - sizeof(vector_t) behind the pointer
* util_htdel(foo);
*/
hash_table_t *util_htnew (size_t size);
+void util_htrem (hash_table_t *ht, void (*callback)(void *data));
void util_htset (hash_table_t *ht, const char *key, void *value);
void util_htdel (hash_table_t *ht);
size_t util_hthash(hash_table_t *ht, const char *key);
void util_htseth(hash_table_t *ht, const char *key, size_t hash, void *value);
+void util_htrmh (hash_table_t *ht, const char *key, size_t bin, void (*cb)(void*));
+void util_htrm (hash_table_t *ht, const char *key, void (*cb)(void*));
void *util_htget (hash_table_t *ht, const char *key);
void *util_htgeth(hash_table_t *ht, const char *key, size_t hash);
void fs_file_close (FILE *);
int fs_file_error (FILE *);
int fs_file_getc (FILE *);
-int fs_file_flush (FILE *);
int fs_file_printf (FILE *, const char *, ...);
int fs_file_puts (FILE *, const char *);
int fs_file_seek (FILE *, long int, int);
int fs_file_getline(char **, size_t *, FILE *);
/* directory handling */
+int fs_dir_make (const char *);
DIR *fs_dir_open (const char *);
int fs_dir_close (DIR *);
struct dirent *fs_dir_read (DIR *);
-int fs_dir_make (const char *);
-int fs_dir_change (const char *);
/*===================================================================*/
/*===================================================================*/
/*===================== parser.c commandline ========================*/
/*===================================================================*/
+struct parser_s;
-bool parser_init ();
-bool parser_compile_file (const char *);
-bool parser_compile_string(const char *, const char *, size_t);
-bool parser_finish (const char *);
-void parser_cleanup ();
+struct parser_s *parser_create ();
+bool parser_compile_file (struct parser_s *parser, const char *);
+bool parser_compile_string(struct parser_s *parser, const char *, const char *, size_t);
+bool parser_finish (struct parser_s *parser, const char *);
+void parser_cleanup (struct parser_s *parser);
/*===================================================================*/
/*====================== ftepp.c commandline ========================*/
/*===================================================================*/
struct lex_file_s;
+struct ftepp_s;
+
typedef struct {
const char *name;
char *(*func)(struct lex_file_s *);
*/
#define FTEPP_PREDEF_COUNT 8
-bool ftepp_init ();
-bool ftepp_preprocess_file (const char *filename);
-bool ftepp_preprocess_string(const char *name, const char *str);
-void ftepp_finish ();
-const char *ftepp_get ();
-void ftepp_flush ();
-void ftepp_add_define (const char *source, const char *name);
-void ftepp_add_macro (const char *name, const char *value);
+struct ftepp_s *ftepp_create ();
+bool ftepp_preprocess_file (struct ftepp_s *ftepp, const char *filename);
+bool ftepp_preprocess_string(struct ftepp_s *ftepp, const char *name, const char *str);
+void ftepp_finish (struct ftepp_s *ftepp);
+const char *ftepp_get (struct ftepp_s *ftepp);
+void ftepp_flush (struct ftepp_s *ftepp);
+void ftepp_add_define (struct ftepp_s *ftepp, const char *source, const char *name);
+void ftepp_add_macro (struct ftepp_s *ftepp, const char *name, const char *value);
extern const ftepp_predef_t ftepp_predefs[FTEPP_PREDEF_COUNT];