1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <sys/types.h>
31 #include "libgeda_priv.h"
33 #ifdef HAVE_LIBDMALLOC
37 #define MAX_ATTRIBS 128
40 struct st_attrib_names
{
45 static int attrib_index
=0;
48 /* and eventually make this unlimited */
50 static struct st_attrib_names attrib
[MAX_ATTRIBS
];
52 /*! \todo Finish function documentation!!!
54 * \par Function Description
57 int s_attrib_add_entry(char *new_attrib
)
59 if (new_attrib
== NULL
) {
63 if (attrib_index
>= MAX_ATTRIBS
) {
67 attrib
[attrib_index
].attrib_name
= g_strdup (new_attrib
);
73 /*! \todo Finish function documentation!!!
75 * \par Function Description
82 for (i
= 0; i
< attrib_index
; i
++) {
83 printf("%s\n", attrib
[i
].attrib_name
);
87 /*! \todo Finish function documentation!!!
89 * \par Function Description
92 /* true for uniqueness, zero for duplication */
93 int s_attrib_uniq(char *name
)
97 for (i
= 0; i
< attrib_index
; i
++) {
98 if (strcmp(attrib
[i
].attrib_name
, name
) == 0) {
106 /*! \todo Finish function documentation!!!
108 * \par Function Description
115 for (i
= 0; i
< attrib_index
; i
++) {
116 g_free(attrib
[i
].attrib_name
);
122 /*! \todo Finish function documentation!!!
124 * \par Function Description
130 for (i
= 0; i
< MAX_ATTRIBS
; i
++) {
131 attrib
[i
].attrib_name
= NULL
;
135 /*! \todo Finish function documentation!!!
137 * \par Function Description
140 char *s_attrib_get(int counter
)
142 if (counter
< attrib_index
) {
143 return(attrib
[counter
].attrib_name
);