# key bindings for DCT, by Shiar

# 1.08.1 2004-09-27 00:40 - moved from 1.8 main
# 1.08.2 2004-09-27 00:49 - single key alias to chs: \ (often close to _)

package DCT::Bindings;

use strict;
use utf8;

use vars qw($VERSION @ISA @EXPORT);
require Exporter;

@ISA = qw(Exporter);
@EXPORT = qw(%falias %alias);

$VERSION = 1.008.001;

our %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
); # %falias

our %alias = (
	chr 4              => 'quit',    # ^D
	chr 9              => 'more',    # tab
	"\014"             => 'refresh', # ^L
#	"\033\133\110"     => 'refresh', # home
	'_'                => 'chs',     # easy to remember, difficult to type
	'\\'               => 'chs',     # single key
#	'y'                => 'chs',     # redundant hp48 compatibility
#	'z'                => 'eex',     # redundant hp48 compatibility
	"\033\133\062\176" => 'eex',     # ins
	"\033\133\063\176" => "clear",   # del
	chr 127            => 'drop',    # backspace
	chr 8              => 'drop',    # backspace
	chr 13             => 'enter',   # enter
	' '                => 'enter',   # space
	'='                => 'sto',     #

	"\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)

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

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

1;

