示例#1
0
zchar Processor::stream_read_key(zword timeout, zword routine, bool hot_keys) {
	zchar key = ZC_BAD;

	flush_buffer();

	// Read key from current input stream
continue_input:

	do {
		if (istream_replay)
			key = replay_read_key();
		else
			key = console_read_key(timeout);
		if (shouldQuit())
			return ZC_BAD;
	} while (key == ZC_BAD);

	// Copy key to the command file
	if (ostream_record && !istream_replay)
		record_write_key(key);

	// Handle timeouts
	if (key == ZC_TIME_OUT)
		if (direct_call (routine) == 0)
			goto continue_input;

	// Return key
	return key;
}
示例#2
0
void Processor::record_write_input(const zchar *buf, zchar key) {
	zchar c;

	while ((c = *buf++) != 0)
		record_char(c);

	record_write_key(key);
}
zchar stream_read_key ( zword timeout, zword routine,
			bool hot_keys )
{
    zchar key = ZC_BAD;

    flush_buffer ();

    /* Read key from current input stream */

continue_input:

    do {

	if (istream_replay)
	    key = replay_read_key ();
	else
	    key = console_read_key (timeout);

    } while (key == ZC_BAD);

    /* Verify mouse clicks */

    if (key == ZC_SINGLE_CLICK || key == ZC_DOUBLE_CLICK)
	if (!validate_click ())
	    goto continue_input;

    /* Copy key to the command file */

    if (ostream_record && !istream_replay)
	record_write_key (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 (h_version == V4 && key == ZC_HKEY_UNDO)
	    goto continue_input;
	if (!handle_hot_key (key))
	    goto continue_input;

	return ZC_BAD;

    }

    /* Return key */

    return key;

}/* stream_read_key */