print_ctxt.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @file print_ctxt.h
  3. *
  4. * Defines a context used during element printing and all it's
  5. * associated functions.
  6. */
  7. #ifndef PRINT_CTXT_H
  8. #define PRINT_CTXT_H
  9. #include "print.h"
  10. #include "stdbool.h"
  11. /**
  12. * @brief A context for printing doc_elt's in a tree.
  13. */
  14. typedef struct print_ctxt
  15. {
  16. int depth; /*< The current depth in a document tree */
  17. size_t rmargin; /*< The column of the doc's right margin */
  18. size_t tab_width; /*< The column width of a tab character */
  19. bool use_tabs; /*< Should generated output use tabs? */
  20. print_state print_state; /*< the current printing mode */
  21. bool nested_conflicts; /*< if there are nested conflicts */
  22. conflict_state structure_conflict; /*< the current state of conflicts */
  23. conflict_state content_conflict; /*< the current state of conflicts */
  24. bool conflict_occurred; /* IF a conflict occured */
  25. } print_ctxt;
  26. /**
  27. * @brief Create and initialize a print context.
  28. */
  29. print_ctxt* print_ctxt_create_empty (void);
  30. /**
  31. * @brief Initialize a print_ctxt.
  32. */
  33. void print_ctxt_init (print_ctxt *ctxt);
  34. #endif