# key bindings for DCT, by Shiar

#                     - function keys moved back here
#                     - module not auto loaded by dct, but by specific display modules
# 1.09.3 200410142200 - enter sent as chr 10 on non-curses terminals
# 1.09.2 200410120145 - alt+backspace and ^W for (hard) drop
# 1.09.1 200410112145 - function keys moved to menu.pm
# 1.08.2 200409270049 - single key alias to chs: \ (often close to _)
# 1.08.1 200409270040 - moved from 1.8 main

use strict;
use warnings;

%alias = (
	chr 4              => "quit",    # ^D
	chr 9              => "more",    # tab
	"\014"             => "refresh", # ^L
#	"\033\133\110"     => "refresh", # home
	"\033\133\062\176" => "eex",     # ins
	"\033\133\063\176" => "clear",   # del
	    "\177"         => "back",    # backspace
	    "\010"         => "back",    # backspace
	"\033\010"         => "drop",    # alt+backspace
	"\033\177"         => "drop",    # alt+backspace
	    "\027"         => "drop",    # ^W
	chr 10             => "enter",   # enter (terminal)
	chr 13             => "enter",   # enter (curses)
	' '                => "enter",   # space
	"\033\133\101"     => "stack",   # up    - 48: k (stack)
	"\033\133\104"     => "undo",    # left  - 48: p (picture)
#	"\033\133\102"     => '',        # down  - 48: q (view)
	"\033\133\103"     => "swap",    # right - 48: r (swap)

	    '='            => "sto",     #
	    '_'            => "chs",     # easy to remember, difficult to type
	    '\\'           => "chs",     # single key
#	    'y'            => "chs",     # redundant hp48 compatibility
#	    'z'            => "eex",     # redundant hp48 compatibility

	    '&'            => "and",
	    '|'            => "or",
	    '#'            => "xor",
	    '~'            => "not",
	    '('            => "sl",
	    ')'            => "sr",

	    "s"            => "sin",
	"\033s"            => "asin",
	    "o"            => "cos", # or u?
	"\033o"            => "acos",
	    "t"            => "tan",
	"\033t"            => "atan",
	    "l"            => "log",
	"\033l"            => "alog",
	    "n"            => "ln",
	"\033n"            => "exp",
	    "q"            => "sq",
	"\033q"            => "sqrt",
	    "x"            => "^",
	"\033x"            => "xroot",
	"\033^"            => "xroot",   # for consistency
	    "v"            => "inv",
); # %alias

%falias = (
	"\033"                         =>  0, # esc
	"\033\117\120"                 =>  1, # f1
	"\033\133\061\061\176"         =>  1, # f1
	"\033\133\061\062\176"         =>  2, # f2
	"\033\133\061\063\176"         =>  3, # f3
	"\033\133\061\064\176"         =>  4, # f4
	"\033\117\121"                 =>  2, # f2
	"\033\117\122"                 =>  3, # f3
	"\033\117\123"                 =>  4, # f4
	"\033\133\061\065\176"         =>  5, # f5
	"\033\133\061\067\176"         =>  6, # f6
	"\033\133\061\070\176"         =>  7, # f7
	"\033\133\061\071\176"         =>  8, # f8
	"\033\133\062\060\176"         =>  9, # f9
	"\033\133\062\061\176"         => 10, # f10
	"\033\133\062\063\176"         => 11, # f11/F1
	"\033\133\062\064\176"         => 12, # f12/F2
	"\033\133\062\065\176"         => 13, # F3
	"\033\133\062\066\176"         => 14, # F4
	"\033\133\062\070\176"         => 15, # F5
	"\033\133\062\071\176"         => 16, # F6
	"\033\133\063\061\176"         => 17, # F7
	"\033\133\063\062\176"         => 18, # F8
	"\033\133\063\063\176"         => 19, # F9
	"\033\133\063\064\176"         => 20, # F10
	"\033\133\062\063\073\062\176" => 21, # F11
	"\033\133\062\064\073\062\176" => 22, # F12
	"\033\061"                     =>  1, # alt+1
	"\033\062"                     =>  2, # alt+2
	"\033\063"                     =>  3, # alt+3
	"\033\064"                     =>  4, # alt+4
	"\033\065"                     =>  5, # alt+5
	"\033\066"                     =>  6, # alt+6
	"\033\067"                     =>  7, # alt+7
	"\033\070"                     =>  8, # alt+8
	"\033\071"                     =>  9, # alt+9
	"\033\060"                     => 10, # alt+0
); # %falias

1;

