
    VAR
      flag_id: ost$system_flag,
      flag_found: boolean,
      flag_handler: tmt$system_flag_handler,

      trap_enables: 0 .. 3,
      traps: 0 .. 3;

    i#disable_traps (trap_enables);
    flag_found := TRUE;
    REPEAT
      tmp$find_flag_to_process (flag_found, flag_id, flag_handler);
      IF flag_found THEN
        i#enable_traps (traps);
        {call the flag handler}
        flag_handler^ (flag_id);
        i#restore_traps (traps);
      IFEND;
    UNTIL NOT flag_found;

    i#restore_traps (trap_enables);
