blob: 242d035a778f14f7f7449ee713c44dc2e9a916c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
:
# create macro calls for all defines in the file
# src/tools/pginclude/pgdefine
trap "rm -f /tmp/$$" 0 1 2 3 15
for FILE
do
cat "$FILE" | grep "^#define" >/tmp/$$
cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*\)[ ][ ]*[^ ].*\\\\$/\1;/p'
cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*\)[ ][ ]*[^ ].*[^\\\\]$/(void)\1;/p'
(
cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*([^)]*)\).*\\\\$/\1;/p'
cat /tmp/$$ | sed -n 's/^#define[ ][ ]*\([a-zA-Z0-9_]*([^)]*)\).*[^\\\\]$/(=void)\1;/p'
) |
sed 's/([a-zA-Z0-9_ ][a-zA-Z0-9_ ]*)/(0)/g' |
sed 's/([a-zA-Z0-9_ ]*,/(0,/g' |
sed 's/,[a-zA-Z0-9_ ]*,/,0,/g' |
sed 's/,[a-zA-Z0-9_ ]*)/,0)/g' |
# do not cast 'return' macros as (void)
sed 's/(=void)\(.*return\)/\1/g' |
sed 's/(=void)\(.*RETURN\)/\1/g' |
sed 's/(=void)/(void)/g'
done
|