Pristine Ack-5.5
[Ack-5.5.git] / mach / proto / ncg / label.c
1 #include "tables.h"
2 #ifdef USE_TES
3 #include "types.h"
4 #include "param.h"
5 #include "label.h"
6
7 static label_p label_list = (label_p)0;
8 extern char *myalloc();
9
10 add_label(num, height, flth)
11 {
12         register label_p lbl = (label_p)0;
13
14         if (height <= 0) return;
15         if (flth != TRUE && flth != FALSE)
16             fatal("incorrect value for fallthrough");
17
18         lbl = (label_p) myalloc(sizeof(label_t));
19         lbl->lb_next = label_list;
20         lbl->lb_number = num;
21         lbl->lb_height = height;
22         lbl->lb_fallthrough = flth;
23         label_list = lbl;
24 }
25
26 label_p get_label(num)
27 register word num;
28 {
29         register label_p tmp = label_list;
30
31         while (tmp != (label_p)0) {
32                 if (tmp->lb_number == num) return tmp;
33                 tmp = tmp->lb_next;
34         }
35         return (label_p)0;
36 }
37
38 kill_labels()
39 {
40         label_p tmp;
41
42         while((tmp = label_list) != (label_p)0) {
43             label_list = label_list->lb_next;
44             myfree((char *)tmp);
45         }
46 }
47 #endif