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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
23 #include <sys/types.h>
31 #include "libgeda_priv.h"
33 #ifdef HAVE_LIBDMALLOC
43 static int menu_index
=0;
47 /* and eventually make this unlimited */
49 static struct st_menu menu
[MAX_MENUS
];
51 /*! \todo Finish function documentation!!!
53 * \par Function Description
56 int s_menu_return_num(void)
61 /*! \todo Finish function documentation!!!
63 * \par Function Description
66 SCM
s_menu_return_entry(int index
, char **menu_name
)
68 if (menu_name
== NULL
) {
72 if (index
> MAX_MENUS
|| index
< 0) {
77 *menu_name
= menu
[index
].menu_name
;
78 return(menu
[index
].menu_items
);
81 /*! \todo Finish function documentation!!!
83 * \par Function Description
86 int s_menu_add_entry(char *new_menu
, SCM menu_items
)
88 if (new_menu
== NULL
) {
92 if (menu_index
>= MAX_MENUS
) {
96 menu
[menu_index
].menu_name
= g_strdup (new_menu
);
97 scm_gc_protect_object (menu_items
);
98 menu
[menu_index
].menu_items
= menu_items
;
104 /*! \todo Finish function documentation!!!
106 * \par Function Description
113 for (i
= 0; i
< menu_index
; i
++) {
114 printf("Name; %s\n", menu
[i
].menu_name
);
115 scm_display (menu
[i
].menu_items
, scm_current_output_port ());
120 /*! \todo Finish function documentation!!!
122 * \par Function Description
129 for (i
= 0; i
< menu_index
; i
++) {
130 if (menu
[i
].menu_name
) {
131 g_free(menu
[i
].menu_name
);
132 menu
[i
].menu_name
= NULL
;
133 scm_gc_unprotect_object (menu
[i
].menu_items
);
140 /*! \todo Finish function documentation!!!
142 * \par Function Description
148 for (i
= 0; i
< MAX_MENUS
; i
++) {
149 menu
[i
].menu_name
= NULL
;