summaryrefslogtreecommitdiff
path: root/src/references.h
blob: 8d3631f34d2674fc3bb746827e86fca108535961 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef CMARK_REFERENCES_H
#define CMARK_REFERENCES_H

#include "chunk.h"

#ifdef __cplusplus
extern "C" {
#endif

#define REFMAP_SIZE 16

struct cmark_reference {
  struct cmark_reference *next;
  unsigned char *label;
  cmark_chunk url;
  cmark_chunk title;
  unsigned int hash;
};

typedef struct cmark_reference cmark_reference;

struct cmark_reference_map {
  cmark_mem *mem;
  cmark_reference *table[REFMAP_SIZE];
};

typedef struct cmark_reference_map cmark_reference_map;

cmark_reference_map *cmark_reference_map_new(cmark_mem *mem);
void cmark_reference_map_free(cmark_reference_map *map);
cmark_reference *cmark_reference_lookup(cmark_reference_map *map,
                                        cmark_chunk *label);
extern void cmark_reference_create(cmark_reference_map *map, cmark_chunk *label,
                                   cmark_chunk *url, cmark_chunk *title);

#ifdef __cplusplus
}
#endif

#endif