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