kbde.awk

来自「开源的键盘模拟程序」· AWK 代码 · 共 51 行

AWK
51
字号
function NeedSkipLine(){   if ($0 ~ "^[[:blank:]]*#") return 1; # Skip comment line   if ($0 ~ "^[[:blank:]]*$") return 1; # Skip empty   line   return 0}function StripSpaces(String){   gsub("^[[:blank:]]+",           "" , String); # Streap leading whitespace   gsub("[[:blank:]]+$",           "" , String); # Streap tailing whitespace   gsub("[[:blank:]][[:blank:]]+", " ", String); # multiple whitespace to one   return String;}function print_c_do_not_change(){      print "/*"   print " * Don't change this file, it was generated automatically"   print " */"   print ""}BEGIN {   FS = ":"   Define_Prefix = "KBDE_KEY_";   MaxDefine = 0;   Quote = "\"";}{   if (NeedSkipLine() ) next; # Skip comment line or empty line   # Remove white-spaces   Name     = StripSpaces($1);   Define   = StripSpaces($2);   Make     = StripSpaces($3);   Break    = StripSpaces($4);   Label    = StripSpaces($5);   AddLabel = StripSpaces($6);   Names[Define]     = Name;   Makes[Define]     = Make;   Breaks[Define]    = Break;   Labels[Define]    = Label;   AddLabels[Define] = AddLabel;   if (int(Define) > int(MaxDefine)) MaxDefine = Define;}  END {      print_func();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?