📄 mkh
字号:
#! /bin/sh# mkh - pull headers out of C sourcePATH=/bin:/usr/bin ; export PATH# egrep pattern to pick out marked linesegrep='^ =([ ]|$)'# Sed program to process marked lines into lines for the header file.# The markers have already been removed. Two things are done here: removal# of backslashed newlines, and some fudging of comments. The first is done# because -o needs to have prototypes on one line to strip them down.# Getting comments into the output is tricky; we turn C++-style // comments# into /* */ comments, after altering any existing */'s to avoid trouble.peel=' /\\$/N /\\\n[ ]*/s///g /\/\//s;\*/;* /;g /\/\//s;//\(.*\);/*\1 */;'for ado case "$a" in -o) # old (pre-function-prototype) compiler # add code to comment out argument lists peel="$peel "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);' shift ;; -b) # funny Berkeley __P macro peel="$peel "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));' shift ;; -s) # compiler doesn't like `static foo();' # add code to get rid of the `static' peel="$peel "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;' shift ;; -p) # private declarations egrep='^ ==([ ]|$)' shift ;; -i) # wrap in #ifndef, argument is name ifndef="$2" shift ; shift ;; *) break ;; esacdoneif test " $ifndef" != " "then echo "#ifndef $ifndef" echo "#define $ifndef /* never again */"fiecho "/* ========= begin header generated by $0 ========= */"echo '#ifdef __cplusplus'echo 'extern "C" {'echo '#endif'for fdo echo echo "/* === $f === */" egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel" echodoneecho '#ifdef __cplusplus'echo '}'echo '#endif'echo "/* ========= end header generated by $0 ========= */"if test " $ifndef" != " "then echo "#endif"fiexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -