]> git.ozlabs.org Git - ccan/blob - tools/manifest.h
ccanlint: add testdepends support.
[ccan] / tools / manifest.h
1 #ifndef CCAN_TOOLS_MANIFEST_H
2 #define CCAN_TOOLS_MANIFEST_H
3 #include "config.h"
4 #include "ccanlint/licenses.h"
5 #include <ccan/list/list.h>
6
7 enum compile_type {
8         COMPILE_NORMAL,
9         COMPILE_NOFEAT,
10         COMPILE_COVERAGE,
11         COMPILE_TYPES
12 };
13
14 struct manifest {
15         char *dir;
16         /* The module name, ie. final element of dir name */
17         char *basename;
18         struct ccan_file *info_file;
19
20         /* Linked off deps. */
21         struct list_node list;
22         /* Where our final compiled output is */
23         char *compiled[COMPILE_TYPES];
24
25         struct list_head c_files;
26         struct list_head h_files;
27
28         struct list_head run_tests;
29         struct list_head api_tests;
30         struct list_head compile_ok_tests;
31         struct list_head compile_fail_tests;
32         struct list_head other_test_c_files;
33         struct list_head other_test_files;
34
35         struct list_head other_files;
36         struct list_head examples;
37         struct list_head mangled_examples;
38
39         /* From tests/check_depends_exist.c */
40         struct list_head deps;
41         struct list_head test_deps;
42
43         /* From tests/license_exists.c */
44         enum license license;
45 };
46
47 /* Get the manifest for a given directory. */
48 struct manifest *get_manifest(const void *ctx, const char *dir);
49
50 struct ccan_file {
51         struct list_node list;
52
53         /* Name (usually, within m->dir). */
54         char *name;
55
56         /* Full path name. */
57         char *fullname;
58
59         /* Pristine version of the original file.
60          * Use get_ccan_file_contents to fill this. */
61         const char *contents;
62         size_t contents_size;
63
64         /* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
65         unsigned int num_lines;
66         char **lines;
67         struct line_info *line_info;
68
69         struct list_head *doc_sections;
70
71         /* If this file gets compiled (eg. .C file to .o file), result here. */
72         char *compiled[COMPILE_TYPES];
73
74         /* Filename containing output from valgrind. */
75         char *valgrind_log;
76
77         /* Leak output from valgrind. */
78         char *leak_info;
79
80         /* Simplified stream (lowercase letters and single spaces) */
81         char *simplified;
82 };
83
84 /* A new ccan_file, with the given name (talloc_steal onto returned value). */
85 struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name);
86
87 /* Use this rather than accessing f->contents directly: loads on demand. */
88 const char *get_ccan_file_contents(struct ccan_file *f);
89
90 /* Use this rather than accessing f->lines directly: loads on demand. */
91 char **get_ccan_file_lines(struct ccan_file *f);
92
93 #endif /* CCAN_TOOLS_MANIFEST_H */