a.h 3.5 KB

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