comparison xrogue/daemon.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents cadff8f047a1
children b67b99f6c92b
comparison
equal deleted inserted replaced
219:f9ef86cf22b2 220:f54901b9c39b
39 /* 39 /*
40 * d_slot: 40 * d_slot:
41 * Find an empty slot in the daemon list 41 * Find an empty slot in the daemon list
42 */ 42 */
43 struct delayed_action * 43 struct delayed_action *
44 d_slot() 44 d_slot(void)
45 { 45 {
46 reg int i; 46 reg int i;
47 reg struct delayed_action *dev; 47 reg struct delayed_action *dev;
48 48
49 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) 49 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++)
55 /* 55 /*
56 * f_slot: 56 * f_slot:
57 * Find an empty slot in the fuses list 57 * Find an empty slot in the fuses list
58 */ 58 */
59 struct delayed_action * 59 struct delayed_action *
60 f_slot() 60 f_slot(void)
61 { 61 {
62 reg int i; 62 reg int i;
63 reg struct delayed_action *dev; 63 reg struct delayed_action *dev;
64 64
65 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) 65 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++)
72 * find_slot: 72 * find_slot:
73 * Find a particular slot in the table 73 * Find a particular slot in the table
74 */ 74 */
75 75
76 struct delayed_action * 76 struct delayed_action *
77 find_slot(func) 77 find_slot(int (*func)())
78 reg int (*func)();
79 { 78 {
80 reg int i; 79 reg int i;
81 reg struct delayed_action *dev; 80 reg struct delayed_action *dev;
82 81
83 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) 82 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++)
89 /* 88 /*
90 * start_daemon: 89 * start_daemon:
91 * Start a daemon, takes a function. 90 * Start a daemon, takes a function.
92 */ 91 */
93 92
94 start_daemon(dfunc, arg, type) 93 void
95 reg VOID *arg; 94 start_daemon(int (*dfunc)(), VOID *arg, int type)
96 reg int type, (*dfunc)();
97 { 95 {
98 reg struct delayed_action *dev; 96 reg struct delayed_action *dev;
99 97
100 dev = d_slot(); 98 dev = d_slot();
101 if (dev != NULL) { 99 if (dev != NULL) {
110 /* 108 /*
111 * kill_daemon: 109 * kill_daemon:
112 * Remove a daemon from the list 110 * Remove a daemon from the list
113 */ 111 */
114 112
115 kill_daemon(dfunc) 113 void
116 reg int (*dfunc)(); 114 kill_daemon(int (*dfunc)())
117 { 115 {
118 reg struct delayed_action *dev; 116 reg struct delayed_action *dev;
119 reg int i; 117 reg int i;
120 118
121 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) { 119 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) {
138 * do_daemons: 136 * do_daemons:
139 * Run all the daemons that are active with the current flag, 137 * Run all the daemons that are active with the current flag,
140 * passing the argument to the function. 138 * passing the argument to the function.
141 */ 139 */
142 140
143 do_daemons(flag) 141 void
144 reg int flag; 142 do_daemons(int flag)
145 { 143 {
146 struct delayed_action *dev; 144 struct delayed_action *dev;
147 int i; 145 int i;
148 146
149 /* 147 /*
163 /* 161 /*
164 * fuse: 162 * fuse:
165 * Start a fuse to go off in a certain number of turns 163 * Start a fuse to go off in a certain number of turns
166 */ 164 */
167 165
168 fuse(dfunc, arg, time, type) 166 void
169 VOID *arg; 167 fuse(int (*dfunc)(), VOID *arg, int time, int type)
170 reg int (*dfunc)(), time, type;
171 { 168 {
172 reg struct delayed_action *wire; 169 reg struct delayed_action *wire;
173 170
174 wire = f_slot(); 171 wire = f_slot();
175 if (wire != NULL) { 172 if (wire != NULL) {
184 /* 181 /*
185 * lengthen: 182 * lengthen:
186 * Increase the time until a fuse goes off 183 * Increase the time until a fuse goes off
187 */ 184 */
188 185
189 lengthen(dfunc, xtime) 186 void
190 reg int (*dfunc)(), xtime; 187 lengthen(int (*dfunc)(), int xtime)
191 { 188 {
192 reg struct delayed_action *wire; 189 reg struct delayed_action *wire;
193 190
194 if ((wire = find_slot(dfunc)) == NULL) 191 if ((wire = find_slot(dfunc)) == NULL)
195 return; 192 return;
199 /* 196 /*
200 * extinguish: 197 * extinguish:
201 * Put out a fuse 198 * Put out a fuse
202 */ 199 */
203 200
204 extinguish(dfunc) 201 void
205 reg int (*dfunc)(); 202 extinguish(int (*dfunc)())
206 { 203 {
207 reg struct delayed_action *wire; 204 reg struct delayed_action *wire;
208 205
209 if ((wire = find_slot(dfunc)) == NULL) 206 if ((wire = find_slot(dfunc)) == NULL)
210 return; 207 return;
218 /* 215 /*
219 * do_fuses: 216 * do_fuses:
220 * Decrement counters and start needed fuses 217 * Decrement counters and start needed fuses
221 */ 218 */
222 219
223 do_fuses(flag) 220 void
224 reg int flag; 221 do_fuses(int flag)
225 { 222 {
226 struct delayed_action *wire; 223 struct delayed_action *wire;
227 int i; 224 int i;
228 225
229 /* 226 /*
248 /* 245 /*
249 * activity: 246 * activity:
250 * Show wizard number of demaons and memory blocks used 247 * Show wizard number of demaons and memory blocks used
251 */ 248 */
252 249
253 activity() 250 void
251 activity(void)
254 { 252 {
255 msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", 253 msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d",
256 demoncnt,fusecnt,total,md_memused()); 254 demoncnt,fusecnt,total,md_memused());
257 } 255 }
258 256