manifest.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. /* From tests/license_exists.c */
  35. enum license license;
  36. };
  37. /* Get the manifest for a given directory. */
  38. struct manifest *get_manifest(const void *ctx, const char *dir);
  39. struct ccan_file {
  40. struct list_node list;
  41. /* Name (usually, within m->dir). */
  42. char *name;
  43. /* Full path name. */
  44. char *fullname;
  45. /* Pristine version of the original file.
  46. * Use get_ccan_file_contents to fill this. */
  47. const char *contents;
  48. size_t contents_size;
  49. /* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
  50. unsigned int num_lines;
  51. char **lines;
  52. struct line_info *line_info;
  53. struct list_head *doc_sections;
  54. /* If this file gets compiled (eg. .C file to .o file), result here. */
  55. char *compiled[COMPILE_TYPES];
  56. /* Filename containing output from valgrind. */
  57. char *valgrind_log;
  58. /* Leak output from valgrind. */
  59. char *leak_info;
  60. /* Simplified stream (lowercase letters and single spaces) */
  61. char *simplified;
  62. };
  63. /* A new ccan_file, with the given name (talloc_steal onto returned value). */
  64. struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name);
  65. /* Use this rather than accessing f->contents directly: loads on demand. */
  66. const char *get_ccan_file_contents(struct ccan_file *f);
  67. /* Use this rather than accessing f->lines directly: loads on demand. */
  68. char **get_ccan_file_lines(struct ccan_file *f);
  69. #endif /* CCAN_TOOLS_MANIFEST_H */