comparison arogue7/daemon.c @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents cadff8f047a1
children b67b99f6c92b
comparison
equal deleted inserted replaced
218:56e748983fa8 219:f9ef86cf22b2
42 /* 42 /*
43 * d_slot: 43 * d_slot:
44 * Find an empty slot in the daemon list 44 * Find an empty slot in the daemon list
45 */ 45 */
46 struct delayed_action * 46 struct delayed_action *
47 d_slot() 47 d_slot(void)
48 { 48 {
49 reg int i; 49 reg int i;
50 reg struct delayed_action *dev; 50 reg struct delayed_action *dev;
51 51
52 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) 52 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++)
58 /* 58 /*
59 * f_slot: 59 * f_slot:
60 * Find an empty slot in the fuses list 60 * Find an empty slot in the fuses list
61 */ 61 */
62 struct delayed_action * 62 struct delayed_action *
63 f_slot() 63 f_slot(void)
64 { 64 {
65 reg int i; 65 reg int i;
66 reg struct delayed_action *dev; 66 reg struct delayed_action *dev;
67 67
68 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) 68 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++)
76 /* 76 /*
77 * find_slot: 77 * find_slot:
78 * Find a particular slot in the table 78 * Find a particular slot in the table
79 */ 79 */
80 struct delayed_action * 80 struct delayed_action *
81 find_slot(func) 81 find_slot(int (*func)())
82 reg int (*func)();
83 { 82 {
84 reg int i; 83 reg int i;
85 reg struct delayed_action *dev; 84 reg struct delayed_action *dev;
86 85
87 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++) 86 for (i = 0, dev = f_list; i < MAXFUSES; i++, dev++)
93 92
94 /* 93 /*
95 * start_daemon: 94 * start_daemon:
96 * Start a daemon, takes a function. 95 * Start a daemon, takes a function.
97 */ 96 */
98 start_daemon(func, arg, type) 97 void
99 reg int arg, type, (*func)(); 98 start_daemon(int (*func)(), int arg, int type)
100 { 99 {
101 reg struct delayed_action *dev; 100 reg struct delayed_action *dev;
102 101
103 dev = d_slot(); 102 dev = d_slot();
104 if (dev != NULL) { 103 if (dev != NULL) {
113 112
114 /* 113 /*
115 * kill_daemon: 114 * kill_daemon:
116 * Remove a daemon from the list 115 * Remove a daemon from the list
117 */ 116 */
118 kill_daemon(func) 117 void
119 reg int (*func)(); 118 kill_daemon(int (*func)())
120 { 119 {
121 reg struct delayed_action *dev; 120 reg struct delayed_action *dev;
122 reg int i; 121 reg int i;
123 122
124 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) { 123 for (i = 0, dev = d_list; i < MAXDAEMONS; i++, dev++) {
140 /* 139 /*
141 * do_daemons: 140 * do_daemons:
142 * Run all the daemons that are active with the current flag, 141 * Run all the daemons that are active with the current flag,
143 * passing the argument to the function. 142 * passing the argument to the function.
144 */ 143 */
145 do_daemons(flag) 144 void
146 reg int flag; 145 do_daemons(int flag)
147 { 146 {
148 reg struct delayed_action *dev; 147 reg struct delayed_action *dev;
149 148
150 /* 149 /*
151 * Loop through the devil list 150 * Loop through the devil list
161 160
162 /* 161 /*
163 * fuse: 162 * fuse:
164 * 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
165 */ 164 */
166 fuse(func, arg, time, type) 165 void
167 reg int (*func)(), arg, time, type; 166 fuse(int (*func)(), int arg, int time, int type)
168 { 167 {
169 reg struct delayed_action *wire; 168 reg struct delayed_action *wire;
170 169
171 wire = f_slot(); 170 wire = f_slot();
172 if (wire != NULL) { 171 if (wire != NULL) {
181 180
182 /* 181 /*
183 * lengthen: 182 * lengthen:
184 * Increase the time until a fuse goes off 183 * Increase the time until a fuse goes off
185 */ 184 */
186 lengthen(func, xtime) 185 void
187 reg int (*func)(), xtime; 186 lengthen(int (*func)(), int xtime)
188 { 187 {
189 reg struct delayed_action *wire; 188 reg struct delayed_action *wire;
190 189
191 if ((wire = find_slot(func)) == NULL) 190 if ((wire = find_slot(func)) == NULL)
192 return; 191 return;
196 195
197 /* 196 /*
198 * extinguish: 197 * extinguish:
199 * Put out a fuse 198 * Put out a fuse
200 */ 199 */
201 extinguish(func) 200 void
202 reg int (*func)(); 201 extinguish(int (*func)())
203 { 202 {
204 reg struct delayed_action *wire; 203 reg struct delayed_action *wire;
205 204
206 if ((wire = find_slot(func)) == NULL) 205 if ((wire = find_slot(func)) == NULL)
207 return; 206 return;
215 214
216 /* 215 /*
217 * do_fuses: 216 * do_fuses:
218 * Decrement counters and start needed fuses 217 * Decrement counters and start needed fuses
219 */ 218 */
220 do_fuses(flag) 219 void
221 reg int flag; 220 do_fuses(int flag)
222 { 221 {
223 reg struct delayed_action *wire; 222 reg struct delayed_action *wire;
224 223
225 /* 224 /*
226 * Step though the list 225 * Step though the list
243 242
244 /* 243 /*
245 * activity: 244 * activity:
246 * Show wizard number of demaons and memory blocks used 245 * Show wizard number of demaons and memory blocks used
247 */ 246 */
248 activity() 247 void
248 activity(void)
249 { 249 {
250 msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d", 250 msg("Daemons = %d : Fuses = %d : Memory Items = %d : Memory Used = %d",
251 demoncnt,fusecnt,total,md_memused(0)); 251 demoncnt,fusecnt,total,md_memused());
252 } 252 }