work on type inference some more
[ccc.git] / util.h
diff --git a/util.h b/util.h
index d8b40ba..ac47fa6 100644 (file)
--- a/util.h
+++ b/util.h
@@ -3,22 +3,25 @@
 
 #include <stdarg.h>
 #include <stdbool.h>
+#include <stdio.h>
 
-struct list {
-       void *el;
-       struct list *tail;
-};
-struct list *list_cons(void *el, struct list *tail);
-void list_free(struct list *head, void (*freefun)(void *));
-void **list_to_array(struct list *list, int *num, bool reverse);
-int list_length(struct list *head);
+#define min(x, y) ((x)<(y)?(x):(y))
 
 void die(const char *msg, ...);
 void pdie(const char *msg);
 
+/* if buf == NULL, a fresh buffer is allocated */
+char *escape_char(char c, char *buf, bool str);
+/* unescaped character will be in position 0 and the rest from position 1 on */
+char *unescape_char(char *c);
+/* Remove the last and first character from the string */
+char *trimquotes(char *c);
 void pindent(int indent, FILE *out);
+
 void safe_fprintf(FILE *out, const char *msg, ...);
 void *safe_malloc(size_t size);
 void *safe_strdup(const char *c);
+FILE *safe_fopen(const char *path, const char *mode);
+void safe_fclose(FILE *file);
 
 #endif