types.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /** @file
  2. * @brief Concrete data types.
  3. *
  4. * On the one hand, having these all in the same file isn't
  5. * good modularity. On the other hand, I don't want to write
  6. * loads of setters and getters.
  7. */
  8. /* (C) C.D.F. Miller, Heriot-Watt University, March 1984
  9. *
  10. * Permission is hereby given to reproduce or modify this
  11. * software freely, provided that this notice be retained,
  12. * and that no use be made of the software for commercial
  13. * purposes without the express written permission of the
  14. * author.
  15. */
  16. #ifndef _TYPES_H_
  17. #define _TYPES_H_
  18. #include <list>
  19. /** @todo Remove this */
  20. #define us unsigned
  21. /** Max no. of header levels */
  22. #define NLEVELS 20
  23. /** Type for header levels member of label struct */
  24. typedef int levels[NLEVELS];
  25. /** Header format */
  26. typedef char *format;
  27. typedef struct Type Type; /**< Type type */
  28. typedef struct Label Label; /**< Label type */
  29. typedef struct Keyword Keyword; /**< Keyword type */
  30. /** Label type */
  31. struct Type {
  32. char *t_name; /**< name */
  33. levels t_levels; /**< current header levels */
  34. format t_format; /**< format */
  35. std::list<Label> labelhead; /**< list of labels of this type */
  36. };
  37. /** Label definition */
  38. struct Label {
  39. char *l_name; /**< Name */
  40. Type *l_type; /**< Back-reference to label type */
  41. char *l_file; /**< File where defined */
  42. long l_line; /**< line where defined */
  43. levels l_levels; /**< Counter for label no. at different levels */
  44. int l_bottom; /**< Last significant level */
  45. unsigned char padding[4];
  46. };
  47. /** Action routine for keyword processing */
  48. typedef int (*func) ();
  49. /** Command keyword, to come after ".L=" at the start of an input line */
  50. struct Keyword {
  51. char *k_name; /**< How is the keyword spelt */
  52. func k_action; /**< Function pointer for action to take */
  53. us int k_minargs; /**< Min no. of args for k_action */
  54. us int k_maxargs; /**< Max no. of args for k_action */
  55. };
  56. #endif