trailer.hon commit trailers: export action enums and corresponding lookup functions (52fc319)
   1#ifndef TRAILER_H
   2#define TRAILER_H
   3
   4enum trailer_where {
   5        WHERE_END,
   6        WHERE_AFTER,
   7        WHERE_BEFORE,
   8        WHERE_START
   9};
  10enum trailer_if_exists {
  11        EXISTS_ADD_IF_DIFFERENT_NEIGHBOR,
  12        EXISTS_ADD_IF_DIFFERENT,
  13        EXISTS_ADD,
  14        EXISTS_REPLACE,
  15        EXISTS_DO_NOTHING
  16};
  17enum trailer_if_missing {
  18        MISSING_ADD,
  19        MISSING_DO_NOTHING
  20};
  21
  22int trailer_set_where(enum trailer_where *item, const char *value);
  23int trailer_set_if_exists(enum trailer_if_exists *item, const char *value);
  24int trailer_set_if_missing(enum trailer_if_missing *item, const char *value);
  25
  26struct trailer_info {
  27        /*
  28         * True if there is a blank line before the location pointed to by
  29         * trailer_start.
  30         */
  31        int blank_line_before_trailer;
  32
  33        /*
  34         * Pointers to the start and end of the trailer block found. If there
  35         * is no trailer block found, these 2 pointers point to the end of the
  36         * input string.
  37         */
  38        const char *trailer_start, *trailer_end;
  39
  40        /*
  41         * Array of trailers found.
  42         */
  43        char **trailers;
  44        size_t trailer_nr;
  45};
  46
  47void process_trailers(const char *file, int in_place, int trim_empty,
  48                      struct string_list *trailers);
  49
  50void trailer_info_get(struct trailer_info *info, const char *str);
  51
  52void trailer_info_release(struct trailer_info *info);
  53
  54#endif /* TRAILER_H */