summaryrefslogtreecommitdiff
path: root/indexing/makeindexk/scanid.h
blob: 781ae3f709eb2f9b17a11af9b731c4b8d4e6611c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
 *
 *  This file is part of
 *	MakeIndex - A formatter and format independent index processor
 *
 *  Copyright (C) 1998-2011 by the TeX Live project.
 *  Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
 *  Copyright (C) 1988 by Olivetti Research Center
 *  Copyright (C) 1987 by Regents of the University of California
 *
 *  Author:
 *	Pehong Chen
 *	Chen & Harrison International Systems, Inc.
 *	Palo Alto, California
 *	USA
 *
 *  Contributors:
 *	Please refer to the CONTRIB file that comes with this release
 *	for a list of people who have contributed to this and/or previous
 *	release(s) of MakeIndex.
 *
 *  All rights reserved by the copyright holders.  See the copyright
 *  notice distributed with this software for a complete description of
 *  the conditions under which it is made available.
 *
 */

#define IS_COMPOSITOR (strncmp(&no[i], page_comp, comp_len) == 0)

#define ROMAN_I 'I'
#define ROMAN_V 'V'
#define ROMAN_X 'X'
#define ROMAN_L 'L'
#define ROMAN_C 'C'
#define ROMAN_D 'D'
#define ROMAN_M 'M'

#define ROMAN_i 'i'
#define ROMAN_v 'v'
#define ROMAN_x 'x'
#define ROMAN_l 'l'
#define ROMAN_c 'c'
#define ROMAN_d 'd'
#define ROMAN_m 'm'

#define VAL_I 1
#define VAL_V 5
#define VAL_X 10
#define VAL_L 50
#define VAL_C 100
#define VAL_D 500
#define VAL_M 1000

#define ROMAN_LOWER_VAL(C) \
    ((C == ROMAN_i) ? VAL_I : \
     (C == ROMAN_v) ? VAL_V : \
     (C == ROMAN_x) ? VAL_X : \
     (C == ROMAN_l) ? VAL_L : \
     (C == ROMAN_c) ? VAL_C : \
     (C == ROMAN_d) ? VAL_D : \
     (C == ROMAN_m) ? VAL_M : 0)

#define ROMAN_UPPER_VAL(C) \
    ((C == ROMAN_I) ? VAL_I : \
     (C == ROMAN_V) ? VAL_V : \
     (C == ROMAN_X) ? VAL_X : \
     (C == ROMAN_L) ? VAL_L : \
     (C == ROMAN_C) ? VAL_C : \
     (C == ROMAN_D) ? VAL_D : \
     (C == ROMAN_M) ? VAL_M : 0)

#define IS_ROMAN_LOWER(C) \
    ((C == ROMAN_i) || (C == ROMAN_v) || (C == ROMAN_x) || \
     (C == ROMAN_l) || (C == ROMAN_c) || (C == ROMAN_d) || (C == ROMAN_m))

#define IS_ROMAN_UPPER(C) \
    ((C == ROMAN_I) || (C == ROMAN_V) || (C == ROMAN_X) || \
     (C == ROMAN_L) || (C == ROMAN_C) || (C == ROMAN_D) || (C == ROMAN_M))

#define ALPHA_VAL(C) \
    ((('A' <= C) && (C <= 'Z')) ? C - 'A' : \
     (('a' <= C) && (C <= 'z')) ? C - 'a' : 0)

#define IS_ALPHA_LOWER(C) \
    (('a' <= C) && (C <= 'z'))

#define IS_ALPHA_UPPER(C) \
    (('A' <= C) && (C <= 'Z'))

#define IDX_SKIPLINE { \
    int tmp; \
    while ((tmp = GET_CHAR(idx_fp)) != LFD) \
	if (tmp == EOF) \
	    break; \
    idx_lc++; \
    arg_count = -1; \
}

#define NULL_RTN { \
    IDX_ERROR("Illegal null field.\n"); \
    return (FALSE); \
}

#define IDX_ERROR(F) { \
    if (idx_dot) { \
	fprintf(ilg_fp, "\n"); \
	idx_dot = FALSE; \
    } \
    fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
	    idx_fn, idx_lc); \
    fprintf(ilg_fp, F); \
    idx_ec++; \
}

#define IDX_ERROR1(F, D) { \
    if (idx_dot) { \
	fprintf(ilg_fp, "\n"); \
	idx_dot = FALSE; \
    } \
    fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
	    idx_fn, idx_lc); \
    fprintf(ilg_fp, F, D); \
    idx_ec++; \
}

#define IDX_ERROR2(F, D1, D2) { \
    if (idx_dot) { \
	fprintf(ilg_fp, "\n"); \
	idx_dot = FALSE; \
    } \
    fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
	    idx_fn, idx_lc); \
    fprintf(ilg_fp, F, D1, D2); \
    idx_ec++; \
}


#define ENTER(V) { \
    if (*count >= PAGEFIELD_MAX) { \
	IDX_ERROR2("Page number %s has too many fields (max. %d).", \
	       no, PAGEFIELD_MAX); \
	return (FALSE); \
    } \
    npg[*count] = (V); \
    ++*count; \
}