list.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
  2. *
  3. * Permission is hereby given to reproduce or modify this
  4. * software freely, provided that this notice be retained,
  5. * and that no use be made of the software for commercial
  6. * purposes without the express written permission of the
  7. * author.
  8. */
  9. #include <lbl.h>
  10. #include "list.h"
  11. #include "printl.h"
  12. void listtype(Type *);
  13. extern char *def_format;
  14. extern LIST_HEAD(, Type) typehead;
  15. void
  16. listdefs()
  17. {
  18. Type *tp;
  19. if (LIST_EMPTY(&typehead)) {
  20. fprintf(stderr, "No labels defined\n");
  21. return;
  22. }
  23. LIST_FOREACH(tp, &typehead, link)
  24. listtype(tp);
  25. }
  26. void
  27. listtype(Type *tp)
  28. {
  29. Label *lp;
  30. fprintf(stderr, "*** Type %s: format %s\n", tp->t_name,
  31. tp->t_format == def_format ? "default" : tp->t_format);
  32. if (LIST_EMPTY(&(tp->labelhead))) {
  33. fprintf(stderr, "(No labels defined\n)");
  34. return;
  35. }
  36. LIST_FOREACH(lp, &(tp->labelhead), link) {
  37. fprintf(stderr, "%-16.16s %-14.14s %-6ld ",
  38. lp->l_name,
  39. lp->l_file,
  40. lp->l_line);
  41. labelPrint(lp, stderr);
  42. putc('\n', stderr);
  43. }
  44. putc('\n', stderr);
  45. }