summaryrefslogtreecommitdiff
path: root/math/metadb.h
blob: f7ebf40209c73d3368d12ef15d089be7e96b5991 (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
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
74
75
76
77
78
79
80
81
/*	$Id$ */

/*
 * Copyright (c) 2006 Dimitri A. Sokolyuk <demon@dim13.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _METADB_H_
#define _METADB_H_

#define INDEXDB		"_index.db"
#define METADB		"_meta.db"
#define SEARCHDB	"_search.db"
#define AUTHORDB	"_author.db"

#define METADATA	"meta.txt"
#define SECTION		"section.txt"
#define AUTHORDATA	"author.txt"

enum	mtype { M_SET, M_RECORD };
enum	sorder { TITLEI, TITLED, DATEI, DATED, AUTHORI, AUTHORD };

struct author {
	char	*name;
	char	*mail;
};

struct meta {
	enum	mtype type;
	time_t	date;
	unsigned int id;
	char	*dir;
	char	*title;
	char	*abstract;
	char	*author;
	char	*email;
	char	*html;
	char	*mws;
	char	*mw;
	char	*pdf;
	char	*code;
	char	*img;
	char	*language;
	char	*tokens;
	char	*video;
	char	*video_hq;
	char	*video_lq;
};

__BEGIN_DECLS
struct meta *openmeta(char *);
void closemeta(struct meta *);

int db_open(int);
void db_close(void);
void db_wipe(void);
int db_add(struct meta *, int, int);
size_t	db_nelem(unsigned int);

struct meta *db_get(struct meta *, unsigned int);
struct meta *db_children(unsigned int, size_t *);
struct meta *db_path(unsigned int, size_t *);
struct meta *db_find(char *, size_t *);
void db_sort(struct meta *, size_t, enum sorder);

int db_putauthor(struct author *, char *);
struct author *db_getauthor(struct author *, char *);
__END_DECLS

#endif	/* not _METADB_H_ */