2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: entity.c /main/3 1995/11/08 09:35:59 rswiston $ */
25 Copyright 1986 Tandem Computers Incorporated.
26 This product and information is proprietary of Tandem Computers Incorporated.
27 Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
30 /* Entity.c contains procedures pertaining to entities */
45 /* Process the name in a usemap delaration */
47 void m_ckmap(M_WCHAR *name, LOGICAL useoradd)
49 void m_ckmap(name, useoradd)
56 if (mapid = m_packedlook(m_maptree, name))
57 m_setmap(mapid + 1, useoradd) ;
58 else m_err1("Undefined short reference map %s", name) ;
61 /* Check type specified in entity declaration for previously defined
62 entity. Testing to see if the new declaration is identical to the
67 if ((int) m_entity->type != type) {
68 m_err1("Redefinition of entity %s ignored", m_entity->name) ;
70 m_curcon = TYPEDENTVAL ;
74 /* Tests if an entity is too long */
75 void m_longent(context)
78 if (m_entclen >= M_LITLEN) {
80 m_error("Entity content too long") ;
82 else m_entcontent[m_entclen++] = m_scanval ;
85 /* Enters an entity name into the entity name tree */
91 new = (M_ENTITY *) m_malloc(sizeof(M_ENTITY), "entity") ;
92 if (m_entity = (M_ENTITY *) m_ntrtrie(p, m_enttrie, (M_TRIE *) new)) {
93 m_free(new, "entity") ;
94 if (m_entity->wheredef == M_DPARSER) {
96 m_err1("Redefinition of entity %s ignored", p) ;
99 else m_curcon = DUPENT ;
102 if (m_entity->content) {
103 m_err1("Warning: Redefinition of predefined entity %s", p) ;
104 m_entity->type = M_GENERAL ;
105 m_entity->content = NULL ;
107 m_entity->wheredef = M_DPARSER ;
112 m_entity->type = M_GENERAL ;
113 m_entity->wheredef = M_DPARSER ;
114 m_entity->content = NULL ;
115 m_entity->name = (M_WCHAR *) m_malloc(w_strlen(p) + 1, "entity name") ;
116 w_strcpy(m_entity->name, p) ;