Updated copyright text/header in most source files.
[geda-gaf/peter-b.git] / gattrib / include / struct.h
blob904b13a967e55be62f0b26c4ae1ce18825892d10
1 /* gEDA - GPL Electronic Design Automation
2 * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
3 * Copyright (C) 2003-2010 Stuart D. Brorson.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
20 /* ----------------------------------------------------------------- */
21 /*! \file
22 * \brief Definitions of structures used in gattrib
24 * This file holds definitions of the structures used in gattrib.
26 /* ----------------------------------------------------------------- */
29 #ifndef SHEET_DATA_STRUCT
30 #define SHEET_DATA_STRUCT
32 #include <gtk/gtk.h>
33 #include <gdk/gdk.h>
34 #include <gdk/gdkkeysyms.h>
36 #include <glib.h>
37 #include <glib-object.h>
39 /* ------- Includes needed to make the GTK stuff work ------ */
41 #include "gtksheet_2_2.h"
44 /* ======== Data structures used in processing below here ========== */
47 /* ----------------------------------------------------------------- *
48 * The sheet data hierarchy built by the prog should look like this:
49 * SHEET_DATA->(STRING_LIST *master_XXX_list) // list of comps/nets/pins (row labels)
50 * ->(STRING_LIST *master_XXX_attrib_list) // list of attached names (column labels)
51 * ->(TABLE *XXX_table) // table of attrib values (table entries)
52 * ----------------------------------------------------------------- */
53 typedef struct st_sheet_data SHEET_DATA;
54 typedef struct st_table TABLE;
55 typedef struct st_string_list STRING_LIST;
56 typedef struct st_pin_list PIN_LIST;
57 typedef struct st_main_window MAIN_WINDOW;
60 /* -------------------------------------------------------------------- */
61 /*! \brief Sheet data structure
63 * st_sheet_data defines SHEET_DATA, and holds master lists holding
64 * sorted lists of comp/netlist names. Also holds pointers to the heads
65 * of the attribute-holding component and net structures.
67 /* -------------------------------------------------------------------- */
68 struct st_sheet_data {
69 STRING_LIST *master_comp_list_head; /*!< Sorted list of all component refdeses used in design */
70 STRING_LIST *master_comp_attrib_list_head; /*!< Sorted list of all component attribs used in design */
71 int comp_count; /*!< This cannnot change -- user must edit design using gschem */
72 int comp_attrib_count; /*!< This can change in this prog if the user adds attribs */
74 STRING_LIST *master_net_list_head; /*!< Sorted list of all net names used in design */
75 STRING_LIST *master_net_attrib_list_head; /*!< Sorted list of all net attribs used in design */
76 int net_count; /*!< This cannnot change -- user must edit design using gschem */
77 int net_attrib_count; /*!< This can change in this prog if the user adds attribs */
79 STRING_LIST *master_pin_list_head; /*!< Sorted list of all refdes:pin items used in design. */
80 STRING_LIST *master_pin_attrib_list_head; /*!< Sorted list of all pin attribs used in design */
81 int pin_count; /*!< This cannnot change -- user must edit design using gschem */
82 int pin_attrib_count; /*!< This can change in this prog if the user adds attribs */
85 TABLE **component_table; /*!< points to 2d array of component attribs */
86 TABLE **net_table; /*!< points to 2d array of net attribs */
87 TABLE **pin_table; /*!< points to 2d array of pin attribs */
89 int CHANGED; /*!< for "file not saved" warning upon exit */
94 /* -------------------------------------------------------------------- */
95 /* \brief Table cell struct
97 * st_table defined what is held in a spreadsheet cell for both
98 * comp and net spreadsheets. Holds pointer to individual comp/net name, and
99 * pointer to attrib list. Ideally, the name pointer points to the
100 * refdes/netname string held in the TOPLEVEL data structure, so that
101 * when SHEET_DATA is manipulated, so is TOPLEVEL.
103 /* -------------------------------------------------------------------- */
104 struct st_table {
105 int row; /*!< location on spreadsheet */
106 int col; /*!< location on spreadsheet */
107 gchar *row_name; /*!< comp, net, or refdes:pin name */
108 gchar *col_name; /*!< attrib name */
109 gchar *attrib_value; /*!< attrib value */
110 gint visibility;
111 gint show_name_value;
116 /* -------------------------------------------------------------------- */
117 /*! \brief A list of strings.
119 * STRING_LIST is a doubly-linked list of strings. This struct is
120 * used for several different jobs, including serving as base class
121 * for master lists.
123 * \todo Consider replacing with a GList-based implementation
125 /* -------------------------------------------------------------------- */
126 struct st_string_list {
127 gchar *data; /*!< points to zero-terminated string */
128 int pos; /*!< position on spreadsheet */
129 int length; /*!< number of items in list */
130 STRING_LIST *prev; /*!< pointer to previous item in linked list */
131 STRING_LIST *next; /*!< pointer to next item in linked list */
134 /* -------------------------------------------------------------------- */
135 /*! \brief A list of pins
137 * PIN_LIST is a special struct used for keeping track of pins. Since
138 * the master_pin_list must keep track of both refdes and pin, we need a
139 * special struct for pins. Later processing will for a STRING_LIST
140 * of refdes:pinnumber pairs for insertion in the spreadsheet.
142 * \todo Is this still in use? Consider replacing with a GList-based
143 * implementation.
145 /* -------------------------------------------------------------------- */
146 struct st_pin_list {
147 gchar *refdes; /*!< holds refdes string */
148 gint pinnumber;
149 gchar *pinlabel; /*!< holds pin label string */
150 int pos; /*!< pos on spreadsheet */
151 int length; /*!< number of items in list */
152 PIN_LIST *prev;
153 PIN_LIST *next;
156 #endif // #ifndef SHEET_DATA_STRUCT