richterm.h (1499B)
1 typedef struct DrawState DrawState; 2 typedef struct Elem Elem; 3 typedef struct Faux Faux; 4 typedef struct Rich Rich; 5 typedef struct Token Token; 6 7 struct DrawState { 8 int n; 9 Point pos; 10 Point nlpos; 11 char *link; 12 Font *font; 13 }; 14 15 struct Rich { 16 QLock *l; 17 Array *objects; 18 u64int idcount; 19 long selmin; 20 long selmax; 21 long input; 22 Rectangle r; 23 Rectangle rs; 24 int scroll; 25 int max; 26 }; 27 28 struct Faux { 29 Array *data; 30 void (*open)(Req *); 31 void (*read)(Req *); 32 void (*write)(Req *); 33 void (*stat)(Req *); 34 void (*destroyfid)(Fid *); 35 }; 36 37 enum { 38 E_NOOP = '\0', 39 E_TEXT = '.', 40 E_FONT = 'f', 41 E_LINK = 'l', 42 E_IMAGE = 'I', 43 E_NL = 'n', 44 E_TAB = 't', 45 E_SPACE = 's', 46 }; 47 48 enum {TRune = '.', TFont = 'f', TLink = 'l', TImage = 'i'}; 49 50 struct Elem { 51 char type; 52 53 union { 54 Rune r; 55 char *str; 56 Image *image; 57 }; 58 }; 59 60 extern Array *elems; 61 extern Array *fonts; 62 extern Array *menubuf; 63 extern Array *richdata; 64 extern Channel *consc; 65 extern Channel *ctlc; 66 extern Channel *insertc; 67 extern Channel *redrawc; 68 extern File *fsroot; 69 extern Rich rich; 70 71 Faux * fauxalloc(Array *, void (*)(Req *), void (*)(Req *), void (*)(Req *), void (*)(Req *), void (*)(Fid *)); 72 Font* getfont(Array *, char *); 73 Point drawrune(DrawState *, Elem *); 74 Rectangle elemrect(DrawState *, Elem *); 75 Rune * getrunes(long, long); 76 char * getlink(long n); 77 int initfs(char *); 78 void clearelems(void); 79 void drawelems(long, long); 80 void drawpage(Image *, Rich *); 81 void drawscrollbar(void); 82 void freeelem(Elem *); 83 void parsedata(Array *, Array *);