Updated copyright date for the new year.
[geda-gaf/whiteaudio.git] / gsymcheck / src / s_symstruct.c
blobda9df115c878ae67d8301e2ab9c20fa3ab6f212f
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., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include <config.h>
23 #include <stdio.h>
24 #ifdef HAVE_UNISTD_H
25 #include <unistd.h>
26 #endif
28 #include <libgeda/libgeda.h>
30 #include "../include/struct.h"
31 #include "../include/globals.h"
32 #include "../include/prototype.h"
34 /* call this for every symbol that needs to be checked */
35 SYMCHECK *
36 s_symstruct_init(void)
38 SYMCHECK *s_symcheck;
40 s_symcheck = (SYMCHECK *) g_malloc(sizeof(SYMCHECK));
42 s_symcheck->info_messages = NULL;
43 s_symcheck->warning_messages = NULL;
44 s_symcheck->error_messages = NULL;
46 s_symcheck->graphical_symbol=FALSE;
47 s_symcheck->missing_device_attrib=FALSE;
48 s_symcheck->device_attribute_incorrect=FALSE;
49 s_symcheck->device_attribute=NULL;
51 s_symcheck->missing_pinseq_attrib=FALSE;
52 s_symcheck->multiple_pinseq_attrib=FALSE;
53 s_symcheck->duplicate_pinseq_attrib=FALSE;
55 s_symcheck->missing_pinnumber_attrib=FALSE;
56 s_symcheck->multiple_pinnumber_attrib=FALSE;
57 s_symcheck->duplicate_pinnumber_attrib=FALSE;
59 s_symcheck->missing_numslots_attrib=FALSE;
60 s_symcheck->slotting_errors=FALSE;
61 s_symcheck->found_oldpin_attrib=FALSE;
62 s_symcheck->found_oldslot_attrib=FALSE;
63 s_symcheck->unattached_attribs=FALSE;
64 s_symcheck->found_net=FALSE;
65 s_symcheck->found_bus=FALSE;
66 s_symcheck->found_connection=FALSE;
67 s_symcheck->found_label=FALSE;
68 s_symcheck->found_uref=FALSE;
69 s_symcheck->found_name=FALSE;
70 s_symcheck->found_type=FALSE;
71 s_symcheck->found_footprint=FALSE;
72 s_symcheck->found_refdes=FALSE;
74 s_symcheck->numpins=0;
75 s_symcheck->numnetpins=0;
76 s_symcheck->numslots=0;
77 s_symcheck->numslotpins=0;
78 s_symcheck->error_count=0;
79 s_symcheck->warning_count=0;
81 s_symcheck->missing_pintype_attrib=FALSE;
82 s_symcheck->multiple_pintype_attrib=FALSE;
83 s_symcheck->duplicate_pintype_attrib=FALSE;
85 return(s_symcheck);
88 void
89 s_symstruct_print(SYMCHECK *s_current)
91 GList *list;
92 char *msg;
94 if (verbose_mode > 2) {
95 list = s_current->info_messages;
96 while (list != NULL) {
97 msg = (char *) list->data;
98 /* printf("found info: %s\n", msg); */
99 if (msg) {
100 s_log_message("Info: %s", msg);
101 g_free(msg);
104 list = g_list_next(list);
108 if (verbose_mode > 1) {
109 list = s_current->warning_messages;
110 while (list != NULL) {
111 msg = (char *) list->data;
113 /* printf("found warning: %s\n", msg); */
114 if (msg) {
115 s_log_message("Warning: %s", msg);
116 g_free(msg);
119 list = g_list_next(list);
123 if (verbose_mode > 0) {
124 list = s_current->error_messages;
125 while (list != NULL) {
126 msg = (char *) list->data;
128 /* printf("found error: %s\n", msg); */
129 if (msg && verbose_mode) {
130 s_log_message("ERROR: %s", msg);
131 g_free(msg);
134 list = g_list_next(list);
139 void
140 s_symstruct_free(SYMCHECK *s_current)
142 if (s_current) {
144 if (s_current->device_attribute) {
145 g_free(s_current->device_attribute);
148 g_free(s_current);