mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Don’t rebuild the character table every line.
This change halves execution time on my machine. hg-commit-id: aa8e5c92d38c
This commit is contained in:
parent
89d8ad4fd2
commit
98a00bc025
19
textpre.awk
19
textpre.awk
|
@ -1,15 +1,6 @@
|
||||||
BEGIN {
|
BEGIN {
|
||||||
FS = "\""
|
FS = "\""
|
||||||
}
|
|
||||||
|
|
||||||
# skip lines that actually do use ASCII in quotes
|
|
||||||
tolower($1) ~ /section/ ||
|
|
||||||
tolower($1) ~ /include/ ||
|
|
||||||
tolower($1) ~ /incbin/
|
|
||||||
|
|
||||||
!(tolower($1) ~ /section/ || tolower($1) ~ /include/ || tolower($1) ~ /incbin/) {
|
|
||||||
i = 1
|
|
||||||
ORS = ""
|
|
||||||
char[" "] = "$7F"
|
char[" "] = "$7F"
|
||||||
char["A"] = "$80"
|
char["A"] = "$80"
|
||||||
char["B"] = "$81"
|
char["B"] = "$81"
|
||||||
|
@ -80,6 +71,16 @@ char["6"] = "$FC"
|
||||||
char["7"] = "$FD"
|
char["7"] = "$FD"
|
||||||
char["8"] = "$FE"
|
char["8"] = "$FE"
|
||||||
char["9"] = "$FF"
|
char["9"] = "$FF"
|
||||||
|
}
|
||||||
|
|
||||||
|
# skip lines that actually do use ASCII in quotes
|
||||||
|
tolower($1) ~ /section/ ||
|
||||||
|
tolower($1) ~ /include/ ||
|
||||||
|
tolower($1) ~ /incbin/
|
||||||
|
|
||||||
|
!(tolower($1) ~ /section/ || tolower($1) ~ /include/ || tolower($1) ~ /incbin/) {
|
||||||
|
i = 1
|
||||||
|
ORS = ""
|
||||||
|
|
||||||
while (i <= NF) {
|
while (i <= NF) {
|
||||||
if (i % 2 == 1)
|
if (i % 2 == 1)
|
||||||
|
|
Loading…
Reference in a new issue