Re: improvements in Unicode tables generation code

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Heikki Linnakangas <hlinnaka@iki.fi>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-06-23T08:55:41Z
Lists: pgsql-hackers
On 22.06.21 10:20, Heikki Linnakangas wrote:
> On 22/06/2021 10:20, Peter Eisentraut wrote:
>> I have accumulated a few patches to improve the output of the scripts in
>> src/backend/utils/mb/Unicode/ to be less non-standard-looking and fix a
>> few other minor things in that area.
>>
>> v1-0001-Make-Unicode-makefile-more-parallel-safe.patch
>>
>> The makefile rule that calls UCS_to_most.pl was written incorrectly for
>> parallel make.  The script writes all output files in one go, but the
>> rule as written would call the command once for each output file in
>> parallel.
> 
> This could use a comment. At a quick glance, I don't understand what all 
> the $(wordlist ...) magic does.
> 
> Perhaps we should change the script or Makefile so that it doesn't 
> create all the maps in one go?

I agree, either comment it better or just write one file at a time. 
I'll take another look at that.

>> v1-0003-Remove-some-whitespace-in-generated-C-output.patch
>>
>> Improve a small formatting issue in the output.
> 
> I'm surprised the added \n in the perl code didn't result in extra 
> newlines in the outputs.

True, I'll have to check that again.  I suspect that \n actually belongs 
to patch 0004.

>> v1-0004-Simplify-code-generation-code.patch
>>
>> This simplifies the code a bit, which helps with the next patch.
> 
> If we do that, let's add the trailing commas to the other arrays too, 
> not just the combined maps.
> 
> No objection, but how does this help the next patch?

Mainly it just moves things around so that each print normally starts at 
the beginning of a line and concludes with a \n.



Commits

  1. Make Unicode makefile parallel-safe

  2. Remove some whitespace in generated C output

  3. Make UCS_to_most.pl process encodings in sorted order