1 /****************************************************************************
2     Copyright (C) 1987-2015 by Jeffery P. Hansen
3 
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8 
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13 
14     You should have received a copy of the GNU General Public License along
15     with this program; if not, write to the Free Software Foundation, Inc.,
16     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 ****************************************************************************/
18 /*
19     Generic functions for gates.
20 */
21 #ifndef __generic_h
22 #define __generic_h
23 
24 const char *seekOption(const char*,const char**,int);
25 
26 GCElement *Generic_Make(EditState **es,GModuleDef *env,int GType,
27 			int x,int y,int r,const char *Name,int noWires,const char**,int);
28 void Generic_Init(GCElement*);
29 void Generic_Delete(GCElement*,GModuleDef*,int);
30 void Generic_GetExtents(GCElement *g,TargetDev_e target,int *minx,int *miny,int *maxx,int *maxy,int *bd);
31 int Generic_HitDistance(GCElement*g,int,int);
32 void Generic_Draw(GCElement *g,int md);
33 void Generic_Move(GCElement*,int,int);
34 GCElement *Generic_Copy(GModuleDef*,GCElement*,int,int,unsigned);
35 void Generic_AddInput(EditState*,GCElement*);
36 void Generic_AddOutput(EditState*,GCElement*);
37 void Generic_RemovePort(EditState *es,GCElement *g,GWire *w);
38 void Generic_PSWrite(GPrint*,GModLayout*,GCElement*);
39 int Generic_EditProps(GCElement*,int isStore);
40 void Generic_VerSave(FILE*,GCElement*);
41 void Generic_Rotate(GCElement *g, int x,int y,int rdir);
42 GWireNode *Generic_wireSnap(GCElement *g,GWire *w,int *mod,int retry);
43 
44 void Generic_editPropsULBasics(GCElement *g);
45 void Generic_editPropsDLBasics(GCElement *g);
46 void Generic_editPropsULDelay(GCElement *g);
47 void Generic_editPropsDLDelay(GCElement *g);
48 void Generic_editPropsULWires(GCElement *g);
49 void Generic_editPropsDLWires(GCElement *g);
50 
51 void Generic_DrawGateLabel(GPrint *P,GCElement *g,const char *text);
52 void Generic_PSLabels(GPrint *P,GCElement *g);
53 void Generic_WriteCellDef(FILE *f,GCellSpec *gcs);
54 
55 void Err_AddInput(EditState*,GCElement*);
56 void Err_AddOutput(EditState*,GCElement*);
57 void Err_AddInOut(EditState*,GCElement*);
58 void Err_ChangePin(EditState*,GCElement*);
59 void Err_RemovePort(EditState *es,GCElement *g,GWire *w);
60 
61 GCElement *Nop_Copy(EditState *es,GCElement *g,int x,int y,unsigned flags);
62 void Nop_SimInitFunc(EditState*,GCElement*,const char*);
63 int Nop_SimHitFunc(EditState*,GCElement*);
64 int Nop_VerSave(FILE*,GCElement*);
65 void Nop_WriteCellDef(FILE *f,GCellSpec *gcs);
66 
67 GCElement *InOut_Make(EditState **es,GModuleDef *env,int GType,
68 		      int x,int y,int r,const char *Name,int noWire,const char**,int);
69 void InOut_Draw(GCElement*,int);
70 void InOut_VerSave(FILE *f,GCElement *g);
71 void InOut_PSWrite(GPrint *P,GModLayout *L,GCElement *g);
72 
73 #endif
74 
75