Debian Codegraph @

texk/makeindexk/scanid.h

raw
1 /*
2 *
3 * This file is part of
4 * MakeIndex - A formatter and format independent index processor
5 *
6 * Copyright (C) 1998-2011 by the TeX Live project.
7 * Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
8 * Copyright (C) 1988 by Olivetti Research Center
9 * Copyright (C) 1987 by Regents of the University of California
10 *
11 * Author:
12 * Pehong Chen
13 * Chen & Harrison International Systems, Inc.
14 * Palo Alto, California
15 * USA
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 #define ROMAN_LOWER 'r'
81 #define ROMAN_UPPER 'R'
82 #define ARABIC 'n'
83 #define ALPHA_LOWER 'a'
84 #define ALPHA_UPPER 'A'
85
86 #define ALPHA_VAL(C) \
87 ((('A' <= C) && (C <= 'Z')) ? C - 'A' : \
88 (('a' <= C) && (C <= 'z')) ? C - 'a' : 0)
89
90 #define IS_ALPHA_LOWER(C) \
91 (('a' <= C) && (C <= 'z'))
92
93 #define IS_ALPHA_UPPER(C) \
94 (('A' <= C) && (C <= 'Z'))
95
96 #define IDX_SKIPLINE { \
97 int tmp; \
98 while ((tmp = GET_CHAR(idx_fp)) != LFD) \
99 if (tmp == EOF) \
100 break; \
101 idx_lc++; \
102 arg_count = -1; \
103 }
104
105 #define NULL_RTN { \
106 IDX_ERROR("Illegal null field.\n"); \
107 return (FALSE); \
108 }
109
110 #define IDX_ERROR(F) { \
111 if (idx_dot) { \
112 fprintf(ilg_fp, "\n"); \
113 idx_dot = FALSE; \
114 } \
115 fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n -- ", \
116 idx_fn, idx_lc); \
117 fprintf(ilg_fp, F); \
118 idx_ec++; \
119 }
120
121 #define IDX_ERROR1(F, D) { \
122 if (idx_dot) { \
123 fprintf(ilg_fp, "\n"); \
124 idx_dot = FALSE; \
125 } \
126 fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n -- ", \
127 idx_fn, idx_lc); \
128 fprintf(ilg_fp, F, D); \
129 idx_ec++; \
130 }
131
132 #define IDX_ERROR2(F, D1, D2) { \
133 if (idx_dot) { \
134 fprintf(ilg_fp, "\n"); \
135 idx_dot = FALSE; \
136 } \
137 fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n -- ", \
138 idx_fn, idx_lc); \
139 fprintf(ilg_fp, F, D1, D2); \
140 idx_ec++; \
141 }
142
143
144 #define ENTER(V) { \
145 if (*count >= PAGEFIELD_MAX) { \
146 IDX_ERROR2("Page number %s has too many fields (max. %d).", \
147 no, PAGEFIELD_MAX); \
148 return (FALSE); \
149 } \
150 npg[*count] = (V); \
151 ++*count; \
152 }