/Modules/cjkcodecs/emu_jisx0213_2000.h

http://unladen-swallow.googlecode.com/ · C Header · 43 lines · 35 code · 6 blank · 2 comment · 65 complexity · 76bf7fb42746b979f65a7e7fb2bd102c MD5 · raw file

  1. /* These routines may be quite inefficient, but it's used only to emulate old
  2. * standards. */
  3. #ifndef EMULATE_JISX0213_2000_ENCODE_INVALID
  4. #define EMULATE_JISX0213_2000_ENCODE_INVALID 1
  5. #endif
  6. #define EMULATE_JISX0213_2000_ENCODE_BMP(assi, c) \
  7. if (config == (void *)2000 && ( \
  8. (c) == 0x9B1C || (c) == 0x4FF1 || \
  9. (c) == 0x525D || (c) == 0x541E || \
  10. (c) == 0x5653 || (c) == 0x59F8 || \
  11. (c) == 0x5C5B || (c) == 0x5E77 || \
  12. (c) == 0x7626 || (c) == 0x7E6B)) \
  13. return EMULATE_JISX0213_2000_ENCODE_INVALID; \
  14. else if (config == (void *)2000 && (c) == 0x9B1D) \
  15. (assi) = 0x8000 | 0x7d3b; \
  16. #define EMULATE_JISX0213_2000_ENCODE_EMP(assi, c) \
  17. if (config == (void *)2000 && (c) == 0x20B9F) \
  18. return EMULATE_JISX0213_2000_ENCODE_INVALID;
  19. #ifndef EMULATE_JISX0213_2000_DECODE_INVALID
  20. #define EMULATE_JISX0213_2000_DECODE_INVALID 2
  21. #endif
  22. #define EMULATE_JISX0213_2000_DECODE_PLANE1(assi, c1, c2) \
  23. if (config == (void *)2000 && \
  24. (((c1) == 0x2E && (c2) == 0x21) || \
  25. ((c1) == 0x2F && (c2) == 0x7E) || \
  26. ((c1) == 0x4F && (c2) == 0x54) || \
  27. ((c1) == 0x4F && (c2) == 0x7E) || \
  28. ((c1) == 0x74 && (c2) == 0x27) || \
  29. ((c1) == 0x7E && (c2) == 0x7A) || \
  30. ((c1) == 0x7E && (c2) == 0x7B) || \
  31. ((c1) == 0x7E && (c2) == 0x7C) || \
  32. ((c1) == 0x7E && (c2) == 0x7D) || \
  33. ((c1) == 0x7E && (c2) == 0x7E))) \
  34. return EMULATE_JISX0213_2000_DECODE_INVALID;
  35. #define EMULATE_JISX0213_2000_DECODE_PLANE2(assi, c1, c2) \
  36. if (config == (void *)2000 && (c1) == 0x7D && (c2) == 0x3B) \
  37. (assi) = 0x9B1D;