manifest.h 2.4 KB

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