label.c 886 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #include "tables.h"
  2. #ifdef USE_TES
  3. #include "types.h"
  4. #include "param.h"
  5. #include "label.h"
  6. #include "salloc.h"
  7. #include "utils.h"
  8. #include "label.h"
  9. static label_p label_list = (label_p)0;
  10. void add_label(int num, int height, int flth)
  11. {
  12. label_p lbl = (label_p)0;
  13. if (height <= 0) return;
  14. if (flth != TRUE && flth != FALSE)
  15. fatal("incorrect value for fallthrough");
  16. lbl = (label_p) myalloc(sizeof(struct label));
  17. lbl->lb_next = label_list;
  18. lbl->lb_number = num;
  19. lbl->lb_height = height;
  20. lbl->lb_fallthrough = flth;
  21. label_list = lbl;
  22. }
  23. label_p get_label(word num)
  24. {
  25. label_p tmp = label_list;
  26. while (tmp != (label_p)0) {
  27. if (tmp->lb_number == num) return tmp;
  28. tmp = tmp->lb_next;
  29. }
  30. return (label_p)0;
  31. }
  32. void kill_labels()
  33. {
  34. label_p tmp;
  35. while((tmp = label_list) != (label_p)0) {
  36. label_list = label_list->lb_next;
  37. myfree((char *)tmp);
  38. }
  39. }
  40. #endif