Merge branch 'linux1'
[oweals/cde.git] / cde / programs / dthelp / parser / pass2 / util / common.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: common.h /main/6 1996/07/31 13:34:28 cde-hp $ */
24 /*
25                    Copyright (c) 1987, 1988, 1989 Hewlett-Packard Co.
26 */
27
28 /* Common.h contains definitions common to programs BUILD, ELTDEF, and PARSER.
29 Its purpose is to insure that limits, such as the maximum length of an SGML
30 name, are the same for all programs.
31 */
32
33 #define M_MARKUP
34
35 /* White-space characters */
36 #define M_RE '\n'
37 #define M_SPACE ' '
38 #define M_TAB '\t'
39
40 /* Maximum length of a default parameter value */
41 #define M_LITLEN 1024
42
43 /* Maximum length of an element name */
44 #define M_NAMELEN 64
45
46 /* M_NONNAME, M_NMSTART, M_NAMECHAR, and M_DIGIT are used to indicate 
47    which characters can appear within element names*/
48 #define M_NONNAME 0
49 #define M_NMSTART 1
50 #define M_NAMECHAR 2
51 #define M_DIGIT 3
52
53 /* Number of characters in the character set */
54 #define M_CHARSETLEN 256
55
56 /* Structure for entities */
57 typedef struct m_entity M_ENTITY ;
58 struct m_entity {
59   unsigned char type ;
60   unsigned char wheredef ;
61   M_WCHAR *content ;
62   M_WCHAR *name ;
63 #if defined(BUILDEXTERN) || defined(ELTEXTERN)
64   int index ;
65   M_ENTITY *next ;
66 #endif
67 #if ! defined(BUILDEXTERN)
68   int codeindex ;
69 #endif
70   } ;
71
72 /* Declarations for character types */
73 typedef struct {
74   LOGICAL type ;
75   /* Must be same type as EOF */
76   int upper ;
77   int lower ;
78   } M_CHARTYPE ;
79
80
81 #define m_ischar(x) ((int) (x) >= 0 && (int) (x) < M_CHARSETLEN)
82 #define m_cttype(x) (m_ischar(x) ? m_ctarray[x].type : M_NONNAME)
83 #define m_ctupper(x) (m_ischar(x) ? m_ctarray[x].upper : x)
84 #define m_ctlower(x) (m_ischar(x) ? m_ctarray[x].lower : x)
85 #define m_ctdigit(x) (m_ischar(x) ? m_ctarray[x].type == M_DIGIT : FALSE)