| 391 | } |
| 392 | |
| 393 | void soar_invoke_first_callback(agent* thisAgent, |
| 394 | SOAR_CALLBACK_TYPE callback_type, |
| 395 | soar_call_data call_data) |
| 396 | { |
| 397 | list* head; |
| 398 | |
| 399 | /* if no callback is registered, just return */ |
| 400 | head = thisAgent->soar_callbacks[callback_type]; |
| 401 | if (head == NULL) |
| 402 | { |
| 403 | return; |
| 404 | } |
| 405 | |
| 406 | /* REW: begin 28.07.96 */ |
| 407 | |
| 408 | #ifndef NO_TIMING_STUFF |
| 409 | switch (callback_type) |
| 410 | { |
| 411 | case BEFORE_DECISION_CYCLE_CALLBACK: |
| 412 | case BEFORE_INPUT_PHASE_CALLBACK: |
| 413 | case AFTER_INPUT_PHASE_CALLBACK: |
| 414 | /* for these three: thisAgent->current_phase = INPUT_PHASE */ |
| 415 | case BEFORE_OUTPUT_PHASE_CALLBACK: |
| 416 | case AFTER_OUTPUT_PHASE_CALLBACK: |
| 417 | /* for these two: thisAgent->current_phase = OUTPUT_PHASE */ |
| 418 | case BEFORE_PREFERENCE_PHASE_CALLBACK: |
| 419 | case AFTER_PREFERENCE_PHASE_CALLBACK: |
| 420 | /* for these two: thisAgent->current_phase = PREFERENCE_PHASE */ |
| 421 | case BEFORE_WM_PHASE_CALLBACK: |
| 422 | case AFTER_WM_PHASE_CALLBACK: |
| 423 | /* for these two: thisAgent->current_phase = WM_PHASE */ |
| 424 | case BEFORE_DECISION_PHASE_CALLBACK: |
| 425 | case AFTER_DECISION_PHASE_CALLBACK: |
| 426 | /* for above two: thisAgent->current_phase = DECISION_PHASE */ |
| 427 | case BEFORE_PROPOSE_PHASE_CALLBACK: |
| 428 | case AFTER_PROPOSE_PHASE_CALLBACK: |
| 429 | /* for above two: thisAgent->current_phase = PROPOSE_PHASE soar8 only */ |
| 430 | case BEFORE_APPLY_PHASE_CALLBACK: |
| 431 | case AFTER_APPLY_PHASE_CALLBACK: |
| 432 | /* for above two: thisAgent->current_phase = APPLY_PHASE soar8 only */ |
| 433 | case AFTER_DECISION_CYCLE_CALLBACK: |
| 434 | /* for soar7: thisAgent->current_phase = DECISION_PHASE; for soar8 it's OUTPUT_PHASE */ |
| 435 | thisAgent->timers_phase.stop(); |
| 436 | thisAgent->timers_kernel.stop(); |
| 437 | thisAgent->timers_total_kernel_time.update(thisAgent->timers_kernel); |
| 438 | thisAgent->timers_decision_cycle_phase[thisAgent->current_phase].update(thisAgent->timers_phase); |
| 439 | thisAgent->timers_phase.start(); |
| 440 | break; |
| 441 | case INPUT_PHASE_CALLBACK: |
| 442 | /* Stop the kernel and phase timers for the input function. |
| 443 | * the output function is done in do_output_phase */ |
| 444 | thisAgent->timers_phase.stop(); |
| 445 | thisAgent->timers_kernel.stop(); |
| 446 | thisAgent->timers_total_kernel_time.update(thisAgent->timers_kernel); |
| 447 | thisAgent->timers_decision_cycle_phase[thisAgent->current_phase].update(thisAgent->timers_phase); |
| 448 | thisAgent->timers_kernel.start(); |
| 449 | break; |
| 450 | default: |
no test coverage detected