FreeCalypso > hg > ueda-linux
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ueda/libuschem/schemstruct.h Mon Jul 20 00:24:37 2015 +0000 @@ -0,0 +1,196 @@ +/* + * data structures representing a schematic in memory + */ + +#define OBJTYPE_SENTINEL 0x00 +#define OBJTYPE_COMPINST 0x01 +#define OBJTYPE_GRAPHSYM 0x02 +#define OBJTYPE_NET 0x03 +#define OBJTYPE_GRAPHNET 0x04 +#define OBJTYPE_NETLINE 0x05 +#define OBJTYPE_BUSSEG 0x06 +#define OBJTYPE_GRAPHBLOCK 0x07 +#define OBJTYPE_COMMENT 0x08 +#define OBJTYPE_MAX 0x08 + +struct schem { + /* the first 3 fields must match struct schemobj to serve as sentinel */ + struct schemobj *obj_next; + struct schemobj *obj_prev; + int obj_type; + /* we're free from here onward */ + char *orig_filename; + int is_graph; + int graph_xsize; + int graph_ysize; + int has_graphblocks; + struct schemobj **compinst_hash; + struct graphsym_pininst **pininst_hash; +}; + +struct schemobj { + struct schemobj *obj_next; + struct schemobj *obj_prev; + int obj_type; + int obj_lineno; + struct decoration *obj_decorations; + /* the rest differs by type */ + union { + struct { /* Component and GraphSym */ + char *instname; + struct component *mclcomp; + int is_graph; + char *graph_symname; + struct graphsym *graphsym; + int x; + int y; + int rotate; + int mirror; + struct schemobj *next_in_hash; + struct graphsym_pininst *pin_instances; + } comp; + struct { /* Net and GraphNet */ + char *netname; + struct netpoint *points; + struct schemobj *grouphead; + int has_forcenet_syms; + } net; + struct { /* NetLine and BusSeg */ + int x1; + int y1; + int x2; + int y2; + } netline; + struct graphblock *graphblock_body; + char *comment_text; + } bytype; +}; + +/* for Component and GraphSym */ +#define compobj_instname bytype.comp.instname +#define compobj_mclcomp bytype.comp.mclcomp +#define compobj_isgraph bytype.comp.is_graph +#define compobj_graph_symname bytype.comp.graph_symname +#define compobj_graphsym bytype.comp.graphsym +#define compobj_x bytype.comp.x +#define compobj_y bytype.comp.y +#define compobj_rotate bytype.comp.rotate +#define compobj_mirror bytype.comp.mirror +#define compobj_nextinhash bytype.comp.next_in_hash +#define compobj_pins bytype.comp.pin_instances + +/* for Net and GraphNet */ +#define netobj_netname bytype.net.netname +#define netobj_points bytype.net.points +#define netobj_grouphead bytype.net.grouphead +#define netobj_forcenets bytype.net.has_forcenet_syms + +/* for NetLine and BusSeg */ +#define lineobj_x1 bytype.netline.x1 +#define lineobj_y1 bytype.netline.y1 +#define lineobj_x2 bytype.netline.x2 +#define lineobj_y2 bytype.netline.y2 + +/* for GraphBlocks and Comments */ +#define graphblockobj_body bytype.graphblock_body +#define commentobj_text bytype.comment_text + +struct netpoint { + struct netpoint *netpt_next; + int netpt_type; + char *netpt_pin_nameref; + int netpt_x; + int netpt_y; + int netpt_coord_valid; + struct schemobj *netpt_tjoin_to; +}; + +#define NETPT_TYPE_POINT 0 +#define NETPT_TYPE_PIN 1 +#define NETPT_TYPE_TJOIN 2 +#define NETPT_TYPE_PSEUDO 3 + +struct decoration { + struct decoration *decor_next; + int decor_type; + int decor_lineno; + /* the rest differs by type */ + union { + struct { + char *name; + char *value; + } attr; + struct { + char *attr; + int x; + int y; + int ptsize; + int rotate; + int alignment; + } display; + struct { + char *pin; + char *netname; + } pintonet; + struct { + char *pin; + char *symname; + struct graphsym *graphsym; + int mirror; + } symonpin; + struct graphblock *graphblock_body; + char *comment_text; + } bytype; +}; + +#define DECOR_TYPE_ATTR 0x01 +#define DECOR_TYPE_DISPLAYATTR 0x02 +#define DECOR_TYPE_DISPLAYNETNAME 0x03 +#define DECOR_TYPE_GRAPHBLOCK 0x04 +#define DECOR_TYPE_COMMENT 0x05 +#define DECOR_TYPE_PINTONET 0x06 +#define DECOR_TYPE_SYMONPIN 0x07 +#define DECOR_TYPE_NOCONNECT 0x08 + +#define decorattr_name bytype.attr.name +#define decorattr_value bytype.attr.value + +#define decordisp_attr bytype.display.attr +#define decordisp_x bytype.display.x +#define decordisp_y bytype.display.y +#define decordisp_ptsize bytype.display.ptsize +#define decordisp_rotate bytype.display.rotate +#define decordisp_alignment bytype.display.alignment + +#define decorpincon_pin bytype.pintonet.pin +#define decorpincon_netname bytype.pintonet.netname + +#define decorpinsym_pin bytype.symonpin.pin +#define decorpinsym_symname bytype.symonpin.symname +#define decorpinsym_gs bytype.symonpin.graphsym +#define decorpinsym_mirror bytype.symonpin.mirror + +#define decorgraph_body bytype.graphblock_body +#define decorcomment_text bytype.comment_text + +struct graphblock { + int type; + off_t offset; + size_t length; + int lineno; +}; + +#define GRAPHBLOCK_TYPE_PS 0 +#define GRAPHBLOCK_TYPE_GSCHEM 1 + +/* + * This doesn't really belong here, but I couldn't find a better place + * for this structure definition: I want to make this table available + * to the writer as well. + */ + +struct drawing_size_kwtab { + char *keyword; + int xdim; + int ydim; +};