a.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. #include <u.h>
  2. #include <libc.h>
  3. #include <bio.h>
  4. #include <ctype.h>
  5. enum
  6. {
  7. Unbsp = 0x00A0,
  8. Uprivate = 0xF000,
  9. Uempty, /* \& */
  10. Uamp, /* raw & */
  11. Ult, /* raw < */
  12. Ugt, /* raw > */
  13. Utick, /* raw ' */
  14. Ubtick, /* raw ` */
  15. Uminus, /* raw - */
  16. Uspace, /* raw space */
  17. Upl, /* symbol + */
  18. Ueq, /* symbol = */
  19. Umi, /* symbol - */
  20. Uformatted, /* start diverted output */
  21. Uunformatted, /* end diverted output */
  22. UPI = 720, /* units per inch */
  23. UPX = 10, /* units per pixel */
  24. /* special input modes */
  25. CopyMode = 1<<1,
  26. ExpandMode = 1<<2,
  27. ArgMode = 1<<3,
  28. HtmlMode = 1<<4,
  29. MaxLine = 1024,
  30. };
  31. Rune* L(char*);
  32. void addesc(Rune, int (*)(void), int);
  33. void addraw(Rune*, void(*)(Rune*));
  34. void addreq(Rune*, void(*)(int, Rune**), int);
  35. void af(Rune*, Rune*);
  36. void as(Rune*, Rune*);
  37. void br(void);
  38. void closehtml(void);
  39. Rune* copyarg(void);
  40. void delraw(Rune*);
  41. void delreq(Rune*);
  42. void ds(Rune*, Rune*);
  43. int dv(int);
  44. int e_nop(void);
  45. int e_warn(void);
  46. void* emalloc(uint);
  47. void* erealloc(void*, uint);
  48. Rune* erunesmprint(char*, ...);
  49. Rune* erunestrdup(Rune*);
  50. char* esmprint(char*, ...);
  51. char* estrdup(char*);
  52. int eval(Rune*);
  53. int evalscale(Rune*, int);
  54. Rune* getname(void);
  55. int getnext(void);
  56. Rune* getds(Rune*);
  57. Rune* _getnr(Rune*);
  58. int getnr(Rune*);
  59. int getnrr(Rune*);
  60. int getrune(void);
  61. Rune* getqarg(void);
  62. Rune* getline(void);
  63. void hideihtml(void);
  64. void html(Rune*, Rune*);
  65. void htmlinit(void);
  66. void ihtml(Rune*, Rune*);
  67. void inputnotify(void(*)(void));
  68. void itrap(void);
  69. void itrapset(void);
  70. int linefmt(Fmt*);
  71. void nr(Rune*, int);
  72. void _nr(Rune*, Rune*);
  73. void out(Rune*);
  74. void (*outcb)(Rune);
  75. void outhtml(Rune*);
  76. void outrune(Rune);
  77. void outtrap(void);
  78. int popinput(void);
  79. void printds(int);
  80. int pushinputfile(Rune*);
  81. void pushinputstring(Rune*);
  82. int pushstdin(void);
  83. int queueinputfile(Rune*);
  84. int queuestdin(void);
  85. void r_nop(int, Rune**);
  86. void r_warn(int, Rune**);
  87. Rune *readline(int);
  88. void reitag(void);
  89. void renraw(Rune*, Rune*);
  90. void renreq(Rune*, Rune*);
  91. void run(void);
  92. void runinput(void);
  93. int runmacro(int, int, Rune**);
  94. void runmacro1(Rune*);
  95. Rune* rune2html(Rune);
  96. void setlinenumber(Rune*, int);
  97. void showihtml(void);
  98. void sp(int);
  99. void t1init(void);
  100. void t2init(void);
  101. void t3init(void);
  102. void t4init(void);
  103. void t5init(void);
  104. void t6init(void);
  105. void t7init(void);
  106. void t8init(void);
  107. void t9init(void);
  108. void t10init(void);
  109. void t11init(void);
  110. void t12init(void);
  111. void t13init(void);
  112. void t14init(void);
  113. void t15init(void);
  114. void t16init(void);
  115. void t17init(void);
  116. void t18init(void);
  117. void t19init(void);
  118. void t20init(void);
  119. Rune troff2rune(Rune*);
  120. void unfont(void);
  121. void ungetnext(Rune);
  122. void ungetrune(Rune);
  123. void unitag(void);
  124. void warn(char*, ...);
  125. extern int backslash;
  126. extern int bol;
  127. extern Biobuf bout;
  128. extern int broke;
  129. extern int dot;
  130. extern int inputmode;
  131. extern int inrequest;
  132. extern int tick;
  133. extern int utf8;
  134. extern int verbose;
  135. extern int linepos;
  136. #define runemalloc(n) (Rune*)emalloc((n)*sizeof(Rune))
  137. #define runerealloc(r, n) (Rune*)erealloc(r, (n)*sizeof(Rune))
  138. #define runemove(a, b, n) memmove(a, b, (n)*sizeof(Rune))
  139. #pragma varargck type "L" void