]> git.ozlabs.org Git - ccan/blob - tools/manifest.h
io: always make fds O_NONBLOCK.
[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 name of the module, ie. elements of dir name after ccan/. */
17         char *modname;
18         /* The final element of dir name */
19         char *basename;
20         struct ccan_file *info_file;
21
22         /* Linked off deps. */
23         struct list_node list;
24         /* Where our final compiled output is */
25         char *compiled[COMPILE_TYPES];
26
27         struct list_head c_files;
28         struct list_head h_files;
29
30         struct list_head run_tests;
31         struct list_head api_tests;
32         struct list_head compile_ok_tests;
33         struct list_head compile_fail_tests;
34         struct list_head other_test_c_files;
35         struct list_head other_test_files;
36
37         struct list_head other_files;
38         struct list_head examples;
39         struct list_head mangled_examples;
40
41         /* From tests/check_depends_exist.c */
42         struct list_head deps;
43         struct list_head test_deps;
44
45         /* From tests/license_exists.c */
46         enum license license;
47 };
48
49 /* Get the manifest for a given directory. */
50 struct manifest *get_manifest(const void *ctx, const char *dir);
51
52 struct ccan_file {
53         struct list_node list;
54
55         /* Name (usually, within m->dir). */
56         char *name;
57
58         /* Full path name. */
59         char *fullname;
60
61         /* Pristine version of the original file.
62          * Use get_ccan_file_contents to fill this. */
63         const char *contents;
64         size_t contents_size;
65
66         /* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
67         char **lines;
68         struct line_info *line_info;
69
70         struct list_head *doc_sections;
71
72         /* If this file gets compiled (eg. .C file to .o file), result here. */
73         char *compiled[COMPILE_TYPES];
74
75         /* Filename containing output from valgrind. */
76         char *valgrind_log;
77
78         /* Leak output from valgrind. */
79         char *leak_info;
80
81         /* Simplified stream (lowercase letters and single spaces) */
82         char *simplified;
83
84         /* Condition for idempotent wrapper (filled by headers_idempotent) */
85         struct pp_conditions *idempotent_cond;
86 };
87
88 /* A new ccan_file, with the given dir and name (either can be take()). */
89 struct ccan_file *new_ccan_file(const void *ctx,
90                                 const char *dir, const char *name);
91
92 /* Use this rather than accessing f->contents directly: loads on demand. */
93 const char *get_ccan_file_contents(struct ccan_file *f);
94
95 /* Use this rather than accessing f->lines directly: loads on demand. */
96 char **get_ccan_file_lines(struct ccan_file *f);
97
98 #endif /* CCAN_TOOLS_MANIFEST_H */