Commit 876c7009 authored by Bruce Momjian's avatar Bruce Momjian

Make extern C handling more flexible.

parent 149d13de
...@@ -67,11 +67,14 @@ do ...@@ -67,11 +67,14 @@ do
line2 = $0; line2 = $0;
if (skips > 0) if (skips > 0)
skips--; skips--;
if (line1 ~ "^extern[ ]*\"C\"" && if (line1 ~ "^#ifdef[ ]*__cplusplus" &&
line2 ~ "^{[ ]*$") line2 ~ "^extern[ ]*\"C\"[ ]*$")
{ {
# do not print first line print line1;
print line2;
if (getline && $0 ~ /^{[ ]*$/)
print "/* Open extern \"C\" */"; print "/* Open extern \"C\" */";
else print $0;
line2 = ""; line2 = "";
skips = 2; skips = 2;
} }
...@@ -1490,8 +1493,7 @@ do ...@@ -1490,8 +1493,7 @@ do
# remove tabs and retab with four spaces # remove tabs and retab with four spaces
detab -t8 -qc | detab -t8 -qc |
entab -t4 -qc | entab -t4 -qc |
sed 's;^/\* Open extern \"C\" \*/$;extern "C"\ sed 's;^/\* Open extern \"C\" \*/$;{;' |
{;' |
sed 's;^/\* Close extern \"C\" \*/$;};' | sed 's;^/\* Close extern \"C\" \*/$;};' |
sed 's;/\*---X_X;/* ---;g' | sed 's;/\*---X_X;/* ---;g' |
# workaround indent bug # workaround indent bug
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment