CKBD keyboard interrupt ----------------------- StateMachine: At every keyboard interrupt the CKBD state machine is called. If nothing is indicated in this description, then the current character is not changed. There are three basic operations which apply to the keyboard buffer: remove_from_buffer The last entered character is removed from the keyboard buffer. replace_in_buffer char The last entered character is overwritten with 'char'. insert_in_buffer char 'char' is inserted into the keyboard buffer as if it has been typed normally. The 'GOTO' command determines which state is next. The state diagram as defined here has been implemented in assembler in CKBD. 1. DEC-MODE COMPOSED CHARACTERS: -------------------------------- * The function works exactly as on the DEC VT200 terminal by Digital Equipment Corporation. * If the 'Composed Characters' are in 'order sensitive' mode, it doesn't matter if you enter ^e or e^ - you always get ˆ. * If 'order sensitive' is switched on you have to take care of the order in which you type the characters: only e^ gives now ˆ. * During a compose sequence the characters you type are not visible. So when the final character is output CKBD doesn't need to erase intermediate characters with backspace. * Running compose sequences can be interrupted at any moment with ESC or BackSpace. 2. MULTICHAR-MODE COMPOSED CHARACTERS: -------------------------------------- * This function works more like Extkey. After starting a compose sequence intermediate characters are still output. The current application has to cope with quick character sequences. * If the 'Composed Characters' are in 'order sensitive' mode, it doesn't matter if you enter ^e or e^ - you always get ˆ. * If 'order sensitive' is switched on you have to take care of the order in which you type the characters: only e^ gives now ˆ. * Running compose sequences can be interrupted at any moment with ESC or BackSpace. 3. Deadkeys: ------------ * The code generated by a dead key is removed from the keyboard buffer and then CKBD tries to combine this character with the next one. If the combination makes sense it outputs the new composed character, otherwise it writes both characters back into the keyboard buffer. * Running compose sequences can be interrupted at any moment with ESC or BackSpace. * Keys with the ascii code zero are passed through (cursor keys, F-keys) 4. Extkey: ---------- * If you enter a character with the control key depressed CKBD tries to combine this character with the previous one. If the combination makes sense a BackSpace code is sent to erase the previous character from the screen and the composed character is output. 5. ALT_nnn: ----------- * When the ALT key is held down a number typed in on the numeric keypad is interpreted as an ASCII code. 6. the complete status diagram of CKBD: ----------------------------------------- STATE_DIAGRAM CKBD_statemachine: STATE Normal_operation: IF (Alt_pressed) GOTO Prepare_CC ELSE IF (Alt_released) GOTO Normal_operation ELSE IF (Control_pressed) GOTO Extkey ELSE IF (Is_a_deadkey) remove_char_from_buffer Store_this_char GOTO Deadkeys ENDIF STATE Prepare_CC: IF (Alt_released) THEN IF (time_out OR other_key_pressed) THEN GOTO Normal_operation ELSE IF (DEC_mode) GOTO Compose_1 ELSE GOTO Compose_3 ENDIF ELSE IF (Numeric_keypad_digit) THEN compchar=0 GOTO Alt_nnn ENDIF ENDIF STATE Compose_1: remove_char_from_buffer Store_this_char IF (char==ESC OR char==BS) THEN GOTO Normal_operation ELSE GOTO Compose_2 ENDIF STATE Compose_2: IF (char==ESC OR char==BS) THEN GOTO Normal_operation ELSE IF (sequence_is_valid) THEN replace_in_buffer Composed_char ELSE remove_char_from_buffer Bell_sound GOTO Normal_operation ENDIF STATE Compose_3: IF (char==ESC OR char==BS) THEN GOTO Normal_operation ELSE IF (sequence_is_valid) THEN Store_this_char GOTO Compose_multi ELSE GOTO Normal_operation ENDIF STATE Compose_multi: IF (char==ESC OR char==BS) THEN GOTO Normal_operation ELSE IF (sequence_is_valid) THEN replace_in_buffer BackSpace insert_in_buffer Composed_char Store_this_char GOTO Compose_multi ELSE GOTO Normal_operation ENDIF STATE Extkey: IF (Control_released) GOTO Normal_operation IF (sequence_is_valid) THEN replace_in_buffer BackSpace insert_in_buffer Composed_char ENDIF STATE Deadkeys: IF (char==SPACE OR char==previous_char) THEN replace_in_buffer char GOTO Normal_operation ELSE IF (sequence_is_valid) replace_in_buffer Composed_char ELSE replace_in_buffer previous_char insert_in_buffer char ENDIF STATE Alt_nnn: IF (Alt_released) THEN insert_in_buffer compchar GOTO Normal_operation ENDIF compchar = 10*compchar + VALUE_OF(char) IF (compchar>255 OR more_than_3_chars_entered THEN insert_in_buffer compchar ENDIF END_DIAGRAM CKBD_statemachine. ----------------------------------------------------------------------- (c) 1992, 1994 by P. Fellerich -----------------------------------------------------------------------