zchar Processor::stream_read_input(int max, zchar *buf, zword timeout, zword routine, bool hot_keys, bool no_scripting) { zchar key = ZC_BAD; flush_buffer(); // Remove initial input from the transscript file or from the screen if (ostream_script && enable_scripting && !no_scripting) script_erase_input(buf); // Read input line from current input stream continue_input: do { if (istream_replay) key = replay_read_input(buf); else key = console_read_input(max, buf, timeout, key != ZC_BAD); if (shouldQuit()) return ZC_BAD; } while (key == ZC_BAD); // Copy input line to the command file if (ostream_record && !istream_replay) record_write_input(buf, key); // Handle timeouts if (key == ZC_TIME_OUT) if (direct_call(routine) == 0) goto continue_input; // Copy input line to transscript file or to the screen if (ostream_script && enable_scripting && !no_scripting) script_write_input(buf, key); // Return terminating key return key; }
zchar stream_read_input ( int max, zchar *buf, zword timeout, zword routine, bool hot_keys, bool no_scripting ) { zchar key = ZC_BAD; flush_buffer (); /* Remove initial input from the transscript file or from the screen */ if (ostream_script && enable_scripting && !no_scripting) script_erase_input (buf); if (istream_replay) screen_erase_input (buf); /* Read input line from current input stream */ continue_input: do { if (istream_replay) key = replay_read_input (buf); else key = console_read_input (max, buf, timeout, key != ZC_BAD); } while (key == ZC_BAD); /* Verify mouse clicks */ if (key == ZC_SINGLE_CLICK || key == ZC_DOUBLE_CLICK) if (!validate_click ()) goto continue_input; /* Copy input line to the command file */ if (ostream_record && !istream_replay) record_write_input (buf, key); /* Handle timeouts */ if (key == ZC_TIME_OUT) if (direct_call (routine) == 0) goto continue_input; /* Handle hot keys */ if (hot_keys && key >= ZC_HKEY_MIN && key <= ZC_HKEY_MAX) { if (!handle_hot_key (key)) goto continue_input; return ZC_BAD; } /* Copy input line to transscript file or to the screen */ if (ostream_script && enable_scripting && !no_scripting) script_write_input (buf, key); if (istream_replay) screen_write_input (buf, key); /* Return terminating key */ return key; }/* stream_read_input */