Back to index

tetex-bin  3.0
scanid.h
Go to the documentation of this file.
00001 /*
00002  *
00003  *  This file is part of
00004  *     MakeIndex - A formatter and format independent index processor
00005  *
00006  *  Copyright (C) 1989 by Chen & Harrison International Systems, Inc.
00007  *  Copyright (C) 1988 by Olivetti Research Center
00008  *  Copyright (C) 1987 by Regents of the University of California
00009  *
00010  *  Author:
00011  *     Pehong Chen
00012  *     Chen & Harrison International Systems, Inc.
00013  *     Palo Alto, California
00014  *     USA
00015  *     (phc@renoir.berkeley.edu or chen@orc.olivetti.com)
00016  *
00017  *  Contributors:
00018  *     Please refer to the CONTRIB file that comes with this release
00019  *     for a list of people who have contributed to this and/or previous
00020  *     release(s) of MakeIndex.
00021  *
00022  *  All rights reserved by the copyright holders.  See the copyright
00023  *  notice distributed with this software for a complete description of
00024  *  the conditions under which it is made available.
00025  *
00026  */
00027 
00028 #define IS_COMPOSITOR (strncmp(&no[i], page_comp, comp_len) == 0)
00029 
00030 #define ROMAN_I 'I'
00031 #define ROMAN_V 'V'
00032 #define ROMAN_X 'X'
00033 #define ROMAN_L 'L'
00034 #define ROMAN_C 'C'
00035 #define ROMAN_D 'D'
00036 #define ROMAN_M 'M'
00037 
00038 #define ROMAN_i 'i'
00039 #define ROMAN_v 'v'
00040 #define ROMAN_x 'x'
00041 #define ROMAN_l 'l'
00042 #define ROMAN_c 'c'
00043 #define ROMAN_d 'd'
00044 #define ROMAN_m 'm'
00045 
00046 #define VAL_I 1
00047 #define VAL_V 5
00048 #define VAL_X 10
00049 #define VAL_L 50
00050 #define VAL_C 100
00051 #define VAL_D 500
00052 #define VAL_M 1000
00053 
00054 #define ROMAN_LOWER_VAL(C) \
00055     ((C == ROMAN_i) ? VAL_I : \
00056      (C == ROMAN_v) ? VAL_V : \
00057      (C == ROMAN_x) ? VAL_X : \
00058      (C == ROMAN_l) ? VAL_L : \
00059      (C == ROMAN_c) ? VAL_C : \
00060      (C == ROMAN_d) ? VAL_D : \
00061      (C == ROMAN_m) ? VAL_M : 0)
00062 
00063 #define ROMAN_UPPER_VAL(C) \
00064     ((C == ROMAN_I) ? VAL_I : \
00065      (C == ROMAN_V) ? VAL_V : \
00066      (C == ROMAN_X) ? VAL_X : \
00067      (C == ROMAN_L) ? VAL_L : \
00068      (C == ROMAN_C) ? VAL_C : \
00069      (C == ROMAN_D) ? VAL_D : \
00070      (C == ROMAN_M) ? VAL_M : 0)
00071 
00072 #define IS_ROMAN_LOWER(C) \
00073     ((C == ROMAN_i) || (C == ROMAN_v) || (C == ROMAN_x) || \
00074      (C == ROMAN_l) || (C == ROMAN_c) || (C == ROMAN_d) || (C == ROMAN_m))
00075 
00076 #define IS_ROMAN_UPPER(C) \
00077     ((C == ROMAN_I) || (C == ROMAN_V) || (C == ROMAN_X) || \
00078      (C == ROMAN_L) || (C == ROMAN_C) || (C == ROMAN_D) || (C == ROMAN_M))
00079 
00080 #define ALPHA_VAL(C) \
00081     ((('A' <= C) && (C <= 'Z')) ? C - 'A' : \
00082      (('a' <= C) && (C <= 'z')) ? C - 'a' : 0)
00083 
00084 #define IS_ALPHA_LOWER(C) \
00085     (('a' <= C) && (C <= 'z'))
00086 
00087 #define IS_ALPHA_UPPER(C) \
00088     (('A' <= C) && (C <= 'Z'))
00089 
00090 #define IDX_SKIPLINE { \
00091     int tmp; \
00092     while ((tmp = GET_CHAR(idx_fp)) != LFD) \
00093        if (tmp == EOF) \
00094            break; \
00095     idx_lc++; \
00096     arg_count = -1; \
00097 }
00098 
00099 #define NULL_RTN { \
00100     IDX_ERROR("Illegal null field.\n", NULL); \
00101     return (FALSE); \
00102 }
00103 
00104 #define IDX_ERROR(F, D) { \
00105     if (idx_dot) { \
00106        fprintf(ilg_fp, "\n"); \
00107        idx_dot = FALSE; \
00108     } \
00109     fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
00110            idx_fn, idx_lc); \
00111     fprintf(ilg_fp, F, D); \
00112     idx_ec++; \
00113 }
00114 
00115 #define IDX_ERROR2(F, D1, D2) { \
00116     if (idx_dot) { \
00117        fprintf(ilg_fp, "\n"); \
00118        idx_dot = FALSE; \
00119     } \
00120     fprintf(ilg_fp, "!! Input index error (file = %s, line = %d):\n   -- ", \
00121            idx_fn, idx_lc); \
00122     fprintf(ilg_fp, F, D1, D2); \
00123     idx_ec++; \
00124 }
00125 
00126 
00127 #define ENTER(V) { \
00128     if (*count >= PAGEFIELD_MAX) { \
00129        IDX_ERROR2("Page number %s has too many fields (max. %d).", \
00130               no, PAGEFIELD_MAX); \
00131        return (FALSE); \
00132     } \
00133     npg[*count] = (V); \
00134     ++*count; \
00135 }