export.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef EXPORT_H
  2. #define EXPORT_H
  3. #include "vt.h"
  4. #include "misc.h"
  5. struct fmt_char
  6. {
  7. u8 ch, fg, bg, attr;
  8. };
  9. #define EA_DOUBLE 1 // double height char
  10. #define EA_HDOUBLE 2 // single height char in double height line
  11. #define EA_BLINK 4 // blink
  12. #define EA_CONCEALED 8 // concealed
  13. #define EA_GRAPHIC 16 // graphic symbol
  14. #define EA_SEPARATED 32 // use separated graphic symbol
  15. #define E_DEF_FG 7
  16. #define E_DEF_BG 0
  17. #define E_DEF_ATTR 0
  18. struct fmt_page
  19. {
  20. struct vt_page *vtp;
  21. u32 dbl, hid;
  22. struct fmt_char data[H][W];
  23. };
  24. struct export
  25. {
  26. struct export_module *mod; // module type
  27. char *fmt_str; // saved option string (splitted)
  28. // global options
  29. int reveal; // reveal hidden chars
  30. // local data for module's use. initialized to 0.
  31. struct { int dummy; } data[0];
  32. };
  33. struct export_module
  34. {
  35. char *fmt_name; // the format type name (ASCII/HTML/PNG/...)
  36. char *extension; // the default file name extension
  37. char **options; // module options
  38. int local_size;
  39. int (*open)(struct export *fmt);
  40. void (*close)(struct export *fmt);
  41. int (*option)(struct export *fmt, int opt, char *arg);
  42. int (*output)(struct export *fmt, char *name, struct fmt_page *pg);
  43. };
  44. extern struct export_module *modules[]; // list of modules (for help msgs)
  45. void export_error(char *str, ...); // set error
  46. char *export_errstr(void); // return last error
  47. char *export_mkname(struct export *e, char *fmt, struct vt_page *vtp, char *usr);
  48. struct export *export_open(char *fmt);
  49. void export_close(struct export *e);
  50. int export(struct export *e, struct vt_page *vtp, char *user_str);
  51. #endif