From:	CSBVAX::MRGATE!INFO-VAX-RELAY@KL.SRI.COM@SMTP 23-JUN-1988 06:29
To:	ARISIA::EVERHART
Subj:	RE: TPU numeric keypad


Received: from CORNELLC.CCS.CORNELL.EDU by KL.SRI.COM with TCP; Thu, 16 Jun 88 11:09:33 PDT
Received: from IUBACS.BITNET by CORNELLC.CCS.CORNELL.EDU ; Thu, 16 Jun 88 14:08:15 EDT
Date:     Thu, 16 Jun 88 13:07 EST
From:     <FEASTER%IUBACS.BITNET@CORNELLC.CCS.CORNELL.EDU>
Subject:  RE: TPU numeric keypad
To:       INFO-VAX@KL.SRI.COM
X-Original-To:  INTERBITGATE%"INFO-VAX@KL.SRI.COM", FEASTER

Here's one way to allow numeric keypad in a TPU editing environment...

!  NUMERIC.TPU
!
!  TPU command file to toggle between function/numeric keypad by
!  pressing control-k.
!  To use:
!
!      EDIT/TPU/COM=NUMERIC.TPU filename
!
   PROCEDURE dmf$keypad_toggle
   !
   ! Toggle between numeric and function keypad
   !
   IF dmf$numeric_keypad = 'on' THEN
      dmf$numeric_keypad := 'off';
      define_key(dmf$prog_kp0,kp0,dmf$comm_kp0);
      define_key(dmf$prog_kp1,kp1,dmf$comm_kp1);
      define_key(dmf$prog_kp2,kp2,dmf$comm_kp2);
      define_key(dmf$prog_kp3,kp3,dmf$comm_kp3);
      define_key(dmf$prog_kp4,kp4,dmf$comm_kp4);
      define_key(dmf$prog_kp5,kp5,dmf$comm_kp5);
      define_key(dmf$prog_kp6,kp6,dmf$comm_kp6);
      define_key(dmf$prog_kp7,kp7,dmf$comm_kp7);
      define_key(dmf$prog_kp8,kp8,dmf$comm_kp8);
      define_key(dmf$prog_kp9,kp9,dmf$comm_kp9);
      define_key(dmf$prog_kpminus,minus,dmf$comm_kpminus);
      define_key(dmf$prog_kpcomma,comma,dmf$comm_kpcomma);
      define_key(dmf$prog_kpperiod,period,dmf$comm_kpperiod);
      define_key(dmf$prog_kpenter,enter,dmf$comm_kpenter);
      MESSAGE('Function keypad enabled.');
   ELSE
      dmf$numeric_keypad := 'on';
      define_key("COPY_TEXT('0')",kp0,"nkp0");
      define_key("COPY_TEXT('1')",kp1,"nkp1");
      define_key("COPY_TEXT('2')",kp2,"nkp2");
      define_key("COPY_TEXT('3')",kp3,"nkp3");
      define_key("COPY_TEXT('4')",kp4,"nkp4");
      define_key("COPY_TEXT('5')",kp5,"nkp5");
      define_key("COPY_TEXT('6')",kp6,"nkp6");
      define_key("COPY_TEXT('7')",kp7,"nkp7");
      define_key("COPY_TEXT('8')",kp8,"nkp8");
      define_key("COPY_TEXT('9')",kp9,"nkp9");
      define_key("COPY_TEXT('.')",period,"nkpperiod");
      define_key("COPY_TEXT('-')",minus,"nkpminus");
      define_key("COPY_TEXT(',')",comma,"nkpcomma");
      define_key(LOOKUP_KEY(ret_key,PROGRAM),enter,"nkpenter");
      MESSAGE('Numeric keypad is now enabled.');
   ENDIF;
   ENDPROCEDURE;
!
! Numeric keypad will be disabled upon entry to editor
!
    dmf$numeric_keypad := 'off';
!
! Pressing control-K will toggle between numeric and function keypad
!
    define_key("dmf$keypad_toggle",ctrl_k_key,"toggle_keypad");
!
! Save all the original functions of the keypad keys
!
    dmf$prog_kp0 := LOOKUP_KEY(kp0,PROGRAM);
    dmf$prog_kp1 := LOOKUP_KEY(kp1,PROGRAM);
    dmf$prog_kp2 := LOOKUP_KEY(kp2,PROGRAM);
    dmf$prog_kp3 := LOOKUP_KEY(kp3,PROGRAM);
    dmf$prog_kp4 := LOOKUP_KEY(kp4,PROGRAM);
    dmf$prog_kp5 := LOOKUP_KEY(kp5,PROGRAM);
    dmf$prog_kp6 := LOOKUP_KEY(kp6,PROGRAM);
    dmf$prog_kp7 := LOOKUP_KEY(kp7,PROGRAM);
    dmf$prog_kp8 := LOOKUP_KEY(kp8,PROGRAM);
    dmf$prog_kp9 := LOOKUP_KEY(kp9,PROGRAM);
    dmf$prog_kpcomma := LOOKUP_KEY(comma,PROGRAM);
    dmf$prog_kpperiod := LOOKUP_KEY(period,PROGRAM);
    dmf$prog_kpenter := LOOKUP_KEY(enter,PROGRAM);
!
! Save all original key comments
!
    dmf$comm_kp0 := LOOKUP_KEY(kp0,COMMENT);
    dmf$comm_kp1 := LOOKUP_KEY(kp1,COMMENT);
    dmf$comm_kp2 := LOOKUP_KEY(kp2,COMMENT);
    dmf$comm_kp3 := LOOKUP_KEY(kp3,COMMENT);
    dmf$comm_kp4 := LOOKUP_KEY(kp4,COMMENT);
    dmf$comm_kp5 := LOOKUP_KEY(kp5,COMMENT);
    dmf$comm_kp6 := LOOKUP_KEY(kp6,COMMENT);
    dmf$comm_kp7 := LOOKUP_KEY(kp7,COMMENT);
    dmf$comm_kp8 := LOOKUP_KEY(kp8,COMMENT);
    dmf$comm_kp9 := LOOKUP_KEY(kp9,COMMENT);
    dmf$comm_kpcomma := LOOKUP_KEY(comma,COMMENT);
    dmf$comm_kpperiod := LOOKUP_KEY(period,COMMENT);
    dmf$comm_kpenter := LOOKUP_KEY(enter,COMMENT);
!
!  End of tpu file
!
!  Mickey Feaster
!  Indiana University Speech Research Lab
!  BITNET:  FEASTER@IUBACS

