interpret/src/pair.h

36 lines
1.2 KiB
C
Raw Normal View History

2023-02-13 04:53:15 +00:00
#ifndef PAIR_H /* <!-- guard */
#define PAIR_H
2023-02-03 19:50:10 +00:00
#include <stdint.h>
struct pair { const char *a, *b; };
2023-02-03 19:50:10 +00: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 23:07:42 +00: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-05 03:06:43 +00:00
int pair_is_string(struct pair, const char *);
2023-04-07 03:21:38 +00:00
#include "journal.h" /* date32 */
2023-04-30 09:28:15 +00:00
int pair_to_date(const char *, union date32 *);
2023-05-08 22:43:16 +00:00
int pair_to_cents(const char *, const char *, int64_t *);
2023-04-30 09:28:15 +00:00
uint32_t pair_djb2(struct pair);
2023-02-13 04:53:15 +00:00
2023-04-01 01:54:45 +00: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-04-01 02:31:25 +00:00
#define TABLE_UINT uint32_t
2023-04-01 01:54:45 +00:00
#define TABLE_HEAD
#include "../src/table.h"
2023-04-01 02:31:25 +00:00
struct pairmap_table pair_map_table(void);
void pair_map_table_(struct pairmap_table *);
2023-04-01 03:15:02 +00:00
const char *pair_map_table_to_string(const struct pairmap_table *);
2023-04-01 02:31:25 +00: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-04-01 01:54:45 +00:00
2023-02-13 04:53:15 +00:00
#endif /* guard --> */