File: struct.h

package info (click to toggle)
geda-gattrib 20061020-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,412 kB
  • ctags: 1,013
  • sloc: ansic: 15,545; sh: 3,549; makefile: 110
file content (151 lines) | stat: -rw-r--r-- 6,517 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* gEDA - GPL Electronic Design Automation
 * gattrib -- gEDA component and net attribute manipulation using spreadsheet.
 * Copyright (C) 2003 Stuart D. Brorson.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
 */

/* ----------------------------------------------------------------- *
 *  This file holds definitions of the structures used in gattrib.
 * ----------------------------------------------------------------- */


#ifndef SHEET_DATA_STRUCT
#define SHEET_DATA_STRUCT

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>

#include <glib.h>
#include <glib-object.h>

/* -------  Includes needed to make the GTK stuff work  ------ */

#include "gtksheet_2_2.h"
#include "gtkitementry_2_2.h"

/* #include "pixmaps.h" */

/* ========  Data structures used in processing below here  ========== */


/* ----------------------------------------------------------------- *
 *  This struct used in dealing with guile's read-in of the rc files.
 * ----------------------------------------------------------------- */
typedef struct {
  int m_val;
  char *m_str;
} vstbl_entry;


/* ----------------------------------------------------------------- *
 *  The sheet data hierarchy built by the prog should look like this:
 *  SHEET_DATA->(STRING_LIST *master_XXX_list)          // list of comps/nets/pins (row labels) 
 *            ->(STRING_LIST *master_XXX_attrib_list)   // list of attached names  (column labels)
 *            ->(TABLE *XXX_table)                      // table of attrib values (table entries)
 * ----------------------------------------------------------------- */
typedef struct st_sheet_data SHEET_DATA;
typedef struct st_table TABLE;
typedef struct st_string_list STRING_LIST;
typedef struct st_pin_list PIN_LIST;
typedef struct st_main_window MAIN_WINDOW;


/* -------------------------------------------------------------------- *
 * st_sheet_data defines SHEET_DATA, and holds master lists holding
 * sorted lists of comp/netlist names.  Also holds pointers to the heads
 * of the attribute-holding component and net structures.
 * -------------------------------------------------------------------- */
struct st_sheet_data {
  STRING_LIST *master_comp_list_head;         /* Sorted list of all component refdeses used in design */
  STRING_LIST *master_comp_attrib_list_head;  /* Sorted list of all component attribs used in design */
  int comp_count;                             /* This cannnot change -- user must edit design using gschem */
  int comp_attrib_count;                      /* This can change in this prog if the user adds attribs */

  STRING_LIST *master_net_list_head;          /* Sorted list of all net names used in design */
  STRING_LIST *master_net_attrib_list_head;   /* Sorted list of all net attribs used in design */
  int net_count;                              /* This cannnot change -- user must edit design using gschem */
  int net_attrib_count;                       /* This can change in this prog if the user adds attribs */

  STRING_LIST *master_pin_list_head;          /* Sorted list of all refdes:pin items used in design.   */
  STRING_LIST *master_pin_attrib_list_head;   /* Sorted list of all pin attribs used in design */
  int pin_count;                              /* This cannnot change -- user must edit design using gschem */
  int pin_attrib_count;                       /* This can change in this prog if the user adds attribs */


  TABLE **component_table;                    /* points to 2d array of component attribs */
  TABLE **net_table;                          /* points to 2d array of net attribs */
  TABLE **pin_table;                          /* points to 2d array of pin attribs */

  int CHANGED;                                /* for "file not saved" warning upon exit */
};



/* -------------------------------------------------------------------- *
 * st_table defined what is held in a spreadsheet cell for both 
 * comp and net spreadsheets.  Holds pointer to individual comp/net name, and 
 * pointer to attrib list.  Ideally, the name pointer points to the 
 * refdes/netname string held in the TOPLEVEL data structure, so that 
 * when SHEET_DATA is manipulated, so is TOPLEVEL.
 * -------------------------------------------------------------------- */
struct st_table {
  int row;                       /* location on spreadsheet */
  int col;                       /* location on spreadsheet */
  gchar *row_name;               /* comp, net, or refdes:pin name */
  gchar *col_name;               /* attrib name */
  gchar *attrib_value;           /* attrib value */
  gint visibility;
  gint show_name_value;

};


/* -------------------------------------------------------------------- *
 * STRING_LIST is a list of strings.  This struct is used for several 
 * different jobs, including serving as base class for master lists.
 * -------------------------------------------------------------------- */
struct st_string_list {
  gchar *data;      /* holds string */
  int pos;         /* pos on spreadsheet */
  int length;      /* number of items in list */
  STRING_LIST *prev;
  STRING_LIST *next;
};

/* -------------------------------------------------------------------- *
 * PIN_LIST is a special struct used for keeping track of pins.  Since
 * the master_pin_list must keep track of both refdes and pin, we need a 
 * special struct for pins.  Later processing will for a STRING_LIST 
 * of refdes:pinnumber pairs for insertion in the spreadsheet.
 * -------------------------------------------------------------------- */
struct st_pin_list {
  gchar *refdes;       /* holds refdes string */
  gint pinnumber;
  gchar *pinlabel;     /* holds pin label string */
  int pos;             /* pos on spreadsheet */
  int length;          /* number of items in list */
  PIN_LIST *prev;
  PIN_LIST *next;
};

#endif