interpret/src/pair.h

35 lines
1.2 KiB
C
Raw Normal View History

2023-02-12 23:53:15 -05:00
#ifndef PAIR_H /* <!-- guard */
#define PAIR_H
2023-02-03 14:50:10 -05:00
#include <stdint.h>
struct pair { const char *a, *b; };
2023-02-03 14:50:10 -05:00
struct pair pair(const char *const a, const char *const b);
int pair_to_natural(const char *, const char *, uint32_t *);
2023-02-14 18:07:42 -05:00
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);
2023-02-04 22:06:43 -05:00
int pair_is_string(struct pair, const char *);
2023-04-06 23:21:38 -04:00
#include "journal.h" /* date32 */
2023-04-30 05:28:15 -04:00
int pair_to_date(const char *, union date32 *);
uint32_t pair_djb2(struct pair);
2023-02-12 23:53:15 -05:00
2023-03-31 21:54:45 -04:00
/* Supporting pair -> size_t for looking up in arrays. */
#define TABLE_NAME pairmap
#define TABLE_KEY struct pair
#define TABLE_VALUE size_t
2023-03-31 22:31:25 -04:00
#define TABLE_UINT uint32_t
2023-03-31 21:54:45 -04:00
#define TABLE_HEAD
#include "../src/table.h"
2023-03-31 22:31:25 -04:00
struct pairmap_table pair_map_table(void);
void pair_map_table_(struct pairmap_table *);
2023-03-31 23:15:02 -04:00
const char *pair_map_table_to_string(const struct pairmap_table *);
2023-03-31 22:31:25 -04:00
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);
2023-03-31 21:54:45 -04:00
2023-02-12 23:53:15 -05:00
#endif /* guard --> */