1 /* $XConsortium: entity.c /main/3 1995/11/08 10:17:16 rswiston $ */
3 Copyright 1986 Tandem Computers Incorporated.
4 This product and information is proprietary of Tandem Computers Incorporated.
5 Copyright 1986, 1987, 1988, 1989 Hewlett-Packard Co.
8 /* Entity.c contains procedures pertaining to entities */
23 /* Process the name in a usemap delaration */
25 void m_ckmap(M_WCHAR *name, LOGICAL useoradd)
27 void m_ckmap(name, useoradd)
34 if (mapid = m_packedlook(m_maptree, name))
35 m_setmap(mapid + 1, useoradd) ;
36 else m_err1("Undefined short reference map %s", name) ;
39 /* Check type specified in entity declaration for previously defined
40 entity. Testing to see if the new declaration is identical to the
45 if ((int) m_entity->type != type) {
46 m_err1("Redefinition of entity %s ignored", m_entity->name) ;
48 m_curcon = TYPEDENTVAL ;
52 /* Tests if an entity is too long */
53 void m_longent(context)
56 if (m_entclen >= M_LITLEN) {
58 m_error("Entity content too long") ;
60 else m_entcontent[m_entclen++] = m_scanval ;
63 /* Enters an entity name into the entity name tree */
69 new = (M_ENTITY *) m_malloc(sizeof(M_ENTITY), "entity") ;
70 if (m_entity = (M_ENTITY *) m_ntrtrie(p, m_enttrie, (M_TRIE *) new)) {
71 m_free(new, "entity") ;
72 if (m_entity->wheredef == M_DPARSER) {
74 m_err1("Redefinition of entity %s ignored", p) ;
77 else m_curcon = DUPENT ;
80 if (m_entity->content) {
81 m_err1("Warning: Redefinition of predefined entity %s", p) ;
82 m_entity->type = M_GENERAL ;
83 m_entity->content = NULL ;
85 m_entity->wheredef = M_DPARSER ;
90 m_entity->type = M_GENERAL ;
91 m_entity->wheredef = M_DPARSER ;
92 m_entity->content = NULL ;
93 m_entity->name = (M_WCHAR *) m_malloc(w_strlen(p) + 1, "entity name") ;
94 w_strcpy(m_entity->name, p) ;