1990-07-18 14:53:19 +00:00
|
|
|
#include "tables.h"
|
1990-09-04 17:16:00 +00:00
|
|
|
#ifdef USE_TES
|
1990-07-18 14:53:19 +00:00
|
|
|
#include "types.h"
|
|
|
|
#include "param.h"
|
|
|
|
#include "label.h"
|
|
|
|
|
1990-09-04 17:16:00 +00:00
|
|
|
static label_p label_list = (label_p)0;
|
1990-07-18 14:53:19 +00:00
|
|
|
|
2022-08-01 20:08:23 +00:00
|
|
|
void add_label(int num, int height, int flth)
|
1990-07-18 14:53:19 +00:00
|
|
|
{
|
2017-11-13 17:44:17 +00:00
|
|
|
label_p lbl = (label_p)0;
|
1990-07-18 14:53:19 +00:00
|
|
|
|
|
|
|
if (height <= 0) return;
|
|
|
|
if (flth != TRUE && flth != FALSE)
|
|
|
|
fatal("incorrect value for fallthrough");
|
|
|
|
|
2006-07-21 10:35:34 +00:00
|
|
|
lbl = (label_p) myalloc(sizeof(struct label));
|
1990-07-18 14:53:19 +00:00
|
|
|
lbl->lb_next = label_list;
|
|
|
|
lbl->lb_number = num;
|
|
|
|
lbl->lb_height = height;
|
|
|
|
lbl->lb_fallthrough = flth;
|
|
|
|
label_list = lbl;
|
|
|
|
}
|
|
|
|
|
2017-11-13 17:44:17 +00:00
|
|
|
label_p get_label(word num)
|
1990-07-18 14:53:19 +00:00
|
|
|
{
|
2017-11-13 17:44:17 +00:00
|
|
|
label_p tmp = label_list;
|
1990-07-18 14:53:19 +00:00
|
|
|
|
1990-09-04 17:16:00 +00:00
|
|
|
while (tmp != (label_p)0) {
|
1990-07-18 14:53:19 +00:00
|
|
|
if (tmp->lb_number == num) return tmp;
|
|
|
|
tmp = tmp->lb_next;
|
|
|
|
}
|
1990-09-04 17:16:00 +00:00
|
|
|
return (label_p)0;
|
1990-07-18 14:53:19 +00:00
|
|
|
}
|
|
|
|
|
2017-11-13 17:44:17 +00:00
|
|
|
void kill_labels(void)
|
1990-07-18 14:53:19 +00:00
|
|
|
{
|
|
|
|
label_p tmp;
|
|
|
|
|
1990-09-04 17:16:00 +00:00
|
|
|
while((tmp = label_list) != (label_p)0) {
|
1990-07-18 14:53:19 +00:00
|
|
|
label_list = label_list->lb_next;
|
|
|
|
myfree((char *)tmp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|