hdr.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. extern int squawk;
  10. extern int clean;
  11. extern char *file;
  12. extern int verbose;
  13. extern long ninput, noutput, nrunes, nerrors;
  14. enum { From = 1, Table = 2, Func = 4 };
  15. typedef void (*Fnptr)(void);
  16. struct convert{
  17. char *name;
  18. char *chatter;
  19. int flags;
  20. void *data;
  21. Fnptr fn;
  22. };
  23. extern struct convert convert[];
  24. struct convert *conv(char *, int);
  25. typedef void (*Infn)(int, long *, struct convert *);
  26. typedef void (*Outfn)(Rune *, int, long *);
  27. void outtable(Rune *, int, long *);
  28. void utf_in(int, long *, struct convert *);
  29. void utf_out(Rune *, int, long *);
  30. void isoutf_in(int, long *, struct convert *);
  31. void isoutf_out(Rune *, int, long *);
  32. #define N 10000 /* just blocking */
  33. #define OUT(out, r, n) if(out->flags&Table) outtable(r, n, (long *)out->data);\
  34. else ((Outfn)(out->fn))(r, n, (long *)0)
  35. extern Rune runes[N];
  36. extern char obuf[UTFmax*N]; /* maximum bloat from N runes */
  37. #define BADMAP (0xFFFD)
  38. #define BYTEBADMAP ('?') /* badmap but has to fit in a byte */
  39. #define ESC 033
  40. #ifdef PLAN9
  41. #define EPR fprint(2,
  42. #define EXIT(n,s) exits(s)
  43. #else
  44. #define EPR fprintf(stderr,
  45. #define USED(x) /* in plan 9, USED(x) tells the compiler to treat x as used */
  46. #define EXIT(n,s) exit(n)
  47. #endif