old-graph: Move graph API into the common graph struct
[tig.git] / include / tig / parse.h
blob2eea18eec09a02491ecb72a00249e76af965f67e
1 /* Copyright (c) 2006-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of
6 * the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef TIG_PARSE_H
15 #define TIG_PARSE_H
17 #include "tig/tig.h"
18 #include "tig/util.h"
20 struct chunk_header_position {
21 unsigned long position;
22 unsigned long lines;
25 struct chunk_header {
26 struct chunk_header_position old;
27 struct chunk_header_position new;
30 bool parse_chunk_header(struct chunk_header *header, const char *line);
31 bool parse_chunk_lineno(unsigned long *lineno, const char *chunk, int marker);
33 struct blame_commit {
34 char id[SIZEOF_REV]; /* SHA1 ID. */
35 char title[128]; /* First line of the commit message. */
36 const struct ident *author; /* Author of the commit. */
37 struct time time; /* Date from the author ident. */
38 const char *filename; /* Name of file. */
39 char parent_id[SIZEOF_REV]; /* Parent/previous SHA1 ID. */
40 const char *parent_filename; /* Parent/previous name of file. */
43 struct blame_header {
44 char id[SIZEOF_REV]; /* SHA1 ID. */
45 size_t orig_lineno;
46 size_t lineno;
47 size_t group;
50 bool parse_blame_header(struct blame_header *header, const char *text, size_t max_lineno);
51 bool parse_blame_info(struct blame_commit *commit, char author[SIZEOF_STR], char *line);
53 /* Parse author lines where the name may be empty:
54 * author <email@address.tld> 1138474660 +0100
56 void parse_author_line(char *ident, const struct ident **author, struct time *time);
58 size_t parse_size(const char *text);
61 * Caches.
63 const char *get_path(const char *path);
64 struct ident *get_author(const char *name, const char *email);
66 #endif
67 /* vim: set ts=8 sw=8 noexpandtab: */