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
25 * $XConsortium: obj_names_list.c /main/3 1995/11/06 18:37:04 rswiston $
27 * @(#)obj_names_list.c 1.1 26 May 1994 cde_app_builder/src/libABobj
29 * RESTRICTED CONFIDENTIAL INFORMATION:
31 * The information in this document is subject to special
32 * restrictions in a confidential disclosure agreement between
33 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
34 * document outside HP, IBM, Sun, USL, SCO, or Univel without
35 * Sun's specific written approval. This document and all copies
36 * and derivative works thereof must be returned or destroyed at
39 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
45 * template.c - template c file.
49 #include <ab_private/trav.h>
50 #include "obj_names_listP.h"
52 /*************************************************************************
54 ** Constants (#define and const) **
56 **************************************************************************/
58 /*************************************************************************
60 ** Private Functions (C declarations and macros) **
62 **************************************************************************/
64 /*************************************************************************
66 ** Function Definitions **
68 **************************************************************************/
71 objP_get_names_scope_obj(ABObj obj)
73 ABObj namesObj = obj_get_module(obj);
75 if (obj_is_project(obj))
79 else if ((namesObj == NULL) || obj_is_module(obj))
81 /* module names go in project */
82 namesObj = obj_get_project(obj);
89 objP_get_names_scope(ABObj obj)
91 ABObj nameScopeObj = objP_get_names_scope_obj(obj);
92 if (nameScopeObj != NULL)
94 return objP_get_names_list(nameScopeObj);
101 objP_get_names_scope_obj_for_children(ABObj parent)
103 ABObj scopeObj = obj_get_module(parent);
104 if (scopeObj == NULL)
106 scopeObj = obj_get_project(parent);
113 objP_get_names_scope_for_children(ABObj parent)
115 ABObj scopeObj = objP_get_names_scope_obj_for_children(parent);
116 if (scopeObj != NULL)
118 return objP_get_names_list(scopeObj);
125 objP_get_names_list(ABObj obj)
130 return obj->info.module.obj_names_list;
131 case AB_TYPE_PROJECT:
132 return obj->info.project.obj_names_list;
140 objP_add_to_names_list(ABObj obj)
142 StringList names = NULL;
144 names = objP_get_names_scope(obj);
147 strlist_add_istr(names, obj->name, obj);
154 objP_remove_from_names_list(ABObj obj)
156 StringList names = objP_get_names_scope(obj);
159 strlist_remove_istr(names, obj->name);
166 objP_tree_add_to_names_list(ABObj tree)
168 ABObj scopeObj = objP_get_names_scope_obj(tree);
169 StringList names = NULL;
173 if (scopeObj != NULL)
175 names = objP_get_names_list(scopeObj);
182 for (trav_open(&trav, tree, AB_TRAV_ALL);
183 (obj = trav_next(&trav)) != NULL; )
185 if (objP_get_names_scope_obj(obj) == scopeObj)
187 strlist_add_istr(names, obj->name, obj);
197 objP_tree_remove_from_names_list(ABObj tree)
199 ABObj scopeObj = objP_get_names_scope_obj(tree);
200 StringList names = NULL;
204 if (scopeObj != NULL)
206 names = objP_get_names_list(scopeObj);
213 for (trav_open(&trav, tree, AB_TRAV_ALL);
214 (obj = trav_next(&trav)) != NULL; )
216 if (objP_get_names_scope_obj(obj) == scopeObj)
218 strlist_remove_istr(names, obj->name);