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: cyclent.c /main/3 1995/11/08 11:21:36 rswiston $ */
25 Copyright 1988, 1989 Hewlett-Packard Co.
28 /* Cyclent.c contains procedure m_cyclent(), callable by interface
29 designers, to cycle through all defined entities, returning information
40 M_WCHAR *m_cyclent(LOGICAL init, unsigned char *type, M_WCHAR **content, unsigned char *wheredef)
42 M_WCHAR *m_cyclent(init, type, content, wheredef)
46 unsigned char *wheredef ;
49 static M_TRIE *current ;
50 static M_TRIE *ancestor[M_NAMELEN + 1] ;
52 static M_WCHAR name[M_NAMELEN + 1] ;
55 current = m_enttrie->data ;
58 if (length < 0) return(NULL) ;
59 while (current->symbol) {
60 ancestor[length] = current ;
61 name[length++] = current->symbol ;
62 current = current->data ;
64 name[length] = M_EOS ;
65 *type = ((M_ENTITY *) current->data)->type ;
66 *content = ((M_ENTITY *) current->data)->content ;
67 *wheredef = ((M_ENTITY *) current->data)->wheredef ;
70 current = current->next ;
74 if (length < 0) break ;
75 current = ancestor[length] ;