mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-21 23:33:26 +01:00
Merge branch 'master' into feat/env-extension
This commit is contained in:
commit
b29f66c40d
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -244,3 +244,6 @@
|
|||||||
url = https://github.com/victor-gp/cmd-help-sublime-syntax.git
|
url = https://github.com/victor-gp/cmd-help-sublime-syntax.git
|
||||||
branch = main
|
branch = main
|
||||||
shallow = true
|
shallow = true
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Ada"]
|
||||||
|
path = assets/syntaxes/02_Extra/Ada
|
||||||
|
url = https://github.com/wiremoons/ada-sublime-syntax
|
||||||
|
@ -2,12 +2,19 @@
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
- Implemented `-S` and `--chop-long-lines` flags as aliases for `--wrap=never`. See #2309 (@johnmatthiggins)
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
|
- Various bash completion improvements, see #2310 (@scop)
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
|
- Added support for Ada, see #1300 and #2316 (@dkm)
|
||||||
|
- Improve Manpage.sublime-syntax. See #2364 (@Freed-Wu)
|
||||||
|
|
||||||
## Themes
|
## Themes
|
||||||
|
|
||||||
## `bat` as a library
|
## `bat` as a library
|
||||||
@ -18,8 +25,6 @@
|
|||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
- Bring back pre-processing of ANSI escape characters to so that some common `bat` use cases starts working again. See #2308 (@Enselic)
|
- Bring back pre-processing of ANSI escape characters to so that some common `bat` use cases starts working again. See #2308 (@Enselic)
|
||||||
- Improve Manpage.sublime-syntax. See #2364 (@Freed-Wu)
|
|
||||||
|
|
||||||
|
|
||||||
# v0.22.0
|
# v0.22.0
|
||||||
|
|
||||||
|
1
assets/syntaxes/02_Extra/Ada
vendored
Submodule
1
assets/syntaxes/02_Extra/Ada
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e2b8fd51756e0cc42172c1c3405832ce9c19b6b6
|
3
assets/syntaxes/02_Extra/INI.sublime-syntax
vendored
3
assets/syntaxes/02_Extra/INI.sublime-syntax
vendored
@ -16,6 +16,9 @@ file_extensions:
|
|||||||
- url
|
- url
|
||||||
- URL
|
- URL
|
||||||
- .editorconfig
|
- .editorconfig
|
||||||
|
- .coveragerc
|
||||||
|
- .pylintrc
|
||||||
|
- .gitlint
|
||||||
- .hgrc
|
- .hgrc
|
||||||
- hgrc
|
- hgrc
|
||||||
scope: source.ini
|
scope: source.ini
|
||||||
|
@ -80,7 +80,7 @@ The following files have been manually modified after converting from a `.tmLang
|
|||||||
* `Apache.sublime_syntax`=> removed `conf` and `CONF` file types.
|
* `Apache.sublime_syntax`=> removed `conf` and `CONF` file types.
|
||||||
* `Dart.sublime-syntax` => removed `#regex.dart` include.
|
* `Dart.sublime-syntax` => removed `#regex.dart` include.
|
||||||
* `DotENV.sublime-syntax` => added `.env.template`, `env` and `env.*` file types ([upstream PR](https://github.com/zaynali53/DotENV/pull/17)).
|
* `DotENV.sublime-syntax` => added `.env.template`, `env` and `env.*` file types ([upstream PR](https://github.com/zaynali53/DotENV/pull/17)).
|
||||||
* `INI.sublime-syntax` => added `.hgrc`, `hgrc`, and `desktop` file types and support for comments after section headers.
|
* `INI.sublime-syntax` => added `.coveragerc`, `.pylintrc`, `.gitlint`, `.hgrc`, `hgrc`, and `desktop` file types and support for comments after section headers.
|
||||||
* `Org mode.sublime-syntax` => removed `task` file type.
|
* `Org mode.sublime-syntax` => removed `task` file type.
|
||||||
* `Robot.sublime_syntax` => changed name to "Robot Framework", added `.resource` extension.
|
* `Robot.sublime_syntax` => changed name to "Robot Framework", added `.resource` extension.
|
||||||
* `SML.sublime_syntax` => removed `ml` file type.
|
* `SML.sublime_syntax` => removed `ml` file type.
|
||||||
|
@ -161,17 +161,21 @@ impl App {
|
|||||||
}),
|
}),
|
||||||
show_nonprintable: self.matches.get_flag("show-all"),
|
show_nonprintable: self.matches.get_flag("show-all"),
|
||||||
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
||||||
match self.matches.get_one::<String>("wrap").map(|s| s.as_str()) {
|
if !self.matches.contains_id("chop-long-lines") {
|
||||||
Some("character") => WrappingMode::Character,
|
match self.matches.get_one::<String>("wrap").map(|s| s.as_str()) {
|
||||||
Some("never") => WrappingMode::NoWrapping(true),
|
Some("character") => WrappingMode::Character,
|
||||||
Some("auto") | None => {
|
Some("never") => WrappingMode::NoWrapping(true),
|
||||||
if style_components.plain() {
|
Some("auto") | None => {
|
||||||
WrappingMode::NoWrapping(false)
|
if style_components.plain() {
|
||||||
} else {
|
WrappingMode::NoWrapping(false)
|
||||||
WrappingMode::Character
|
} else {
|
||||||
|
WrappingMode::Character
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_ => unreachable!("other values for --wrap are not allowed"),
|
||||||
}
|
}
|
||||||
_ => unreachable!("other values for --wrap are not allowed"),
|
} else {
|
||||||
|
WrappingMode::NoWrapping(true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We don't have the tty width when piping to another program.
|
// We don't have the tty width when piping to another program.
|
||||||
|
@ -201,6 +201,13 @@ pub fn build_app(interactive_output: bool) -> Command<'static> {
|
|||||||
The '--terminal-width' option can be used in addition to \
|
The '--terminal-width' option can be used in addition to \
|
||||||
control the output width."),
|
control the output width."),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("chop-long-lines")
|
||||||
|
.long("chop-long-lines")
|
||||||
|
.short('S')
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Truncate all lines longer than screen width. Alias for '--wrap=never'."),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("terminal-width")
|
Arg::new("terminal-width")
|
||||||
.long("terminal-width")
|
.long("terminal-width")
|
||||||
|
1
tests/examples/long-single-line.txt
vendored
Normal file
1
tests/examples/long-single-line.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz
|
@ -1499,6 +1499,47 @@ fn ignored_suffix_arg() {
|
|||||||
.stderr("");
|
.stderr("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn wrapping_test(wrap_flag: &str, expect_wrap: bool) {
|
||||||
|
let expected = match expect_wrap {
|
||||||
|
true =>
|
||||||
|
"abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcde\nfghigklmnopqrstuvxyz\n",
|
||||||
|
false =>
|
||||||
|
"abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz\n",
|
||||||
|
};
|
||||||
|
|
||||||
|
bat()
|
||||||
|
.arg(wrap_flag)
|
||||||
|
.arg("--style=rule")
|
||||||
|
.arg("--color=never")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("--terminal-width=80")
|
||||||
|
.arg("long-single-line.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout(expected.to_owned())
|
||||||
|
.stderr("");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_line_wrapping_when_set_to_never() {
|
||||||
|
wrapping_test("--wrap=never", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn line_wrapping_when_auto() {
|
||||||
|
wrapping_test("--wrap=auto", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_line_wrapping_with_s_flag() {
|
||||||
|
wrapping_test("-S", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_wrapping_with_chop_long_lines() {
|
||||||
|
wrapping_test("--chop-long-lines", false);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn highlighting_is_skipped_on_long_lines() {
|
fn highlighting_is_skipped_on_long_lines() {
|
||||||
let expected = "\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mapi\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\n".to_owned() +
|
let expected = "\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mapi\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\n".to_owned() +
|
||||||
|
308
tests/syntax-tests/highlighted/Ada/click.adb
vendored
Normal file
308
tests/syntax-tests/highlighted/Ada/click.adb
vendored
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
[38;2;230;219;116mwith Chests.Ring_Buffers;[0m
|
||||||
|
[38;2;230;219;116mwith USB.Device.HID.Keyboard;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;249;38;114mbody[0m[38;2;248;248;242m [0m[38;2;166;226;46mClick[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m--------------[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m DEBOUNCE --[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m--------------[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Ideally, in a separate package.[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m should be [], but not fixed yet in GCC 11.[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCurrent_Status[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Matrix := [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => False]];[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNew_Status[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Matrix := [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => False]];[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mSince[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Nb_Bounce : Natural := 5;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mUpdate[0m[38;2;248;248;242m (NewS : Key_Matrix) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Boolean [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m The new state is the same as the current stable state => Do nothing.[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m Current_Status = NewS [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mSince[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m False;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m New_Status /= NewS [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m The new state differs from the previous[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m new state (bouncing) => reset[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNew_Status[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= NewS;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mSince[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m The new state hasn't changed since last[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m update => towards stabilization.[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mSince[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Since + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m Since > Nb_Bounce [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mdeclare[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mTmp[0m[38;2;249;38;114m :[0m[38;2;248;248;242m [0m[38;2;249;38;114mconstant[0m[38;2;248;248;242m Key_Matrix := Current_Status;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m New state has been stable enough.[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Latch it and notifies caller.[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCurrent_Status[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= New_Status;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNew_Status[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Tmp;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mSince[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m True;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Not there yet[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m False;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mUpdate[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Matrix[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Could use := []; but GNAT 12 has a bug (fixed in upcoming 13)[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mRead_Status[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Matrix := [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => False]];[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Events[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Events [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNum_Evt[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNew_S[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Matrix [0m[38;2;249;38;114mrenames[0m[38;2;248;248;242m Read_Status;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m Get_Matrix;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m Update (New_S) [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m I [0m[38;2;249;38;114min[0m[38;2;248;248;242m Current_Status'[0m[38;2;249;38;114mRange[0m[38;2;248;248;242m ([0m[38;2;190;132;255m1[0m[38;2;248;248;242m) [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m J [0m[38;2;249;38;114min[0m[38;2;248;248;242m Current_Status'[0m[38;2;249;38;114mRange[0m[38;2;248;248;242m ([0m[38;2;190;132;255m2[0m[38;2;248;248;242m) [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m ([0m[38;2;249;38;114mnot[0m[38;2;248;248;242m New_Status (I, J) [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m Current_Status (I, J))[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m (New_Status (I, J) [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m Current_Status (I, J))[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNum_Evt[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Num_Evt + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mdeclare[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mEvts[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Events (Natural [0m[38;2;249;38;114mrange[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m .. Num_Evt);[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCursor[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural [0m[38;2;249;38;114mrange[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m .. Num_Evt + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m := [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m I [0m[38;2;249;38;114min[0m[38;2;248;248;242m Current_Status'[0m[38;2;249;38;114mRange[0m[38;2;248;248;242m ([0m[38;2;190;132;255m1[0m[38;2;248;248;242m) [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m J [0m[38;2;249;38;114min[0m[38;2;248;248;242m Current_Status'[0m[38;2;249;38;114mRange[0m[38;2;248;248;242m ([0m[38;2;190;132;255m2[0m[38;2;248;248;242m) [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m New_Status (I, J)[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m Current_Status (I, J)[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Pressing I, J[0m
|
||||||
|
[38;2;248;248;242m Evts (Cursor) := [[0m
|
||||||
|
[38;2;248;248;242m Evt => Press,[0m
|
||||||
|
[38;2;248;248;242m Col => I,[0m
|
||||||
|
[38;2;248;248;242m Row => J[0m
|
||||||
|
[38;2;248;248;242m ];[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCursor[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Cursor + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114melsif[0m[38;2;248;248;242m New_Status (I, J)[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m Current_Status (I, J)[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Release I, J[0m
|
||||||
|
[38;2;248;248;242m Evts (Cursor) := [[0m
|
||||||
|
[38;2;248;248;242m Evt => Release,[0m
|
||||||
|
[38;2;248;248;242m Col => I,[0m
|
||||||
|
[38;2;248;248;242m Row => J[0m
|
||||||
|
[38;2;248;248;242m ];[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCursor[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Cursor + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Evts;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [];[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Events[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Matrix[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m return Key_Matrix is[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Row [0m[38;2;249;38;114min[0m[38;2;248;248;242m Keys.Rows'[0m[38;2;249;38;114mRange[0m[38;2;248;248;242m [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m Keys.Rows (Row).Clear;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Col [0m[38;2;249;38;114min[0m[38;2;248;248;242m Keys.Cols'[0m[38;2;249;38;114mRange[0m[38;2;248;248;242m [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m Read_Status (Col, Row) := [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m Keys.Cols (Col).Set;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m Keys.Rows (Row).Set;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Matrix[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m End of DEBOUNCE[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m------------[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Layout --[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m------------[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mEvents_Ring_Buffers[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m Chests.Ring_Buffers[0m
|
||||||
|
[38;2;248;248;242m (Element_Type => Event,[0m
|
||||||
|
[38;2;248;248;242m Capacity => [0m[38;2;190;132;255m16[0m[38;2;248;248;242m);[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mQueued_Events[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Events_Ring_Buffers.Ring_Buffer;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Statet [0m[38;2;249;38;114mis[0m[38;2;248;248;242m (Normal_Key, Layer_Mod, None);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m State [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114mrecord[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mTyp[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Statet;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCode[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Code_T;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mLayer_Value[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Col : ColR;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Row : RowR;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend record[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m State_Array [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (ColR, RowR) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m State;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mStates[0m[38;2;249;38;114m :[0m[38;2;248;248;242m State_Array := [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => [[0m[38;2;249;38;114mothers[0m[38;2;248;248;242m => (Typ => None, Code => No, Layer_Value => [0m[38;2;190;132;255m0[0m[38;2;248;248;242m)]];[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mKw[0m[38;2;248;248;242m (Code : Key_Code_T) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Action [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m (T => Key, C => Code, L => [0m[38;2;190;132;255m0[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mKw[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mLw[0m[38;2;248;248;242m (V : Natural) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Action [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m (T => Layer, C => No, L => V);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mLw[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m FIXME: hardcoded max number of events[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114msubtype[0m[38;2;248;248;242m Events_Range [0m[38;2;249;38;114mis[0m[38;2;248;248;242m Natural [0m[38;2;249;38;114mrange[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m .. [0m[38;2;190;132;255m60[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Array_Of_Reg_Events [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (Events_Range) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m Event;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mStamp[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mRegister_Events[0m[38;2;248;248;242m (L : Layout; Es : Events) [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mStamp[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Stamp + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m Log ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mReg events: [0m[38;2;230;219;116m"[0m[38;2;248;248;242m & Stamp'Image);[0m
|
||||||
|
[38;2;248;248;242m Log (Es'Length'Image);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m E [0m[38;2;249;38;114mof[0m[38;2;248;248;242m Es [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mdeclare[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m Events_Ring_Buffers.Is_Full (Queued_Events) [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mraise[0m[38;2;248;248;242m Program_Error;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m Events_Ring_Buffers.Append (Queued_Events, E);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Log ("Reg'ed events:" & Events_Mark'Image);[0m
|
||||||
|
[38;2;248;248;242m Log ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mReg'ed events:[0m[38;2;230;219;116m"[0m[38;2;248;248;242m & Events_Ring_Buffers.Length (Queued_Events)'Image);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mRegister_Events[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mRelease[0m[38;2;248;248;242m (Col: Colr; Row: Rowr) [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m States (Col, Row).Typ = None [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mraise[0m[38;2;248;248;242m Program_Error;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m States (Col, Row) := (Typ => None, Code => No, Layer_Value => [0m[38;2;190;132;255m0[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mRelease[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Current_Layer[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Natural [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mL[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m S [0m[38;2;249;38;114mof[0m[38;2;248;248;242m States [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m S.Typ = Layer_Mod [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mL[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= L + S.Layer_Value;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m L;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Current_Layer[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Tick the event.[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Returns TRUE if it needs to stay in the queued events[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m FALSE if the event has been consumed.[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mTick[0m[38;2;248;248;242m (L: Layout; E : [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;249;38;114mout[0m[38;2;248;248;242m Event) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Boolean [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCurrent_Layer[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural := Get_Current_Layer;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mA[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Action [0m[38;2;249;38;114mrenames[0m[38;2;248;248;242m L (Current_Layer, E.Row, E.Col);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mcase[0m[38;2;248;248;242m E.Evt [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m Press =>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mcase[0m[38;2;248;248;242m A.T [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m Key =>[0m
|
||||||
|
[38;2;248;248;242m States (E.Col, E.Row) :=[0m
|
||||||
|
[38;2;248;248;242m (Typ => Normal_Key,[0m
|
||||||
|
[38;2;248;248;242m Code => A.C,[0m
|
||||||
|
[38;2;248;248;242m Layer_Value => [0m[38;2;190;132;255m0[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m Layer =>[0m
|
||||||
|
[38;2;248;248;242m States (E.Col, E.Row) := (Typ => Layer_Mod, Layer_Value => A.L, Code => No);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mothers[0m[38;2;248;248;242m =>[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mraise[0m[38;2;248;248;242m Program_Error;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend case[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m Release =>[0m
|
||||||
|
[38;2;248;248;242m Release (E.Col, E.Row);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend case[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m False;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mTick[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mLast_Was_Empty_Log[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Boolean := False;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mTick[0m[38;2;248;248;242m (L : Layout) [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m I [0m[38;2;249;38;114min[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m .. Events_Ring_Buffers.Length(Queued_Events) [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mdeclare[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mE[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Event := Events_Ring_Buffers.Last_Element (Queued_Events);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m Events_Ring_Buffers.Delete_Last (Queued_Events);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m Tick (L, E) [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m Events_Ring_Buffers.Prepend (Queued_Events, E);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;249;38;114mnot[0m[38;2;248;248;242m Last_Was_Empty_Log [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m Events_Ring_Buffers.Length(Queued_Events) /= [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m Log ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mEnd Tick layout, events: [0m[38;2;230;219;116m"[0m[38;2;248;248;242m & Events_Ring_Buffers.Length(Queued_Events)'Image);[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mLast_Was_Empty_Log[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Events_Ring_Buffers.Length(Queued_Events) = [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mTick[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Key_Codes[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Key_Codes_T [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCodes[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Codes_T ([0m[38;2;190;132;255m0[0m[38;2;248;248;242m .. [0m[38;2;190;132;255m10[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mWm[0m[38;2;249;38;114m:[0m[38;2;248;248;242m Natural := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m S [0m[38;2;249;38;114mof[0m[38;2;248;248;242m States [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m S.Typ = Normal_Key [0m[38;2;249;38;114mand[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m (S.Code < LCtrl [0m[38;2;249;38;114mor[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m S.Code > RGui)[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m Codes (Wm) := S.Code;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mWm[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= Wm + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m Wm = [0m[38;2;190;132;255m0[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [];[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Codes ([0m[38;2;190;132;255m0[0m[38;2;248;248;242m .. Wm - [0m[38;2;190;132;255m1[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Key_Codes[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Modifiers[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Key_Modifiers [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114muse[0m[38;2;248;248;242m USB.Device.HID.Keyboard;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mKM[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Modifiers ([0m[38;2;190;132;255m1[0m[38;2;248;248;242m..[0m[38;2;190;132;255m8[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mI[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m S [0m[38;2;249;38;114mof[0m[38;2;248;248;242m States [0m[38;2;249;38;114mloop[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m S.Typ = Normal_Key [0m[38;2;249;38;114mthen[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mI[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= I + [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mcase[0m[38;2;248;248;242m S.Code [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m LCtrl =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Ctrl_Left;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m RCtrl =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Ctrl_Right;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m LShift =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Shift_Left;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m RShift =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Shift_Right;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m LAlt =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Alt_Left;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m RAlt =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Alt_Right;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m LGui =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Meta_Left;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m RGui =>[0m
|
||||||
|
[38;2;248;248;242m KM(I) := Meta_Right;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwhen[0m[38;2;248;248;242m [0m[38;2;249;38;114mothers[0m[38;2;248;248;242m =>[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mI[0m[38;2;249;38;114m :[0m[38;2;248;248;242m= I - [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend case[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend if[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend loop[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m KM ([0m[38;2;190;132;255m1[0m[38;2;248;248;242m..I);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Modifiers[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mInit[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mbegin[0m
|
||||||
|
[38;2;248;248;242m Events_Ring_Buffers.Clear (Queued_Events);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mInit[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mClick[0m[38;2;248;248;242m;[0m
|
339
tests/syntax-tests/highlighted/Ada/click.ads
vendored
Normal file
339
tests/syntax-tests/highlighted/Ada/click.ads
vendored
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
[38;2;230;219;116mwith HAL.GPIO;[0m
|
||||||
|
[38;2;230;219;116mwith USB.Device.HID.Keyboard;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114mgeneric[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNb_Bounce[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m ColR [0m[38;2;249;38;114mis[0m[38;2;248;248;242m (<>);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m RowR [0m[38;2;249;38;114mis[0m[38;2;248;248;242m (<>);[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m GPIOP [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114mnew[0m[38;2;248;248;242m HAL.GPIO.GPIO_Point [0m[38;2;249;38;114mwith[0m[38;2;248;248;242m [0m[38;2;249;38;114mprivate[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Cols_T [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (ColR) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m GPIOP;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Rows_T [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (RowR) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m GPIOP;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCols[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Cols_T;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mRows[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Rows_T;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mNum_Layers[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mwith[0m[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mLog[0m[38;2;248;248;242m (S : String; L : Integer := [0m[38;2;190;132;255m1[0m[38;2;248;248;242m; Deindent : Integer := [0m[38;2;190;132;255m0[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mClick[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Keys_T [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114mrecord[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCols[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Cols_T;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mRows[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Rows_T;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend record[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mKeys[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Keys_T :=[0m
|
||||||
|
[38;2;248;248;242m (Rows => Rows, Cols => Cols);[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Key_Matrix [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (ColR, RowR) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m Boolean;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m------------------------[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Events & Debouncing --[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m------------------------[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mMaxEvents[0m[38;2;249;38;114m :[0m[38;2;248;248;242m [0m[38;2;249;38;114mconstant[0m[38;2;248;248;242m Positive := [0m[38;2;190;132;255m20[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m EventT [0m[38;2;249;38;114mis[0m[38;2;248;248;242m (Press, Release);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Event [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114mrecord[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mEvt[0m[38;2;249;38;114m :[0m[38;2;248;248;242m EventT;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mCol[0m[38;2;249;38;114m :[0m[38;2;248;248;242m ColR;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mRow[0m[38;2;249;38;114m :[0m[38;2;248;248;242m RowR;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend record[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Events [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (Natural [0m[38;2;249;38;114mrange[0m[38;2;248;248;242m <>) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m Event;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Events[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Events;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mUpdate[0m[38;2;248;248;242m (NewS : Key_Matrix) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Boolean;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m-----------[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Layout --[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m-----------[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m-------------[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keycodes --[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m-------------[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keycodes copy/pasted from the excelent Keyberon Rust firmware:[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m https://github.com/TeXitoi/keyberon/[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Key_Code_T [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m ([0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m The "no" key, a placeholder to express nothing.[0m
|
||||||
|
[38;2;248;248;242m No, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m = 0x00,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / Error if too much keys are pressed at[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m the same time.[0m
|
||||||
|
[38;2;248;248;242m ErrorRollOver,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / The POST fail error.[0m
|
||||||
|
[38;2;248;248;242m PostFail,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / An undefined error occured.[0m
|
||||||
|
[38;2;248;248;242m ErrorUndefined,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / `a` and `A`.[0m
|
||||||
|
[38;2;248;248;242m A,[0m
|
||||||
|
[38;2;248;248;242m B,[0m
|
||||||
|
[38;2;248;248;242m C,[0m
|
||||||
|
[38;2;248;248;242m D,[0m
|
||||||
|
[38;2;248;248;242m E,[0m
|
||||||
|
[38;2;248;248;242m F,[0m
|
||||||
|
[38;2;248;248;242m G,[0m
|
||||||
|
[38;2;248;248;242m H,[0m
|
||||||
|
[38;2;248;248;242m I,[0m
|
||||||
|
[38;2;248;248;242m J,[0m
|
||||||
|
[38;2;248;248;242m K,[0m
|
||||||
|
[38;2;248;248;242m L,[0m
|
||||||
|
[38;2;248;248;242m M, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x10[0m
|
||||||
|
[38;2;248;248;242m N,[0m
|
||||||
|
[38;2;248;248;242m O,[0m
|
||||||
|
[38;2;248;248;242m P,[0m
|
||||||
|
[38;2;248;248;242m Q,[0m
|
||||||
|
[38;2;248;248;242m R,[0m
|
||||||
|
[38;2;248;248;242m S,[0m
|
||||||
|
[38;2;248;248;242m T,[0m
|
||||||
|
[38;2;248;248;242m U,[0m
|
||||||
|
[38;2;248;248;242m V,[0m
|
||||||
|
[38;2;248;248;242m W,[0m
|
||||||
|
[38;2;248;248;242m X,[0m
|
||||||
|
[38;2;248;248;242m Y,[0m
|
||||||
|
[38;2;248;248;242m Z,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `1` and `!`.[0m
|
||||||
|
[38;2;248;248;242m Kb1,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `2` and `@`.[0m
|
||||||
|
[38;2;248;248;242m Kb2,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `3` and `#`.[0m
|
||||||
|
[38;2;248;248;242m Kb3, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x20[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / `4` and `$`.[0m
|
||||||
|
[38;2;248;248;242m Kb4,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `5` and `%`.[0m
|
||||||
|
[38;2;248;248;242m Kb5,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `6` and `^`.[0m
|
||||||
|
[38;2;248;248;242m Kb6,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `7` and `&`.[0m
|
||||||
|
[38;2;248;248;242m Kb7,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `8` and `*`.[0m
|
||||||
|
[38;2;248;248;242m Kb8,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `9` and `(`.[0m
|
||||||
|
[38;2;248;248;242m Kb9,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `0` and `)`.[0m
|
||||||
|
[38;2;248;248;242m Kb0,[0m
|
||||||
|
[38;2;248;248;242m Enter,[0m
|
||||||
|
[38;2;248;248;242m Escape,[0m
|
||||||
|
[38;2;248;248;242m BSpace,[0m
|
||||||
|
[38;2;248;248;242m Tab,[0m
|
||||||
|
[38;2;248;248;242m Space,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `-` and `_`.[0m
|
||||||
|
[38;2;248;248;242m Minus,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `=` and `+`.[0m
|
||||||
|
[38;2;248;248;242m Equal,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `[` and `{`.[0m
|
||||||
|
[38;2;248;248;242m LBracket,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `]` and `}`.[0m
|
||||||
|
[38;2;248;248;242m RBracket, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x30[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / `\` and `|`.[0m
|
||||||
|
[38;2;248;248;242m Bslash,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Non-US `#` and `~` (Typically near the Enter key).[0m
|
||||||
|
[38;2;248;248;242m NonUsHash,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `;` and `:`.[0m
|
||||||
|
[38;2;248;248;242m SColon,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `'` and `"`.[0m
|
||||||
|
[38;2;248;248;242m Quote,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m How to have ` as code?[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m \` and `~`.[0m
|
||||||
|
[38;2;248;248;242m Grave,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `,` and `<`.[0m
|
||||||
|
[38;2;248;248;242m Comma,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `.` and `>`.[0m
|
||||||
|
[38;2;248;248;242m Dot,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m `/` and `?`.[0m
|
||||||
|
[38;2;248;248;242m Slash,[0m
|
||||||
|
[38;2;248;248;242m CapsLock,[0m
|
||||||
|
[38;2;248;248;242m F1,[0m
|
||||||
|
[38;2;248;248;242m F2,[0m
|
||||||
|
[38;2;248;248;242m F3,[0m
|
||||||
|
[38;2;248;248;242m F4,[0m
|
||||||
|
[38;2;248;248;242m F5,[0m
|
||||||
|
[38;2;248;248;242m F6,[0m
|
||||||
|
[38;2;248;248;242m F7, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x40[0m
|
||||||
|
[38;2;248;248;242m F8,[0m
|
||||||
|
[38;2;248;248;242m F9,[0m
|
||||||
|
[38;2;248;248;242m F10,[0m
|
||||||
|
[38;2;248;248;242m F11,[0m
|
||||||
|
[38;2;248;248;242m F12,[0m
|
||||||
|
[38;2;248;248;242m PScreen,[0m
|
||||||
|
[38;2;248;248;242m ScrollLock,[0m
|
||||||
|
[38;2;248;248;242m Pause,[0m
|
||||||
|
[38;2;248;248;242m Insert,[0m
|
||||||
|
[38;2;248;248;242m Home,[0m
|
||||||
|
[38;2;248;248;242m PgUp,[0m
|
||||||
|
[38;2;248;248;242m Delete,[0m
|
||||||
|
[38;2;248;248;242m Endd,[0m
|
||||||
|
[38;2;248;248;242m PgDown,[0m
|
||||||
|
[38;2;248;248;242m Right,[0m
|
||||||
|
[38;2;248;248;242m Left, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x50[0m
|
||||||
|
[38;2;248;248;242m Down,[0m
|
||||||
|
[38;2;248;248;242m Up,[0m
|
||||||
|
[38;2;248;248;242m NumLock,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad `/`[0m
|
||||||
|
[38;2;248;248;242m KpSlash,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad `*`[0m
|
||||||
|
[38;2;248;248;242m KpAsterisk,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad `-`.[0m
|
||||||
|
[38;2;248;248;242m KpMinus,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad `+`.[0m
|
||||||
|
[38;2;248;248;242m KpPlus,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad enter.[0m
|
||||||
|
[38;2;248;248;242m KpEnter,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad 1.[0m
|
||||||
|
[38;2;248;248;242m Kp1,[0m
|
||||||
|
[38;2;248;248;242m Kp2,[0m
|
||||||
|
[38;2;248;248;242m Kp3,[0m
|
||||||
|
[38;2;248;248;242m Kp4,[0m
|
||||||
|
[38;2;248;248;242m Kp5,[0m
|
||||||
|
[38;2;248;248;242m Kp6,[0m
|
||||||
|
[38;2;248;248;242m Kp7,[0m
|
||||||
|
[38;2;248;248;242m Kp8, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x60[0m
|
||||||
|
[38;2;248;248;242m Kp9,[0m
|
||||||
|
[38;2;248;248;242m Kp0,[0m
|
||||||
|
[38;2;248;248;242m KpDot,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Non-US `\` and `|` (Typically near the Left-Shift key)[0m
|
||||||
|
[38;2;248;248;242m NonUsBslash,[0m
|
||||||
|
[38;2;248;248;242m Application, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x65[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / not a key, used for errors[0m
|
||||||
|
[38;2;248;248;242m Power,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Keypad `=`.[0m
|
||||||
|
[38;2;248;248;242m KpEqual,[0m
|
||||||
|
[38;2;248;248;242m F13,[0m
|
||||||
|
[38;2;248;248;242m F14,[0m
|
||||||
|
[38;2;248;248;242m F15,[0m
|
||||||
|
[38;2;248;248;242m F16,[0m
|
||||||
|
[38;2;248;248;242m F17,[0m
|
||||||
|
[38;2;248;248;242m F18,[0m
|
||||||
|
[38;2;248;248;242m F19,[0m
|
||||||
|
[38;2;248;248;242m F20,[0m
|
||||||
|
[38;2;248;248;242m F21, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x70[0m
|
||||||
|
[38;2;248;248;242m F22,[0m
|
||||||
|
[38;2;248;248;242m F23,[0m
|
||||||
|
[38;2;248;248;242m F24,[0m
|
||||||
|
[38;2;248;248;242m Execute,[0m
|
||||||
|
[38;2;248;248;242m Help,[0m
|
||||||
|
[38;2;248;248;242m Menu,[0m
|
||||||
|
[38;2;248;248;242m Selectt,[0m
|
||||||
|
[38;2;248;248;242m Stop,[0m
|
||||||
|
[38;2;248;248;242m Again,[0m
|
||||||
|
[38;2;248;248;242m Undo,[0m
|
||||||
|
[38;2;248;248;242m Cut,[0m
|
||||||
|
[38;2;248;248;242m Copy,[0m
|
||||||
|
[38;2;248;248;242m Paste,[0m
|
||||||
|
[38;2;248;248;242m Find,[0m
|
||||||
|
[38;2;248;248;242m Mute,[0m
|
||||||
|
[38;2;248;248;242m VolUp, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x80[0m
|
||||||
|
[38;2;248;248;242m VolDown,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Deprecated.[0m
|
||||||
|
[38;2;248;248;242m LockingCapsLock,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Deprecated.[0m
|
||||||
|
[38;2;248;248;242m LockingNumLock,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Deprecated.[0m
|
||||||
|
[38;2;248;248;242m LockingScrollLock,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / Keypad `,`, also used for the[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m brazilian keypad period (.) key.[0m
|
||||||
|
[38;2;248;248;242m KpComma,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Used on AS/400 keyboard[0m
|
||||||
|
[38;2;248;248;242m KpEqualSign,[0m
|
||||||
|
[38;2;248;248;242m Intl1,[0m
|
||||||
|
[38;2;248;248;242m Intl2,[0m
|
||||||
|
[38;2;248;248;242m Intl3,[0m
|
||||||
|
[38;2;248;248;242m Intl4,[0m
|
||||||
|
[38;2;248;248;242m Intl5,[0m
|
||||||
|
[38;2;248;248;242m Intl6,[0m
|
||||||
|
[38;2;248;248;242m Intl7,[0m
|
||||||
|
[38;2;248;248;242m Intl8,[0m
|
||||||
|
[38;2;248;248;242m Intl9,[0m
|
||||||
|
[38;2;248;248;242m Lang1, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0x90[0m
|
||||||
|
[38;2;248;248;242m Lang2,[0m
|
||||||
|
[38;2;248;248;242m Lang3,[0m
|
||||||
|
[38;2;248;248;242m Lang4,[0m
|
||||||
|
[38;2;248;248;242m Lang5,[0m
|
||||||
|
[38;2;248;248;242m Lang6,[0m
|
||||||
|
[38;2;248;248;242m Lang7,[0m
|
||||||
|
[38;2;248;248;242m Lang8,[0m
|
||||||
|
[38;2;248;248;242m Lang9,[0m
|
||||||
|
[38;2;248;248;242m AltErase,[0m
|
||||||
|
[38;2;248;248;242m SysReq,[0m
|
||||||
|
[38;2;248;248;242m Cancel,[0m
|
||||||
|
[38;2;248;248;242m Clear,[0m
|
||||||
|
[38;2;248;248;242m Prior,[0m
|
||||||
|
[38;2;248;248;242m Returnn,[0m
|
||||||
|
[38;2;248;248;242m Separator,[0m
|
||||||
|
[38;2;248;248;242m Outt, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0xA0[0m
|
||||||
|
[38;2;248;248;242m Oper,[0m
|
||||||
|
[38;2;248;248;242m ClearAgain,[0m
|
||||||
|
[38;2;248;248;242m CrSel,[0m
|
||||||
|
[38;2;248;248;242m ExSel,[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m According to QMK, 0xA5-0xDF are not[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m usable on modern keyboards[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Modifiers[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Left Control.[0m
|
||||||
|
[38;2;248;248;242m LCtrl, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m = 0xE0,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m / Left Shift.[0m
|
||||||
|
[38;2;248;248;242m LShift,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Left Alt.[0m
|
||||||
|
[38;2;248;248;242m LAlt,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Left GUI (the Windows key).[0m
|
||||||
|
[38;2;248;248;242m LGui,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Right Control.[0m
|
||||||
|
[38;2;248;248;242m RCtrl,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Right Shift.[0m
|
||||||
|
[38;2;248;248;242m RShift,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Right Alt (or Alt Gr). [0m
|
||||||
|
[38;2;248;248;242m RAlt,[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Right GUI (the Windows key).[0m
|
||||||
|
[38;2;248;248;242m RGui, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0xE7[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Unofficial[0m
|
||||||
|
[38;2;248;248;242m MediaPlayPause, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0xE8,[0m
|
||||||
|
[38;2;248;248;242m MediaStopCD,[0m
|
||||||
|
[38;2;248;248;242m MediaPreviousSong,[0m
|
||||||
|
[38;2;248;248;242m MediaNextSong,[0m
|
||||||
|
[38;2;248;248;242m MediaEjectCD,[0m
|
||||||
|
[38;2;248;248;242m MediaVolUp,[0m
|
||||||
|
[38;2;248;248;242m MediaVolDown,[0m
|
||||||
|
[38;2;248;248;242m MediaMute,[0m
|
||||||
|
[38;2;248;248;242m MediaWWW, [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0xF0[0m
|
||||||
|
[38;2;248;248;242m MediaBack,[0m
|
||||||
|
[38;2;248;248;242m MediaForward,[0m
|
||||||
|
[38;2;248;248;242m MediaStop,[0m
|
||||||
|
[38;2;248;248;242m MediaFind,[0m
|
||||||
|
[38;2;248;248;242m MediaScrollUp,[0m
|
||||||
|
[38;2;248;248;242m MediaScrollDown,[0m
|
||||||
|
[38;2;248;248;242m MediaEdit,[0m
|
||||||
|
[38;2;248;248;242m MediaSleep,[0m
|
||||||
|
[38;2;248;248;242m MediaCoffee,[0m
|
||||||
|
[38;2;248;248;242m MediaRefresh,[0m
|
||||||
|
[38;2;248;248;242m MediaCalc [0m[38;2;117;113;94m--[0m[38;2;117;113;94m 0xFB[0m
|
||||||
|
[38;2;248;248;242m );[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Action_Type [0m[38;2;249;38;114mis[0m[38;2;248;248;242m (Key, No_Op, Trans, Layer, Multiple_Actions);[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Should be a discriminated type[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Action [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114mrecord[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mT[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Action_Type; [0m[38;2;117;113;94m--[0m[38;2;117;113;94m hould be the discriminant[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mC[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Key_Code_T;[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mL[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Natural;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend record[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mKw[0m[38;2;248;248;242m (Code : Key_Code_T) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Action;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mLw[0m[38;2;248;248;242m (V : Natural) [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Action;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Key_Modifiers [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (Natural [0m[38;2;249;38;114mrange[0m[38;2;248;248;242m <>) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m USB.Device.HID.Keyboard.Modifiers;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Key_Codes_T [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m (Natural [0m[38;2;249;38;114mrange[0m[38;2;248;248;242m <>) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m Key_Code_T;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114msubtype[0m[38;2;248;248;242m Ac [0m[38;2;249;38;114mis[0m[38;2;248;248;242m Action;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Layout [0m[38;2;249;38;114mis[0m[38;2;248;248;242m [0m[38;2;249;38;114marray[0m[38;2;248;248;242m ([0m[38;2;190;132;255m0[0m[38;2;248;248;242m .. Num_Layers - [0m[38;2;190;132;255m1[0m[38;2;248;248;242m, RowR, ColR) [0m[38;2;249;38;114mof[0m[38;2;248;248;242m Action;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mRegister_Events[0m[38;2;248;248;242m (L : Layout; Es : Events);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mTick[0m[38;2;248;248;242m (L : Layout);[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Key_Codes[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Key_Codes_T;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfunction[0m[38;2;248;248;242m [0m[38;2;166;226;46mGet_Modifiers[0m[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m Key_Modifiers;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mprocedure[0m[38;2;248;248;242m [0m[38;2;166;226;46mInit[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mClick[0m[38;2;248;248;242m;[0m
|
29
tests/syntax-tests/highlighted/Ada/click.gpr
vendored
Normal file
29
tests/syntax-tests/highlighted/Ada/click.gpr
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[38;2;249;38;114mwith[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mconfig/click_config.gpr[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242mproject Click [0m[38;2;249;38;114mis[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Library_Name [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mClick[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Library_Version [0m[38;2;249;38;114muse[0m[38;2;248;248;242m Project'Library_Name & [0m[38;2;230;219;116m"[0m[38;2;230;219;116m.so.[0m[38;2;230;219;116m"[0m[38;2;248;248;242m & Click_Config.Crate_Version;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Source_Dirs [0m[38;2;249;38;114muse[0m[38;2;248;248;242m ([0m[38;2;230;219;116m"[0m[38;2;230;219;116msrc/[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mconfig/[0m[38;2;230;219;116m"[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Object_Dir [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mobj/[0m[38;2;230;219;116m"[0m[38;2;248;248;242m & Click_Config.Build_Profile;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Create_Missing_Dirs [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mTrue[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Library_Dir [0m[38;2;249;38;114muse[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mlib[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mtype[0m[38;2;248;248;242m Library_Type_Type [0m[38;2;249;38;114mis[0m[38;2;248;248;242m ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mrelocatable[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mstatic[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mstatic-pic[0m[38;2;230;219;116m"[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;249;38;114m [0m[38;2;166;226;46mLibrary_Type[0m[38;2;249;38;114m :[0m[38;2;248;248;242m Library_Type_Type :=[0m
|
||||||
|
[38;2;248;248;242m external ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mCLICK_LIBRARY_TYPE[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, external ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mLIBRARY_TYPE[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116mstatic[0m[38;2;230;219;116m"[0m[38;2;248;248;242m));[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Library_Kind [0m[38;2;249;38;114muse[0m[38;2;248;248;242m Library_Type;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mCompiler[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Default_Switches ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mAda[0m[38;2;230;219;116m"[0m[38;2;248;248;242m) [0m[38;2;249;38;114muse[0m[38;2;248;248;242m Click_Config.Ada_Compiler_Switches & ([0m[38;2;230;219;116m"[0m[38;2;230;219;116m-gnatX[0m[38;2;230;219;116m"[0m[38;2;248;248;242m, [0m[38;2;230;219;116m"[0m[38;2;230;219;116m-gnat2022[0m[38;2;230;219;116m"[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mCompiler[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mBinder[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Switches ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mAda[0m[38;2;230;219;116m"[0m[38;2;248;248;242m) [0m[38;2;249;38;114muse[0m[38;2;248;248;242m ([0m[38;2;230;219;116m"[0m[38;2;230;219;116m-Es[0m[38;2;230;219;116m"[0m[38;2;248;248;242m); [0m[38;2;117;113;94m--[0m[38;2;117;113;94m Symbolic traceback[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mBinder[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mpackage[0m[38;2;248;248;242m [0m[38;2;166;226;46mInstall[0m[38;2;248;248;242m [0m[38;2;249;38;114mis[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mfor[0m[38;2;248;248;242m Artifacts ([0m[38;2;230;219;116m"[0m[38;2;230;219;116m.[0m[38;2;230;219;116m"[0m[38;2;248;248;242m) [0m[38;2;249;38;114muse[0m[38;2;248;248;242m ([0m[38;2;230;219;116m"[0m[38;2;230;219;116mshare[0m[38;2;230;219;116m"[0m[38;2;248;248;242m);[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mInstall[0m[38;2;248;248;242m;[0m
|
||||||
|
|
||||||
|
[38;2;249;38;114mend[0m[38;2;248;248;242m [0m[38;2;166;226;46mClick[0m[38;2;248;248;242m;[0m
|
23
tests/syntax-tests/source/Ada/LICENSE.md
vendored
Normal file
23
tests/syntax-tests/source/Ada/LICENSE.md
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
The files `click.adb`, `click.ads` and `click.gpr` have been added from https://github.com/dkm/click under the following license:
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Marc Poulhiès <dkm@kataplop.net>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
308
tests/syntax-tests/source/Ada/click.adb
vendored
Normal file
308
tests/syntax-tests/source/Ada/click.adb
vendored
Normal file
@ -0,0 +1,308 @@
|
|||||||
|
with Chests.Ring_Buffers;
|
||||||
|
with USB.Device.HID.Keyboard;
|
||||||
|
|
||||||
|
package body Click is
|
||||||
|
----------------
|
||||||
|
-- DEBOUNCE --
|
||||||
|
----------------
|
||||||
|
|
||||||
|
-- Ideally, in a separate package.
|
||||||
|
|
||||||
|
-- should be [], but not fixed yet in GCC 11.
|
||||||
|
Current_Status : Key_Matrix := [others => [others => False]];
|
||||||
|
New_Status : Key_Matrix := [others => [others => False]];
|
||||||
|
Since : Natural := 0;
|
||||||
|
-- Nb_Bounce : Natural := 5;
|
||||||
|
|
||||||
|
function Update (NewS : Key_Matrix) return Boolean is
|
||||||
|
begin
|
||||||
|
-- The new state is the same as the current stable state => Do nothing.
|
||||||
|
if Current_Status = NewS then
|
||||||
|
Since := 0;
|
||||||
|
return False;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
if New_Status /= NewS then
|
||||||
|
-- The new state differs from the previous
|
||||||
|
-- new state (bouncing) => reset
|
||||||
|
New_Status := NewS;
|
||||||
|
Since := 1;
|
||||||
|
else
|
||||||
|
-- The new state hasn't changed since last
|
||||||
|
-- update => towards stabilization.
|
||||||
|
Since := Since + 1;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
if Since > Nb_Bounce then
|
||||||
|
declare
|
||||||
|
Tmp : constant Key_Matrix := Current_Status;
|
||||||
|
begin
|
||||||
|
-- New state has been stable enough.
|
||||||
|
-- Latch it and notifies caller.
|
||||||
|
Current_Status := New_Status;
|
||||||
|
New_Status := Tmp;
|
||||||
|
Since := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
return True;
|
||||||
|
else
|
||||||
|
-- Not there yet
|
||||||
|
return False;
|
||||||
|
end if;
|
||||||
|
end Update;
|
||||||
|
|
||||||
|
procedure Get_Matrix;
|
||||||
|
-- Could use := []; but GNAT 12 has a bug (fixed in upcoming 13)
|
||||||
|
Read_Status : Key_Matrix := [others => [others => False]];
|
||||||
|
|
||||||
|
function Get_Events return Events is
|
||||||
|
Num_Evt : Natural := 0;
|
||||||
|
New_S : Key_Matrix renames Read_Status;
|
||||||
|
begin
|
||||||
|
Get_Matrix;
|
||||||
|
if Update (New_S) then
|
||||||
|
for I in Current_Status'Range (1) loop
|
||||||
|
for J in Current_Status'Range (2) loop
|
||||||
|
if (not New_Status (I, J) and then Current_Status (I, J))
|
||||||
|
or else (New_Status (I, J) and then not Current_Status (I, J))
|
||||||
|
then
|
||||||
|
Num_Evt := Num_Evt + 1;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
declare
|
||||||
|
Evts : Events (Natural range 1 .. Num_Evt);
|
||||||
|
Cursor : Natural range 1 .. Num_Evt + 1 := 1;
|
||||||
|
begin
|
||||||
|
for I in Current_Status'Range (1) loop
|
||||||
|
for J in Current_Status'Range (2) loop
|
||||||
|
if not New_Status (I, J)
|
||||||
|
and then Current_Status (I, J)
|
||||||
|
then
|
||||||
|
-- Pressing I, J
|
||||||
|
Evts (Cursor) := [
|
||||||
|
Evt => Press,
|
||||||
|
Col => I,
|
||||||
|
Row => J
|
||||||
|
];
|
||||||
|
Cursor := Cursor + 1;
|
||||||
|
elsif New_Status (I, J)
|
||||||
|
and then not Current_Status (I, J)
|
||||||
|
then
|
||||||
|
-- Release I, J
|
||||||
|
Evts (Cursor) := [
|
||||||
|
Evt => Release,
|
||||||
|
Col => I,
|
||||||
|
Row => J
|
||||||
|
];
|
||||||
|
Cursor := Cursor + 1;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
end loop;
|
||||||
|
return Evts;
|
||||||
|
end;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
return [];
|
||||||
|
end Get_Events;
|
||||||
|
|
||||||
|
procedure Get_Matrix is -- return Key_Matrix is
|
||||||
|
begin
|
||||||
|
for Row in Keys.Rows'Range loop
|
||||||
|
Keys.Rows (Row).Clear;
|
||||||
|
|
||||||
|
for Col in Keys.Cols'Range loop
|
||||||
|
Read_Status (Col, Row) := not Keys.Cols (Col).Set;
|
||||||
|
end loop;
|
||||||
|
Keys.Rows (Row).Set;
|
||||||
|
end loop;
|
||||||
|
end Get_Matrix;
|
||||||
|
|
||||||
|
-- End of DEBOUNCE
|
||||||
|
|
||||||
|
--------------
|
||||||
|
-- Layout --
|
||||||
|
--------------
|
||||||
|
|
||||||
|
package Events_Ring_Buffers is new Chests.Ring_Buffers
|
||||||
|
(Element_Type => Event,
|
||||||
|
Capacity => 16);
|
||||||
|
|
||||||
|
Queued_Events : Events_Ring_Buffers.Ring_Buffer;
|
||||||
|
|
||||||
|
type Statet is (Normal_Key, Layer_Mod, None);
|
||||||
|
type State is record
|
||||||
|
Typ : Statet;
|
||||||
|
Code : Key_Code_T;
|
||||||
|
Layer_Value : Natural;
|
||||||
|
-- Col : ColR;
|
||||||
|
-- Row : RowR;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
type State_Array is array (ColR, RowR) of State;
|
||||||
|
States : State_Array := [others => [others => (Typ => None, Code => No, Layer_Value => 0)]];
|
||||||
|
|
||||||
|
function Kw (Code : Key_Code_T) return Action is
|
||||||
|
begin
|
||||||
|
return (T => Key, C => Code, L => 0);
|
||||||
|
end Kw;
|
||||||
|
|
||||||
|
function Lw (V : Natural) return Action is
|
||||||
|
begin
|
||||||
|
return (T => Layer, C => No, L => V);
|
||||||
|
end Lw;
|
||||||
|
|
||||||
|
-- FIXME: hardcoded max number of events
|
||||||
|
subtype Events_Range is Natural range 0 .. 60;
|
||||||
|
type Array_Of_Reg_Events is array (Events_Range) of Event;
|
||||||
|
|
||||||
|
Stamp : Natural := 0;
|
||||||
|
|
||||||
|
procedure Register_Events (L : Layout; Es : Events) is
|
||||||
|
begin
|
||||||
|
Stamp := Stamp + 1;
|
||||||
|
|
||||||
|
Log ("Reg events: " & Stamp'Image);
|
||||||
|
Log (Es'Length'Image);
|
||||||
|
for E of Es loop
|
||||||
|
declare
|
||||||
|
begin
|
||||||
|
if Events_Ring_Buffers.Is_Full (Queued_Events) then
|
||||||
|
raise Program_Error;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
Events_Ring_Buffers.Append (Queued_Events, E);
|
||||||
|
end;
|
||||||
|
-- Log ("Reg'ed events:" & Events_Mark'Image);
|
||||||
|
Log ("Reg'ed events:" & Events_Ring_Buffers.Length (Queued_Events)'Image);
|
||||||
|
end loop;
|
||||||
|
end Register_Events;
|
||||||
|
|
||||||
|
procedure Release (Col: Colr; Row: Rowr) is
|
||||||
|
begin
|
||||||
|
if States (Col, Row).Typ = None then
|
||||||
|
raise Program_Error;
|
||||||
|
end if;
|
||||||
|
States (Col, Row) := (Typ => None, Code => No, Layer_Value => 0);
|
||||||
|
end Release;
|
||||||
|
|
||||||
|
function Get_Current_Layer return Natural is
|
||||||
|
L : Natural := 0;
|
||||||
|
begin
|
||||||
|
for S of States loop
|
||||||
|
if S.Typ = Layer_Mod then
|
||||||
|
L := L + S.Layer_Value;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
return L;
|
||||||
|
end Get_Current_Layer;
|
||||||
|
|
||||||
|
-- Tick the event.
|
||||||
|
-- Returns TRUE if it needs to stay in the queued events
|
||||||
|
-- FALSE if the event has been consumed.
|
||||||
|
|
||||||
|
function Tick (L: Layout; E : in out Event) return Boolean is
|
||||||
|
Current_Layer : Natural := Get_Current_Layer;
|
||||||
|
A : Action renames L (Current_Layer, E.Row, E.Col);
|
||||||
|
begin
|
||||||
|
case E.Evt is
|
||||||
|
when Press =>
|
||||||
|
case A.T is
|
||||||
|
when Key =>
|
||||||
|
States (E.Col, E.Row) :=
|
||||||
|
(Typ => Normal_Key,
|
||||||
|
Code => A.C,
|
||||||
|
Layer_Value => 0);
|
||||||
|
when Layer =>
|
||||||
|
States (E.Col, E.Row) := (Typ => Layer_Mod, Layer_Value => A.L, Code => No);
|
||||||
|
when others =>
|
||||||
|
raise Program_Error;
|
||||||
|
end case;
|
||||||
|
|
||||||
|
when Release =>
|
||||||
|
Release (E.Col, E.Row);
|
||||||
|
end case;
|
||||||
|
return False;
|
||||||
|
end Tick;
|
||||||
|
|
||||||
|
Last_Was_Empty_Log : Boolean := False;
|
||||||
|
|
||||||
|
procedure Tick (L : Layout) is
|
||||||
|
begin
|
||||||
|
for I in 1 .. Events_Ring_Buffers.Length(Queued_Events) loop
|
||||||
|
declare
|
||||||
|
E : Event := Events_Ring_Buffers.Last_Element (Queued_Events);
|
||||||
|
begin
|
||||||
|
Events_Ring_Buffers.Delete_Last (Queued_Events);
|
||||||
|
if Tick (L, E) then
|
||||||
|
Events_Ring_Buffers.Prepend (Queued_Events, E);
|
||||||
|
end if;
|
||||||
|
end;
|
||||||
|
end loop;
|
||||||
|
if not Last_Was_Empty_Log or else Events_Ring_Buffers.Length(Queued_Events) /= 0 then
|
||||||
|
Log ("End Tick layout, events: " & Events_Ring_Buffers.Length(Queued_Events)'Image);
|
||||||
|
Last_Was_Empty_Log := Events_Ring_Buffers.Length(Queued_Events) = 0;
|
||||||
|
end if;
|
||||||
|
end Tick;
|
||||||
|
|
||||||
|
function Get_Key_Codes return Key_Codes_T is
|
||||||
|
Codes : Key_Codes_T (0 .. 10);
|
||||||
|
Wm: Natural := 0;
|
||||||
|
begin
|
||||||
|
for S of States loop
|
||||||
|
if S.Typ = Normal_Key and then
|
||||||
|
(S.Code < LCtrl or else S.Code > RGui)
|
||||||
|
then
|
||||||
|
Codes (Wm) := S.Code;
|
||||||
|
Wm := Wm + 1;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
if Wm = 0 then
|
||||||
|
return [];
|
||||||
|
else
|
||||||
|
return Codes (0 .. Wm - 1);
|
||||||
|
end if;
|
||||||
|
end Get_Key_Codes;
|
||||||
|
|
||||||
|
function Get_Modifiers return Key_Modifiers is
|
||||||
|
use USB.Device.HID.Keyboard;
|
||||||
|
KM : Key_Modifiers (1..8);
|
||||||
|
I : Natural := 0;
|
||||||
|
begin
|
||||||
|
for S of States loop
|
||||||
|
if S.Typ = Normal_Key then
|
||||||
|
I := I + 1;
|
||||||
|
case S.Code is
|
||||||
|
when LCtrl =>
|
||||||
|
KM(I) := Ctrl_Left;
|
||||||
|
when RCtrl =>
|
||||||
|
KM(I) := Ctrl_Right;
|
||||||
|
when LShift =>
|
||||||
|
KM(I) := Shift_Left;
|
||||||
|
when RShift =>
|
||||||
|
KM(I) := Shift_Right;
|
||||||
|
when LAlt =>
|
||||||
|
KM(I) := Alt_Left;
|
||||||
|
when RAlt =>
|
||||||
|
KM(I) := Alt_Right;
|
||||||
|
when LGui =>
|
||||||
|
KM(I) := Meta_Left;
|
||||||
|
when RGui =>
|
||||||
|
KM(I) := Meta_Right;
|
||||||
|
when others =>
|
||||||
|
I := I - 1;
|
||||||
|
end case;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
return KM (1..I);
|
||||||
|
end Get_Modifiers;
|
||||||
|
|
||||||
|
procedure Init is
|
||||||
|
begin
|
||||||
|
Events_Ring_Buffers.Clear (Queued_Events);
|
||||||
|
end Init;
|
||||||
|
|
||||||
|
end Click;
|
339
tests/syntax-tests/source/Ada/click.ads
vendored
Normal file
339
tests/syntax-tests/source/Ada/click.ads
vendored
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
with HAL.GPIO;
|
||||||
|
with USB.Device.HID.Keyboard;
|
||||||
|
|
||||||
|
generic
|
||||||
|
Nb_Bounce : Natural;
|
||||||
|
type ColR is (<>);
|
||||||
|
type RowR is (<>);
|
||||||
|
|
||||||
|
type GPIOP is new HAL.GPIO.GPIO_Point with private;
|
||||||
|
|
||||||
|
type Cols_T is array (ColR) of GPIOP;
|
||||||
|
type Rows_T is array (RowR) of GPIOP;
|
||||||
|
|
||||||
|
Cols : Cols_T;
|
||||||
|
Rows : Rows_T;
|
||||||
|
Num_Layers : Natural;
|
||||||
|
|
||||||
|
with procedure Log (S : String; L : Integer := 1; Deindent : Integer := 0);
|
||||||
|
package Click is
|
||||||
|
|
||||||
|
type Keys_T is record
|
||||||
|
Cols : Cols_T;
|
||||||
|
Rows : Rows_T;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
Keys : Keys_T :=
|
||||||
|
(Rows => Rows, Cols => Cols);
|
||||||
|
|
||||||
|
type Key_Matrix is array (ColR, RowR) of Boolean;
|
||||||
|
|
||||||
|
--------------------------
|
||||||
|
-- Events & Debouncing --
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
MaxEvents : constant Positive := 20;
|
||||||
|
|
||||||
|
type EventT is (Press, Release);
|
||||||
|
type Event is record
|
||||||
|
Evt : EventT;
|
||||||
|
Col : ColR;
|
||||||
|
Row : RowR;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
type Events is array (Natural range <>) of Event;
|
||||||
|
|
||||||
|
function Get_Events return Events;
|
||||||
|
function Update (NewS : Key_Matrix) return Boolean;
|
||||||
|
|
||||||
|
-------------
|
||||||
|
-- Layout --
|
||||||
|
-------------
|
||||||
|
---------------
|
||||||
|
-- Keycodes --
|
||||||
|
---------------
|
||||||
|
|
||||||
|
-- Keycodes copy/pasted from the excelent Keyberon Rust firmware:
|
||||||
|
-- https://github.com/TeXitoi/keyberon/
|
||||||
|
|
||||||
|
type Key_Code_T is
|
||||||
|
(
|
||||||
|
-- The "no" key, a placeholder to express nothing.
|
||||||
|
No, -- = 0x00,
|
||||||
|
-- / Error if too much keys are pressed at
|
||||||
|
-- the same time.
|
||||||
|
ErrorRollOver,
|
||||||
|
-- / The POST fail error.
|
||||||
|
PostFail,
|
||||||
|
-- / An undefined error occured.
|
||||||
|
ErrorUndefined,
|
||||||
|
-- / `a` and `A`.
|
||||||
|
A,
|
||||||
|
B,
|
||||||
|
C,
|
||||||
|
D,
|
||||||
|
E,
|
||||||
|
F,
|
||||||
|
G,
|
||||||
|
H,
|
||||||
|
I,
|
||||||
|
J,
|
||||||
|
K,
|
||||||
|
L,
|
||||||
|
M, -- 0x10
|
||||||
|
N,
|
||||||
|
O,
|
||||||
|
P,
|
||||||
|
Q,
|
||||||
|
R,
|
||||||
|
S,
|
||||||
|
T,
|
||||||
|
U,
|
||||||
|
V,
|
||||||
|
W,
|
||||||
|
X,
|
||||||
|
Y,
|
||||||
|
Z,
|
||||||
|
-- `1` and `!`.
|
||||||
|
Kb1,
|
||||||
|
-- `2` and `@`.
|
||||||
|
Kb2,
|
||||||
|
-- `3` and `#`.
|
||||||
|
Kb3, -- 0x20
|
||||||
|
-- / `4` and `$`.
|
||||||
|
Kb4,
|
||||||
|
-- `5` and `%`.
|
||||||
|
Kb5,
|
||||||
|
-- `6` and `^`.
|
||||||
|
Kb6,
|
||||||
|
-- `7` and `&`.
|
||||||
|
Kb7,
|
||||||
|
-- `8` and `*`.
|
||||||
|
Kb8,
|
||||||
|
-- `9` and `(`.
|
||||||
|
Kb9,
|
||||||
|
-- `0` and `)`.
|
||||||
|
Kb0,
|
||||||
|
Enter,
|
||||||
|
Escape,
|
||||||
|
BSpace,
|
||||||
|
Tab,
|
||||||
|
Space,
|
||||||
|
-- `-` and `_`.
|
||||||
|
Minus,
|
||||||
|
-- `=` and `+`.
|
||||||
|
Equal,
|
||||||
|
-- `[` and `{`.
|
||||||
|
LBracket,
|
||||||
|
-- `]` and `}`.
|
||||||
|
RBracket, -- 0x30
|
||||||
|
-- / `\` and `|`.
|
||||||
|
Bslash,
|
||||||
|
-- Non-US `#` and `~` (Typically near the Enter key).
|
||||||
|
NonUsHash,
|
||||||
|
-- `;` and `:`.
|
||||||
|
SColon,
|
||||||
|
-- `'` and `"`.
|
||||||
|
Quote,
|
||||||
|
-- How to have ` as code?
|
||||||
|
-- \` and `~`.
|
||||||
|
Grave,
|
||||||
|
-- `,` and `<`.
|
||||||
|
Comma,
|
||||||
|
-- `.` and `>`.
|
||||||
|
Dot,
|
||||||
|
-- `/` and `?`.
|
||||||
|
Slash,
|
||||||
|
CapsLock,
|
||||||
|
F1,
|
||||||
|
F2,
|
||||||
|
F3,
|
||||||
|
F4,
|
||||||
|
F5,
|
||||||
|
F6,
|
||||||
|
F7, -- 0x40
|
||||||
|
F8,
|
||||||
|
F9,
|
||||||
|
F10,
|
||||||
|
F11,
|
||||||
|
F12,
|
||||||
|
PScreen,
|
||||||
|
ScrollLock,
|
||||||
|
Pause,
|
||||||
|
Insert,
|
||||||
|
Home,
|
||||||
|
PgUp,
|
||||||
|
Delete,
|
||||||
|
Endd,
|
||||||
|
PgDown,
|
||||||
|
Right,
|
||||||
|
Left, -- 0x50
|
||||||
|
Down,
|
||||||
|
Up,
|
||||||
|
NumLock,
|
||||||
|
-- Keypad `/`
|
||||||
|
KpSlash,
|
||||||
|
-- Keypad `*`
|
||||||
|
KpAsterisk,
|
||||||
|
-- Keypad `-`.
|
||||||
|
KpMinus,
|
||||||
|
-- Keypad `+`.
|
||||||
|
KpPlus,
|
||||||
|
-- Keypad enter.
|
||||||
|
KpEnter,
|
||||||
|
-- Keypad 1.
|
||||||
|
Kp1,
|
||||||
|
Kp2,
|
||||||
|
Kp3,
|
||||||
|
Kp4,
|
||||||
|
Kp5,
|
||||||
|
Kp6,
|
||||||
|
Kp7,
|
||||||
|
Kp8, -- 0x60
|
||||||
|
Kp9,
|
||||||
|
Kp0,
|
||||||
|
KpDot,
|
||||||
|
-- Non-US `\` and `|` (Typically near the Left-Shift key)
|
||||||
|
NonUsBslash,
|
||||||
|
Application, -- 0x65
|
||||||
|
-- / not a key, used for errors
|
||||||
|
Power,
|
||||||
|
-- Keypad `=`.
|
||||||
|
KpEqual,
|
||||||
|
F13,
|
||||||
|
F14,
|
||||||
|
F15,
|
||||||
|
F16,
|
||||||
|
F17,
|
||||||
|
F18,
|
||||||
|
F19,
|
||||||
|
F20,
|
||||||
|
F21, -- 0x70
|
||||||
|
F22,
|
||||||
|
F23,
|
||||||
|
F24,
|
||||||
|
Execute,
|
||||||
|
Help,
|
||||||
|
Menu,
|
||||||
|
Selectt,
|
||||||
|
Stop,
|
||||||
|
Again,
|
||||||
|
Undo,
|
||||||
|
Cut,
|
||||||
|
Copy,
|
||||||
|
Paste,
|
||||||
|
Find,
|
||||||
|
Mute,
|
||||||
|
VolUp, -- 0x80
|
||||||
|
VolDown,
|
||||||
|
-- Deprecated.
|
||||||
|
LockingCapsLock,
|
||||||
|
-- Deprecated.
|
||||||
|
LockingNumLock,
|
||||||
|
-- Deprecated.
|
||||||
|
LockingScrollLock,
|
||||||
|
-- / Keypad `,`, also used for the
|
||||||
|
-- brazilian keypad period (.) key.
|
||||||
|
KpComma,
|
||||||
|
-- Used on AS/400 keyboard
|
||||||
|
KpEqualSign,
|
||||||
|
Intl1,
|
||||||
|
Intl2,
|
||||||
|
Intl3,
|
||||||
|
Intl4,
|
||||||
|
Intl5,
|
||||||
|
Intl6,
|
||||||
|
Intl7,
|
||||||
|
Intl8,
|
||||||
|
Intl9,
|
||||||
|
Lang1, -- 0x90
|
||||||
|
Lang2,
|
||||||
|
Lang3,
|
||||||
|
Lang4,
|
||||||
|
Lang5,
|
||||||
|
Lang6,
|
||||||
|
Lang7,
|
||||||
|
Lang8,
|
||||||
|
Lang9,
|
||||||
|
AltErase,
|
||||||
|
SysReq,
|
||||||
|
Cancel,
|
||||||
|
Clear,
|
||||||
|
Prior,
|
||||||
|
Returnn,
|
||||||
|
Separator,
|
||||||
|
Outt, -- 0xA0
|
||||||
|
Oper,
|
||||||
|
ClearAgain,
|
||||||
|
CrSel,
|
||||||
|
ExSel,
|
||||||
|
|
||||||
|
-- According to QMK, 0xA5-0xDF are not
|
||||||
|
-- usable on modern keyboards
|
||||||
|
|
||||||
|
-- Modifiers
|
||||||
|
-- Left Control.
|
||||||
|
LCtrl, -- = 0xE0,
|
||||||
|
-- / Left Shift.
|
||||||
|
LShift,
|
||||||
|
-- Left Alt.
|
||||||
|
LAlt,
|
||||||
|
-- Left GUI (the Windows key).
|
||||||
|
LGui,
|
||||||
|
-- Right Control.
|
||||||
|
RCtrl,
|
||||||
|
-- Right Shift.
|
||||||
|
RShift,
|
||||||
|
-- Right Alt (or Alt Gr).
|
||||||
|
RAlt,
|
||||||
|
-- Right GUI (the Windows key).
|
||||||
|
RGui, -- 0xE7
|
||||||
|
|
||||||
|
-- Unofficial
|
||||||
|
MediaPlayPause, -- 0xE8,
|
||||||
|
MediaStopCD,
|
||||||
|
MediaPreviousSong,
|
||||||
|
MediaNextSong,
|
||||||
|
MediaEjectCD,
|
||||||
|
MediaVolUp,
|
||||||
|
MediaVolDown,
|
||||||
|
MediaMute,
|
||||||
|
MediaWWW, -- 0xF0
|
||||||
|
MediaBack,
|
||||||
|
MediaForward,
|
||||||
|
MediaStop,
|
||||||
|
MediaFind,
|
||||||
|
MediaScrollUp,
|
||||||
|
MediaScrollDown,
|
||||||
|
MediaEdit,
|
||||||
|
MediaSleep,
|
||||||
|
MediaCoffee,
|
||||||
|
MediaRefresh,
|
||||||
|
MediaCalc -- 0xFB
|
||||||
|
);
|
||||||
|
|
||||||
|
type Action_Type is (Key, No_Op, Trans, Layer, Multiple_Actions);
|
||||||
|
|
||||||
|
-- Should be a discriminated type
|
||||||
|
type Action is record
|
||||||
|
T : Action_Type; -- hould be the discriminant
|
||||||
|
C : Key_Code_T;
|
||||||
|
L : Natural;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
function Kw (Code : Key_Code_T) return Action;
|
||||||
|
function Lw (V : Natural) return Action;
|
||||||
|
|
||||||
|
type Key_Modifiers is array (Natural range <>) of USB.Device.HID.Keyboard.Modifiers;
|
||||||
|
|
||||||
|
type Key_Codes_T is array (Natural range <>) of Key_Code_T;
|
||||||
|
|
||||||
|
subtype Ac is Action;
|
||||||
|
type Layout is array (0 .. Num_Layers - 1, RowR, ColR) of Action;
|
||||||
|
procedure Register_Events (L : Layout; Es : Events);
|
||||||
|
procedure Tick (L : Layout);
|
||||||
|
|
||||||
|
function Get_Key_Codes return Key_Codes_T;
|
||||||
|
function Get_Modifiers return Key_Modifiers;
|
||||||
|
procedure Init;
|
||||||
|
end Click;
|
29
tests/syntax-tests/source/Ada/click.gpr
vendored
Normal file
29
tests/syntax-tests/source/Ada/click.gpr
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
with "config/click_config.gpr";
|
||||||
|
project Click is
|
||||||
|
|
||||||
|
for Library_Name use "Click";
|
||||||
|
for Library_Version use Project'Library_Name & ".so." & Click_Config.Crate_Version;
|
||||||
|
|
||||||
|
for Source_Dirs use ("src/", "config/");
|
||||||
|
for Object_Dir use "obj/" & Click_Config.Build_Profile;
|
||||||
|
for Create_Missing_Dirs use "True";
|
||||||
|
for Library_Dir use "lib";
|
||||||
|
|
||||||
|
type Library_Type_Type is ("relocatable", "static", "static-pic");
|
||||||
|
Library_Type : Library_Type_Type :=
|
||||||
|
external ("CLICK_LIBRARY_TYPE", external ("LIBRARY_TYPE", "static"));
|
||||||
|
for Library_Kind use Library_Type;
|
||||||
|
|
||||||
|
package Compiler is
|
||||||
|
for Default_Switches ("Ada") use Click_Config.Ada_Compiler_Switches & ("-gnatX", "-gnat2022");
|
||||||
|
end Compiler;
|
||||||
|
|
||||||
|
package Binder is
|
||||||
|
for Switches ("Ada") use ("-Es"); -- Symbolic traceback
|
||||||
|
end Binder;
|
||||||
|
|
||||||
|
package Install is
|
||||||
|
for Artifacts (".") use ("share");
|
||||||
|
end Install;
|
||||||
|
|
||||||
|
end Click;
|
Loading…
Reference in New Issue
Block a user