On 21/02/2017 20:37, Hermann Peifer wrote:
> On 21/02/2017 15:28, Digi wrote:
>> Hi!
>>
>> i have an issue with the script composed by --pretty-print option.
>> the original source containing more than 30 includes with the total size around 500 kb. so i was needed to compose its into the large single source file. i found that --pretty-print option may be used for this. but the resulted source have different behaviour than the original script. due to huge size of the source currently i have no idea what exactly is wrong with the script generated by the --pretty-print
>>
>
> Which version of Gawk are you using?
> Why exactly is a single source file needed?
>
> A source code size of 500k means something like 10000-20000 lines of
> code (my best guess). The Gawk manual gives this hint:
>
>> If you find yourself writing awk scripts of more than, say,
>> a few hundred lines, you might consider using a different
>> programming language.
>
https://www.gnu.org/software/gawk/manual/html_node/When.html#When
>
> Hermann
>
I forgot to give an example where pretty-printing changes the code, see
below. In earlier versions of gawk, pretty-print would also print
integers with format "%.6g" which might change the code.
# Gawk 4.1.4
$ /opt/local/bin/gawk -o- 'BEGIN{ x = .9999999 }'
# gawk profile, created Tue Feb 21 20:42:21 2017
# BEGIN rule(s)
BEGIN {
x = 1
}
# Gawk from git/master
$ gawk -o- 'BEGIN{ x = .9999999 }'
BEGIN {
x = .9999999
}