Updated copyright text/header in most source files.
[geda-gaf.git] / gsymcheck / src / s_symstruct.c
blob5c10d8f3c164f2fca17f27e478a24ee46710069a
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->footprint_size = -1;
75 s_symcheck->numpins=0;
76 s_symcheck->numnetpins=0;
77 s_symcheck->numslots=0;
78 s_symcheck->numslotpins=0;
79 s_symcheck->error_count=0;
80 s_symcheck->warning_count=0;
82 s_symcheck->missing_pintype_attrib=FALSE;
83 s_symcheck->multiple_pintype_attrib=FALSE;
84 s_symcheck->duplicate_pintype_attrib=FALSE;
86 return(s_symcheck);
89 void
90 s_symstruct_print(SYMCHECK *s_current)
92 GList *list;
93 char *msg;
95 if (verbose_mode > 2) {
96 list = s_current->info_messages;
97 while (list != NULL) {
98 msg = (char *) list->data;
99 /* printf("found info: %s\n", msg); */
100 if (msg) {
101 s_log_message("Info: %s", msg);
102 g_free(msg);
105 list = list->next;
109 if (verbose_mode > 1) {
110 list = s_current->warning_messages;
111 while (list != NULL) {
112 msg = (char *) list->data;
114 /* printf("found warning: %s\n", msg); */
115 if (msg) {
116 s_log_message("Warning: %s", msg);
117 g_free(msg);
120 list = list->next;
124 if (verbose_mode > 0) {
125 list = s_current->error_messages;
126 while (list != NULL) {
127 msg = (char *) list->data;
129 /* printf("found error: %s\n", msg); */
130 if (msg && verbose_mode) {
131 s_log_message("ERROR: %s", msg);
132 g_free(msg);
135 list = list->next;
140 void
141 s_symstruct_free(SYMCHECK *s_current)
143 if (s_current) {
145 if (s_current->device_attribute) {
146 g_free(s_current->device_attribute);
149 g_free(s_current);