manifest.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. enum compile_type {
  7. COMPILE_NORMAL,
  8. COMPILE_NOFEAT,
  9. COMPILE_COVERAGE,
  10. COMPILE_TYPES
  11. };
  12. struct manifest {
  13. char *dir;
  14. /* The module name, ie. final element of dir name */
  15. char *basename;
  16. struct ccan_file *info_file;
  17. /* Linked off deps. */
  18. struct list_node list;
  19. /* Where our final compiled output is */
  20. char *compiled[COMPILE_TYPES];
  21. struct list_head c_files;
  22. struct list_head h_files;
  23. struct list_head run_tests;
  24. struct list_head api_tests;
  25. struct list_head compile_ok_tests;
  26. struct list_head compile_fail_tests;
  27. struct list_head other_test_c_files;
  28. struct list_head other_test_files;
  29. struct list_head other_files;
  30. struct list_head examples;
  31. struct list_head mangled_examples;
  32. /* From tests/check_depends_exist.c */
  33. struct list_head deps;
  34. struct list_head test_deps;
  35. /* From tests/license_exists.c */
  36. enum license license;
  37. };
  38. /* Get the manifest for a given directory. */
  39. struct manifest *get_manifest(const void *ctx, const char *dir);
  40. struct ccan_file {
  41. struct list_node list;
  42. /* Name (usually, within m->dir). */
  43. char *name;
  44. /* Full path name. */
  45. char *fullname;
  46. /* Pristine version of the original file.
  47. * Use get_ccan_file_contents to fill this. */
  48. const char *contents;
  49. size_t contents_size;
  50. /* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
  51. unsigned int num_lines;
  52. char **lines;
  53. struct line_info *line_info;
  54. struct list_head *doc_sections;
  55. /* If this file gets compiled (eg. .C file to .o file), result here. */
  56. char *compiled[COMPILE_TYPES];
  57. /* Filename containing output from valgrind. */
  58. char *valgrind_log;
  59. /* Leak output from valgrind. */
  60. char *leak_info;
  61. /* Simplified stream (lowercase letters and single spaces) */
  62. char *simplified;
  63. };
  64. /* A new ccan_file, with the given name (talloc_steal onto returned value). */
  65. struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name);
  66. /* Use this rather than accessing f->contents directly: loads on demand. */
  67. const char *get_ccan_file_contents(struct ccan_file *f);
  68. /* Use this rather than accessing f->lines directly: loads on demand. */
  69. char **get_ccan_file_lines(struct ccan_file *f);
  70. #endif /* CCAN_TOOLS_MANIFEST_H */