mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +03:00
Additional unicode primitive functions.
Introduce unicode_version(), icu_unicode_version(), and unicode_assigned(). The latter requires introducing a new lookup table for the Unicode General Category, which is generated along with the other Unicode lookup tables. Discussion: https://postgr.es/m/CA+TgmoYzYR-yhU6k1XFCADeyj=Oyz2PkVsa3iKv+keM8wp-F_A@mail.gmail.com Reviewed-by: Peter Eisentraut
This commit is contained in:
46
src/common/unicode/generate-unicode_version.pl
Normal file
46
src/common/unicode/generate-unicode_version.pl
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Generate header file with Unicode version used by Postgres.
|
||||
#
|
||||
# Output: unicode_version.h
|
||||
#
|
||||
# Copyright (c) 2000-2023, PostgreSQL Global Development Group
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long;
|
||||
|
||||
use FindBin;
|
||||
use lib "$FindBin::RealBin/../../tools/";
|
||||
|
||||
my $output_path = '.';
|
||||
my $version_str = undef;
|
||||
|
||||
GetOptions('outdir:s' => \$output_path, 'version:s' => \$version_str);
|
||||
|
||||
my @version_parts = split /\./, $version_str;
|
||||
|
||||
my $unicode_version_str = sprintf "%d.%d", $version_parts[0], $version_parts[1];
|
||||
|
||||
my $output_file = "$output_path/unicode_version.h";
|
||||
|
||||
# Start writing out the output files
|
||||
open my $OT, '>', $output_file
|
||||
or die "Could not open output file $output_file: $!\n";
|
||||
|
||||
print $OT <<HEADER;
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* unicode_version.h
|
||||
* Unicode version used by Postgres.
|
||||
*
|
||||
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/common/unicode_version.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#define PG_UNICODE_VERSION "$unicode_version_str"
|
||||
HEADER
|
||||
Reference in New Issue
Block a user