il3_aux.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* $Id$ */
  2. /*
  3. * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
  4. * See the copyright notice in the ACK home directory, in the file "Copyright".
  5. */
  6. /* I N L I N E S U B S T I T U T I O N
  7. *
  8. * I L 3 _ A U X . C
  9. */
  10. #include <stdio.h>
  11. #include "../share/types.h"
  12. #include "il.h"
  13. #include "../share/debug.h"
  14. #include "../share/alloc.h"
  15. #include "../share/global.h"
  16. #include "il_aux.h"
  17. #include "il3_aux.h"
  18. line_p last_line(line_p lines)
  19. {
  20. /* Determine the last line of a list */
  21. register line_p l;
  22. assert (lines != (line_p) 0);
  23. for (l = lines; l->l_next != (line_p) 0; l = l->l_next);
  24. return l;
  25. }
  26. void app_list(line_p list, line_p l)
  27. {
  28. /* Append the list after line l */
  29. line_p llast;
  30. assert(l != (line_p) 0);
  31. assert (list != (line_p) 0);
  32. llast = last_line(list);
  33. llast->l_next = l->l_next;
  34. if (l->l_next != (line_p) 0) {
  35. PREV(l->l_next) = llast;
  36. }
  37. l->l_next = list;
  38. PREV(list) = l;
  39. }
  40. void rem_line(line_p l)
  41. {
  42. /* Remove a line from the list */
  43. if (PREV(l) != (line_p) 0) {
  44. PREV(l)->l_next = l->l_next;
  45. }
  46. if (l->l_next != (line_p) 0) {
  47. PREV(l->l_next) = PREV(l);
  48. }
  49. oldline(l);
  50. }