aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler.h')
-rw-r--r--src/compiler.h13
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);
20void compile_proc_call(Object *obj); 20void compile_proc_call(Object *obj);
21void compile(Root *roots); 21void compile(Root *roots);
22 22
23char *
24generate_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
23void 36void
24emit_file(char *file_name) { 37emit_file(char *file_name) {
25 FILE *file = fopen(file_name, "r"); 38 FILE *file = fopen(file_name, "r");