1 /* gEDA - GPL Electronic Design Automation
2 * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
3 * Copyright (C) 2003 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 * This file holds definitions of the structures used in gattrib.
22 * ----------------------------------------------------------------- */
25 #ifndef SHEET_DATA_STRUCT
26 #define SHEET_DATA_STRUCT
30 #include <gdk/gdkkeysyms.h>
33 #include <glib-object.h>
35 /* ------- Includes needed to make the GTK stuff work ------ */
37 #include "gtksheet_2_2.h"
38 #include "gtkitementry_2_2.h"
41 /* ======== Data structures used in processing below here ========== */
44 /* ----------------------------------------------------------------- *
45 * The sheet data hierarchy built by the prog should look like this:
46 * SHEET_DATA->(STRING_LIST *master_XXX_list) // list of comps/nets/pins (row labels)
47 * ->(STRING_LIST *master_XXX_attrib_list) // list of attached names (column labels)
48 * ->(TABLE *XXX_table) // table of attrib values (table entries)
49 * ----------------------------------------------------------------- */
50 typedef struct st_sheet_data SHEET_DATA
;
51 typedef struct st_table TABLE
;
52 typedef struct st_string_list STRING_LIST
;
53 typedef struct st_pin_list PIN_LIST
;
54 typedef struct st_main_window MAIN_WINDOW
;
57 /* -------------------------------------------------------------------- *
58 * st_sheet_data defines SHEET_DATA, and holds master lists holding
59 * sorted lists of comp/netlist names. Also holds pointers to the heads
60 * of the attribute-holding component and net structures.
61 * -------------------------------------------------------------------- */
62 struct st_sheet_data
{
63 STRING_LIST
*master_comp_list_head
; /* Sorted list of all component refdeses used in design */
64 STRING_LIST
*master_comp_attrib_list_head
; /* Sorted list of all component attribs used in design */
65 int comp_count
; /* This cannnot change -- user must edit design using gschem */
66 int comp_attrib_count
; /* This can change in this prog if the user adds attribs */
68 STRING_LIST
*master_net_list_head
; /* Sorted list of all net names used in design */
69 STRING_LIST
*master_net_attrib_list_head
; /* Sorted list of all net attribs used in design */
70 int net_count
; /* This cannnot change -- user must edit design using gschem */
71 int net_attrib_count
; /* This can change in this prog if the user adds attribs */
73 STRING_LIST
*master_pin_list_head
; /* Sorted list of all refdes:pin items used in design. */
74 STRING_LIST
*master_pin_attrib_list_head
; /* Sorted list of all pin attribs used in design */
75 int pin_count
; /* This cannnot change -- user must edit design using gschem */
76 int pin_attrib_count
; /* This can change in this prog if the user adds attribs */
79 TABLE
**component_table
; /* points to 2d array of component attribs */
80 TABLE
**net_table
; /* points to 2d array of net attribs */
81 TABLE
**pin_table
; /* points to 2d array of pin attribs */
83 int CHANGED
; /* for "file not saved" warning upon exit */
88 /* -------------------------------------------------------------------- *
89 * st_table defined what is held in a spreadsheet cell for both
90 * comp and net spreadsheets. Holds pointer to individual comp/net name, and
91 * pointer to attrib list. Ideally, the name pointer points to the
92 * refdes/netname string held in the TOPLEVEL data structure, so that
93 * when SHEET_DATA is manipulated, so is TOPLEVEL.
94 * -------------------------------------------------------------------- */
96 int row
; /* location on spreadsheet */
97 int col
; /* location on spreadsheet */
98 gchar
*row_name
; /* comp, net, or refdes:pin name */
99 gchar
*col_name
; /* attrib name */
100 gchar
*attrib_value
; /* attrib value */
102 gint show_name_value
;
107 /* -------------------------------------------------------------------- *
108 * STRING_LIST is a list of strings. This struct is used for several
109 * different jobs, including serving as base class for master lists.
110 * -------------------------------------------------------------------- */
111 struct st_string_list
{
112 gchar
*data
; /* holds string */
113 int pos
; /* pos on spreadsheet */
114 int length
; /* number of items in list */
119 /* -------------------------------------------------------------------- *
120 * PIN_LIST is a special struct used for keeping track of pins. Since
121 * the master_pin_list must keep track of both refdes and pin, we need a
122 * special struct for pins. Later processing will for a STRING_LIST
123 * of refdes:pinnumber pairs for insertion in the spreadsheet.
124 * -------------------------------------------------------------------- */
126 gchar
*refdes
; /* holds refdes string */
128 gchar
*pinlabel
; /* holds pin label string */
129 int pos
; /* pos on spreadsheet */
130 int length
; /* number of items in list */