home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / bbs / programs / amiga / makeindex.lha / makeindex-2.12 / src / scanid.h < prev    next >
Text File  |  1991-07-05  |  4KB  |  171 lines

  1. /*
  2.  *
  3.  *  This file is part of
  4.  *    MakeIndex - A formatter and format independent index processor
  5.  *
  6.  *  Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
  7.  *  Copyright (C) 1988 by Olivetti Research Center
  8.  *  Copyright (C) 1987 by Regents of the University of California
  9.  *
  10.  *  Author:
  11.  *    Pehong Chen
  12.  *    Chen & Harrison International Systems, Inc.
  13.  *    Palo Alto, California
  14.  *    USA
  15.  *    (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
  16.  *
  17.  *  Contributors:
  18.  *    Please refer to the CONTRIB file that comes with this release
  19.  *    for a list of people who have contributed to this and/or previous
  20.  *    release(s) of MakeIndex.
  21.  *
  22.  *  All rights reserved by the copyright holders.  See the copyright
  23.  *  notice distributed with this software for a complete description of
  24.  *  the conditions under which it is made available.
  25.  *
  26.  */
  27.  
  28. #define IS_COMPOSITOR (strncmp(&no[i], page_comp, comp_len) == 0)
  29.  
  30. #define ROMAN_I 'I'
  31. #define ROMAN_V 'V'
  32. #define ROMAN_X 'X'
  33. #define ROMAN_L 'L'
  34. #define ROMAN_C 'C'
  35. #define ROMAN_D 'D'
  36. #define ROMAN_M 'M'
  37.  
  38. #define ROMAN_i 'i'
  39. #define ROMAN_v 'v'
  40. #define ROMAN_x 'x'
  41. #define ROMAN_l 'l'
  42. #define ROMAN_c 'c'
  43. #define ROMAN_d 'd'
  44. #define ROMAN_m 'm'
  45.  
  46. #define VAL_I 1
  47. #define VAL_V 5
  48. #define VAL_X 10
  49. #define VAL_L 50
  50. #define VAL_C 100
  51. #define VAL_D 500
  52. #define VAL_M 1000
  53.  
  54. #define ROMAN_LOWER_VAL(C) \
  55.     ((C == ROMAN_i) ? VAL_I : \
  56.      (C == ROMAN_v) ? VAL_V : \
  57.      (C == ROMAN_x) ? VAL_X : \
  58.      (C == ROMAN_l) ? VAL_L : \
  59.      (C == ROMAN_c) ? VAL_C : \
  60.      (C == ROMAN_d) ? VAL_D : \
  61.      (C == ROMAN_m) ? VAL_M : 0)
  62.  
  63. #define ROMAN_UPPER_VAL(C) \
  64.     ((C == ROMAN_I) ? VAL_I : \
  65.      (C == ROMAN_V) ? VAL_V : \
  66.      (C == ROMAN_X) ? VAL_X : \
  67.      (C == ROMAN_L) ? VAL_L : \
  68.      (C == ROMAN_C) ? VAL_C : \
  69.      (C == ROMAN_D) ? VAL_D : \
  70.      (C == ROMAN_M) ? VAL_M : 0)
  71.  
  72. #define IS_ROMAN_LOWER(C) \
  73.     ((C == ROMAN_i) || (C == ROMAN_v) || (C == ROMAN_x) || \
  74.      (C == ROMAN_l) || (C == ROMAN_c) || (C == ROMAN_d) || (C == ROMAN_m))
  75.  
  76. #define IS_ROMAN_UPPER(C) \
  77.     ((C == ROMAN_I) || (C == ROMAN_V) || (C == ROMAN_X) || \
  78.      (C == ROMAN_L) || (C == ROMAN_C) || (C == ROMAN_D) || (C == ROMAN_M))
  79.  
  80. #if   (CCD_2000 | OS_MVSXA)
  81. #define ALPHA_VAL(C) ((isalpha(C)) ? (strchr(UPCC,toupper(C))-UPCC) : 0)
  82.  
  83. #define IS_ALPHA_LOWER(C) (isalpha(C) && islower(C))
  84.  
  85. #define IS_ALPHA_UPPER(C) (isalpha(C) && isupper(C))
  86. #else
  87. #define ALPHA_VAL(C) \
  88.     ((('A' <= C) && (C <= 'Z')) ? C - 'A' : \
  89.      (('a' <= C) && (C <= 'z')) ? C - 'a' : 0)
  90.  
  91. #define IS_ALPHA_LOWER(C) \
  92.     (('a' <= C) && (C <= 'z'))
  93.  
  94. #define IS_ALPHA_UPPER(C) \
  95.     (('A' <= C) && (C <= 'Z'))
  96. #endif                                 /* CCD_2000 | OS_MVSXA */
  97.  
  98. #define IDX_SKIPLINE { \
  99.     int tmp; \
  100.     while ((tmp = GET_CHAR(idx_fp)) != LFD) \
  101.     if (tmp == EOF) \
  102.         break; \
  103.     idx_lc++; \
  104.     arg_count = -1; \
  105. }
  106.  
  107. #define NULL_RTN { \
  108.     IDX_ERROR("Illegal null field.\n", NULL); \
  109.     return (FALSE); \
  110. }
  111.  
  112. #if   KCC_20
  113. /* KCC preprocessor bug collapses multiple blanks to single blank */
  114. #define IDX_ERROR(F, D) { \
  115.     if (idx_dot) { \
  116.     fprintf(ilg_fp, "\n"); \
  117.     idx_dot = FALSE; \
  118.     } \
  119.     fprintf(ilg_fp, \
  120.         "!! Input index error (file = %s, line = %d):\n\040\040 -- ", \
  121.         idx_fn, idx_lc); \
  122.     fprintf(ilg_fp, F, D); \
  123.     idx_ec++; \
  124. }
  125.  
  126. #define IDX_ERROR2(F, D1, D2) { \
  127.     if (idx_dot) { \
  128.     fprintf(ilg_fp, "\n"); \
  129.     idx_dot = FALSE; \
  130.     } \
  131.     fprintf(ilg_fp, \
  132.         "!! Input index error (file = %s, line = %d):\n\040\040 -- ", \
  133.         idx_fn, idx_lc); \
  134.     fprintf(ilg_fp, F, D1, D2); \
  135.     idx_ec++; \
  136. }
  137. #else
  138. #define IDX_ERROR(F, D) { \
  139.     if (idx_dot) { \
  140.     fprintf(ilg_fp, "\n"); \
  141.     idx_dot = FALSE; \
  142.     } \
  143.     fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
  144.         idx_fn, idx_lc); \
  145.     fprintf(ilg_fp, F, D); \
  146.     idx_ec++; \
  147. }
  148.  
  149. #define IDX_ERROR2(F, D1, D2) { \
  150.     if (idx_dot) { \
  151.     fprintf(ilg_fp, "\n"); \
  152.     idx_dot = FALSE; \
  153.     } \
  154.     fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
  155.         idx_fn, idx_lc); \
  156.     fprintf(ilg_fp, F, D1, D2); \
  157.     idx_ec++; \
  158. }
  159. #endif
  160.  
  161.  
  162. #define ENTER(V) { \
  163.     if (*count >= PAGEFIELD_MAX) { \
  164.     IDX_ERROR2("Page number %s has too many fields (max. %d).", \
  165.            no, PAGEFIELD_MAX); \
  166.     return (FALSE); \
  167.     } \
  168.     npg[*count] = (V); \
  169.     ++*count; \
  170. }
  171.