gsymcheck

s_symstruct.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * gsymcheck - gEDA Symbol Check 
00003  * Copyright (C) 1998-2010 Ales Hvezda
00004  * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00019  * MA 02111-1301 USA.
00020  */
00021 
00022 #include <config.h>
00023 
00024 #include <stdio.h>
00025 #ifdef HAVE_UNISTD_H
00026 #include <unistd.h>
00027 #endif
00028 
00029 #include <libgeda/libgeda.h>
00030 
00031 #include "../include/struct.h"
00032 #include "../include/globals.h"
00033 #include "../include/prototype.h"
00034 
00035 /* call this for every symbol that needs to be checked */
00036 SYMCHECK *
00037 s_symstruct_init(void)
00038 {
00039   SYMCHECK *s_symcheck;
00040     
00041   s_symcheck = (SYMCHECK *) g_malloc(sizeof(SYMCHECK));
00042 
00043   s_symcheck->info_messages = NULL;
00044   s_symcheck->warning_messages = NULL;
00045   s_symcheck->error_messages = NULL;
00046 
00047   s_symcheck->graphical_symbol=FALSE;
00048   s_symcheck->missing_device_attrib=FALSE;
00049   s_symcheck->device_attribute_incorrect=FALSE;
00050   s_symcheck->device_attribute=NULL;
00051 
00052   s_symcheck->missing_pinseq_attrib=FALSE;
00053   s_symcheck->multiple_pinseq_attrib=FALSE;
00054   s_symcheck->duplicate_pinseq_attrib=FALSE;
00055 
00056   s_symcheck->missing_pinnumber_attrib=FALSE;
00057   s_symcheck->multiple_pinnumber_attrib=FALSE;
00058   s_symcheck->duplicate_pinnumber_attrib=FALSE;
00059 
00060   s_symcheck->missing_numslots_attrib=FALSE;
00061   s_symcheck->slotting_errors=FALSE;
00062   s_symcheck->found_oldpin_attrib=FALSE;
00063   s_symcheck->found_oldslot_attrib=FALSE;
00064   s_symcheck->unattached_attribs=FALSE;
00065   s_symcheck->found_net=FALSE;
00066   s_symcheck->found_bus=FALSE;
00067   s_symcheck->found_connection=FALSE;
00068   s_symcheck->found_footprint=FALSE;
00069   s_symcheck->found_refdes=FALSE;
00070 
00071   s_symcheck->numpins=0;
00072   s_symcheck->numnetpins=0;
00073   s_symcheck->numslots=0;
00074   s_symcheck->numslotpins=0;
00075   s_symcheck->error_count=0;
00076   s_symcheck->warning_count=0;
00077 
00078   s_symcheck->missing_pintype_attrib=FALSE;
00079   s_symcheck->multiple_pintype_attrib=FALSE;
00080   s_symcheck->duplicate_pintype_attrib=FALSE;
00081 
00082   return(s_symcheck);
00083 }
00084 
00085 void
00086 s_symstruct_print(SYMCHECK *s_current)
00087 {
00088   GList *list;
00089   char *msg;
00090 
00091   if (verbose_mode > 2) {
00092     list = s_current->info_messages;
00093     while (list != NULL) {
00094       msg = (char *) list->data;     
00095       /* printf("found info: %s\n", msg); */
00096       if (msg) { 
00097         s_log_message("Info: %s", msg);
00098         g_free(msg);
00099       }
00100 
00101       list = g_list_next(list);
00102     }
00103   }
00104 
00105   if (verbose_mode > 1) {
00106     list = s_current->warning_messages;
00107     while (list != NULL) {
00108       msg = (char *) list->data;     
00109      
00110       /* printf("found warning: %s\n", msg); */
00111       if (msg) { 
00112         s_log_message("Warning: %s", msg);
00113         g_free(msg);
00114       }
00115 
00116       list = g_list_next(list);
00117     }
00118   }
00119 
00120   if (verbose_mode > 0) {
00121     list = s_current->error_messages;
00122     while (list != NULL) {
00123       msg = (char *) list->data;     
00124      
00125       /* printf("found error: %s\n", msg); */
00126       if (msg && verbose_mode) { 
00127         s_log_message("ERROR: %s", msg);
00128         g_free(msg);
00129       }
00130 
00131       list = g_list_next(list);
00132     }
00133   }
00134 }
00135 
00136 void
00137 s_symstruct_free(SYMCHECK *s_current)
00138 {
00139   if (s_current) {
00140 
00141     g_free(s_current->device_attribute);
00142 
00143     g_free(s_current);
00144   }
00145 }
 All Data Structures Files Functions Variables Typedefs Defines