mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng17] Accept "," as separator in options.awk
This commit is contained in:
parent
395ddbd318
commit
9f7f03a3c4
@ -252,46 +252,71 @@ $1 == "file" && NF >= 2{
|
|||||||
# be later) entry may turn an option on or off explicitly.
|
# be later) entry may turn an option on or off explicitly.
|
||||||
|
|
||||||
$1 == "option" && NF >= 2{
|
$1 == "option" && NF >= 2{
|
||||||
onoff = option[$2] # records current (and the default is "", enabled)
|
opt = $2
|
||||||
|
sub(/,$/,"",opt)
|
||||||
|
onoff = option[opt] # records current (and the default is "", enabled)
|
||||||
key = ""
|
key = ""
|
||||||
for (i=3; i<=NF; ++i) {
|
istart = 3
|
||||||
if ($(i) == "on" || $(i) == "off" || $(i) == "disabled") {
|
do {
|
||||||
|
if (istart == 1) { # continuation line
|
||||||
|
val = getline
|
||||||
|
|
||||||
|
if (val != 1) { # error reading it
|
||||||
|
if (val == 0)
|
||||||
|
print "option", opt ": ERROR: missing contination line"
|
||||||
|
else
|
||||||
|
print "option", opt ": ERROR: error reading continuation line"
|
||||||
|
|
||||||
|
# This is a hard error
|
||||||
|
err = 1 # prevent END{} running
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=istart; i<=NF; ++i) {
|
||||||
|
val=$(i)
|
||||||
|
sub(/,$/,"",val)
|
||||||
|
if (val == "on" || val == "off" || val == "disabled") {
|
||||||
key = ""
|
key = ""
|
||||||
if (onoff != $(i)) {
|
if (onoff != val) {
|
||||||
# on or off can zap disabled or enabled:
|
# on or off can zap disabled or enabled:
|
||||||
if (onoff == "" || (onoff == "disabled" || onoff == "enabled") && ($(i) == "on" || $(i) == "off")) {
|
if (onoff == "" || (onoff == "disabled" || onoff == "enabled") &&
|
||||||
|
(val == "on" || val == "off")) {
|
||||||
# It's easy to mis-spell the option when turning it
|
# It's easy to mis-spell the option when turning it
|
||||||
# on or off, so warn about it here:
|
# on or off, so warn about it here:
|
||||||
if (onoff == "" && ($(i) == "on" || $(i) == "off")) {
|
if (onoff == "" && (val == "on" || val == "off")) {
|
||||||
print $2 ": ERROR: turning unrecognized option", $(i)
|
print "option", opt ": ERROR: turning unrecognized option", val
|
||||||
# For the moment error out - it is safer
|
# For the moment error out - it is safer
|
||||||
err = 1 # prevent END{} running
|
err = 1 # prevent END{} running
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
onoff = $(i)
|
onoff = val
|
||||||
} else {
|
} else {
|
||||||
# Print a message, otherwise the error
|
# Print a message, otherwise the error
|
||||||
# below is incomprehensible
|
# below is incomprehensible
|
||||||
print $2 ": currently", onoff ": attempt to turn", $(i)
|
print "option", opt ": currently", onoff ": attempt to turn", val
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ($(i) == "requires" || $(i) == "if" || $(i) == "enables") {
|
} else if (val == "requires" || val == "if" || val == "enables") {
|
||||||
key = $(i)
|
key = val
|
||||||
} else if (key == "requires") {
|
} else if (key == "requires") {
|
||||||
requires[$2] = requires[$2] " " $(i)
|
requires[opt] = requires[opt] " " val
|
||||||
} else if (key == "if") {
|
} else if (key == "if") {
|
||||||
iffs[$2] = iffs[$2] " " $(i)
|
iffs[opt] = iffs[opt] " " val
|
||||||
} else if (key == "enables") {
|
} else if (key == "enables") {
|
||||||
enabledby[$(i)] = enabledby[$(i)] " " $2
|
enabledby[val] = enabledby[val] " " opt
|
||||||
} else
|
} else
|
||||||
break # bad line format
|
break # bad line format
|
||||||
}
|
}
|
||||||
|
|
||||||
|
istart = 1
|
||||||
|
} while (i > NF && $0 ~ /,$/)
|
||||||
|
|
||||||
if (i > NF) {
|
if (i > NF) {
|
||||||
# Set the option, defaulting to 'enabled'
|
# Set the option, defaulting to 'enabled'
|
||||||
if (onoff == "") onoff = "enabled"
|
if (onoff == "") onoff = "enabled"
|
||||||
option[$2] = onoff
|
option[opt] = onoff
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
# Else fall through to the error handler
|
# Else fall through to the error handler
|
||||||
@ -311,41 +336,62 @@ $1 == "option" && NF >= 2{
|
|||||||
pre != 0 && $1 == "chunk" && NF >= 2{
|
pre != 0 && $1 == "chunk" && NF >= 2{
|
||||||
# 'chunk' is handled on the first pass by writing appropriate
|
# 'chunk' is handled on the first pass by writing appropriate
|
||||||
# 'option' lines into the intermediate file.
|
# 'option' lines into the intermediate file.
|
||||||
|
opt = $2
|
||||||
|
sub(/,$/,"",opt)
|
||||||
onoff = ""
|
onoff = ""
|
||||||
reqread = ""
|
reqread = ""
|
||||||
reqwrite = ""
|
reqwrite = ""
|
||||||
enables = ""
|
enables = ""
|
||||||
i = 3 # indicates format error
|
|
||||||
if (NF > 2) {
|
|
||||||
# read the keywords/additional OPTS
|
|
||||||
req = 0
|
req = 0
|
||||||
for (i=3; i<=NF; ++i) {
|
istart = 3
|
||||||
if ($(i) == "on" || $(i) == "off" || $(i) == "disabled") {
|
do {
|
||||||
if (onoff != $(i)) {
|
if (istart == 1) { # continuation line
|
||||||
|
val = getline
|
||||||
|
|
||||||
|
if (val != 1) { # error reading it
|
||||||
|
if (val == 0)
|
||||||
|
print "chunk", opt ": ERROR: missing contination line"
|
||||||
|
else
|
||||||
|
print "chunk", opt ": ERROR: error reading continuation line"
|
||||||
|
|
||||||
|
# This is a hard error
|
||||||
|
err = 1 # prevent END{} running
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# read the keywords/additional OPTS
|
||||||
|
for (i=istart; i<=NF; ++i) {
|
||||||
|
val = $(i)
|
||||||
|
sub(/,$/,"",val)
|
||||||
|
if (val == "on" || val == "off" || val == "disabled") {
|
||||||
|
if (onoff != val) {
|
||||||
if (onoff == "")
|
if (onoff == "")
|
||||||
onoff = $(i)
|
onoff = val
|
||||||
else
|
else
|
||||||
break # on/off conflict
|
break # on/off conflict
|
||||||
}
|
}
|
||||||
req = 0
|
req = 0
|
||||||
} else if ($(i) == "requires")
|
} else if (val == "requires")
|
||||||
req = 1
|
req = 1
|
||||||
else if ($(i) == "enables")
|
else if (val == "enables")
|
||||||
req = 2
|
req = 2
|
||||||
else if (req == 1){
|
else if (req == 1){
|
||||||
reqread = reqread " READ_" $(i)
|
reqread = reqread " READ_" val
|
||||||
reqwrite = reqwrite " WRITE_" $(i)
|
reqwrite = reqwrite " WRITE_" val
|
||||||
} else if (req == 2)
|
} else if (req == 2)
|
||||||
enables = enables " " $(i)
|
enables = enables " " val
|
||||||
else
|
else
|
||||||
break # bad line: handled below
|
break # bad line: handled below
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
istart = 1
|
||||||
|
} while (i > NF && $0 ~ /,$/)
|
||||||
|
|
||||||
if (i > NF) {
|
if (i > NF) {
|
||||||
# Output new 'option' lines to the intermediate file (out)
|
# Output new 'option' lines to the intermediate file (out)
|
||||||
print "option READ_" $2, "requires READ_ANCILLARY_CHUNKS" reqread, "enables", $2 enables , onoff >out
|
print "option READ_" opt, "requires READ_ANCILLARY_CHUNKS" reqread, "enables", opt enables , onoff >out
|
||||||
print "option WRITE_" $2, "requires WRITE_ANCILLARY_CHUNKS" reqwrite, "enables", $2 enables, onoff >out
|
print "option WRITE_" opt, "requires WRITE_ANCILLARY_CHUNKS" reqwrite, "enables", opt enables, onoff >out
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
# Else hit the error handler below - bad line format!
|
# Else hit the error handler below - bad line format!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user