gsch2pcb: Make --m4-file and -m4-pcbdir arguments work again.
[geda-gaf/peter-b.git] / gnetlist / src / vams_misc.c
blobf5f862c0fcb209d46ddd4ff0e81f5d5ed1005084
1 /* gEDA - GPL Electronic Design Automation
2 * gnetlist - gEDA Netlist
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <config.h>
22 #include <missing.h>
24 #include <stdio.h>
25 #ifdef HAVE_STRING_H
26 #include <string.h>
27 #endif
28 #include <math.h>
30 #include <libgeda/libgeda.h>
32 #include "../include/globals.h"
33 #include "../include/prototype.h"
35 #ifdef HAVE_LIBDMALLOC
36 #include <dmalloc.h>
37 #endif
39 SCM
40 vams_get_attribs_list (OBJECT *object)
42 SCM list = SCM_EOL;
43 OBJECT *o_current;
44 GList *a_iter;
45 OBJECT *a_current;
46 int val;
47 char* found_name = NULL;
49 o_current = object;
51 /* search outside the symbol (attached attributes only) */
52 a_iter = o_current->attribs;
53 while(a_iter != NULL) {
54 a_current = a_iter->data;
55 if (a_current->text && a_current->text->string) {
56 val = o_attrib_get_name_value (a_current, &found_name, NULL);
58 if (val) {
59 list = scm_cons (scm_from_utf8_string (found_name), list);
62 g_free (found_name);
64 a_iter = g_list_next (a_iter);
67 return list;
70 SCM
71 vams_get_package_attributes(SCM scm_uref)
73 NETLIST *nl_current;
74 char *uref;
76 SCM_ASSERT(scm_is_string (scm_uref), scm_uref, SCM_ARG1,
77 "gnetlist:vams-get-package-attributes");
79 uref = scm_to_utf8_string (scm_uref);
81 /* here is where you make it multi page aware */
82 nl_current = netlist_head;
84 /* search for the first instance */
85 /* through the entire list */
86 while(nl_current != NULL) {
88 if (nl_current->component_uref &&
89 strcmp(nl_current->component_uref, uref) == 0) {
90 free (uref);
91 return vams_get_attribs_list (nl_current->object_ptr);
93 nl_current = nl_current->next;
96 free (uref);
97 return SCM_EOL;