# Bereinigt MSVC-generierte RC-Dateien zu einer menschenlesbaren Form
# und entfernt (später!) überflüssige VERSIONINFO-Values
/^#ifdef / {
if ($2 == "_DEBUG") {
ignore_if=1;
print;
next;
}else if ($2 == "_WIN32") {
if (if_nest==suppress_above) suppress_above++; # TRUE conditional
}
if_nest++; # FALSE conditional: if_nest > suppress_above
next;
}
/^#ifndef / {
(if_nest==suppress_above) suppress_above++; # TRUE conditional
if_nest++;
next;
}
/^#if / {
(if_nest==suppress_above) suppress_above++; # TRUE conditional
if_nest++;
next;
}
/^#endif/ {
if (ignore_if) {
ignore_if=0; # case "_DEBUG" inside VERSIONINFO
print;
next;
}else if_nest--;
if (suppress_above>if_nest) suppress_above=if_nest;
next;
}
/^\/\// { # remove comment lines completely
next;
}
/^#define / {
next;
}
/^#undef / {
next;
}
/^ *BEGIN$/ {
sub(/BEGIN/,"{");
}
/^ *END$/ {
sub(/END/,"}");
}
{
if (if_nest > suppress_above) next;
if (/^ *$/) { # empty line?
if (prev_line_empty) next; # put out only one
prev_line_empty=1;
}else prev_line_empty=0;
indent=0;
while (/^ /) {
sub(/^ /," "); # use less indention
indent++;
}
if ($1 ~ /^[0-9]+$/) { # first argument a number?
$0=gensub(/([0-9]+) +/,"\\1 ",1); # remove trailing spaces leaving one
}else if ((indent==1) && ($0 ~ /^ [A-Z]+ /)) {
$0=gensub(/( [A-Z]+) /,"\\1 ",1); # remove one space for later tab replacement (dialog resources)
}
buf=$0;
while (buf ~ /[|,] *$/) { # more than one line?
getline; # fetch following line
sub(/^ */,""); # remove leading spaces from next line
buf = buf $0; # concatenate
}
if ($1 !~ /^[0-9]+$/) gsub(/ \| /,"|",buf); # problematic if " | " is inside double quotes too
gsub(/IDC_STATIC/,"-1",buf);
print buf;
}
END {
}
Detected encoding: ANSI (CP1252) | 4
|
|