Re: improvements in Unicode tables generation code

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: improvements in Unicode tables generation code
Date: 2021-06-22 08:20:46
Message-ID: f77d3a96-f2bf-662a-4a98-7ed7a9dc45fa@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

> v1-0002-Make-UCS_to_most.pl-process-encodings-in-sorted-o.patch
>
> This mainly just helps eyeball the output while debugging the previous
> patch.

+1

> 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.

> 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?

If we want to avoid the stray commas (and I think they are a little
ugly, but that's a matter of taste), we could adopt the approach that
print_radix_table() uses to avoid the comma. That seems simpler than
what print_from_utf8_combined_map and print_to_utf8_combined_map are doing.

> v1-0005-Fix-indentation-in-generated-output.patch
>
> This changes the indentation in the output from two spaces to a tab.
>
> I haven't included the actual output changes in the last patch, because
> they would be huge, but the idea should be clear.
>
> All together, these make the output look closer to how pgindent would
> make it.

Thanks!

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-06-22 08:33:07 Re: improvements in Unicode tables generation code
Previous Message Kyotaro Horiguchi 2021-06-22 08:17:26 Re: improvements in Unicode tables generation code