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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
35 #include <libgeda/libgeda.h>
37 #include "../include/globals.h"
38 #include "../include/prototype.h"
40 #ifdef HAVE_LIBDMALLOC
44 /* hack rename this to be s_return_tail */
45 /* update object_tail or any list of that matter */
46 CPINLIST
*s_cpinlist_return_tail(CPINLIST
* head
)
48 CPINLIST
*pl_current
= NULL
;
49 CPINLIST
*ret_struct
= NULL
;
52 while (pl_current
!= NULL
) { /* goto end of list */
53 ret_struct
= pl_current
;
54 pl_current
= pl_current
->next
;
60 /* hack rename this to be s_return_head */
61 /* update object_tail or any list of that matter */
62 CPINLIST
*s_cpinlist_return_head(CPINLIST
* tail
)
64 CPINLIST
*pl_current
= NULL
;
65 CPINLIST
*ret_struct
= NULL
;
68 while (pl_current
!= NULL
) { /* goto end of list */
69 ret_struct
= pl_current
;
70 pl_current
= pl_current
->prev
;
77 /* returns new node */
78 CPINLIST
*s_cpinlist_add(CPINLIST
* ptr
)
82 new_node
= (CPINLIST
*) g_malloc(sizeof(CPINLIST
));
84 /* setup node information */
86 new_node
->type
= PIN_TYPE_NET
;
87 new_node
->pin_number
= NULL
;
88 new_node
->pin_label
= NULL
;
89 new_node
->net_name
= NULL
;
90 new_node
->nets
= NULL
;
92 /* Setup link list stuff */
93 new_node
->next
= NULL
;
96 new_node
->prev
= NULL
; /* setup previous link */
99 new_node
->prev
= ptr
; /* setup previous link */
100 ptr
->next
= new_node
;
105 void s_cpinlist_print(CPINLIST
* ptr
)
107 CPINLIST
*pl_current
= NULL
;
111 if (pl_current
== NULL
) {
115 while (pl_current
!= NULL
) {
117 if (pl_current
->plid
!= -1) {
118 if (pl_current
->pin_number
) {
119 printf(" pin %s", pl_current
->pin_number
);
124 if (pl_current
->pin_label
) {
125 printf(" (%s)", pl_current
->pin_label
);
130 if (pl_current
->net_name
) {
131 printf(" %s", pl_current
->net_name
);
133 printf(" Null net name");
140 if (pl_current
->nets
) {
141 s_net_print(pl_current
->nets
);
145 pl_current
= pl_current
->next
;
149 CPINLIST
*s_cpinlist_search_pin(CPINLIST
* ptr
, char *pin_number
)
151 CPINLIST
*pl_current
= NULL
;
155 if (pl_current
== NULL
) {
159 while (pl_current
!= NULL
) {
161 if (pl_current
->plid
!= -1 && (pl_current
->pin_number
!= NULL
)) {
163 if (strcmp(pl_current
->pin_number
, pin_number
) == 0) {
166 printf("equal: %s %s\n",
167 pl_current
->pin_number
, pin_number
);
174 pl_current
= pl_current
->next
;