1 /* gEDA - GPL Electronic Design Automation
2 * gsymcheck - gEDA Symbol Check
3 * Copyright (C) 1998-2007 Ales Hvezda
4 * Copyright (C) 1998-2007 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,
29 #include <libgeda/libgeda.h>
31 #include "../include/struct.h"
32 #include "../include/globals.h"
33 #include "../include/prototype.h"
35 /* call this for every symbol that needs to be checked */
37 s_symstruct_init(void)
41 s_symcheck
= (SYMCHECK
*) g_malloc(sizeof(SYMCHECK
));
43 s_symcheck
->info_messages
= NULL
;
44 s_symcheck
->warning_messages
= NULL
;
45 s_symcheck
->error_messages
= NULL
;
47 s_symcheck
->graphical_symbol
=FALSE
;
48 s_symcheck
->device_attribute_incorrect
=FALSE
;
49 s_symcheck
->device_attribute
=NULL
;
51 s_symcheck
->found_numbers
= NULL
;
53 s_symcheck
->net_numbers
= NULL
;
54 s_symcheck
->pin_numbers
= NULL
;
56 s_symcheck
->numslots
= NULL
;
57 s_symcheck
->slotdef
= NULL
;
58 s_symcheck
->slotting_errors
= 0;
59 s_symcheck
->found_oldpin_attrib
= 0;
60 s_symcheck
->found_oldslot_attrib
= 0;
61 s_symcheck
->unattached_attribs
=FALSE
;
62 s_symcheck
->found_net
= 0;
63 s_symcheck
->found_bus
= 0;
64 s_symcheck
->found_connection
= 0;
65 s_symcheck
->found_footprint
= 0;
66 s_symcheck
->found_refdes
= 0;
68 s_symcheck
->numpins
=0;
69 s_symcheck
->numnetpins
=0;
70 s_symcheck
->numslotpins
=0;
71 s_symcheck
->error_count
=0;
72 s_symcheck
->warning_count
=0;
78 s_symstruct_print(SYMCHECK
*s_current
)
83 if (verbose_mode
> 2) {
84 list
= s_current
->info_messages
;
85 while (list
!= NULL
) {
86 msg
= (char *) list
->data
;
87 /* printf("found info: %s\n", msg); */
89 s_log_message("Info: %s", msg
);
93 list
= g_list_next(list
);
97 if (verbose_mode
> 1) {
98 list
= s_current
->warning_messages
;
99 while (list
!= NULL
) {
100 msg
= (char *) list
->data
;
102 /* printf("found warning: %s\n", msg); */
104 s_log_message("Warning: %s", msg
);
108 list
= g_list_next(list
);
112 if (verbose_mode
> 0) {
113 list
= s_current
->error_messages
;
114 while (list
!= NULL
) {
115 msg
= (char *) list
->data
;
117 /* printf("found error: %s\n", msg); */
118 if (msg
&& verbose_mode
) {
119 s_log_message("ERROR: %s", msg
);
123 list
= g_list_next(list
);
129 s_symstruct_free(SYMCHECK
*s_current
)
133 g_free(s_current
->device_attribute
);