diff options
| author | Richard Brooksby | 2012-08-31 20:15:26 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2012-08-31 20:15:26 +0100 |
| commit | 03b25f13a52d6a9dc7b1e6532952c99e31c5d030 (patch) | |
| tree | 1d3628b8f5ad958f48bb3a7c45a8cb14a866f0e8 /mps/code | |
| parent | 6d6f88608fa183190140c4e98875b559b69e8e3f (diff) | |
| download | emacs-03b25f13a52d6a9dc7b1e6532952c99e31c5d030.tar.gz emacs-03b25f13a52d6a9dc7b1e6532952c99e31c5d030.zip | |
Tidying up fixmes.
Catching errors from EVENT_CLOCK_WRITE.
Printing more information about unknown event types.
Copied from Perforce
Change: 179143
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/event.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/mps/code/event.c b/mps/code/event.c index cdcd6e9bb21..c83d99205a0 100644 --- a/mps/code/event.c +++ b/mps/code/event.c | |||
| @@ -209,7 +209,7 @@ void EventFinish(void) | |||
| 209 | * Flip(M) EventControl(0,M) | 209 | * Flip(M) EventControl(0,M) |
| 210 | * Read() EventControl(0,0) | 210 | * Read() EventControl(0,0) |
| 211 | * | 211 | * |
| 212 | * FIXME: Candy-machine interface is a transgression. | 212 | * TODO: Candy-machine interface is a transgression. |
| 213 | */ | 213 | */ |
| 214 | 214 | ||
| 215 | EventControlSet EventControl(EventControlSet resetMask, | 215 | EventControlSet EventControl(EventControlSet resetMask, |
| @@ -274,11 +274,12 @@ void EventLabelAddr(Addr addr, EventStringId id) | |||
| 274 | #define EVENT_WRITE_PARAM_B(name, index, sort, ident) \ | 274 | #define EVENT_WRITE_PARAM_B(name, index, sort, ident) \ |
| 275 | " $U", (WriteFU)event->name.f##index, | 275 | " $U", (WriteFU)event->name.f##index, |
| 276 | 276 | ||
| 277 | |||
| 277 | Res EventDescribe(Event event, mps_lib_FILE *stream) | 278 | Res EventDescribe(Event event, mps_lib_FILE *stream) |
| 278 | { | 279 | { |
| 279 | Res res; | 280 | Res res; |
| 280 | 281 | ||
| 281 | /* FIXME: Some sort of EventCheck would be good */ | 282 | /* TODO: Some sort of EventCheck would be good */ |
| 282 | if (event == NULL) | 283 | if (event == NULL) |
| 283 | return ResFAIL; | 284 | return ResFAIL; |
| 284 | if (stream == NULL) | 285 | if (stream == NULL) |
| @@ -286,23 +287,24 @@ Res EventDescribe(Event event, mps_lib_FILE *stream) | |||
| 286 | 287 | ||
| 287 | res = WriteF(stream, | 288 | res = WriteF(stream, |
| 288 | "Event $P {\n", (WriteFP)event, | 289 | "Event $P {\n", (WriteFP)event, |
| 289 | NULL); | 290 | " code $U\n", (WriteFU)event->any.code, |
| 291 | " clock ", NULL); | ||
| 292 | if (res != ResOK) return res; | ||
| 293 | res = EVENT_CLOCK_WRITE(stream, event->any.clock); | ||
| 294 | if (res != ResOK) return res; | ||
| 295 | res = WriteF(stream, "\n size $U\n", (WriteFU)event->any.size, NULL); | ||
| 290 | if (res != ResOK) return res; | 296 | if (res != ResOK) return res; |
| 291 | 297 | ||
| 292 | switch (event->any.code) { | 298 | switch (event->any.code) { |
| 293 | 299 | ||
| 294 | #define EVENT_DESC_PARAM(name, index, sort, ident) \ | 300 | #define EVENT_DESC_PARAM(name, index, sort, ident) \ |
| 295 | "\n $S", (WriteFS)#ident, \ | 301 | "\n $S", (WriteFS)#ident, \ |
| 296 | EVENT_WRITE_PARAM_##sort(name, index, sort, ident) | 302 | EVENT_WRITE_PARAM_##sort(name, index, sort, ident) |
| 297 | 303 | ||
| 298 | #define EVENT_DESC(X, name, _code, always, kind) \ | 304 | #define EVENT_DESC(X, name, _code, always, kind) \ |
| 299 | case _code: \ | 305 | case _code: \ |
| 300 | res = WriteF(stream, \ | 306 | res = WriteF(stream, \ |
| 301 | " code $U ($S)\n", (WriteFU)event->any.code, (WriteFS)#name, \ | 307 | " event \"$S\"", (WriteFS)#name, \ |
| 302 | " clock ", NULL); \ | ||
| 303 | if (res != ResOK) return res; \ | ||
| 304 | EVENT_CLOCK_WRITE(stream, event->any.clock); /* FIXME: return code */ \ | ||
| 305 | res = WriteF(stream, "\n size $U", (WriteFU)event->any.size, \ | ||
| 306 | EVENT_##name##_PARAMS(EVENT_DESC_PARAM, name) \ | 308 | EVENT_##name##_PARAMS(EVENT_DESC_PARAM, name) \ |
| 307 | NULL); \ | 309 | NULL); \ |
| 308 | if (res != ResOK) return res; \ | 310 | if (res != ResOK) return res; \ |
| @@ -311,7 +313,10 @@ Res EventDescribe(Event event, mps_lib_FILE *stream) | |||
| 311 | EVENT_LIST(EVENT_DESC, X) | 313 | EVENT_LIST(EVENT_DESC, X) |
| 312 | 314 | ||
| 313 | default: | 315 | default: |
| 314 | NOTREACHED; /* FIXME: should print .any info */ | 316 | res = WriteF(stream, " event type unknown", NULL); |
| 317 | if (res != ResOK) return res; | ||
| 318 | /* TODO: Hexdump unknown event contents. */ | ||
| 319 | break; | ||
| 315 | } | 320 | } |
| 316 | 321 | ||
| 317 | res = WriteF(stream, | 322 | res = WriteF(stream, |
| @@ -328,7 +333,9 @@ Res EventWrite(Event event, mps_lib_FILE *stream) | |||
| 328 | if (event == NULL) return ResFAIL; | 333 | if (event == NULL) return ResFAIL; |
| 329 | if (stream == NULL) return ResFAIL; | 334 | if (stream == NULL) return ResFAIL; |
| 330 | 335 | ||
| 331 | EVENT_CLOCK_WRITE(stream, event->any.clock); /* FIXME: return code */ | 336 | res = EVENT_CLOCK_WRITE(stream, event->any.clock); |
| 337 | if (res != ResOK) | ||
| 338 | return res; | ||
| 332 | 339 | ||
| 333 | switch (event->any.code) { | 340 | switch (event->any.code) { |
| 334 | 341 | ||
| @@ -337,7 +344,7 @@ Res EventWrite(Event event, mps_lib_FILE *stream) | |||
| 337 | 344 | ||
| 338 | #define EVENT_WRITE(X, name, code, always, kind) \ | 345 | #define EVENT_WRITE(X, name, code, always, kind) \ |
| 339 | case code: \ | 346 | case code: \ |
| 340 | res = WriteF(stream, " "#name, \ | 347 | res = WriteF(stream, " $S", #name, \ |
| 341 | EVENT_##name##_PARAMS(EVENT_WRITE_PARAM, name) \ | 348 | EVENT_##name##_PARAMS(EVENT_WRITE_PARAM, name) \ |
| 342 | NULL); \ | 349 | NULL); \ |
| 343 | if (res != ResOK) return res; \ | 350 | if (res != ResOK) return res; \ |
| @@ -347,7 +354,7 @@ Res EventWrite(Event event, mps_lib_FILE *stream) | |||
| 347 | default: | 354 | default: |
| 348 | res = WriteF(stream, " <unknown code $U>", event->any.code, NULL); | 355 | res = WriteF(stream, " <unknown code $U>", event->any.code, NULL); |
| 349 | if (res != ResOK) return res; | 356 | if (res != ResOK) return res; |
| 350 | /* FIXME: Should dump contents in hex. */ | 357 | /* TODO: Hexdump unknown event contents. */ |
| 351 | break; | 358 | break; |
| 352 | } | 359 | } |
| 353 | 360 | ||