1 /****************************************************************************
2 This file is part of TkGate digital circuit editor and simulator
3 Copyright (C) 1987-2015 by Jeffery P. Hansen
4 Copyright (C) 2015-2018 by Andrey V. Skvortsov
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 ****************************************************************************/
20 #include "tkgate.h"
21
22 static iconDimensions pullup_iconDims[] = {
23 /* x y w h ox oy*/
24 {0, 0, 35, 38, 19, 4},
25 {38, 0, 38, 35, 4, 15},
26 {77, 0, 35, 38, 15, 33},
27 {113,0, 38, 35, 33, 19},
28 };
29 static int pullup_iconBoldOffset = 40;
30
31 GPadLoc pullup_out_loc[] = {
32 {-11, 34, -11, 34, D_DOWN},
33 {34, 11, 34, 11, D_RIGHT},
34 {11, -34,11, -34, D_UP},
35 {-34, -11,-34, -11, D_LEFT}
36 };
37
38 static char *psPullup[] = {
39 "%",
40 "% x y r pullup",
41 "%",
42 "/pspullup {",
43 " startgate",
44 " -19 0 moveto -3 0 lineto stroke",
45 " 10 rfont",
46 " -1 -4 moveto (V) show",
47 " 8 rfont",
48 " 0 -3 rmoveto (dd) show",
49 " -11 0 moveto -11 -8 lineto",
50 " -6 -10 lineto",
51 " -16 -14 lineto",
52 " -6 -18 lineto",
53 " -16 -22 lineto",
54 " -6 -26 lineto",
55 " -16 -30 lineto",
56 " -11 -32 lineto",
57 " -11 -34 lineto stroke",
58 " grestore",
59 "} def",
60 0
61 };
62
63 GGateInfo gate_pullup_info = {
64 0, /* code */
65 "PULLUP", /* name */
66 "tri1", /* vnames */
67 0x0, /* vmask */
68 "pspullup", /* psprint */
69 psPullup, /* psdef */
70 -1 /* gi_multipad */,
71 -1, /* gi_bitpad */
72 {
73 {"v", /* key_seq */
74 {"gm.signals",0}, /* root */
75 {"gm.signals.pullup",0,0,400}, /* entry */
76 "gat_make PULLUP"}, /* cmds[0] */
77 {0} /* cmds[1] */
78 }, /* cmds */
79 pullup_iconDims, /* dim */
80 1, /* NumPads */
81 {
82 {"Z", /* name */
83 OUT, /* iotype */
84 1, /* size */
85 1, /* num */
86 pullup_out_loc
87 } /* Pad[0] */
88 }, /* Pad */
89 { /* x y just */
90 { 5, 15, LJ}, /* lpos[0] */
91 { 5, 15, LJ}, /* lpos[1] */
92 { 5, 15, LJ}, /* lpos[2] */
93 { 5, 15, LJ} /* lpos[3] */
94 }, /* lpos */
95 /* CanRot NoInvert IsIONet */
96 { 1, 1, 1},/* flags */
97 {0}, /* delayNames */
98 Generic_Make, /* MakeFunction */
99 Nop_WriteCellDef, /* WriteCellDef */
100 Generic_Init, /* InitGate */
101 Generic_Delete, /* DeleteGate */
102 Generic_GetExtents, /* GetExtents */
103 Generic_HitDistance, /* HitDistance */
104 Generic_Draw, /* DrawGate */
105 Generic_Move, /* MoveGate */
106 Generic_Copy, /* CopyGate */
107 Err_AddInput, /* AddInput */
108 Err_AddOutput,
109 Err_AddInOut,
110 Generic_Rotate,
111 Err_RemovePort,
112 Err_ChangePin,
113 Nop_SimInitFunc,
114 Nop_SimHitFunc,
115 Generic_PSWrite,
116 Generic_EditProps,
117 InOut_VerSave
118 };
119
init_pullup()120 void init_pullup()
121 {
122 Pixmap P;
123
124 P = Pixmap_registerFromFile("pullup","pullup.b");
125 gateinfo_iconInit(&gate_pullup_info,P,pullup_iconDims,pullup_iconBoldOffset);
126 RegisterGate(&gate_pullup_info);
127 }
128