manifest.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. unsigned int num_lines;
  54. char **lines;
  55. struct line_info *line_info;
  56. struct list_head *doc_sections;
  57. /* If this file gets compiled (eg. .C file to .o file), result here. */
  58. char *compiled[COMPILE_TYPES];
  59. /* Filename containing output from valgrind. */
  60. char *valgrind_log;
  61. /* Leak output from valgrind. */
  62. char *leak_info;
  63. /* Simplified stream (lowercase letters and single spaces) */
  64. char *simplified;
  65. };
  66. /* A new ccan_file, with the given name (talloc_steal onto returned value). */
  67. struct ccan_file *new_ccan_file(const void *ctx, const char *dir, char *name);
  68. /* Use this rather than accessing f->contents directly: loads on demand. */
  69. const char *get_ccan_file_contents(struct ccan_file *f);
  70. /* Use this rather than accessing f->lines directly: loads on demand. */
  71. char **get_ccan_file_lines(struct ccan_file *f);
  72. #endif /* CCAN_TOOLS_MANIFEST_H */