Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
decode: move "{keymap/*. => lib/core-decode.*-}rlfunc.txt" and clean …
…up files
- Loading branch information
1 parent
e130619
commit f7323b4
Showing
19 changed files
with
265 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
-x md:bash --exclude=./out --exclude=./dist --exclude=./a.sh --exclude=./test/install --exclude=./ble.sh ble-syntax-ctx.def keymap/*.rlfunc.txt ble.pp blerc | ||
|
||
-x md:bash --exclude=./out --exclude=./dist --exclude=./a.sh --exclude=./test/install --exclude=./ble.sh | ||
GNUmakefile | ||
ble.pp | ||
blerc | ||
lib/core-syntax-ctx.def | ||
lib/core-decode.*-rlfunc.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# unbind all "C-x ?" | ||
for second in e g {A..Z} '\C-'{e,g,r,u,v,x,'?'} '!' '$' '(' ')' '*' '/' '@' '~'; do | ||
bind -r '\C-x'"$second" | ||
done | ||
|
||
bind -x '"\C-x\C-x":echo XX' | ||
bind -r '\C-x\C-x' | ||
|
||
bind -x '"\C-x":echo X' | ||
bind -x '"\C-b":echo B' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# unbind all "C-x ?" | ||
for second in e g {A..Z} '\C-'{e,g,r,u,v,x,'?'} '!' '$' '(' ')' '*' '/' '@' '~'; do | ||
bind -r '\C-x'"$second" | ||
done | ||
|
||
# bash-4.2 以下で以下の様にすると vi で C-x を受信できなくなってしまう。 | ||
bind -x '"\C-x\C-x":echo XX' | ||
bind -r '\C-x\C-x' | ||
set -o vi | ||
bind -x '"\C-x":echo X' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "----------" | ||
echo "locale" | ||
locale | ||
|
||
echo "----------" | ||
echo "test regex (default locale)" | ||
|
||
rex='^"([^\"]|\\.)*$' | ||
[[ $'"\x9B": self-insert' =~ $rex ]] | ||
echo "$? (${BASH_REMATCH[*]@Q})" | ||
|
||
echo "----------" | ||
echo "test regex (locale C)" | ||
|
||
LC_ALL=C | ||
[[ $'"\x9B": self-insert' =~ $rex ]] | ||
echo "$? (${BASH_REMATCH[*]@Q})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
|
||
bash44_traverse=1 | ||
|
||
function user-debug-handler { | ||
local caller=${FUNCNAME[1]} | ||
[[ $caller == ble-debug-handler ]] && | ||
caller=${FUNCNAME[2]} | ||
echo "trap($*):$caller: $BASH_COMMAND" | ||
} | ||
|
||
# * 4.4 以降では最初に DEBUG を設定した関数呼び出しレベルを書き換える? | ||
# 否、関数終了時に上書きする様にしたら良いという事の気がする。 | ||
# * 関数を一つ上がったら trap handler を削除 | ||
# * trap handler が全てなくなったら解除 | ||
# ? yes: 内側の関数で活性化した時に外側の関数でもちゃんと DEBUG trap が発動 | ||
# するのだろうか。 | ||
|
||
_debug_trap_handlers=() | ||
function ble/trap-debug { | ||
local depth=$((${#FUNCNAME[@]}-2)) | ||
if [[ $1 != - ]]; then | ||
_debug_trap_handlers[depth]=$1 | ||
|
||
# 再活性化 (extdebug/functrace が設定されていなければ、 | ||
# 設定を行った関数呼び出しレベルでしか DEBUG trap は発生しない)。 | ||
builtin trap ble-debug-handler DEBUG | ||
else | ||
unset '_debug_trap_handlers[depth]' | ||
fi | ||
} | ||
function ble-debug-handler { | ||
local depth=$((${#FUNCNAME[@]}-1)) | ||
[[ $_ble_trap_suppress || ${FUNCNAME[1]} == trap ]] && return 0 | ||
#echo "ble-debug-handler" | ||
for ((;depth>=0;depth--)); do | ||
local handler=${_debug_trap_handlers[depth]-} | ||
[[ $handler ]] || continue | ||
eval "$handler" | ||
return "$?" | ||
done | ||
} | ||
function ble-return-handler { | ||
#echo "ble-return-handler" | ||
local _ble_trap_suppress=1 | ||
local depth=$((${#FUNCNAME[@]}-1)) | ||
((depth)) || return 0 | ||
if [[ $bash44_traverse && ${_debug_trap_handlers[depth]+set} ]]; then | ||
_debug_trap_handlers[depth-1]=${_debug_trap_handlers[depth]} | ||
fi | ||
} | ||
|
||
#------------------------------------------------------------------------------ | ||
|
||
function f3 { | ||
builtin trap '_ble_trap_suppress=1 ble-return-handler' RETURN | ||
trap 'user-debug-handler f3' DEBUG | ||
echo f3 | ||
} | ||
function f2 { | ||
builtin trap '_ble_trap_suppress=1 ble-return-handler' RETURN | ||
echo f2:1 | ||
f3 | ||
echo f2:2 | ||
trap - DEBUG | ||
} | ||
function f1 { | ||
builtin trap '_ble_trap_suppress=1 ble-return-handler' RETURN | ||
trap 'user-debug-handler f1' DEBUG | ||
echo f1:1 | ||
f2 | ||
echo f1:3 | ||
trap - DEBUG | ||
} | ||
|
||
#------------------------------------------------------------------------------ | ||
|
||
#trap ble-debug-handler DEBUG | ||
|
||
# 通常 | ||
f1 | ||
|
||
echo ---------- | ||
trap ble-return-handler RETURN | ||
function trap { local _ble_trap_suppress=1; ble/trap-debug "$1"; } | ||
f1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# bashrc -*- mode: sh-bash; -*- | ||
|
||
sub=T0005.source-arguments-in-func.source.sh | ||
|
||
function sourcer1 { source "$sub"; } | ||
function sourcer2 { source "$sub" x; } | ||
|
||
sourcer1 A B C | ||
sourcer2 A B C | ||
shopt -s extdebug | ||
sourcer1 A B C | ||
sourcer2 A B C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- mode: sh; mode: sh-bash -*- | ||
|
||
args=("$0" "$@") | ||
declare -p args | ||
declare -p FUNCNAME | ||
declare -p BASH_LINENO | ||
declare -p BASH_SOURCE | ||
declare -p BASH_ARGC | ||
declare -p BASH_ARGV | ||
|
||
# 呼び出しを行った後で extdebug を実行しても意味ない | ||
# shopt -s extdebug | ||
# declare -p BASH_ARGC | ||
# declare -p BASH_ARGV | ||
# shopt -u extdebug | ||
echo ---------------------------------------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
if [[ ! $_ble_bash ]]; then | ||
echo 'benchmark: Please source from a ble session.' >&2 | ||
return 1 | ||
fi | ||
|
||
function measure-array.1 { | ||
local N=$1 | ||
eval "local -a a=({1..$N})" | ||
ble-measure "$2" | ||
} | ||
function measure-array { | ||
measure-array.1 10 "$1 10 " | ||
measure-array.1 100 "$1 100 " | ||
measure-array.1 1000 "$1 1000 " | ||
measure-array.1 10000 "$1 10000 " | ||
measure-array.1 100000 "$1 100000" | ||
} | ||
function sum-forward { local s=0; for ((i=0;i<N;i++)); do ((s+=a[i])); done ; } | ||
function sum-backward { local s=0; for ((i=N;--i>=0;)); do ((s+=a[i])); done ; } | ||
function sum-random { local s=0; for ((i=0;i<N;i++)); do ((s+=a[RANDOM%N])); done; } | ||
|
||
measure-array sum-forward | ||
measure-array sum-backward | ||
measure-array sum-random | ||
|
||
# bash-dev | ||
# 38.371 usec/eval: sum-forward 10 (x5000) | ||
# 311.913 usec/eval: sum-forward 100 (x500) | ||
# 3046.322 usec/eval: sum-forward 1000 (x50) | ||
# 30699.500 usec/eval: sum-forward 10000 (x5) | ||
# 309013.300 usec/eval: sum-forward 100000 (x1) | ||
# 33.804 usec/eval: sum-backward 10 (x5000) | ||
# 269.811 usec/eval: sum-backward 100 (x500) | ||
# 2645.302 usec/eval: sum-backward 1000 (x50) | ||
# 26564.500 usec/eval: sum-backward 10000 (x5) | ||
# 266084.300 usec/eval: sum-backward 100000 (x1) | ||
# 45.826 usec/eval: sum-random 10 (x5000) | ||
# 399.209 usec/eval: sum-random 100 (x500) | ||
# 4580.182 usec/eval: sum-random 1000 (x50) | ||
# 135904.300 usec/eval: sum-random 10000 (x1) | ||
# 3693072.300 usec/eval: sum-random 100000 (x1) | ||
|
||
# bash-5.0 | ||
# 38.723 usec/eval: sum-forward 10 (x5000) | ||
# 322.861 usec/eval: sum-forward 100 (x500) | ||
# 3188.720 usec/eval: sum-forward 1000 (x50) | ||
# 31446.200 usec/eval: sum-forward 10000 (x5) | ||
# 317422.600 usec/eval: sum-forward 100000 (x1) | ||
# 34.875 usec/eval: sum-backward 10 (x5000) | ||
# 286.639 usec/eval: sum-backward 100 (x500) | ||
# 2826.220 usec/eval: sum-backward 1000 (x50) | ||
# 27921.600 usec/eval: sum-backward 10000 (x5) | ||
# 283819.600 usec/eval: sum-backward 100000 (x1) | ||
# 46.838 usec/eval: sum-random 10 (x2000) | ||
# 414.663 usec/eval: sum-random 100 (x500) | ||
# 5517.050 usec/eval: sum-random 1000 (x20) | ||
# 123421.600 usec/eval: sum-random 10000 (x1) | ||
# 4942400.600 usec/eval: sum-random 100000 (x1) | ||
|
||
# bash-4.4 | ||
# 41.660 usec/eval: sum-forward 10 (x5000) | ||
# 354.000 usec/eval: sum-forward 100 (x500) | ||
# 3416.000 usec/eval: sum-forward 1000 (x50) | ||
# 34200.000 usec/eval: sum-forward 10000 (x5) | ||
# 347000.000 usec/eval: sum-forward 100000 (x1) | ||
# 37.060 usec/eval: sum-backward 10 (x5000) | ||
# 316.000 usec/eval: sum-backward 100 (x500) | ||
# 5095.000 usec/eval: sum-backward 1000 (x20) | ||
# 242000.000 usec/eval: sum-backward 10000 (x1) | ||
# 19999000.000 usec/eval: sum-backward 100000 (x1) | ||
# 51.050 usec/eval: sum-random 10 (x2000) | ||
# 454.000 usec/eval: sum-random 100 (x500) | ||
# 5895.000 usec/eval: sum-random 1000 (x20) | ||
# 172000.000 usec/eval: sum-random 10000 (x1) | ||
# 4577000.000 usec/eval: sum-random 100000 (x1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters