1 /* gEDA - GPL Electronic Design Automation
2 * gnetlist - gEDA Netlist
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2019 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
35 #include <libgeda/libgeda.h>
37 #include "../include/globals.h"
38 #include "../include/prototype.h"
40 /* hack rename this to be s_return_tail */
41 /* update object_tail or any list of that matter */
42 CPINLIST
*s_cpinlist_return_tail(CPINLIST
* head
)
44 CPINLIST
*pl_current
= NULL
;
45 CPINLIST
*ret_struct
= NULL
;
48 while (pl_current
!= NULL
) { /* goto end of list */
49 ret_struct
= pl_current
;
50 pl_current
= pl_current
->next
;
56 /* hack rename this to be s_return_head */
57 /* update object_tail or any list of that matter */
58 CPINLIST
*s_cpinlist_return_head(CPINLIST
* tail
)
60 CPINLIST
*pl_current
= NULL
;
61 CPINLIST
*ret_struct
= NULL
;
64 while (pl_current
!= NULL
) { /* goto end of list */
65 ret_struct
= pl_current
;
66 pl_current
= pl_current
->prev
;
73 /* returns new node */
74 CPINLIST
*s_cpinlist_add(CPINLIST
* ptr
)
78 new_node
= (CPINLIST
*) g_malloc(sizeof(CPINLIST
));
80 /* setup node information */
82 new_node
->type
= PIN_TYPE_NET
;
83 new_node
->pin_number
= NULL
;
84 new_node
->pin_label
= NULL
;
85 new_node
->net_name
= NULL
;
86 new_node
->nets
= NULL
;
88 /* Setup link list stuff */
89 new_node
->next
= NULL
;
92 new_node
->prev
= NULL
; /* setup previous link */
95 new_node
->prev
= ptr
; /* setup previous link */
101 void s_cpinlist_print(CPINLIST
* ptr
)
103 CPINLIST
*pl_current
= NULL
;
107 if (pl_current
== NULL
) {
111 while (pl_current
!= NULL
) {
113 if (pl_current
->plid
!= -1) {
114 if (pl_current
->pin_number
) {
115 printf(" pin %s", pl_current
->pin_number
);
120 if (pl_current
->pin_label
) {
121 printf(" (%s)", pl_current
->pin_label
);
126 if (pl_current
->net_name
) {
127 printf(" %s", pl_current
->net_name
);
129 printf(" Null net name");
136 if (pl_current
->nets
) {
137 s_net_print(pl_current
->nets
);
141 pl_current
= pl_current
->next
;
145 CPINLIST
*s_cpinlist_search_pin(CPINLIST
* ptr
, char *pin_number
)
147 CPINLIST
*pl_current
= NULL
;
151 if (pl_current
== NULL
) {
155 while (pl_current
!= NULL
) {
157 if (pl_current
->plid
!= -1 && (pl_current
->pin_number
!= NULL
)) {
159 if (strcmp(pl_current
->pin_number
, pin_number
) == 0) {
162 printf("equal: %s %s\n",
163 pl_current
->pin_number
, pin_number
);
170 pl_current
= pl_current
->next
;