interpret/src/pair.h
2023-05-08 15:43:16 -07:00

36 lines
1.2 KiB
C

#ifndef PAIR_H /* <!-- guard */
#define PAIR_H
#include <stdint.h>
struct pair { const char *a, *b; };
struct pair pair(const char *const a, const char *const b);
int pair_to_natural(const char *, const char *, uint32_t *);
int pair_colon_to_minutes(const char *, const char *,
const char *, const char *, uint32_t *);
int pair_hours_to_minutes(const char *h0, const char *const h1,
const char *m0, const char *const m1, uint32_t *const n);
int pair_is_equal(struct pair, struct pair);
int pair_is_string(struct pair, const char *);
#include "journal.h" /* date32 */
int pair_to_date(const char *, union date32 *);
int pair_to_cents(const char *, const char *, int64_t *);
uint32_t pair_djb2(struct pair);
/* Supporting pair -> size_t for looking up in arrays. */
#define TABLE_NAME pairmap
#define TABLE_KEY struct pair
#define TABLE_VALUE size_t
#define TABLE_UINT uint32_t
#define TABLE_HEAD
#include "../src/table.h"
struct pairmap_table pair_map_table(void);
void pair_map_table_(struct pairmap_table *);
const char *pair_map_table_to_string(const struct pairmap_table *);
enum table_result pair_map_table_assign(struct pairmap_table *,
const struct pair, size_t **);
size_t pair_map_table_get(struct pairmap_table *, struct pair);
#endif /* guard --> */