scanchar.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (C) 1990, 1995, 1996 Aladdin Enterprises. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: scanchar.h,v 1.4 2002/02/21 22:24:53 giles Exp $ */
  14. /* Definitions for token scanner character type table */
  15. /* Requires scommon.h */
  16. #ifndef scanchar_INCLUDED
  17. # define scanchar_INCLUDED
  18. /*
  19. * An array for fast scanning of names, numbers, and hex strings.
  20. * Indexed by character code (including exceptions), it contains:
  21. * 0 - max_radix-1 for valid digits,
  22. * ctype_name for other characters valid in names,
  23. * ctype_btoken for characters introducing binary tokens
  24. * (if the binary token feature is enabled),
  25. * ctype_space for whitespace characters,
  26. * ctype_exception for exceptions (see scommon.h), and
  27. * ctype_other for everything else.
  28. * Exceptions are negative values; we bias the table origin accordingly.
  29. *
  30. * NOTE: This table is defined in iscantab.c and used in a variety of places.
  31. * If any of the values below change, you must edit the table.
  32. */
  33. extern const byte scan_char_array[max_stream_exception + 256];
  34. #define scan_char_decoder (&scan_char_array[max_stream_exception])
  35. #define min_radix 2
  36. #define max_radix 36
  37. #define ctype_name 100
  38. #define ctype_btoken 101
  39. #define ctype_space 102
  40. #define ctype_other 103
  41. #define ctype_exception 104
  42. /* Special characters with no \xxx representation */
  43. #define char_NULL 0
  44. #define char_EOT 004 /* ^D, job delimiter */
  45. #define char_VT 013 /* ^K, vertical tab */
  46. #define char_DOS_EOF 032 /* ^Z */
  47. /*
  48. * Most systems define '\n' as 0x0a and '\r' as 0x0d; however, OS-9
  49. * has '\n' = '\r' = 0x0d and '\l' = 0x0a. To deal with this,
  50. * we introduce abstract characters char_CR and char_EOL such that
  51. * any of [char_CR], [char_CR char_EOL], or [char_EOL] is recognized
  52. * as an end-of-line sequence.
  53. */
  54. #define char_CR '\r'
  55. #if '\r' == '\n'
  56. # define char_EOL 0x0a /* non-OS-9 compilers complain about '\l' */
  57. #else
  58. # define char_EOL '\n'
  59. #endif
  60. #endif /* scanchar_INCLUDED */