]>
git.saurik.com Git - wxWidgets.git/blob - src/regex/mkh
2 # mkh - pull headers out of C source
3 PATH
=/bin
:/usr
/bin
; export PATH
5 # egrep pattern to pick out marked lines
8 # Sed program to process marked lines into lines for the header file.
9 # The markers have already been removed. Two things are done here: removal
10 # of backslashed newlines, and some fudging of comments. The first is done
11 # because -o needs to have prototypes on one line to strip them down.
12 # Getting comments into the output is tricky; we turn C++-style // comments
13 # into /* */ comments, after altering any existing */'s to avoid trouble.
17 /\/\//s;//\(.*\);/*\1 */;'
22 -o) # old (pre-function-prototype) compiler
23 # add code to comment out argument lists
25 "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1(/*\2*/);'
28 -b) # funny Berkeley __P macro
30 "'/^\([^#\/][^\/]*[a-zA-Z0-9_)]\)(\(.*\))/s;;\1 __P((\2));'
33 -s) # compiler doesn't like `static foo();'
34 # add code to get rid of the `static'
36 "'/^static[ ][^\/]*[a-zA-Z0-9_)](.*)/s;static.;;'
39 -p) # private declarations
43 -i) # wrap in #ifndef, argument is name
52 if test " $ifndef" != " "
54 echo "#ifndef $ifndef"
55 echo "#define $ifndef /* never again */"
57 echo "/* ========= begin header generated by $0 ========= */"
58 echo '#ifdef __cplusplus'
64 echo "/* === $f === */"
65 egrep "$egrep" $f | sed 's/^ ==*[ ]//;s/^ ==*$//' | sed "$peel"
68 echo '#ifdef __cplusplus'
71 echo "/* ========= end header generated by $0 ========= */"
72 if test " $ifndef" != " "