dat.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. typedef struct Fsevent Fsevent;
  2. typedef struct Event Event;
  3. typedef struct Message Message;
  4. typedef struct Window Window;
  5. enum
  6. {
  7. STACK = 8192,
  8. NPIPEDATA = 8000,
  9. NPIPE = NPIPEDATA+32,
  10. /* EVENTSIZE is really 256 in acme, but we use events internally and want bigger buffers */
  11. EVENTSIZE = 8192,
  12. NEVENT = 5,
  13. };
  14. struct Fsevent
  15. {
  16. int type;
  17. void *r;
  18. };
  19. struct Event
  20. {
  21. int c1;
  22. int c2;
  23. int q0;
  24. int q1;
  25. int flag;
  26. int nb;
  27. int nr;
  28. char b[EVENTSIZE*UTFmax+1];
  29. Rune r[EVENTSIZE+1];
  30. };
  31. struct Window
  32. {
  33. /* file descriptors */
  34. int ctl;
  35. int event;
  36. int addr;
  37. int data;
  38. int body;
  39. /* event input */
  40. char buf[512];
  41. char *bufp;
  42. int nbuf;
  43. Event e[NEVENT];
  44. int id;
  45. int open;
  46. Channel *cevent;
  47. };
  48. extern Window* newwindow(void);
  49. extern int winopenfile(Window*, char*);
  50. extern void wintagwrite(Window*, char*, int);
  51. extern void winname(Window*, char*);
  52. extern void winwriteevent(Window*, Event*);
  53. extern int winread(Window*, uint, uint, char*);
  54. extern int windel(Window*, int);
  55. extern void wingetevent(Window*, Event*);
  56. extern void wineventproc(void*);
  57. extern void winclean(Window*);
  58. extern int winselect(Window*, char*, int);
  59. extern int winsetaddr(Window*, char*, int);
  60. extern void windormant(Window*);
  61. extern void winsetdump(Window*, char*, char*);
  62. extern void ctlprint(int, char*, ...);
  63. extern void* emalloc(uint);
  64. extern char* estrdup(char*);
  65. extern char* estrstrdup(char*, char*);
  66. extern char* egrow(char*, char*, char*);
  67. extern char* eappend(char*, char*, char*);
  68. extern void error(char*, ...);
  69. extern void startpipe(void);
  70. extern void sendit(char*);
  71. extern void execevent(Window *w, Event *e, int (*)(Window*, char*));
  72. extern void mountcons(void);
  73. extern void fsloop(void*);
  74. extern int newpipewin(int, char*);
  75. extern void startpipe(void);
  76. extern int pipecommand(Window*, char*);
  77. extern void pipectl(void*);
  78. #pragma varargck argpos error 1
  79. #pragma varargck argpos ctlprint 2
  80. extern Window *win;
  81. extern Channel *fschan, *writechan;