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 #include "tkgate.h"
19 
20 #define TRI_OUT 0
21 
22 iconDimensions inout_iconDims[] = {
23   {0,  8, 13,  7, 7, 3},
24   {24, 0,  7, 13, 3, 7},
25   {0,  8, 13,  7, 7, 3},
26   {24, 0,  7, 13, 3, 7},
27 };
28 int inout_iconBoldOffset = 16;
29 
30 GPadLoc inout_out_loc[] = {
31 	{6,0,6,0,D_RIGHT},
32 	{0,-8,0,-8,D_UP},
33 	{-8,0,-8,0,D_LEFT},
34 	{0,6,0,6,D_DOWN}};
35 
36 static char *psTriio[] = {
37   "/triiogate {",
38   "  startgate",
39   "  0 -3 moveto",
40   "  6 0 lineto",
41   "  0 3 lineto",
42   "  -6 0 lineto",
43   "  closepath",
44   "  stroke",
45   "  grestore",
46   "} bind def",
47   0
48 };
49 
50 struct gateinfo gate_inout_info = {
51   GC_LOGICTRI,
52   "INOUT",
53   "inout",0x0,
54   "triiogate",psTriio,
55   -1,-1,
56 
57   {{"=",	{"gm.mod",2},		{"gm.mod.inout",11,0,400},	"gat_make INOUT"},
58    {0}},
59 
60   inout_iconDims,
61 
62   1,{{"Z",TRI,1,1,inout_out_loc}},
63   {{-10,4,RJ},{0,15,CT},{10,4,LJ},{0,-10,CT}},
64   {1,1,1},
65 
66   {0},
67 
68   InOut_Make,
69   Nop_WriteCellDef,
70   Generic_Init,
71   Generic_Delete,
72   Generic_GetExtents,
73   Generic_HitDistance,
74   InOut_Draw,
75   Generic_Move,
76   Generic_Copy,
77   Err_AddInput,
78   Err_AddOutput,
79   Err_AddInOut,
80   Generic_Rotate,
81   Err_RemovePort,
82   Err_ChangePin,
83   Nop_SimInitFunc,
84   Nop_SimHitFunc,
85   InOut_PSWrite,
86   Generic_EditProps,
87   InOut_VerSave
88 };
89 
init_inout()90 void init_inout()
91 {
92   Pixmap P;
93 
94   P = Pixmap_find("inout");
95   gateinfo_iconInit(&gate_inout_info,P,inout_iconDims,inout_iconBoldOffset);
96 
97   RegisterGate(&gate_inout_info);
98 }
99