#include "pair.h" /* pair */
struct source { struct pair name, desc; };

#define ARRAY_NAME sourcelist
#define ARRAY_TYPE struct source
#define ARRAY_HEAD
#include "../src/array.h"

#include <stddef.h> /* size_t */
#include "../src/journal.h" /* line64 */

#define TREE_NAME source
#define TREE_KEY union line64
#define TREE_VALUE size_t
#define TREE_HEAD
#include "../src/tree.h"

struct sources {
	struct sourcelist_array list;
	struct pairmap_table map;
	struct source_tree dates;
};
struct source *sources_add(struct sources *, const union line64);
struct sources sources(struct journal *);
void sources_(struct sources *);
int sources_is_empty(const struct sources *);
const char *sources_to_string(const struct sources *);
const struct source *source_lookup(struct sources *s, const union line64 range);
