gnetlist
|
00001 /* gEDA - GPL Electronic Design Automation 00002 * gnetlist - gEDA Netlist 00003 * Copyright (C) 1998-2010 Ales Hvezda 00004 * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details) 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00019 * MA 02111-1301 USA. 00020 */ 00021 00022 #include <config.h> 00023 #include <missing.h> 00024 00025 #include <stdio.h> 00026 #ifdef HAVE_STRING_H 00027 #include <string.h> 00028 #endif 00029 #include <math.h> 00030 00031 #include <libgeda/libgeda.h> 00032 00033 #include "../include/globals.h" 00034 #include "../include/prototype.h" 00035 00036 #ifdef HAVE_LIBDMALLOC 00037 #include <dmalloc.h> 00038 #endif 00039 00040 SCM 00041 vams_get_attribs_list (OBJECT *object) 00042 { 00043 SCM list = SCM_EOL; 00044 OBJECT *o_current; 00045 GList *a_iter; 00046 OBJECT *a_current; 00047 int val; 00048 char* found_name = NULL; 00049 00050 o_current = object; 00051 00052 /* search outside the symbol (attached attributes only) */ 00053 a_iter = o_current->attribs; 00054 while(a_iter != NULL) { 00055 a_current = a_iter->data; 00056 if (a_current->text && a_current->text->string) { 00057 val = o_attrib_get_name_value (a_current, &found_name, NULL); 00058 00059 if (val) { 00060 list = scm_cons (scm_from_utf8_string (found_name), list); 00061 } 00062 00063 g_free (found_name); 00064 } 00065 a_iter = g_list_next (a_iter); 00066 } 00067 00068 return list; 00069 } 00070 00071 SCM 00072 vams_get_package_attributes(SCM scm_uref) 00073 { 00074 NETLIST *nl_current; 00075 char *uref; 00076 00077 SCM_ASSERT(scm_is_string (scm_uref), scm_uref, SCM_ARG1, 00078 "gnetlist:vams-get-package-attributes"); 00079 00080 uref = scm_to_utf8_string (scm_uref); 00081 00082 /* here is where you make it multi page aware */ 00083 nl_current = netlist_head; 00084 00085 /* search for the first instance */ 00086 /* through the entire list */ 00087 while(nl_current != NULL) { 00088 00089 if (nl_current->component_uref && 00090 strcmp(nl_current->component_uref, uref) == 0) { 00091 free (uref); 00092 return vams_get_attribs_list (nl_current->object_ptr); 00093 } 00094 nl_current = nl_current->next; 00095 } 00096 00097 free (uref); 00098 return SCM_EOL; 00099 }