diff options
-rw-r--r-- | src/compiler.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler.h b/src/compiler.h index b703a99..441b665 100644 --- a/src/compiler.h +++ b/src/compiler.h | |||
@@ -20,6 +20,19 @@ void compile_fixnum(Object *obj); | |||
20 | void compile_proc_call(Object *obj); | 20 | void compile_proc_call(Object *obj); |
21 | void compile(Root *roots); | 21 | void compile(Root *roots); |
22 | 22 | ||
23 | char * | ||
24 | generate_label(void) { | ||
25 | // Generate a unique label allocated on the heap. The caller is responsible | ||
26 | // for freeing the memory. | ||
27 | static size_t label_counter = 0; | ||
28 | char buf[32]; | ||
29 | memset(buf, 0, 32); | ||
30 | sprintf(buf, ".BDLL%ld", label_counter++); | ||
31 | char * ret = malloc(strlen(buf)); | ||
32 | memcpy(ret, buf, strlen(buf)); | ||
33 | return ret; | ||
34 | } | ||
35 | |||
23 | void | 36 | void |
24 | emit_file(char *file_name) { | 37 | emit_file(char *file_name) { |
25 | FILE *file = fopen(file_name, "r"); | 38 | FILE *file = fopen(file_name, "r"); |