FreeCalypso > hg > ueda-linux
comparison ueda/libuschem/schemstruct.h @ 0:cd92449fdb51
initial import of ueda and ifctf-part-lib from ifctfvax CVS
| author | Space Falcon <falcon@ivan.Harhan.ORG> |
|---|---|
| date | Mon, 20 Jul 2015 00:24:37 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:cd92449fdb51 |
|---|---|
| 1 /* | |
| 2 * data structures representing a schematic in memory | |
| 3 */ | |
| 4 | |
| 5 #define OBJTYPE_SENTINEL 0x00 | |
| 6 #define OBJTYPE_COMPINST 0x01 | |
| 7 #define OBJTYPE_GRAPHSYM 0x02 | |
| 8 #define OBJTYPE_NET 0x03 | |
| 9 #define OBJTYPE_GRAPHNET 0x04 | |
| 10 #define OBJTYPE_NETLINE 0x05 | |
| 11 #define OBJTYPE_BUSSEG 0x06 | |
| 12 #define OBJTYPE_GRAPHBLOCK 0x07 | |
| 13 #define OBJTYPE_COMMENT 0x08 | |
| 14 #define OBJTYPE_MAX 0x08 | |
| 15 | |
| 16 struct schem { | |
| 17 /* the first 3 fields must match struct schemobj to serve as sentinel */ | |
| 18 struct schemobj *obj_next; | |
| 19 struct schemobj *obj_prev; | |
| 20 int obj_type; | |
| 21 /* we're free from here onward */ | |
| 22 char *orig_filename; | |
| 23 int is_graph; | |
| 24 int graph_xsize; | |
| 25 int graph_ysize; | |
| 26 int has_graphblocks; | |
| 27 struct schemobj **compinst_hash; | |
| 28 struct graphsym_pininst **pininst_hash; | |
| 29 }; | |
| 30 | |
| 31 struct schemobj { | |
| 32 struct schemobj *obj_next; | |
| 33 struct schemobj *obj_prev; | |
| 34 int obj_type; | |
| 35 int obj_lineno; | |
| 36 struct decoration *obj_decorations; | |
| 37 /* the rest differs by type */ | |
| 38 union { | |
| 39 struct { /* Component and GraphSym */ | |
| 40 char *instname; | |
| 41 struct component *mclcomp; | |
| 42 int is_graph; | |
| 43 char *graph_symname; | |
| 44 struct graphsym *graphsym; | |
| 45 int x; | |
| 46 int y; | |
| 47 int rotate; | |
| 48 int mirror; | |
| 49 struct schemobj *next_in_hash; | |
| 50 struct graphsym_pininst *pin_instances; | |
| 51 } comp; | |
| 52 struct { /* Net and GraphNet */ | |
| 53 char *netname; | |
| 54 struct netpoint *points; | |
| 55 struct schemobj *grouphead; | |
| 56 int has_forcenet_syms; | |
| 57 } net; | |
| 58 struct { /* NetLine and BusSeg */ | |
| 59 int x1; | |
| 60 int y1; | |
| 61 int x2; | |
| 62 int y2; | |
| 63 } netline; | |
| 64 struct graphblock *graphblock_body; | |
| 65 char *comment_text; | |
| 66 } bytype; | |
| 67 }; | |
| 68 | |
| 69 /* for Component and GraphSym */ | |
| 70 #define compobj_instname bytype.comp.instname | |
| 71 #define compobj_mclcomp bytype.comp.mclcomp | |
| 72 #define compobj_isgraph bytype.comp.is_graph | |
| 73 #define compobj_graph_symname bytype.comp.graph_symname | |
| 74 #define compobj_graphsym bytype.comp.graphsym | |
| 75 #define compobj_x bytype.comp.x | |
| 76 #define compobj_y bytype.comp.y | |
| 77 #define compobj_rotate bytype.comp.rotate | |
| 78 #define compobj_mirror bytype.comp.mirror | |
| 79 #define compobj_nextinhash bytype.comp.next_in_hash | |
| 80 #define compobj_pins bytype.comp.pin_instances | |
| 81 | |
| 82 /* for Net and GraphNet */ | |
| 83 #define netobj_netname bytype.net.netname | |
| 84 #define netobj_points bytype.net.points | |
| 85 #define netobj_grouphead bytype.net.grouphead | |
| 86 #define netobj_forcenets bytype.net.has_forcenet_syms | |
| 87 | |
| 88 /* for NetLine and BusSeg */ | |
| 89 #define lineobj_x1 bytype.netline.x1 | |
| 90 #define lineobj_y1 bytype.netline.y1 | |
| 91 #define lineobj_x2 bytype.netline.x2 | |
| 92 #define lineobj_y2 bytype.netline.y2 | |
| 93 | |
| 94 /* for GraphBlocks and Comments */ | |
| 95 #define graphblockobj_body bytype.graphblock_body | |
| 96 #define commentobj_text bytype.comment_text | |
| 97 | |
| 98 struct netpoint { | |
| 99 struct netpoint *netpt_next; | |
| 100 int netpt_type; | |
| 101 char *netpt_pin_nameref; | |
| 102 int netpt_x; | |
| 103 int netpt_y; | |
| 104 int netpt_coord_valid; | |
| 105 struct schemobj *netpt_tjoin_to; | |
| 106 }; | |
| 107 | |
| 108 #define NETPT_TYPE_POINT 0 | |
| 109 #define NETPT_TYPE_PIN 1 | |
| 110 #define NETPT_TYPE_TJOIN 2 | |
| 111 #define NETPT_TYPE_PSEUDO 3 | |
| 112 | |
| 113 struct decoration { | |
| 114 struct decoration *decor_next; | |
| 115 int decor_type; | |
| 116 int decor_lineno; | |
| 117 /* the rest differs by type */ | |
| 118 union { | |
| 119 struct { | |
| 120 char *name; | |
| 121 char *value; | |
| 122 } attr; | |
| 123 struct { | |
| 124 char *attr; | |
| 125 int x; | |
| 126 int y; | |
| 127 int ptsize; | |
| 128 int rotate; | |
| 129 int alignment; | |
| 130 } display; | |
| 131 struct { | |
| 132 char *pin; | |
| 133 char *netname; | |
| 134 } pintonet; | |
| 135 struct { | |
| 136 char *pin; | |
| 137 char *symname; | |
| 138 struct graphsym *graphsym; | |
| 139 int mirror; | |
| 140 } symonpin; | |
| 141 struct graphblock *graphblock_body; | |
| 142 char *comment_text; | |
| 143 } bytype; | |
| 144 }; | |
| 145 | |
| 146 #define DECOR_TYPE_ATTR 0x01 | |
| 147 #define DECOR_TYPE_DISPLAYATTR 0x02 | |
| 148 #define DECOR_TYPE_DISPLAYNETNAME 0x03 | |
| 149 #define DECOR_TYPE_GRAPHBLOCK 0x04 | |
| 150 #define DECOR_TYPE_COMMENT 0x05 | |
| 151 #define DECOR_TYPE_PINTONET 0x06 | |
| 152 #define DECOR_TYPE_SYMONPIN 0x07 | |
| 153 #define DECOR_TYPE_NOCONNECT 0x08 | |
| 154 | |
| 155 #define decorattr_name bytype.attr.name | |
| 156 #define decorattr_value bytype.attr.value | |
| 157 | |
| 158 #define decordisp_attr bytype.display.attr | |
| 159 #define decordisp_x bytype.display.x | |
| 160 #define decordisp_y bytype.display.y | |
| 161 #define decordisp_ptsize bytype.display.ptsize | |
| 162 #define decordisp_rotate bytype.display.rotate | |
| 163 #define decordisp_alignment bytype.display.alignment | |
| 164 | |
| 165 #define decorpincon_pin bytype.pintonet.pin | |
| 166 #define decorpincon_netname bytype.pintonet.netname | |
| 167 | |
| 168 #define decorpinsym_pin bytype.symonpin.pin | |
| 169 #define decorpinsym_symname bytype.symonpin.symname | |
| 170 #define decorpinsym_gs bytype.symonpin.graphsym | |
| 171 #define decorpinsym_mirror bytype.symonpin.mirror | |
| 172 | |
| 173 #define decorgraph_body bytype.graphblock_body | |
| 174 #define decorcomment_text bytype.comment_text | |
| 175 | |
| 176 struct graphblock { | |
| 177 int type; | |
| 178 off_t offset; | |
| 179 size_t length; | |
| 180 int lineno; | |
| 181 }; | |
| 182 | |
| 183 #define GRAPHBLOCK_TYPE_PS 0 | |
| 184 #define GRAPHBLOCK_TYPE_GSCHEM 1 | |
| 185 | |
| 186 /* | |
| 187 * This doesn't really belong here, but I couldn't find a better place | |
| 188 * for this structure definition: I want to make this table available | |
| 189 * to the writer as well. | |
| 190 */ | |
| 191 | |
| 192 struct drawing_size_kwtab { | |
| 193 char *keyword; | |
| 194 int xdim; | |
| 195 int ydim; | |
| 196 }; |
