about summary refs log tree commit diff stats
path: root/gemtext.h
blob: bd6b26cf13d672348736a905d74e238c99457265 (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#define GEMTEXT_TEXT 1
#define GEMTEXT_LINK 2
#define GEMTEXT_PRE 3
#define GEMTEXT_H1 4
#define GEMTEXT_H2 5
#define GEMTEXT_H3 6
#define GEMTEXT_UL 7
#define GEMTEXT_QT 8

struct gemtext {
	int type;
};

struct gemtext_text {
	int type;
	char *text;
};

struct gemtext_link {
	int type;
	char *name;
	char *link;
};

struct gemtext_pre {
	int type;
	char *text;
};

struct gemtext_h1 {
	int type;
	char *text;
};

struct gemtext_h2 {
	int type;
	char *text;
};

struct gemtext_h3 {
	int type;
	char *text;
};

struct gemtext_ul {
	int type;
	char *text;
};

struct gemtext_qt {
	int type;
	char *text;
};

/* strlcpy.c/strlcat.c */
#undef strlcpy
#undef strlcat
size_t strlcpy(char *, const char *, size_t);
size_t strlcat(char *, const char *, size_t);

/* decode.c */
struct gemtext **gemtext_decode(char *);
struct gemtext **gemtext_decode_fd(int);
struct gemtext **gemtext_decode_file(const char *);

/* encode.c */
int gemtext_encode(struct gemtext **, char **, int *);
int gemtext_encode_fd(struct gemtext **, int);
int gemtext_encode_file(struct gemtext **, const char *);

/* free.c */
void _gemtext_free(struct gemtext *);
void gemtext_list_free(struct gemtext **);