]> git.ozlabs.org Git - ccan/blob - tools/manifest.h
ccanlint: don't remove HAVE_STRUCT_TIMESPEC when testing without features.
[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
42         /* From tests/license_exists.c */
43         enum license license;
44 };
45
46 /* Get the manifest for a given directory. */
47 struct manifest *get_manifest(const void *ctx, const char *dir);
48
49 struct ccan_file {
50         struct list_node list;
51
52         /* Name (usually, within m->dir). */
53         char *name;
54
55         /* Full path name. */
56         char *fullname;
57
58         /* Pristine version of the original file.
59          * Use get_ccan_file_contents to fill this. */
60         const char *contents;
61         size_t contents_size;
62
63         /* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
64         unsigned int num_lines;
65         char **lines;
66         struct line_info *line_info;
67
68         struct list_head *doc_sections;
69
70         /* If this file gets compiled (eg. .C file to .o file), result here. */
71         char *compiled[COMPILE_TYPES];
72
73         /* Filename containing output from valgrind. */
74         char *valgrind_log;
75
76         /* Leak output from valgrind. */
77         char *leak_info;
78
79         /* Simplified stream (lowercase letters and single spaces) */
80         char *simplified;
81 };
82
83 /* A new ccan_file, with the given name (talloc_steal onto returned value). */
84 struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name);
85
86 /* Use this rather than accessing f->contents directly: loads on demand. */
87 const char *get_ccan_file_contents(struct ccan_file *f);
88
89 /* Use this rather than accessing f->lines directly: loads on demand. */
90 char **get_ccan_file_lines(struct ccan_file *f);
91
92 #endif /* CCAN_TOOLS_MANIFEST_H */