! This set of procedures allows the definition of keys during the editing ! session using LEARN sequences: press the key to be defined, perform the ! editing operations to be associated with the key, and press CTRL_Z. ! PROCEDURE lsi_learn_sequence MESSAGE ("Press the key to be defined."); learn_key := READ_KEY; LOOP EXITIF learn_key <> CTRL_Z_KEY;; MESSAGE ("Can't define that key!"); MESSAGE ("Press the key to be defined."); learn_key := READ_KEY; ENDLOOP; ! old_ctrl_z := LOOKUP_KEY (CTRL_Z_KEY, PROGRAM); IF old_ctrl_z <> 0 THEN UNDEFINE_KEY (CTRL_Z_KEY); ENDIF; DEFINE_KEY ('lsi_end_learn_sequence', CTRL_Z_KEY); MESSAGE ("Now learning ... enter CTRL-Z to end"); LEARN_BEGIN (EXACT); ENDPROCEDURE; PROCEDURE lsi_end_learn_sequence learn_sequence := LEARN_END; MESSAGE ("Learn sequence complete."); IF LOOKUP_KEY (learn_key, PROGRAM) <> 0 THEN UNDEFINE_KEY (learn_key); ENDIF; DEFINE_KEY (learn_sequence, learn_key); IF old_ctrl_z <> 0 THEN UNDEFINE_KEY (CTRL_Z_KEY); DEFINE_KEY (old_ctrl_z, CTRL_Z_KEY); ENDIF; ENDPROCEDURE;